github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/elasticache/userGroup.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 elasticache
     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 ElastiCache user group resource.
    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/elasticache"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			test, err := elasticache.NewUser(ctx, "test", &elasticache.UserArgs{
    33  //				UserId:       pulumi.String("testUserId"),
    34  //				UserName:     pulumi.String("default"),
    35  //				AccessString: pulumi.String("on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"),
    36  //				Engine:       pulumi.String("REDIS"),
    37  //				Passwords: pulumi.StringArray{
    38  //					pulumi.String("password123456789"),
    39  //				},
    40  //			})
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			_, err = elasticache.NewUserGroup(ctx, "test", &elasticache.UserGroupArgs{
    45  //				Engine:      pulumi.String("REDIS"),
    46  //				UserGroupId: pulumi.String("userGroupId"),
    47  //				UserIds: pulumi.StringArray{
    48  //					test.UserId,
    49  //				},
    50  //			})
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			return nil
    55  //		})
    56  //	}
    57  //
    58  // ```
    59  // <!--End PulumiCodeChooser -->
    60  //
    61  // ## Import
    62  //
    63  // Using `pulumi import`, import ElastiCache user groups using the `user_group_id`. For example:
    64  //
    65  // ```sh
    66  // $ pulumi import aws:elasticache/userGroup:UserGroup my_user_group userGoupId1
    67  // ```
    68  type UserGroup struct {
    69  	pulumi.CustomResourceState
    70  
    71  	// The ARN that identifies the user group.
    72  	Arn pulumi.StringOutput `pulumi:"arn"`
    73  	// The current supported value is `REDIS`.
    74  	Engine pulumi.StringOutput `pulumi:"engine"`
    75  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    76  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    77  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    78  	//
    79  	// Deprecated: Please use `tags` instead.
    80  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    81  	// The ID of the user group.
    82  	//
    83  	// The following arguments are optional:
    84  	UserGroupId pulumi.StringOutput `pulumi:"userGroupId"`
    85  	// The list of user IDs that belong to the user group.
    86  	UserIds pulumi.StringArrayOutput `pulumi:"userIds"`
    87  }
    88  
    89  // NewUserGroup registers a new resource with the given unique name, arguments, and options.
    90  func NewUserGroup(ctx *pulumi.Context,
    91  	name string, args *UserGroupArgs, opts ...pulumi.ResourceOption) (*UserGroup, error) {
    92  	if args == nil {
    93  		return nil, errors.New("missing one or more required arguments")
    94  	}
    95  
    96  	if args.Engine == nil {
    97  		return nil, errors.New("invalid value for required argument 'Engine'")
    98  	}
    99  	if args.UserGroupId == nil {
   100  		return nil, errors.New("invalid value for required argument 'UserGroupId'")
   101  	}
   102  	opts = internal.PkgResourceDefaultOpts(opts)
   103  	var resource UserGroup
   104  	err := ctx.RegisterResource("aws:elasticache/userGroup:UserGroup", name, args, &resource, opts...)
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  	return &resource, nil
   109  }
   110  
   111  // GetUserGroup gets an existing UserGroup resource's state with the given name, ID, and optional
   112  // state properties that are used to uniquely qualify the lookup (nil if not required).
   113  func GetUserGroup(ctx *pulumi.Context,
   114  	name string, id pulumi.IDInput, state *UserGroupState, opts ...pulumi.ResourceOption) (*UserGroup, error) {
   115  	var resource UserGroup
   116  	err := ctx.ReadResource("aws:elasticache/userGroup:UserGroup", name, id, state, &resource, opts...)
   117  	if err != nil {
   118  		return nil, err
   119  	}
   120  	return &resource, nil
   121  }
   122  
   123  // Input properties used for looking up and filtering UserGroup resources.
   124  type userGroupState struct {
   125  	// The ARN that identifies the user group.
   126  	Arn *string `pulumi:"arn"`
   127  	// The current supported value is `REDIS`.
   128  	Engine *string `pulumi:"engine"`
   129  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   130  	Tags map[string]string `pulumi:"tags"`
   131  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   132  	//
   133  	// Deprecated: Please use `tags` instead.
   134  	TagsAll map[string]string `pulumi:"tagsAll"`
   135  	// The ID of the user group.
   136  	//
   137  	// The following arguments are optional:
   138  	UserGroupId *string `pulumi:"userGroupId"`
   139  	// The list of user IDs that belong to the user group.
   140  	UserIds []string `pulumi:"userIds"`
   141  }
   142  
   143  type UserGroupState struct {
   144  	// The ARN that identifies the user group.
   145  	Arn pulumi.StringPtrInput
   146  	// The current supported value is `REDIS`.
   147  	Engine pulumi.StringPtrInput
   148  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   149  	Tags pulumi.StringMapInput
   150  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   151  	//
   152  	// Deprecated: Please use `tags` instead.
   153  	TagsAll pulumi.StringMapInput
   154  	// The ID of the user group.
   155  	//
   156  	// The following arguments are optional:
   157  	UserGroupId pulumi.StringPtrInput
   158  	// The list of user IDs that belong to the user group.
   159  	UserIds pulumi.StringArrayInput
   160  }
   161  
   162  func (UserGroupState) ElementType() reflect.Type {
   163  	return reflect.TypeOf((*userGroupState)(nil)).Elem()
   164  }
   165  
   166  type userGroupArgs struct {
   167  	// The current supported value is `REDIS`.
   168  	Engine string `pulumi:"engine"`
   169  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   170  	Tags map[string]string `pulumi:"tags"`
   171  	// The ID of the user group.
   172  	//
   173  	// The following arguments are optional:
   174  	UserGroupId string `pulumi:"userGroupId"`
   175  	// The list of user IDs that belong to the user group.
   176  	UserIds []string `pulumi:"userIds"`
   177  }
   178  
   179  // The set of arguments for constructing a UserGroup resource.
   180  type UserGroupArgs struct {
   181  	// The current supported value is `REDIS`.
   182  	Engine pulumi.StringInput
   183  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   184  	Tags pulumi.StringMapInput
   185  	// The ID of the user group.
   186  	//
   187  	// The following arguments are optional:
   188  	UserGroupId pulumi.StringInput
   189  	// The list of user IDs that belong to the user group.
   190  	UserIds pulumi.StringArrayInput
   191  }
   192  
   193  func (UserGroupArgs) ElementType() reflect.Type {
   194  	return reflect.TypeOf((*userGroupArgs)(nil)).Elem()
   195  }
   196  
   197  type UserGroupInput interface {
   198  	pulumi.Input
   199  
   200  	ToUserGroupOutput() UserGroupOutput
   201  	ToUserGroupOutputWithContext(ctx context.Context) UserGroupOutput
   202  }
   203  
   204  func (*UserGroup) ElementType() reflect.Type {
   205  	return reflect.TypeOf((**UserGroup)(nil)).Elem()
   206  }
   207  
   208  func (i *UserGroup) ToUserGroupOutput() UserGroupOutput {
   209  	return i.ToUserGroupOutputWithContext(context.Background())
   210  }
   211  
   212  func (i *UserGroup) ToUserGroupOutputWithContext(ctx context.Context) UserGroupOutput {
   213  	return pulumi.ToOutputWithContext(ctx, i).(UserGroupOutput)
   214  }
   215  
   216  // UserGroupArrayInput is an input type that accepts UserGroupArray and UserGroupArrayOutput values.
   217  // You can construct a concrete instance of `UserGroupArrayInput` via:
   218  //
   219  //	UserGroupArray{ UserGroupArgs{...} }
   220  type UserGroupArrayInput interface {
   221  	pulumi.Input
   222  
   223  	ToUserGroupArrayOutput() UserGroupArrayOutput
   224  	ToUserGroupArrayOutputWithContext(context.Context) UserGroupArrayOutput
   225  }
   226  
   227  type UserGroupArray []UserGroupInput
   228  
   229  func (UserGroupArray) ElementType() reflect.Type {
   230  	return reflect.TypeOf((*[]*UserGroup)(nil)).Elem()
   231  }
   232  
   233  func (i UserGroupArray) ToUserGroupArrayOutput() UserGroupArrayOutput {
   234  	return i.ToUserGroupArrayOutputWithContext(context.Background())
   235  }
   236  
   237  func (i UserGroupArray) ToUserGroupArrayOutputWithContext(ctx context.Context) UserGroupArrayOutput {
   238  	return pulumi.ToOutputWithContext(ctx, i).(UserGroupArrayOutput)
   239  }
   240  
   241  // UserGroupMapInput is an input type that accepts UserGroupMap and UserGroupMapOutput values.
   242  // You can construct a concrete instance of `UserGroupMapInput` via:
   243  //
   244  //	UserGroupMap{ "key": UserGroupArgs{...} }
   245  type UserGroupMapInput interface {
   246  	pulumi.Input
   247  
   248  	ToUserGroupMapOutput() UserGroupMapOutput
   249  	ToUserGroupMapOutputWithContext(context.Context) UserGroupMapOutput
   250  }
   251  
   252  type UserGroupMap map[string]UserGroupInput
   253  
   254  func (UserGroupMap) ElementType() reflect.Type {
   255  	return reflect.TypeOf((*map[string]*UserGroup)(nil)).Elem()
   256  }
   257  
   258  func (i UserGroupMap) ToUserGroupMapOutput() UserGroupMapOutput {
   259  	return i.ToUserGroupMapOutputWithContext(context.Background())
   260  }
   261  
   262  func (i UserGroupMap) ToUserGroupMapOutputWithContext(ctx context.Context) UserGroupMapOutput {
   263  	return pulumi.ToOutputWithContext(ctx, i).(UserGroupMapOutput)
   264  }
   265  
   266  type UserGroupOutput struct{ *pulumi.OutputState }
   267  
   268  func (UserGroupOutput) ElementType() reflect.Type {
   269  	return reflect.TypeOf((**UserGroup)(nil)).Elem()
   270  }
   271  
   272  func (o UserGroupOutput) ToUserGroupOutput() UserGroupOutput {
   273  	return o
   274  }
   275  
   276  func (o UserGroupOutput) ToUserGroupOutputWithContext(ctx context.Context) UserGroupOutput {
   277  	return o
   278  }
   279  
   280  // The ARN that identifies the user group.
   281  func (o UserGroupOutput) Arn() pulumi.StringOutput {
   282  	return o.ApplyT(func(v *UserGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   283  }
   284  
   285  // The current supported value is `REDIS`.
   286  func (o UserGroupOutput) Engine() pulumi.StringOutput {
   287  	return o.ApplyT(func(v *UserGroup) pulumi.StringOutput { return v.Engine }).(pulumi.StringOutput)
   288  }
   289  
   290  // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   291  func (o UserGroupOutput) Tags() pulumi.StringMapOutput {
   292  	return o.ApplyT(func(v *UserGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   293  }
   294  
   295  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   296  //
   297  // Deprecated: Please use `tags` instead.
   298  func (o UserGroupOutput) TagsAll() pulumi.StringMapOutput {
   299  	return o.ApplyT(func(v *UserGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   300  }
   301  
   302  // The ID of the user group.
   303  //
   304  // The following arguments are optional:
   305  func (o UserGroupOutput) UserGroupId() pulumi.StringOutput {
   306  	return o.ApplyT(func(v *UserGroup) pulumi.StringOutput { return v.UserGroupId }).(pulumi.StringOutput)
   307  }
   308  
   309  // The list of user IDs that belong to the user group.
   310  func (o UserGroupOutput) UserIds() pulumi.StringArrayOutput {
   311  	return o.ApplyT(func(v *UserGroup) pulumi.StringArrayOutput { return v.UserIds }).(pulumi.StringArrayOutput)
   312  }
   313  
   314  type UserGroupArrayOutput struct{ *pulumi.OutputState }
   315  
   316  func (UserGroupArrayOutput) ElementType() reflect.Type {
   317  	return reflect.TypeOf((*[]*UserGroup)(nil)).Elem()
   318  }
   319  
   320  func (o UserGroupArrayOutput) ToUserGroupArrayOutput() UserGroupArrayOutput {
   321  	return o
   322  }
   323  
   324  func (o UserGroupArrayOutput) ToUserGroupArrayOutputWithContext(ctx context.Context) UserGroupArrayOutput {
   325  	return o
   326  }
   327  
   328  func (o UserGroupArrayOutput) Index(i pulumi.IntInput) UserGroupOutput {
   329  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UserGroup {
   330  		return vs[0].([]*UserGroup)[vs[1].(int)]
   331  	}).(UserGroupOutput)
   332  }
   333  
   334  type UserGroupMapOutput struct{ *pulumi.OutputState }
   335  
   336  func (UserGroupMapOutput) ElementType() reflect.Type {
   337  	return reflect.TypeOf((*map[string]*UserGroup)(nil)).Elem()
   338  }
   339  
   340  func (o UserGroupMapOutput) ToUserGroupMapOutput() UserGroupMapOutput {
   341  	return o
   342  }
   343  
   344  func (o UserGroupMapOutput) ToUserGroupMapOutputWithContext(ctx context.Context) UserGroupMapOutput {
   345  	return o
   346  }
   347  
   348  func (o UserGroupMapOutput) MapIndex(k pulumi.StringInput) UserGroupOutput {
   349  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UserGroup {
   350  		return vs[0].(map[string]*UserGroup)[vs[1].(string)]
   351  	}).(UserGroupOutput)
   352  }
   353  
   354  func init() {
   355  	pulumi.RegisterInputType(reflect.TypeOf((*UserGroupInput)(nil)).Elem(), &UserGroup{})
   356  	pulumi.RegisterInputType(reflect.TypeOf((*UserGroupArrayInput)(nil)).Elem(), UserGroupArray{})
   357  	pulumi.RegisterInputType(reflect.TypeOf((*UserGroupMapInput)(nil)).Elem(), UserGroupMap{})
   358  	pulumi.RegisterOutputType(UserGroupOutput{})
   359  	pulumi.RegisterOutputType(UserGroupArrayOutput{})
   360  	pulumi.RegisterOutputType(UserGroupMapOutput{})
   361  }