// 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("IKDSFXW3KPRJYC8PSAM6<unique_ID>"),
		UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{DisplayName: common.String("EXAMPLE-displayName-Value"),
			RequestProtection: &waf.RequestProtection{BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
				BodyInspectionSizeLimitInBytes: common.Int(700),
				Rules: []waf.ProtectionRule{waf.ProtectionRule{ActionName: common.String("EXAMPLE-actionName-Value"),
					Condition:               common.String("EXAMPLE-condition-Value"),
					ConditionLanguage:       waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
					IsBodyInspectionEnabled: common.Bool(false),
					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(829),
						ActionName:                   common.String("EXAMPLE-actionName-Value"),
						CollaborativeActionThreshold: common.Int(686),
						CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
							Weight: common.Int(423)}}}},
					ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{MaxSingleArgumentLength: common.Int(498307),
						MaxTotalArgumentLength:     common.Int(3.970596e+06),
						AllowedHttpMethods:         []string{"EXAMPLE--Value"},
						MaxHttpRequestHeaderLength: common.Int(718742),
						MaxHttpRequestHeaders:      common.Int(120),
						MaxNumberOfArguments:       common.Int(1159)}}}},
			ResponseAccessControl: &waf.ResponseAccessControl{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")}}},
			Actions:      []waf.Action{waf.CheckAction{Name: common.String("EXAMPLE-name-Value")}},
			DefinedTags:  map[string]map[string]interface{}{"EXAMPLE_KEY_BMNcs": map[string]interface{}{"EXAMPLE_KEY_c09Mv": "EXAMPLE--Value"}},
			FreeformTags: map[string]string{"EXAMPLE_KEY_RUnPP": "EXAMPLE_VALUE_AFhVaccxomsQ0oGRk7iQ"},
			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")}}},
			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(54660),
					PeriodInSeconds: common.Int(30774),
					RequestsLimit:   common.Int(359)}},
				Name: common.String("EXAMPLE-name-Value")}}},
			ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
				MaxHttpRequestHeaderLength: common.Int(16603),
				MaxHttpRequestHeaders:      common.Int(375),
				MaxNumberOfArguments:       common.Int(7837),
				MaxSingleArgumentLength:    common.Int(364591),
				MaxTotalArgumentLength:     common.Int(6.3178201e+07)},
				ActionName:              common.String("EXAMPLE-actionName-Value"),
				Condition:               common.String("EXAMPLE-condition-Value"),
				ConditionLanguage:       waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				IsBodyInspectionEnabled: common.Bool(false),
				Name:                    common.String("EXAMPLE-name-Value"),
				ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{CollaborativeActionThreshold: common.Int(704),
					CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(739)}},
					Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
						RequestCookies: []string{"EXAMPLE--Value"}},
					Key:        common.String("EXAMPLE-key-Value"),
					Version:    common.Int(475),
					ActionName: common.String("EXAMPLE-actionName-Value")}}}}},
			SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_kdcAD": map[string]interface{}{"EXAMPLE_KEY_kB8dB": "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)
}