@pulumi/github
Version:
A Pulumi package for creating and managing github cloud resources.
111 lines • 5.46 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.RepositoryCollaborator = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a GitHub repository collaborator resource.
*
* > Note: github.RepositoryCollaborator cannot be used in conjunction with github.RepositoryCollaborators or
* they will fight over what your policy should be.
*
* This resource allows you to add/remove collaborators from 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 collaborator
* on a repository. When destroyed, either the invitation will be cancelled or the
* collaborator will be removed from the repository.
*
* This resource is non-authoritative, for managing ALL collaborators of a repo, use github.RepositoryCollaborators
* 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 collaborator](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 a collaborator to a repository
* const aRepoCollaborator = new github.RepositoryCollaborator("a_repo_collaborator", {
* repository: "our-cool-repo",
* username: "SomeUser",
* permission: "admin",
* });
* ```
*
* ## Import
*
* GitHub Repository Collaborators can be imported using an ID made up of `repository:username`, e.g.
*
* ```sh
* $ pulumi import github:index/repositoryCollaborator:RepositoryCollaborator collaborator terraform:someuser
* ```
*/
class RepositoryCollaborator extends pulumi.CustomResource {
/**
* Get an existing RepositoryCollaborator 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 RepositoryCollaborator(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RepositoryCollaborator. 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'] === RepositoryCollaborator.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["invitationId"] = state ? state.invitationId : undefined;
resourceInputs["permission"] = state ? state.permission : undefined;
resourceInputs["permissionDiffSuppression"] = state ? state.permissionDiffSuppression : undefined;
resourceInputs["repository"] = state ? state.repository : undefined;
resourceInputs["username"] = state ? state.username : undefined;
}
else {
const args = argsOrState;
if ((!args || args.repository === undefined) && !opts.urn) {
throw new Error("Missing required property 'repository'");
}
if ((!args || args.username === undefined) && !opts.urn) {
throw new Error("Missing required property 'username'");
}
resourceInputs["permission"] = args ? args.permission : undefined;
resourceInputs["permissionDiffSuppression"] = args ? args.permissionDiffSuppression : undefined;
resourceInputs["repository"] = args ? args.repository : undefined;
resourceInputs["username"] = args ? args.username : undefined;
resourceInputs["invitationId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RepositoryCollaborator.__pulumiType, name, resourceInputs, opts);
}
}
exports.RepositoryCollaborator = RepositoryCollaborator;
/** @internal */
RepositoryCollaborator.__pulumiType = 'github:index/repositoryCollaborator:RepositoryCollaborator';
//# sourceMappingURL=repositoryCollaborator.js.map
;