@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
149 lines • 7.39 kB
JavaScript
;
// *** 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");
/**
* Provides an API gateway API resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const tfApigwGroup = new huaweicloud.sharedapig.Group("tfApigwGroup", {description: "your descpiption"});
* const tfApigwApi = new huaweicloud.sharedapig.Api("tfApigwApi", {
* groupId: tfApigwGroup.id,
* description: "your descpiption",
* tags: [
* "tag1",
* "tag2",
* ],
* visibility: 2,
* authType: "IAM",
* backendType: "HTTP",
* requestProtocol: "HTTPS",
* requestMethod: "GET",
* requestUri: "/test/path1",
* exampleSuccessResponse: "example response",
* httpBackend: {
* protocol: "HTTPS",
* method: "GET",
* uri: "/web/openapi",
* urlDomain: "myhuaweicloud.com",
* timeout: 10000,
* },
* });
* ```
*
* ## Import
*
* API can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:SharedApig/api:Api api "774438a28a574ac8a496325d1bf51807"
* ```
*/
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["authType"] = state ? state.authType : undefined;
resourceInputs["backendParameters"] = state ? state.backendParameters : undefined;
resourceInputs["backendType"] = state ? state.backendType : undefined;
resourceInputs["cors"] = state ? state.cors : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["exampleFailureResponse"] = state ? state.exampleFailureResponse : undefined;
resourceInputs["exampleSuccessResponse"] = state ? state.exampleSuccessResponse : undefined;
resourceInputs["functionBackend"] = state ? state.functionBackend : undefined;
resourceInputs["groupId"] = state ? state.groupId : undefined;
resourceInputs["groupName"] = state ? state.groupName : undefined;
resourceInputs["httpBackend"] = state ? state.httpBackend : undefined;
resourceInputs["mockBackend"] = state ? state.mockBackend : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["requestMethod"] = state ? state.requestMethod : undefined;
resourceInputs["requestParameters"] = state ? state.requestParameters : undefined;
resourceInputs["requestProtocol"] = state ? state.requestProtocol : undefined;
resourceInputs["requestUri"] = state ? state.requestUri : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["version"] = state ? state.version : undefined;
resourceInputs["visibility"] = state ? state.visibility : undefined;
}
else {
const args = argsOrState;
if ((!args || args.authType === undefined) && !opts.urn) {
throw new Error("Missing required property 'authType'");
}
if ((!args || args.backendType === undefined) && !opts.urn) {
throw new Error("Missing required property 'backendType'");
}
if ((!args || args.exampleSuccessResponse === undefined) && !opts.urn) {
throw new Error("Missing required property 'exampleSuccessResponse'");
}
if ((!args || args.groupId === undefined) && !opts.urn) {
throw new Error("Missing required property 'groupId'");
}
if ((!args || args.requestMethod === undefined) && !opts.urn) {
throw new Error("Missing required property 'requestMethod'");
}
if ((!args || args.requestUri === undefined) && !opts.urn) {
throw new Error("Missing required property 'requestUri'");
}
resourceInputs["authType"] = args ? args.authType : undefined;
resourceInputs["backendParameters"] = args ? args.backendParameters : undefined;
resourceInputs["backendType"] = args ? args.backendType : undefined;
resourceInputs["cors"] = args ? args.cors : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["exampleFailureResponse"] = args ? args.exampleFailureResponse : undefined;
resourceInputs["exampleSuccessResponse"] = args ? args.exampleSuccessResponse : undefined;
resourceInputs["functionBackend"] = args ? args.functionBackend : undefined;
resourceInputs["groupId"] = args ? args.groupId : undefined;
resourceInputs["httpBackend"] = args ? args.httpBackend : undefined;
resourceInputs["mockBackend"] = args ? args.mockBackend : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["requestMethod"] = args ? args.requestMethod : undefined;
resourceInputs["requestParameters"] = args ? args.requestParameters : undefined;
resourceInputs["requestProtocol"] = args ? args.requestProtocol : undefined;
resourceInputs["requestUri"] = args ? args.requestUri : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["version"] = args ? args.version : undefined;
resourceInputs["visibility"] = args ? args.visibility : undefined;
resourceInputs["groupName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Api.__pulumiType, name, resourceInputs, opts);
}
}
exports.Api = Api;
/** @internal */
Api.__pulumiType = 'huaweicloud:SharedApig/api:Api';
//# sourceMappingURL=api.js.map