@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
88 lines • 3.8 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.TagAssignment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* A [tag](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODEwMA-assign-tags) is applied to Escalation Policies, Teams or Users and can be used to filter them.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const example = new pagerduty.Tag("example", {label: "API"});
* const engteam = new pagerduty.Team("engteam", {name: "Engineering"});
* const exampleTagAssignment = new pagerduty.TagAssignment("example", {
* tagId: example.id,
* entityType: "teams",
* entityId: engteam.id,
* });
* ```
*
* ## Import
*
* Tag assignments can be imported using the `id` which is constructed by taking the `entity` Type, `entity` ID and the `tag` ID separated by a dot, e.g.
*
* ```sh
* $ pulumi import pagerduty:index/tagAssignment:TagAssignment main users.P7HHMVK.PYC7IQQ
* ```
*/
class TagAssignment extends pulumi.CustomResource {
/**
* Get an existing TagAssignment 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 TagAssignment(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of TagAssignment. 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'] === TagAssignment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["entityId"] = state ? state.entityId : undefined;
resourceInputs["entityType"] = state ? state.entityType : undefined;
resourceInputs["tagId"] = state ? state.tagId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.entityId === undefined) && !opts.urn) {
throw new Error("Missing required property 'entityId'");
}
if ((!args || args.entityType === undefined) && !opts.urn) {
throw new Error("Missing required property 'entityType'");
}
if ((!args || args.tagId === undefined) && !opts.urn) {
throw new Error("Missing required property 'tagId'");
}
resourceInputs["entityId"] = args ? args.entityId : undefined;
resourceInputs["entityType"] = args ? args.entityType : undefined;
resourceInputs["tagId"] = args ? args.tagId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TagAssignment.__pulumiType, name, resourceInputs, opts);
}
}
exports.TagAssignment = TagAssignment;
/** @internal */
TagAssignment.__pulumiType = 'pagerduty:index/tagAssignment:TagAssignment';
//# sourceMappingURL=tagAssignment.js.map