@pulumi/github
Version:
A Pulumi package for creating and managing github cloud resources.
141 lines • 5.32 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.Issue = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a GitHub issue resource.
*
* This resource allows you to create and manage issue within your
* GitHub repository.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as github from "@pulumi/github";
*
* // Create a simple issue
* const test = new github.Repository("test", {
* name: "tf-acc-test-%s",
* autoInit: true,
* hasIssues: true,
* });
* const testIssue = new github.Issue("test", {
* repository: test.name,
* title: "My issue title",
* body: "The body of my issue",
* });
* ```
*
* ### With Milestone And Project Assignment
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as github from "@pulumi/github";
* import * as std from "@pulumi/std";
*
* // Create an issue with milestone and project assignment
* const test = new github.Repository("test", {
* name: "tf-acc-test-%s",
* autoInit: true,
* hasIssues: true,
* });
* const testRepositoryMilestone = new github.RepositoryMilestone("test", {
* owner: std.splitOutput({
* separator: "/",
* text: test.fullName,
* }).apply(invoke => invoke.result?.[0]),
* repository: test.name,
* title: "v1.0.0",
* description: "General Availability",
* dueDate: "2022-11-22",
* state: "open",
* });
* const testIssue = new github.Issue("test", {
* repository: test.name,
* title: "My issue",
* body: "My issue body",
* labels: [
* "bug",
* "documentation",
* ],
* assignees: ["bob-github"],
* milestoneNumber: testRepositoryMilestone.number,
* });
* ```
*
* ## Import
*
* GitHub Issues can be imported using an ID made up of `repository:number`, e.g.
*
* ```sh
* $ pulumi import github:index/issue:Issue issue_15 myrepo:15
* ```
*/
class Issue extends pulumi.CustomResource {
/**
* Get an existing Issue 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 Issue(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Issue. 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'] === Issue.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["assignees"] = state ? state.assignees : undefined;
resourceInputs["body"] = state ? state.body : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["issueId"] = state ? state.issueId : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["milestoneNumber"] = state ? state.milestoneNumber : undefined;
resourceInputs["number"] = state ? state.number : undefined;
resourceInputs["repository"] = state ? state.repository : undefined;
resourceInputs["title"] = state ? state.title : undefined;
}
else {
const args = argsOrState;
if ((!args || args.repository === undefined) && !opts.urn) {
throw new Error("Missing required property 'repository'");
}
if ((!args || args.title === undefined) && !opts.urn) {
throw new Error("Missing required property 'title'");
}
resourceInputs["assignees"] = args ? args.assignees : undefined;
resourceInputs["body"] = args ? args.body : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["milestoneNumber"] = args ? args.milestoneNumber : undefined;
resourceInputs["repository"] = args ? args.repository : undefined;
resourceInputs["title"] = args ? args.title : undefined;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["issueId"] = undefined /*out*/;
resourceInputs["number"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Issue.__pulumiType, name, resourceInputs, opts);
}
}
exports.Issue = Issue;
/** @internal */
Issue.__pulumiType = 'github:index/issue:Issue';
//# sourceMappingURL=issue.js.map
;