UNPKG

@pulumi/azuredevops

Version:

A Pulumi package for creating and managing Azure DevOps.

165 lines 6.98 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** 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, Object.assign(Object.assign({}, 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 ? state.authorEmail : undefined; resourceInputs["authorName"] = state ? state.authorName : undefined; resourceInputs["branch"] = state ? state.branch : undefined; resourceInputs["commitMessage"] = state ? state.commitMessage : undefined; resourceInputs["committerEmail"] = state ? state.committerEmail : undefined; resourceInputs["committerName"] = state ? state.committerName : undefined; resourceInputs["content"] = state ? state.content : undefined; resourceInputs["file"] = state ? state.file : undefined; resourceInputs["overwriteOnCreate"] = state ? state.overwriteOnCreate : undefined; resourceInputs["repositoryId"] = state ? state.repositoryId : undefined; } else { const args = argsOrState; if ((!args || args.content === undefined) && !opts.urn) { throw new Error("Missing required property 'content'"); } if ((!args || args.file === undefined) && !opts.urn) { throw new Error("Missing required property 'file'"); } if ((!args || args.repositoryId === undefined) && !opts.urn) { throw new Error("Missing required property 'repositoryId'"); } resourceInputs["authorEmail"] = args ? args.authorEmail : undefined; resourceInputs["authorName"] = args ? args.authorName : undefined; resourceInputs["branch"] = args ? args.branch : undefined; resourceInputs["commitMessage"] = args ? args.commitMessage : undefined; resourceInputs["committerEmail"] = args ? args.committerEmail : undefined; resourceInputs["committerName"] = args ? args.committerName : undefined; resourceInputs["content"] = args ? args.content : undefined; resourceInputs["file"] = args ? args.file : undefined; resourceInputs["overwriteOnCreate"] = args ? args.overwriteOnCreate : undefined; resourceInputs["repositoryId"] = args ? args.repositoryId : undefined; } 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