Skip to content

modify_user_group

modify_user_group(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    user_group_id: Optional[String] = None,
    user_ids_to_add: Optional[UserIdListInput] = None,
    user_ids_to_remove: Optional[UserIdListInput] = None,
    engine: Optional[EngineType] = None,
) -> UserGroup

Changes the list of users that belong to the user group.

Parameters:

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

    The ID of the user group.

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

    The list of user IDs to add to the user group.

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

    The list of user IDs to remove from the user group.

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

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

Raises:

Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def modify_user_group(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    user_group_id: Optional["capo_elasticache.types.string.String"] = None,
    user_ids_to_add: Optional[
        "capo_elasticache.types.user_id_list_input.UserIdListInput"
    ] = None,
    user_ids_to_remove: Optional[
        "capo_elasticache.types.user_id_list_input.UserIdListInput"
    ] = None,
    engine: Optional["capo_elasticache.types.engine_type.EngineType"] = None,
) -> "capo_elasticache.types.user_group.UserGroup":
    """<p>Changes the list of users that belong to the user group.</p>

    Args:
        user_group_id: <p>The ID of the user group.</p>
        user_ids_to_add: <p>The list of user IDs to add to the user group.</p>
        user_ids_to_remove: <p>The list of user IDs to remove from the user group.</p>
        engine: <p>Modifies the engine listed in a user group. The options are valkey or redis.</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_combination_exception.InvalidParameterCombinationException: <p>Two or more incompatible parameters were specified.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.invalid_user_group_state_fault.InvalidUserGroupStateFault: <p>The user group is not in an active state.</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.user_group_not_found_fault.UserGroupNotFoundFault: <p>The user group was not found or does not exist</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.modify_user_group_message.ModifyUserGroupMessage]",
    ) -> OperationResponse["capo_elasticache.types.user_group.UserGroup"]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.modify_user_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyUserGroup")
    )
    input_: capo_elasticache.types.modify_user_group_message.ModifyUserGroupMessage = {}
    if user_group_id is not None:
        input_["user_group_id"] = user_group_id
    if user_ids_to_add is not None:
        input_["user_ids_to_add"] = user_ids_to_add
    if user_ids_to_remove is not None:
        input_["user_ids_to_remove"] = user_ids_to_remove
    if engine is not None:
        input_["engine"] = engine

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