UNPKG

@pulumi/azuredevops

Version:

A Pulumi package for creating and managing Azure DevOps.

118 lines 4.79 kB
"use strict"; // *** 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.BranchPolicyMergeTypes = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Branch policy for merge types allowed on a specified branch. * * ## 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 exampleBranchPolicyMergeTypes = new azuredevops.BranchPolicyMergeTypes("example", { * projectId: example.id, * enabled: true, * blocking: true, * settings: { * allowSquash: true, * allowRebaseAndFastForward: true, * allowBasicNoFastForward: true, * allowRebaseWithMerge: true, * scopes: [ * { * repositoryId: exampleGit.id, * repositoryRef: exampleGit.defaultBranch, * matchType: "Exact", * }, * { * repositoryId: null, * repositoryRef: "refs/heads/releases", * matchType: "Prefix", * }, * { * matchType: "DefaultBranch", * }, * ], * }, * }); * ``` * * ## 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/branchPolicyMergeTypes:BranchPolicyMergeTypes example 00000000-0000-0000-0000-000000000000/0 * ``` */ class BranchPolicyMergeTypes extends pulumi.CustomResource { /** * Get an existing BranchPolicyMergeTypes 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 BranchPolicyMergeTypes(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of BranchPolicyMergeTypes. 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'] === BranchPolicyMergeTypes.__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(BranchPolicyMergeTypes.__pulumiType, name, resourceInputs, opts); } } exports.BranchPolicyMergeTypes = BranchPolicyMergeTypes; /** @internal */ BranchPolicyMergeTypes.__pulumiType = 'azuredevops:index/branchPolicyMergeTypes:BranchPolicyMergeTypes'; //# sourceMappingURL=branchPolicyMergeTypes.js.map