# 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: 6183, maximum_bandwidth_in_mbps: 1823
),
is_private: true,
is_delete_protection_enabled: true,
ip_mode: 'IPV6',
is_request_id_enabled: true,
request_id_header: 'EXAMPLE-requestIdHeader-Value',
reserved_ips: [
OCI::LoadBalancer::Models::ReservedIP.new(
id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value'
)
],
listeners: {
'EXAMPLE_KEY_0pjzN' => {
'defaultBackendSetName' => 'EXAMPLE-defaultBackendSetName-Value',
'port' => 41_675,
'protocol' => 'EXAMPLE-protocol-Value',
'hostnameNames' => %w[EXAMPLE--Value],
'pathRouteSetName' => 'EXAMPLE-pathRouteSetName-Value',
'sslConfiguration' => {
'verifyDepth' => 156,
'verifyPeerCertificate' => True,
'hasSessionResumption' => False,
'trustedCertificateAuthorityIds' => %w[EXAMPLE--Value],
'certificateIds' => %w[EXAMPLE--Value],
'certificateName' => 'EXAMPLE-certificateName-Value',
'protocols' => %w[EXAMPLE--Value],
'cipherSuiteName' => 'EXAMPLE-cipherSuiteName-Value',
'serverOrderPreference' => 'DISABLED'
},
'connectionConfiguration' => {
'idleTimeout' => 201,
'backendTcpProxyProtocolVersion' => 1,
'backendTcpProxyProtocolOptions' => %w[PP2_TYPE_AUTHORITY]
},
'routingPolicyName' => 'EXAMPLE-routingPolicyName-Value',
'ruleSetNames' => %w[EXAMPLE--Value]
}
},
hostnames: {
'EXAMPLE_KEY_iZqED' => {
'name' => 'EXAMPLE-name-Value', 'hostname' => 'EXAMPLE-hostname-Value'
}
},
backend_sets: {
'EXAMPLE_KEY_5RMjx' => {
'policy' => 'EXAMPLE-policy-Value',
'healthChecker' => {
'protocol' => 'EXAMPLE-protocol-Value',
'urlPath' => 'EXAMPLE-urlPath-Value',
'port' => 64_363,
'returnCode' => 587,
'retries' => 41,
'timeoutInMillis' => 10_740,
'intervalInMillis' => 1_181_037,
'responseBodyRegex' => 'EXAMPLE-responseBodyRegex-Value',
'isForcePlainText' => False
},
'backends' => [
{
'ipAddress' => 'EXAMPLE-ipAddress-Value',
'port' => 63_063,
'weight' => 985,
'maxConnections' => 38_123,
'backup' => False,
'drain' => True,
'offline' => True
}
],
'backendMaxConnections' => 51_844,
'sslConfiguration' => {
'verifyDepth' => 336,
'verifyPeerCertificate' => True,
'hasSessionResumption' => True,
'trustedCertificateAuthorityIds' => %w[EXAMPLE--Value],
'certificateIds' => %w[EXAMPLE--Value],
'certificateName' => 'EXAMPLE-certificateName-Value',
'protocols' => %w[EXAMPLE--Value],
'cipherSuiteName' => 'EXAMPLE-cipherSuiteName-Value',
'serverOrderPreference' => 'DISABLED'
},
'sessionPersistenceConfiguration' => {
'cookieName' => 'EXAMPLE-cookieName-Value',
'disableFallback' => True
},
'lbCookieSessionPersistenceConfiguration' => {
'cookieName' => 'EXAMPLE-cookieName-Value',
'disableFallback' => True,
'domain' => 'EXAMPLE-domain-Value',
'path' => 'EXAMPLE-path-Value',
'maxAgeInSeconds' => 743,
'isSecure' => True,
'isHttpOnly' => False
}
}
},
network_security_group_ids: %w[EXAMPLE--Value],
certificates: {
'EXAMPLE_KEY_sSezt' => {
'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_qujpM' => {
'name' => 'EXAMPLE-name-Value', 'ciphers' => %w[EXAMPLE--Value]
}
},
path_route_sets: {
'EXAMPLE_KEY_jQMX6' => {
'pathRoutes' => [
{
'path' => 'EXAMPLE-path-Value',
'pathMatchType' => { 'matchType' => 'PREFIX_MATCH' },
'backendSetName' => 'EXAMPLE-backendSetName-Value'
}
]
}
},
freeform_tags: {
'EXAMPLE_KEY_xeuHc' => 'EXAMPLE_VALUE_oJ6O4y4mDJSSNSXsTRL8'
},
defined_tags: {
'EXAMPLE_KEY_YqCCp' => { 'EXAMPLE_KEY_TQ62Q' => 'EXAMPLE--Value' }
},
security_attributes: {
'EXAMPLE_KEY_44kEk' => { 'EXAMPLE_KEY_IjImG' => 'EXAMPLE--Value' }
},
rule_sets: {
'EXAMPLE_KEY_Lb4iF' => {
'items' => [
{
'action' => 'ALLOW',
'conditions' => [
{
'attributeName' => 'PATH',
'attributeValue' => 'EXAMPLE-attributeValue-Value',
'operator' => 'SUFFIX_MATCH'
}
],
'description' => 'EXAMPLE-description-Value'
}
]
}
}
)
)
# Get the data from response
puts "#{create_load_balancer_response.headers}"