@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
122 lines • 5.13 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.RepositoryPolicyReservedNames = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manage a reserved names repository policy within Azure DevOps project. Block pushes that introduce files, folders, or branch names that include platform reserved names or incompatible characters.
*
* > If both project and project policy are enabled, the project policy has high priority.
*
* ## 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 exampleGit = new azuredevops.Git("example", {
* projectId: example.id,
* name: "Example Repository",
* initialization: {
* initType: "Clean",
* },
* });
* const exampleRepositoryPolicyReservedNames = new azuredevops.RepositoryPolicyReservedNames("example", {
* projectId: example.id,
* enabled: true,
* blocking: true,
* repositoryIds: [exampleGit.id],
* });
* ```
*
* # Set project level repository policy
* ```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 exampleRepositoryPolicyReservedNames = new azuredevops.RepositoryPolicyReservedNames("example", {
* projectId: example.id,
* enabled: true,
* blocking: true,
* });
* ```
*
* ## Relevant Links
*
* - [Azure DevOps Service REST API 7.0 - Policy Configurations](https://docs.microsoft.com/en-us/rest/api/azure/devops/policy/configurations?view=azure-devops-rest-7.0)
*
* ## Import
*
* Azure DevOps repository policies can be imported using the projectID/policyID or projectName/policyID:
*
* ```sh
* $ pulumi import azuredevops:index/repositoryPolicyReservedNames:RepositoryPolicyReservedNames example 00000000-0000-0000-0000-000000000000/0
* ```
*/
class RepositoryPolicyReservedNames extends pulumi.CustomResource {
/**
* Get an existing RepositoryPolicyReservedNames 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 RepositoryPolicyReservedNames(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RepositoryPolicyReservedNames. 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'] === RepositoryPolicyReservedNames.__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["repositoryIds"] = state ? state.repositoryIds : undefined;
}
else {
const args = argsOrState;
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
resourceInputs["blocking"] = args ? args.blocking : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["repositoryIds"] = args ? args.repositoryIds : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RepositoryPolicyReservedNames.__pulumiType, name, resourceInputs, opts);
}
}
exports.RepositoryPolicyReservedNames = RepositoryPolicyReservedNames;
/** @internal */
RepositoryPolicyReservedNames.__pulumiType = 'azuredevops:index/repositoryPolicyReservedNames:RepositoryPolicyReservedNames';
//# sourceMappingURL=repositoryPolicyReservedNames.js.map