UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

145 lines 5.25 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ServiceCustomFieldValue = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pagerduty from "@pulumi/pagerduty"; * * // First, create service custom fields * const environment = new pagerduty.ServiceCustomField("environment", { * name: "environment", * displayName: "Environment", * dataType: "string", * fieldType: "single_value", * description: "The environment this service runs in", * }); * const region = new pagerduty.ServiceCustomField("region", { * name: "region", * displayName: "Region", * dataType: "string", * fieldType: "single_value", * description: "The region this service is deployed in", * }); * const isCritical = new pagerduty.ServiceCustomField("is_critical", { * name: "is_critical", * displayName: "Is Critical", * dataType: "boolean", * fieldType: "single_value", * description: "Whether this service is critical", * }); * const regions = new pagerduty.ServiceCustomField("regions", { * name: "regions", * displayName: "AWS Regions", * dataType: "string", * fieldType: "multi_value_fixed", * description: "AWS regions where this service is deployed", * fieldOptions: [ * { * value: "us-east-1", * dataType: "string", * }, * { * value: "us-west-1", * dataType: "string", * }, * ], * }); * // Create a service * const example = new pagerduty.Service("example", { * name: "Example Service", * autoResolveTimeout: "14400", * acknowledgementTimeout: "600", * escalationPolicy: examplePagerdutyEscalationPolicy.id, * }); * // Set custom field values on the service * const exampleServiceCustomFieldValue = new pagerduty.ServiceCustomFieldValue("example", { * serviceId: example.id, * customFields: [ * { * name: environment.name, * value: JSON.stringify("production"), * }, * { * name: region.name, * value: JSON.stringify("us-east-1"), * }, * { * name: isCritical.name, * value: JSON.stringify(true), * }, * { * name: regions.name, * value: JSON.stringify([ * "us-east-1", * "us-west-1", * ]), * }, * ], * }); * ``` * * ## Import * * Service custom field values can be imported using the service ID, e.g. * * ```sh * $ pulumi import pagerduty:index/serviceCustomFieldValue:ServiceCustomFieldValue example PXYZ123 * ``` */ class ServiceCustomFieldValue extends pulumi.CustomResource { /** * Get an existing ServiceCustomFieldValue 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 ServiceCustomFieldValue(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ServiceCustomFieldValue. 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'] === ServiceCustomFieldValue.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["customFields"] = state?.customFields; resourceInputs["serviceId"] = state?.serviceId; } else { const args = argsOrState; if (args?.customFields === undefined && !opts.urn) { throw new Error("Missing required property 'customFields'"); } if (args?.serviceId === undefined && !opts.urn) { throw new Error("Missing required property 'serviceId'"); } resourceInputs["customFields"] = args?.customFields; resourceInputs["serviceId"] = args?.serviceId; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ServiceCustomFieldValue.__pulumiType, name, resourceInputs, opts); } } exports.ServiceCustomFieldValue = ServiceCustomFieldValue; /** @internal */ ServiceCustomFieldValue.__pulumiType = 'pagerduty:index/serviceCustomFieldValue:ServiceCustomFieldValue'; //# sourceMappingURL=serviceCustomFieldValue.js.map