@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
165 lines • 6.53 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.GitRepositoryFile = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manage files within an Azure DevOps Git repository.
*
* ## 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",
* });
* const exampleGit = new azuredevops.Git("example", {
* projectId: example.id,
* name: "Example Git Repository",
* initialization: {
* initType: "Clean",
* },
* });
* const exampleGitRepositoryFile = new azuredevops.GitRepositoryFile("example", {
* repositoryId: exampleGit.id,
* file: ".gitignore",
* content: "**/*.tfstate",
* branch: "refs/heads/master",
* commitMessage: "First commit",
* overwriteOnCreate: false,
* });
* ```
*
* ### Author Email Pattern
* ```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",
* });
* const exampleGit = new azuredevops.Git("example", {
* projectId: example.id,
* name: "Example Git Repository",
* initialization: {
* initType: "Clean",
* },
* });
* const exampleRepositoryPolicyAuthorEmailPattern = new azuredevops.RepositoryPolicyAuthorEmailPattern("example", {
* projectId: example.id,
* enabled: true,
* blocking: true,
* authorEmailPatterns: ["auhtor@test.com"],
* repositoryIds: [exampleGit.id],
* });
* const exampleGitRepositoryFile = new azuredevops.GitRepositoryFile("example", {
* repositoryId: exampleGit.id,
* file: ".gitignore",
* content: "**/*.tfstate",
* branch: "refs/heads/master",
* commitMessage: "First commit",
* overwriteOnCreate: false,
* authorName: "authorname",
* authorEmail: "auhtor@test.com",
* }, {
* dependsOn: [exampleRepositoryPolicyAuthorEmailPattern],
* });
* ```
*
* ## Relevant Links
*
* - [Azure DevOps Service REST API 7.0 - Git API](https://docs.microsoft.com/en-us/rest/api/azure/devops/git/?view=azure-devops-rest-7.0)
*
* ## Import
*
* Repository files can be imported using a combination of the `repository ID` and `file`, e.g.
*
* ```sh
* $ pulumi import azuredevops:index/gitRepositoryFile:GitRepositoryFile example 00000000-0000-0000-0000-000000000000/.gitignore
* ```
*
* To import a file from a branch other than `master`, append `:` and the branch name, e.g.
*
* ```sh
* $ pulumi import azuredevops:index/gitRepositoryFile:GitRepositoryFile example 00000000-0000-0000-0000-000000000000/.gitignore:refs/heads/master
* ```
*/
class GitRepositoryFile extends pulumi.CustomResource {
/**
* Get an existing GitRepositoryFile 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 GitRepositoryFile(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of GitRepositoryFile. 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'] === GitRepositoryFile.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["authorEmail"] = state?.authorEmail;
resourceInputs["authorName"] = state?.authorName;
resourceInputs["branch"] = state?.branch;
resourceInputs["commitMessage"] = state?.commitMessage;
resourceInputs["committerEmail"] = state?.committerEmail;
resourceInputs["committerName"] = state?.committerName;
resourceInputs["content"] = state?.content;
resourceInputs["file"] = state?.file;
resourceInputs["overwriteOnCreate"] = state?.overwriteOnCreate;
resourceInputs["repositoryId"] = state?.repositoryId;
}
else {
const args = argsOrState;
if (args?.content === undefined && !opts.urn) {
throw new Error("Missing required property 'content'");
}
if (args?.file === undefined && !opts.urn) {
throw new Error("Missing required property 'file'");
}
if (args?.repositoryId === undefined && !opts.urn) {
throw new Error("Missing required property 'repositoryId'");
}
resourceInputs["authorEmail"] = args?.authorEmail;
resourceInputs["authorName"] = args?.authorName;
resourceInputs["branch"] = args?.branch;
resourceInputs["commitMessage"] = args?.commitMessage;
resourceInputs["committerEmail"] = args?.committerEmail;
resourceInputs["committerName"] = args?.committerName;
resourceInputs["content"] = args?.content;
resourceInputs["file"] = args?.file;
resourceInputs["overwriteOnCreate"] = args?.overwriteOnCreate;
resourceInputs["repositoryId"] = args?.repositoryId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GitRepositoryFile.__pulumiType, name, resourceInputs, opts);
}
}
exports.GitRepositoryFile = GitRepositoryFile;
/** @internal */
GitRepositoryFile.__pulumiType = 'azuredevops:index/gitRepositoryFile:GitRepositoryFile';
//# sourceMappingURL=gitRepositoryFile.js.map