lib/oci/core/virtual_network_client.rb
# Creates a new virtual cloud network (VCN). For more information, see
# [VCNs and Subnets](https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingVCNs.htm).
#
# For the VCN, you specify a list of one or more IPv4 CIDR blocks that meet the following criteria:
#
# - The CIDR blocks must be valid.
# - They must not overlap with each other or with the on-premises network CIDR block.
# - The number of CIDR blocks does not exceed the limit of CIDR blocks allowed per VCN.
#
# For a CIDR block, Oracle recommends that you use one of the private IP address ranges specified in [RFC 1918](https://tools.ietf.org/html/rfc1918) (10.0.0.0/8, 172.16/12, and 192.168/16). Example:
# 172.16.0.0/16. The CIDR blocks can range from /16 to /30.
#
# For the purposes of access control, you must provide the OCID of the compartment where you want the VCN to
# reside. Consult an Oracle Cloud Infrastructure administrator in your organization if you're not sure which
# compartment to use. Notice that the VCN doesn't have to be in the same compartment as the subnets or other
# Networking Service components. For more information about compartments and access control, see
# [Overview of the IAM Service](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/overview.htm). For information about OCIDs, see
# [Resource Identifiers](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm).
#
# You may optionally specify a *display name* for the VCN, otherwise a default is provided. It does not have to
# be unique, and you can change it. Avoid entering confidential information.
#
# You can also add a DNS label for the VCN, which is required if you want the instances to use the
# Interent and VCN Resolver option for DNS in the VCN. For more information, see
# [DNS in Your Virtual Cloud Network](https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/dns.htm).
#
# The VCN automatically comes with a default route table, default security list, and default set of DHCP options.
# The OCID for each is returned in the response. You can't delete these default objects, but you can change their
# contents (that is, change the route rules, security list rules, and so on).
#
# The VCN and subnets you create are not accessible until you attach an internet gateway or set up an IPSec VPN
# or FastConnect. For more information, see
# [Overview of the Networking Service](https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm).
#
# @param [OCI::Core::Models::CreateVcnDetails] create_vcn_details Details for creating a new VCN.
# @param [Hash] opts the optional parameters
# @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
#   retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
# @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
#   server error without risk of executing that same action again. Retry tokens expire after 24
#   hours, but can be invalidated before then due to conflicting operations (for example, if a resource
#   has been deleted and purged from the system, then a retry of the original creation request
#   may be rejected).
#
# @return [Response] A Response object with data of type {OCI::Core::Models::Vcn Vcn}
# @note Click [here](https://docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/core/create_vcn.rb.html) to see an example of how to use create_vcn API.
Creates a new virtual cloud network (VCN). For more information, see
[VCNs and Subnets].

For the VCN, you specify a list of one or more IPv4 CIDR blocks that meet the following criteria.

The CIDR blocks must be valid.
They must not overlap with each other or with the on-premises network CIDR block.
The number of CIDR blocks does not exceed the limit of CIDR blocks allowed per VCN.

For a CIDR block, Oracle recommends that you use one of the private IP address ranges specified in [RFC 1918] (10.0.0.0/8, 172.16/12, and 192.168/16).

For the purposes of access control, you must provide the OCID of the compartment where you want the VCN to
reside. Consult an Oracle Cloud Infrastructure administrator in your organization if you're not sure which
compartment to use. Notice that the VCN doesn't have to be in the same compartment as the subnets or other
Networking Service components. For more information about compartments and access control, see
[Overview of the IAM Service]. For information about OCIDs, see
[Resource Identifiers].

You may optionally specify a *display name* for the VCN, otherwise a default is provided. It does not have to
be unique, and you can change it. Avoid entering confidential information.

You can also add a DNS label for the VCN, which is required if you want the instances to use the
Interent and VCN Resolver option for DNS in the VCN. For more information, see
[DNS in Your Virtual Cloud Network].

The VCN automatically comes with a default route table, default security list, and default set of DHCP options.
The OCID for each is returned in the response. You can't delete these default objects, but you can change their
contents (that is, change the route rules, security list rules, and so on).

The VCN and subnets you create are not accessible until you attach an internet gateway or set up an IPSec VPN
or FastConnect. For more information, see
[Overview of the Networking Service].
Creates a new virtual cloud network ( VCN ) . For more information see [ VCNs and Subnets ] . For the VCN you specify a list of one or more IPv4 CIDR blocks that meet the following criteria . The CIDR blocks must be valid . They must not overlap with each other or with the on - premises network CIDR block . The number of CIDR blocks does not exceed the limit of CIDR blocks allowed per VCN . For a CIDR block Oracle recommends that you use one of the private IP address ranges specified in [ RFC 1918 ] ( 10 . 0 . 0 . 0 / 8 172 . 16 / 12 and 192 . 168 / 16 ) . For the purposes of access control you must provide the OCID of the compartment where you want the VCN to reside . Consult an Oracle Cloud Infrastructure administrator in your organization if you ' re not sure which compartment to use . Notice that the VCN doesn ' t have to be in the same compartment as the subnets or other Networking Service components . For more information about compartments and access control see [ Overview of the IAM Service ] . For information about OCIDs see [ Resource Identifiers ] . You may optionally specify a * display name * for the VCN otherwise a default is provided . It does not have to be unique and you can change it . Avoid entering confidential information . You can also add a DNS label for the VCN which is required if you want the instances to use the Interent and VCN Resolver option for DNS in the VCN . For more information see [ DNS in Your Virtual Cloud Network ] . The VCN automatically comes with a default route table default security list and default set of DHCP options . The OCID for each is returned in the response . You can ' t delete these default objects but you can change their contents ( that is change the route rules security list rules and so on ) . The VCN and subnets you create are not accessible until you attach an internet gateway or set up an IPSec VPN or FastConnect . For more information see [ Overview of the Networking Service ] .
def create_vcn(create_vcn_details, opts = {})
      logger.debug 'Calling operation VirtualNetworkClient#create_vcn.' if logger
      raise "Missing the required parameter 'create_vcn_details' when calling create_vcn." if create_vcn_details.nil?
      path = '/vcns'
      operation_signing_strategy = :standard
      query_params = {}
      header_params = {}
      header_params[:accept] = 'application/json'
      header_params[:'content-type'] = 'application/json'
      header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
      header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token
      post_body = @api_client.object_to_http_body(create_vcn_details)
      OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'VirtualNetworkClient#create_vcn') do
        @api_client.call_api(
          :POST,
          path,
          endpoint,
          header_params: header_params,
          query_params: query_params,
          operation_signing_strategy: operation_signing_strategy,
          body: post_body,
          return_type: 'OCI::Core::Models::Vcn'
        )
      end
    end
def create_vcn ( create_vcn_details , opts = { } ) logger . debug 'Calling operation VirtualNetworkClient#create_vcn.' if logger raise "Missing the required parameter 'create_vcn_details' when calling create_vcn." if create_vcn_details . nil? path = '/vcns' operation_signing_strategy = :standard query_params = { } header_params = { } header_params [ :accept ] = 'application/json' header_params [ :' content-type ' ] = 'application/json' header_params [ :' opc-retry-token ' ] = opts [ :opc_retry_token ] if opts [ :opc_retry_token ] header_params [ :' opc-retry-token ' ] ||= OCI :: Retry . generate_opc_retry_token post_body = @api_client . object_to_http_body ( create_vcn_details ) OCI :: Retry . make_retrying_call ( applicable_retry_config ( opts ) , call_name : 'VirtualNetworkClient#create_vcn' ) do @api_client . call_api ( :POST , path , endpoint , header_params : header_params , query_params : query_params , operation_signing_strategy : operation_signing_strategy , body : post_body , return_type : 'OCI::Core::Models::Vcn' ) end end
Creates a new virtual cloud network (VCN).
Creates a new virtual cloud network ( VCN ) .
# rubocop:disable Style/NegatedIf # Query Params # Header Params # rubocop:enable Style/NegatedIf # rubocop:disable Metrics/BlockLength # rubocop:enable Metrics/BlockLength
A Response object with data of type {OCI::Core::Models::Vcn Vcn}
A Response object with data of type { OCI :: Core :: Models :: Vcn Vcn }
Response
create_vcn_details
<not_specific>
opts
:opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
: opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again . Retry tokens expire after 24 hours but can be invalidated before then due to conflicting operations ( for example if a resource has been deleted and purged from the system then a retry of the original creation request may be rejected ) .
<not_specific>
opts the optional parameters
opts the optional parameters
note
Click [here] to see an example of how to use create_vcn API.
Click [ here ] to see an example of how to use create_vcn API .