@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
593 lines (592 loc) • 23.9 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "../types";
/**
* Manages an APIG API resource within HuaweiCloud.
*
* ## Example Usage
* ### Create an API with the Web backend and the protocol type is HTTP
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const instanceId = config.requireObject("instanceId");
* const groupId = config.requireObject("groupId");
* const apiName = config.requireObject("apiName");
* const customResponseId = config.requireObject("customResponseId");
* const customAuthId = config.requireObject("customAuthId");
* const vpcChannelId = config.requireObject("vpcChannelId");
* const test = new huaweicloud.dedicatedapig.Api("test", {
* instanceId: instanceId,
* groupId: groupId,
* type: "Public",
* requestProtocol: "HTTP",
* requestMethod: "POST",
* requestPath: "/terraform/users",
* securityAuthentication: "AUTHORIZER",
* matching: "Exact",
* successResponse: "Successful",
* responseId: customResponseId,
* authorizerId: customAuthId,
* backendParams: [{
* type: "SYSTEM",
* name: "X-User-Auth",
* location: "HEADER",
* value: "user_name",
* }],
* web: {
* path: "/backend/users",
* vpcChannelId: vpcChannelId,
* requestMethod: "POST",
* requestProtocol: "HTTP",
* timeout: 5000,
* },
* });
* ```
*
* ## Import
*
* APIs can be imported using their `name` and the related dedicated instance IDs, separated by a slash, e.g.
*
* ```sh
* $ pulumi import huaweicloud:DedicatedApig/api:Api test <instance_id>/<name>
* ```
*/
export declare class Api extends pulumi.CustomResource {
/**
* Get an existing Api 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?: ApiState, opts?: pulumi.CustomResourceOptions): Api;
/**
* Returns true if the given object is an instance of Api. 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 Api;
/**
* Specifies the ID of the backend custom authorization.
*/
readonly authorizerId: pulumi.Output<string | undefined>;
/**
* Specifies an array of one or more backend parameters. The maximum of request
* parameters is 50. The object structure is documented above.
*/
readonly backendParams: pulumi.Output<outputs.DedicatedApig.ApiBackendParam[] | undefined>;
/**
* Specifies the description of the API request body, which can be an example
* request body, media type or parameters.
* The request body does not exceed `20,480` characters.
*/
readonly bodyDescription: pulumi.Output<string | undefined>;
/**
* Specifies the content type of the request body.
* The valid values are as follows:
* + **application/json**
* + **application/xml**
* + **multipart/form-data**
* + **text/plain**
*/
readonly contentType: pulumi.Output<string>;
/**
* Specifies whether CORS is supported, defaults to **false**.
*/
readonly cors: pulumi.Output<boolean | undefined>;
/**
* Specifies the description of the constant or system parameter.
* The description contains a maximum of `255` characters and the angle brackets (< and >) are not allowed.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Specifies the example response for a failure request.
* The response contains a maximum of `20,480` characters.
*/
readonly failureResponse: pulumi.Output<string | undefined>;
/**
* Specifies the function graph backend details.
* The object structure is documented below.
* Changing this will create a new API resource.
*/
readonly funcGraph: pulumi.Output<outputs.DedicatedApig.ApiFuncGraph>;
/**
* Specifies the Mock policy backends.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
readonly funcGraphPolicies: pulumi.Output<outputs.DedicatedApig.ApiFuncGraphPolicy[] | undefined>;
/**
* Specifies the ID of the APIG group to which the API belongs.
* Changing this will create a new API resource.
*/
readonly groupId: pulumi.Output<string>;
/**
* Specifies an ID of the APIG dedicated instance to which the API belongs
* to. Changing this will create a new API resource.
*/
readonly instanceId: pulumi.Output<string>;
/**
* Specifies whether to perform base64 encoding on the body for interaction
* with FunctionGraph.
* Defaults to **true**.
* The body does not need to be encoded using base64 only when `contentType` is set to **application/json**.
* These scenarios which can be applied:
* + Custom authentication.
* + Bound circuit breaker plug-in with FunctionGraph backend downgrade policy.
* + APIs with FunctionGraph backend.
*/
readonly isSendFgBodyBase64: pulumi.Output<boolean | undefined>;
/**
* Specifies the route matching mode.
* The valid values are **Exact** and **Prefix**, defaults to **Exact**.
*/
readonly matching: pulumi.Output<string | undefined>;
/**
* Specifies the mock backend details.
* The object structure is documented below.
* Changing this will create a new API resource.
*/
readonly mock: pulumi.Output<outputs.DedicatedApig.ApiMock>;
/**
* Specifies the Mock policy backends.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
readonly mockPolicies: pulumi.Output<outputs.DedicatedApig.ApiMockPolicy[] | undefined>;
/**
* Specifies the backend policy name.
* The valid length is limited from `3` to `64`, only letters, digits and underscores (_) are allowed.
* It must start with a letter.
*/
readonly name: pulumi.Output<string>;
/**
* Specifies the region where the API is located.
* If omitted, the provider-level region will be used. Changing this will create a new API resource.
*/
readonly region: pulumi.Output<string>;
/**
* The registered time of the API.
*/
readonly registeredAt: pulumi.Output<string>;
/**
* Specifies the backend request method of the API.
* The valid types are **GET**, **POST**, **PUT**, **DELETE**, **HEAD**, **PATCH**, **OPTIONS** and **ANY**.
*/
readonly requestMethod: pulumi.Output<string>;
/**
* Specifies the configurations of the front-end parameters.
* The object structure is documented below.
*/
readonly requestParams: pulumi.Output<outputs.DedicatedApig.ApiRequestParam[]>;
/**
* Specifies the request address, which can contain a maximum of `512` characters,
* the request parameters enclosed with brackets ({}).
* + The address can contain special characters, such as asterisks (*), percent signs (%), hyphens (-), and
* underscores (_) and must comply with URI specifications.
* + The address can contain environment variables, each starting with a letter and consisting of `3` to `32` characters.
*/
readonly requestPath: pulumi.Output<string>;
/**
* Specifies the backend request protocol. The valid values are **HTTP** and
* **HTTPS**, defaults to **HTTPS**.
*/
readonly requestProtocol: pulumi.Output<string>;
/**
* Specifies the APIG group response ID.
*/
readonly responseId: pulumi.Output<string | undefined>;
/**
* Specifies the security authentication mode of the API request.
* The valid values are **NONE**, **APP**, **IAM** and **AUTHORIZER**, defaults to **NONE**.
*/
readonly securityAuthentication: pulumi.Output<string | undefined>;
/**
* Specifies whether the authentication of the application code is enabled.
* The application code must located in the header when `simpleAuthentication` is true.
*/
readonly simpleAuthentication: pulumi.Output<boolean>;
/**
* Specifies the example response for a successful request.
* The response contains a maximum of `20,480` characters.
*/
readonly successResponse: pulumi.Output<string | undefined>;
/**
* Specifies the list of tags configuration.
*/
readonly tags: pulumi.Output<string[] | undefined>;
/**
* Specifies the condition type of the backend policy.
* The valid values are **Equal**, **Enumerated** and **Matching**, defaults to **Equal**.
* When the `sysName` is **req_method**, the valid values are **Equal** and **Enumerated**.
*/
readonly type: pulumi.Output<string>;
/**
* The latest update time of the API.
*/
readonly updatedAt: pulumi.Output<string>;
/**
* Specifies the web backend details.
* The object structure is documented below. Changing this will create a new API resource.
*/
readonly web: pulumi.Output<outputs.DedicatedApig.ApiWeb>;
/**
* Specifies the example response for a failed request.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
readonly webPolicies: pulumi.Output<outputs.DedicatedApig.ApiWebPolicy[] | undefined>;
/**
* Create a Api 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: ApiArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Api resources.
*/
export interface ApiState {
/**
* Specifies the ID of the backend custom authorization.
*/
authorizerId?: pulumi.Input<string>;
/**
* Specifies an array of one or more backend parameters. The maximum of request
* parameters is 50. The object structure is documented above.
*/
backendParams?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiBackendParam>[]>;
/**
* Specifies the description of the API request body, which can be an example
* request body, media type or parameters.
* The request body does not exceed `20,480` characters.
*/
bodyDescription?: pulumi.Input<string>;
/**
* Specifies the content type of the request body.
* The valid values are as follows:
* + **application/json**
* + **application/xml**
* + **multipart/form-data**
* + **text/plain**
*/
contentType?: pulumi.Input<string>;
/**
* Specifies whether CORS is supported, defaults to **false**.
*/
cors?: pulumi.Input<boolean>;
/**
* Specifies the description of the constant or system parameter.
* The description contains a maximum of `255` characters and the angle brackets (< and >) are not allowed.
*/
description?: pulumi.Input<string>;
/**
* Specifies the example response for a failure request.
* The response contains a maximum of `20,480` characters.
*/
failureResponse?: pulumi.Input<string>;
/**
* Specifies the function graph backend details.
* The object structure is documented below.
* Changing this will create a new API resource.
*/
funcGraph?: pulumi.Input<inputs.DedicatedApig.ApiFuncGraph>;
/**
* Specifies the Mock policy backends.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
funcGraphPolicies?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiFuncGraphPolicy>[]>;
/**
* Specifies the ID of the APIG group to which the API belongs.
* Changing this will create a new API resource.
*/
groupId?: pulumi.Input<string>;
/**
* Specifies an ID of the APIG dedicated instance to which the API belongs
* to. Changing this will create a new API resource.
*/
instanceId?: pulumi.Input<string>;
/**
* Specifies whether to perform base64 encoding on the body for interaction
* with FunctionGraph.
* Defaults to **true**.
* The body does not need to be encoded using base64 only when `contentType` is set to **application/json**.
* These scenarios which can be applied:
* + Custom authentication.
* + Bound circuit breaker plug-in with FunctionGraph backend downgrade policy.
* + APIs with FunctionGraph backend.
*/
isSendFgBodyBase64?: pulumi.Input<boolean>;
/**
* Specifies the route matching mode.
* The valid values are **Exact** and **Prefix**, defaults to **Exact**.
*/
matching?: pulumi.Input<string>;
/**
* Specifies the mock backend details.
* The object structure is documented below.
* Changing this will create a new API resource.
*/
mock?: pulumi.Input<inputs.DedicatedApig.ApiMock>;
/**
* Specifies the Mock policy backends.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
mockPolicies?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiMockPolicy>[]>;
/**
* Specifies the backend policy name.
* The valid length is limited from `3` to `64`, only letters, digits and underscores (_) are allowed.
* It must start with a letter.
*/
name?: pulumi.Input<string>;
/**
* Specifies the region where the API is located.
* If omitted, the provider-level region will be used. Changing this will create a new API resource.
*/
region?: pulumi.Input<string>;
/**
* The registered time of the API.
*/
registeredAt?: pulumi.Input<string>;
/**
* Specifies the backend request method of the API.
* The valid types are **GET**, **POST**, **PUT**, **DELETE**, **HEAD**, **PATCH**, **OPTIONS** and **ANY**.
*/
requestMethod?: pulumi.Input<string>;
/**
* Specifies the configurations of the front-end parameters.
* The object structure is documented below.
*/
requestParams?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiRequestParam>[]>;
/**
* Specifies the request address, which can contain a maximum of `512` characters,
* the request parameters enclosed with brackets ({}).
* + The address can contain special characters, such as asterisks (*), percent signs (%), hyphens (-), and
* underscores (_) and must comply with URI specifications.
* + The address can contain environment variables, each starting with a letter and consisting of `3` to `32` characters.
*/
requestPath?: pulumi.Input<string>;
/**
* Specifies the backend request protocol. The valid values are **HTTP** and
* **HTTPS**, defaults to **HTTPS**.
*/
requestProtocol?: pulumi.Input<string>;
/**
* Specifies the APIG group response ID.
*/
responseId?: pulumi.Input<string>;
/**
* Specifies the security authentication mode of the API request.
* The valid values are **NONE**, **APP**, **IAM** and **AUTHORIZER**, defaults to **NONE**.
*/
securityAuthentication?: pulumi.Input<string>;
/**
* Specifies whether the authentication of the application code is enabled.
* The application code must located in the header when `simpleAuthentication` is true.
*/
simpleAuthentication?: pulumi.Input<boolean>;
/**
* Specifies the example response for a successful request.
* The response contains a maximum of `20,480` characters.
*/
successResponse?: pulumi.Input<string>;
/**
* Specifies the list of tags configuration.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Specifies the condition type of the backend policy.
* The valid values are **Equal**, **Enumerated** and **Matching**, defaults to **Equal**.
* When the `sysName` is **req_method**, the valid values are **Equal** and **Enumerated**.
*/
type?: pulumi.Input<string>;
/**
* The latest update time of the API.
*/
updatedAt?: pulumi.Input<string>;
/**
* Specifies the web backend details.
* The object structure is documented below. Changing this will create a new API resource.
*/
web?: pulumi.Input<inputs.DedicatedApig.ApiWeb>;
/**
* Specifies the example response for a failed request.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
webPolicies?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiWebPolicy>[]>;
}
/**
* The set of arguments for constructing a Api resource.
*/
export interface ApiArgs {
/**
* Specifies the ID of the backend custom authorization.
*/
authorizerId?: pulumi.Input<string>;
/**
* Specifies an array of one or more backend parameters. The maximum of request
* parameters is 50. The object structure is documented above.
*/
backendParams?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiBackendParam>[]>;
/**
* Specifies the description of the API request body, which can be an example
* request body, media type or parameters.
* The request body does not exceed `20,480` characters.
*/
bodyDescription?: pulumi.Input<string>;
/**
* Specifies the content type of the request body.
* The valid values are as follows:
* + **application/json**
* + **application/xml**
* + **multipart/form-data**
* + **text/plain**
*/
contentType?: pulumi.Input<string>;
/**
* Specifies whether CORS is supported, defaults to **false**.
*/
cors?: pulumi.Input<boolean>;
/**
* Specifies the description of the constant or system parameter.
* The description contains a maximum of `255` characters and the angle brackets (< and >) are not allowed.
*/
description?: pulumi.Input<string>;
/**
* Specifies the example response for a failure request.
* The response contains a maximum of `20,480` characters.
*/
failureResponse?: pulumi.Input<string>;
/**
* Specifies the function graph backend details.
* The object structure is documented below.
* Changing this will create a new API resource.
*/
funcGraph?: pulumi.Input<inputs.DedicatedApig.ApiFuncGraph>;
/**
* Specifies the Mock policy backends.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
funcGraphPolicies?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiFuncGraphPolicy>[]>;
/**
* Specifies the ID of the APIG group to which the API belongs.
* Changing this will create a new API resource.
*/
groupId: pulumi.Input<string>;
/**
* Specifies an ID of the APIG dedicated instance to which the API belongs
* to. Changing this will create a new API resource.
*/
instanceId: pulumi.Input<string>;
/**
* Specifies whether to perform base64 encoding on the body for interaction
* with FunctionGraph.
* Defaults to **true**.
* The body does not need to be encoded using base64 only when `contentType` is set to **application/json**.
* These scenarios which can be applied:
* + Custom authentication.
* + Bound circuit breaker plug-in with FunctionGraph backend downgrade policy.
* + APIs with FunctionGraph backend.
*/
isSendFgBodyBase64?: pulumi.Input<boolean>;
/**
* Specifies the route matching mode.
* The valid values are **Exact** and **Prefix**, defaults to **Exact**.
*/
matching?: pulumi.Input<string>;
/**
* Specifies the mock backend details.
* The object structure is documented below.
* Changing this will create a new API resource.
*/
mock?: pulumi.Input<inputs.DedicatedApig.ApiMock>;
/**
* Specifies the Mock policy backends.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
mockPolicies?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiMockPolicy>[]>;
/**
* Specifies the backend policy name.
* The valid length is limited from `3` to `64`, only letters, digits and underscores (_) are allowed.
* It must start with a letter.
*/
name?: pulumi.Input<string>;
/**
* Specifies the region where the API is located.
* If omitted, the provider-level region will be used. Changing this will create a new API resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies the backend request method of the API.
* The valid types are **GET**, **POST**, **PUT**, **DELETE**, **HEAD**, **PATCH**, **OPTIONS** and **ANY**.
*/
requestMethod: pulumi.Input<string>;
/**
* Specifies the configurations of the front-end parameters.
* The object structure is documented below.
*/
requestParams?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiRequestParam>[]>;
/**
* Specifies the request address, which can contain a maximum of `512` characters,
* the request parameters enclosed with brackets ({}).
* + The address can contain special characters, such as asterisks (*), percent signs (%), hyphens (-), and
* underscores (_) and must comply with URI specifications.
* + The address can contain environment variables, each starting with a letter and consisting of `3` to `32` characters.
*/
requestPath: pulumi.Input<string>;
/**
* Specifies the backend request protocol. The valid values are **HTTP** and
* **HTTPS**, defaults to **HTTPS**.
*/
requestProtocol: pulumi.Input<string>;
/**
* Specifies the APIG group response ID.
*/
responseId?: pulumi.Input<string>;
/**
* Specifies the security authentication mode of the API request.
* The valid values are **NONE**, **APP**, **IAM** and **AUTHORIZER**, defaults to **NONE**.
*/
securityAuthentication?: pulumi.Input<string>;
/**
* Specifies whether the authentication of the application code is enabled.
* The application code must located in the header when `simpleAuthentication` is true.
*/
simpleAuthentication?: pulumi.Input<boolean>;
/**
* Specifies the example response for a successful request.
* The response contains a maximum of `20,480` characters.
*/
successResponse?: pulumi.Input<string>;
/**
* Specifies the list of tags configuration.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Specifies the condition type of the backend policy.
* The valid values are **Equal**, **Enumerated** and **Matching**, defaults to **Equal**.
* When the `sysName` is **req_method**, the valid values are **Equal** and **Enumerated**.
*/
type: pulumi.Input<string>;
/**
* Specifies the web backend details.
* The object structure is documented below. Changing this will create a new API resource.
*/
web?: pulumi.Input<inputs.DedicatedApig.ApiWeb>;
/**
* Specifies the example response for a failed request.
* The maximum blocks of the policy is 5.
* The object structure is documented below.
*/
webPolicies?: pulumi.Input<pulumi.Input<inputs.DedicatedApig.ApiWebPolicy>[]>;
}