// 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_qfBCg": map[string]interface{}{"EXAMPLE_KEY_gdvwp": "EXAMPLE--Value"}},
		DisplayName:        common.String("EXAMPLE-displayName-Value"),
		FreeformTags:       map[string]string{"EXAMPLE_KEY_uEYQx": "EXAMPLE_VALUE_JSupsKKQVP0fAWUZwHx2"},
		IpMode:             loadbalancer.CreateLoadBalancerDetailsIpModeIpv6,
		IsRequestIdEnabled: common.Bool(true),
		ReservedIps:        []loadbalancer.ReservedIp{loadbalancer.ReservedIp{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")}},
		BackendSets: map[string]loadbalancer.BackendSetDetails{"EXAMPLE_KEY_gT7hW": loadbalancer.BackendSetDetails{Policy: common.String("EXAMPLE-policy-Value"),
			SessionPersistenceConfiguration: &loadbalancer.SessionPersistenceConfigurationDetails{CookieName: common.String("EXAMPLE-cookieName-Value"),
				DisableFallback: common.Bool(false)},
			SslConfiguration: &loadbalancer.SslConfigurationDetails{HasSessionResumption: common.Bool(false),
				Protocols:                      []string{"EXAMPLE--Value"},
				VerifyDepth:                    common.Int(654),
				VerifyPeerCertificate:          common.Bool(true),
				CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
				CertificateName:                common.String("EXAMPLE-certificateName-Value"),
				ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
				TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
				CertificateIds:                 []string{"EXAMPLE--Value"}},
			BackendMaxConnections: common.Int(31433),
			Backends: []loadbalancer.BackendDetails{loadbalancer.BackendDetails{MaxConnections: common.Int(4666),
				Offline:   common.Bool(false),
				Port:      common.Int(5086),
				Weight:    common.Int(425),
				Backup:    common.Bool(true),
				Drain:     common.Bool(false),
				IpAddress: common.String("EXAMPLE-ipAddress-Value")}},
			HealthChecker: &loadbalancer.HealthCheckerDetails{Port: common.Int(52273),
				Protocol:          common.String("EXAMPLE-protocol-Value"),
				ResponseBodyRegex: common.String("EXAMPLE-responseBodyRegex-Value"),
				UrlPath:           common.String("EXAMPLE-urlPath-Value"),
				IntervalInMillis:  common.Int(342702),
				IsForcePlainText:  common.Bool(true),
				Retries:           common.Int(617),
				ReturnCode:        common.Int(385),
				TimeoutInMillis:   common.Int(315042)},
			LbCookieSessionPersistenceConfiguration: &loadbalancer.LbCookieSessionPersistenceConfigurationDetails{CookieName: common.String("EXAMPLE-cookieName-Value"),
				DisableFallback: common.Bool(true),
				Domain:          common.String("EXAMPLE-domain-Value"),
				IsHttpOnly:      common.Bool(false),
				IsSecure:        common.Bool(true),
				MaxAgeInSeconds: common.Int(403),
				Path:            common.String("EXAMPLE-path-Value")}}},
		Hostnames: map[string]loadbalancer.HostnameDetails{"EXAMPLE_KEY_UzqNH": loadbalancer.HostnameDetails{Hostname: common.String("EXAMPLE-hostname-Value"),
			Name: common.String("EXAMPLE-name-Value")}},
		Ipv6SubnetCidr:          common.String("EXAMPLE-ipv6SubnetCidr-Value"),
		NetworkSecurityGroupIds: []string{"EXAMPLE--Value"},
		PathRouteSets: map[string]loadbalancer.PathRouteSetDetails{"EXAMPLE_KEY_ojNBd": loadbalancer.PathRouteSetDetails{PathRoutes: []loadbalancer.PathRoute{loadbalancer.PathRoute{BackendSetName: common.String("EXAMPLE-backendSetName-Value"),
			Path:          common.String("EXAMPLE-path-Value"),
			PathMatchType: &loadbalancer.PathMatchType{MatchType: loadbalancer.PathMatchTypeMatchTypePrefixMatch}}}}},
		RequestIdHeader:    common.String("EXAMPLE-requestIdHeader-Value"),
		SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_4r9RE": map[string]interface{}{"EXAMPLE_KEY_EOaQq": "EXAMPLE--Value"}},
		SubnetIds:          []string{"EXAMPLE--Value"},
		Certificates: map[string]loadbalancer.CertificateDetails{"EXAMPLE_KEY_nrzWp": loadbalancer.CertificateDetails{PublicCertificate: common.String("EXAMPLE-publicCertificate-Value"),
			CaCertificate:   common.String("EXAMPLE-caCertificate-Value"),
			CertificateName: common.String("EXAMPLE-certificateName-Value"),
			Passphrase:      common.String("EXAMPLE-passphrase-Value"),
			PrivateKey:      common.String("EXAMPLE-privateKey-Value")}},
		ShapeDetails: &loadbalancer.ShapeDetails{MaximumBandwidthInMbps: common.Int(297),
			MinimumBandwidthInMbps: common.Int(1910)},
		ShapeName:                 common.String("EXAMPLE-shapeName-Value"),
		IsDeleteProtectionEnabled: common.Bool(true),
		IsPrivate:                 common.Bool(true),
		Listeners: map[string]loadbalancer.ListenerDetails{"EXAMPLE_KEY_5vdJZ": loadbalancer.ListenerDetails{PathRouteSetName: common.String("EXAMPLE-pathRouteSetName-Value"),
			SslConfiguration: &loadbalancer.SslConfigurationDetails{Protocols: []string{"EXAMPLE--Value"},
				ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceDisabled,
				VerifyDepth:                    common.Int(216),
				CertificateIds:                 []string{"EXAMPLE--Value"},
				CertificateName:                common.String("EXAMPLE-certificateName-Value"),
				CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
				HasSessionResumption:           common.Bool(true),
				TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
				VerifyPeerCertificate:          common.Bool(false)},
			DefaultBackendSetName: common.String("EXAMPLE-defaultBackendSetName-Value"),
			HostnameNames:         []string{"EXAMPLE--Value"},
			Protocol:              common.String("EXAMPLE-protocol-Value"),
			RoutingPolicyName:     common.String("EXAMPLE-routingPolicyName-Value"),
			RuleSetNames:          []string{"EXAMPLE--Value"},
			ConnectionConfiguration: &loadbalancer.ConnectionConfiguration{BackendTcpProxyProtocolOptions: []loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsEnum{loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsPp2TypeAuthority},
				BackendTcpProxyProtocolVersion: common.Int(1),
				IdleTimeout:                    common.Int64(857)},
			Port: common.Int(6080)}},
		RuleSets: map[string]loadbalancer.RuleSetDetails{"EXAMPLE_KEY_c89pB": loadbalancer.RuleSetDetails{Items: []loadbalancer.Rule{loadbalancer.RedirectRule{Conditions: []loadbalancer.RuleCondition{loadbalancer.SourceVcnIdCondition{AttributeValue: common.String("EXAMPLE-attributeValue-Value")}},
			RedirectUri: &loadbalancer.RedirectUri{Host: common.String("EXAMPLE-host-Value"),
				Path:     common.String("EXAMPLE-path-Value"),
				Port:     common.Int(6684),
				Protocol: common.String("EXAMPLE-protocol-Value"),
				Query:    common.String("EXAMPLE-query-Value")},
			ResponseCode: common.Int(303)}}}},
		SslCipherSuites: map[string]loadbalancer.SslCipherSuiteDetails{"EXAMPLE_KEY_ASMqq": loadbalancer.SslCipherSuiteDetails{Ciphers: []string{"EXAMPLE--Value"},
			Name: common.String("EXAMPLE-name-Value")}},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")},
		OpcRequestId:  common.String("P2SYUTPVKDUITENVJPKU<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)
}