Skip to content
v2.274.0

Experimental

@aws-cdk/aws-elasticache-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

UserGroup L2 construct ​

An ElastiCache UserGroup.

Example ​

ts
const newDefaultUser = new elasticache.NoPasswordUser(this, 'NoPasswordUser', {
  userId: 'default',
  accessControl: elasticache.AccessControl.fromAccessString("on ~* +@all"),
})

const userGroup = new elasticache.UserGroup(this, 'UserGroup', {
  users: [newDefaultUser],
});
python
new_default_user = elasticache.NoPasswordUser(self, "NoPasswordUser",
    user_id="default",
    access_control=elasticache.AccessControl.from_access_string("on ~* +@all")
)

user_group = elasticache.UserGroup(self, "UserGroup",
    users=[new_default_user]
)
java
NoPasswordUser newDefaultUser = NoPasswordUser.Builder.create(this, "NoPasswordUser")
        .userId("default")
        .accessControl(AccessControl.fromAccessString("on ~* +@all"))
        .build();

UserGroup userGroup = UserGroup.Builder.create(this, "UserGroup")
        .users(List.of(newDefaultUser))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.ElastiCache.Alpha
var newDefaultUser = new NoPasswordUser(this, "NoPasswordUser", new NoPasswordUserProps {
    UserId = "default",
    AccessControl = AccessControl.FromAccessString("on ~* +@all")
});

var userGroup = new UserGroup(this, "UserGroup", new UserGroupProps {
    Users = new [] { newDefaultUser }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkelasticachealpha/v2
newDefaultUser := elasticache.NewNoPasswordUser(this, jsii.String("NoPasswordUser"), &NoPasswordUserProps{
	UserId: jsii.String("default"),
	AccessControl: elasticache.AccessControl_FromAccessString(jsii.String("on ~* +@all")),
})

userGroup := elasticache.NewUserGroup(this, jsii.String("UserGroup"), &UserGroupProps{
	Users: []IUser{
		newDefaultUser,
	},
})

Initializer ​

ts
new UserGroup(scope: Construct, id: string, props?: UserGroupProps)
python
UserGroup(scope: Construct, id: str, props: typing.Optional[UserGroupProps] = None)
java
new UserGroup(Construct scope, String id, UserGroupProps props)
csharp
new UserGroup(Construct scope, string id, UserGroupProps? props = null)
go
NewUserGroup(Scope Construct, Id *string, Props UserGroupProps)

Construct Props ​

engineoptionalUserEngineengineoptionalUserEngineengineoptionalUserEngineEngineoptionalUserEngineEngineoptionalUserEngine= UserEngine.VALKEY#
The engine type for the user group Enum options: UserEngine.VALKEY, UserEngine.REDIS.
userGroupNameoptionalstringuser_group_nameoptionalstruserGroupNameoptionalStringUserGroupNameoptionalstringUserGroupNameoptional*string= <generated>#
Enforces a particular physical user group name.
usersoptionalIUser[]usersoptionaltyping.List[IUser]usersoptionalList<IUser>UsersoptionalIUser[]Usersoptional*[]IUser#
List of users inside the user group.

Default: no users

Properties ​

enginemay be undefinedUserEngineenginemay be undefinedUserEngineenginemay be undefinedUserEngineEnginemay be undefinedUserEngineEnginemay be undefinedUserEngine#
The engine type for the user group.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
userGroupArnstringuser_group_arnstruserGroupArnStringUserGroupArnstringUserGroupArn*stringrequired#
The ARN of the user group.
userGroupNamestringuser_group_namestruserGroupNameStringUserGroupNamestringUserGroupName*stringrequired#
The name of the user group.
userGroupStatusstringuser_group_statusstruserGroupStatusStringUserGroupStatusstringUserGroupStatus*stringrequired#
The status of the user group Can be 'creating', 'active', 'modifying', 'deleting'.
usersmay be undefinedIUser[]usersmay be undefinedtyping.List[IUser]usersmay be undefinedList<IUser>Usersmay be undefinedIUser[]Usersmay be undefined*[]IUser#
Array of users in the user group.

Do not push directly to this array. Use addUser() instead to ensure proper validation and dependency management.

Methods ​

addUser(user: IUser): voiddef add_user(self, user: IUser) -> Nonepublic void addUser(IUser user)public void AddUser(IUser user)func AddUser(User IUser)#
Add a user to this user group.
1 parameter

Parameters

  • useruseruseruserUser — The user to add to the group.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

fromUserGroupArn(scope: Construct, id: string, userGroupArn: string): IUserGroup@staticmethod def from_user_group_arn(scope: Construct, id: str, user_group_arn: str) -> IUserGrouppublic static IUserGroup fromUserGroupArn(Construct scope, String id, String userGroupArn)public static IUserGroup FromUserGroupArn(Construct scope, string id, string userGroupArn)func FromUserGroupArn(Scope Construct, Id *string, UserGroupArn *string) IUserGroupstatic#
Import an existing user group by ARN.
3 parameters

Parameters

  • scopescopescopescopeScope — The parent creating construct (usually this).
  • ididididId — The construct's name.
  • userGroupArnuser_group_arnuserGroupArnuserGroupArnUserGroupArn — The ARN of the existing user group.
fromUserGroupAttributes(scope: Construct, id: string, attrs: UserGroupAttributes): IUserGroup@staticmethod def from_user_group_attributes(scope: Construct, id: str, attrs: UserGroupAttributes) -> IUserGrouppublic static IUserGroup fromUserGroupAttributes(Construct scope, String id, UserGroupAttributes attrs)public static IUserGroup FromUserGroupAttributes(Construct scope, string id, UserGroupAttributes attrs)func FromUserGroupAttributes(Scope Construct, Id *string, Attrs UserGroupAttributes) IUserGroupstatic#
Import an existing user group using attributes.
3 parameters

Parameters

  • scopescopescopescopeScope — The parent creating construct (usually this).
  • ididididId — The construct's name.
  • attrsattrsattrsattrsAttrs — A UserGroupAttributes object.
fromUserGroupName(scope: Construct, id: string, userGroupName: string): IUserGroup@staticmethod def from_user_group_name(scope: Construct, id: str, user_group_name: str) -> IUserGrouppublic static IUserGroup fromUserGroupName(Construct scope, String id, String userGroupName)public static IUserGroup FromUserGroupName(Construct scope, string id, string userGroupName)func FromUserGroupName(Scope Construct, Id *string, UserGroupName *string) IUserGroupstatic#
Import an existing user group by name.
3 parameters

Parameters

  • scopescopescopescopeScope — The parent creating construct (usually this).
  • ididididId — The construct's name.
  • userGroupNameuser_group_nameuserGroupNameuserGroupNameUserGroupName — The name of the existing user group.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
isUserGroup(x: any): boolean@staticmethod def is_user_group(x: Any) -> boolpublic static Boolean isUserGroup(Object x)public static bool IsUserGroup(object x)func IsUserGroup(X interface{}) *boolstatic#
Return whether the given object is a `UserGroup`.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.