// 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{IpMode: loadbalancer.CreateLoadBalancerDetailsIpModeIpv6,
		IsDeleteProtectionEnabled: common.Bool(true),
		NetworkSecurityGroupIds:   []string{"EXAMPLE--Value"},
		ReservedIps:               []loadbalancer.ReservedIp{loadbalancer.ReservedIp{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")}},
		RuleSets: map[string]loadbalancer.RuleSetDetails{"EXAMPLE_KEY_IyBX4": loadbalancer.RuleSetDetails{Items: []loadbalancer.Rule{loadbalancer.AddHttpResponseHeaderRule{Header: common.String("EXAMPLE-header-Value"),
			Value: common.String("EXAMPLE-value-Value")}}}},
		ShapeName: common.String("EXAMPLE-shapeName-Value"),
		BackendSets: map[string]loadbalancer.BackendSetDetails{"EXAMPLE_KEY_j7I2F": loadbalancer.BackendSetDetails{Backends: []loadbalancer.BackendDetails{loadbalancer.BackendDetails{Weight: common.Int(97),
			Backup:         common.Bool(true),
			Drain:          common.Bool(true),
			IpAddress:      common.String("EXAMPLE-ipAddress-Value"),
			MaxConnections: common.Int(13667),
			Offline:        common.Bool(true),
			Port:           common.Int(17478)}},
			HealthChecker: &loadbalancer.HealthCheckerDetails{Protocol: common.String("EXAMPLE-protocol-Value"),
				TimeoutInMillis:   common.Int(85845),
				UrlPath:           common.String("EXAMPLE-urlPath-Value"),
				IntervalInMillis:  common.Int(1.093858e+06),
				IsForcePlainText:  common.Bool(false),
				Port:              common.Int(5982),
				ResponseBodyRegex: common.String("EXAMPLE-responseBodyRegex-Value"),
				Retries:           common.Int(985),
				ReturnCode:        common.Int(528)},
			LbCookieSessionPersistenceConfiguration: &loadbalancer.LbCookieSessionPersistenceConfigurationDetails{IsHttpOnly: common.Bool(true),
				IsSecure:        common.Bool(false),
				MaxAgeInSeconds: common.Int(115),
				Path:            common.String("EXAMPLE-path-Value"),
				CookieName:      common.String("EXAMPLE-cookieName-Value"),
				DisableFallback: common.Bool(true),
				Domain:          common.String("EXAMPLE-domain-Value")},
			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"},
				ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
				TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"},
				VerifyPeerCertificate:          common.Bool(false),
				CertificateName:                common.String("EXAMPLE-certificateName-Value"),
				CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
				HasSessionResumption:           common.Bool(true),
				Protocols:                      []string{"EXAMPLE--Value"},
				VerifyDepth:                    common.Int(928)},
			BackendMaxConnections: common.Int(49543)}},
		Certificates: map[string]loadbalancer.CertificateDetails{"EXAMPLE_KEY_RkZY7": 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")}},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		DefinedTags:   map[string]map[string]interface{}{"EXAMPLE_KEY_2KUCI": map[string]interface{}{"EXAMPLE_KEY_3r0BH": "EXAMPLE--Value"}},
		FreeformTags:  map[string]string{"EXAMPLE_KEY_c6ryD": "EXAMPLE_VALUE_MNyKQlS9mBVdOPe4HFSn"},
		IsPrivate:     common.Bool(false),
		PathRouteSets: map[string]loadbalancer.PathRouteSetDetails{"EXAMPLE_KEY_xhPtC": loadbalancer.PathRouteSetDetails{PathRoutes: []loadbalancer.PathRoute{loadbalancer.PathRoute{PathMatchType: &loadbalancer.PathMatchType{MatchType: loadbalancer.PathMatchTypeMatchTypePrefixMatch},
			BackendSetName: common.String("EXAMPLE-backendSetName-Value"),
			Path:           common.String("EXAMPLE-path-Value")}}}},
		Listeners: map[string]loadbalancer.ListenerDetails{"EXAMPLE_KEY_kZcxg": loadbalancer.ListenerDetails{ConnectionConfiguration: &loadbalancer.ConnectionConfiguration{BackendTcpProxyProtocolVersion: common.Int(1),
			IdleTimeout: common.Int64(477)},
			DefaultBackendSetName: common.String("EXAMPLE-defaultBackendSetName-Value"),
			PathRouteSetName:      common.String("EXAMPLE-pathRouteSetName-Value"),
			Port:                  common.Int(50422),
			RoutingPolicyName:     common.String("EXAMPLE-routingPolicyName-Value"),
			HostnameNames:         []string{"EXAMPLE--Value"},
			Protocol:              common.String("EXAMPLE-protocol-Value"),
			RuleSetNames:          []string{"EXAMPLE--Value"},
			SslConfiguration: &loadbalancer.SslConfigurationDetails{CertificateName: common.String("EXAMPLE-certificateName-Value"),
				CipherSuiteName:                common.String("EXAMPLE-cipherSuiteName-Value"),
				HasSessionResumption:           common.Bool(true),
				Protocols:                      []string{"EXAMPLE--Value"},
				ServerOrderPreference:          loadbalancer.SslConfigurationDetailsServerOrderPreferenceEnabled,
				VerifyDepth:                    common.Int(41),
				VerifyPeerCertificate:          common.Bool(false),
				CertificateIds:                 []string{"EXAMPLE--Value"},
				TrustedCertificateAuthorityIds: []string{"EXAMPLE--Value"}}}},
		SslCipherSuites: map[string]loadbalancer.SslCipherSuiteDetails{"EXAMPLE_KEY_C698e": loadbalancer.SslCipherSuiteDetails{Ciphers: []string{"EXAMPLE--Value"},
			Name: common.String("EXAMPLE-name-Value")}},
		SubnetIds:   []string{"EXAMPLE--Value"},
		DisplayName: common.String("EXAMPLE-displayName-Value"),
		Hostnames: map[string]loadbalancer.HostnameDetails{"EXAMPLE_KEY_VmTQs": loadbalancer.HostnameDetails{Hostname: common.String("EXAMPLE-hostname-Value"),
			Name: common.String("EXAMPLE-name-Value")}},
		ShapeDetails: &loadbalancer.ShapeDetails{MaximumBandwidthInMbps: common.Int(1011),
			MinimumBandwidthInMbps: common.Int(7474)}},
		OpcRequestId:  common.String("KVHFFIIWNEMDRDRFRVNK<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)
}