@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
112 lines • 4.72 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.BranchPolicyAutoReviewers = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages required reviewer policy branch policy within Azure DevOps.
*
* ## Example Usage
*
* ```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 exampleUser = new azuredevops.User("example", {
* principalName: "mail@email.com",
* accountLicenseType: "basic",
* });
* const exampleBranchPolicyAutoReviewers = new azuredevops.BranchPolicyAutoReviewers("example", {
* projectId: example.id,
* enabled: true,
* blocking: true,
* settings: {
* autoReviewerIds: [exampleUser.id],
* submitterCanVote: false,
* message: "Auto reviewer",
* pathFilters: ["*/src/*.ts"],
* scopes: [{
* repositoryId: exampleGit.id,
* repositoryRef: exampleGit.defaultBranch,
* matchType: "Exact",
* }],
* },
* });
* ```
*
* ## Relevant Links
*
* - [Azure DevOps Service REST API 7.0 - Policy Configurations](https://docs.microsoft.com/en-us/rest/api/azure/devops/policy/configurations/create?view=azure-devops-rest-7.0)
*
* ## Import
*
* Azure DevOps Branch Policies can be imported using the project ID and policy configuration ID:
*
* ```sh
* $ pulumi import azuredevops:index/branchPolicyAutoReviewers:BranchPolicyAutoReviewers example 00000000-0000-0000-0000-000000000000/0
* ```
*/
class BranchPolicyAutoReviewers extends pulumi.CustomResource {
/**
* Get an existing BranchPolicyAutoReviewers 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 BranchPolicyAutoReviewers(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of BranchPolicyAutoReviewers. 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'] === BranchPolicyAutoReviewers.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["blocking"] = state ? state.blocking : undefined;
resourceInputs["enabled"] = state ? state.enabled : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["settings"] = state ? state.settings : undefined;
}
else {
const args = argsOrState;
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if ((!args || args.settings === undefined) && !opts.urn) {
throw new Error("Missing required property 'settings'");
}
resourceInputs["blocking"] = args ? args.blocking : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["settings"] = args ? args.settings : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(BranchPolicyAutoReviewers.__pulumiType, name, resourceInputs, opts);
}
}
exports.BranchPolicyAutoReviewers = BranchPolicyAutoReviewers;
/** @internal */
BranchPolicyAutoReviewers.__pulumiType = 'azuredevops:index/branchPolicyAutoReviewers:BranchPolicyAutoReviewers';
//# sourceMappingURL=branchPolicyAutoReviewers.js.map