@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
104 lines • 4.77 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.ResourceAuthorization = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages authorization of resources, e.g. for access in build pipelines.
*
* Currently supported resources: service endpoint (aka service connection, endpoint).
*
* ## Example Usage
*
* ```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 exampleServiceEndpointBitBucket = new azuredevops.ServiceEndpointBitBucket("example", {
* projectId: example.id,
* username: "username",
* password: "password",
* serviceEndpointName: "example-bitbucket",
* description: "Managed by Pulumi",
* });
* const exampleResourceAuthorization = new azuredevops.ResourceAuthorization("example", {
* projectId: example.id,
* resourceId: exampleServiceEndpointBitBucket.id,
* authorized: true,
* });
* ```
*
* ## Relevant Links
*
* - [Azure DevOps Service REST API 7.0 - Authorize Definition Resource](https://docs.microsoft.com/en-us/rest/api/azure/devops/build/resources/authorize%20definition%20resources?view=azure-devops-rest-7.0)
*/
class ResourceAuthorization extends pulumi.CustomResource {
/**
* Get an existing ResourceAuthorization 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 ResourceAuthorization(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ResourceAuthorization. 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'] === ResourceAuthorization.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["authorized"] = state ? state.authorized : undefined;
resourceInputs["definitionId"] = state ? state.definitionId : 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.authorized === undefined) && !opts.urn) {
throw new Error("Missing required property 'authorized'");
}
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'");
}
resourceInputs["authorized"] = args ? args.authorized : undefined;
resourceInputs["definitionId"] = args ? args.definitionId : 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);
const aliasOpts = { aliases: [{ type: "azuredevops:Security/resourceAuthorization:ResourceAuthorization" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(ResourceAuthorization.__pulumiType, name, resourceInputs, opts);
}
}
exports.ResourceAuthorization = ResourceAuthorization;
/** @internal */
ResourceAuthorization.__pulumiType = 'azuredevops:index/resourceAuthorization:ResourceAuthorization';
//# sourceMappingURL=resourceAuthorization.js.map