File: nic_properties.py

package info (click to toggle)
python-ionoscloud 6.1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,084 kB
  • sloc: python: 44,694; makefile: 4
file content (457 lines) | stat: -rw-r--r-- 16,679 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# coding: utf-8

"""
    CLOUD API

     IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool.    Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on.  # noqa: E501

    The version of the OpenAPI document: 6.0
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from ionoscloud.configuration import Configuration


class NicProperties(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    openapi_types = {

        'name': 'str',

        'mac': 'str',

        'ips': 'list[str]',

        'dhcp': 'bool',

        'ipv6_ips': 'list[str]',

        'ipv6_cidr_block': 'str',

        'dhcpv6': 'bool',

        'lan': 'int',

        'firewall_active': 'bool',

        'firewall_type': 'str',

        'device_number': 'int',

        'pci_slot': 'int',
    }

    attribute_map = {

        'name': 'name',

        'mac': 'mac',

        'ips': 'ips',

        'dhcp': 'dhcp',

        'ipv6_ips': 'ipv6Ips',

        'ipv6_cidr_block': 'ipv6CidrBlock',

        'dhcpv6': 'dhcpv6',

        'lan': 'lan',

        'firewall_active': 'firewallActive',

        'firewall_type': 'firewallType',

        'device_number': 'deviceNumber',

        'pci_slot': 'pciSlot',
    }

    def __init__(self, name=None, mac=None, ips=None, dhcp=True, ipv6_ips=None, ipv6_cidr_block=None, dhcpv6=None, lan=None, firewall_active=None, firewall_type=None, device_number=None, pci_slot=None, local_vars_configuration=None):  # noqa: E501
        """NicProperties - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._name = None
        self._mac = None
        self._ips = None
        self._dhcp = None
        self._ipv6_ips = None
        self._ipv6_cidr_block = None
        self._dhcpv6 = None
        self._lan = None
        self._firewall_active = None
        self._firewall_type = None
        self._device_number = None
        self._pci_slot = None
        self.discriminator = None

        if name is not None:
            self.name = name
        if mac is not None:
            self.mac = mac
        self.ips = ips
        if dhcp is not None:
            self.dhcp = dhcp
        self.ipv6_ips = ipv6_ips
        self.ipv6_cidr_block = ipv6_cidr_block
        self.dhcpv6 = dhcpv6
        self.lan = lan
        if firewall_active is not None:
            self.firewall_active = firewall_active
        if firewall_type is not None:
            self.firewall_type = firewall_type
        if device_number is not None:
            self.device_number = device_number
        if pci_slot is not None:
            self.pci_slot = pci_slot


    @property
    def name(self):
        """Gets the name of this NicProperties.  # noqa: E501

        The name of the  resource.  # noqa: E501

        :return: The name of this NicProperties.  # noqa: E501
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this NicProperties.

        The name of the  resource.  # noqa: E501

        :param name: The name of this NicProperties.  # noqa: E501
        :type name: str
        """

        self._name = name

    @property
    def mac(self):
        """Gets the mac of this NicProperties.  # noqa: E501

        The MAC address of the NIC.  # noqa: E501

        :return: The mac of this NicProperties.  # noqa: E501
        :rtype: str
        """
        return self._mac

    @mac.setter
    def mac(self, mac):
        """Sets the mac of this NicProperties.

        The MAC address of the NIC.  # noqa: E501

        :param mac: The mac of this NicProperties.  # noqa: E501
        :type mac: str
        """

        self._mac = mac

    @property
    def ips(self):
        """Gets the ips of this NicProperties.  # noqa: E501

        Collection of IP addresses, assigned to the NIC. Explicitly assigned public IPs need to come from reserved IP blocks. Passing value null or empty array will assign an IP address automatically.  # noqa: E501

        :return: The ips of this NicProperties.  # noqa: E501
        :rtype: list[str]
        """
        return self._ips

    @ips.setter
    def ips(self, ips):
        """Sets the ips of this NicProperties.

        Collection of IP addresses, assigned to the NIC. Explicitly assigned public IPs need to come from reserved IP blocks. Passing value null or empty array will assign an IP address automatically.  # noqa: E501

        :param ips: The ips of this NicProperties.  # noqa: E501
        :type ips: list[str]
        """

        self._ips = ips

    @property
    def dhcp(self):
        """Gets the dhcp of this NicProperties.  # noqa: E501

        Indicates if the NIC will reserve an IP using DHCP.  # noqa: E501

        :return: The dhcp of this NicProperties.  # noqa: E501
        :rtype: bool
        """
        return self._dhcp

    @dhcp.setter
    def dhcp(self, dhcp):
        """Sets the dhcp of this NicProperties.

        Indicates if the NIC will reserve an IP using DHCP.  # noqa: E501

        :param dhcp: The dhcp of this NicProperties.  # noqa: E501
        :type dhcp: bool
        """

        self._dhcp = dhcp

    @property
    def ipv6_ips(self):
        """Gets the ipv6_ips of this NicProperties.  # noqa: E501

        If this NIC is connected to an IPv6 enabled LAN then this property contains the IPv6 IP addresses of the NIC. The maximum number of IPv6 IP addresses per NIC is 50, if you need more, contact support. If you leave this property 'null' when adding a NIC, when changing the NIC's IPv6 CIDR block, when changing the LAN's IPv6 CIDR block or when moving the NIC to a different IPv6 enabled LAN, then we will automatically assign the same number of IPv6 addresses which you had before from the NICs new CIDR block. If you leave this property 'null' while not changing the CIDR block, the IPv6 IP addresses won't be changed either. You can also provide your own self choosen IPv6 addresses, which then must be inside the IPv6 CIDR block of this NIC.  # noqa: E501

        :return: The ipv6_ips of this NicProperties.  # noqa: E501
        :rtype: list[str]
        """
        return self._ipv6_ips

    @ipv6_ips.setter
    def ipv6_ips(self, ipv6_ips):
        """Sets the ipv6_ips of this NicProperties.

        If this NIC is connected to an IPv6 enabled LAN then this property contains the IPv6 IP addresses of the NIC. The maximum number of IPv6 IP addresses per NIC is 50, if you need more, contact support. If you leave this property 'null' when adding a NIC, when changing the NIC's IPv6 CIDR block, when changing the LAN's IPv6 CIDR block or when moving the NIC to a different IPv6 enabled LAN, then we will automatically assign the same number of IPv6 addresses which you had before from the NICs new CIDR block. If you leave this property 'null' while not changing the CIDR block, the IPv6 IP addresses won't be changed either. You can also provide your own self choosen IPv6 addresses, which then must be inside the IPv6 CIDR block of this NIC.  # noqa: E501

        :param ipv6_ips: The ipv6_ips of this NicProperties.  # noqa: E501
        :type ipv6_ips: list[str]
        """

        self._ipv6_ips = ipv6_ips

    @property
    def ipv6_cidr_block(self):
        """Gets the ipv6_cidr_block of this NicProperties.  # noqa: E501

        If this NIC is connected to an IPv6 enabled LAN then this property contains the /80 IPv6 CIDR block of the NIC. If you leave this property 'null' when adding a NIC to an IPv6-enabled LAN, then an IPv6 CIDR block will automatically be assigned to the NIC, but you can also specify an /80 IPv6 CIDR block for the NIC on your own, which must be inside the /64 IPv6 CIDR block of the LAN and unique. This value can only be set, if the LAN already has an IPv6 CIDR block assigned. An IPv6-enabled LAN is limited to a maximum of 65,536 NICs.  # noqa: E501

        :return: The ipv6_cidr_block of this NicProperties.  # noqa: E501
        :rtype: str
        """
        return self._ipv6_cidr_block

    @ipv6_cidr_block.setter
    def ipv6_cidr_block(self, ipv6_cidr_block):
        """Sets the ipv6_cidr_block of this NicProperties.

        If this NIC is connected to an IPv6 enabled LAN then this property contains the /80 IPv6 CIDR block of the NIC. If you leave this property 'null' when adding a NIC to an IPv6-enabled LAN, then an IPv6 CIDR block will automatically be assigned to the NIC, but you can also specify an /80 IPv6 CIDR block for the NIC on your own, which must be inside the /64 IPv6 CIDR block of the LAN and unique. This value can only be set, if the LAN already has an IPv6 CIDR block assigned. An IPv6-enabled LAN is limited to a maximum of 65,536 NICs.  # noqa: E501

        :param ipv6_cidr_block: The ipv6_cidr_block of this NicProperties.  # noqa: E501
        :type ipv6_cidr_block: str
        """

        self._ipv6_cidr_block = ipv6_cidr_block

    @property
    def dhcpv6(self):
        """Gets the dhcpv6 of this NicProperties.  # noqa: E501

        Indicates if the NIC will receive an IPv6 using DHCP. It can be set to 'true' or 'false' only if this NIC is connected to an IPv6 enabled LAN.  # noqa: E501

        :return: The dhcpv6 of this NicProperties.  # noqa: E501
        :rtype: bool
        """
        return self._dhcpv6

    @dhcpv6.setter
    def dhcpv6(self, dhcpv6):
        """Sets the dhcpv6 of this NicProperties.

        Indicates if the NIC will receive an IPv6 using DHCP. It can be set to 'true' or 'false' only if this NIC is connected to an IPv6 enabled LAN.  # noqa: E501

        :param dhcpv6: The dhcpv6 of this NicProperties.  # noqa: E501
        :type dhcpv6: bool
        """

        self._dhcpv6 = dhcpv6

    @property
    def lan(self):
        """Gets the lan of this NicProperties.  # noqa: E501

        The LAN ID the NIC will be on. If the LAN ID does not exist, it will be implicitly created.  # noqa: E501

        :return: The lan of this NicProperties.  # noqa: E501
        :rtype: int
        """
        return self._lan

    @lan.setter
    def lan(self, lan):
        """Sets the lan of this NicProperties.

        The LAN ID the NIC will be on. If the LAN ID does not exist, it will be implicitly created.  # noqa: E501

        :param lan: The lan of this NicProperties.  # noqa: E501
        :type lan: int
        """
        if self.local_vars_configuration.client_side_validation and lan is None:  # noqa: E501
            raise ValueError("Invalid value for `lan`, must not be `None`")  # noqa: E501

        self._lan = lan

    @property
    def firewall_active(self):
        """Gets the firewall_active of this NicProperties.  # noqa: E501

        Activate or deactivate the firewall. By default, an active firewall without any defined rules will block all incoming network traffic except for the firewall rules that explicitly allows certain protocols, IP addresses and ports.  # noqa: E501

        :return: The firewall_active of this NicProperties.  # noqa: E501
        :rtype: bool
        """
        return self._firewall_active

    @firewall_active.setter
    def firewall_active(self, firewall_active):
        """Sets the firewall_active of this NicProperties.

        Activate or deactivate the firewall. By default, an active firewall without any defined rules will block all incoming network traffic except for the firewall rules that explicitly allows certain protocols, IP addresses and ports.  # noqa: E501

        :param firewall_active: The firewall_active of this NicProperties.  # noqa: E501
        :type firewall_active: bool
        """

        self._firewall_active = firewall_active

    @property
    def firewall_type(self):
        """Gets the firewall_type of this NicProperties.  # noqa: E501

        The type of firewall rules that will be allowed on the NIC. If not specified, the default INGRESS value is used.  # noqa: E501

        :return: The firewall_type of this NicProperties.  # noqa: E501
        :rtype: str
        """
        return self._firewall_type

    @firewall_type.setter
    def firewall_type(self, firewall_type):
        """Sets the firewall_type of this NicProperties.

        The type of firewall rules that will be allowed on the NIC. If not specified, the default INGRESS value is used.  # noqa: E501

        :param firewall_type: The firewall_type of this NicProperties.  # noqa: E501
        :type firewall_type: str
        """
        allowed_values = ["INGRESS", "EGRESS", "BIDIRECTIONAL"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and firewall_type not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `firewall_type` ({0}), must be one of {1}"  # noqa: E501
                .format(firewall_type, allowed_values)
            )

        self._firewall_type = firewall_type

    @property
    def device_number(self):
        """Gets the device_number of this NicProperties.  # noqa: E501

        The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created using Cloud API and no DCD changes were performed on the Datacenter.  # noqa: E501

        :return: The device_number of this NicProperties.  # noqa: E501
        :rtype: int
        """
        return self._device_number

    @device_number.setter
    def device_number(self, device_number):
        """Sets the device_number of this NicProperties.

        The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created using Cloud API and no DCD changes were performed on the Datacenter.  # noqa: E501

        :param device_number: The device_number of this NicProperties.  # noqa: E501
        :type device_number: int
        """

        self._device_number = device_number

    @property
    def pci_slot(self):
        """Gets the pci_slot of this NicProperties.  # noqa: E501

        The PCI slot number for the NIC.  # noqa: E501

        :return: The pci_slot of this NicProperties.  # noqa: E501
        :rtype: int
        """
        return self._pci_slot

    @pci_slot.setter
    def pci_slot(self, pci_slot):
        """Sets the pci_slot of this NicProperties.

        The PCI slot number for the NIC.  # noqa: E501

        :param pci_slot: The pci_slot of this NicProperties.  # noqa: E501
        :type pci_slot: int
        """

        self._pci_slot = pci_slot
    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.openapi_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, NicProperties):
            return False

        return self.to_dict() == other.to_dict()

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        if not isinstance(other, NicProperties):
            return True

        return self.to_dict() != other.to_dict()