# 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
load_balancer_client = OCI::LoadBalancer::LoadBalancerClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
create_load_balancer_response =
  load_balancer_client.create_load_balancer(
    OCI::LoadBalancer::Models::CreateLoadBalancerDetails.new(
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      display_name: 'EXAMPLE-displayName-Value',
      shape_name: 'EXAMPLE-shapeName-Value',
      subnet_ids: %w[EXAMPLE--Value],
      shape_details:
        OCI::LoadBalancer::Models::ShapeDetails.new(
          minimum_bandwidth_in_mbps: 3712, maximum_bandwidth_in_mbps: 4281
        ),
      is_private: false,
      is_delete_protection_enabled: true,
      ip_mode: 'IPV4',
      reserved_ips: [
        OCI::LoadBalancer::Models::ReservedIP.new(
          id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value'
        )
      ],
      listeners: {
        'EXAMPLE_KEY_Fnr7p' => {
          'defaultBackendSetName' => 'EXAMPLE-defaultBackendSetName-Value',
          'port' => 28_297,
          'protocol' => 'EXAMPLE-protocol-Value',
          'hostnameNames' => %w[EXAMPLE--Value],
          'pathRouteSetName' => 'EXAMPLE-pathRouteSetName-Value',
          'sslConfiguration' => {
            'verifyDepth' => 633,
            'verifyPeerCertificate' => False,
            'trustedCertificateAuthorityIds' => %w[EXAMPLE--Value],
            'certificateIds' => %w[EXAMPLE--Value],
            'certificateName' => 'EXAMPLE-certificateName-Value',
            'protocols' => %w[EXAMPLE--Value],
            'cipherSuiteName' => 'EXAMPLE-cipherSuiteName-Value',
            'serverOrderPreference' => 'ENABLED'
          },
          'connectionConfiguration' => {
            'idleTimeout' => 812, 'backendTcpProxyProtocolVersion' => 1
          },
          'routingPolicyName' => 'EXAMPLE-routingPolicyName-Value',
          'ruleSetNames' => %w[EXAMPLE--Value]
        }
      },
      hostnames: {
        'EXAMPLE_KEY_HSbVi' => {
          'name' => 'EXAMPLE-name-Value', 'hostname' => 'EXAMPLE-hostname-Value'
        }
      },
      backend_sets: {
        'EXAMPLE_KEY_8KUw5' => {
          'policy' => 'EXAMPLE-policy-Value',
          'healthChecker' => {
            'protocol' => 'EXAMPLE-protocol-Value',
            'urlPath' => 'EXAMPLE-urlPath-Value',
            'port' => 60_775,
            'returnCode' => 345,
            'retries' => 777,
            'timeoutInMillis' => 275_853,
            'intervalInMillis' => 651_219,
            'responseBodyRegex' => 'EXAMPLE-responseBodyRegex-Value',
            'isForcePlainText' => True
          },
          'backends' => [
            {
              'ipAddress' => 'EXAMPLE-ipAddress-Value',
              'port' => 49_109,
              'weight' => 783,
              'maxConnections' => 33_486,
              'backup' => True,
              'drain' => True,
              'offline' => False
            }
          ],
          'backendMaxConnections' => 22_132,
          'sslConfiguration' => {
            'verifyDepth' => 488,
            'verifyPeerCertificate' => True,
            'trustedCertificateAuthorityIds' => %w[EXAMPLE--Value],
            'certificateIds' => %w[EXAMPLE--Value],
            'certificateName' => 'EXAMPLE-certificateName-Value',
            'protocols' => %w[EXAMPLE--Value],
            'cipherSuiteName' => 'EXAMPLE-cipherSuiteName-Value',
            'serverOrderPreference' => 'ENABLED'
          },
          'sessionPersistenceConfiguration' => {
            'cookieName' => 'EXAMPLE-cookieName-Value',
            'disableFallback' => False
          },
          'lbCookieSessionPersistenceConfiguration' => {
            'cookieName' => 'EXAMPLE-cookieName-Value',
            'disableFallback' => False,
            'domain' => 'EXAMPLE-domain-Value',
            'path' => 'EXAMPLE-path-Value',
            'maxAgeInSeconds' => 514,
            'isSecure' => True,
            'isHttpOnly' => True
          }
        }
      },
      network_security_group_ids: %w[EXAMPLE--Value],
      certificates: {
        'EXAMPLE_KEY_RlLKF' => {
          'certificateName' => 'EXAMPLE-certificateName-Value',
          'passphrase' => 'EXAMPLE-passphrase-Value',
          'privateKey' => 'EXAMPLE-privateKey-Value',
          'publicCertificate' => 'EXAMPLE-publicCertificate-Value',
          'caCertificate' => 'EXAMPLE-caCertificate-Value'
        }
      },
      ssl_cipher_suites: {
        'EXAMPLE_KEY_3pcdx' => {
          'name' => 'EXAMPLE-name-Value', 'ciphers' => %w[EXAMPLE--Value]
        }
      },
      path_route_sets: {
        'EXAMPLE_KEY_TMqOj' => {
          'pathRoutes' => [
            {
              'path' => 'EXAMPLE-path-Value',
              'pathMatchType' => { 'matchType' => 'EXACT_MATCH' },
              'backendSetName' => 'EXAMPLE-backendSetName-Value'
            }
          ]
        }
      },
      freeform_tags: {
        'EXAMPLE_KEY_o4Q7u' => 'EXAMPLE_VALUE_inhEkiE8zi1f76fQNm6n'
      },
      defined_tags: {
        'EXAMPLE_KEY_fEcxY' => { 'EXAMPLE_KEY_aELc6' => 'EXAMPLE--Value' }
      },
      rule_sets: {
        'EXAMPLE_KEY_6NWMR' => {
          'items' => [
            {
              'action' => 'IP_BASED_MAX_CONNECTIONS',
              'defaultMaxConnections' => 58_884,
              'ipMaxConnections' => [
                {
                  'ipAddresses' => %w[EXAMPLE--Value], 'maxConnections' => 8930
                }
              ]
            }
          ]
        }
      }
    )
  )

# Get the data from response
puts "#{create_load_balancer_response.headers}"