// 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("HKWLHCMZLKSF02S7CPLO<unique_ID>"),
		UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{Actions: []waf.Action{waf.AllowAction{Name: common.String("EXAMPLE-name-Value")}},
			DefinedTags:  map[string]map[string]interface{}{"EXAMPLE_KEY_4YQYV": map[string]interface{}{"EXAMPLE_KEY_q9ycO": "EXAMPLE--Value"}},
			FreeformTags: map[string]string{"EXAMPLE_KEY_wZ5bk": "EXAMPLE_VALUE_lKgJy6tijec9McIcTR55"},
			RequestProtection: &waf.RequestProtection{BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
				BodyInspectionSizeLimitInBytes: common.Int(296),
				Rules: []waf.ProtectionRule{waf.ProtectionRule{ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
					IsBodyInspectionEnabled: common.Bool(false),
					Name:                    common.String("EXAMPLE-name-Value"),
					ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{Exclusions: &waf.ProtectionCapabilityExclusions{RequestCookies: []string{"EXAMPLE--Value"},
						Args: []string{"EXAMPLE--Value"}},
						Key:                          common.String("EXAMPLE-key-Value"),
						Version:                      common.Int(299),
						ActionName:                   common.String("EXAMPLE-actionName-Value"),
						CollaborativeActionThreshold: common.Int(707),
						CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
							Weight: common.Int(631)}}}},
					ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{MaxSingleArgumentLength: common.Int(430536),
						MaxTotalArgumentLength:     common.Int(3.0194176e+07),
						AllowedHttpMethods:         []string{"EXAMPLE--Value"},
						MaxHttpRequestHeaderLength: common.Int(806105),
						MaxHttpRequestHeaders:      common.Int(393),
						MaxNumberOfArguments:       common.Int(6783)},
					ActionName: common.String("EXAMPLE-actionName-Value"),
					Condition:  common.String("EXAMPLE-condition-Value")}}},
			ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{Name: common.String("EXAMPLE-name-Value"),
				ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{Version: common.Int(853),
					ActionName:                   common.String("EXAMPLE-actionName-Value"),
					CollaborativeActionThreshold: common.Int(312),
					CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(712)}},
					Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
						RequestCookies: []string{"EXAMPLE--Value"}},
					Key: common.String("EXAMPLE-key-Value")}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{MaxHttpRequestHeaderLength: common.Int(419715),
					MaxHttpRequestHeaders:   common.Int(455),
					MaxNumberOfArguments:    common.Int(3553),
					MaxSingleArgumentLength: common.Int(142701),
					MaxTotalArgumentLength:  common.Int(4.5116853e+07),
					AllowedHttpMethods:      []string{"EXAMPLE--Value"}},
				ActionName:              common.String("EXAMPLE-actionName-Value"),
				Condition:               common.String("EXAMPLE-condition-Value"),
				ConditionLanguage:       waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				IsBodyInspectionEnabled: common.Bool(false)}}},
			DisplayName: common.String("EXAMPLE-displayName-Value"),
			RequestAccessControl: &waf.RequestAccessControl{Rules: []waf.AccessControlRule{waf.AccessControlRule{Condition: common.String("EXAMPLE-condition-Value"),
				ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				Name:              common.String("EXAMPLE-name-Value"),
				ActionName:        common.String("EXAMPLE-actionName-Value")}},
				DefaultActionName: common.String("EXAMPLE-defaultActionName-Value")},
			RequestRateLimiting: &waf.RequestRateLimiting{Rules: []waf.RequestRateLimitingRule{waf.RequestRateLimitingRule{ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				Configurations: []waf.RequestRateLimitingConfiguration{waf.RequestRateLimitingConfiguration{ActionDurationInSeconds: common.Int(81144),
					PeriodInSeconds: common.Int(82541),
					RequestsLimit:   common.Int(946)}},
				Name:       common.String("EXAMPLE-name-Value"),
				ActionName: common.String("EXAMPLE-actionName-Value"),
				Condition:  common.String("EXAMPLE-condition-Value")}}},
			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")}}},
			SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_2hE6F": map[string]interface{}{"EXAMPLE_KEY_8CZFw": "EXAMPLE--Value"}}},
		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)
}