// 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("MYCBL8EHFAVKQ15MERSG<unique_ID>"),
		UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{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")}}},
			Actions: []waf.Action{waf.ReturnHttpResponseAction{Body: waf.DynamicHttpResponseBody{Template: common.String("EXAMPLE-template-Value")},
				Code: common.Int(372),
				Headers: []waf.ResponseHeader{waf.ResponseHeader{Name: common.String("EXAMPLE-name-Value"),
					Value: common.String("EXAMPLE-value-Value")}},
				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")},
			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(1313),
					PeriodInSeconds: common.Int(22078),
					RequestsLimit:   common.Int(87)}}}}},
			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(false),
				Name:                    common.String("EXAMPLE-name-Value"),
				ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{ActionName: common.String("EXAMPLE-actionName-Value"),
					CollaborativeActionThreshold: common.Int(970),
					CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(472)}},
					Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
						RequestCookies: []string{"EXAMPLE--Value"}},
					Key:     common.String("EXAMPLE-key-Value"),
					Version: common.Int(158)}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(271238),
					MaxHttpRequestHeaders:      common.Int(717),
					MaxNumberOfArguments:       common.Int(756),
					MaxSingleArgumentLength:    common.Int(735169),
					MaxTotalArgumentLength:     common.Int(3.7112181e+07)}}}},
			SystemTags:   map[string]map[string]interface{}{"EXAMPLE_KEY_e0xj8": map[string]interface{}{"EXAMPLE_KEY_BGAfN": "EXAMPLE--Value"}},
			DefinedTags:  map[string]map[string]interface{}{"EXAMPLE_KEY_C8bCO": map[string]interface{}{"EXAMPLE_KEY_hUANb": "EXAMPLE--Value"}},
			FreeformTags: map[string]string{"EXAMPLE_KEY_ZLnJA": "EXAMPLE_VALUE_i6CcRh6yzfe4APtq4JR2"},
			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{CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
					Weight: common.Int(950)}},
					Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
						RequestCookies: []string{"EXAMPLE--Value"}},
					Key:                          common.String("EXAMPLE-key-Value"),
					Version:                      common.Int(294),
					ActionName:                   common.String("EXAMPLE-actionName-Value"),
					CollaborativeActionThreshold: common.Int(458)}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(896122),
					MaxHttpRequestHeaders:      common.Int(906),
					MaxNumberOfArguments:       common.Int(9483),
					MaxSingleArgumentLength:    common.Int(632922),
					MaxTotalArgumentLength:     common.Int(5.8540514e+07)},
				ActionName: common.String("EXAMPLE-actionName-Value")}},
				BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
				BodyInspectionSizeLimitInBytes:            common.Int(158)}},
		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)
}