// 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/waas"
)
func ExampleUpdateWafConfig() {
// 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 := waas.NewWaasClientWithConfigurationProvider(common.DefaultConfigProvider())
helpers.FatalIfError(err)
// Create a request and dependent object(s).
req := waas.UpdateWafConfigRequest{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
OpcRequestId: common.String("8ZFJKBPTBQBFHDDXDBRT<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
UpdateWafConfigDetails: waas.WafConfig{AddressRateLimiting: &waas.AddressRateLimiting{BlockResponseCode: common.Int(629),
IsEnabled: common.Bool(false),
MaxDelayedCountPerAddress: common.Int(7832),
AllowedRatePerAddress: common.Int(2571)},
Captchas: []waas.Captcha{waas.Captcha{Title: common.String("EXAMPLE-title-Value"),
Url: common.String("EXAMPLE-url-Value"),
FailureMessage: common.String("EXAMPLE-failureMessage-Value"),
FooterText: common.String("EXAMPLE-footerText-Value"),
HeaderText: common.String("EXAMPLE-headerText-Value"),
SessionExpirationInSeconds: common.Int(428169),
SubmitLabel: common.String("EXAMPLE-submitLabel-Value")}},
GoodBots: []waas.GoodBot{waas.GoodBot{Description: common.String("EXAMPLE-description-Value"),
IsEnabled: common.Bool(false),
Key: common.String("EXAMPLE-key-Value"),
Name: common.String("EXAMPLE-name-Value")}},
OriginGroups: []string{"EXAMPLE--Value"},
ThreatFeeds: []waas.ThreatFeed{waas.ThreatFeed{Action: waas.ThreatFeedActionOff,
Description: common.String("EXAMPLE-description-Value"),
Key: common.String("EXAMPLE-key-Value"),
Name: common.String("EXAMPLE-name-Value")}},
Whitelists: []waas.Whitelist{waas.Whitelist{AddressLists: []string{"EXAMPLE--Value"},
Addresses: []string{"EXAMPLE--Value"},
Name: common.String("EXAMPLE-name-Value")}},
CachingRules: []waas.CachingRule{waas.CachingRule{IsClientCachingEnabled: common.Bool(false),
Key: common.String("EXAMPLE-key-Value"),
Name: common.String("EXAMPLE-name-Value"),
Action: waas.CachingRuleActionBypassCache,
CachingDuration: common.String("EXAMPLE-cachingDuration-Value"),
ClientCachingDuration: common.String("EXAMPLE-clientCachingDuration-Value"),
Criteria: []waas.CachingRuleCriteria{waas.CachingRuleCriteria{Value: common.String("EXAMPLE-value-Value"),
Condition: waas.CachingRuleCriteriaConditionPartEndsWith}}}},
Origin: common.String("EXAMPLE-origin-Value"),
DeviceFingerprintChallenge: &waas.DeviceFingerprintChallenge{IsEnabled: common.Bool(true),
MaxAddressCount: common.Int(5439),
MaxAddressCountExpirationInSeconds: common.Int(90078),
Action: waas.DeviceFingerprintChallengeActionDetect,
ActionExpirationInSeconds: common.Int(68704),
ChallengeSettings: &waas.BlockChallengeSettings{BlockErrorPageMessage: common.String("EXAMPLE-blockErrorPageMessage-Value"),
CaptchaTitle: common.String("EXAMPLE-captchaTitle-Value"),
BlockAction: waas.BlockChallengeSettingsBlockActionShowCaptcha,
BlockErrorPageCode: common.String("EXAMPLE-blockErrorPageCode-Value"),
BlockErrorPageDescription: common.String("EXAMPLE-blockErrorPageDescription-Value"),
BlockResponseCode: common.Int(535),
CaptchaFooter: common.String("EXAMPLE-captchaFooter-Value"),
CaptchaHeader: common.String("EXAMPLE-captchaHeader-Value"),
CaptchaSubmitLabel: common.String("EXAMPLE-captchaSubmitLabel-Value")},
FailureThreshold: common.Int(594698),
FailureThresholdExpirationInSeconds: common.Int(22631)},
ProtectionSettings: &waas.ProtectionSettings{BlockErrorPageMessage: common.String("EXAMPLE-blockErrorPageMessage-Value"),
IsResponseInspected: common.Bool(false),
MaxTotalNameLengthOfArguments: common.Int(166889),
MediaTypes: []string{"EXAMPLE--Value"},
AllowedHttpMethods: []waas.ProtectionSettingsAllowedHttpMethodsEnum{waas.ProtectionSettingsAllowedHttpMethodsPatch},
BlockErrorPageCode: common.String("EXAMPLE-blockErrorPageCode-Value"),
BlockErrorPageDescription: common.String("EXAMPLE-blockErrorPageDescription-Value"),
MaxNameLengthPerArgument: common.Int(43492),
MaxResponseSizeInKiB: common.Int(1047),
RecommendationsPeriodInDays: common.Int(66),
BlockAction: waas.ProtectionSettingsBlockActionSetResponseCode,
BlockResponseCode: common.Int(972),
MaxArgumentCount: common.Int(2707)},
AccessRules: []waas.AccessRule{waas.AccessRule{BlockErrorPageDescription: common.String("EXAMPLE-blockErrorPageDescription-Value"),
BlockErrorPageMessage: common.String("EXAMPLE-blockErrorPageMessage-Value"),
BypassChallenges: []waas.AccessRuleBypassChallengesEnum{waas.AccessRuleBypassChallengesDeviceFingerprintChallenge},
CaptchaHeader: common.String("EXAMPLE-captchaHeader-Value"),
Name: common.String("EXAMPLE-name-Value"),
RedirectResponseCode: waas.AccessRuleRedirectResponseCodeFound,
Action: waas.AccessRuleActionAllow,
CaptchaTitle: common.String("EXAMPLE-captchaTitle-Value"),
ResponseHeaderManipulation: []waas.HeaderManipulationAction{waas.RemoveHttpResponseHeaderAction{Header: common.String("EXAMPLE-header-Value")}},
BlockAction: waas.AccessRuleBlockActionShowErrorPage,
BlockResponseCode: common.Int(454),
CaptchaFooter: common.String("EXAMPLE-captchaFooter-Value"),
Criteria: []waas.AccessRuleCriteria{waas.AccessRuleCriteria{Condition: waas.AccessRuleCriteriaConditionIpInList,
IsCaseSensitive: common.Bool(true),
Value: common.String("EXAMPLE-value-Value")}},
BlockErrorPageCode: common.String("EXAMPLE-blockErrorPageCode-Value"),
RedirectUrl: common.String("EXAMPLE-redirectUrl-Value"),
CaptchaSubmitLabel: common.String("EXAMPLE-captchaSubmitLabel-Value")}},
CustomProtectionRules: []waas.CustomProtectionRuleSetting{waas.CustomProtectionRuleSetting{Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value"),
Action: waas.CustomProtectionRuleSettingActionDetect,
Exclusions: []waas.ProtectionRuleExclusion{waas.ProtectionRuleExclusion{Exclusions: []string{"EXAMPLE--Value"},
Target: waas.ProtectionRuleExclusionTargetRequestCookies}}}},
HumanInteractionChallenge: &waas.HumanInteractionChallenge{FailureThreshold: common.Int(988675),
FailureThresholdExpirationInSeconds: common.Int(359925),
IsNatEnabled: common.Bool(false),
SetHttpHeader: &waas.Header{Name: common.String("EXAMPLE-name-Value"),
Value: common.String("EXAMPLE-value-Value")},
ActionExpirationInSeconds: common.Int(21436),
ChallengeSettings: &waas.BlockChallengeSettings{BlockResponseCode: common.Int(328),
CaptchaFooter: common.String("EXAMPLE-captchaFooter-Value"),
CaptchaHeader: common.String("EXAMPLE-captchaHeader-Value"),
BlockAction: waas.BlockChallengeSettingsBlockActionShowCaptcha,
BlockErrorPageCode: common.String("EXAMPLE-blockErrorPageCode-Value"),
BlockErrorPageDescription: common.String("EXAMPLE-blockErrorPageDescription-Value"),
BlockErrorPageMessage: common.String("EXAMPLE-blockErrorPageMessage-Value"),
CaptchaSubmitLabel: common.String("EXAMPLE-captchaSubmitLabel-Value"),
CaptchaTitle: common.String("EXAMPLE-captchaTitle-Value")},
IsEnabled: common.Bool(false),
RecordingPeriodInSeconds: common.Int(10757),
Action: waas.HumanInteractionChallengeActionDetect,
InteractionThreshold: common.Int(33)},
JsChallenge: &waas.JsChallenge{Criteria: []waas.AccessRuleCriteria{waas.AccessRuleCriteria{Condition: waas.AccessRuleCriteriaConditionUrlPartContains,
IsCaseSensitive: common.Bool(false),
Value: common.String("EXAMPLE-value-Value")}},
FailureThreshold: common.Int(271888),
SetHttpHeader: &waas.Header{Name: common.String("EXAMPLE-name-Value"),
Value: common.String("EXAMPLE-value-Value")},
Action: waas.JsChallengeActionDetect,
ActionExpirationInSeconds: common.Int(203986),
ChallengeSettings: &waas.BlockChallengeSettings{BlockErrorPageCode: common.String("EXAMPLE-blockErrorPageCode-Value"),
CaptchaFooter: common.String("EXAMPLE-captchaFooter-Value"),
CaptchaHeader: common.String("EXAMPLE-captchaHeader-Value"),
CaptchaSubmitLabel: common.String("EXAMPLE-captchaSubmitLabel-Value"),
BlockAction: waas.BlockChallengeSettingsBlockActionSetResponseCode,
BlockErrorPageDescription: common.String("EXAMPLE-blockErrorPageDescription-Value"),
BlockErrorPageMessage: common.String("EXAMPLE-blockErrorPageMessage-Value"),
BlockResponseCode: common.Int(454),
CaptchaTitle: common.String("EXAMPLE-captchaTitle-Value")},
AreRedirectsChallenged: common.Bool(true),
IsEnabled: common.Bool(false),
IsNatEnabled: common.Bool(true)},
ProtectionRules: []waas.ProtectionRule{waas.ProtectionRule{Description: common.String("EXAMPLE-description-Value"),
Exclusions: []waas.ProtectionRuleExclusion{waas.ProtectionRuleExclusion{Exclusions: []string{"EXAMPLE--Value"},
Target: waas.ProtectionRuleExclusionTargetArgs}},
Key: common.String("EXAMPLE-key-Value"),
Labels: []string{"EXAMPLE--Value"},
ModSecurityRuleIds: []string{"EXAMPLE--Value"},
Name: common.String("EXAMPLE-name-Value"),
Action: waas.ProtectionRuleActionDetect}}},
WaasPolicyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-waasPolicyId-Value")}
// Send the request using the service client
resp, err := client.UpdateWafConfig(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}