Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

getRole

The vsphere.Role data source can be used to discover the id and privileges associated with a role given its name or display label in vsphere UI.

Example Usage

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var role1 = Output.Create(VSphere.GetRole.InvokeAsync(new VSphere.GetRoleArgs
        {
            Label = "Virtual machine user (sample)",
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-vsphere/sdk/v2/go/vsphere"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := vsphere.LookupRole(ctx, &vsphere.LookupRoleArgs{
            Label: "Virtual machine user (sample)",
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

role1 = vsphere.get_role(label="Virtual machine user (sample)")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const role1 = pulumi.output(vsphere.getRole({
    label: "Virtual machine user (sample)",
}, { async: true }));

Using getRole

function getRole(args: GetRoleArgs, opts?: InvokeOptions): Promise<GetRoleResult>
def get_role(description: Optional[str] = None, label: Optional[str] = None, name: Optional[str] = None, role_privileges: Optional[Sequence[str]] = None, opts: Optional[InvokeOptions] = None) -> GetRoleResult
func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)

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

public static class GetRole {
    public static Task<GetRoleResult> InvokeAsync(GetRoleArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Label string

The label of the role.

Description string

The description of the role.

Name string
RolePrivileges List<string>

The privileges associated with the role.

Label string

The label of the role.

Description string

The description of the role.

Name string
RolePrivileges []string

The privileges associated with the role.

label string

The label of the role.

description string

The description of the role.

name string
rolePrivileges string[]

The privileges associated with the role.

label str

The label of the role.

description str

The description of the role.

name str
role_privileges Sequence[str]

The privileges associated with the role.

getRole Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Label string

The display label of the role.

Description string

The description of the role.

Name string
RolePrivileges List<string>

The privileges associated with the role.

Id string

The provider-assigned unique ID for this managed resource.

Label string

The display label of the role.

Description string

The description of the role.

Name string
RolePrivileges []string

The privileges associated with the role.

id string

The provider-assigned unique ID for this managed resource.

label string

The display label of the role.

description string

The description of the role.

name string
rolePrivileges string[]

The privileges associated with the role.

id str

The provider-assigned unique ID for this managed resource.

label str

The display label of the role.

description str

The description of the role.

name str
role_privileges Sequence[str]

The privileges associated with the role.

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.