1. Packages
  2. Github Provider
  3. API Docs
  4. OrganizationCustomRole
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

github.OrganizationCustomRole

Explore with Pulumi AI

github logo
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

    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

    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 pulumi
    import pulumi_github as github
    
    example = github.OrganizationCustomRole("example",
        name="example",
        description="Example custom role that uses the read role as its base",
        base_role="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",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := github.NewOrganizationCustomRole(ctx, "example", &github.OrganizationCustomRoleArgs{
    			Name:        pulumi.String("example"),
    			Description: pulumi.String("Example custom role that uses the read role as its base"),
    			BaseRole:    pulumi.String("read"),
    			Permissions: pulumi.StringArray{
    				pulumi.String("add_assignee"),
    				pulumi.String("add_label"),
    				pulumi.String("bypass_branch_protection"),
    				pulumi.String("close_issue"),
    				pulumi.String("close_pull_request"),
    				pulumi.String("mark_as_duplicate"),
    				pulumi.String("create_tag"),
    				pulumi.String("delete_issue"),
    				pulumi.String("delete_tag"),
    				pulumi.String("manage_deploy_keys"),
    				pulumi.String("push_protected_branch"),
    				pulumi.String("read_code_scanning"),
    				pulumi.String("reopen_issue"),
    				pulumi.String("reopen_pull_request"),
    				pulumi.String("request_pr_review"),
    				pulumi.String("resolve_dependabot_alerts"),
    				pulumi.String("resolve_secret_scanning_alerts"),
    				pulumi.String("view_secret_scanning_alerts"),
    				pulumi.String("write_code_scanning"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Github.OrganizationCustomRole("example", new()
        {
            Name = "example",
            Description = "Example custom role that uses the read role as its base",
            BaseRole = "read",
            Permissions = new[]
            {
                "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",
            },
        });
    
    });
    
    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());
    
        }
    }
    
    resources:
      example:
        type: github:OrganizationCustomRole
        properties:
          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
    

    Create OrganizationCustomRole Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new OrganizationCustomRole(name: string, args: OrganizationCustomRoleArgs, opts?: CustomResourceOptions);
    @overload
    def OrganizationCustomRole(resource_name: str,
                               args: OrganizationCustomRoleArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def OrganizationCustomRole(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               base_role: Optional[str] = None,
                               permissions: Optional[Sequence[str]] = None,
                               description: Optional[str] = None,
                               name: Optional[str] = None)
    func NewOrganizationCustomRole(ctx *Context, name string, args OrganizationCustomRoleArgs, opts ...ResourceOption) (*OrganizationCustomRole, error)
    public OrganizationCustomRole(string name, OrganizationCustomRoleArgs args, CustomResourceOptions? opts = null)
    public OrganizationCustomRole(String name, OrganizationCustomRoleArgs args)
    public OrganizationCustomRole(String name, OrganizationCustomRoleArgs args, CustomResourceOptions options)
    
    type: github:OrganizationCustomRole
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args OrganizationCustomRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args OrganizationCustomRoleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args OrganizationCustomRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args OrganizationCustomRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args OrganizationCustomRoleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var organizationCustomRoleResource = new Github.OrganizationCustomRole("organizationCustomRoleResource", new()
    {
        BaseRole = "string",
        Permissions = new[]
        {
            "string",
        },
        Description = "string",
        Name = "string",
    });
    
    example, err := github.NewOrganizationCustomRole(ctx, "organizationCustomRoleResource", &github.OrganizationCustomRoleArgs{
    	BaseRole: pulumi.String("string"),
    	Permissions: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var organizationCustomRoleResource = new OrganizationCustomRole("organizationCustomRoleResource", OrganizationCustomRoleArgs.builder()
        .baseRole("string")
        .permissions("string")
        .description("string")
        .name("string")
        .build());
    
    organization_custom_role_resource = github.OrganizationCustomRole("organizationCustomRoleResource",
        base_role="string",
        permissions=["string"],
        description="string",
        name="string")
    
    const organizationCustomRoleResource = new github.OrganizationCustomRole("organizationCustomRoleResource", {
        baseRole: "string",
        permissions: ["string"],
        description: "string",
        name: "string",
    });
    
    type: github:OrganizationCustomRole
    properties:
        baseRole: string
        description: string
        name: string
        permissions:
            - string
    

    OrganizationCustomRole Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The OrganizationCustomRole resource accepts the following input properties:

    BaseRole string
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    Permissions List<string>
    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 API.
    Description string
    The description for the custom role.
    Name string
    The name of the custom role.
    BaseRole string
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    Permissions []string
    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 API.
    Description string
    The description for the custom role.
    Name string
    The name of the custom role.
    baseRole String
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    permissions List<String>
    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 API.
    description String
    The description for the custom role.
    name String
    The name of the custom role.
    baseRole string
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    permissions string[]
    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 API.
    description string
    The description for the custom role.
    name string
    The name of the custom role.
    base_role str
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    permissions Sequence[str]
    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 API.
    description str
    The description for the custom role.
    name str
    The name of the custom role.
    baseRole String
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    permissions List<String>
    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 API.
    description String
    The description for the custom role.
    name String
    The name of the custom role.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the OrganizationCustomRole resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing OrganizationCustomRole Resource

    Get an existing OrganizationCustomRole resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: OrganizationCustomRoleState, opts?: CustomResourceOptions): OrganizationCustomRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            base_role: Optional[str] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            permissions: Optional[Sequence[str]] = None) -> OrganizationCustomRole
    func GetOrganizationCustomRole(ctx *Context, name string, id IDInput, state *OrganizationCustomRoleState, opts ...ResourceOption) (*OrganizationCustomRole, error)
    public static OrganizationCustomRole Get(string name, Input<string> id, OrganizationCustomRoleState? state, CustomResourceOptions? opts = null)
    public static OrganizationCustomRole get(String name, Output<String> id, OrganizationCustomRoleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BaseRole string
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    Description string
    The description for the custom role.
    Name string
    The name of the custom role.
    Permissions List<string>
    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 API.
    BaseRole string
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    Description string
    The description for the custom role.
    Name string
    The name of the custom role.
    Permissions []string
    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 API.
    baseRole String
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    description String
    The description for the custom role.
    name String
    The name of the custom role.
    permissions List<String>
    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 API.
    baseRole string
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    description string
    The description for the custom role.
    name string
    The name of the custom role.
    permissions string[]
    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 API.
    base_role str
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    description str
    The description for the custom role.
    name str
    The name of the custom role.
    permissions Sequence[str]
    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 API.
    baseRole String
    The system role from which the role inherits permissions. Can be one of: read, triage, write, or maintain.
    description String
    The description for the custom role.
    name String
    The name of the custom role.
    permissions List<String>
    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 API.

    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 API.

    $ pulumi import github:index/organizationCustomRole:OrganizationCustomRole example 1234
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi