UNPKG

@pulumi/azuredevops

Version:

A Pulumi package for creating and managing Azure DevOps.

115 lines 4.32 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.Queue = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages an agent queue within Azure DevOps. In the UI, this is equivalent to adding an * Organization defined pool to a project. * * The created queue is not authorized for use by all pipelines in the project. However, * the `azuredevops.ResourceAuthorization` resource can be used to grant authorization. * * ## Example Usage * * ### Creating a Queue from an organization-level pool * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const exampleProject = new azuredevops.Project("example", {name: "Example Project"}); * const example = azuredevops.getPool({ * name: "example-pool", * }); * const exampleQueue = new azuredevops.Queue("example", { * projectId: exampleProject.id, * agentPoolId: example.then(example => example.id), * }); * // Grant access to queue to all pipelines in the project * const exampleResourceAuthorization = new azuredevops.ResourceAuthorization("example", { * projectId: exampleProject.id, * resourceId: exampleQueue.id, * type: "queue", * authorized: true, * }); * ``` * * ### Creating a Queue at the project level (Organization-level permissions not required) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = azuredevops.getProject({ * name: "Example Project", * }); * const exampleQueue = new azuredevops.Queue("example", { * name: "example-queue", * projectId: example.then(example => example.id), * }); * ``` * * ## Relevant Links * * - [Azure DevOps Service REST API 7.0 - Agent Queues](https://docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/queues?view=azure-devops-rest-7.0) * * ## Import * * Azure DevOps Agent Pools can be imported using the project ID and agent queue ID, e.g. * * ```sh * $ pulumi import azuredevops:index/queue:Queue example 00000000-0000-0000-0000-000000000000/0 * ``` */ class Queue extends pulumi.CustomResource { /** * Get an existing Queue 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 Queue(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Queue. 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'] === Queue.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["agentPoolId"] = state?.agentPoolId; resourceInputs["name"] = state?.name; resourceInputs["projectId"] = state?.projectId; } else { const args = argsOrState; if (args?.projectId === undefined && !opts.urn) { throw new Error("Missing required property 'projectId'"); } resourceInputs["agentPoolId"] = args?.agentPoolId; resourceInputs["name"] = args?.name; resourceInputs["projectId"] = args?.projectId; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Queue.__pulumiType, name, resourceInputs, opts); } } exports.Queue = Queue; /** @internal */ Queue.__pulumiType = 'azuredevops:index/queue:Queue'; //# sourceMappingURL=queue.js.map