@pulumi/github
Version:
A Pulumi package for creating and managing github cloud resources.
101 lines • 4.17 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.IssueLabel = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a GitHub issue label resource.
*
* This resource allows you to create and manage issue labels within your
* GitHub organization.
*
* Issue labels are keyed off of their "name", so pre-existing issue labels result
* in a 422 HTTP error if they exist outside of Pulumi. Normally this would not
* be an issue, except new repositories are created with a "default" set of labels,
* and those labels easily conflict with custom ones.
*
* This resource will first check if the label exists, and then issue an update,
* otherwise it will create.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as github from "@pulumi/github";
*
* // Create a new, red colored label
* const testRepo = new github.IssueLabel("test_repo", {
* repository: "test-repo",
* name: "Urgent",
* color: "FF0000",
* });
* ```
*
* ## Import
*
* GitHub Issue Labels can be imported using an ID made up of `repository:name`, e.g.
*
* ```sh
* $ pulumi import github:index/issueLabel:IssueLabel panic_label terraform:panic
* ```
*/
class IssueLabel extends pulumi.CustomResource {
/**
* Get an existing IssueLabel 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 IssueLabel(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of IssueLabel. 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'] === IssueLabel.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["color"] = state ? state.color : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["repository"] = state ? state.repository : undefined;
resourceInputs["url"] = state ? state.url : undefined;
}
else {
const args = argsOrState;
if ((!args || args.color === undefined) && !opts.urn) {
throw new Error("Missing required property 'color'");
}
if ((!args || args.repository === undefined) && !opts.urn) {
throw new Error("Missing required property 'repository'");
}
resourceInputs["color"] = args ? args.color : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["repository"] = args ? args.repository : undefined;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["url"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(IssueLabel.__pulumiType, name, resourceInputs, opts);
}
}
exports.IssueLabel = IssueLabel;
/** @internal */
IssueLabel.__pulumiType = 'github:index/issueLabel:IssueLabel';
//# sourceMappingURL=issueLabel.js.map
;