// 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("NICA2KFWKZJHOOHBADMY<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateLoadBalancerDetails: loadbalancer.CreateLoadBalancerDetails{FreeformTags: map[string]string{"EXAMPLE_KEY_hzAWS": "EXAMPLE_VALUE_H7jX94H9NUV4vCFugBao"},
			Hostnames: map[string]loadbalancer.HostnameDetails{"EXAMPLE_KEY_bodVL": loadbalancer.HostnameDetails{Hostname: common.String("EXAMPLE-hostname-Value"),
				Name: common.String("EXAMPLE-name-Value")}},
			IsDeleteProtectionEnabled: common.Bool(true),
			IsRequestIdEnabled:        common.Bool(true),
			Listeners: map[string]loadbalancer.ListenerDetails{"EXAMPLE_KEY_XA6zW": loadbalancer.ListenerDetails{Port: common.Int(20562),
				Protocol:              common.String("EXAMPLE-protocol-Value"),
				RoutingPolicyName:     common.String("EXAMPLE-routingPolicyName-Value"),
				DefaultBackendSetName: common.String("EXAMPLE-defaultBackendSetName-Value"),
				HostnameNames:         []string{"EXAMPLE--Value"},
				RuleSetNames:          []string{"EXAMPLE--Value"},
				SslConfiguration: &loadbalancer.SslConfigurationDetails{ServerOrderPreference: loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
					VerifyDepth:                    common.Int(943),
					VerifyPeerCertificate:          common.Bool(false),
					HasSessionResumption:           common.Bool(false),
					Protocols:                      []string{"EXAMPLE--Value"},
					TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
					CertificateIds:                 []string{"EXAMPLE--Value"},
					CertificateName:                common.String("EXAMPLE-certificateName-Value"),
					CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value")},
				ConnectionConfiguration: &loadbalancer.ConnectionConfiguration{BackendTcpProxyProtocolOptions: []loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsEnum{loadbalancer.ConnectionConfigurationBackendTcpProxyProtocolOptionsPp2TypeAuthority},
					BackendTcpProxyProtocolVersion: common.Int(1),
					IdleTimeout:                    common.Int64(901)},
				PathRouteSetName: common.String("EXAMPLE-pathRouteSetName-Value")}},
			PathRouteSets: map[string]loadbalancer.PathRouteSetDetails{"EXAMPLE_KEY_uPxt4": loadbalancer.PathRouteSetDetails{PathRoutes: []loadbalancer.PathRoute{loadbalancer.PathRoute{PathMatchType: &loadbalancer.PathMatchType{MatchType: loadbalancer.PathMatchTypeMatchTypeForceLongestPrefixMatch},
				BackendSetName: common.String("EXAMPLE-backendSetName-Value"),
				Path:           common.String("EXAMPLE-path-Value")}}}},
			BackendSets: map[string]loadbalancer.BackendSetDetails{"EXAMPLE_KEY_wsBBi": loadbalancer.BackendSetDetails{SslConfiguration: &loadbalancer.SslConfigurationDetails{CertificateIds: []string{"EXAMPLE--Value"},
				CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
				HasSessionResumption:           common.Bool(false),
				Protocols:                      []string{"EXAMPLE--Value"},
				ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceDisabled,
				TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
				VerifyPeerCertificate:          common.Bool(true),
				CertificateName:                common.String("EXAMPLE-certificateName-Value"),
				VerifyDepth:                    common.Int(30)},
				BackendMaxConnections: common.Int(43787),
				Backends: []loadbalancer.BackendDetails{loadbalancer.BackendDetails{Backup: common.Bool(false),
					Drain:          common.Bool(false),
					IpAddress:      common.String("EXAMPLE-ipAddress-Value"),
					MaxConnections: common.Int(17774),
					Offline:        common.Bool(false),
					Port:           common.Int(54698),
					Weight:         common.Int(14)}},
				HealthChecker: &loadbalancer.HealthCheckerDetails{Protocol: common.String("EXAMPLE-protocol-Value"),
					Retries:           common.Int(367),
					ReturnCode:        common.Int(284),
					TimeoutInMillis:   common.Int(271073),
					UrlPath:           common.String("EXAMPLE-urlPath-Value"),
					IntervalInMillis:  common.Int(96844),
					Port:              common.Int(43957),
					ResponseBodyRegex: common.String("EXAMPLE-responseBodyRegex-Value"),
					IsForcePlainText:  common.Bool(false)},
				LbCookieSessionPersistenceConfiguration: &loadbalancer.LbCookieSessionPersistenceConfigurationDetails{DisableFallback: common.Bool(false),
					Domain:          common.String("EXAMPLE-domain-Value"),
					IsHttpOnly:      common.Bool(true),
					IsSecure:        common.Bool(false),
					MaxAgeInSeconds: common.Int(677),
					Path:            common.String("EXAMPLE-path-Value"),
					CookieName:      common.String("EXAMPLE-cookieName-Value")},
				Policy: common.String("EXAMPLE-policy-Value"),
				SessionPersistenceConfiguration: &loadbalancer.SessionPersistenceConfigurationDetails{DisableFallback: common.Bool(false),
					CookieName: common.String("EXAMPLE-cookieName-Value")}}},
			DisplayName:             common.String("EXAMPLE-displayName-Value"),
			NetworkSecurityGroupIds: []string{"EXAMPLE--Value"},
			ReservedIps:             []loadbalancer.ReservedIp{loadbalancer.ReservedIp{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")}},
			SubnetIds:               []string{"EXAMPLE--Value"},
			DefinedTags:             map[string]map[string]interface{}{"EXAMPLE_KEY_4diC9": map[string]interface{}{"EXAMPLE_KEY_fiRO3": "EXAMPLE--Value"}},
			IpMode:                  loadbalancer.CreateLoadBalancerDetailsIpModeIpv4,
			IsPrivate:               common.Bool(true),
			RequestIdHeader:         common.String("EXAMPLE-requestIdHeader-Value"),
			RuleSets: map[string]loadbalancer.RuleSetDetails{"EXAMPLE_KEY_bhjKU": 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_gD7UI": map[string]interface{}{"EXAMPLE_KEY_tmE6I": "EXAMPLE--Value"}},
			ShapeDetails: &loadbalancer.ShapeDetails{MaximumBandwidthInMbps: common.Int(2252),
				MinimumBandwidthInMbps: common.Int(4641)},
			Certificates: map[string]loadbalancer.CertificateDetails{"EXAMPLE_KEY_WXjeH": loadbalancer.CertificateDetails{PrivateKey: common.String("EXAMPLE-privateKey-Value"),
				PublicCertificate: common.String("EXAMPLE-publicCertificate-Value"),
				CaCertificate:     common.String("EXAMPLE-caCertificate-Value"),
				CertificateName:   common.String("EXAMPLE-certificateName-Value"),
				Passphrase:        common.String("EXAMPLE-passphrase-Value")}},
			Ipv6SubnetCidr: common.String("EXAMPLE-ipv6SubnetCidr-Value"),
			ShapeName:      common.String("EXAMPLE-shapeName-Value"),
			SslCipherSuites: map[string]loadbalancer.SslCipherSuiteDetails{"EXAMPLE_KEY_P9fCG": loadbalancer.SslCipherSuiteDetails{Ciphers: []string{"EXAMPLE--Value"},
				Name: common.String("EXAMPLE-name-Value")}},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-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)
}