// 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("M54ZJWAN42GIGUIUYBPF<unique_ID>"),
UpdateWebAppFirewallPolicyDetails: waf.UpdateWebAppFirewallPolicyDetails{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")},
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_Wp0lc": map[string]interface{}{"EXAMPLE_KEY_Vivqr": "EXAMPLE--Value"}},
DisplayName: common.String("EXAMPLE-displayName-Value"),
RequestProtection: &waf.RequestProtection{BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
BodyInspectionSizeLimitInBytes: common.Int(177),
Rules: []waf.ProtectionRule{waf.ProtectionRule{ActionName: common.String("EXAMPLE-actionName-Value"),
Condition: common.String("EXAMPLE-condition-Value"),
ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
IsBodyInspectionEnabled: common.Bool(true),
Name: common.String("EXAMPLE-name-Value"),
ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{Version: common.Int(480),
ActionName: common.String("EXAMPLE-actionName-Value"),
CollaborativeActionThreshold: common.Int(167),
CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
Weight: common.Int(905)}},
Exclusions: &waf.ProtectionCapabilityExclusions{RequestCookies: []string{"EXAMPLE--Value"},
Args: []string{"EXAMPLE--Value"}},
Key: common.String("EXAMPLE-key-Value")}},
ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
MaxHttpRequestHeaderLength: common.Int(111297),
MaxHttpRequestHeaders: common.Int(160),
MaxNumberOfArguments: common.Int(8785),
MaxSingleArgumentLength: common.Int(230057),
MaxTotalArgumentLength: common.Int(4.4894568e+07)}}}},
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(6359),
PeriodInSeconds: common.Int(43671),
RequestsLimit: common.Int(476)}},
Name: common.String("EXAMPLE-name-Value")}}},
ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
IsBodyInspectionEnabled: common.Bool(false),
Name: common.String("EXAMPLE-name-Value"),
ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{Key: common.String("EXAMPLE-key-Value"),
Version: common.Int(153),
ActionName: common.String("EXAMPLE-actionName-Value"),
CollaborativeActionThreshold: common.Int(171),
CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
Weight: common.Int(258)}},
Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
RequestCookies: []string{"EXAMPLE--Value"}}}},
ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{MaxNumberOfArguments: common.Int(389),
MaxSingleArgumentLength: common.Int(841449),
MaxTotalArgumentLength: common.Int(5.7534268e+07),
AllowedHttpMethods: []string{"EXAMPLE--Value"},
MaxHttpRequestHeaderLength: common.Int(865),
MaxHttpRequestHeaders: common.Int(160)},
ActionName: common.String("EXAMPLE-actionName-Value"),
Condition: common.String("EXAMPLE-condition-Value")}}},
Actions: []waf.Action{waf.ReturnHttpResponseAction{Body: waf.StaticTextHttpResponseBody{Text: common.String("EXAMPLE-text-Value")},
Code: common.Int(466),
Headers: []waf.ResponseHeader{waf.ResponseHeader{Name: common.String("EXAMPLE-name-Value"),
Value: common.String("EXAMPLE-value-Value")}},
Name: common.String("EXAMPLE-name-Value")}},
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_XSfqE": map[string]interface{}{"EXAMPLE_KEY_wribB": "EXAMPLE--Value"}},
FreeformTags: map[string]string{"EXAMPLE_KEY_8i0Sf": "EXAMPLE_VALUE_XojlmOK4XfbiNgSJwIG2"}},
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)
}