Subnet

class oci.core.models.Subnet(**kwargs)

Bases: object

A logical subdivision of a VCN. Each subnet consists of a contiguous range of IP addresses that do not overlap with other subnets in the VCN. Example: 172.16.1.0/24. For more information, see Overview of the Networking Service and VCNs and Subnets.

To use any of the API operations, you must be authorized in an IAM policy. If you’re not authorized, talk to an administrator. If you’re an administrator who needs to write policies to give users access, see Getting Started with Policies.

Attributes

LIFECYCLE_STATE_AVAILABLE A constant which can be used with the lifecycle_state property of a Subnet.
LIFECYCLE_STATE_PROVISIONING A constant which can be used with the lifecycle_state property of a Subnet.
LIFECYCLE_STATE_TERMINATED A constant which can be used with the lifecycle_state property of a Subnet.
LIFECYCLE_STATE_TERMINATING A constant which can be used with the lifecycle_state property of a Subnet.
LIFECYCLE_STATE_UPDATING A constant which can be used with the lifecycle_state property of a Subnet.
availability_domain Gets the availability_domain of this Subnet.
cidr_block [Required] Gets the cidr_block of this Subnet.
compartment_id [Required] Gets the compartment_id of this Subnet.
defined_tags Gets the defined_tags of this Subnet.
dhcp_options_id Gets the dhcp_options_id of this Subnet.
display_name Gets the display_name of this Subnet.
dns_label Gets the dns_label of this Subnet.
freeform_tags Gets the freeform_tags of this Subnet.
id [Required] Gets the id of this Subnet.
ipv6_cidr_block Gets the ipv6_cidr_block of this Subnet.
ipv6_cidr_blocks Gets the ipv6_cidr_blocks of this Subnet.
ipv6_virtual_router_ip Gets the ipv6_virtual_router_ip of this Subnet.
lifecycle_state [Required] Gets the lifecycle_state of this Subnet.
prohibit_internet_ingress Gets the prohibit_internet_ingress of this Subnet.
prohibit_public_ip_on_vnic Gets the prohibit_public_ip_on_vnic of this Subnet.
route_table_id [Required] Gets the route_table_id of this Subnet.
security_list_ids Gets the security_list_ids of this Subnet.
subnet_domain_name Gets the subnet_domain_name of this Subnet.
time_created Gets the time_created of this Subnet.
vcn_id [Required] Gets the vcn_id of this Subnet.
virtual_router_ip [Required] Gets the virtual_router_ip of this Subnet.
virtual_router_mac [Required] Gets the virtual_router_mac of this Subnet.

Methods

__init__(**kwargs) Initializes a new Subnet object with values from keyword arguments.
LIFECYCLE_STATE_AVAILABLE = 'AVAILABLE'

A constant which can be used with the lifecycle_state property of a Subnet. This constant has a value of “AVAILABLE”

LIFECYCLE_STATE_PROVISIONING = 'PROVISIONING'

A constant which can be used with the lifecycle_state property of a Subnet. This constant has a value of “PROVISIONING”

LIFECYCLE_STATE_TERMINATED = 'TERMINATED'

A constant which can be used with the lifecycle_state property of a Subnet. This constant has a value of “TERMINATED”

LIFECYCLE_STATE_TERMINATING = 'TERMINATING'

A constant which can be used with the lifecycle_state property of a Subnet. This constant has a value of “TERMINATING”

LIFECYCLE_STATE_UPDATING = 'UPDATING'

A constant which can be used with the lifecycle_state property of a Subnet. This constant has a value of “UPDATING”

__init__(**kwargs)

Initializes a new Subnet object with values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters:
  • availability_domain (str) – The value to assign to the availability_domain property of this Subnet.
  • cidr_block (str) – The value to assign to the cidr_block property of this Subnet.
  • compartment_id (str) – The value to assign to the compartment_id property of this Subnet.
  • defined_tags (dict(str, dict(str, object))) – The value to assign to the defined_tags property of this Subnet.
  • dhcp_options_id (str) – The value to assign to the dhcp_options_id property of this Subnet.
  • display_name (str) – The value to assign to the display_name property of this Subnet.
  • dns_label (str) – The value to assign to the dns_label property of this Subnet.
  • freeform_tags (dict(str, str)) – The value to assign to the freeform_tags property of this Subnet.
  • id (str) – The value to assign to the id property of this Subnet.
  • ipv6_cidr_block (str) – The value to assign to the ipv6_cidr_block property of this Subnet.
  • ipv6_cidr_blocks (list[str]) – The value to assign to the ipv6_cidr_blocks property of this Subnet.
  • ipv6_virtual_router_ip (str) – The value to assign to the ipv6_virtual_router_ip property of this Subnet.
  • lifecycle_state (str) – The value to assign to the lifecycle_state property of this Subnet. Allowed values for this property are: “PROVISIONING”, “AVAILABLE”, “TERMINATING”, “TERMINATED”, “UPDATING”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
  • prohibit_internet_ingress (bool) – The value to assign to the prohibit_internet_ingress property of this Subnet.
  • prohibit_public_ip_on_vnic (bool) – The value to assign to the prohibit_public_ip_on_vnic property of this Subnet.
  • route_table_id (str) – The value to assign to the route_table_id property of this Subnet.
  • security_list_ids (list[str]) – The value to assign to the security_list_ids property of this Subnet.
  • subnet_domain_name (str) – The value to assign to the subnet_domain_name property of this Subnet.
  • time_created (datetime) – The value to assign to the time_created property of this Subnet.
  • vcn_id (str) – The value to assign to the vcn_id property of this Subnet.
  • virtual_router_ip (str) – The value to assign to the virtual_router_ip property of this Subnet.
  • virtual_router_mac (str) – The value to assign to the virtual_router_mac property of this Subnet.
availability_domain

Gets the availability_domain of this Subnet. The subnet’s availability domain. This attribute will be null if this is a regional subnet instead of an AD-specific subnet. Oracle recommends creating regional subnets.

Example: Uocm:PHX-AD-1

Returns:The availability_domain of this Subnet.
Return type:str
cidr_block

[Required] Gets the cidr_block of this Subnet. The subnet’s CIDR block.

Example: 10.0.1.0/24

Returns:The cidr_block of this Subnet.
Return type:str
compartment_id

[Required] Gets the compartment_id of this Subnet. The OCID of the compartment containing the subnet.

Returns:The compartment_id of this Subnet.
Return type:str
defined_tags

Gets the defined_tags of this Subnet. Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.

Example: {“Operations”: {“CostCenter”: “42”}}

Returns:The defined_tags of this Subnet.
Return type:dict(str, dict(str, object))
dhcp_options_id

Gets the dhcp_options_id of this Subnet. The OCID of the set of DHCP options that the subnet uses.

Returns:The dhcp_options_id of this Subnet.
Return type:str
display_name

Gets the display_name of this Subnet. A user-friendly name. Does not have to be unique, and it’s changeable. Avoid entering confidential information.

Returns:The display_name of this Subnet.
Return type:str
dns_label

Gets the dns_label of this Subnet. A DNS label for the subnet, used in conjunction with the VNIC’s hostname and VCN’s DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet (for example, bminstance1.subnet123.vcn1.oraclevcn.com). Must be an alphanumeric string that begins with a letter and is unique within the VCN. The value cannot be changed.

The absence of this parameter means the Internet and VCN Resolver will not resolve hostnames of instances in this subnet.

For more information, see DNS in Your Virtual Cloud Network.

Example: subnet123

Returns:The dns_label of this Subnet.
Return type:str
freeform_tags

Gets the freeform_tags of this Subnet. Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags.

Example: {“Department”: “Finance”}

Returns:The freeform_tags of this Subnet.
Return type:dict(str, str)
id

[Required] Gets the id of this Subnet. The subnet’s Oracle ID (OCID).

Returns:The id of this Subnet.
Return type:str
ipv6_cidr_block

Gets the ipv6_cidr_block of this Subnet. For an IPv6-enabled subnet, this is the IPv6 prefix for the subnet’s IP address space. The subnet size is always /64. See IPv6 Addresses.

Example: 2001:0db8:0123:1111::/64

Returns:The ipv6_cidr_block of this Subnet.
Return type:str
ipv6_cidr_blocks

Gets the ipv6_cidr_blocks of this Subnet. The list of all IPv6 prefixes (Oracle allocated IPv6 GUA, ULA or private IPv6 prefixes, BYOIPv6 prefixes) for the subnet.

Returns:The ipv6_cidr_blocks of this Subnet.
Return type:list[str]
ipv6_virtual_router_ip

Gets the ipv6_virtual_router_ip of this Subnet. For an IPv6-enabled subnet, this is the IPv6 address of the virtual router.

Example: 2001:0db8:0123:1111:89ab:cdef:1234:5678

Returns:The ipv6_virtual_router_ip of this Subnet.
Return type:str
lifecycle_state

[Required] Gets the lifecycle_state of this Subnet. The subnet’s current state.

Allowed values for this property are: “PROVISIONING”, “AVAILABLE”, “TERMINATING”, “TERMINATED”, “UPDATING”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.

Returns:The lifecycle_state of this Subnet.
Return type:str
prohibit_internet_ingress

Gets the prohibit_internet_ingress of this Subnet. Whether to disallow ingress internet traffic to VNICs within this subnet. Defaults to false.

For IPV4, prohibitInternetIngress behaves similarly to prohibitPublicIpOnVnic. If it is set to false, VNICs created in this subnet will automatically be assigned public IP addresses unless specified otherwise during instance launch or VNIC creation (with the assignPublicIp flag in CreateVnicDetails). If prohibitInternetIngress is set to true, VNICs created in this subnet cannot have public IP addresses (that is, it’s a privatesubnet).

For IPv6, if prohibitInternetIngress is set to true, internet access is not allowed for any IPv6s assigned to VNICs in the subnet. Otherwise, ingress internet traffic is allowed by default.

Example: true

Returns:The prohibit_internet_ingress of this Subnet.
Return type:bool
prohibit_public_ip_on_vnic

Gets the prohibit_public_ip_on_vnic of this Subnet. Whether VNICs within this subnet can have public IP addresses. Defaults to false, which means VNICs created in this subnet will automatically be assigned public IP addresses unless specified otherwise during instance launch or VNIC creation (with the assignPublicIp flag in CreateVnicDetails). If prohibitPublicIpOnVnic is set to true, VNICs created in this subnet cannot have public IP addresses (that is, it’s a private subnet).

Example: true

Returns:The prohibit_public_ip_on_vnic of this Subnet.
Return type:bool
route_table_id

[Required] Gets the route_table_id of this Subnet. The OCID of the route table that the subnet uses.

Returns:The route_table_id of this Subnet.
Return type:str
security_list_ids

Gets the security_list_ids of this Subnet. The OCIDs of the security list or lists that the subnet uses. Remember that security lists are associated with the subnet, but the rules are applied to the individual VNICs in the subnet.

Returns:The security_list_ids of this Subnet.
Return type:list[str]
subnet_domain_name

Gets the subnet_domain_name of this Subnet. The subnet’s domain name, which consists of the subnet’s DNS label, the VCN’s DNS label, and the oraclevcn.com domain.

For more information, see DNS in Your Virtual Cloud Network.

Example: subnet123.vcn1.oraclevcn.com

Returns:The subnet_domain_name of this Subnet.
Return type:str
time_created

Gets the time_created of this Subnet. The date and time the subnet was created, in the format defined by RFC3339.

Example: 2016-08-25T21:10:29.600Z

Returns:The time_created of this Subnet.
Return type:datetime
vcn_id

[Required] Gets the vcn_id of this Subnet. The OCID of the VCN the subnet is in.

Returns:The vcn_id of this Subnet.
Return type:str
virtual_router_ip

[Required] Gets the virtual_router_ip of this Subnet. The IP address of the virtual router.

Example: 10.0.14.1

Returns:The virtual_router_ip of this Subnet.
Return type:str
virtual_router_mac

[Required] Gets the virtual_router_mac of this Subnet. The MAC address of the virtual router.

Example: 00:00:00:00:00:01

Returns:The virtual_router_mac of this Subnet.
Return type:str