github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/memorydb/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 memorydb 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 a MemoryDB User. 16 // 17 // More information about users and ACL-s can be found in the [MemoryDB User Guide](https://docs.aws.amazon.com/memorydb/latest/devguide/clusters.acls.html). 18 // 19 // > **Note:** All arguments including the username and passwords will be stored in the raw state as plain-text. 20 // ## Example Usage 21 // 22 // <!--Start PulumiCodeChooser --> 23 // ```go 24 // package main 25 // 26 // import ( 27 // 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/memorydb" 29 // "github.com/pulumi/pulumi-random/sdk/v4/go/random" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // example, err := random.NewPassword(ctx, "example", &random.PasswordArgs{ 37 // Length: 16, 38 // }) 39 // if err != nil { 40 // return err 41 // } 42 // _, err = memorydb.NewUser(ctx, "example", &memorydb.UserArgs{ 43 // UserName: pulumi.String("my-user"), 44 // AccessString: pulumi.String("on ~* &* +@all"), 45 // AuthenticationMode: &memorydb.UserAuthenticationModeArgs{ 46 // Type: pulumi.String("password"), 47 // Passwords: pulumi.StringArray{ 48 // example.Result, 49 // }, 50 // }, 51 // }) 52 // if err != nil { 53 // return err 54 // } 55 // return nil 56 // }) 57 // } 58 // 59 // ``` 60 // <!--End PulumiCodeChooser --> 61 // 62 // ## Import 63 // 64 // Using `pulumi import`, import a user using the `user_name`. For example: 65 // 66 // ```sh 67 // $ pulumi import aws:memorydb/user:User example my-user 68 // ``` 69 // The `passwords` are not available for imported resources, as this information cannot be read back from the MemoryDB API. 70 type User struct { 71 pulumi.CustomResourceState 72 73 // The access permissions string used for this user. 74 AccessString pulumi.StringOutput `pulumi:"accessString"` 75 // The ARN of the user. 76 Arn pulumi.StringOutput `pulumi:"arn"` 77 // Denotes the user's authentication properties. Detailed below. 78 AuthenticationMode UserAuthenticationModeOutput `pulumi:"authenticationMode"` 79 // The minimum engine version supported for the user. 80 MinimumEngineVersion pulumi.StringOutput `pulumi:"minimumEngineVersion"` 81 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 82 Tags pulumi.StringMapOutput `pulumi:"tags"` 83 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 84 // 85 // Deprecated: Please use `tags` instead. 86 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 87 // Name of the MemoryDB user. Up to 40 characters. 88 // 89 // The following arguments are optional: 90 UserName pulumi.StringOutput `pulumi:"userName"` 91 } 92 93 // NewUser registers a new resource with the given unique name, arguments, and options. 94 func NewUser(ctx *pulumi.Context, 95 name string, args *UserArgs, opts ...pulumi.ResourceOption) (*User, error) { 96 if args == nil { 97 return nil, errors.New("missing one or more required arguments") 98 } 99 100 if args.AccessString == nil { 101 return nil, errors.New("invalid value for required argument 'AccessString'") 102 } 103 if args.AuthenticationMode == nil { 104 return nil, errors.New("invalid value for required argument 'AuthenticationMode'") 105 } 106 if args.UserName == nil { 107 return nil, errors.New("invalid value for required argument 'UserName'") 108 } 109 opts = internal.PkgResourceDefaultOpts(opts) 110 var resource User 111 err := ctx.RegisterResource("aws:memorydb/user:User", name, args, &resource, opts...) 112 if err != nil { 113 return nil, err 114 } 115 return &resource, nil 116 } 117 118 // GetUser gets an existing User resource's state with the given name, ID, and optional 119 // state properties that are used to uniquely qualify the lookup (nil if not required). 120 func GetUser(ctx *pulumi.Context, 121 name string, id pulumi.IDInput, state *UserState, opts ...pulumi.ResourceOption) (*User, error) { 122 var resource User 123 err := ctx.ReadResource("aws:memorydb/user:User", name, id, state, &resource, opts...) 124 if err != nil { 125 return nil, err 126 } 127 return &resource, nil 128 } 129 130 // Input properties used for looking up and filtering User resources. 131 type userState struct { 132 // The access permissions string used for this user. 133 AccessString *string `pulumi:"accessString"` 134 // The ARN of the user. 135 Arn *string `pulumi:"arn"` 136 // Denotes the user's authentication properties. Detailed below. 137 AuthenticationMode *UserAuthenticationMode `pulumi:"authenticationMode"` 138 // The minimum engine version supported for the user. 139 MinimumEngineVersion *string `pulumi:"minimumEngineVersion"` 140 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 141 Tags map[string]string `pulumi:"tags"` 142 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 143 // 144 // Deprecated: Please use `tags` instead. 145 TagsAll map[string]string `pulumi:"tagsAll"` 146 // Name of the MemoryDB user. Up to 40 characters. 147 // 148 // The following arguments are optional: 149 UserName *string `pulumi:"userName"` 150 } 151 152 type UserState struct { 153 // The access permissions string used for this user. 154 AccessString pulumi.StringPtrInput 155 // The ARN of the user. 156 Arn pulumi.StringPtrInput 157 // Denotes the user's authentication properties. Detailed below. 158 AuthenticationMode UserAuthenticationModePtrInput 159 // The minimum engine version supported for the user. 160 MinimumEngineVersion pulumi.StringPtrInput 161 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 162 Tags pulumi.StringMapInput 163 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 164 // 165 // Deprecated: Please use `tags` instead. 166 TagsAll pulumi.StringMapInput 167 // Name of the MemoryDB user. Up to 40 characters. 168 // 169 // The following arguments are optional: 170 UserName pulumi.StringPtrInput 171 } 172 173 func (UserState) ElementType() reflect.Type { 174 return reflect.TypeOf((*userState)(nil)).Elem() 175 } 176 177 type userArgs struct { 178 // The access permissions string used for this user. 179 AccessString string `pulumi:"accessString"` 180 // Denotes the user's authentication properties. Detailed below. 181 AuthenticationMode UserAuthenticationMode `pulumi:"authenticationMode"` 182 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 183 Tags map[string]string `pulumi:"tags"` 184 // Name of the MemoryDB user. Up to 40 characters. 185 // 186 // The following arguments are optional: 187 UserName string `pulumi:"userName"` 188 } 189 190 // The set of arguments for constructing a User resource. 191 type UserArgs struct { 192 // The access permissions string used for this user. 193 AccessString pulumi.StringInput 194 // Denotes the user's authentication properties. Detailed below. 195 AuthenticationMode UserAuthenticationModeInput 196 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 197 Tags pulumi.StringMapInput 198 // Name of the MemoryDB user. Up to 40 characters. 199 // 200 // The following arguments are optional: 201 UserName pulumi.StringInput 202 } 203 204 func (UserArgs) ElementType() reflect.Type { 205 return reflect.TypeOf((*userArgs)(nil)).Elem() 206 } 207 208 type UserInput interface { 209 pulumi.Input 210 211 ToUserOutput() UserOutput 212 ToUserOutputWithContext(ctx context.Context) UserOutput 213 } 214 215 func (*User) ElementType() reflect.Type { 216 return reflect.TypeOf((**User)(nil)).Elem() 217 } 218 219 func (i *User) ToUserOutput() UserOutput { 220 return i.ToUserOutputWithContext(context.Background()) 221 } 222 223 func (i *User) ToUserOutputWithContext(ctx context.Context) UserOutput { 224 return pulumi.ToOutputWithContext(ctx, i).(UserOutput) 225 } 226 227 // UserArrayInput is an input type that accepts UserArray and UserArrayOutput values. 228 // You can construct a concrete instance of `UserArrayInput` via: 229 // 230 // UserArray{ UserArgs{...} } 231 type UserArrayInput interface { 232 pulumi.Input 233 234 ToUserArrayOutput() UserArrayOutput 235 ToUserArrayOutputWithContext(context.Context) UserArrayOutput 236 } 237 238 type UserArray []UserInput 239 240 func (UserArray) ElementType() reflect.Type { 241 return reflect.TypeOf((*[]*User)(nil)).Elem() 242 } 243 244 func (i UserArray) ToUserArrayOutput() UserArrayOutput { 245 return i.ToUserArrayOutputWithContext(context.Background()) 246 } 247 248 func (i UserArray) ToUserArrayOutputWithContext(ctx context.Context) UserArrayOutput { 249 return pulumi.ToOutputWithContext(ctx, i).(UserArrayOutput) 250 } 251 252 // UserMapInput is an input type that accepts UserMap and UserMapOutput values. 253 // You can construct a concrete instance of `UserMapInput` via: 254 // 255 // UserMap{ "key": UserArgs{...} } 256 type UserMapInput interface { 257 pulumi.Input 258 259 ToUserMapOutput() UserMapOutput 260 ToUserMapOutputWithContext(context.Context) UserMapOutput 261 } 262 263 type UserMap map[string]UserInput 264 265 func (UserMap) ElementType() reflect.Type { 266 return reflect.TypeOf((*map[string]*User)(nil)).Elem() 267 } 268 269 func (i UserMap) ToUserMapOutput() UserMapOutput { 270 return i.ToUserMapOutputWithContext(context.Background()) 271 } 272 273 func (i UserMap) ToUserMapOutputWithContext(ctx context.Context) UserMapOutput { 274 return pulumi.ToOutputWithContext(ctx, i).(UserMapOutput) 275 } 276 277 type UserOutput struct{ *pulumi.OutputState } 278 279 func (UserOutput) ElementType() reflect.Type { 280 return reflect.TypeOf((**User)(nil)).Elem() 281 } 282 283 func (o UserOutput) ToUserOutput() UserOutput { 284 return o 285 } 286 287 func (o UserOutput) ToUserOutputWithContext(ctx context.Context) UserOutput { 288 return o 289 } 290 291 // The access permissions string used for this user. 292 func (o UserOutput) AccessString() pulumi.StringOutput { 293 return o.ApplyT(func(v *User) pulumi.StringOutput { return v.AccessString }).(pulumi.StringOutput) 294 } 295 296 // The ARN of the user. 297 func (o UserOutput) Arn() pulumi.StringOutput { 298 return o.ApplyT(func(v *User) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 299 } 300 301 // Denotes the user's authentication properties. Detailed below. 302 func (o UserOutput) AuthenticationMode() UserAuthenticationModeOutput { 303 return o.ApplyT(func(v *User) UserAuthenticationModeOutput { return v.AuthenticationMode }).(UserAuthenticationModeOutput) 304 } 305 306 // The minimum engine version supported for the user. 307 func (o UserOutput) MinimumEngineVersion() pulumi.StringOutput { 308 return o.ApplyT(func(v *User) pulumi.StringOutput { return v.MinimumEngineVersion }).(pulumi.StringOutput) 309 } 310 311 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 312 func (o UserOutput) Tags() pulumi.StringMapOutput { 313 return o.ApplyT(func(v *User) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 314 } 315 316 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 317 // 318 // Deprecated: Please use `tags` instead. 319 func (o UserOutput) TagsAll() pulumi.StringMapOutput { 320 return o.ApplyT(func(v *User) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 321 } 322 323 // Name of the MemoryDB user. Up to 40 characters. 324 // 325 // The following arguments are optional: 326 func (o UserOutput) UserName() pulumi.StringOutput { 327 return o.ApplyT(func(v *User) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput) 328 } 329 330 type UserArrayOutput struct{ *pulumi.OutputState } 331 332 func (UserArrayOutput) ElementType() reflect.Type { 333 return reflect.TypeOf((*[]*User)(nil)).Elem() 334 } 335 336 func (o UserArrayOutput) ToUserArrayOutput() UserArrayOutput { 337 return o 338 } 339 340 func (o UserArrayOutput) ToUserArrayOutputWithContext(ctx context.Context) UserArrayOutput { 341 return o 342 } 343 344 func (o UserArrayOutput) Index(i pulumi.IntInput) UserOutput { 345 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *User { 346 return vs[0].([]*User)[vs[1].(int)] 347 }).(UserOutput) 348 } 349 350 type UserMapOutput struct{ *pulumi.OutputState } 351 352 func (UserMapOutput) ElementType() reflect.Type { 353 return reflect.TypeOf((*map[string]*User)(nil)).Elem() 354 } 355 356 func (o UserMapOutput) ToUserMapOutput() UserMapOutput { 357 return o 358 } 359 360 func (o UserMapOutput) ToUserMapOutputWithContext(ctx context.Context) UserMapOutput { 361 return o 362 } 363 364 func (o UserMapOutput) MapIndex(k pulumi.StringInput) UserOutput { 365 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *User { 366 return vs[0].(map[string]*User)[vs[1].(string)] 367 }).(UserOutput) 368 } 369 370 func init() { 371 pulumi.RegisterInputType(reflect.TypeOf((*UserInput)(nil)).Elem(), &User{}) 372 pulumi.RegisterInputType(reflect.TypeOf((*UserArrayInput)(nil)).Elem(), UserArray{}) 373 pulumi.RegisterInputType(reflect.TypeOf((*UserMapInput)(nil)).Elem(), UserMap{}) 374 pulumi.RegisterOutputType(UserOutput{}) 375 pulumi.RegisterOutputType(UserArrayOutput{}) 376 pulumi.RegisterOutputType(UserMapOutput{}) 377 }