1. Packages
  2. Zenduty Provider
  3. API Docs
  4. AssignAccountRole
zenduty 0.2.6 published on Wednesday, Jan 15, 2025 by zenduty

zenduty.AssignAccountRole

Explore with Pulumi AI

zenduty logo
zenduty 0.2.6 published on Wednesday, Jan 15, 2025 by zenduty

    This Resource allows you to assign a custom role to user


    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as zenduty from "@pulumi/zenduty";
    
    const sre = new zenduty.AccountRole("sre", {
        description: "view all incidents in account",
        permissions: ["incident_read"],
    });
    const user1 = zenduty.getUser({
        email: "demouser@gmail.com",
    });
    const demouser = new zenduty.AssignAccountRole("demouser", {
        username: user1.then(user1 => user1.users?.[0]?.username),
        accountRole: sre.accountRoleId,
    });
    
    import pulumi
    import pulumi_zenduty as zenduty
    
    sre = zenduty.AccountRole("sre",
        description="view all incidents in account",
        permissions=["incident_read"])
    user1 = zenduty.get_user(email="demouser@gmail.com")
    demouser = zenduty.AssignAccountRole("demouser",
        username=user1.users[0].username,
        account_role=sre.account_role_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/zenduty/zenduty"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		sre, err := zenduty.NewAccountRole(ctx, "sre", &zenduty.AccountRoleArgs{
    			Description: pulumi.String("view all incidents in account"),
    			Permissions: pulumi.StringArray{
    				pulumi.String("incident_read"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		user1, err := zenduty.LookupUser(ctx, &zenduty.LookupUserArgs{
    			Email: "demouser@gmail.com",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = zenduty.NewAssignAccountRole(ctx, "demouser", &zenduty.AssignAccountRoleArgs{
    			Username:    pulumi.String(user1.Users[0].Username),
    			AccountRole: sre.AccountRoleId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Zenduty = Pulumi.Zenduty;
    
    return await Deployment.RunAsync(() => 
    {
        var sre = new Zenduty.AccountRole("sre", new()
        {
            Description = "view all incidents in account",
            Permissions = new[]
            {
                "incident_read",
            },
        });
    
        var user1 = Zenduty.GetUser.Invoke(new()
        {
            Email = "demouser@gmail.com",
        });
    
        var demouser = new Zenduty.AssignAccountRole("demouser", new()
        {
            Username = user1.Apply(getUserResult => getUserResult.Users[0]?.Username),
            AccountRole = sre.AccountRoleId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.zenduty.AccountRole;
    import com.pulumi.zenduty.AccountRoleArgs;
    import com.pulumi.zenduty.ZendutyFunctions;
    import com.pulumi.zenduty.inputs.GetUserArgs;
    import com.pulumi.zenduty.AssignAccountRole;
    import com.pulumi.zenduty.AssignAccountRoleArgs;
    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 sre = new AccountRole("sre", AccountRoleArgs.builder()
                .description("view all incidents in account")
                .permissions("incident_read")
                .build());
    
            final var user1 = ZendutyFunctions.getUser(GetUserArgs.builder()
                .email("demouser@gmail.com")
                .build());
    
            var demouser = new AssignAccountRole("demouser", AssignAccountRoleArgs.builder()
                .username(user1.applyValue(getUserResult -> getUserResult.users()[0].username()))
                .accountRole(sre.accountRoleId())
                .build());
    
        }
    }
    
    resources:
      sre:
        type: zenduty:AccountRole
        properties:
          description: view all incidents in account
          permissions:
            - incident_read
      demouser:
        type: zenduty:AssignAccountRole
        properties:
          username: ${user1.users[0].username}
          accountRole: ${sre.accountRoleId}
    variables:
      user1:
        fn::invoke:
          function: zenduty:getUser
          arguments:
            email: demouser@gmail.com
    

    Create AssignAccountRole Resource

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

    Constructor syntax

    new AssignAccountRole(name: string, args: AssignAccountRoleArgs, opts?: CustomResourceOptions);
    @overload
    def AssignAccountRole(resource_name: str,
                          args: AssignAccountRoleArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def AssignAccountRole(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          account_role: Optional[str] = None,
                          username: Optional[str] = None,
                          assign_account_role_id: Optional[str] = None)
    func NewAssignAccountRole(ctx *Context, name string, args AssignAccountRoleArgs, opts ...ResourceOption) (*AssignAccountRole, error)
    public AssignAccountRole(string name, AssignAccountRoleArgs args, CustomResourceOptions? opts = null)
    public AssignAccountRole(String name, AssignAccountRoleArgs args)
    public AssignAccountRole(String name, AssignAccountRoleArgs args, CustomResourceOptions options)
    
    type: zenduty:AssignAccountRole
    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 AssignAccountRoleArgs
    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 AssignAccountRoleArgs
    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 AssignAccountRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AssignAccountRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AssignAccountRoleArgs
    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 assignAccountRoleResource = new Zenduty.AssignAccountRole("assignAccountRoleResource", new()
    {
        AccountRole = "string",
        Username = "string",
        AssignAccountRoleId = "string",
    });
    
    example, err := zenduty.NewAssignAccountRole(ctx, "assignAccountRoleResource", &zenduty.AssignAccountRoleArgs{
    AccountRole: pulumi.String("string"),
    Username: pulumi.String("string"),
    AssignAccountRoleId: pulumi.String("string"),
    })
    
    var assignAccountRoleResource = new AssignAccountRole("assignAccountRoleResource", AssignAccountRoleArgs.builder()
        .accountRole("string")
        .username("string")
        .assignAccountRoleId("string")
        .build());
    
    assign_account_role_resource = zenduty.AssignAccountRole("assignAccountRoleResource",
        account_role="string",
        username="string",
        assign_account_role_id="string")
    
    const assignAccountRoleResource = new zenduty.AssignAccountRole("assignAccountRoleResource", {
        accountRole: "string",
        username: "string",
        assignAccountRoleId: "string",
    });
    
    type: zenduty:AssignAccountRole
    properties:
        accountRole: string
        assignAccountRoleId: string
        username: string
    

    AssignAccountRole 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 AssignAccountRole resource accepts the following input properties:

    AccountRole string
    UniqueID of the AccountRole
    Username string
    Username of the User
    AssignAccountRoleId string
    AccountRole string
    UniqueID of the AccountRole
    Username string
    Username of the User
    AssignAccountRoleId string
    accountRole String
    UniqueID of the AccountRole
    username String
    Username of the User
    assignAccountRoleId String
    accountRole string
    UniqueID of the AccountRole
    username string
    Username of the User
    assignAccountRoleId string
    account_role str
    UniqueID of the AccountRole
    username str
    Username of the User
    assign_account_role_id str
    accountRole String
    UniqueID of the AccountRole
    username String
    Username of the User
    assignAccountRoleId String

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AssignAccountRole 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 AssignAccountRole Resource

    Get an existing AssignAccountRole 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?: AssignAccountRoleState, opts?: CustomResourceOptions): AssignAccountRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_role: Optional[str] = None,
            assign_account_role_id: Optional[str] = None,
            username: Optional[str] = None) -> AssignAccountRole
    func GetAssignAccountRole(ctx *Context, name string, id IDInput, state *AssignAccountRoleState, opts ...ResourceOption) (*AssignAccountRole, error)
    public static AssignAccountRole Get(string name, Input<string> id, AssignAccountRoleState? state, CustomResourceOptions? opts = null)
    public static AssignAccountRole get(String name, Output<String> id, AssignAccountRoleState state, CustomResourceOptions options)
    resources:  _:    type: zenduty:AssignAccountRole    get:      id: ${id}
    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:
    AccountRole string
    UniqueID of the AccountRole
    AssignAccountRoleId string
    Username string
    Username of the User
    AccountRole string
    UniqueID of the AccountRole
    AssignAccountRoleId string
    Username string
    Username of the User
    accountRole String
    UniqueID of the AccountRole
    assignAccountRoleId String
    username String
    Username of the User
    accountRole string
    UniqueID of the AccountRole
    assignAccountRoleId string
    username string
    Username of the User
    account_role str
    UniqueID of the AccountRole
    assign_account_role_id str
    username str
    Username of the User
    accountRole String
    UniqueID of the AccountRole
    assignAccountRoleId String
    username String
    Username of the User

    Package Details

    Repository
    zenduty zenduty/terraform-provider-zenduty
    License
    Notes
    This Pulumi package is based on the zenduty Terraform Provider.
    zenduty logo
    zenduty 0.2.6 published on Wednesday, Jan 15, 2025 by zenduty