UNPKG

@pulumi/github

Version:

A Pulumi package for creating and managing github cloud resources.

105 lines 4.75 kB
"use strict"; // *** 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.RepositoryEnvironment = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * This resource allows you to create and manage environments for a GitHub repository. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as github from "@pulumi/github"; * * const current = github.getUser({ * username: "", * }); * const example = new github.Repository("example", { * name: "A Repository Project", * description: "My awesome codebase", * }); * const exampleRepositoryEnvironment = new github.RepositoryEnvironment("example", { * environment: "example", * repository: example.name, * preventSelfReview: true, * reviewers: [{ * users: [current.then(current => current.id)], * }], * deploymentBranchPolicy: { * protectedBranches: true, * customBranchPolicies: false, * }, * }); * ``` * * ## Import * * GitHub Repository Environment can be imported using an ID made up of `name` of the repository combined with the `environment` name of the environment, separated by a `:` character, e.g. * * ```sh * $ pulumi import github:index/repositoryEnvironment:RepositoryEnvironment daily terraform:daily * ``` */ class RepositoryEnvironment extends pulumi.CustomResource { /** * Get an existing RepositoryEnvironment 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 RepositoryEnvironment(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RepositoryEnvironment. 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'] === RepositoryEnvironment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["canAdminsBypass"] = state ? state.canAdminsBypass : undefined; resourceInputs["deploymentBranchPolicy"] = state ? state.deploymentBranchPolicy : undefined; resourceInputs["environment"] = state ? state.environment : undefined; resourceInputs["preventSelfReview"] = state ? state.preventSelfReview : undefined; resourceInputs["repository"] = state ? state.repository : undefined; resourceInputs["reviewers"] = state ? state.reviewers : undefined; resourceInputs["waitTimer"] = state ? state.waitTimer : undefined; } else { const args = argsOrState; if ((!args || args.environment === undefined) && !opts.urn) { throw new Error("Missing required property 'environment'"); } if ((!args || args.repository === undefined) && !opts.urn) { throw new Error("Missing required property 'repository'"); } resourceInputs["canAdminsBypass"] = args ? args.canAdminsBypass : undefined; resourceInputs["deploymentBranchPolicy"] = args ? args.deploymentBranchPolicy : undefined; resourceInputs["environment"] = args ? args.environment : undefined; resourceInputs["preventSelfReview"] = args ? args.preventSelfReview : undefined; resourceInputs["repository"] = args ? args.repository : undefined; resourceInputs["reviewers"] = args ? args.reviewers : undefined; resourceInputs["waitTimer"] = args ? args.waitTimer : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RepositoryEnvironment.__pulumiType, name, resourceInputs, opts); } } exports.RepositoryEnvironment = RepositoryEnvironment; /** @internal */ RepositoryEnvironment.__pulumiType = 'github:index/repositoryEnvironment:RepositoryEnvironment'; //# sourceMappingURL=repositoryEnvironment.js.map