@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
331 lines (330 loc) • 14 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "../types";
/**
* Manages an APIG (API) throttling policy resource within HuaweiCloud.
*
* ## Example Usage
* ### Create a basic throttling policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const instanceId = config.requireObject("instanceId");
* const policyName = config.requireObject("policyName");
* const description = config.requireObject("description");
* const test = new huaweicloud.dedicatedapig.ThrottlingPolicy("test", {
* instanceId: instanceId,
* description: description,
* type: "API-based",
* period: 10,
* periodUnit: "MINUTE",
* maxApiRequests: 70,
* maxUserRequests: 45,
* maxAppRequests: 45,
* maxIpRequests: 45,
* });
* ```
* ### Create a throttling policy with a special throttle
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const instanceId = config.requireObject("instanceId");
* const policyName = config.requireObject("policyName");
* const applicationId = config.requireObject("applicationId");
* const test = new huaweicloud.dedicatedapig.ThrottlingPolicy("test", {
* instanceId: instanceId,
* type: "API-based",
* period: 10,
* periodUnit: "MINUTE",
* maxApiRequests: 70,
* appThrottles: [{
* maxApiRequests: 40,
* throttlingObjectId: applicationId,
* }],
* });
* ```
*
* ## Import
*
* API Throttling Policies can be imported using their `name` and related dedicated instance ID, separated by a slash, e.g.
*
* ```sh
* $ pulumi import huaweicloud:DedicatedApig/throttlingPolicy:ThrottlingPolicy test <instance_id>/<name>
* ```
*/
export declare class ThrottlingPolicy extends pulumi.CustomResource {
/**
* Get an existing ThrottlingPolicy resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ThrottlingPolicyState, opts?: pulumi.CustomResourceOptions): ThrottlingPolicy;
/**
* Returns true if the given object is an instance of ThrottlingPolicy. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is ThrottlingPolicy;
/**
* Specifies the array of one or more special throttling policies for APP limit.
* The object structure is documented below.
*/
readonly appThrottles: pulumi.Output<outputs.DedicatedApig.ThrottlingPolicyAppThrottle[] | undefined>;
/**
* The creation time of the throttling policy.
*/
readonly createdAt: pulumi.Output<string>;
/**
* Specifies the description about the API throttling policy.
* The description contain a maximum of `255` characters and the angle brackets (< and >) are not allowed.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Specifies the ID of the dedicated instance to which the throttling
* policy belongs.
* Changing this will create a new resource.
*/
readonly instanceId: pulumi.Output<string>;
/**
* Specifies the maximum number of times an API can be accessed within a specified
* period.
*/
readonly maxApiRequests: pulumi.Output<number>;
/**
* Specifies the maximum number of times the API can be accessed by an app within
* the same period.
* The value of this parameter must be less than or equal to the value of `maxUserRequests`.
*/
readonly maxAppRequests: pulumi.Output<number | undefined>;
/**
* Specifies the maximum number of times the API can be accessed by an IP address
* within the same period.
* The value of this parameter must be less than or equal to the value of `maxApiRequests`.
*/
readonly maxIpRequests: pulumi.Output<number | undefined>;
/**
* Specifies the maximum number of times the API can be accessed by a user within
* the same period.
* The value of this parameter must be less than or equal to the value of `maxApiRequests`.
*/
readonly maxUserRequests: pulumi.Output<number | undefined>;
/**
* Specifies the name of the throttling policy.
* The valid length is limited from `3` to `64`, only Chinese and English letters, digits and underscores (_) are
* allowed.
* The name must start with a Chinese or English letter.
*/
readonly name: pulumi.Output<string>;
/**
* Specifies the period of time for limiting the number of API calls.
* This parameter applies with each of the API call limits: `maxApiRequests`, `maxAppRequests`, `maxIpRequests`
* and `maxUserRequests`.
*/
readonly period: pulumi.Output<number>;
/**
* Specifies the time unit for limiting the number of API calls.
* The valid values are **SECOND**, **MINUTE**, **HOUR** and **DAY**, defaults to **MINUTE**.
*/
readonly periodUnit: pulumi.Output<string | undefined>;
/**
* Specifies the region where the throttling policy is located.
* If omitted, the provider-level region will be used. Changing this will create a new resource.
*/
readonly region: pulumi.Output<string>;
/**
* Specifies the type of the request throttling policy.
* The valid values are as follows:
* + **API-based**: limiting the maximum number of times a single API bound to the policy can be called within the
* specified period.
* + **API-shared**: limiting the maximum number of times all APIs bound to the policy can be called within the specified
* period.
*/
readonly type: pulumi.Output<string | undefined>;
/**
* Specifies the array of one or more special throttling policies for IAM user limit.
* The object structure is documented below.
*/
readonly userThrottles: pulumi.Output<outputs.DedicatedApig.ThrottlingPolicyUserThrottle[] | undefined>;
/**
* Create a ThrottlingPolicy resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: ThrottlingPolicyArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering ThrottlingPolicy resources.
*/
export interface ThrottlingPolicyState {
/**
* Specifies the array of one or more special throttling policies for APP limit.
* The object structure is documented below.
*/
appThrottles?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ThrottlingPolicyAppThrottle>[]>;
/**
* The creation time of the throttling policy.
*/
createdAt?: pulumi.Input<string>;
/**
* Specifies the description about the API throttling policy.
* The description contain a maximum of `255` characters and the angle brackets (< and >) are not allowed.
*/
description?: pulumi.Input<string>;
/**
* Specifies the ID of the dedicated instance to which the throttling
* policy belongs.
* Changing this will create a new resource.
*/
instanceId?: pulumi.Input<string>;
/**
* Specifies the maximum number of times an API can be accessed within a specified
* period.
*/
maxApiRequests?: pulumi.Input<number>;
/**
* Specifies the maximum number of times the API can be accessed by an app within
* the same period.
* The value of this parameter must be less than or equal to the value of `maxUserRequests`.
*/
maxAppRequests?: pulumi.Input<number>;
/**
* Specifies the maximum number of times the API can be accessed by an IP address
* within the same period.
* The value of this parameter must be less than or equal to the value of `maxApiRequests`.
*/
maxIpRequests?: pulumi.Input<number>;
/**
* Specifies the maximum number of times the API can be accessed by a user within
* the same period.
* The value of this parameter must be less than or equal to the value of `maxApiRequests`.
*/
maxUserRequests?: pulumi.Input<number>;
/**
* Specifies the name of the throttling policy.
* The valid length is limited from `3` to `64`, only Chinese and English letters, digits and underscores (_) are
* allowed.
* The name must start with a Chinese or English letter.
*/
name?: pulumi.Input<string>;
/**
* Specifies the period of time for limiting the number of API calls.
* This parameter applies with each of the API call limits: `maxApiRequests`, `maxAppRequests`, `maxIpRequests`
* and `maxUserRequests`.
*/
period?: pulumi.Input<number>;
/**
* Specifies the time unit for limiting the number of API calls.
* The valid values are **SECOND**, **MINUTE**, **HOUR** and **DAY**, defaults to **MINUTE**.
*/
periodUnit?: pulumi.Input<string>;
/**
* Specifies the region where the throttling policy is located.
* If omitted, the provider-level region will be used. Changing this will create a new resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies the type of the request throttling policy.
* The valid values are as follows:
* + **API-based**: limiting the maximum number of times a single API bound to the policy can be called within the
* specified period.
* + **API-shared**: limiting the maximum number of times all APIs bound to the policy can be called within the specified
* period.
*/
type?: pulumi.Input<string>;
/**
* Specifies the array of one or more special throttling policies for IAM user limit.
* The object structure is documented below.
*/
userThrottles?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ThrottlingPolicyUserThrottle>[]>;
}
/**
* The set of arguments for constructing a ThrottlingPolicy resource.
*/
export interface ThrottlingPolicyArgs {
/**
* Specifies the array of one or more special throttling policies for APP limit.
* The object structure is documented below.
*/
appThrottles?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ThrottlingPolicyAppThrottle>[]>;
/**
* Specifies the description about the API throttling policy.
* The description contain a maximum of `255` characters and the angle brackets (< and >) are not allowed.
*/
description?: pulumi.Input<string>;
/**
* Specifies the ID of the dedicated instance to which the throttling
* policy belongs.
* Changing this will create a new resource.
*/
instanceId: pulumi.Input<string>;
/**
* Specifies the maximum number of times an API can be accessed within a specified
* period.
*/
maxApiRequests: pulumi.Input<number>;
/**
* Specifies the maximum number of times the API can be accessed by an app within
* the same period.
* The value of this parameter must be less than or equal to the value of `maxUserRequests`.
*/
maxAppRequests?: pulumi.Input<number>;
/**
* Specifies the maximum number of times the API can be accessed by an IP address
* within the same period.
* The value of this parameter must be less than or equal to the value of `maxApiRequests`.
*/
maxIpRequests?: pulumi.Input<number>;
/**
* Specifies the maximum number of times the API can be accessed by a user within
* the same period.
* The value of this parameter must be less than or equal to the value of `maxApiRequests`.
*/
maxUserRequests?: pulumi.Input<number>;
/**
* Specifies the name of the throttling policy.
* The valid length is limited from `3` to `64`, only Chinese and English letters, digits and underscores (_) are
* allowed.
* The name must start with a Chinese or English letter.
*/
name?: pulumi.Input<string>;
/**
* Specifies the period of time for limiting the number of API calls.
* This parameter applies with each of the API call limits: `maxApiRequests`, `maxAppRequests`, `maxIpRequests`
* and `maxUserRequests`.
*/
period: pulumi.Input<number>;
/**
* Specifies the time unit for limiting the number of API calls.
* The valid values are **SECOND**, **MINUTE**, **HOUR** and **DAY**, defaults to **MINUTE**.
*/
periodUnit?: pulumi.Input<string>;
/**
* Specifies the region where the throttling policy is located.
* If omitted, the provider-level region will be used. Changing this will create a new resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies the type of the request throttling policy.
* The valid values are as follows:
* + **API-based**: limiting the maximum number of times a single API bound to the policy can be called within the
* specified period.
* + **API-shared**: limiting the maximum number of times all APIs bound to the policy can be called within the specified
* period.
*/
type?: pulumi.Input<string>;
/**
* Specifies the array of one or more special throttling policies for IAM user limit.
* The object structure is documented below.
*/
userThrottles?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ThrottlingPolicyUserThrottle>[]>;
}