@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
113 lines • 4.93 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.Contact = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A contact that will receive notifications from Google Cloud.
*
* To get more information about Contact, see:
*
* * [API documentation](https://cloud.google.com/resource-manager/docs/reference/essentialcontacts/rest/v1/projects.contacts)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/resource-manager/docs/managing-notification-contacts)
*
* > **Warning:** If you are using User ADCs (Application Default Credentials) with this resource,
* you must specify a `billingProject` and set `userProjectOverride` to true
* in the provider configuration. Otherwise the Essential Contacts API will return a 403 error.
* Your account must have the `serviceusage.services.use` permission on the
* `billingProject` you defined.
*
* ## Example Usage
*
* ### Essential Contact
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const contact = new gcp.essentialcontacts.Contact("contact", {
* parent: project.then(project => project.id),
* email: "foo@bar.com",
* languageTag: "en-GB",
* notificationCategorySubscriptions: ["ALL"],
* });
* ```
*
* ## Import
*
* Contact can be imported using any of these accepted formats:
*
* * `{{name}}`
*
* When using the `pulumi import` command, Contact can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:essentialcontacts/contact:Contact default {{name}}
* ```
*/
class Contact extends pulumi.CustomResource {
/**
* Get an existing Contact 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 Contact(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Contact. 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'] === Contact.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["email"] = state ? state.email : undefined;
resourceInputs["languageTag"] = state ? state.languageTag : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["notificationCategorySubscriptions"] = state ? state.notificationCategorySubscriptions : undefined;
resourceInputs["parent"] = state ? state.parent : undefined;
}
else {
const args = argsOrState;
if ((!args || args.email === undefined) && !opts.urn) {
throw new Error("Missing required property 'email'");
}
if ((!args || args.languageTag === undefined) && !opts.urn) {
throw new Error("Missing required property 'languageTag'");
}
if ((!args || args.notificationCategorySubscriptions === undefined) && !opts.urn) {
throw new Error("Missing required property 'notificationCategorySubscriptions'");
}
if ((!args || args.parent === undefined) && !opts.urn) {
throw new Error("Missing required property 'parent'");
}
resourceInputs["email"] = args ? args.email : undefined;
resourceInputs["languageTag"] = args ? args.languageTag : undefined;
resourceInputs["notificationCategorySubscriptions"] = args ? args.notificationCategorySubscriptions : undefined;
resourceInputs["parent"] = args ? args.parent : undefined;
resourceInputs["name"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Contact.__pulumiType, name, resourceInputs, opts);
}
}
exports.Contact = Contact;
/** @internal */
Contact.__pulumiType = 'gcp:essentialcontacts/contact:Contact';
//# sourceMappingURL=contact.js.map