// 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{CreateLoadBalancerDetails: loadbalancer.CreateLoadBalancerDetails{DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_6Eykt": map[string]interface{}{"EXAMPLE_KEY_pIknf": "EXAMPLE--Value"}},
		DisplayName: common.String("EXAMPLE-displayName-Value"),
		Hostnames: map[string]loadbalancer.HostnameDetails{"EXAMPLE_KEY_fiRO3": loadbalancer.HostnameDetails{Name: common.String("EXAMPLE-name-Value"),
			Hostname: common.String("EXAMPLE-hostname-Value")}},
		PathRouteSets: map[string]loadbalancer.PathRouteSetDetails{"EXAMPLE_KEY_jHUo8": 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}}}}},
		ReservedIps: []loadbalancer.ReservedIp{loadbalancer.ReservedIp{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")}},
		ShapeName:   common.String("EXAMPLE-shapeName-Value"),
		SslCipherSuites: map[string]loadbalancer.SslCipherSuiteDetails{"EXAMPLE_KEY_HrgMu": loadbalancer.SslCipherSuiteDetails{Ciphers: []string{"EXAMPLE--Value"},
			Name: common.String("EXAMPLE-name-Value")}},
		Certificates: map[string]loadbalancer.CertificateDetails{"EXAMPLE_KEY_admYw": 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")}},
		IsPrivate:          common.Bool(true),
		IsRequestIdEnabled: common.Bool(false),
		Listeners: map[string]loadbalancer.ListenerDetails{"EXAMPLE_KEY_ugBao": loadbalancer.ListenerDetails{DefaultBackendSetName: common.String("EXAMPLE-defaultBackendSetName-Value"),
			HostnameNames:     []string{"EXAMPLE--Value"},
			RoutingPolicyName: common.String("EXAMPLE-routingPolicyName-Value"),
			RuleSetNames:      []string{"EXAMPLE--Value"},
			SslConfiguration: &loadbalancer.SslConfigurationDetails{CertificateName: common.String("EXAMPLE-certificateName-Value"),
				CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
				HasSessionResumption:           common.Bool(true),
				ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
				Protocols:                      []string{"EXAMPLE--Value"},
				TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
				VerifyDepth:                    common.Int(536),
				VerifyPeerCertificate:          common.Bool(false),
				CertificateIds:                 []string{"EXAMPLE--Value"}},
			ConnectionConfiguration: &loadbalancer.ConnectionConfiguration{BackendTcpProxyProtocolOptions: []loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsEnum{loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsPp2TypeAuthority},
				BackendTcpProxyProtocolVersion: common.Int(1),
				IdleTimeout:                    common.Int64(407)},
			PathRouteSetName: common.String("EXAMPLE-pathRouteSetName-Value"),
			Port:             common.Int(50406),
			Protocol:         common.String("EXAMPLE-protocol-Value")}},
		NetworkSecurityGroupIds: []string{"EXAMPLE--Value"},
		RequestIdHeader:         common.String("EXAMPLE-requestIdHeader-Value"),
		BackendSets: map[string]loadbalancer.BackendSetDetails{"EXAMPLE_KEY_hOOHB": loadbalancer.BackendSetDetails{SslConfiguration: &loadbalancer.SslConfigurationDetails{CertificateIds: []string{"EXAMPLE--Value"},
			CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
			HasSessionResumption:           common.Bool(true),
			ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
			CertificateName:                common.String("EXAMPLE-certificateName-Value"),
			Protocols:                      []string{"EXAMPLE--Value"},
			TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
			VerifyDepth:                    common.Int(897),
			VerifyPeerCertificate:          common.Bool(true)},
			BackendMaxConnections: common.Int(46297),
			Backends: []loadbalancer.BackendDetails{loadbalancer.BackendDetails{Backup: common.Bool(false),
				Drain:          common.Bool(true),
				IpAddress:      common.String("EXAMPLE-ipAddress-Value"),
				MaxConnections: common.Int(62220),
				Offline:        common.Bool(true),
				Port:           common.Int(26443),
				Weight:         common.Int(30)}},
			HealthChecker: &loadbalancer.HealthCheckerDetails{ResponseBodyRegex: common.String("EXAMPLE-responseBodyRegex-Value"),
				TimeoutInMillis:  common.Int(546994),
				IsForcePlainText: common.Bool(true),
				Port:             common.Int(36895),
				Protocol:         common.String("EXAMPLE-protocol-Value"),
				Retries:          common.Int(470),
				ReturnCode:       common.Int(25),
				UrlPath:          common.String("EXAMPLE-urlPath-Value"),
				IntervalInMillis: common.Int(1273)},
			LbCookieSessionPersistenceConfiguration: &loadbalancer.LbCookieSessionPersistenceConfigurationDetails{Domain: common.String("EXAMPLE-domain-Value"),
				IsHttpOnly:      common.Bool(false),
				IsSecure:        common.Bool(false),
				MaxAgeInSeconds: common.Int(343),
				Path:            common.String("EXAMPLE-path-Value"),
				CookieName:      common.String("EXAMPLE-cookieName-Value"),
				DisableFallback: common.Bool(true)},
			Policy: common.String("EXAMPLE-policy-Value"),
			SessionPersistenceConfiguration: &loadbalancer.SessionPersistenceConfigurationDetails{CookieName: common.String("EXAMPLE-cookieName-Value"),
				DisableFallback: common.Bool(true)}}},
		IpMode:                    loadbalancer.CreateLoadBalancerDetailsIpModeIpv4,
		Ipv6SubnetCidr:            common.String("EXAMPLE-ipv6SubnetCidr-Value"),
		IsDeleteProtectionEnabled: common.Bool(false),
		RuleSets: map[string]loadbalancer.RuleSetDetails{"EXAMPLE_KEY_IIGdK": loadbalancer.RuleSetDetails{Items: []loadbalancer.Rule{loadbalancer.ExtendHttpRequestHeaderValueRule{Header: common.String("EXAMPLE-header-Value"),
			Prefix: common.String("EXAMPLE-prefix-Value"),
			Suffix: common.String("EXAMPLE-suffix-Value")}}}},
		SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_q05Tf": map[string]interface{}{"EXAMPLE_KEY_QohJU": "EXAMPLE--Value"}},
		CompartmentId:      common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		FreeformTags:       map[string]string{"EXAMPLE_KEY_8Qfo6": "EXAMPLE_VALUE_nIWzxAsWUAdl5oQa8FuM"},
		ShapeDetails: &loadbalancer.ShapeDetails{MaximumBandwidthInMbps: common.Int(747),
			MinimumBandwidthInMbps: common.Int(6329)},
		SubnetIds: []string{"EXAMPLE--Value"}},
		OpcRequestId:  common.String("ELDOZQTMFJFJMXBEIEME<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-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)
}