Google Cloud (GCP) Classic
getRule
Use this data source to get information about a Google IAM Role.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const roleinfo = gcp.iam.getRule({
name: "roles/compute.viewer",
});
export const theRolePermissions = roleinfo.then(roleinfo => roleinfo.includedPermissions);
import pulumi
import pulumi_gcp as gcp
roleinfo = gcp.iam.get_rule(name="roles/compute.viewer")
pulumi.export("theRolePermissions", roleinfo.included_permissions)
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var roleinfo = Output.Create(Gcp.Iam.GetRule.InvokeAsync(new Gcp.Iam.GetRuleArgs
{
Name = "roles/compute.viewer",
}));
this.TheRolePermissions = roleinfo.Apply(roleinfo => roleinfo.IncludedPermissions);
}
[Output("theRolePermissions")]
public Output<string> TheRolePermissions { get; set; }
}
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
roleinfo, err := iam.GetRule(ctx, &iam.GetRuleArgs{
Name: "roles/compute.viewer",
}, nil)
if err != nil {
return err
}
ctx.Export("theRolePermissions", roleinfo.IncludedPermissions)
return nil
})
}
package generated_program;
import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var roleinfo = Output.of(IamFunctions.getRule(GetRuleArgs.builder()
.name("roles/compute.viewer")
.build()));
ctx.export("theRolePermissions", roleinfo.apply(getRuleResult -> getRuleResult.includedPermissions()));
}
}
variables:
roleinfo:
Fn::Invoke:
Function: gcp:iam:getRule
Arguments:
name: roles/compute.viewer
outputs:
theRolePermissions: ${roleinfo.includedPermissions}
Using getRule
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 getRule(args: GetRuleArgs, opts?: InvokeOptions): Promise<GetRuleResult>
function getRuleOutput(args: GetRuleOutputArgs, opts?: InvokeOptions): Output<GetRuleResult>
def get_rule(name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRuleResult
def get_rule_output(name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRuleResult]
func GetRule(ctx *Context, args *GetRuleArgs, opts ...InvokeOption) (*GetRuleResult, error)
func GetRuleOutput(ctx *Context, args *GetRuleOutputArgs, opts ...InvokeOption) GetRuleResultOutput
> Note: This function is named GetRule
in the Go SDK.
public static class GetRule
{
public static Task<GetRuleResult> InvokeAsync(GetRuleArgs args, InvokeOptions? opts = null)
public static Output<GetRuleResult> Invoke(GetRuleInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetRuleResult> getRule(GetRuleArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
Function: gcp:iam/getRule:getRule
Arguments:
# Arguments dictionary
The following arguments are supported:
- Name string
The name of the Role to lookup in the form
roles/{ROLE_NAME}
,organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}
orprojects/{PROJECT_ID}/roles/{ROLE_NAME}
- Name string
The name of the Role to lookup in the form
roles/{ROLE_NAME}
,organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}
orprojects/{PROJECT_ID}/roles/{ROLE_NAME}
- name String
The name of the Role to lookup in the form
roles/{ROLE_NAME}
,organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}
orprojects/{PROJECT_ID}/roles/{ROLE_NAME}
- name string
The name of the Role to lookup in the form
roles/{ROLE_NAME}
,organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}
orprojects/{PROJECT_ID}/roles/{ROLE_NAME}
- name str
The name of the Role to lookup in the form
roles/{ROLE_NAME}
,organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}
orprojects/{PROJECT_ID}/roles/{ROLE_NAME}
- name String
The name of the Role to lookup in the form
roles/{ROLE_NAME}
,organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}
orprojects/{PROJECT_ID}/roles/{ROLE_NAME}
getRule Result
The following output properties are available:
- Id string
The provider-assigned unique ID for this managed resource.
- Included
Permissions List<string> specifies the list of one or more permissions to include in the custom role, such as -
iam.roles.get
- Name string
- Stage string
indicates the stage of a role in the launch lifecycle, such as
GA
,BETA
orALPHA
.- Title string
is a friendly title for the role, such as "Role Viewer"
- Id string
The provider-assigned unique ID for this managed resource.
- Included
Permissions []string specifies the list of one or more permissions to include in the custom role, such as -
iam.roles.get
- Name string
- Stage string
indicates the stage of a role in the launch lifecycle, such as
GA
,BETA
orALPHA
.- Title string
is a friendly title for the role, such as "Role Viewer"
- id String
The provider-assigned unique ID for this managed resource.
- included
Permissions List<String> specifies the list of one or more permissions to include in the custom role, such as -
iam.roles.get
- name String
- stage String
indicates the stage of a role in the launch lifecycle, such as
GA
,BETA
orALPHA
.- title String
is a friendly title for the role, such as "Role Viewer"
- id string
The provider-assigned unique ID for this managed resource.
- included
Permissions string[] specifies the list of one or more permissions to include in the custom role, such as -
iam.roles.get
- name string
- stage string
indicates the stage of a role in the launch lifecycle, such as
GA
,BETA
orALPHA
.- title string
is a friendly title for the role, such as "Role Viewer"
- id str
The provider-assigned unique ID for this managed resource.
- included_
permissions Sequence[str] specifies the list of one or more permissions to include in the custom role, such as -
iam.roles.get
- name str
- stage str
indicates the stage of a role in the launch lifecycle, such as
GA
,BETA
orALPHA
.- title str
is a friendly title for the role, such as "Role Viewer"
- id String
The provider-assigned unique ID for this managed resource.
- included
Permissions List<String> specifies the list of one or more permissions to include in the custom role, such as -
iam.roles.get
- name String
- stage String
indicates the stage of a role in the launch lifecycle, such as
GA
,BETA
orALPHA
.- title String
is a friendly title for the role, such as "Role Viewer"
Package Details
- Repository
- https://github.com/pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
google-beta
Terraform Provider.