UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

180 lines 9.54 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Api = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * 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> * ``` */ 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, id, state, opts) { return new Api(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Api.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["authorizerId"] = state ? state.authorizerId : undefined; resourceInputs["backendParams"] = state ? state.backendParams : undefined; resourceInputs["bodyDescription"] = state ? state.bodyDescription : undefined; resourceInputs["contentType"] = state ? state.contentType : undefined; resourceInputs["cors"] = state ? state.cors : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["failureResponse"] = state ? state.failureResponse : undefined; resourceInputs["funcGraph"] = state ? state.funcGraph : undefined; resourceInputs["funcGraphPolicies"] = state ? state.funcGraphPolicies : undefined; resourceInputs["groupId"] = state ? state.groupId : undefined; resourceInputs["instanceId"] = state ? state.instanceId : undefined; resourceInputs["isSendFgBodyBase64"] = state ? state.isSendFgBodyBase64 : undefined; resourceInputs["matching"] = state ? state.matching : undefined; resourceInputs["mock"] = state ? state.mock : undefined; resourceInputs["mockPolicies"] = state ? state.mockPolicies : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["registeredAt"] = state ? state.registeredAt : undefined; resourceInputs["requestMethod"] = state ? state.requestMethod : undefined; resourceInputs["requestParams"] = state ? state.requestParams : undefined; resourceInputs["requestPath"] = state ? state.requestPath : undefined; resourceInputs["requestProtocol"] = state ? state.requestProtocol : undefined; resourceInputs["responseId"] = state ? state.responseId : undefined; resourceInputs["securityAuthentication"] = state ? state.securityAuthentication : undefined; resourceInputs["simpleAuthentication"] = state ? state.simpleAuthentication : undefined; resourceInputs["successResponse"] = state ? state.successResponse : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; resourceInputs["web"] = state ? state.web : undefined; resourceInputs["webPolicies"] = state ? state.webPolicies : undefined; } else { const args = argsOrState; if ((!args || args.groupId === undefined) && !opts.urn) { throw new Error("Missing required property 'groupId'"); } if ((!args || args.instanceId === undefined) && !opts.urn) { throw new Error("Missing required property 'instanceId'"); } if ((!args || args.requestMethod === undefined) && !opts.urn) { throw new Error("Missing required property 'requestMethod'"); } if ((!args || args.requestPath === undefined) && !opts.urn) { throw new Error("Missing required property 'requestPath'"); } if ((!args || args.requestProtocol === undefined) && !opts.urn) { throw new Error("Missing required property 'requestProtocol'"); } if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["authorizerId"] = args ? args.authorizerId : undefined; resourceInputs["backendParams"] = args ? args.backendParams : undefined; resourceInputs["bodyDescription"] = args ? args.bodyDescription : undefined; resourceInputs["contentType"] = args ? args.contentType : undefined; resourceInputs["cors"] = args ? args.cors : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["failureResponse"] = args ? args.failureResponse : undefined; resourceInputs["funcGraph"] = args ? args.funcGraph : undefined; resourceInputs["funcGraphPolicies"] = args ? args.funcGraphPolicies : undefined; resourceInputs["groupId"] = args ? args.groupId : undefined; resourceInputs["instanceId"] = args ? args.instanceId : undefined; resourceInputs["isSendFgBodyBase64"] = args ? args.isSendFgBodyBase64 : undefined; resourceInputs["matching"] = args ? args.matching : undefined; resourceInputs["mock"] = args ? args.mock : undefined; resourceInputs["mockPolicies"] = args ? args.mockPolicies : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["requestMethod"] = args ? args.requestMethod : undefined; resourceInputs["requestParams"] = args ? args.requestParams : undefined; resourceInputs["requestPath"] = args ? args.requestPath : undefined; resourceInputs["requestProtocol"] = args ? args.requestProtocol : undefined; resourceInputs["responseId"] = args ? args.responseId : undefined; resourceInputs["securityAuthentication"] = args ? args.securityAuthentication : undefined; resourceInputs["simpleAuthentication"] = args ? args.simpleAuthentication : undefined; resourceInputs["successResponse"] = args ? args.successResponse : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["web"] = args ? args.web : undefined; resourceInputs["webPolicies"] = args ? args.webPolicies : undefined; resourceInputs["registeredAt"] = undefined /*out*/; resourceInputs["updatedAt"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Api.__pulumiType, name, resourceInputs, opts); } } exports.Api = Api; /** @internal */ Api.__pulumiType = 'huaweicloud:DedicatedApig/api:Api'; //# sourceMappingURL=api.js.map