// 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{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateLoadBalancerDetails: loadbalancer.CreateLoadBalancerDetails{BackendSets: map[string]loadbalancer.BackendSetDetails{"EXAMPLE_KEY_kWlcM": loadbalancer.BackendSetDetails{BackendMaxConnections: common.Int(3702),
			Backends: []loadbalancer.BackendDetails{loadbalancer.BackendDetails{Weight: common.Int(268),
				Backup:         common.Bool(true),
				Drain:          common.Bool(true),
				IpAddress:      common.String("EXAMPLE-ipAddress-Value"),
				MaxConnections: common.Int(51520),
				Offline:        common.Bool(true),
				Port:           common.Int(65170)}},
			HealthChecker: &loadbalancer.HealthCheckerDetails{IsForcePlainText: common.Bool(true),
				Port:              common.Int(9500),
				Protocol:          common.String("EXAMPLE-protocol-Value"),
				ResponseBodyRegex: common.String("EXAMPLE-responseBodyRegex-Value"),
				ReturnCode:        common.Int(109),
				TimeoutInMillis:   common.Int(459638),
				IntervalInMillis:  common.Int(90577),
				Retries:           common.Int(560),
				UrlPath:           common.String("EXAMPLE-urlPath-Value")},
			LbCookieSessionPersistenceConfiguration: &loadbalancer.LbCookieSessionPersistenceConfigurationDetails{IsHttpOnly: common.Bool(false),
				IsSecure:        common.Bool(true),
				MaxAgeInSeconds: common.Int(792),
				Path:            common.String("EXAMPLE-path-Value"),
				CookieName:      common.String("EXAMPLE-cookieName-Value"),
				DisableFallback: common.Bool(false),
				Domain:          common.String("EXAMPLE-domain-Value")},
			Policy: common.String("EXAMPLE-policy-Value"),
			SessionPersistenceConfiguration: &loadbalancer.SessionPersistenceConfigurationDetails{CookieName: common.String("EXAMPLE-cookieName-Value"),
				DisableFallback: common.Bool(true)},
			SslConfiguration: &loadbalancer.SslConfigurationDetails{CertificateIds: []string{"EXAMPLE--Value"},
				CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
				HasSessionResumption:           common.Bool(true),
				Protocols:                      []string{"EXAMPLE--Value"},
				TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
				VerifyDepth:                    common.Int(441),
				CertificateName:                common.String("EXAMPLE-certificateName-Value"),
				ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
				VerifyPeerCertificate:          common.Bool(true)}}},
			CompartmentId:  common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			DisplayName:    common.String("EXAMPLE-displayName-Value"),
			IpMode:         loadbalancer.CreateLoadBalancerDetailsIpModeIpv4,
			Ipv6SubnetCidr: common.String("EXAMPLE-ipv6SubnetCidr-Value"),
			PathRouteSets: map[string]loadbalancer.PathRouteSetDetails{"EXAMPLE_KEY_xiGXA": loadbalancer.PathRouteSetDetails{PathRoutes: []loadbalancer.PathRoute{loadbalancer.PathRoute{BackendSetName: common.String("EXAMPLE-backendSetName-Value"),
				Path:          common.String("EXAMPLE-path-Value"),
				PathMatchType: &loadbalancer.PathMatchType{MatchType: loadbalancer.PathMatchTypeMatchTypeSuffixMatch}}}}},
			DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_dwTfJ": map[string]interface{}{"EXAMPLE_KEY_sFaUH": "EXAMPLE--Value"}},
			IsPrivate:   common.Bool(true),
			ReservedIps: []loadbalancer.ReservedIp{loadbalancer.ReservedIp{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")}},
			RuleSets: map[string]loadbalancer.RuleSetDetails{"EXAMPLE_KEY_XjeHP": loadbalancer.RuleSetDetails{Items: []loadbalancer.Rule{loadbalancer.AddHttpResponseHeaderRule{Header: common.String("EXAMPLE-header-Value"),
				Value: common.String("EXAMPLE-value-Value")}}}},
			ShapeDetails: &loadbalancer.ShapeDetails{MaximumBandwidthInMbps: common.Int(4007),
				MinimumBandwidthInMbps: common.Int(1248)},
			SubnetIds:               []string{"EXAMPLE--Value"},
			IsRequestIdEnabled:      common.Bool(true),
			NetworkSecurityGroupIds: []string{"EXAMPLE--Value"},
			Certificates: map[string]loadbalancer.CertificateDetails{"EXAMPLE_KEY_uqrNZ": 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")}},
			FreeformTags: map[string]string{"EXAMPLE_KEY_6zWbo": "EXAMPLE_VALUE_dVL3qLvA2qnCZ6718Sn2"},
			Hostnames: map[string]loadbalancer.HostnameDetails{"EXAMPLE_KEY_SUcxq": loadbalancer.HostnameDetails{Name: common.String("EXAMPLE-name-Value"),
				Hostname: common.String("EXAMPLE-hostname-Value")}},
			ShapeName:                 common.String("EXAMPLE-shapeName-Value"),
			IsDeleteProtectionEnabled: common.Bool(true),
			Listeners: map[string]loadbalancer.ListenerDetails{"EXAMPLE_KEY_IGi0I": loadbalancer.ListenerDetails{ConnectionConfiguration: &loadbalancer.ConnectionConfiguration{BackendTcpProxyProtocolVersion: common.Int(1),
				IdleTimeout:                    common.Int64(646),
				BackendTcpProxyProtocolOptions: []loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsEnum{loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsPp2TypeAuthority}},
				HostnameNames:         []string{"EXAMPLE--Value"},
				PathRouteSetName:      common.String("EXAMPLE-pathRouteSetName-Value"),
				Port:                  common.Int(14738),
				Protocol:              common.String("EXAMPLE-protocol-Value"),
				RuleSetNames:          []string{"EXAMPLE--Value"},
				DefaultBackendSetName: common.String("EXAMPLE-defaultBackendSetName-Value"),
				RoutingPolicyName:     common.String("EXAMPLE-routingPolicyName-Value"),
				SslConfiguration: &loadbalancer.SslConfigurationDetails{ServerOrderPreference: loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
					TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
					VerifyDepth:                    common.Int(258),
					VerifyPeerCertificate:          common.Bool(false),
					CertificateName:                common.String("EXAMPLE-certificateName-Value"),
					CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
					HasSessionResumption:           common.Bool(false),
					CertificateIds:                 []string{"EXAMPLE--Value"},
					Protocols:                      []string{"EXAMPLE--Value"}}}},
			RequestIdHeader:    common.String("EXAMPLE-requestIdHeader-Value"),
			SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_wsBBi": map[string]interface{}{"EXAMPLE_KEY_RIJa5": "EXAMPLE--Value"}},
			SslCipherSuites: map[string]loadbalancer.SslCipherSuiteDetails{"EXAMPLE_KEY_LEcJJ": loadbalancer.SslCipherSuiteDetails{Ciphers: []string{"EXAMPLE--Value"},
				Name: common.String("EXAMPLE-name-Value")}}},
		OpcRequestId: common.String("9FCGXUPXT4HZAWSH7JX9<unique_ID>")}

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