1# coding: utf-8 2# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. 3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. 4 5 6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 7from oci.decorators import init_model_state_from_kwargs 8 9 10@init_model_state_from_kwargs 11class CreateVnicDetails(object): 12 """ 13 Contains properties for a VNIC. You use this object when creating the 14 primary VNIC during instance launch or when creating a secondary VNIC. 15 For more information about VNICs, see 16 `Virtual Network Interface Cards (VNICs)`__. 17 18 __ https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingVNICs.htm 19 """ 20 21 def __init__(self, **kwargs): 22 """ 23 Initializes a new CreateVnicDetails object with values from keyword arguments. 24 The following keyword arguments are supported (corresponding to the getters/setters of this class): 25 26 :param assign_public_ip: 27 The value to assign to the assign_public_ip property of this CreateVnicDetails. 28 :type assign_public_ip: bool 29 30 :param assign_private_dns_record: 31 The value to assign to the assign_private_dns_record property of this CreateVnicDetails. 32 :type assign_private_dns_record: bool 33 34 :param defined_tags: 35 The value to assign to the defined_tags property of this CreateVnicDetails. 36 :type defined_tags: dict(str, dict(str, object)) 37 38 :param display_name: 39 The value to assign to the display_name property of this CreateVnicDetails. 40 :type display_name: str 41 42 :param freeform_tags: 43 The value to assign to the freeform_tags property of this CreateVnicDetails. 44 :type freeform_tags: dict(str, str) 45 46 :param hostname_label: 47 The value to assign to the hostname_label property of this CreateVnicDetails. 48 :type hostname_label: str 49 50 :param nsg_ids: 51 The value to assign to the nsg_ids property of this CreateVnicDetails. 52 :type nsg_ids: list[str] 53 54 :param private_ip: 55 The value to assign to the private_ip property of this CreateVnicDetails. 56 :type private_ip: str 57 58 :param skip_source_dest_check: 59 The value to assign to the skip_source_dest_check property of this CreateVnicDetails. 60 :type skip_source_dest_check: bool 61 62 :param subnet_id: 63 The value to assign to the subnet_id property of this CreateVnicDetails. 64 :type subnet_id: str 65 66 :param vlan_id: 67 The value to assign to the vlan_id property of this CreateVnicDetails. 68 :type vlan_id: str 69 70 """ 71 self.swagger_types = { 72 'assign_public_ip': 'bool', 73 'assign_private_dns_record': 'bool', 74 'defined_tags': 'dict(str, dict(str, object))', 75 'display_name': 'str', 76 'freeform_tags': 'dict(str, str)', 77 'hostname_label': 'str', 78 'nsg_ids': 'list[str]', 79 'private_ip': 'str', 80 'skip_source_dest_check': 'bool', 81 'subnet_id': 'str', 82 'vlan_id': 'str' 83 } 84 85 self.attribute_map = { 86 'assign_public_ip': 'assignPublicIp', 87 'assign_private_dns_record': 'assignPrivateDnsRecord', 88 'defined_tags': 'definedTags', 89 'display_name': 'displayName', 90 'freeform_tags': 'freeformTags', 91 'hostname_label': 'hostnameLabel', 92 'nsg_ids': 'nsgIds', 93 'private_ip': 'privateIp', 94 'skip_source_dest_check': 'skipSourceDestCheck', 95 'subnet_id': 'subnetId', 96 'vlan_id': 'vlanId' 97 } 98 99 self._assign_public_ip = None 100 self._assign_private_dns_record = None 101 self._defined_tags = None 102 self._display_name = None 103 self._freeform_tags = None 104 self._hostname_label = None 105 self._nsg_ids = None 106 self._private_ip = None 107 self._skip_source_dest_check = None 108 self._subnet_id = None 109 self._vlan_id = None 110 111 @property 112 def assign_public_ip(self): 113 """ 114 Gets the assign_public_ip of this CreateVnicDetails. 115 Whether the VNIC should be assigned a public IP address. Defaults to whether 116 the subnet is public or private. If not set and the VNIC is being created 117 in a private subnet (that is, where `prohibitPublicIpOnVnic` = true in the 118 :class:`Subnet`), then no public IP address is assigned. 119 If not set and the subnet is public (`prohibitPublicIpOnVnic` = false), then 120 a public IP address is assigned. If set to true and 121 `prohibitPublicIpOnVnic` = true, an error is returned. 122 123 **Note:** This public IP address is associated with the primary private IP 124 on the VNIC. For more information, see 125 `IP Addresses`__. 126 127 **Note:** There's a limit to the number of :class:`PublicIp` 128 a VNIC or instance can have. If you try to create a secondary VNIC 129 with an assigned public IP for an instance that has already 130 reached its public IP limit, an error is returned. For information 131 about the public IP limits, see 132 `Public IP Addresses`__. 133 134 Example: `false` 135 136 If you specify a `vlanId`, then `assignPublicIp` must be set to false. See 137 :class:`Vlan`. 138 139 __ https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingIPaddresses.htm 140 __ https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingpublicIPs.htm 141 142 143 :return: The assign_public_ip of this CreateVnicDetails. 144 :rtype: bool 145 """ 146 return self._assign_public_ip 147 148 @assign_public_ip.setter 149 def assign_public_ip(self, assign_public_ip): 150 """ 151 Sets the assign_public_ip of this CreateVnicDetails. 152 Whether the VNIC should be assigned a public IP address. Defaults to whether 153 the subnet is public or private. If not set and the VNIC is being created 154 in a private subnet (that is, where `prohibitPublicIpOnVnic` = true in the 155 :class:`Subnet`), then no public IP address is assigned. 156 If not set and the subnet is public (`prohibitPublicIpOnVnic` = false), then 157 a public IP address is assigned. If set to true and 158 `prohibitPublicIpOnVnic` = true, an error is returned. 159 160 **Note:** This public IP address is associated with the primary private IP 161 on the VNIC. For more information, see 162 `IP Addresses`__. 163 164 **Note:** There's a limit to the number of :class:`PublicIp` 165 a VNIC or instance can have. If you try to create a secondary VNIC 166 with an assigned public IP for an instance that has already 167 reached its public IP limit, an error is returned. For information 168 about the public IP limits, see 169 `Public IP Addresses`__. 170 171 Example: `false` 172 173 If you specify a `vlanId`, then `assignPublicIp` must be set to false. See 174 :class:`Vlan`. 175 176 __ https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingIPaddresses.htm 177 __ https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingpublicIPs.htm 178 179 180 :param assign_public_ip: The assign_public_ip of this CreateVnicDetails. 181 :type: bool 182 """ 183 self._assign_public_ip = assign_public_ip 184 185 @property 186 def assign_private_dns_record(self): 187 """ 188 Gets the assign_private_dns_record of this CreateVnicDetails. 189 Whether the VNIC should be assigned a DNS record. If set to false, there will be no DNS record 190 registration for the VNIC. If set to true, the DNS record will be registered. The default 191 value is true. 192 193 If you specify a `hostnameLabel`, then `assignPrivateDnsRecord` must be set to true. 194 195 196 :return: The assign_private_dns_record of this CreateVnicDetails. 197 :rtype: bool 198 """ 199 return self._assign_private_dns_record 200 201 @assign_private_dns_record.setter 202 def assign_private_dns_record(self, assign_private_dns_record): 203 """ 204 Sets the assign_private_dns_record of this CreateVnicDetails. 205 Whether the VNIC should be assigned a DNS record. If set to false, there will be no DNS record 206 registration for the VNIC. If set to true, the DNS record will be registered. The default 207 value is true. 208 209 If you specify a `hostnameLabel`, then `assignPrivateDnsRecord` must be set to true. 210 211 212 :param assign_private_dns_record: The assign_private_dns_record of this CreateVnicDetails. 213 :type: bool 214 """ 215 self._assign_private_dns_record = assign_private_dns_record 216 217 @property 218 def defined_tags(self): 219 """ 220 Gets the defined_tags of this CreateVnicDetails. 221 Defined tags for this resource. Each key is predefined and scoped to a 222 namespace. For more information, see `Resource Tags`__. 223 224 Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` 225 226 __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm 227 228 229 :return: The defined_tags of this CreateVnicDetails. 230 :rtype: dict(str, dict(str, object)) 231 """ 232 return self._defined_tags 233 234 @defined_tags.setter 235 def defined_tags(self, defined_tags): 236 """ 237 Sets the defined_tags of this CreateVnicDetails. 238 Defined tags for this resource. Each key is predefined and scoped to a 239 namespace. For more information, see `Resource Tags`__. 240 241 Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` 242 243 __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm 244 245 246 :param defined_tags: The defined_tags of this CreateVnicDetails. 247 :type: dict(str, dict(str, object)) 248 """ 249 self._defined_tags = defined_tags 250 251 @property 252 def display_name(self): 253 """ 254 Gets the display_name of this CreateVnicDetails. 255 A user-friendly name. Does not have to be unique, and it's changeable. 256 Avoid entering confidential information. 257 258 259 :return: The display_name of this CreateVnicDetails. 260 :rtype: str 261 """ 262 return self._display_name 263 264 @display_name.setter 265 def display_name(self, display_name): 266 """ 267 Sets the display_name of this CreateVnicDetails. 268 A user-friendly name. Does not have to be unique, and it's changeable. 269 Avoid entering confidential information. 270 271 272 :param display_name: The display_name of this CreateVnicDetails. 273 :type: str 274 """ 275 self._display_name = display_name 276 277 @property 278 def freeform_tags(self): 279 """ 280 Gets the freeform_tags of this CreateVnicDetails. 281 Free-form tags for this resource. Each tag is a simple key-value pair with no 282 predefined name, type, or namespace. For more information, see `Resource Tags`__. 283 284 Example: `{\"Department\": \"Finance\"}` 285 286 __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm 287 288 289 :return: The freeform_tags of this CreateVnicDetails. 290 :rtype: dict(str, str) 291 """ 292 return self._freeform_tags 293 294 @freeform_tags.setter 295 def freeform_tags(self, freeform_tags): 296 """ 297 Sets the freeform_tags of this CreateVnicDetails. 298 Free-form tags for this resource. Each tag is a simple key-value pair with no 299 predefined name, type, or namespace. For more information, see `Resource Tags`__. 300 301 Example: `{\"Department\": \"Finance\"}` 302 303 __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm 304 305 306 :param freeform_tags: The freeform_tags of this CreateVnicDetails. 307 :type: dict(str, str) 308 """ 309 self._freeform_tags = freeform_tags 310 311 @property 312 def hostname_label(self): 313 """ 314 Gets the hostname_label of this CreateVnicDetails. 315 The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname 316 portion of the primary private IP's fully qualified domain name (FQDN) 317 (for example, `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). 318 Must be unique across all VNICs in the subnet and comply with 319 `RFC 952`__ and 320 `RFC 1123`__. 321 The value appears in the :class:`Vnic` object and also the 322 :class:`PrivateIp` object returned by 323 :func:`list_private_ips` and 324 :func:`get_private_ip`. 325 326 For more information, see 327 `DNS in Your Virtual Cloud Network`__. 328 329 When launching an instance, use this `hostnameLabel` instead 330 of the deprecated `hostnameLabel` in 331 :func:`launch_instance_details`. 332 If you provide both, the values must match. 333 334 Example: `bminstance-1` 335 336 If you specify a `vlanId`, the `hostnameLabel` cannot be specified. VNICs on a VLAN 337 can not be assigned a hostname. See :class:`Vlan`. 338 339 __ https://tools.ietf.org/html/rfc952 340 __ https://tools.ietf.org/html/rfc1123 341 __ https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/dns.htm 342 343 344 :return: The hostname_label of this CreateVnicDetails. 345 :rtype: str 346 """ 347 return self._hostname_label 348 349 @hostname_label.setter 350 def hostname_label(self, hostname_label): 351 """ 352 Sets the hostname_label of this CreateVnicDetails. 353 The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname 354 portion of the primary private IP's fully qualified domain name (FQDN) 355 (for example, `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). 356 Must be unique across all VNICs in the subnet and comply with 357 `RFC 952`__ and 358 `RFC 1123`__. 359 The value appears in the :class:`Vnic` object and also the 360 :class:`PrivateIp` object returned by 361 :func:`list_private_ips` and 362 :func:`get_private_ip`. 363 364 For more information, see 365 `DNS in Your Virtual Cloud Network`__. 366 367 When launching an instance, use this `hostnameLabel` instead 368 of the deprecated `hostnameLabel` in 369 :func:`launch_instance_details`. 370 If you provide both, the values must match. 371 372 Example: `bminstance-1` 373 374 If you specify a `vlanId`, the `hostnameLabel` cannot be specified. VNICs on a VLAN 375 can not be assigned a hostname. See :class:`Vlan`. 376 377 __ https://tools.ietf.org/html/rfc952 378 __ https://tools.ietf.org/html/rfc1123 379 __ https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/dns.htm 380 381 382 :param hostname_label: The hostname_label of this CreateVnicDetails. 383 :type: str 384 """ 385 self._hostname_label = hostname_label 386 387 @property 388 def nsg_ids(self): 389 """ 390 Gets the nsg_ids of this CreateVnicDetails. 391 A list of the OCIDs of the network security groups (NSGs) to add the VNIC to. For more 392 information about NSGs, see 393 :class:`NetworkSecurityGroup`. 394 395 If a `vlanId` is specified, the `nsgIds` cannot be specified. The `vlanId` 396 indicates that the VNIC will belong to a VLAN instead of a subnet. With VLANs, 397 all VNICs in the VLAN belong to the NSGs that are associated with the VLAN. 398 See :class:`Vlan`. 399 400 401 :return: The nsg_ids of this CreateVnicDetails. 402 :rtype: list[str] 403 """ 404 return self._nsg_ids 405 406 @nsg_ids.setter 407 def nsg_ids(self, nsg_ids): 408 """ 409 Sets the nsg_ids of this CreateVnicDetails. 410 A list of the OCIDs of the network security groups (NSGs) to add the VNIC to. For more 411 information about NSGs, see 412 :class:`NetworkSecurityGroup`. 413 414 If a `vlanId` is specified, the `nsgIds` cannot be specified. The `vlanId` 415 indicates that the VNIC will belong to a VLAN instead of a subnet. With VLANs, 416 all VNICs in the VLAN belong to the NSGs that are associated with the VLAN. 417 See :class:`Vlan`. 418 419 420 :param nsg_ids: The nsg_ids of this CreateVnicDetails. 421 :type: list[str] 422 """ 423 self._nsg_ids = nsg_ids 424 425 @property 426 def private_ip(self): 427 """ 428 Gets the private_ip of this CreateVnicDetails. 429 A private IP address of your choice to assign to the VNIC. Must be an 430 available IP address within the subnet's CIDR. If you don't specify a 431 value, Oracle automatically assigns a private IP address from the subnet. 432 This is the VNIC's *primary* private IP address. The value appears in 433 the :class:`Vnic` object and also the 434 :class:`PrivateIp` object returned by 435 :func:`list_private_ips` and 436 :func:`get_private_ip`. 437 438 439 If you specify a `vlanId`, the `privateIp` cannot be specified. 440 See :class:`Vlan`. 441 442 Example: `10.0.3.3` 443 444 445 :return: The private_ip of this CreateVnicDetails. 446 :rtype: str 447 """ 448 return self._private_ip 449 450 @private_ip.setter 451 def private_ip(self, private_ip): 452 """ 453 Sets the private_ip of this CreateVnicDetails. 454 A private IP address of your choice to assign to the VNIC. Must be an 455 available IP address within the subnet's CIDR. If you don't specify a 456 value, Oracle automatically assigns a private IP address from the subnet. 457 This is the VNIC's *primary* private IP address. The value appears in 458 the :class:`Vnic` object and also the 459 :class:`PrivateIp` object returned by 460 :func:`list_private_ips` and 461 :func:`get_private_ip`. 462 463 464 If you specify a `vlanId`, the `privateIp` cannot be specified. 465 See :class:`Vlan`. 466 467 Example: `10.0.3.3` 468 469 470 :param private_ip: The private_ip of this CreateVnicDetails. 471 :type: str 472 """ 473 self._private_ip = private_ip 474 475 @property 476 def skip_source_dest_check(self): 477 """ 478 Gets the skip_source_dest_check of this CreateVnicDetails. 479 Whether the source/destination check is disabled on the VNIC. 480 Defaults to `false`, which means the check is performed. For information 481 about why you would skip the source/destination check, see 482 `Using a Private IP as a Route Target`__. 483 484 485 If you specify a `vlanId`, the `skipSourceDestCheck` cannot be specified because the 486 source/destination check is always disabled for VNICs in a VLAN. See 487 :class:`Vlan`. 488 489 Example: `true` 490 491 __ https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingroutetables.htm#privateip 492 493 494 :return: The skip_source_dest_check of this CreateVnicDetails. 495 :rtype: bool 496 """ 497 return self._skip_source_dest_check 498 499 @skip_source_dest_check.setter 500 def skip_source_dest_check(self, skip_source_dest_check): 501 """ 502 Sets the skip_source_dest_check of this CreateVnicDetails. 503 Whether the source/destination check is disabled on the VNIC. 504 Defaults to `false`, which means the check is performed. For information 505 about why you would skip the source/destination check, see 506 `Using a Private IP as a Route Target`__. 507 508 509 If you specify a `vlanId`, the `skipSourceDestCheck` cannot be specified because the 510 source/destination check is always disabled for VNICs in a VLAN. See 511 :class:`Vlan`. 512 513 Example: `true` 514 515 __ https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingroutetables.htm#privateip 516 517 518 :param skip_source_dest_check: The skip_source_dest_check of this CreateVnicDetails. 519 :type: bool 520 """ 521 self._skip_source_dest_check = skip_source_dest_check 522 523 @property 524 def subnet_id(self): 525 """ 526 Gets the subnet_id of this CreateVnicDetails. 527 The `OCID`__ of the subnet to create the VNIC in. When launching an instance, 528 use this `subnetId` instead of the deprecated `subnetId` in 529 :func:`launch_instance_details`. 530 At least one of them is required; if you provide both, the values must match. 531 532 If you are an Oracle Cloud VMware Solution customer and creating a secondary 533 VNIC in a VLAN instead of a subnet, provide a `vlanId` instead of a `subnetId`. 534 If you provide both a `vlanId` and `subnetId`, the request fails. 535 536 __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm 537 538 539 :return: The subnet_id of this CreateVnicDetails. 540 :rtype: str 541 """ 542 return self._subnet_id 543 544 @subnet_id.setter 545 def subnet_id(self, subnet_id): 546 """ 547 Sets the subnet_id of this CreateVnicDetails. 548 The `OCID`__ of the subnet to create the VNIC in. When launching an instance, 549 use this `subnetId` instead of the deprecated `subnetId` in 550 :func:`launch_instance_details`. 551 At least one of them is required; if you provide both, the values must match. 552 553 If you are an Oracle Cloud VMware Solution customer and creating a secondary 554 VNIC in a VLAN instead of a subnet, provide a `vlanId` instead of a `subnetId`. 555 If you provide both a `vlanId` and `subnetId`, the request fails. 556 557 __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm 558 559 560 :param subnet_id: The subnet_id of this CreateVnicDetails. 561 :type: str 562 """ 563 self._subnet_id = subnet_id 564 565 @property 566 def vlan_id(self): 567 """ 568 Gets the vlan_id of this CreateVnicDetails. 569 Provide this attribute only if you are an Oracle Cloud VMware Solution 570 customer and creating a secondary VNIC in a VLAN. The value is the `OCID`__ of the VLAN. 571 See :class:`Vlan`. 572 573 Provide a `vlanId` instead of a `subnetId`. If you provide both a 574 `vlanId` and `subnetId`, the request fails. 575 576 __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm 577 578 579 :return: The vlan_id of this CreateVnicDetails. 580 :rtype: str 581 """ 582 return self._vlan_id 583 584 @vlan_id.setter 585 def vlan_id(self, vlan_id): 586 """ 587 Sets the vlan_id of this CreateVnicDetails. 588 Provide this attribute only if you are an Oracle Cloud VMware Solution 589 customer and creating a secondary VNIC in a VLAN. The value is the `OCID`__ of the VLAN. 590 See :class:`Vlan`. 591 592 Provide a `vlanId` instead of a `subnetId`. If you provide both a 593 `vlanId` and `subnetId`, the request fails. 594 595 __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm 596 597 598 :param vlan_id: The vlan_id of this CreateVnicDetails. 599 :type: str 600 """ 601 self._vlan_id = vlan_id 602 603 def __repr__(self): 604 return formatted_flat_dict(self) 605 606 def __eq__(self, other): 607 if other is None: 608 return False 609 610 return self.__dict__ == other.__dict__ 611 612 def __ne__(self, other): 613 return not self == other 614