com.pulumi.github.OrganizationCustomRole Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of github Show documentation
Show all versions of github Show documentation
A Pulumi package for creating and managing github cloud resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.github;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import com.pulumi.github.OrganizationCustomRoleArgs;
import com.pulumi.github.Utilities;
import com.pulumi.github.inputs.OrganizationCustomRoleState;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* 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
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.github.OrganizationCustomRole;
* import com.pulumi.github.OrganizationCustomRoleArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
*
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
*
* public static void stack(Context ctx) {
* var example = new OrganizationCustomRole("example", OrganizationCustomRoleArgs.builder()
* .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")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## 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{@literal @}latest/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization) API.
*
* ```sh
* $ pulumi import github:index/organizationCustomRole:OrganizationCustomRole example 1234
* ```
*
*/
@ResourceType(type="github:index/organizationCustomRole:OrganizationCustomRole")
public class OrganizationCustomRole extends com.pulumi.resources.CustomResource {
/**
* The system role from which the role inherits permissions. Can be one of: `read`, `triage`, `write`, or `maintain`.
*
*/
@Export(name="baseRole", refs={String.class}, tree="[0]")
private Output baseRole;
/**
* @return The system role from which the role inherits permissions. Can be one of: `read`, `triage`, `write`, or `maintain`.
*
*/
public Output baseRole() {
return this.baseRole;
}
/**
* The description for the custom role.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return The description for the custom role.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* The name of the custom role.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the custom role.
*
*/
public Output name() {
return this.name;
}
/**
* A list of additional permissions included in this role. Must have a minimum of 1 additional permission. The list of available permissions can be found using the [list repository fine-grained permissions for an organization](https://docs.github.com/en/enterprise-cloud{@literal @}latest/rest/orgs/custom-roles?apiVersion=2022-11-28#list-repository-fine-grained-permissions-for-an-organization) API.
*
*/
@Export(name="permissions", refs={List.class,String.class}, tree="[0,1]")
private Output> permissions;
/**
* @return A list of additional permissions included in this role. Must have a minimum of 1 additional permission. The list of available permissions can be found using the [list repository fine-grained permissions for an organization](https://docs.github.com/en/enterprise-cloud{@literal @}latest/rest/orgs/custom-roles?apiVersion=2022-11-28#list-repository-fine-grained-permissions-for-an-organization) API.
*
*/
public Output> permissions() {
return this.permissions;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public OrganizationCustomRole(java.lang.String name) {
this(name, OrganizationCustomRoleArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public OrganizationCustomRole(java.lang.String name, OrganizationCustomRoleArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public OrganizationCustomRole(java.lang.String name, OrganizationCustomRoleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("github:index/organizationCustomRole:OrganizationCustomRole", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private OrganizationCustomRole(java.lang.String name, Output id, @Nullable OrganizationCustomRoleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("github:index/organizationCustomRole:OrganizationCustomRole", name, state, makeResourceOptions(options, id), false);
}
private static OrganizationCustomRoleArgs makeArgs(OrganizationCustomRoleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? OrganizationCustomRoleArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host 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
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static OrganizationCustomRole get(java.lang.String name, Output id, @Nullable OrganizationCustomRoleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new OrganizationCustomRole(name, id, state, options);
}
}