@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
129 lines • 5.34 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.RepositoryPolicyMaxFileSize = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manage a max file size repository policy within Azure DevOps project.
*
* > If both project and project policy are enabled, the repository 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 exampleRepositoryPolicyMaxFileSize = new azuredevops.RepositoryPolicyMaxFileSize("example", {
* projectId: example.id,
* enabled: true,
* blocking: true,
* maxFileSize: 1,
* 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 exampleRepositoryPolicyMaxFileSize = new azuredevops.RepositoryPolicyMaxFileSize("example", {
* projectId: example.id,
* enabled: true,
* blocking: true,
* maxFileSize: 1,
* });
* ```
*
* ## 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/repositoryPolicyMaxFileSize:RepositoryPolicyMaxFileSize example 00000000-0000-0000-0000-000000000000/0
* ```
*/
class RepositoryPolicyMaxFileSize extends pulumi.CustomResource {
/**
* Get an existing RepositoryPolicyMaxFileSize 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 RepositoryPolicyMaxFileSize(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RepositoryPolicyMaxFileSize. 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'] === RepositoryPolicyMaxFileSize.__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["maxFileSize"] = state ? state.maxFileSize : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["repositoryIds"] = state ? state.repositoryIds : undefined;
}
else {
const args = argsOrState;
if ((!args || args.maxFileSize === undefined) && !opts.urn) {
throw new Error("Missing required property 'maxFileSize'");
}
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["maxFileSize"] = args ? args.maxFileSize : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["repositoryIds"] = args ? args.repositoryIds : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RepositoryPolicyMaxFileSize.__pulumiType, name, resourceInputs, opts);
}
}
exports.RepositoryPolicyMaxFileSize = RepositoryPolicyMaxFileSize;
/** @internal */
RepositoryPolicyMaxFileSize.__pulumiType = 'azuredevops:index/repositoryPolicyMaxFileSize:RepositoryPolicyMaxFileSize';
//# sourceMappingURL=repositoryPolicyMaxFileSize.js.map