// 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("S1HSIHMCCNASPIZLHBUM<unique_ID>"),
UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{Actions: []waf.Action{waf.AllowAction{Name: common.String("EXAMPLE-name-Value")}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
FreeformTags: map[string]string{"EXAMPLE_KEY_sGb5V": "EXAMPLE_VALUE_tF7r9pidu7FGEOv6PKu0"},
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")}}},
RequestProtection: &waf.RequestProtection{BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
BodyInspectionSizeLimitInBytes: common.Int(212),
Rules: []waf.ProtectionRule{waf.ProtectionRule{ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{Key: common.String("EXAMPLE-key-Value"),
Version: common.Int(25),
ActionName: common.String("EXAMPLE-actionName-Value"),
CollaborativeActionThreshold: common.Int(685),
CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
Weight: common.Int(496)}},
Exclusions: &waf.ProtectionCapabilityExclusions{RequestCookies: []string{"EXAMPLE--Value"},
Args: []string{"EXAMPLE--Value"}}}},
ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{MaxHttpRequestHeaders: common.Int(194),
MaxNumberOfArguments: common.Int(4547),
MaxSingleArgumentLength: common.Int(608615),
MaxTotalArgumentLength: common.Int(2.9043304e+07),
AllowedHttpMethods: []string{"EXAMPLE--Value"},
MaxHttpRequestHeaderLength: common.Int(793115)},
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")}}},
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{PeriodInSeconds: common.Int(86247),
RequestsLimit: common.Int(528),
ActionDurationInSeconds: common.Int(60092)}},
Name: common.String("EXAMPLE-name-Value")}}},
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_qFv8R": map[string]interface{}{"EXAMPLE_KEY_N2oB9": "EXAMPLE--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")}}},
ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{Name: common.String("EXAMPLE-name-Value"),
ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{CollaborativeActionThreshold: common.Int(623),
CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
Weight: common.Int(916)}},
Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
RequestCookies: []string{"EXAMPLE--Value"}},
Key: common.String("EXAMPLE-key-Value"),
Version: common.Int(830),
ActionName: common.String("EXAMPLE-actionName-Value")}},
ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{MaxNumberOfArguments: common.Int(6810),
MaxSingleArgumentLength: common.Int(833813),
MaxTotalArgumentLength: common.Int(5.4638168e+07),
AllowedHttpMethods: []string{"EXAMPLE--Value"},
MaxHttpRequestHeaderLength: common.Int(280340),
MaxHttpRequestHeaders: common.Int(51)},
ActionName: common.String("EXAMPLE-actionName-Value"),
Condition: common.String("EXAMPLE-condition-Value"),
ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
IsBodyInspectionEnabled: common.Bool(false)}}},
SystemTags: map[string]map[string]interface{}{"EXAMPLE_KEY_QHIcd": map[string]interface{}{"EXAMPLE_KEY_w3hnN": "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)
}