// 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 ExampleCreateWebAppFirewallPolicy() {
	// 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.CreateWebAppFirewallPolicyRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		CreateWebAppFirewallPolicyDetails: waf.CreateWebAppFirewallPolicyDetails{DisplayName: common.String("EXAMPLE-displayName-Value"),
			FreeformTags: map[string]string{"EXAMPLE_KEY_Kw8fK": "EXAMPLE_VALUE_T6BWyvCbXimMz3RV8yro"},
			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}}},
			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(46896),
					PeriodInSeconds: common.Int(26035),
					RequestsLimit:   common.Int(850)}},
				Name: common.String("EXAMPLE-name-Value")}}},
			ResponseAccessControl: &waf.ResponseAccessControl{Rules: []waf.AccessControlRule{waf.AccessControlRule{Condition: common.String("EXAMPLE-condition-Value"),
				ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				Name:              common.String("EXAMPLE-name-Value"),
				ActionName:        common.String("EXAMPLE-actionName-Value")}}},
			ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{CollaborativeActionThreshold: common.Int(207),
				CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
					Weight: common.Int(154)}},
				Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
					RequestCookies: []string{"EXAMPLE--Value"}},
				Key:        common.String("EXAMPLE-key-Value"),
				Version:    common.Int(341),
				ActionName: common.String("EXAMPLE-actionName-Value")}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(465943),
					MaxHttpRequestHeaders:      common.Int(994),
					MaxNumberOfArguments:       common.Int(3513),
					MaxSingleArgumentLength:    common.Int(120776),
					MaxTotalArgumentLength:     common.Int(4.6848339e+07)},
				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")}}},
			DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_Tcq5w": map[string]interface{}{"EXAMPLE_KEY_KK6Oh": "EXAMPLE--Value"}},
			RequestProtection: &waf.RequestProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{Name: common.String("EXAMPLE-name-Value"),
				ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
					RequestCookies: []string{"EXAMPLE--Value"}},
					Key:                          common.String("EXAMPLE-key-Value"),
					Version:                      common.Int(906),
					ActionName:                   common.String("EXAMPLE-actionName-Value"),
					CollaborativeActionThreshold: common.Int(498),
					CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
						Weight: common.Int(168)}}}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(489958),
					MaxHttpRequestHeaders:      common.Int(187),
					MaxNumberOfArguments:       common.Int(3754),
					MaxSingleArgumentLength:    common.Int(57536),
					MaxTotalArgumentLength:     common.Int(5.7295919e+07)},
				ActionName:              common.String("EXAMPLE-actionName-Value"),
				Condition:               common.String("EXAMPLE-condition-Value"),
				ConditionLanguage:       waf.WebAppFirewallPolicyRuleConditionLanguageJmespath,
				IsBodyInspectionEnabled: common.Bool(true)}},
				BodyInspectionSizeLimitExceededActionName: common.String("EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value"),
				BodyInspectionSizeLimitInBytes:            common.Int(854)},
			SystemTags:    map[string]map[string]interface{}{"EXAMPLE_KEY_RkmAL": map[string]interface{}{"EXAMPLE_KEY_nqLNZ": "EXAMPLE--Value"}},
			Actions:       []waf.Action{waf.CheckAction{Name: common.String("EXAMPLE-name-Value")}},
			CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")},
		OpcRequestId: common.String("XXONAN1JSXIRBHS21GWB<unique_ID>")}

	// Send the request using the service client
	resp, err := client.CreateWebAppFirewallPolicy(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}