// 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{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("KGPEYYYNWGR8J1ZFBWBK<unique_ID>"),
		UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{Actions: []waf.Action{waf.CheckAction{Name: common.String("EXAMPLE-name-Value")}},
			FreeformTags: map[string]string{"EXAMPLE_KEY_4jBva": "EXAMPLE_VALUE_L694vRldQLlgawNANuIA"},
			RequestAccessControl: &waf.RequestAccessControl{DefaultActionName: common.String("EXAMPLE-defaultActionName-Value"),
				Rules: []waf.AccessControlRule{waf.AccessControlRule{Name: common.String("EXAMPLE-name-Value"),
					ActionName:        common.String("EXAMPLE-actionName-Value"),
					Condition:         common.String("EXAMPLE-condition-Value"),
					ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath}}},
			RequestProtection: &waf.RequestProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{Condition: common.String("EXAMPLE-condition-Value"),
				ConditionLanguage:       waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				IsBodyInspectionEnabled: common.Bool(false),
				Name:                    common.String("EXAMPLE-name-Value"),
				ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{Version: common.Int(659),
					ActionName:                   common.String("EXAMPLE-actionName-Value"),
					CollaborativeActionThreshold: common.Int(205),
					CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(682)}},
					Exclusions: &waf.ProtectionCapabilityExclusions{RequestCookies: []string{"EXAMPLE--Value"},
						Args: []string{"EXAMPLE--Value"}},
					Key: common.String("EXAMPLE-key-Value")}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(873688),
					MaxHttpRequestHeaders:      common.Int(212),
					MaxNumberOfArguments:       common.Int(7707),
					MaxSingleArgumentLength:    common.Int(898490),
					MaxTotalArgumentLength:     common.Int(201324)},
				ActionName: common.String("EXAMPLE-actionName-Value")}},
				BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
				BodyInspectionSizeLimitInBytes:            common.Int(413)},
			SystemTags:  map[string]map[string]interface{}{"EXAMPLE_KEY_QN3jX": map[string]interface{}{"EXAMPLE_KEY_d5Bue": "EXAMPLE--Value"}},
			DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_Orhe2": map[string]interface{}{"EXAMPLE_KEY_PpLNd": "EXAMPLE--Value"}},
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			RequestRateLimiting: &waf.RequestRateLimiting{Rules: []waf.RequestRateLimitingRule{waf.RequestRateLimitingRule{Name: common.String("EXAMPLE-name-Value"),
				ActionName:        common.String("EXAMPLE-actionName-Value"),
				Condition:         common.String("EXAMPLE-condition-Value"),
				ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				Configurations: []waf.RequestRateLimitingConfiguration{waf.RequestRateLimitingConfiguration{ActionDurationInSeconds: common.Int(4468),
					PeriodInSeconds: common.Int(32022),
					RequestsLimit:   common.Int(652)}}}}},
			ResponseAccessControl: &waf.ResponseAccessControl{Rules: []waf.AccessControlRule{waf.AccessControlRule{Name: common.String("EXAMPLE-name-Value"),
				ActionName:        common.String("EXAMPLE-actionName-Value"),
				Condition:         common.String("EXAMPLE-condition-Value"),
				ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath}}},
			ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{IsBodyInspectionEnabled: common.Bool(true),
				Name: common.String("EXAMPLE-name-Value"),
				ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{CollaborativeActionThreshold: common.Int(952),
					CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(209)}},
					Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
						RequestCookies: []string{"EXAMPLE--Value"}},
					Key:        common.String("EXAMPLE-key-Value"),
					Version:    common.Int(230),
					ActionName: common.String("EXAMPLE-actionName-Value")}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(145599),
					MaxHttpRequestHeaders:      common.Int(800),
					MaxNumberOfArguments:       common.Int(7662),
					MaxSingleArgumentLength:    common.Int(453770),
					MaxTotalArgumentLength:     common.Int(3.15886e+07)},
				ActionName:        common.String("EXAMPLE-actionName-Value"),
				Condition:         common.String("EXAMPLE-condition-Value"),
				ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath}}}},
		WebAppFirewallPolicyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-webAppFirewallPolicyId-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)
}