UNPKG

@pulumi/azuredevops

Version:

A Pulumi package for creating and managing Azure DevOps.

209 lines 8.72 kB
"use strict"; // *** 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.CheckBranchControl = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages a branch control check on a resource within Azure DevOps. * * ## Example Usage * * ### Protect a service connection * * ```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 exampleCheckBranchControl = new azuredevops.CheckBranchControl("example", { * projectId: example.id, * displayName: "Managed by Pulumi", * targetResourceId: exampleServiceEndpointGeneric.id, * targetResourceType: "endpoint", * allowedBranches: "refs/heads/main, refs/heads/features/*", * timeout: 1440, * }); * ``` * * ### 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 exampleCheckBranchControl = new azuredevops.CheckBranchControl("example", { * projectId: example.id, * displayName: "Managed by Pulumi", * targetResourceId: exampleEnvironment.id, * targetResourceType: "environment", * allowedBranches: "refs/heads/main, refs/heads/features/*", * }); * ``` * * ### Protect an agent queue * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.Project("example", {name: "Example Project"}); * const examplePool = new azuredevops.Pool("example", {name: "example-pool"}); * const exampleQueue = new azuredevops.Queue("example", { * projectId: example.id, * agentPoolId: examplePool.id, * }); * const exampleCheckBranchControl = new azuredevops.CheckBranchControl("example", { * projectId: example.id, * displayName: "Managed by Pulumi", * targetResourceId: exampleQueue.id, * targetResourceType: "queue", * allowedBranches: "refs/heads/main, refs/heads/features/*", * }); * ``` * * ### 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 Empty Git Repository", * initialization: { * initType: "Clean", * }, * }); * const exampleCheckBranchControl = new azuredevops.CheckBranchControl("example", { * projectId: example.id, * displayName: "Managed by Pulumi", * targetResourceId: pulumi.interpolate`${example.id}.${exampleGit.id}`, * targetResourceType: "repository", * allowedBranches: "refs/heads/main, refs/heads/features/*", * }); * ``` * * ### Protect a variable group * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azuredevops from "@pulumi/azuredevops"; * * const example = new azuredevops.Project("example", {name: "Example Project"}); * const exampleVariableGroup = new azuredevops.VariableGroup("example", { * projectId: example.id, * name: "Example Variable Group", * description: "Example Variable Group Description", * allowAccess: true, * variables: [ * { * name: "key1", * value: "val1", * }, * { * name: "key2", * secretValue: "val2", * isSecret: true, * }, * ], * }); * const exampleCheckBranchControl = new azuredevops.CheckBranchControl("example", { * projectId: example.id, * displayName: "Managed by Pulumi", * targetResourceId: exampleVariableGroup.id, * targetResourceType: "variablegroup", * allowedBranches: "refs/heads/main, refs/heads/features/*", * }); * ``` * * ## Relevant Links * * - [Define approvals and checks](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass) * * ## Import * * Importing this resource is not supported. */ class CheckBranchControl extends pulumi.CustomResource { /** * Get an existing CheckBranchControl 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 CheckBranchControl(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of CheckBranchControl. 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'] === CheckBranchControl.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["allowedBranches"] = state ? state.allowedBranches : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["ignoreUnknownProtectionStatus"] = state ? state.ignoreUnknownProtectionStatus : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["targetResourceId"] = state ? state.targetResourceId : undefined; resourceInputs["targetResourceType"] = state ? state.targetResourceType : undefined; resourceInputs["timeout"] = state ? state.timeout : undefined; resourceInputs["verifyBranchProtection"] = state ? state.verifyBranchProtection : undefined; resourceInputs["version"] = state ? state.version : undefined; } else { const args = argsOrState; if ((!args || args.projectId === undefined) && !opts.urn) { throw new Error("Missing required property 'projectId'"); } if ((!args || args.targetResourceId === undefined) && !opts.urn) { throw new Error("Missing required property 'targetResourceId'"); } if ((!args || args.targetResourceType === undefined) && !opts.urn) { throw new Error("Missing required property 'targetResourceType'"); } resourceInputs["allowedBranches"] = args ? args.allowedBranches : undefined; resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["ignoreUnknownProtectionStatus"] = args ? args.ignoreUnknownProtectionStatus : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["targetResourceId"] = args ? args.targetResourceId : undefined; resourceInputs["targetResourceType"] = args ? args.targetResourceType : undefined; resourceInputs["timeout"] = args ? args.timeout : undefined; resourceInputs["verifyBranchProtection"] = args ? args.verifyBranchProtection : undefined; resourceInputs["version"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(CheckBranchControl.__pulumiType, name, resourceInputs, opts); } } exports.CheckBranchControl = CheckBranchControl; /** @internal */ CheckBranchControl.__pulumiType = 'azuredevops:index/checkBranchControl:CheckBranchControl'; //# sourceMappingURL=checkBranchControl.js.map