akamai.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
Basic usage
using System.Collections.Generic;
using System.IO;
using Pulumi;
using Akamai = Pulumi.Akamai;
return await Deployment.RunAsync(() =>
{
var configuration = Akamai.GetAppSecConfiguration.Invoke(new()
{
Name = "Documentation",
});
var ratePolicy = new Akamai.AppSecRatePolicy("ratePolicy", new()
{
ConfigId = configuration.Apply(getAppSecConfigurationResult => getAppSecConfigurationResult.ConfigId),
RatePolicy = File.ReadAllText($"{path.Module}/rate_policy.json"),
});
return new Dictionary<string, object?>
{
["ratePolicyId"] = ratePolicy.RatePolicyId,
};
});
package main
import (
"fmt"
"io/ioutil"
"github.com/pulumi/pulumi-akamai/sdk/v4/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 {
configuration, err := akamai.LookupAppSecConfiguration(ctx, &akamai.LookupAppSecConfigurationArgs{
Name: pulumi.StringRef("Documentation"),
}, nil)
if err != nil {
return err
}
ratePolicy, err := akamai.NewAppSecRatePolicy(ctx, "ratePolicy", &akamai.AppSecRatePolicyArgs{
ConfigId: *pulumi.Int(configuration.ConfigId),
RatePolicy: readFileOrPanic(fmt.Sprintf("%v/rate_policy.json", path.Module)),
})
if err != nil {
return err
}
ctx.Export("ratePolicyId", ratePolicy.RatePolicyId)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.akamai.AkamaiFunctions;
import com.pulumi.akamai.inputs.GetAppSecConfigurationArgs;
import com.pulumi.akamai.AppSecRatePolicy;
import com.pulumi.akamai.AppSecRatePolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var configuration = AkamaiFunctions.getAppSecConfiguration(GetAppSecConfigurationArgs.builder()
.name("Documentation")
.build());
var ratePolicy = new AppSecRatePolicy("ratePolicy", AppSecRatePolicyArgs.builder()
.configId(configuration.applyValue(getAppSecConfigurationResult -> getAppSecConfigurationResult.configId()))
.ratePolicy(Files.readString(Paths.get(String.format("%s/rate_policy.json", path.module()))))
.build());
ctx.export("ratePolicyId", ratePolicy.ratePolicyId());
}
}
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 * as fs 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;
resources:
ratePolicy:
type: akamai:AppSecRatePolicy
properties:
configId: ${configuration.configId}
ratePolicy:
fn::readFile: ${path.module}/rate_policy.json
variables:
configuration:
fn::invoke:
Function: akamai:getAppSecConfiguration
Arguments:
name: Documentation
outputs:
ratePolicyId: ${ratePolicy.ratePolicyId}
Create 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)
public AppSecRatePolicy(String name, AppSecRatePolicyArgs args)
public AppSecRatePolicy(String name, AppSecRatePolicyArgs args, CustomResourceOptions options)
type: akamai:AppSecRatePolicy
properties: # The arguments to resource properties.
options: # 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.
- 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.
- name String
- The unique name of the resource.
- args AppSecRatePolicyArgs
- The arguments to resource properties.
- options 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:
- Config
Id int . Unique identifier of the security configuration associated with the rate policy being modified.
- Rate
Policy string . Path to a JSON file containing a rate policy definition.
- Config
Id int . Unique identifier of the security configuration associated with the rate policy being modified.
- Rate
Policy string . Path to a JSON file containing a rate policy definition.
- config
Id Integer . Unique identifier of the security configuration associated with the rate policy being modified.
- rate
Policy String . Path to a JSON file containing a rate policy definition.
- config
Id number . Unique identifier of the security configuration associated with the rate policy being modified.
- rate
Policy string . Path to a JSON file containing a rate policy definition.
- 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.
- config
Id Number . Unique identifier of the security configuration associated with the rate policy being modified.
- rate
Policy String . Path to a JSON file containing a rate policy definition.
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.
- Rate
Policy intId Unique identifier of the rate policy
- Id string
The provider-assigned unique ID for this managed resource.
- Rate
Policy intId Unique identifier of the rate policy
- id String
The provider-assigned unique ID for this managed resource.
- rate
Policy IntegerId Unique identifier of the rate policy
- id string
The provider-assigned unique ID for this managed resource.
- rate
Policy numberId Unique identifier of the rate policy
- id str
The provider-assigned unique ID for this managed resource.
- rate_
policy_ intid Unique identifier of the rate policy
- id String
The provider-assigned unique ID for this managed resource.
- rate
Policy NumberId Unique identifier of the rate policy
Look up 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)
public static AppSecRatePolicy get(String name, Output<String> id, AppSecRatePolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Config
Id int . Unique identifier of the security configuration associated with the rate policy being modified.
- Rate
Policy string . Path to a JSON file containing a rate policy definition.
- Rate
Policy intId Unique identifier of the rate policy
- Config
Id int . Unique identifier of the security configuration associated with the rate policy being modified.
- Rate
Policy string . Path to a JSON file containing a rate policy definition.
- Rate
Policy intId Unique identifier of the rate policy
- config
Id Integer . Unique identifier of the security configuration associated with the rate policy being modified.
- rate
Policy String . Path to a JSON file containing a rate policy definition.
- rate
Policy IntegerId Unique identifier of the rate policy
- config
Id number . Unique identifier of the security configuration associated with the rate policy being modified.
- rate
Policy string . Path to a JSON file containing a rate policy definition.
- rate
Policy numberId Unique identifier of the 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.
- rate_
policy_ intid Unique identifier of the rate policy
- config
Id Number . Unique identifier of the security configuration associated with the rate policy being modified.
- rate
Policy String . Path to a JSON file containing a rate policy definition.
- rate
Policy NumberId Unique identifier of the rate policy
Package Details
- Repository
- Akamai pulumi/pulumi-akamai
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
akamai
Terraform Provider.