1. Packages
  2. Spectrocloud Provider
  3. API Docs
  4. getRole
spectrocloud 0.23.5 published on Sunday, Apr 20, 2025 by spectrocloud

spectrocloud.getRole

Explore with Pulumi AI

spectrocloud logo
spectrocloud 0.23.5 published on Sunday, Apr 20, 2025 by spectrocloud

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as spectrocloud from "@pulumi/spectrocloud";
    
    const example = spectrocloud.getRole({
        name: "admin-role",
    });
    export const roleId = example.then(example => example.id);
    export const rolePermissions = example.then(example => example.permissions);
    
    import pulumi
    import pulumi_spectrocloud as spectrocloud
    
    example = spectrocloud.get_role(name="admin-role")
    pulumi.export("roleId", example.id)
    pulumi.export("rolePermissions", example.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 {
    		example, err := spectrocloud.LookupRole(ctx, &spectrocloud.LookupRoleArgs{
    			Name: pulumi.StringRef("admin-role"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("roleId", example.Id)
    		ctx.Export("rolePermissions", example.Permissions)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Spectrocloud = Pulumi.Spectrocloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Spectrocloud.GetRole.Invoke(new()
        {
            Name = "admin-role",
        });
    
        return new Dictionary<string, object?>
        {
            ["roleId"] = example.Apply(getRoleResult => getRoleResult.Id),
            ["rolePermissions"] = example.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 example = SpectrocloudFunctions.getRole(GetRoleArgs.builder()
                .name("admin-role")
                .build());
    
            ctx.export("roleId", example.applyValue(getRoleResult -> getRoleResult.id()));
            ctx.export("rolePermissions", example.applyValue(getRoleResult -> getRoleResult.permissions()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: spectrocloud:getRole
          arguments:
            name: admin-role
    outputs:
      # Output role ID
      roleId: ${example.id}
      # Output permissions associated with the role
      rolePermissions: ${example.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.5 published on Sunday, Apr 20, 2025 by spectrocloud