@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
165 lines • 6.29 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.Workitem = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Work Item in Azure Devops.
*
* ## Example Usage
*
* ### Basic usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* workItemTemplate: "Agile",
* versionControl: "Git",
* visibility: "private",
* description: "Managed by Pulumi",
* });
* const exampleWorkitem = new azuredevops.Workitem("example", {
* projectId: exampleAzuredevopsProject.id,
* title: "Example Work Item",
* type: "Issue",
* state: "Active",
* tags: ["Tag"],
* });
* ```
*
* ### With custom fields
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* workItemTemplate: "Agile",
* versionControl: "Git",
* visibility: "private",
* description: "Managed by Pulumi",
* });
* const exampleWorkitem = new azuredevops.Workitem("example", {
* projectId: exampleAzuredevopsProject.id,
* title: "Example Work Item",
* type: "Issue",
* state: "Active",
* tags: ["Tag"],
* customFields: {
* example: "example",
* },
* });
* ```
* ### With Parent Work Item
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* workItemTemplate: "Agile",
* versionControl: "Git",
* visibility: "private",
* });
* const epic = new azuredevops.Workitem("epic", {
* projectId: example.id,
* title: "Example EPIC Title",
* type: "Epic",
* state: "New",
* });
* const exampleWorkitem = new azuredevops.Workitem("example", {
* projectId: example.id,
* title: "Example Work Item",
* type: "Issue",
* state: "Active",
* tags: ["Tag"],
* parentId: epic.id,
* });
* ```
*
* ## Import
*
* Azure DevOps Work Item can be imported using the Project ID and Work Item ID, e.g.
*
* ```sh
* $ pulumi import azuredevops:index/workitem:Workitem example 00000000-0000-0000-0000-000000000000/0
* ```
*/
class Workitem extends pulumi.CustomResource {
/**
* Get an existing Workitem 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 Workitem(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Workitem. 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'] === Workitem.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["areaPath"] = state ? state.areaPath : undefined;
resourceInputs["customFields"] = state ? state.customFields : undefined;
resourceInputs["iterationPath"] = state ? state.iterationPath : undefined;
resourceInputs["parentId"] = state ? state.parentId : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["relations"] = state ? state.relations : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["title"] = state ? state.title : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["url"] = state ? state.url : undefined;
}
else {
const args = argsOrState;
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if ((!args || args.title === undefined) && !opts.urn) {
throw new Error("Missing required property 'title'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["areaPath"] = args ? args.areaPath : undefined;
resourceInputs["customFields"] = args ? args.customFields : undefined;
resourceInputs["iterationPath"] = args ? args.iterationPath : undefined;
resourceInputs["parentId"] = args ? args.parentId : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["state"] = args ? args.state : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["title"] = args ? args.title : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["relations"] = undefined /*out*/;
resourceInputs["url"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Workitem.__pulumiType, name, resourceInputs, opts);
}
}
exports.Workitem = Workitem;
/** @internal */
Workitem.__pulumiType = 'azuredevops:index/workitem:Workitem';
//# sourceMappingURL=workitem.js.map