@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
151 lines • 6.26 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.PipelineAuthorization = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manage pipeline access permissions to resources.
*
* > **Note** This resource is a replacement for `azuredevops.ResourceAuthorization`. Pipeline authorizations managed by `azuredevops.ResourceAuthorization` can also be managed by this resource.
*
* > **Note** If both "All Pipeline Authorization" and "Custom Pipeline Authorization" are configured, "All Pipeline Authorization" has higher priority.
*
* ## Example Usage
*
* ### Authorization for all pipelines
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* visibility: "private",
* versionControl: "Git",
* workItemTemplate: "Agile",
* description: "Managed by Pulumi",
* });
* const examplePool = new azuredevops.Pool("example", {
* name: "Example Pool",
* autoProvision: false,
* autoUpdate: false,
* });
* const exampleQueue = new azuredevops.Queue("example", {
* projectId: example.id,
* agentPoolId: examplePool.id,
* });
* const examplePipelineAuthorization = new azuredevops.PipelineAuthorization("example", {
* projectId: example.id,
* resourceId: exampleQueue.id,
* type: "queue",
* });
* ```
*
* ### Authorization for specific pipeline
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const exampleProject = new azuredevops.Project("example", {
* name: "Example Project",
* visibility: "private",
* versionControl: "Git",
* workItemTemplate: "Agile",
* description: "Managed by Pulumi",
* });
* const examplePool = new azuredevops.Pool("example", {
* name: "Example Pool",
* autoProvision: false,
* autoUpdate: false,
* });
* const exampleQueue = new azuredevops.Queue("example", {
* projectId: exampleProject.id,
* agentPoolId: examplePool.id,
* });
* const example = azuredevops.getGitRepositoryOutput({
* projectId: exampleProject.id,
* name: "Example Project",
* });
* const exampleBuildDefinition = new azuredevops.BuildDefinition("example", {
* projectId: exampleProject.id,
* name: "Example Pipeline",
* repository: {
* repoType: "TfsGit",
* repoId: example.apply(example => example.id),
* ymlPath: "azure-pipelines.yml",
* },
* });
* const examplePipelineAuthorization = new azuredevops.PipelineAuthorization("example", {
* projectId: exampleProject.id,
* resourceId: exampleQueue.id,
* type: "queue",
* pipelineId: exampleBuildDefinition.id,
* });
* ```
*
* ## Relevant Links
*
* - [Azure DevOps Service REST API 7.1 - Pipeline Permissions](https://learn.microsoft.com/en-us/rest/api/azure/devops/approvalsandchecks/pipeline-permissions?view=azure-devops-rest-7.1)
*/
class PipelineAuthorization extends pulumi.CustomResource {
/**
* Get an existing PipelineAuthorization 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 PipelineAuthorization(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of PipelineAuthorization. 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'] === PipelineAuthorization.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["pipelineId"] = state ? state.pipelineId : undefined;
resourceInputs["pipelineProjectId"] = state ? state.pipelineProjectId : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["resourceId"] = state ? state.resourceId : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if ((!args || args.resourceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'resourceId'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["pipelineId"] = args ? args.pipelineId : undefined;
resourceInputs["pipelineProjectId"] = args ? args.pipelineProjectId : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["resourceId"] = args ? args.resourceId : undefined;
resourceInputs["type"] = args ? args.type : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PipelineAuthorization.__pulumiType, name, resourceInputs, opts);
}
}
exports.PipelineAuthorization = PipelineAuthorization;
/** @internal */
PipelineAuthorization.__pulumiType = 'azuredevops:index/pipelineAuthorization:PipelineAuthorization';
//# sourceMappingURL=pipelineAuthorization.js.map