// 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).

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
	"github.com/oracle/oci-go-sdk/v65/loadbalancer"
)

func ExampleCreateLoadBalancer() {
	// Create a default authentication provider that uses the DEFAULT
	// profile in the configuration file.
	// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
	client, err := loadbalancer.NewLoadBalancerClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := loadbalancer.CreateLoadBalancerRequest{OpcRequestId: common.String("SK1NENFN9ORDAGKSAU8M<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateLoadBalancerDetails: loadbalancer.CreateLoadBalancerDetails{FreeformTags: map[string]string{"EXAMPLE_KEY_0CHEl": "EXAMPLE_VALUE_3o9A1xm11SPrEBDlNLBz"},
			Hostnames: map[string]loadbalancer.HostnameDetails{"EXAMPLE_KEY_OLPjS": loadbalancer.HostnameDetails{Hostname: common.String("EXAMPLE-hostname-Value"),
				Name: common.String("EXAMPLE-name-Value")}},
			IsDeleteProtectionEnabled: common.Bool(true),
			RuleSets:                  map[string]loadbalancer.RuleSetDetails{"EXAMPLE_KEY_zP0Qy": loadbalancer.RuleSetDetails{Items: []loadbalancer.Rule{loadbalancer.RemoveHttpResponseHeaderRule{Header: common.String("EXAMPLE-header-Value")}}}},
			SslCipherSuites: map[string]loadbalancer.SslCipherSuiteDetails{"EXAMPLE_KEY_BZ671": loadbalancer.SslCipherSuiteDetails{Ciphers: []string{"EXAMPLE--Value"},
				Name: common.String("EXAMPLE-name-Value")}},
			DisplayName:             common.String("EXAMPLE-displayName-Value"),
			IsPrivate:               common.Bool(false),
			NetworkSecurityGroupIds: []string{"EXAMPLE--Value"},
			SubnetIds:               []string{"EXAMPLE--Value"},
			DefinedTags:             map[string]map[string]interface{}{"EXAMPLE_KEY_A4M1h": map[string]interface{}{"EXAMPLE_KEY_OTCmo": "EXAMPLE--Value"}},
			Ipv6SubnetCidr:          common.String("EXAMPLE-ipv6SubnetCidr-Value"),
			IsRequestIdEnabled:      common.Bool(true),
			PathRouteSets: map[string]loadbalancer.PathRouteSetDetails{"EXAMPLE_KEY_7ALG4": loadbalancer.PathRouteSetDetails{PathRoutes: []loadbalancer.PathRoute{loadbalancer.PathRoute{BackendSetName: common.String("EXAMPLE-backendSetName-Value"),
				Path:          common.String("EXAMPLE-path-Value"),
				PathMatchType: &loadbalancer.PathMatchType{MatchType: loadbalancer.PathMatchTypeMatchTypeForceLongestPrefixMatch}}}}},
			ReservedIps: []loadbalancer.ReservedIp{loadbalancer.ReservedIp{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")}},
			ShapeDetails: &loadbalancer.ShapeDetails{MaximumBandwidthInMbps: common.Int(1449),
				MinimumBandwidthInMbps: common.Int(1337)},
			ShapeName: common.String("EXAMPLE-shapeName-Value"),
			BackendSets: map[string]loadbalancer.BackendSetDetails{"EXAMPLE_KEY_UeY00": loadbalancer.BackendSetDetails{SslConfiguration: &loadbalancer.SslConfigurationDetails{VerifyPeerCertificate: common.Bool(false),
				HasSessionResumption:           common.Bool(true),
				Protocols:                      []string{"EXAMPLE--Value"},
				VerifyDepth:                    common.Int(345),
				CertificateIds:                 []string{"EXAMPLE--Value"},
				CertificateName:                common.String("EXAMPLE-certificateName-Value"),
				CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
				ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceDisabled,
				TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"}},
				BackendMaxConnections: common.Int(62821),
				Backends: []loadbalancer.BackendDetails{loadbalancer.BackendDetails{Offline: common.Bool(true),
					Port:           common.Int(18973),
					Weight:         common.Int(966),
					Backup:         common.Bool(true),
					Drain:          common.Bool(false),
					IpAddress:      common.String("EXAMPLE-ipAddress-Value"),
					MaxConnections: common.Int(2370)}},
				HealthChecker: &loadbalancer.HealthCheckerDetails{ResponseBodyRegex: common.String("EXAMPLE-responseBodyRegex-Value"),
					Retries:          common.Int(567),
					ReturnCode:       common.Int(580),
					TimeoutInMillis:  common.Int(7255),
					IntervalInMillis: common.Int(1.166412e+06),
					IsForcePlainText: common.Bool(false),
					Port:             common.Int(40682),
					Protocol:         common.String("EXAMPLE-protocol-Value"),
					UrlPath:          common.String("EXAMPLE-urlPath-Value")},
				LbCookieSessionPersistenceConfiguration: &loadbalancer.LbCookieSessionPersistenceConfigurationDetails{Domain: common.String("EXAMPLE-domain-Value"),
					IsHttpOnly:      common.Bool(true),
					IsSecure:        common.Bool(true),
					MaxAgeInSeconds: common.Int(937),
					Path:            common.String("EXAMPLE-path-Value"),
					CookieName:      common.String("EXAMPLE-cookieName-Value"),
					DisableFallback: common.Bool(false)},
				Policy: common.String("EXAMPLE-policy-Value"),
				SessionPersistenceConfiguration: &loadbalancer.SessionPersistenceConfigurationDetails{CookieName: common.String("EXAMPLE-cookieName-Value"),
					DisableFallback: common.Bool(false)}}},
			Certificates: map[string]loadbalancer.CertificateDetails{"EXAMPLE_KEY_m5TCu": loadbalancer.CertificateDetails{CaCertificate: common.String("EXAMPLE-caCertificate-Value"),
				CertificateName:   common.String("EXAMPLE-certificateName-Value"),
				Passphrase:        common.String("EXAMPLE-passphrase-Value"),
				PrivateKey:        common.String("EXAMPLE-privateKey-Value"),
				PublicCertificate: common.String("EXAMPLE-publicCertificate-Value")}},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			IpMode:        loadbalancer.CreateLoadBalancerDetailsIpModeIpv4,
			Listeners: map[string]loadbalancer.ListenerDetails{"EXAMPLE_KEY_FYGL8": loadbalancer.ListenerDetails{Protocol: common.String("EXAMPLE-protocol-Value"),
				SslConfiguration: &loadbalancer.SslConfigurationDetails{CertificateName: common.String("EXAMPLE-certificateName-Value"),
					HasSessionResumption:           common.Bool(false),
					TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
					VerifyPeerCertificate:          common.Bool(true),
					CertificateIds:                 []string{"EXAMPLE--Value"},
					CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
					Protocols:                      []string{"EXAMPLE--Value"},
					ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
					VerifyDepth:                    common.Int(580)},
				ConnectionConfiguration: &loadbalancer.ConnectionConfiguration{BackendTcpProxyProtocolVersion: common.Int(1),
					IdleTimeout:                    common.Int64(188),
					BackendTcpProxyProtocolOptions: []loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsEnum{loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsPp2TypeAuthority}},
				DefaultBackendSetName: common.String("EXAMPLE-defaultBackendSetName-Value"),
				HostnameNames:         []string{"EXAMPLE--Value"},
				RoutingPolicyName:     common.String("EXAMPLE-routingPolicyName-Value"),
				RuleSetNames:          []string{"EXAMPLE--Value"},
				PathRouteSetName:      common.String("EXAMPLE-pathRouteSetName-Value"),
				Port:                  common.Int(33499)}},
			RequestIdHeader:    common.String("EXAMPLE-requestIdHeader-Value"),
			SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_ZArx3": map[string]interface{}{"EXAMPLE_KEY_4rc8d": "EXAMPLE--Value"}}}}

	// Send the request using the service client
	resp, err := client.CreateLoadBalancer(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}