@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
108 lines • 4.9 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.Subscription = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an SMN subscription resource within HuaweiCloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const topic1 = new huaweicloud.smn.Topic("topic1", {displayName: "The display name of topic_1"});
* const subscription1 = new huaweicloud.smn.Subscription("subscription1", {
* topicUrn: topic1.id,
* endpoint: "mailtest@gmail.com",
* protocol: "email",
* remark: "O&M",
* });
* const subscription2 = new huaweicloud.smn.Subscription("subscription2", {
* topicUrn: topic1.id,
* endpoint: "13600000000",
* protocol: "sms",
* remark: "O&M",
* });
* ```
*
* ## Import
*
* SMN subscription can be imported using the `id` (subscription urn), e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Smn/subscription:Subscription subscription_1 urn:smn:cn-north-4:0970dd7a1300f5672ff2c003c60ae115:topic_1:a2aa5a1f66df494184f4e108398de1a6
* ```
*/
class Subscription extends pulumi.CustomResource {
/**
* Get an existing Subscription 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 Subscription(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Subscription. 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'] === Subscription.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["endpoint"] = state ? state.endpoint : undefined;
resourceInputs["extension"] = state ? state.extension : undefined;
resourceInputs["filterPolicies"] = state ? state.filterPolicies : undefined;
resourceInputs["owner"] = state ? state.owner : undefined;
resourceInputs["protocol"] = state ? state.protocol : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["remark"] = state ? state.remark : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["subscriptionUrn"] = state ? state.subscriptionUrn : undefined;
resourceInputs["topicUrn"] = state ? state.topicUrn : undefined;
}
else {
const args = argsOrState;
if ((!args || args.endpoint === undefined) && !opts.urn) {
throw new Error("Missing required property 'endpoint'");
}
if ((!args || args.protocol === undefined) && !opts.urn) {
throw new Error("Missing required property 'protocol'");
}
if ((!args || args.topicUrn === undefined) && !opts.urn) {
throw new Error("Missing required property 'topicUrn'");
}
resourceInputs["endpoint"] = args ? args.endpoint : undefined;
resourceInputs["extension"] = args ? args.extension : undefined;
resourceInputs["protocol"] = args ? args.protocol : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["remark"] = args ? args.remark : undefined;
resourceInputs["topicUrn"] = args ? args.topicUrn : undefined;
resourceInputs["filterPolicies"] = undefined /*out*/;
resourceInputs["owner"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["subscriptionUrn"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Subscription.__pulumiType, name, resourceInputs, opts);
}
}
exports.Subscription = Subscription;
/** @internal */
Subscription.__pulumiType = 'huaweicloud:Smn/subscription:Subscription';
//# sourceMappingURL=subscription.js.map