# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

require 'oci'

# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config

# Initialize service client with default config file
core_client = OCI::Core::VirtualNetworkClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
create_security_list_response =
  core_client.create_security_list(
    OCI::Core::Models::CreateSecurityListDetails.new(
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      egress_security_rules: [
        OCI::Core::Models::EgressSecurityRule.new(
          destination: 'EXAMPLE-destination-Value',
          protocol: 'EXAMPLE-protocol-Value',
          destination_type: 'CIDR_BLOCK',
          icmp_options: OCI::Core::Models::IcmpOptions.new(type: 159, code: 2),
          is_stateless: true,
          tcp_options:
            OCI::Core::Models::TcpOptions.new(
              destination_port_range:
                OCI::Core::Models::PortRange.new(max: 50_206, min: 44_569),
              source_port_range:
                OCI::Core::Models::PortRange.new(max: 22_888, min: 51_190)
            ),
          udp_options:
            OCI::Core::Models::UdpOptions.new(
              destination_port_range:
                OCI::Core::Models::PortRange.new(max: 62_862, min: 40_163),
              source_port_range:
                OCI::Core::Models::PortRange.new(max: 27_408, min: 11_571)
            ),
          description: 'EXAMPLE-description-Value'
        )
      ],
      ingress_security_rules: [
        OCI::Core::Models::IngressSecurityRule.new(
          protocol: 'EXAMPLE-protocol-Value',
          source: 'EXAMPLE-source-Value',
          icmp_options: OCI::Core::Models::IcmpOptions.new(type: 248, code: 12),
          is_stateless: true,
          source_type: 'CIDR_BLOCK',
          tcp_options:
            OCI::Core::Models::TcpOptions.new(
              destination_port_range:
                OCI::Core::Models::PortRange.new(max: 63_903, min: 23_927),
              source_port_range:
                OCI::Core::Models::PortRange.new(max: 46_613, min: 27_635)
            ),
          udp_options:
            OCI::Core::Models::UdpOptions.new(
              destination_port_range:
                OCI::Core::Models::PortRange.new(max: 61_830, min: 11_666),
              source_port_range:
                OCI::Core::Models::PortRange.new(max: 13_052, min: 50_999)
            ),
          description: 'EXAMPLE-description-Value'
        )
      ],
      vcn_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value',
      defined_tags: {
        'EXAMPLE_KEY_XOQXj' => { 'EXAMPLE_KEY_2PfUt' => 'EXAMPLE--Value' }
      },
      display_name: 'EXAMPLE-displayName-Value',
      freeform_tags: {
        'EXAMPLE_KEY_VH39r' => 'EXAMPLE_VALUE_6tFtCaxNtPe2FsUNyTnU'
      }
    )
  )

# Get the data from response
puts "#{create_security_list_response.data}"