@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
172 lines • 7.69 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (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.NotificationChannel = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(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)
*
* > **Note:** All arguments marked as write-only values will not be stored in the state: `sensitive_labels.auth_token_wo`, `sensitive_labels.password_wo`, `sensitive_labels.service_key_wo`.
* Read more about Write-only Arguments.
*
* ## 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, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:monitoring/notificationChannel:NotificationChannel';
/**
* 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["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["forceDelete"] = state?.forceDelete;
resourceInputs["labels"] = state?.labels;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["sensitiveLabels"] = state?.sensitiveLabels;
resourceInputs["type"] = state?.type;
resourceInputs["userLabels"] = state?.userLabels;
resourceInputs["verificationStatus"] = state?.verificationStatus;
}
else {
const args = argsOrState;
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["enabled"] = args?.enabled;
resourceInputs["forceDelete"] = args?.forceDelete;
resourceInputs["labels"] = args?.labels;
resourceInputs["project"] = args?.project;
resourceInputs["sensitiveLabels"] = args?.sensitiveLabels;
resourceInputs["type"] = args?.type;
resourceInputs["userLabels"] = args?.userLabels;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["verificationStatus"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NotificationChannel.__pulumiType, name, resourceInputs, opts);
}
}
exports.NotificationChannel = NotificationChannel;
//# sourceMappingURL=notificationChannel.js.map