@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
133 lines • 5.21 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.RepositoryPolicyFilePathPattern = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manage a file path pattern repository policy within Azure DevOps project.
*
* ## 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 exampleRepositoryPolicyFilePathPattern = new azuredevops.RepositoryPolicyFilePathPattern("example", {
* projectId: example.id,
* enabled: true,
* blocking: true,
* filepathPatterns: [
* "*.go",
* "/home/test/*.ts",
* ],
* 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 examplep = new azuredevops.RepositoryPolicyFilePathPattern("examplep", {
* projectId: example.id,
* enabled: true,
* blocking: true,
* filepathPatterns: [
* "*.go",
* "/home/test/*.ts",
* ],
* });
* ```
*
* ## 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/repositoryPolicyFilePathPattern:RepositoryPolicyFilePathPattern example 00000000-0000-0000-0000-000000000000/0
* ```
*/
class RepositoryPolicyFilePathPattern extends pulumi.CustomResource {
/**
* Get an existing RepositoryPolicyFilePathPattern 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 RepositoryPolicyFilePathPattern(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of RepositoryPolicyFilePathPattern. 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'] === RepositoryPolicyFilePathPattern.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["blocking"] = state?.blocking;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["filepathPatterns"] = state?.filepathPatterns;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["repositoryIds"] = state?.repositoryIds;
}
else {
const args = argsOrState;
if (args?.filepathPatterns === undefined && !opts.urn) {
throw new Error("Missing required property 'filepathPatterns'");
}
if (args?.projectId === undefined && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
resourceInputs["blocking"] = args?.blocking;
resourceInputs["enabled"] = args?.enabled;
resourceInputs["filepathPatterns"] = args?.filepathPatterns;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["repositoryIds"] = args?.repositoryIds;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RepositoryPolicyFilePathPattern.__pulumiType, name, resourceInputs, opts);
}
}
exports.RepositoryPolicyFilePathPattern = RepositoryPolicyFilePathPattern;
/** @internal */
RepositoryPolicyFilePathPattern.__pulumiType = 'azuredevops:index/repositoryPolicyFilePathPattern:RepositoryPolicyFilePathPattern';
//# sourceMappingURL=repositoryPolicyFilePathPattern.js.map