github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/appstream/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 appstream
     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  // Provides an AppStream 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/appstream"
    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 := appstream.NewUser(ctx, "example", &appstream.UserArgs{
    33  //				AuthenticationType: pulumi.String("USERPOOL"),
    34  //				UserName:           pulumi.String("EMAIL"),
    35  //				FirstName:          pulumi.String("FIRST NAME"),
    36  //				LastName:           pulumi.String("LAST NAME"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import `aws_appstream_user` using the `user_name` and `authentication_type` separated by a slash (`/`). For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:appstream/user:User example UserName/AuthenticationType
    54  // ```
    55  type User struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// ARN of the appstream user.
    59  	Arn pulumi.StringOutput `pulumi:"arn"`
    60  	// Authentication type for the user. You must specify USERPOOL. Valid values: `API`, `SAML`, `USERPOOL`
    61  	AuthenticationType pulumi.StringOutput `pulumi:"authenticationType"`
    62  	// Date and time, in UTC and extended RFC 3339 format, when the user was created.
    63  	CreatedTime pulumi.StringOutput `pulumi:"createdTime"`
    64  	// Whether the user in the user pool is enabled.
    65  	Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
    66  	// First name, or given name, of the user.
    67  	FirstName pulumi.StringPtrOutput `pulumi:"firstName"`
    68  	// Last name, or surname, of the user.
    69  	LastName pulumi.StringPtrOutput `pulumi:"lastName"`
    70  	// Send an email notification.
    71  	SendEmailNotification pulumi.BoolPtrOutput `pulumi:"sendEmailNotification"`
    72  	// Email address of the user.
    73  	//
    74  	// The following arguments are optional:
    75  	UserName pulumi.StringOutput `pulumi:"userName"`
    76  }
    77  
    78  // NewUser registers a new resource with the given unique name, arguments, and options.
    79  func NewUser(ctx *pulumi.Context,
    80  	name string, args *UserArgs, opts ...pulumi.ResourceOption) (*User, error) {
    81  	if args == nil {
    82  		return nil, errors.New("missing one or more required arguments")
    83  	}
    84  
    85  	if args.AuthenticationType == nil {
    86  		return nil, errors.New("invalid value for required argument 'AuthenticationType'")
    87  	}
    88  	if args.UserName == nil {
    89  		return nil, errors.New("invalid value for required argument 'UserName'")
    90  	}
    91  	opts = internal.PkgResourceDefaultOpts(opts)
    92  	var resource User
    93  	err := ctx.RegisterResource("aws:appstream/user:User", name, args, &resource, opts...)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	return &resource, nil
    98  }
    99  
   100  // GetUser gets an existing User resource's state with the given name, ID, and optional
   101  // state properties that are used to uniquely qualify the lookup (nil if not required).
   102  func GetUser(ctx *pulumi.Context,
   103  	name string, id pulumi.IDInput, state *UserState, opts ...pulumi.ResourceOption) (*User, error) {
   104  	var resource User
   105  	err := ctx.ReadResource("aws:appstream/user:User", name, id, state, &resource, opts...)
   106  	if err != nil {
   107  		return nil, err
   108  	}
   109  	return &resource, nil
   110  }
   111  
   112  // Input properties used for looking up and filtering User resources.
   113  type userState struct {
   114  	// ARN of the appstream user.
   115  	Arn *string `pulumi:"arn"`
   116  	// Authentication type for the user. You must specify USERPOOL. Valid values: `API`, `SAML`, `USERPOOL`
   117  	AuthenticationType *string `pulumi:"authenticationType"`
   118  	// Date and time, in UTC and extended RFC 3339 format, when the user was created.
   119  	CreatedTime *string `pulumi:"createdTime"`
   120  	// Whether the user in the user pool is enabled.
   121  	Enabled *bool `pulumi:"enabled"`
   122  	// First name, or given name, of the user.
   123  	FirstName *string `pulumi:"firstName"`
   124  	// Last name, or surname, of the user.
   125  	LastName *string `pulumi:"lastName"`
   126  	// Send an email notification.
   127  	SendEmailNotification *bool `pulumi:"sendEmailNotification"`
   128  	// Email address of the user.
   129  	//
   130  	// The following arguments are optional:
   131  	UserName *string `pulumi:"userName"`
   132  }
   133  
   134  type UserState struct {
   135  	// ARN of the appstream user.
   136  	Arn pulumi.StringPtrInput
   137  	// Authentication type for the user. You must specify USERPOOL. Valid values: `API`, `SAML`, `USERPOOL`
   138  	AuthenticationType pulumi.StringPtrInput
   139  	// Date and time, in UTC and extended RFC 3339 format, when the user was created.
   140  	CreatedTime pulumi.StringPtrInput
   141  	// Whether the user in the user pool is enabled.
   142  	Enabled pulumi.BoolPtrInput
   143  	// First name, or given name, of the user.
   144  	FirstName pulumi.StringPtrInput
   145  	// Last name, or surname, of the user.
   146  	LastName pulumi.StringPtrInput
   147  	// Send an email notification.
   148  	SendEmailNotification pulumi.BoolPtrInput
   149  	// Email address of the user.
   150  	//
   151  	// The following arguments are optional:
   152  	UserName pulumi.StringPtrInput
   153  }
   154  
   155  func (UserState) ElementType() reflect.Type {
   156  	return reflect.TypeOf((*userState)(nil)).Elem()
   157  }
   158  
   159  type userArgs struct {
   160  	// Authentication type for the user. You must specify USERPOOL. Valid values: `API`, `SAML`, `USERPOOL`
   161  	AuthenticationType string `pulumi:"authenticationType"`
   162  	// Whether the user in the user pool is enabled.
   163  	Enabled *bool `pulumi:"enabled"`
   164  	// First name, or given name, of the user.
   165  	FirstName *string `pulumi:"firstName"`
   166  	// Last name, or surname, of the user.
   167  	LastName *string `pulumi:"lastName"`
   168  	// Send an email notification.
   169  	SendEmailNotification *bool `pulumi:"sendEmailNotification"`
   170  	// Email address of the user.
   171  	//
   172  	// The following arguments are optional:
   173  	UserName string `pulumi:"userName"`
   174  }
   175  
   176  // The set of arguments for constructing a User resource.
   177  type UserArgs struct {
   178  	// Authentication type for the user. You must specify USERPOOL. Valid values: `API`, `SAML`, `USERPOOL`
   179  	AuthenticationType pulumi.StringInput
   180  	// Whether the user in the user pool is enabled.
   181  	Enabled pulumi.BoolPtrInput
   182  	// First name, or given name, of the user.
   183  	FirstName pulumi.StringPtrInput
   184  	// Last name, or surname, of the user.
   185  	LastName pulumi.StringPtrInput
   186  	// Send an email notification.
   187  	SendEmailNotification pulumi.BoolPtrInput
   188  	// Email address of the user.
   189  	//
   190  	// The following arguments are optional:
   191  	UserName pulumi.StringInput
   192  }
   193  
   194  func (UserArgs) ElementType() reflect.Type {
   195  	return reflect.TypeOf((*userArgs)(nil)).Elem()
   196  }
   197  
   198  type UserInput interface {
   199  	pulumi.Input
   200  
   201  	ToUserOutput() UserOutput
   202  	ToUserOutputWithContext(ctx context.Context) UserOutput
   203  }
   204  
   205  func (*User) ElementType() reflect.Type {
   206  	return reflect.TypeOf((**User)(nil)).Elem()
   207  }
   208  
   209  func (i *User) ToUserOutput() UserOutput {
   210  	return i.ToUserOutputWithContext(context.Background())
   211  }
   212  
   213  func (i *User) ToUserOutputWithContext(ctx context.Context) UserOutput {
   214  	return pulumi.ToOutputWithContext(ctx, i).(UserOutput)
   215  }
   216  
   217  // UserArrayInput is an input type that accepts UserArray and UserArrayOutput values.
   218  // You can construct a concrete instance of `UserArrayInput` via:
   219  //
   220  //	UserArray{ UserArgs{...} }
   221  type UserArrayInput interface {
   222  	pulumi.Input
   223  
   224  	ToUserArrayOutput() UserArrayOutput
   225  	ToUserArrayOutputWithContext(context.Context) UserArrayOutput
   226  }
   227  
   228  type UserArray []UserInput
   229  
   230  func (UserArray) ElementType() reflect.Type {
   231  	return reflect.TypeOf((*[]*User)(nil)).Elem()
   232  }
   233  
   234  func (i UserArray) ToUserArrayOutput() UserArrayOutput {
   235  	return i.ToUserArrayOutputWithContext(context.Background())
   236  }
   237  
   238  func (i UserArray) ToUserArrayOutputWithContext(ctx context.Context) UserArrayOutput {
   239  	return pulumi.ToOutputWithContext(ctx, i).(UserArrayOutput)
   240  }
   241  
   242  // UserMapInput is an input type that accepts UserMap and UserMapOutput values.
   243  // You can construct a concrete instance of `UserMapInput` via:
   244  //
   245  //	UserMap{ "key": UserArgs{...} }
   246  type UserMapInput interface {
   247  	pulumi.Input
   248  
   249  	ToUserMapOutput() UserMapOutput
   250  	ToUserMapOutputWithContext(context.Context) UserMapOutput
   251  }
   252  
   253  type UserMap map[string]UserInput
   254  
   255  func (UserMap) ElementType() reflect.Type {
   256  	return reflect.TypeOf((*map[string]*User)(nil)).Elem()
   257  }
   258  
   259  func (i UserMap) ToUserMapOutput() UserMapOutput {
   260  	return i.ToUserMapOutputWithContext(context.Background())
   261  }
   262  
   263  func (i UserMap) ToUserMapOutputWithContext(ctx context.Context) UserMapOutput {
   264  	return pulumi.ToOutputWithContext(ctx, i).(UserMapOutput)
   265  }
   266  
   267  type UserOutput struct{ *pulumi.OutputState }
   268  
   269  func (UserOutput) ElementType() reflect.Type {
   270  	return reflect.TypeOf((**User)(nil)).Elem()
   271  }
   272  
   273  func (o UserOutput) ToUserOutput() UserOutput {
   274  	return o
   275  }
   276  
   277  func (o UserOutput) ToUserOutputWithContext(ctx context.Context) UserOutput {
   278  	return o
   279  }
   280  
   281  // ARN of the appstream user.
   282  func (o UserOutput) Arn() pulumi.StringOutput {
   283  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   284  }
   285  
   286  // Authentication type for the user. You must specify USERPOOL. Valid values: `API`, `SAML`, `USERPOOL`
   287  func (o UserOutput) AuthenticationType() pulumi.StringOutput {
   288  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.AuthenticationType }).(pulumi.StringOutput)
   289  }
   290  
   291  // Date and time, in UTC and extended RFC 3339 format, when the user was created.
   292  func (o UserOutput) CreatedTime() pulumi.StringOutput {
   293  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.CreatedTime }).(pulumi.StringOutput)
   294  }
   295  
   296  // Whether the user in the user pool is enabled.
   297  func (o UserOutput) Enabled() pulumi.BoolPtrOutput {
   298  	return o.ApplyT(func(v *User) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
   299  }
   300  
   301  // First name, or given name, of the user.
   302  func (o UserOutput) FirstName() pulumi.StringPtrOutput {
   303  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.FirstName }).(pulumi.StringPtrOutput)
   304  }
   305  
   306  // Last name, or surname, of the user.
   307  func (o UserOutput) LastName() pulumi.StringPtrOutput {
   308  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.LastName }).(pulumi.StringPtrOutput)
   309  }
   310  
   311  // Send an email notification.
   312  func (o UserOutput) SendEmailNotification() pulumi.BoolPtrOutput {
   313  	return o.ApplyT(func(v *User) pulumi.BoolPtrOutput { return v.SendEmailNotification }).(pulumi.BoolPtrOutput)
   314  }
   315  
   316  // Email address of the user.
   317  //
   318  // The following arguments are optional:
   319  func (o UserOutput) UserName() pulumi.StringOutput {
   320  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput)
   321  }
   322  
   323  type UserArrayOutput struct{ *pulumi.OutputState }
   324  
   325  func (UserArrayOutput) ElementType() reflect.Type {
   326  	return reflect.TypeOf((*[]*User)(nil)).Elem()
   327  }
   328  
   329  func (o UserArrayOutput) ToUserArrayOutput() UserArrayOutput {
   330  	return o
   331  }
   332  
   333  func (o UserArrayOutput) ToUserArrayOutputWithContext(ctx context.Context) UserArrayOutput {
   334  	return o
   335  }
   336  
   337  func (o UserArrayOutput) Index(i pulumi.IntInput) UserOutput {
   338  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *User {
   339  		return vs[0].([]*User)[vs[1].(int)]
   340  	}).(UserOutput)
   341  }
   342  
   343  type UserMapOutput struct{ *pulumi.OutputState }
   344  
   345  func (UserMapOutput) ElementType() reflect.Type {
   346  	return reflect.TypeOf((*map[string]*User)(nil)).Elem()
   347  }
   348  
   349  func (o UserMapOutput) ToUserMapOutput() UserMapOutput {
   350  	return o
   351  }
   352  
   353  func (o UserMapOutput) ToUserMapOutputWithContext(ctx context.Context) UserMapOutput {
   354  	return o
   355  }
   356  
   357  func (o UserMapOutput) MapIndex(k pulumi.StringInput) UserOutput {
   358  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *User {
   359  		return vs[0].(map[string]*User)[vs[1].(string)]
   360  	}).(UserOutput)
   361  }
   362  
   363  func init() {
   364  	pulumi.RegisterInputType(reflect.TypeOf((*UserInput)(nil)).Elem(), &User{})
   365  	pulumi.RegisterInputType(reflect.TypeOf((*UserArrayInput)(nil)).Elem(), UserArray{})
   366  	pulumi.RegisterInputType(reflect.TypeOf((*UserMapInput)(nil)).Elem(), UserMap{})
   367  	pulumi.RegisterOutputType(UserOutput{})
   368  	pulumi.RegisterOutputType(UserArrayOutput{})
   369  	pulumi.RegisterOutputType(UserMapOutput{})
   370  }