@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
144 lines • 6.69 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.NotificationChannel = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A NotificationChannel is a medium through which an alert is delivered
* when a policy violation is detected. Examples of channels include email, SMS,
* and third-party messaging applications. Fields containing sensitive information
* like authentication tokens or contact info are only partially populated on retrieval.
*
* Notification Channels are designed to be flexible and are made up of a supported `type`
* and labels to configure that channel. Each `type` has specific labels that need to be
* present for that channel to be correctly configured. The labels that are required to be
* present for one channel `type` are often different than those required for another.
* Due to these loose constraints it's often best to set up a channel through the UI
* and import it to the provider when setting up a brand new channel type to determine which
* labels are required.
*
* A list of supported channels per project the `list` endpoint can be
* accessed programmatically or through the api explorer at https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.notificationChannelDescriptors/list .
* This provides the channel type and all of the required labels that must be passed.
*
* To get more information about NotificationChannel, see:
*
* * [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.notificationChannels)
* * How-to Guides
* * [Monitoring API Documentation](https://cloud.google.com/monitoring/api/v3/)
* * [Notification Options](https://cloud.google.com/monitoring/support/notification-options)
*
* ## Example Usage
*
* ### Notification Channel Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basic = new gcp.monitoring.NotificationChannel("basic", {
* displayName: "Test Notification Channel",
* type: "email",
* labels: {
* email_address: "fake_email@blahblah.com",
* },
* forceDelete: false,
* });
* ```
* ### Notification Channel Sensitive
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.monitoring.NotificationChannel("default", {
* displayName: "Test Slack Channel",
* type: "slack",
* labels: {
* channel_name: "#foobar",
* },
* sensitiveLabels: {
* authToken: "one",
* },
* });
* ```
*
* ## Import
*
* NotificationChannel can be imported using any of these accepted formats:
*
* * `{{name}}`
*
* When using the `pulumi import` command, NotificationChannel can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:monitoring/notificationChannel:NotificationChannel default {{name}}
* ```
*/
class NotificationChannel extends pulumi.CustomResource {
/**
* Get an existing NotificationChannel 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 NotificationChannel(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NotificationChannel. 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'] === NotificationChannel.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["enabled"] = state ? state.enabled : undefined;
resourceInputs["forceDelete"] = state ? state.forceDelete : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["sensitiveLabels"] = state ? state.sensitiveLabels : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["userLabels"] = state ? state.userLabels : undefined;
resourceInputs["verificationStatus"] = state ? state.verificationStatus : undefined;
}
else {
const args = argsOrState;
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["forceDelete"] = args ? args.forceDelete : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["sensitiveLabels"] = args ? args.sensitiveLabels : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["userLabels"] = args ? args.userLabels : undefined;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["verificationStatus"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NotificationChannel.__pulumiType, name, resourceInputs, opts);
}
}
exports.NotificationChannel = NotificationChannel;
/** @internal */
NotificationChannel.__pulumiType = 'gcp:monitoring/notificationChannel:NotificationChannel';
//# sourceMappingURL=notificationChannel.js.map