1. Packages
  2. Spectrocloud Provider
  3. API Docs
  4. getRole
spectrocloud 0.23.4 published on Monday, Apr 14, 2025 by spectrocloud

spectrocloud.getRole

Explore with Pulumi AI

spectrocloud logo
spectrocloud 0.23.4 published on Monday, Apr 14, 2025 by spectrocloud

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as spectrocloud from "@pulumi/spectrocloud";
    
    const role = spectrocloud.getRole({
        name: "Resource Cluster Admin",
    });
    export const roleId = role.then(role => role.id);
    export const rolePermissions = role.then(role => role.permissions);
    
    import pulumi
    import pulumi_spectrocloud as spectrocloud
    
    role = spectrocloud.get_role(name="Resource Cluster Admin")
    pulumi.export("roleId", role.id)
    pulumi.export("rolePermissions", role.permissions)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/spectrocloud/spectrocloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		role, err := spectrocloud.LookupRole(ctx, &spectrocloud.LookupRoleArgs{
    			Name: pulumi.StringRef("Resource Cluster Admin"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("roleId", role.Id)
    		ctx.Export("rolePermissions", role.Permissions)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Spectrocloud = Pulumi.Spectrocloud;
    
    return await Deployment.RunAsync(() => 
    {
        var role = Spectrocloud.GetRole.Invoke(new()
        {
            Name = "Resource Cluster Admin",
        });
    
        return new Dictionary<string, object?>
        {
            ["roleId"] = role.Apply(getRoleResult => getRoleResult.Id),
            ["rolePermissions"] = role.Apply(getRoleResult => getRoleResult.Permissions),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.spectrocloud.SpectrocloudFunctions;
    import com.pulumi.spectrocloud.inputs.GetRoleArgs;
    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) {
            final var role = SpectrocloudFunctions.getRole(GetRoleArgs.builder()
                .name("Resource Cluster Admin")
                .build());
    
            ctx.export("roleId", role.applyValue(getRoleResult -> getRoleResult.id()));
            ctx.export("rolePermissions", role.applyValue(getRoleResult -> getRoleResult.permissions()));
        }
    }
    
    variables:
      role:
        fn::invoke:
          function: spectrocloud:getRole
          arguments:
            name: Resource Cluster Admin
    outputs:
      roleId: ${role.id}
      rolePermissions: ${role.permissions}
    

    Using getRole

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getRole(args: GetRoleArgs, opts?: InvokeOptions): Promise<GetRoleResult>
    function getRoleOutput(args: GetRoleOutputArgs, opts?: InvokeOptions): Output<GetRoleResult>
    def get_role(id: Optional[str] = None,
                 name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetRoleResult
    def get_role_output(id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetRoleResult]
    func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)
    func LookupRoleOutput(ctx *Context, args *LookupRoleOutputArgs, opts ...InvokeOption) LookupRoleResultOutput

    > Note: This function is named LookupRole in the Go SDK.

    public static class GetRole 
    {
        public static Task<GetRoleResult> InvokeAsync(GetRoleArgs args, InvokeOptions? opts = null)
        public static Output<GetRoleResult> Invoke(GetRoleInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
    public static Output<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
    
    fn::invoke:
      function: spectrocloud:index/getRole:getRole
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The ID of this resource.
    Name string
    Id string
    The ID of this resource.
    Name string
    id String
    The ID of this resource.
    name String
    id string
    The ID of this resource.
    name string
    id str
    The ID of this resource.
    name str
    id String
    The ID of this resource.
    name String

    getRole Result

    The following output properties are available:

    Id string
    The ID of this resource.
    Name string
    Permissions List<string>
    List of permissions associated with the role.
    Id string
    The ID of this resource.
    Name string
    Permissions []string
    List of permissions associated with the role.
    id String
    The ID of this resource.
    name String
    permissions List<String>
    List of permissions associated with the role.
    id string
    The ID of this resource.
    name string
    permissions string[]
    List of permissions associated with the role.
    id str
    The ID of this resource.
    name str
    permissions Sequence[str]
    List of permissions associated with the role.
    id String
    The ID of this resource.
    name String
    permissions List<String>
    List of permissions associated with the role.

    Package Details

    Repository
    spectrocloud spectrocloud/terraform-provider-spectrocloud
    License
    Notes
    This Pulumi package is based on the spectrocloud Terraform Provider.
    spectrocloud logo
    spectrocloud 0.23.4 published on Monday, Apr 14, 2025 by spectrocloud