@pulumi/pulumiservice
Version:
[](https://slack.pulumi.com) [](https://www.npmjs.com/package/@pulumi/pulumiservice) [ || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Webhook = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../../utilities"));
/**
* Creates a new webhook for the specified stack. The request body must include the webhook name, payload URL, and format.
*
* The `format` field accepts: `raw` (default), `slack`, `ms_teams`, or `pulumi_deployments`.
*
* The `filters` field accepts a list of event types to subscribe to. See the [webhook event filtering documentation](https://www.pulumi.com/docs/pulumi-cloud/webhooks/#event-filtering) for available filters.
*
* The optional `secret` field sets the HMAC key for signature verification. See the [webhook headers documentation](https://www.pulumi.com/docs/pulumi-cloud/webhooks/#headers) for details.
*
* Returns 409 if a webhook with the same name already exists. Returns 400 if the organization or stack name in the request body does not match the URL path parameters.
*/
class Webhook extends pulumi.CustomResource {
/**
* Get an existing Webhook 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 opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, opts) {
return new Webhook(name, undefined, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'pulumiservice:api/stacks:Webhook';
/**
* Returns true if the given object is an instance of Webhook. 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'] === Webhook.__pulumiType;
}
/**
* Create a Webhook 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, args, opts) {
let resourceInputs = {};
opts = opts || {};
if (!opts.id) {
if (args?.active === undefined && !opts.urn) {
throw new Error("Missing required property 'active'");
}
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.name === undefined && !opts.urn) {
throw new Error("Missing required property 'name'");
}
if (args?.organizationName === undefined && !opts.urn) {
throw new Error("Missing required property 'organizationName'");
}
if (args?.payloadUrl === undefined && !opts.urn) {
throw new Error("Missing required property 'payloadUrl'");
}
if (args?.projectName === undefined && !opts.urn) {
throw new Error("Missing required property 'projectName'");
}
if (args?.stackName === undefined && !opts.urn) {
throw new Error("Missing required property 'stackName'");
}
resourceInputs["active"] = args?.active;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["envName"] = args?.envName;
resourceInputs["filters"] = args?.filters;
resourceInputs["format"] = args?.format;
resourceInputs["groups"] = args?.groups;
resourceInputs["name"] = args?.name;
resourceInputs["organizationName"] = args?.organizationName;
resourceInputs["payloadUrl"] = args?.payloadUrl;
resourceInputs["projectName"] = args?.projectName;
resourceInputs["secret"] = args?.secret ? pulumi.secret(args.secret) : undefined;
resourceInputs["stackName"] = args?.stackName;
resourceInputs["hasSecret"] = undefined /*out*/;
resourceInputs["secretCiphertext"] = undefined /*out*/;
}
else {
resourceInputs["active"] = undefined /*out*/;
resourceInputs["displayName"] = undefined /*out*/;
resourceInputs["envName"] = undefined /*out*/;
resourceInputs["filters"] = undefined /*out*/;
resourceInputs["format"] = undefined /*out*/;
resourceInputs["groups"] = undefined /*out*/;
resourceInputs["hasSecret"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["organizationName"] = undefined /*out*/;
resourceInputs["payloadUrl"] = undefined /*out*/;
resourceInputs["projectName"] = undefined /*out*/;
resourceInputs["secret"] = undefined /*out*/;
resourceInputs["secretCiphertext"] = undefined /*out*/;
resourceInputs["stackName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["hasSecret", "secret", "secretCiphertext"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Webhook.__pulumiType, name, resourceInputs, opts);
}
}
exports.Webhook = Webhook;
//# sourceMappingURL=webhook.js.map