// 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{CreateWebAppFirewallPolicyDetails: waf.CreateWebAppFirewallPolicyDetails{ResponseProtection: &waf.ResponseProtection{Rules: []waf.ProtectionRule{waf.ProtectionRule{ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
		MaxHttpRequestHeaderLength: common.Int(431290),
		MaxHttpRequestHeaders:      common.Int(445),
		MaxNumberOfArguments:       common.Int(8573),
		MaxSingleArgumentLength:    common.Int(328851),
		MaxTotalArgumentLength:     common.Int(6.1033895e+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"),
		ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{ActionName: common.String("EXAMPLE-actionName-Value"),
			CollaborativeActionThreshold: common.Int(461),
			CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
				Weight: common.Int(338)}},
			Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
				RequestCookies: []string{"EXAMPLE--Value"}},
			Key:     common.String("EXAMPLE-key-Value"),
			Version: common.Int(837)}}}}},
		SystemTags:   map[string]map[string]interface{}{"EXAMPLE_KEY_HE4zt": map[string]interface{}{"EXAMPLE_KEY_V50Il": "EXAMPLE--Value"}},
		DefinedTags:  map[string]map[string]interface{}{"EXAMPLE_KEY_hnmum": map[string]interface{}{"EXAMPLE_KEY_KVP1r": "EXAMPLE--Value"}},
		DisplayName:  common.String("EXAMPLE-displayName-Value"),
		FreeformTags: map[string]string{"EXAMPLE_KEY_GlxnI": "EXAMPLE_VALUE_9WG3aMxt1qHc2Y1vAWCv"},
		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(225),
			Rules: []waf.ProtectionRule{waf.ProtectionRule{ProtectionCapabilities: []waf.ProtectionCapability{waf.ProtectionCapability{CollaborativeWeights: []waf.CollaborativeCapabilityWeightOverride{waf.CollaborativeCapabilityWeightOverride{Key: common.String("EXAMPLE-key-Value"),
				Weight: common.Int(813)}},
				Exclusions: &waf.ProtectionCapabilityExclusions{Args: []string{"EXAMPLE--Value"},
					RequestCookies: []string{"EXAMPLE--Value"}},
				Key:                          common.String("EXAMPLE-key-Value"),
				Version:                      common.Int(75),
				ActionName:                   common.String("EXAMPLE-actionName-Value"),
				CollaborativeActionThreshold: common.Int(695)}},
				ProtectionCapabilitySettings: &waf.ProtectionCapabilitySettings{AllowedHttpMethods: []string{"EXAMPLE--Value"},
					MaxHttpRequestHeaderLength: common.Int(869772),
					MaxHttpRequestHeaders:      common.Int(123),
					MaxNumberOfArguments:       common.Int(5348),
					MaxSingleArgumentLength:    common.Int(924013),
					MaxTotalArgumentLength:     common.Int(1.3792878e+07)},
				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")}}},
		RequestRateLimiting: &waf.RequestRateLimiting{Rules: []waf.RequestRateLimitingRule{waf.RequestRateLimitingRule{Configurations: []waf.RequestRateLimitingConfiguration{waf.RequestRateLimitingConfiguration{ActionDurationInSeconds: common.Int(40732),
			PeriodInSeconds: common.Int(5201),
			RequestsLimit:   common.Int(560)}},
			Name:              common.String("EXAMPLE-name-Value"),
			ActionName:        common.String("EXAMPLE-actionName-Value"),
			Condition:         common.String("EXAMPLE-condition-Value"),
			ConditionLanguage: waf.WebAppFirewallPolicyRuleConditionLanguageJmespath}}},
		Actions:       []waf.Action{waf.AllowAction{Name: common.String("EXAMPLE-name-Value")}},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-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")}}}},
		OpcRequestId:  common.String("IQDNDBYED12SAW6G1R2K<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

	// 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)
}