github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/identitystore/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 identitystore
     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  // This resource manages a User resource within an Identity Store.
    16  //
    17  // > **Note:** If you use an external identity provider or Active Directory as your identity source,
    18  // use this resource with caution. IAM Identity Center does not support outbound synchronization,
    19  // so your identity source does not automatically update with the changes that you make to
    20  // users using this resource.
    21  //
    22  // ## Example Usage
    23  //
    24  // ## Import
    25  //
    26  // Using `pulumi import`, import an Identity Store User using the combination `identity_store_id/user_id`. For example:
    27  //
    28  // ```sh
    29  // $ pulumi import aws:identitystore/user:User example d-9c6705e95c/065212b4-9061-703b-5876-13a517ae2a7c
    30  // ```
    31  type User struct {
    32  	pulumi.CustomResourceState
    33  
    34  	// Details about the user's address. At most 1 address is allowed. Detailed below.
    35  	Addresses UserAddressesPtrOutput `pulumi:"addresses"`
    36  	// The name that is typically displayed when the user is referenced.
    37  	DisplayName pulumi.StringOutput `pulumi:"displayName"`
    38  	// Details about the user's email. At most 1 email is allowed. Detailed below.
    39  	Emails UserEmailsPtrOutput `pulumi:"emails"`
    40  	// A list of identifiers issued to this resource by an external identity provider.
    41  	ExternalIds UserExternalIdArrayOutput `pulumi:"externalIds"`
    42  	// The globally unique identifier for the identity store that this user is in.
    43  	IdentityStoreId pulumi.StringOutput `pulumi:"identityStoreId"`
    44  	// The user's geographical region or location.
    45  	Locale pulumi.StringPtrOutput `pulumi:"locale"`
    46  	// Details about the user's full name. Detailed below.
    47  	Name UserNameOutput `pulumi:"name"`
    48  	// An alternate name for the user.
    49  	Nickname pulumi.StringPtrOutput `pulumi:"nickname"`
    50  	// Details about the user's phone number. At most 1 phone number is allowed. Detailed below.
    51  	PhoneNumbers UserPhoneNumbersPtrOutput `pulumi:"phoneNumbers"`
    52  	// The preferred language of the user.
    53  	PreferredLanguage pulumi.StringPtrOutput `pulumi:"preferredLanguage"`
    54  	// An URL that may be associated with the user.
    55  	ProfileUrl pulumi.StringPtrOutput `pulumi:"profileUrl"`
    56  	// The user's time zone.
    57  	Timezone pulumi.StringPtrOutput `pulumi:"timezone"`
    58  	// The user's title.
    59  	Title pulumi.StringPtrOutput `pulumi:"title"`
    60  	// The identifier for this user in the identity store.
    61  	UserId pulumi.StringOutput `pulumi:"userId"`
    62  	// A unique string used to identify the user. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. The limit is 128 characters.
    63  	//
    64  	// The following arguments are optional:
    65  	UserName pulumi.StringOutput `pulumi:"userName"`
    66  	// The user type.
    67  	UserType pulumi.StringPtrOutput `pulumi:"userType"`
    68  }
    69  
    70  // NewUser registers a new resource with the given unique name, arguments, and options.
    71  func NewUser(ctx *pulumi.Context,
    72  	name string, args *UserArgs, opts ...pulumi.ResourceOption) (*User, error) {
    73  	if args == nil {
    74  		return nil, errors.New("missing one or more required arguments")
    75  	}
    76  
    77  	if args.DisplayName == nil {
    78  		return nil, errors.New("invalid value for required argument 'DisplayName'")
    79  	}
    80  	if args.IdentityStoreId == nil {
    81  		return nil, errors.New("invalid value for required argument 'IdentityStoreId'")
    82  	}
    83  	if args.UserName == nil {
    84  		return nil, errors.New("invalid value for required argument 'UserName'")
    85  	}
    86  	opts = internal.PkgResourceDefaultOpts(opts)
    87  	var resource User
    88  	err := ctx.RegisterResource("aws:identitystore/user:User", name, args, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // GetUser gets an existing User resource's state with the given name, ID, and optional
    96  // state properties that are used to uniquely qualify the lookup (nil if not required).
    97  func GetUser(ctx *pulumi.Context,
    98  	name string, id pulumi.IDInput, state *UserState, opts ...pulumi.ResourceOption) (*User, error) {
    99  	var resource User
   100  	err := ctx.ReadResource("aws:identitystore/user:User", name, id, state, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // Input properties used for looking up and filtering User resources.
   108  type userState struct {
   109  	// Details about the user's address. At most 1 address is allowed. Detailed below.
   110  	Addresses *UserAddresses `pulumi:"addresses"`
   111  	// The name that is typically displayed when the user is referenced.
   112  	DisplayName *string `pulumi:"displayName"`
   113  	// Details about the user's email. At most 1 email is allowed. Detailed below.
   114  	Emails *UserEmails `pulumi:"emails"`
   115  	// A list of identifiers issued to this resource by an external identity provider.
   116  	ExternalIds []UserExternalId `pulumi:"externalIds"`
   117  	// The globally unique identifier for the identity store that this user is in.
   118  	IdentityStoreId *string `pulumi:"identityStoreId"`
   119  	// The user's geographical region or location.
   120  	Locale *string `pulumi:"locale"`
   121  	// Details about the user's full name. Detailed below.
   122  	Name *UserName `pulumi:"name"`
   123  	// An alternate name for the user.
   124  	Nickname *string `pulumi:"nickname"`
   125  	// Details about the user's phone number. At most 1 phone number is allowed. Detailed below.
   126  	PhoneNumbers *UserPhoneNumbers `pulumi:"phoneNumbers"`
   127  	// The preferred language of the user.
   128  	PreferredLanguage *string `pulumi:"preferredLanguage"`
   129  	// An URL that may be associated with the user.
   130  	ProfileUrl *string `pulumi:"profileUrl"`
   131  	// The user's time zone.
   132  	Timezone *string `pulumi:"timezone"`
   133  	// The user's title.
   134  	Title *string `pulumi:"title"`
   135  	// The identifier for this user in the identity store.
   136  	UserId *string `pulumi:"userId"`
   137  	// A unique string used to identify the user. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. The limit is 128 characters.
   138  	//
   139  	// The following arguments are optional:
   140  	UserName *string `pulumi:"userName"`
   141  	// The user type.
   142  	UserType *string `pulumi:"userType"`
   143  }
   144  
   145  type UserState struct {
   146  	// Details about the user's address. At most 1 address is allowed. Detailed below.
   147  	Addresses UserAddressesPtrInput
   148  	// The name that is typically displayed when the user is referenced.
   149  	DisplayName pulumi.StringPtrInput
   150  	// Details about the user's email. At most 1 email is allowed. Detailed below.
   151  	Emails UserEmailsPtrInput
   152  	// A list of identifiers issued to this resource by an external identity provider.
   153  	ExternalIds UserExternalIdArrayInput
   154  	// The globally unique identifier for the identity store that this user is in.
   155  	IdentityStoreId pulumi.StringPtrInput
   156  	// The user's geographical region or location.
   157  	Locale pulumi.StringPtrInput
   158  	// Details about the user's full name. Detailed below.
   159  	Name UserNamePtrInput
   160  	// An alternate name for the user.
   161  	Nickname pulumi.StringPtrInput
   162  	// Details about the user's phone number. At most 1 phone number is allowed. Detailed below.
   163  	PhoneNumbers UserPhoneNumbersPtrInput
   164  	// The preferred language of the user.
   165  	PreferredLanguage pulumi.StringPtrInput
   166  	// An URL that may be associated with the user.
   167  	ProfileUrl pulumi.StringPtrInput
   168  	// The user's time zone.
   169  	Timezone pulumi.StringPtrInput
   170  	// The user's title.
   171  	Title pulumi.StringPtrInput
   172  	// The identifier for this user in the identity store.
   173  	UserId pulumi.StringPtrInput
   174  	// A unique string used to identify the user. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. The limit is 128 characters.
   175  	//
   176  	// The following arguments are optional:
   177  	UserName pulumi.StringPtrInput
   178  	// The user type.
   179  	UserType pulumi.StringPtrInput
   180  }
   181  
   182  func (UserState) ElementType() reflect.Type {
   183  	return reflect.TypeOf((*userState)(nil)).Elem()
   184  }
   185  
   186  type userArgs struct {
   187  	// Details about the user's address. At most 1 address is allowed. Detailed below.
   188  	Addresses *UserAddresses `pulumi:"addresses"`
   189  	// The name that is typically displayed when the user is referenced.
   190  	DisplayName string `pulumi:"displayName"`
   191  	// Details about the user's email. At most 1 email is allowed. Detailed below.
   192  	Emails *UserEmails `pulumi:"emails"`
   193  	// The globally unique identifier for the identity store that this user is in.
   194  	IdentityStoreId string `pulumi:"identityStoreId"`
   195  	// The user's geographical region or location.
   196  	Locale *string `pulumi:"locale"`
   197  	// Details about the user's full name. Detailed below.
   198  	Name *UserName `pulumi:"name"`
   199  	// An alternate name for the user.
   200  	Nickname *string `pulumi:"nickname"`
   201  	// Details about the user's phone number. At most 1 phone number is allowed. Detailed below.
   202  	PhoneNumbers *UserPhoneNumbers `pulumi:"phoneNumbers"`
   203  	// The preferred language of the user.
   204  	PreferredLanguage *string `pulumi:"preferredLanguage"`
   205  	// An URL that may be associated with the user.
   206  	ProfileUrl *string `pulumi:"profileUrl"`
   207  	// The user's time zone.
   208  	Timezone *string `pulumi:"timezone"`
   209  	// The user's title.
   210  	Title *string `pulumi:"title"`
   211  	// A unique string used to identify the user. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. The limit is 128 characters.
   212  	//
   213  	// The following arguments are optional:
   214  	UserName string `pulumi:"userName"`
   215  	// The user type.
   216  	UserType *string `pulumi:"userType"`
   217  }
   218  
   219  // The set of arguments for constructing a User resource.
   220  type UserArgs struct {
   221  	// Details about the user's address. At most 1 address is allowed. Detailed below.
   222  	Addresses UserAddressesPtrInput
   223  	// The name that is typically displayed when the user is referenced.
   224  	DisplayName pulumi.StringInput
   225  	// Details about the user's email. At most 1 email is allowed. Detailed below.
   226  	Emails UserEmailsPtrInput
   227  	// The globally unique identifier for the identity store that this user is in.
   228  	IdentityStoreId pulumi.StringInput
   229  	// The user's geographical region or location.
   230  	Locale pulumi.StringPtrInput
   231  	// Details about the user's full name. Detailed below.
   232  	Name UserNamePtrInput
   233  	// An alternate name for the user.
   234  	Nickname pulumi.StringPtrInput
   235  	// Details about the user's phone number. At most 1 phone number is allowed. Detailed below.
   236  	PhoneNumbers UserPhoneNumbersPtrInput
   237  	// The preferred language of the user.
   238  	PreferredLanguage pulumi.StringPtrInput
   239  	// An URL that may be associated with the user.
   240  	ProfileUrl pulumi.StringPtrInput
   241  	// The user's time zone.
   242  	Timezone pulumi.StringPtrInput
   243  	// The user's title.
   244  	Title pulumi.StringPtrInput
   245  	// A unique string used to identify the user. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. The limit is 128 characters.
   246  	//
   247  	// The following arguments are optional:
   248  	UserName pulumi.StringInput
   249  	// The user type.
   250  	UserType pulumi.StringPtrInput
   251  }
   252  
   253  func (UserArgs) ElementType() reflect.Type {
   254  	return reflect.TypeOf((*userArgs)(nil)).Elem()
   255  }
   256  
   257  type UserInput interface {
   258  	pulumi.Input
   259  
   260  	ToUserOutput() UserOutput
   261  	ToUserOutputWithContext(ctx context.Context) UserOutput
   262  }
   263  
   264  func (*User) ElementType() reflect.Type {
   265  	return reflect.TypeOf((**User)(nil)).Elem()
   266  }
   267  
   268  func (i *User) ToUserOutput() UserOutput {
   269  	return i.ToUserOutputWithContext(context.Background())
   270  }
   271  
   272  func (i *User) ToUserOutputWithContext(ctx context.Context) UserOutput {
   273  	return pulumi.ToOutputWithContext(ctx, i).(UserOutput)
   274  }
   275  
   276  // UserArrayInput is an input type that accepts UserArray and UserArrayOutput values.
   277  // You can construct a concrete instance of `UserArrayInput` via:
   278  //
   279  //	UserArray{ UserArgs{...} }
   280  type UserArrayInput interface {
   281  	pulumi.Input
   282  
   283  	ToUserArrayOutput() UserArrayOutput
   284  	ToUserArrayOutputWithContext(context.Context) UserArrayOutput
   285  }
   286  
   287  type UserArray []UserInput
   288  
   289  func (UserArray) ElementType() reflect.Type {
   290  	return reflect.TypeOf((*[]*User)(nil)).Elem()
   291  }
   292  
   293  func (i UserArray) ToUserArrayOutput() UserArrayOutput {
   294  	return i.ToUserArrayOutputWithContext(context.Background())
   295  }
   296  
   297  func (i UserArray) ToUserArrayOutputWithContext(ctx context.Context) UserArrayOutput {
   298  	return pulumi.ToOutputWithContext(ctx, i).(UserArrayOutput)
   299  }
   300  
   301  // UserMapInput is an input type that accepts UserMap and UserMapOutput values.
   302  // You can construct a concrete instance of `UserMapInput` via:
   303  //
   304  //	UserMap{ "key": UserArgs{...} }
   305  type UserMapInput interface {
   306  	pulumi.Input
   307  
   308  	ToUserMapOutput() UserMapOutput
   309  	ToUserMapOutputWithContext(context.Context) UserMapOutput
   310  }
   311  
   312  type UserMap map[string]UserInput
   313  
   314  func (UserMap) ElementType() reflect.Type {
   315  	return reflect.TypeOf((*map[string]*User)(nil)).Elem()
   316  }
   317  
   318  func (i UserMap) ToUserMapOutput() UserMapOutput {
   319  	return i.ToUserMapOutputWithContext(context.Background())
   320  }
   321  
   322  func (i UserMap) ToUserMapOutputWithContext(ctx context.Context) UserMapOutput {
   323  	return pulumi.ToOutputWithContext(ctx, i).(UserMapOutput)
   324  }
   325  
   326  type UserOutput struct{ *pulumi.OutputState }
   327  
   328  func (UserOutput) ElementType() reflect.Type {
   329  	return reflect.TypeOf((**User)(nil)).Elem()
   330  }
   331  
   332  func (o UserOutput) ToUserOutput() UserOutput {
   333  	return o
   334  }
   335  
   336  func (o UserOutput) ToUserOutputWithContext(ctx context.Context) UserOutput {
   337  	return o
   338  }
   339  
   340  // Details about the user's address. At most 1 address is allowed. Detailed below.
   341  func (o UserOutput) Addresses() UserAddressesPtrOutput {
   342  	return o.ApplyT(func(v *User) UserAddressesPtrOutput { return v.Addresses }).(UserAddressesPtrOutput)
   343  }
   344  
   345  // The name that is typically displayed when the user is referenced.
   346  func (o UserOutput) DisplayName() pulumi.StringOutput {
   347  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
   348  }
   349  
   350  // Details about the user's email. At most 1 email is allowed. Detailed below.
   351  func (o UserOutput) Emails() UserEmailsPtrOutput {
   352  	return o.ApplyT(func(v *User) UserEmailsPtrOutput { return v.Emails }).(UserEmailsPtrOutput)
   353  }
   354  
   355  // A list of identifiers issued to this resource by an external identity provider.
   356  func (o UserOutput) ExternalIds() UserExternalIdArrayOutput {
   357  	return o.ApplyT(func(v *User) UserExternalIdArrayOutput { return v.ExternalIds }).(UserExternalIdArrayOutput)
   358  }
   359  
   360  // The globally unique identifier for the identity store that this user is in.
   361  func (o UserOutput) IdentityStoreId() pulumi.StringOutput {
   362  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.IdentityStoreId }).(pulumi.StringOutput)
   363  }
   364  
   365  // The user's geographical region or location.
   366  func (o UserOutput) Locale() pulumi.StringPtrOutput {
   367  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.Locale }).(pulumi.StringPtrOutput)
   368  }
   369  
   370  // Details about the user's full name. Detailed below.
   371  func (o UserOutput) Name() UserNameOutput {
   372  	return o.ApplyT(func(v *User) UserNameOutput { return v.Name }).(UserNameOutput)
   373  }
   374  
   375  // An alternate name for the user.
   376  func (o UserOutput) Nickname() pulumi.StringPtrOutput {
   377  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.Nickname }).(pulumi.StringPtrOutput)
   378  }
   379  
   380  // Details about the user's phone number. At most 1 phone number is allowed. Detailed below.
   381  func (o UserOutput) PhoneNumbers() UserPhoneNumbersPtrOutput {
   382  	return o.ApplyT(func(v *User) UserPhoneNumbersPtrOutput { return v.PhoneNumbers }).(UserPhoneNumbersPtrOutput)
   383  }
   384  
   385  // The preferred language of the user.
   386  func (o UserOutput) PreferredLanguage() pulumi.StringPtrOutput {
   387  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.PreferredLanguage }).(pulumi.StringPtrOutput)
   388  }
   389  
   390  // An URL that may be associated with the user.
   391  func (o UserOutput) ProfileUrl() pulumi.StringPtrOutput {
   392  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.ProfileUrl }).(pulumi.StringPtrOutput)
   393  }
   394  
   395  // The user's time zone.
   396  func (o UserOutput) Timezone() pulumi.StringPtrOutput {
   397  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.Timezone }).(pulumi.StringPtrOutput)
   398  }
   399  
   400  // The user's title.
   401  func (o UserOutput) Title() pulumi.StringPtrOutput {
   402  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.Title }).(pulumi.StringPtrOutput)
   403  }
   404  
   405  // The identifier for this user in the identity store.
   406  func (o UserOutput) UserId() pulumi.StringOutput {
   407  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.UserId }).(pulumi.StringOutput)
   408  }
   409  
   410  // A unique string used to identify the user. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. The limit is 128 characters.
   411  //
   412  // The following arguments are optional:
   413  func (o UserOutput) UserName() pulumi.StringOutput {
   414  	return o.ApplyT(func(v *User) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput)
   415  }
   416  
   417  // The user type.
   418  func (o UserOutput) UserType() pulumi.StringPtrOutput {
   419  	return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.UserType }).(pulumi.StringPtrOutput)
   420  }
   421  
   422  type UserArrayOutput struct{ *pulumi.OutputState }
   423  
   424  func (UserArrayOutput) ElementType() reflect.Type {
   425  	return reflect.TypeOf((*[]*User)(nil)).Elem()
   426  }
   427  
   428  func (o UserArrayOutput) ToUserArrayOutput() UserArrayOutput {
   429  	return o
   430  }
   431  
   432  func (o UserArrayOutput) ToUserArrayOutputWithContext(ctx context.Context) UserArrayOutput {
   433  	return o
   434  }
   435  
   436  func (o UserArrayOutput) Index(i pulumi.IntInput) UserOutput {
   437  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *User {
   438  		return vs[0].([]*User)[vs[1].(int)]
   439  	}).(UserOutput)
   440  }
   441  
   442  type UserMapOutput struct{ *pulumi.OutputState }
   443  
   444  func (UserMapOutput) ElementType() reflect.Type {
   445  	return reflect.TypeOf((*map[string]*User)(nil)).Elem()
   446  }
   447  
   448  func (o UserMapOutput) ToUserMapOutput() UserMapOutput {
   449  	return o
   450  }
   451  
   452  func (o UserMapOutput) ToUserMapOutputWithContext(ctx context.Context) UserMapOutput {
   453  	return o
   454  }
   455  
   456  func (o UserMapOutput) MapIndex(k pulumi.StringInput) UserOutput {
   457  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *User {
   458  		return vs[0].(map[string]*User)[vs[1].(string)]
   459  	}).(UserOutput)
   460  }
   461  
   462  func init() {
   463  	pulumi.RegisterInputType(reflect.TypeOf((*UserInput)(nil)).Elem(), &User{})
   464  	pulumi.RegisterInputType(reflect.TypeOf((*UserArrayInput)(nil)).Elem(), UserArray{})
   465  	pulumi.RegisterInputType(reflect.TypeOf((*UserMapInput)(nil)).Elem(), UserMap{})
   466  	pulumi.RegisterOutputType(UserOutput{})
   467  	pulumi.RegisterOutputType(UserArrayOutput{})
   468  	pulumi.RegisterOutputType(UserMapOutput{})
   469  }