@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
141 lines • 5.59 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.CheckExclusiveLock = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Exclusive Lock Check.
*
* Adding an exclusive lock will only allow a single stage to utilize this resource at a time. If multiple stages are waiting on the lock, only the latest will run. All others will be canceled.
*
* ## Example Usage
*
* ### Add Exclusive Lock to an environment
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {name: "Example Project"});
* const exampleServiceEndpointGeneric = new azuredevops.ServiceEndpointGeneric("example", {
* projectId: example.id,
* serverUrl: "https://some-server.example.com",
* username: "username",
* password: "password",
* serviceEndpointName: "Example Generic",
* description: "Managed by Pulumi",
* });
* const exampleCheckExclusiveLock = new azuredevops.CheckExclusiveLock("example", {
* projectId: example.id,
* targetResourceId: exampleServiceEndpointGeneric.id,
* targetResourceType: "endpoint",
* timeout: 43200,
* });
* ```
*
* ### Protect an environment
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {name: "Example Project"});
* const exampleEnvironment = new azuredevops.Environment("example", {
* projectId: example.id,
* name: "Example Environment",
* });
* const exampleCheckExclusiveLock = new azuredevops.CheckExclusiveLock("example", {
* projectId: example.id,
* targetResourceId: exampleEnvironment.id,
* targetResourceType: "environment",
* timeout: 43200,
* });
* ```
*
* ### Protect a repository
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {name: "Example Project"});
* const exampleGit = new azuredevops.Git("example", {
* projectId: example.id,
* name: "Example Repository",
* initialization: {
* initType: "Clean",
* },
* });
* const exampleCheckExclusiveLock = new azuredevops.CheckExclusiveLock("example", {
* projectId: example.id,
* targetResourceId: pulumi.interpolate`${example.id}.${exampleGit.id}`,
* targetResourceType: "repository",
* timeout: 43200,
* });
* ```
*
* ## Import
*
* Importing this resource is not supported.
*/
class CheckExclusiveLock extends pulumi.CustomResource {
/**
* Get an existing CheckExclusiveLock 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 CheckExclusiveLock(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CheckExclusiveLock. 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'] === CheckExclusiveLock.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["targetResourceId"] = state?.targetResourceId;
resourceInputs["targetResourceType"] = state?.targetResourceType;
resourceInputs["timeout"] = state?.timeout;
resourceInputs["version"] = state?.version;
}
else {
const args = argsOrState;
if (args?.projectId === undefined && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if (args?.targetResourceId === undefined && !opts.urn) {
throw new Error("Missing required property 'targetResourceId'");
}
if (args?.targetResourceType === undefined && !opts.urn) {
throw new Error("Missing required property 'targetResourceType'");
}
resourceInputs["projectId"] = args?.projectId;
resourceInputs["targetResourceId"] = args?.targetResourceId;
resourceInputs["targetResourceType"] = args?.targetResourceType;
resourceInputs["timeout"] = args?.timeout;
resourceInputs["version"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CheckExclusiveLock.__pulumiType, name, resourceInputs, opts);
}
}
exports.CheckExclusiveLock = CheckExclusiveLock;
/** @internal */
CheckExclusiveLock.__pulumiType = 'azuredevops:index/checkExclusiveLock:CheckExclusiveLock';
//# sourceMappingURL=checkExclusiveLock.js.map