// 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{UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_wan42": map[string]interface{}{"EXAMPLE_KEY_m54zj": "EXAMPLE--Value"}},
FreeformTags: map[string]string{"EXAMPLE_KEY_JwIG2": "EXAMPLE_VALUE_wribBXSfqEVivqrWp0lc"},
RequestProtection: &waf.RequestProtection{BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
BodyInspectionSizeLimitInBytes: common.Int(843),
Rules: []waf.ProtectionRule{waf.ProtectionRule{ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
IsBodyInspectionEnabled: common.Bool(true),
Name: common.String("EXAMPLE-name-Value"),
ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{ActionName: common.String("EXAMPLE-actionName-Value"),
CollaborativeActionThreshold: common.Int(865),
CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
Weight: common.Int(709)}},
Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
RequestCookies: []string{"EXAMPLE--Value"}},
Key: common.String("EXAMPLE-key-Value"),
Version: common.Int(708)}},
ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
MaxHttpRequestHeaderLength: common.Int(82159),
MaxHttpRequestHeaders: common.Int(230),
MaxNumberOfArguments: common.Int(2426),
MaxSingleArgumentLength: common.Int(807270),
MaxTotalArgumentLength: common.Int(5.1063414e+07)},
ActionName: common.String("EXAMPLE-actionName-Value"),
Condition: common.String("EXAMPLE-condition-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{PeriodInSeconds: common.Int(21754),
RequestsLimit: common.Int(893),
ActionDurationInSeconds: common.Int(911)}}}}},
SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_uyBpF": map[string]interface{}{"EXAMPLE_KEY_gigUi": "EXAMPLE--Value"}},
Actions: []waf.Action{waf.CheckAction{Name: common.String("EXAMPLE-name-Value")}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
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}}},
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")}}},
ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
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(186)}},
Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
RequestCookies: []string{"EXAMPLE--Value"}},
Key: common.String("EXAMPLE-key-Value"),
Version: common.Int(528),
ActionName: common.String("EXAMPLE-actionName-Value"),
CollaborativeActionThreshold: common.Int(193)}},
ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
MaxHttpRequestHeaderLength: common.Int(475600),
MaxHttpRequestHeaders: common.Int(198),
MaxNumberOfArguments: common.Int(3842),
MaxSingleArgumentLength: common.Int(752307),
MaxTotalArgumentLength: common.Int(5.8822826e+07)},
ActionName: common.String("EXAMPLE-actionName-Value"),
Condition: common.String("EXAMPLE-condition-Value")}}}},
WebAppFirewallPolicyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-webAppFirewallPolicyId-Value"),
IfMatch: common.String("EXAMPLE-ifMatch-Value"),
OpcRequestId: common.String("OMDMW0SVMIXGD4WPXWNQ<unique_ID>")}
// 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)
}