AppSecRatePolicy

Scopes: Security configuration; rate policy

Creates, modifies or deletes rate policies. Rate polices help you monitor and moderate the number and rate of all the requests you receive. In turn, this helps you prevent your website from being overwhelmed by a dramatic and unexpected surge in traffic.

Related API Endpoint: /appsec/v1/configs/{configId}/versions/{versionNumber}/rate-policies

Output Options

The following options can be used to determine the information returned, and how that returned information is formatted:

  • rate_policy_id. ID of the modified or newly-created rate policy.

Example Usage

using System.IO;
using Pulumi;
using Akamai = Pulumi.Akamai;

class MyStack : Stack
{
    public MyStack()
    {
        var configuration = Output.Create(Akamai.GetAppSecConfiguration.InvokeAsync(new Akamai.GetAppSecConfigurationArgs
        {
            Name = "Documentation",
        }));
        var ratePolicy = new Akamai.AppSecRatePolicy("ratePolicy", new Akamai.AppSecRatePolicyArgs
        {
            ConfigId = configuration.Apply(configuration => configuration.ConfigId),
            RatePolicy = File.ReadAllText($"{path.Module}/rate_policy.json"),
        });
        this.RatePolicyId = ratePolicy.RatePolicyId;
    }

    [Output("ratePolicyId")]
    public Output<string> RatePolicyId { get; set; }
}
package main

import (
	"fmt"
	"io/ioutil"

	"github.com/pulumi/pulumi-akamai/sdk/v2/go/akamai"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "Documentation"
		configuration, err := akamai.LookupAppSecConfiguration(ctx, &GetAppSecConfigurationArgs{
			Name: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		ratePolicy, err := akamai.NewAppSecRatePolicy(ctx, "ratePolicy", &akamai.AppSecRatePolicyArgs{
			ConfigId:   pulumi.Int(configuration.ConfigId),
			RatePolicy: readFileOrPanic(fmt.Sprintf("%v%v", path.Module, "/rate_policy.json")),
		})
		if err != nil {
			return err
		}
		ctx.Export("ratePolicyId", ratePolicy.RatePolicyId)
		return nil
	})
}
import pulumi
import pulumi_akamai as akamai

configuration = akamai.get_app_sec_configuration(name="Documentation")
rate_policy = akamai.AppSecRatePolicy("ratePolicy",
    config_id=configuration.config_id,
    rate_policy=(lambda path: open(path).read())(f"{path['module']}/rate_policy.json"))
pulumi.export("ratePolicyId", rate_policy.rate_policy_id)
import * as pulumi from "@pulumi/pulumi";
import * as akamai from "@pulumi/akamai";
import * from "fs";

const configuration = akamai.getAppSecConfiguration({
    name: "Documentation",
});
const ratePolicy = new akamai.AppSecRatePolicy("ratePolicy", {
    configId: configuration.then(configuration => configuration.configId),
    ratePolicy: fs.readFileSync(`${path.module}/rate_policy.json`),
});
export const ratePolicyId = ratePolicy.ratePolicyId;

Create a AppSecRatePolicy Resource

new AppSecRatePolicy(name: string, args: AppSecRatePolicyArgs, opts?: CustomResourceOptions);
@overload
def AppSecRatePolicy(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     config_id: Optional[int] = None,
                     rate_policy: Optional[str] = None)
@overload
def AppSecRatePolicy(resource_name: str,
                     args: AppSecRatePolicyArgs,
                     opts: Optional[ResourceOptions] = None)
func NewAppSecRatePolicy(ctx *Context, name string, args AppSecRatePolicyArgs, opts ...ResourceOption) (*AppSecRatePolicy, error)
public AppSecRatePolicy(string name, AppSecRatePolicyArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args AppSecRatePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args AppSecRatePolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AppSecRatePolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AppSecRatePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

AppSecRatePolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The AppSecRatePolicy resource accepts the following input properties:

ConfigId int
. Unique identifier of the security configuration associated with the rate policy being modified.
RatePolicy string
. Path to a JSON file containing a rate policy definition. You can view a sample rate policy JSON file in the RatePolicy section of the Application Security API documentation.
ConfigId int
. Unique identifier of the security configuration associated with the rate policy being modified.
RatePolicy string
. Path to a JSON file containing a rate policy definition. You can view a sample rate policy JSON file in the RatePolicy section of the Application Security API documentation.
configId number
. Unique identifier of the security configuration associated with the rate policy being modified.
ratePolicy string
. Path to a JSON file containing a rate policy definition. You can view a sample rate policy JSON file in the RatePolicy section of the Application Security API documentation.
config_id int
. Unique identifier of the security configuration associated with the rate policy being modified.
rate_policy str
. Path to a JSON file containing a rate policy definition. You can view a sample rate policy JSON file in the RatePolicy section of the Application Security API documentation.

Outputs

All input properties are implicitly available as output properties. Additionally, the AppSecRatePolicy resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
RatePolicyId int
. Unique identifier of an existing rate policy.
Id string
The provider-assigned unique ID for this managed resource.
RatePolicyId int
. Unique identifier of an existing rate policy.
id string
The provider-assigned unique ID for this managed resource.
ratePolicyId number
. Unique identifier of an existing rate policy.
id str
The provider-assigned unique ID for this managed resource.
rate_policy_id int
. Unique identifier of an existing rate policy.

Look up an Existing AppSecRatePolicy Resource

Get an existing AppSecRatePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AppSecRatePolicyState, opts?: CustomResourceOptions): AppSecRatePolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        config_id: Optional[int] = None,
        rate_policy: Optional[str] = None,
        rate_policy_id: Optional[int] = None) -> AppSecRatePolicy
func GetAppSecRatePolicy(ctx *Context, name string, id IDInput, state *AppSecRatePolicyState, opts ...ResourceOption) (*AppSecRatePolicy, error)
public static AppSecRatePolicy Get(string name, Input<string> id, AppSecRatePolicyState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

ConfigId int
. Unique identifier of the security configuration associated with the rate policy being modified.
RatePolicy string
. Path to a JSON file containing a rate policy definition. You can view a sample rate policy JSON file in the RatePolicy section of the Application Security API documentation.
RatePolicyId int
. Unique identifier of an existing rate policy.
ConfigId int
. Unique identifier of the security configuration associated with the rate policy being modified.
RatePolicy string
. Path to a JSON file containing a rate policy definition. You can view a sample rate policy JSON file in the RatePolicy section of the Application Security API documentation.
RatePolicyId int
. Unique identifier of an existing rate policy.
configId number
. Unique identifier of the security configuration associated with the rate policy being modified.
ratePolicy string
. Path to a JSON file containing a rate policy definition. You can view a sample rate policy JSON file in the RatePolicy section of the Application Security API documentation.
ratePolicyId number
. Unique identifier of an existing rate policy.
config_id int
. Unique identifier of the security configuration associated with the rate policy being modified.
rate_policy str
. Path to a JSON file containing a rate policy definition. You can view a sample rate policy JSON file in the RatePolicy section of the Application Security API documentation.
rate_policy_id int
. Unique identifier of an existing rate policy.

Package Details

Repository
https://github.com/pulumi/pulumi-akamai
License
Apache-2.0
Notes
This Pulumi package is based on the akamai Terraform Provider.