UNPKG

@pulumi/github

Version:

A Pulumi package for creating and managing github cloud resources.

119 lines 5.58 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.RepositoryCollaborators = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a GitHub repository collaborators resource. * * > Note: github.RepositoryCollaborators cannot be used in conjunction with github.RepositoryCollaborator and * github.TeamRepository or they will fight over what your policy should be. * * This resource allows you to manage all collaborators for repositories in your * organization or personal account. For organization repositories, collaborators can * have explicit (and differing levels of) read, write, or administrator access to * specific repositories, without giving the user full organization membership. * For personal repositories, collaborators can only be granted write * (implicitly includes read) permission. * * When applied, an invitation will be sent to the user to become a collaborators * on a repository. When destroyed, either the invitation will be cancelled or the * collaborators will be removed from the repository. * * This resource is authoritative. For adding a collaborator to a repo in a non-authoritative manner, use * github.RepositoryCollaborator instead. * * Further documentation on GitHub collaborators: * * - [Adding outside collaborators to your personal repositories](https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories) * - [Adding outside collaborators to repositories in your organization](https://help.github.com/articles/adding-outside-collaborators-to-repositories-in-your-organization/) * - [Converting an organization member to an outside collaborators](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as github from "@pulumi/github"; * * // Add collaborators to a repository * const someTeam = new github.Team("some_team", { * name: "SomeTeam", * description: "Some cool team", * }); * const someRepo = new github.Repository("some_repo", {name: "some-repo"}); * const someRepoCollaborators = new github.RepositoryCollaborators("some_repo_collaborators", { * repository: someRepo.name, * users: [{ * permission: "admin", * username: "SomeUser", * }], * teams: [{ * permission: "pull", * teamId: someTeam.slug, * }], * }); * ``` * * ## Import * * GitHub Repository Collaborators can be imported using the name `name`, e.g. * * ```sh * $ pulumi import github:index/repositoryCollaborators:RepositoryCollaborators collaborators terraform * ``` */ class RepositoryCollaborators extends pulumi.CustomResource { /** * Get an existing RepositoryCollaborators 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 RepositoryCollaborators(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RepositoryCollaborators. 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'] === RepositoryCollaborators.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["ignoreTeams"] = state ? state.ignoreTeams : undefined; resourceInputs["invitationIds"] = state ? state.invitationIds : undefined; resourceInputs["repository"] = state ? state.repository : undefined; resourceInputs["teams"] = state ? state.teams : undefined; resourceInputs["users"] = state ? state.users : undefined; } else { const args = argsOrState; if ((!args || args.repository === undefined) && !opts.urn) { throw new Error("Missing required property 'repository'"); } resourceInputs["ignoreTeams"] = args ? args.ignoreTeams : undefined; resourceInputs["repository"] = args ? args.repository : undefined; resourceInputs["teams"] = args ? args.teams : undefined; resourceInputs["users"] = args ? args.users : undefined; resourceInputs["invitationIds"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RepositoryCollaborators.__pulumiType, name, resourceInputs, opts); } } exports.RepositoryCollaborators = RepositoryCollaborators; /** @internal */ RepositoryCollaborators.__pulumiType = 'github:index/repositoryCollaborators:RepositoryCollaborators'; //# sourceMappingURL=repositoryCollaborators.js.map