github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/quicksight/user.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package quicksight
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Resource for managing QuickSight User
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/quicksight"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := quicksight.NewUser(ctx, "example", &quicksight.UserArgs{
    33  //				SessionName:  pulumi.String("an-author"),
    34  //				Email:        pulumi.String("author@example.com"),
    35  //				Namespace:    pulumi.String("foo"),
    36  //				IdentityType: pulumi.String("IAM"),
    37  //				IamArn:       pulumi.String("arn:aws:iam::123456789012:user/Example"),
    38  //				UserRole:     pulumi.String("AUTHOR"),
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			return nil
    44  //		})
    45  //	}
    46  //
    47  // ```
    48  // <!--End PulumiCodeChooser -->
    49  //
    50  // ## Import
    51  //
    52  // You cannot import this resource.
    53  type User struct {
    54  	pulumi.CustomResourceState
    55  
    56  	// Amazon Resource Name (ARN) of the user
    57  	Arn pulumi.StringOutput `pulumi:"arn"`
    58  	// The ID for the AWS account that the user is in. Currently, you use the ID for the AWS account that contains your Amazon QuickSight account.
    59  	AwsAccountId pulumi.StringOutput `pulumi:"awsAccountId"`
    60  	// The email address of the user that you want to register.
    61  	Email pulumi.StringOutput `pulumi:"email"`
    62  	// The ARN of the IAM user or role that you are registering with Amazon QuickSight.
    63  	IamArn pulumi.StringPtrOutput `pulumi:"iamArn"`
    64  	// Amazon QuickSight supports several ways of managing the identity of users. This parameter accepts either  `IAM` or `QUICKSIGHT`. If `IAM` is specified, the `iamArn` must also be specified.
    65  	IdentityType pulumi.StringOutput `pulumi:"identityType"`
    66  	// The Amazon Quicksight namespace to create the user in. Defaults to `default`.
    67  	Namespace pulumi.StringPtrOutput `pulumi:"namespace"`
    68  	// The name of the IAM session to use when assuming roles that can embed QuickSight dashboards. Only valid for registering users using an assumed IAM role. Additionally, if registering multiple users using the same IAM role, each user needs to have a unique session name.
    69  	SessionName pulumi.StringPtrOutput `pulumi:"sessionName"`
    70  	// The Amazon QuickSight user name that you want to create for the user you are registering. Only valid for registering a user with `identityType` set to `QUICKSIGHT`.
    71  	UserName pulumi.StringPtrOutput `pulumi:"userName"`
    72  	// The Amazon QuickSight role of the user. The user role can be one of the following: `READER`, `AUTHOR`, or `ADMIN`
    73  	UserRole pulumi.StringOutput `pulumi:"userRole"`
    74  }
    75  
    76  // NewUser registers a new resource with the given unique name, arguments, and options.
    77  func NewUser(ctx *pulumi.Context,
    78  	name string, args *UserArgs, opts ...pulumi.ResourceOption) (*User, error) {
    79  	if args == nil {
    80  		return nil, errors.New("missing one or more required arguments")
    81  	}
    82  
    83  	if args.Email == nil {
    84  		return nil, errors.New("invalid value for required argument 'Email'")
    85  	}
    86  	if args.IdentityType == nil {
    87  		return nil, errors.New("invalid value for required argument 'IdentityType'")
    88  	}
    89  	if args.UserRole == nil {
    90  		return nil, errors.New("invalid value for required argument 'UserRole'")
    91  	}
    92  	opts = internal.PkgResourceDefaultOpts(opts)
    93  	var resource User
    94  	err := ctx.RegisterResource("aws:quicksight/user:User", name, args, &resource, opts...)
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	return &resource, nil
    99  }
   100  
   101  // GetUser gets an existing User resource's state with the given name, ID, and optional
   102  // state properties that are used to uniquely qualify the lookup (nil if not required).
   103  func GetUser(ctx *pulumi.Context,
   104  	name string, id pulumi.IDInput, state *UserState, opts ...pulumi.ResourceOption) (*User, error) {
   105  	var resource User
   106  	err := ctx.ReadResource("aws:quicksight/user:User", name, id, state, &resource, opts...)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	return &resource, nil
   111  }
   112  
   113  // Input properties used for looking up and filtering User resources.
   114  type userState struct {
   115  	// Amazon Resource Name (ARN) of the user
   116  	Arn *string `pulumi:"arn"`
   117  	// The ID for the AWS account that the user is in. Currently, you use the ID for the AWS account that contains your Amazon QuickSight account.
   118  	AwsAccountId *string `pulumi:"awsAccountId"`
   119  	// The email address of the user that you want to register.
   120  	Email *string `pulumi:"email"`
   121  	// The ARN of the IAM user or role that you are registering with Amazon QuickSight.
   122  	IamArn *string `pulumi:"iamArn"`
   123  	// Amazon QuickSight supports several ways of managing the identity of users. This parameter accepts either  `IAM` or `QUICKSIGHT`. If `IAM` is specified, the `iamArn` must also be specified.
   124  	IdentityType *string `pulumi:"identityType"`
   125  	// The Amazon Quicksight namespace to create the user in. Defaults to `default`.
   126  	Namespace *string `pulumi:"namespace"`
   127  	// The name of the IAM session to use when assuming roles that can embed QuickSight dashboards. Only valid for registering users using an assumed IAM role. Additionally, if registering multiple users using the same IAM role, each user needs to have a unique session name.
   128  	SessionName *string `pulumi:"sessionName"`
   129  	// The Amazon QuickSight user name that you want to create for the user you are registering. Only valid for registering a user with `identityType` set to `QUICKSIGHT`.
   130  	UserName *string `pulumi:"userName"`
   131  	// The Amazon QuickSight role of the user. The user role can be one of the following: `READER`, `AUTHOR`, or `ADMIN`
   132  	UserRole *string `pulumi:"userRole"`
   133  }
   134  
   135  type UserState struct {
   136  	// Amazon Resource Name (ARN) of the user
   137  	Arn pulumi.StringPtrInput
   138  	// The ID for the AWS account that the user is in. Currently, you use the ID for the AWS account that contains your Amazon QuickSight account.
   139  	AwsAccountId pulumi.StringPtrInput
   140  	// The email address of the user that you want to register.
   141  	Email pulumi.StringPtrInput
   142  	// The ARN of the IAM user or role that you are registering with Amazon QuickSight.
   143  	IamArn pulumi.StringPtrInput
   144  	// Amazon QuickSight supports several ways of managing the identity of users. This parameter accepts either  `IAM` or `QUICKSIGHT`. If `IAM` is specified, the `iamArn` must also be specified.
   145  	IdentityType pulumi.StringPtrInput
   146  	// The Amazon Quicksight namespace to create the user in. Defaults to `default`.
   147  	Namespace pulumi.StringPtrInput
   148  	// The name of the IAM session to use when assuming roles that can embed QuickSight dashboards. Only valid for registering users using an assumed IAM role. Additionally, if registering multiple users using the same IAM role, each user needs to have a unique session name.
   149  	SessionName pulumi.StringPtrInput
   150  	// The Amazon QuickSight user name that you want to create for the user you are registering. Only valid for registering a user with `identityType` set to `QUICKSIGHT`.
   151  	UserName pulumi.StringPtrInput
   152  	// The Amazon QuickSight role of the user. The user role can be one of the following: `READER`, `AUTHOR`, or `ADMIN`
   153  	UserRole pulumi.StringPtrInput
   154  }
   155  
   156  func (UserState) ElementType() reflect.Type {
   157  	return reflect.TypeOf((*userState)(nil)).Elem()
   158  }
   159  
   160  type userArgs struct {
   161  	// The ID for the AWS account that the user is in. Currently, you use the ID for the AWS account that contains your Amazon QuickSight account.
   162  	AwsAccountId *string `pulumi:"awsAccountId"`
   163  	// The email address of the user that you want to register.
   164  	Email string `pulumi:"email"`
   165  	// The ARN of the IAM user or role that you are registering with Amazon QuickSight.
   166  	IamArn *string `pulumi:"iamArn"`
   167  	// Amazon QuickSight supports several ways of managing the identity of users. This parameter accepts either  `IAM` or `QUICKSIGHT`. If `IAM` is specified, the `iamArn` must also be specified.
   168  	IdentityType string `pulumi:"identityType"`
   169  	// The Amazon Quicksight namespace to create the user in. Defaults to `default`.
   170  	Namespace *string `pulumi:"namespace"`
   171  	// The name of the IAM session to use when assuming roles that can embed QuickSight dashboards. Only valid for registering users using an assumed IAM role. Additionally, if registering multiple users using the same IAM role, each user needs to have a unique session name.
   172  	SessionName *string `pulumi:"sessionName"`
   173  	// The Amazon QuickSight user name that you want to create for the user you are registering. Only valid for registering a user with `identityType` set to `QUICKSIGHT`.
   174  	UserName *string `pulumi:"userName"`
   175  	// The Amazon QuickSight role of the user. The user role can be one of the following: `READER`, `AUTHOR`, or `ADMIN`
   176  	UserRole string `pulumi:"userRole"`
   177  }
   178  
   179  // The set of arguments for constructing a User resource.
   180  type UserArgs struct {
   181  	// The ID for the AWS account that the user is in. Currently, you use the ID for the AWS account that contains your Amazon QuickSight account.
   182  	AwsAccountId pulumi.StringPtrInput
   183  	// The email address of the user that you want to register.
   184  	Email pulumi.StringInput
   185  	// The ARN of the IAM user or role that you are registering with Amazon QuickSight.
   186  	IamArn pulumi.StringPtrInput
   187  	// Amazon QuickSight supports several ways of managing the identity of users. This parameter accepts either  `IAM` or `QUICKSIGHT`. If `IAM` is specified, the `iamArn` must also be specified.
   188  	IdentityType pulumi.StringInput
   189  	// The Amazon Quicksight namespace to create the user in. Defaults to `default`.
   190  	Namespace pulumi.StringPtrInput
   191  	// The name of the IAM session to use when assuming roles that can embed QuickSight dashboards. Only valid for registering users using an assumed IAM role. Additionally, if registering multiple users using the same IAM role, each user needs to have a unique session name.
   192  	SessionName pulumi.StringPtrInput
   193  	// The Amazon QuickSight user name that you want to create for the user you are registering. Only valid for registering a user with `identityType` set to `QUICKSIGHT`.
   194  	UserName pulumi.StringPtrInput
   195  	// The Amazon QuickSight role of the user. The user role can be one of the following: `READER`, `AUTHOR`, or `ADMIN`
   196  	UserRole pulumi.StringInput
   197  }
   198  
   199  func (UserArgs) ElementType() reflect.Type {
   200  	return reflect.TypeOf((*userArgs)(nil)).Elem()
   201  }
   202  
   203  type UserInput interface {
   204  	pulumi.Input
   205  
   206  	ToUserOutput() UserOutput
   207  	ToUserOutputWithContext(ctx context.Context) UserOutput
   208  }
   209  
   210  func (*User) ElementType() reflect.Type {
   211  	return reflect.TypeOf((**User)(nil)).Elem()
   212  }
   213  
   214  func (i *User) ToUserOutput() UserOutput {
   215  	return i.ToUserOutputWithContext(context.Background())
   216  }
   217  
   218  func (i *User) ToUserOutputWithContext(ctx context.Context) UserOutput {
   219  	return pulumi.ToOutputWithContext(ctx, i).(UserOutput)
   220  }
   221  
   222  // UserArrayInput is an input type that accepts UserArray and UserArrayOutput values.
   223  // You can construct a concrete instance of `UserArrayInput` via:
   224  //
   225  //	UserArray{ UserArgs{...} }
   226  type UserArrayInput interface {
   227  	pulumi.Input
   228  
   229  	ToUserArrayOutput() UserArrayOutput
   230  	ToUserArrayOutputWithContext(context.Context) UserArrayOutput
   231  }
   232  
   233  type UserArray []UserInput
   234  
   235  func (UserArray) ElementType() reflect.Type {
   236  	return reflect.TypeOf((*[]*User)(nil)).Elem()
   237  }
   238  
   239  func (i UserArray) ToUserArrayOutput() UserArrayOutput {
   240  	return i.ToUserArrayOutputWithContext(context.Background())
   241  }
   242  
   243  func (i UserArray) ToUserArrayOutputWithContext(ctx context.Context) UserArrayOutput {
   244  	return pulumi.ToOutputWithContext(ctx, i).(UserArrayOutput)
   245  }
   246  
   247  // UserMapInput is an input type that accepts UserMap and UserMapOutput values.
   248  // You can construct a concrete instance of `UserMapInput` via:
   249  //
   250  //	UserMap{ "key": UserArgs{...} }
   251  type UserMapInput interface {
   252  	pulumi.Input
   253  
   254  	ToUserMapOutput() UserMapOutput
   255  	ToUserMapOutputWithContext(context.Context) UserMapOutput
   256  }
   257  
   258  type UserMap map[string]UserInput
   259  
   260  func (UserMap) ElementType() reflect.Type {
   261  	return reflect.TypeOf((*map[string]*User)(nil)).Elem()
   262  }
   263  
   264  func (i UserMap) ToUserMapOutput() UserMapOutput {
   265  	return i.ToUserMapOutputWithContext(context.Background())
   266  }
   267  
   268  func (i UserMap) ToUserMapOutputWithContext(ctx context.Context) UserMapOutput {
   269  	return pulumi.ToOutputWithContext(ctx, i).(UserMapOutput)
   270  }
   271  
   272  type UserOutput struct{ *pulumi.OutputState }
   273  
   274  func (UserOutput) ElementType() reflect.Type {
   275  	return reflect.TypeOf((**User)(nil)).Elem()
   276  }
   277  
   278  func (o UserOutput) ToUserOutput() UserOutput {
   279  	return o
   280  }
   281  
   282  func (o UserOutput) ToUserOutputWithContext(ctx context.Context) UserOutput {
   283  	return o
   284  }
   285  
   286  // Amazon Resource Name (ARN) of the user
   287  func (o UserOutput) Arn() pulumi.StringOutput {
   288  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   289  }
   290  
   291  // The ID for the AWS account that the user is in. Currently, you use the ID for the AWS account that contains your Amazon QuickSight account.
   292  func (o UserOutput) AwsAccountId() pulumi.StringOutput {
   293  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.AwsAccountId }).(pulumi.StringOutput)
   294  }
   295  
   296  // The email address of the user that you want to register.
   297  func (o UserOutput) Email() pulumi.StringOutput {
   298  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.Email }).(pulumi.StringOutput)
   299  }
   300  
   301  // The ARN of the IAM user or role that you are registering with Amazon QuickSight.
   302  func (o UserOutput) IamArn() pulumi.StringPtrOutput {
   303  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.IamArn }).(pulumi.StringPtrOutput)
   304  }
   305  
   306  // Amazon QuickSight supports several ways of managing the identity of users. This parameter accepts either  `IAM` or `QUICKSIGHT`. If `IAM` is specified, the `iamArn` must also be specified.
   307  func (o UserOutput) IdentityType() pulumi.StringOutput {
   308  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.IdentityType }).(pulumi.StringOutput)
   309  }
   310  
   311  // The Amazon Quicksight namespace to create the user in. Defaults to `default`.
   312  func (o UserOutput) Namespace() pulumi.StringPtrOutput {
   313  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.Namespace }).(pulumi.StringPtrOutput)
   314  }
   315  
   316  // The name of the IAM session to use when assuming roles that can embed QuickSight dashboards. Only valid for registering users using an assumed IAM role. Additionally, if registering multiple users using the same IAM role, each user needs to have a unique session name.
   317  func (o UserOutput) SessionName() pulumi.StringPtrOutput {
   318  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.SessionName }).(pulumi.StringPtrOutput)
   319  }
   320  
   321  // The Amazon QuickSight user name that you want to create for the user you are registering. Only valid for registering a user with `identityType` set to `QUICKSIGHT`.
   322  func (o UserOutput) UserName() pulumi.StringPtrOutput {
   323  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.UserName }).(pulumi.StringPtrOutput)
   324  }
   325  
   326  // The Amazon QuickSight role of the user. The user role can be one of the following: `READER`, `AUTHOR`, or `ADMIN`
   327  func (o UserOutput) UserRole() pulumi.StringOutput {
   328  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.UserRole }).(pulumi.StringOutput)
   329  }
   330  
   331  type UserArrayOutput struct{ *pulumi.OutputState }
   332  
   333  func (UserArrayOutput) ElementType() reflect.Type {
   334  	return reflect.TypeOf((*[]*User)(nil)).Elem()
   335  }
   336  
   337  func (o UserArrayOutput) ToUserArrayOutput() UserArrayOutput {
   338  	return o
   339  }
   340  
   341  func (o UserArrayOutput) ToUserArrayOutputWithContext(ctx context.Context) UserArrayOutput {
   342  	return o
   343  }
   344  
   345  func (o UserArrayOutput) Index(i pulumi.IntInput) UserOutput {
   346  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *User {
   347  		return vs[0].([]*User)[vs[1].(int)]
   348  	}).(UserOutput)
   349  }
   350  
   351  type UserMapOutput struct{ *pulumi.OutputState }
   352  
   353  func (UserMapOutput) ElementType() reflect.Type {
   354  	return reflect.TypeOf((*map[string]*User)(nil)).Elem()
   355  }
   356  
   357  func (o UserMapOutput) ToUserMapOutput() UserMapOutput {
   358  	return o
   359  }
   360  
   361  func (o UserMapOutput) ToUserMapOutputWithContext(ctx context.Context) UserMapOutput {
   362  	return o
   363  }
   364  
   365  func (o UserMapOutput) MapIndex(k pulumi.StringInput) UserOutput {
   366  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *User {
   367  		return vs[0].(map[string]*User)[vs[1].(string)]
   368  	}).(UserOutput)
   369  }
   370  
   371  func init() {
   372  	pulumi.RegisterInputType(reflect.TypeOf((*UserInput)(nil)).Elem(), &User{})
   373  	pulumi.RegisterInputType(reflect.TypeOf((*UserArrayInput)(nil)).Elem(), UserArray{})
   374  	pulumi.RegisterInputType(reflect.TypeOf((*UserMapInput)(nil)).Elem(), UserMap{})
   375  	pulumi.RegisterOutputType(UserOutput{})
   376  	pulumi.RegisterOutputType(UserArrayOutput{})
   377  	pulumi.RegisterOutputType(UserMapOutput{})
   378  }