// 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("HZAWSH7JX94H9NUV4VCF<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateLoadBalancerDetails: loadbalancer.CreateLoadBalancerDetails{IsDeleteProtectionEnabled: common.Bool(false),
			IsPrivate: common.Bool(true),
			RuleSets: map[string]loadbalancer.RuleSetDetails{"EXAMPLE_KEY_uPxt4": loadbalancer.RuleSetDetails{Items: []loadbalancer.Rule{loadbalancer.HttpHeaderRule{AreInvalidCharactersAllowed: common.Bool(true),
				HttpLargeHeaderSizeInKB: common.Int(253)}}}},
			SubnetIds:          []string{"EXAMPLE--Value"},
			CompartmentId:      common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			IpMode:             loadbalancer.CreateLoadBalancerDetailsIpModeIpv4,
			IsRequestIdEnabled: common.Bool(false),
			Listeners: map[string]loadbalancer.ListenerDetails{"EXAMPLE_KEY_cxq6h": loadbalancer.ListenerDetails{HostnameNames: []string{"EXAMPLE--Value"},
				PathRouteSetName: common.String("EXAMPLE-pathRouteSetName-Value"),
				Protocol:         common.String("EXAMPLE-protocol-Value"),
				RuleSetNames:     []string{"EXAMPLE--Value"},
				ConnectionConfiguration: &loadbalancer.ConnectionConfiguration{BackendTcpProxyProtocolOptions: []loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsEnum{loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsPp2TypeAuthority},
					BackendTcpProxyProtocolVersion: common.Int(1),
					IdleTimeout:                    common.Int64(471)},
				DefaultBackendSetName: common.String("EXAMPLE-defaultBackendSetName-Value"),
				Port:                  common.Int(29660),
				RoutingPolicyName:     common.String("EXAMPLE-routingPolicyName-Value"),
				SslConfiguration: &loadbalancer.SslConfigurationDetails{HasSessionResumption: common.Bool(true),
					ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
					TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
					CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
					Protocols:                      []string{"EXAMPLE--Value"},
					VerifyDepth:                    common.Int(584),
					VerifyPeerCertificate:          common.Bool(true),
					CertificateIds:                 []string{"EXAMPLE--Value"},
					CertificateName:                common.String("EXAMPLE-certificateName-Value")}}},
			PathRouteSets: map[string]loadbalancer.PathRouteSetDetails{"EXAMPLE_KEY_WbodV": 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}}}}},
			SecurityAttributes: map[string]map[string]interface{}{"EXAMPLE_KEY_jeHP9": map[string]interface{}{"EXAMPLE_KEY_BBiWX": "EXAMPLE--Value"}},
			DefinedTags:        map[string]map[string]interface{}{"EXAMPLE_KEY_Ja5ws": map[string]interface{}{"EXAMPLE_KEY_TfJRI": "EXAMPLE--Value"}},
			DisplayName:        common.String("EXAMPLE-displayName-Value"),
			FreeformTags:       map[string]string{"EXAMPLE_KEY_L3qLv": "EXAMPLE_VALUE_A2qnCZ6718Sn2sFaUHdw"},
			Hostnames: map[string]loadbalancer.HostnameDetails{"EXAMPLE_KEY_qdxyb": loadbalancer.HostnameDetails{Hostname: common.String("EXAMPLE-hostname-Value"),
				Name: common.String("EXAMPLE-name-Value")}},
			Ipv6SubnetCidr:  common.String("EXAMPLE-ipv6SubnetCidr-Value"),
			RequestIdHeader: common.String("EXAMPLE-requestIdHeader-Value"),
			ReservedIps:     []loadbalancer.ReservedIp{loadbalancer.ReservedIp{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")}},
			ShapeName:       common.String("EXAMPLE-shapeName-Value"),
			BackendSets: map[string]loadbalancer.BackendSetDetails{"EXAMPLE_KEY_rNZLE": loadbalancer.BackendSetDetails{Policy: common.String("EXAMPLE-policy-Value"),
				SessionPersistenceConfiguration: &loadbalancer.SessionPersistenceConfigurationDetails{CookieName: common.String("EXAMPLE-cookieName-Value"),
					DisableFallback: common.Bool(false)},
				SslConfiguration: &loadbalancer.SslConfigurationDetails{CertificateIds: []string{"EXAMPLE--Value"},
					CertificateName:                common.String("EXAMPLE-certificateName-Value"),
					CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
					Protocols:                      []string{"EXAMPLE--Value"},
					ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceDisabled,
					TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
					VerifyDepth:                    common.Int(673),
					HasSessionResumption:           common.Bool(true),
					VerifyPeerCertificate:          common.Bool(false)},
				BackendMaxConnections: common.Int(18699),
				Backends: []loadbalancer.BackendDetails{loadbalancer.BackendDetails{Drain: common.Bool(false),
					IpAddress:      common.String("EXAMPLE-ipAddress-Value"),
					MaxConnections: common.Int(3702),
					Offline:        common.Bool(false),
					Port:           common.Int(31108),
					Weight:         common.Int(117),
					Backup:         common.Bool(false)}},
				HealthChecker: &loadbalancer.HealthCheckerDetails{ResponseBodyRegex: common.String("EXAMPLE-responseBodyRegex-Value"),
					TimeoutInMillis:  common.Int(249085),
					IsForcePlainText: common.Bool(true),
					Port:             common.Int(50430),
					Retries:          common.Int(150),
					ReturnCode:       common.Int(268),
					UrlPath:          common.String("EXAMPLE-urlPath-Value"),
					IntervalInMillis: common.Int(769239),
					Protocol:         common.String("EXAMPLE-protocol-Value")},
				LbCookieSessionPersistenceConfiguration: &loadbalancer.LbCookieSessionPersistenceConfigurationDetails{MaxAgeInSeconds: common.Int(25),
					Path:            common.String("EXAMPLE-path-Value"),
					CookieName:      common.String("EXAMPLE-cookieName-Value"),
					DisableFallback: common.Bool(true),
					Domain:          common.String("EXAMPLE-domain-Value"),
					IsHttpOnly:      common.Bool(true),
					IsSecure:        common.Bool(true)}}},
			NetworkSecurityGroupIds: []string{"EXAMPLE--Value"},
			ShapeDetails: &loadbalancer.ShapeDetails{MaximumBandwidthInMbps: common.Int(2909),
				MinimumBandwidthInMbps: common.Int(3133)},
			SslCipherSuites: map[string]loadbalancer.SslCipherSuiteDetails{"EXAMPLE_KEY_iGXA6": loadbalancer.SslCipherSuiteDetails{Ciphers: []string{"EXAMPLE--Value"},
				Name: common.String("EXAMPLE-name-Value")}},
			Certificates: map[string]loadbalancer.CertificateDetails{"EXAMPLE_KEY_cJJTx": 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")}}}}

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