@pulumi/github
Version:
A Pulumi package for creating and managing github cloud resources.
109 lines • 4.61 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.OrganizationCustomRole = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource allows you to create and manage custom roles in a GitHub Organization for use in repositories.
*
* > Note: Custom roles are currently only available in GitHub Enterprise Cloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as github from "@pulumi/github";
*
* const example = new github.OrganizationCustomRole("example", {
* name: "example",
* description: "Example custom role that uses the read role as its base",
* baseRole: "read",
* permissions: [
* "add_assignee",
* "add_label",
* "bypass_branch_protection",
* "close_issue",
* "close_pull_request",
* "mark_as_duplicate",
* "create_tag",
* "delete_issue",
* "delete_tag",
* "manage_deploy_keys",
* "push_protected_branch",
* "read_code_scanning",
* "reopen_issue",
* "reopen_pull_request",
* "request_pr_review",
* "resolve_dependabot_alerts",
* "resolve_secret_scanning_alerts",
* "view_secret_scanning_alerts",
* "write_code_scanning",
* ],
* });
* ```
*
* ## Import
*
* Custom roles can be imported using the `id` of the role.
* The `id` of the custom role can be found using the [list custom roles in an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization) API.
*
* ```sh
* $ pulumi import github:index/organizationCustomRole:OrganizationCustomRole example 1234
* ```
*/
class OrganizationCustomRole extends pulumi.CustomResource {
/**
* Get an existing OrganizationCustomRole 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 OrganizationCustomRole(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of OrganizationCustomRole. 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'] === OrganizationCustomRole.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["baseRole"] = state ? state.baseRole : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["permissions"] = state ? state.permissions : undefined;
}
else {
const args = argsOrState;
if ((!args || args.baseRole === undefined) && !opts.urn) {
throw new Error("Missing required property 'baseRole'");
}
if ((!args || args.permissions === undefined) && !opts.urn) {
throw new Error("Missing required property 'permissions'");
}
resourceInputs["baseRole"] = args ? args.baseRole : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["permissions"] = args ? args.permissions : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OrganizationCustomRole.__pulumiType, name, resourceInputs, opts);
}
}
exports.OrganizationCustomRole = OrganizationCustomRole;
/** @internal */
OrganizationCustomRole.__pulumiType = 'github:index/organizationCustomRole:OrganizationCustomRole';
//# sourceMappingURL=organizationCustomRole.js.map
;