@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
121 lines • 5.37 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.ApiPublishment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
* ### Publish a new version of the API
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const instanceId = config.requireObject("instanceId");
* const envId = config.requireObject("envId");
* const apiId = config.requireObject("apiId");
* const _default = new huaweicloud.dedicatedapig.ApiPublishment("default", {
* instanceId: instanceId,
* envId: envId,
* apiId: apiId,
* });
* ```
* ### Switch to a specified version of the API which is published
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const instanceId = config.requireObject("instanceId");
* const envId = config.requireObject("envId");
* const apiId = config.requireObject("apiId");
* const versionId = config.requireObject("versionId");
* const _default = new huaweicloud.dedicatedapig.ApiPublishment("default", {
* instanceId: instanceId,
* envId: envId,
* apiId: apiId,
* versionId: versionId,
* });
* ```
*
* ## Import
*
* The publishments can be imported using their related `instance_id`, `env_id` and `api_id`, separated by slashes, e.g.
*
* ```sh
* $ pulumi import huaweicloud:DedicatedApig/apiPublishment:ApiPublishment test <instance_id>/<env_id>/<api_id>
* ```
*/
class ApiPublishment extends pulumi.CustomResource {
/**
* Get an existing ApiPublishment 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 ApiPublishment(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ApiPublishment. 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'] === ApiPublishment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["apiId"] = state ? state.apiId : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["envId"] = state ? state.envId : undefined;
resourceInputs["envName"] = state ? state.envName : undefined;
resourceInputs["histories"] = state ? state.histories : undefined;
resourceInputs["instanceId"] = state ? state.instanceId : undefined;
resourceInputs["publishId"] = state ? state.publishId : undefined;
resourceInputs["publishedAt"] = state ? state.publishedAt : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["versionId"] = state ? state.versionId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.apiId === undefined) && !opts.urn) {
throw new Error("Missing required property 'apiId'");
}
if ((!args || args.envId === undefined) && !opts.urn) {
throw new Error("Missing required property 'envId'");
}
if ((!args || args.instanceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'instanceId'");
}
resourceInputs["apiId"] = args ? args.apiId : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["envId"] = args ? args.envId : undefined;
resourceInputs["instanceId"] = args ? args.instanceId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["versionId"] = args ? args.versionId : undefined;
resourceInputs["envName"] = undefined /*out*/;
resourceInputs["histories"] = undefined /*out*/;
resourceInputs["publishId"] = undefined /*out*/;
resourceInputs["publishedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ApiPublishment.__pulumiType, name, resourceInputs, opts);
}
}
exports.ApiPublishment = ApiPublishment;
/** @internal */
ApiPublishment.__pulumiType = 'huaweicloud:DedicatedApig/apiPublishment:ApiPublishment';
//# sourceMappingURL=apiPublishment.js.map