// 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/waas"
)

func ExampleUpdatePolicyConfig() {
	// 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 := waas.NewWaasClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := waas.UpdatePolicyConfigRequest{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId:  common.String("TUR3JEALPIV8P4SDLBPK<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		UpdatePolicyConfigDetails: waas.PolicyConfig{WebsocketPathPrefixes: []string{"EXAMPLE--Value"},
			IsResponseBufferingEnabled: common.Bool(false),
			ClientAddressHeader:        waas.PolicyConfigClientAddressHeaderXForwardedFor,
			IsCacheControlRespected:    common.Bool(true),
			IsOriginCompressionEnabled: common.Bool(true),
			TlsProtocols:               []waas.PolicyConfigTlsProtocolsEnum{waas.PolicyConfigTlsProtocolsV1},
			CipherGroup:                waas.PolicyConfigCipherGroupDefault,
			HealthChecks: &waas.HealthCheck{ExpectedResponseText: common.String("EXAMPLE-expectedResponseText-Value"),
				IntervalInSeconds:          common.Int(56),
				IsResponseTextCheckEnabled: common.Bool(false),
				Path:                       common.String("EXAMPLE-path-Value"),
				UnhealthyThreshold:         common.Int(18),
				ExpectedResponseCodeGroup:  []waas.HealthCheckExpectedResponseCodeGroupEnum{waas.HealthCheckExpectedResponseCodeGroup4xx},
				Headers:                    map[string]string{"EXAMPLE_KEY_lt5BU": "EXAMPLE_VALUE_SCbuDIt5iCbIYS0ccm3P"},
				HealthyThreshold:           common.Int(17),
				IsEnabled:                  common.Bool(false),
				Method:                     waas.HealthCheckMethodHead,
				TimeoutInSeconds:           common.Int(82)},
			IsHttpsEnabled:      common.Bool(true),
			LoadBalancingMethod: waas.IpHashLoadBalancingMethod{},
			CertificateId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-certificateId-Value"),
			IsHttpsForced:       common.Bool(true),
			IsSniEnabled:        common.Bool(true),
			IsBehindCdn:         common.Bool(false)},
		WaasPolicyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-waasPolicyId-Value")}

	// Send the request using the service client
	resp, err := client.UpdatePolicyConfig(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}