// 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{WebAppFirewallPolicyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-webAppFirewallPolicyId-Value"),
		IfMatch:      common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("R8J1ZFBWBKEW0CI4MDLS<unique_ID>"),
		UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{RequestRateLimiting: &waf.RequestRateLimiting{Rules: []waf.RequestRateLimitingRule{waf.RequestRateLimitingRule{ActionName: common.String("EXAMPLE-actionName-Value"),
			Condition:         common.String("EXAMPLE-condition-Value"),
			ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
			Configurations: []waf.RequestRateLimitingConfiguration{waf.RequestRateLimitingConfiguration{ActionDurationInSeconds: common.Int(6015),
				PeriodInSeconds: common.Int(6866),
				RequestsLimit:   common.Int(747)}},
			Name: common.String("EXAMPLE-name-Value")}}},
			ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{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{Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
					RequestCookies: []string{"EXAMPLE--Value"}},
					Key:                          common.String("EXAMPLE-key-Value"),
					Version:                      common.Int(911),
					ActionName:                   common.String("EXAMPLE-actionName-Value"),
					CollaborativeActionThreshold: common.Int(73),
					CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(993)}}}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{MaxHttpRequestHeaderLength: common.Int(547219),
					MaxHttpRequestHeaders:   common.Int(652),
					MaxNumberOfArguments:    common.Int(1512),
					MaxSingleArgumentLength: common.Int(763479),
					MaxTotalArgumentLength:  common.Int(1.7343146e+07),
					AllowedHttpMethods:      []string{"EXAMPLE--Value"}}}}},
			SystemTags:   map[string]map[string]interface{}{"EXAMPLE_KEY_YYnWg": map[string]interface{}{"EXAMPLE_KEY_KGPeY": "EXAMPLE--Value"}},
			Actions:      []waf.Action{waf.CheckAction{Name: common.String("EXAMPLE-name-Value")}},
			DisplayName:  common.String("EXAMPLE-displayName-Value"),
			FreeformTags: map[string]string{"EXAMPLE_KEY_RldQL": "EXAMPLE_VALUE_lgawNANuIAPpLNdOrhe2"},
			RequestAccessControl: &waf.RequestAccessControl{DefaultActionName: common.String("EXAMPLE-defaultActionName-Value"),
				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")}}},
			RequestProtection: &waf.RequestProtection{BodyInspectionSizeLimitInBytes: common.Int(809),
				Rules: []waf.ProtectionRule{waf.ProtectionRule{IsBodyInspectionEnabled: common.Bool(true),
					Name: common.String("EXAMPLE-name-Value"),
					ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(81)}},
						Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
							RequestCookies: []string{"EXAMPLE--Value"}},
						Key:                          common.String("EXAMPLE-key-Value"),
						Version:                      common.Int(804),
						ActionName:                   common.String("EXAMPLE-actionName-Value"),
						CollaborativeActionThreshold: common.Int(112)}},
					ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
						MaxHttpRequestHeaderLength: common.Int(453770),
						MaxHttpRequestHeaders:      common.Int(921),
						MaxNumberOfArguments:       common.Int(8269),
						MaxSingleArgumentLength:    common.Int(486748),
						MaxTotalArgumentLength:     common.Int(1.3121813e+07)},
					ActionName:        common.String("EXAMPLE-actionName-Value"),
					Condition:         common.String("EXAMPLE-condition-Value"),
					ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath}},
				BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value")},
			ResponseAccessControl: &waf.ResponseAccessControl{Rules: []waf.AccessControlRule{waf.AccessControlRule{ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				Name:       common.String("EXAMPLE-name-Value"),
				ActionName: common.String("EXAMPLE-actionName-Value"),
				Condition:  common.String("EXAMPLE-condition-Value")}}},
			DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_QN3jX": map[string]interface{}{"EXAMPLE_KEY_d5Bue": "EXAMPLE--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)
}