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

func ExampleUpdateWebAppFirewallPolicy() {
	// 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 := waf.NewWafClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

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

	req := waf.UpdateWebAppFirewallPolicyRequest{OpcRequestId: common.String("ENEO0HUK5RAFYKHIYR1L<unique_ID>"),
		UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{Actions: []waf.Action{waf.CheckAction{Name: common.String("EXAMPLE-name-Value")}},
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			RequestAccessControl: &waf.RequestAccessControl{Rules: []waf.AccessControlRule{waf.AccessControlRule{ActionName: common.String("EXAMPLE-actionName-Value"),
				Condition:         common.String("EXAMPLE-condition-Value"),
				ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				Name:              common.String("EXAMPLE-name-Value")}},
				DefaultActionName: common.String("EXAMPLE-defaultActionName-Value")},
			RequestProtection: &waf.RequestProtection{BodyInspectionSizeLimitInBytes: common.Int(376),
				Rules: []waf.ProtectionRule{waf.ProtectionRule{ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(276161),
					MaxHttpRequestHeaders:      common.Int(641),
					MaxNumberOfArguments:       common.Int(1030),
					MaxSingleArgumentLength:    common.Int(684331),
					MaxTotalArgumentLength:     common.Int(1.7184902e+07)},
					ActionName:              common.String("EXAMPLE-actionName-Value"),
					Condition:               common.String("EXAMPLE-condition-Value"),
					ConditionLanguage:       waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
					IsBodyInspectionEnabled: common.Bool(true),
					Name:                    common.String("EXAMPLE-name-Value"),
					ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Weight: common.Int(807),
						Key: common.String("EXAMPLE-key-Value")}},
						Exclusions: &waf.ProtectionCapabilityExclusions{RequestCookies: []string{"EXAMPLE--Value"},
							Args: []string{"EXAMPLE--Value"}},
						Key:                          common.String("EXAMPLE-key-Value"),
						Version:                      common.Int(881),
						ActionName:                   common.String("EXAMPLE-actionName-Value"),
						CollaborativeActionThreshold: common.Int(211)}}}},
				BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value")},
			RequestRateLimiting: &waf.RequestRateLimiting{Rules: []waf.RequestRateLimitingRule{waf.RequestRateLimitingRule{Configurations: []waf.RequestRateLimitingConfiguration{waf.RequestRateLimitingConfiguration{ActionDurationInSeconds: common.Int(82882),
				PeriodInSeconds: common.Int(3788),
				RequestsLimit:   common.Int(882)}},
				Name:              common.String("EXAMPLE-name-Value"),
				ActionName:        common.String("EXAMPLE-actionName-Value"),
				Condition:         common.String("EXAMPLE-condition-Value"),
				ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath}}},
			ResponseAccessControl: &waf.ResponseAccessControl{Rules: []waf.AccessControlRule{waf.AccessControlRule{ActionName: common.String("EXAMPLE-actionName-Value"),
				Condition:         common.String("EXAMPLE-condition-Value"),
				ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				Name:              common.String("EXAMPLE-name-Value")}}},
			DefinedTags:  map[string]map[string]interface{}{"EXAMPLE_KEY_xb6TW": map[string]interface{}{"EXAMPLE_KEY_LOEly": "EXAMPLE--Value"}},
			FreeformTags: map[string]string{"EXAMPLE_KEY_Fw2hE": "EXAMPLE_VALUE_6FhkwlHCmzlKsf02S7cp"},
			ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{Name: common.String("EXAMPLE-name-Value"),
				ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{ActionName: common.String("EXAMPLE-actionName-Value"),
					CollaborativeActionThreshold: common.Int(206),
					CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(324)}},
					Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
						RequestCookies: []string{"EXAMPLE--Value"}},
					Key:     common.String("EXAMPLE-key-Value"),
					Version: common.Int(917)}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{MaxSingleArgumentLength: common.Int(793693),
					MaxTotalArgumentLength:     common.Int(9.020645e+06),
					AllowedHttpMethods:         []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(44183),
					MaxHttpRequestHeaders:      common.Int(233),
					MaxNumberOfArguments:       common.Int(1200)},
				ActionName:              common.String("EXAMPLE-actionName-Value"),
				Condition:               common.String("EXAMPLE-condition-Value"),
				ConditionLanguage:       waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				IsBodyInspectionEnabled: common.Bool(true)}}},
			SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_XFw63": map[string]interface{}{"EXAMPLE_KEY_ArsyC": "EXAMPLE--Value"}}},
		WebAppFirewallPolicyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-webAppFirewallPolicyId-Value"),
		IfMatch:                common.String("EXAMPLE-ifMatch-Value")}

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

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