Skip to content

create_user_group

create_user_group(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    user_group_id: Optional[String] = None,
    engine: Optional[EngineType] = None,
    user_ids: Optional[UserIdListInput] = None,
    tags: Optional[TagList] = None,
) -> UserGroup

For Valkey engine version 7.2 onwards and Redis OSS 6.0 to 7.1: Creates a user group. For more information, see Using Role Based Access Control (RBAC)

Parameters:

  • user_group_id (Optional[String], default: None ) –

    The ID of the user group. This value is stored as a lowercase string.

  • engine (Optional[EngineType], default: None ) –

    Sets the engine listed in a user group. The options are valkey or redis.

  • user_ids (Optional[UserIdListInput], default: None ) –

    The list of user IDs that belong to the user group.

  • tags (Optional[TagList], default: None ) –

    A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted. Available for Valkey and Redis OSS only.

Raises:

Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def create_user_group(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    user_group_id: Optional["capo_elasticache.types.string.String"] = None,
    engine: Optional["capo_elasticache.types.engine_type.EngineType"] = None,
    user_ids: Optional[
        "capo_elasticache.types.user_id_list_input.UserIdListInput"
    ] = None,
    tags: Optional["capo_elasticache.types.tag_list.TagList"] = None,
) -> "capo_elasticache.types.user_group.UserGroup":
    """<p>For Valkey engine version 7.2 onwards and Redis OSS 6.0 to 7.1: Creates a user group. For more information, see <a href="http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/Clusters.RBAC.html">Using Role Based Access Control (RBAC)</a> </p>

    Args:
        user_group_id: <p>The ID of the user group. This value is stored as a lowercase string.</p>
        engine: <p>Sets the engine listed in a user group. The options are valkey or redis.</p>
        user_ids: <p>The list of user IDs that belong to the user group.</p>
        tags: <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted. Available for Valkey and Redis OSS only.</p>

    Raises:
        capo_elasticache.errors.default_user_required.DefaultUserRequired: <p>You must add default user to a user group.</p>
        capo_elasticache.errors.duplicate_user_name_fault.DuplicateUserNameFault: <p>A user with this username already exists.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The specified service linked role (SLR) was not found.</p>
        capo_elasticache.errors.tag_quota_per_resource_exceeded.TagQuotaPerResourceExceeded: <p>The request cannot be processed because it would cause the resource to have more than the allowed number of tags. The maximum number of tags permitted on a resource is 50.</p>
        capo_elasticache.errors.user_group_already_exists_fault.UserGroupAlreadyExistsFault: <p>The user group with this ID already exists.</p>
        capo_elasticache.errors.user_group_quota_exceeded_fault.UserGroupQuotaExceededFault: <p>The number of users exceeds the user group limit.</p>
        capo_elasticache.errors.user_not_found_fault.UserNotFoundFault: <p>The user does not exist or could not be found.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.create_user_group_message.CreateUserGroupMessage]",
    ) -> OperationResponse["capo_elasticache.types.user_group.UserGroup"]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.create_user_group

        output, http_response = (
            capo_elasticache._operations.amazon_elasti_cache_v9.create_user_group.create_user_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateUserGroup")
    )
    input_: capo_elasticache.types.create_user_group_message.CreateUserGroupMessage = {}
    if user_group_id is not None:
        input_["user_group_id"] = user_group_id
    if engine is not None:
        input_["engine"] = engine
    if user_ids is not None:
        input_["user_ids"] = user_ids
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output