Skip to content

update_user async

update_user(
    network_id: NetworkId,
    user_id: UserId,
    *,
    config_overrides: Optional[AsyncWickrClientConfig] = None,
    user_details: Optional[UpdateUserDetails] = None,
) -> UpdateUserResponse

Updates the properties of an existing user in a Wickr network. This operation allows you to modify the user's name, password, security group membership, and invite code settings.

codeValidation, inviteCode, and inviteCodeTtl are restricted to networks under preview only.

Parameters:

  • network_id (NetworkId) –

    The ID of the Wickr network containing the user to update.

  • user_id (UserId) –

    The unique identifier of the user to update.

  • user_details (Optional[UpdateUserDetails], default: None ) –

    An object containing the user details to be updated, such as name, password, security groups, and invite code settings.

Raises:

  • BadRequestError –

    The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.

  • ForbiddenError –

    Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.

  • InternalServerError –

    An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.

  • RateLimitError –

    The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.

  • ResourceNotFoundError –

    The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.

  • UnauthorizedError –

    The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.

  • ValidationError –

    One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Update user information

>>> await client.update_user(network_id='12345678', user_id='12345', user_details={'firstName': 'Jonathan', 'lastName': 'Doe', 'username': '[email protected]', 'securityGroupIds': ['BCTY8Qhe', 'DEPT001']})
Update user with invite code
>>> await client.update_user(network_id='12345678', user_id='12345', user_details={'firstName': 'Jane', 'lastName': 'Smith', 'username': '[email protected]', 'inviteCode': 'NEWINVITE789', 'inviteCodeTtl': 14, 'codeValidation': True})
User not found error
>>> await client.update_user(network_id='12345678', user_id='99999', user_details={'firstName': 'Non', 'lastName': 'Existent', 'username': '[email protected]'})
Invalid userId error
>>> await client.update_user(network_id='12345678', user_id='99999', user_details={'firstName': 'John', 'lastName': 'Doe', 'username': '[email protected]', 'securityGroupIds': ['BCTY8Qhe']})
Source code in docs_src/capo_wickr/_services/async_wickr.py
async def update_user(
    self,
    network_id: "capo_wickr.types.network_id.NetworkId",
    user_id: "capo_wickr.types.user_id.UserId",
    *,
    config_overrides: Optional[AsyncWickrClientConfig] = None,
    user_details: Optional[
        "capo_wickr.types.update_user_details.UpdateUserDetails"
    ] = None,
) -> "capo_wickr.types.update_user_response.UpdateUserResponse":
    """<p>Updates the properties of an existing user in a Wickr network. This operation allows you to modify the user's name, password, security group membership, and invite code settings.</p> <note> <p> <code>codeValidation</code>, <code>inviteCode</code>, and <code>inviteCodeTtl</code> are restricted to networks under preview only.</p> </note>

    Args:
        network_id: <p>The ID of the Wickr network containing the user to update.</p>
        user_id: <p>The unique identifier of the user to update.</p>
        user_details: <p>An object containing the user details to be updated, such as name, password, security groups, and invite code settings.</p>

    Raises:
        capo_wickr.errors.bad_request_error.BadRequestError: <p>The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.</p>
        capo_wickr.errors.forbidden_error.ForbiddenError: <p>Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.</p>
        capo_wickr.errors.internal_server_error.InternalServerError: <p>An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.</p>
        capo_wickr.errors.rate_limit_error.RateLimitError: <p>The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.</p>
        capo_wickr.errors.resource_not_found_error.ResourceNotFoundError: <p>The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.</p>
        capo_wickr.errors.unauthorized_error.UnauthorizedError: <p>The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.</p>
        capo_wickr.errors.validation_error.ValidationError: <p>One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.</p>
        capo_wickr.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Update user information

        >>> await client.update_user(network_id='12345678', user_id='12345', user_details={'firstName': 'Jonathan', 'lastName': 'Doe', 'username': '[email protected]', 'securityGroupIds': ['BCTY8Qhe', 'DEPT001']})
        Update user with invite code

        >>> await client.update_user(network_id='12345678', user_id='12345', user_details={'firstName': 'Jane', 'lastName': 'Smith', 'username': '[email protected]', 'inviteCode': 'NEWINVITE789', 'inviteCodeTtl': 14, 'codeValidation': True})
        User not found error

        >>> await client.update_user(network_id='12345678', user_id='99999', user_details={'firstName': 'Non', 'lastName': 'Existent', 'username': '[email protected]'})
        Invalid userId error

        >>> await client.update_user(network_id='12345678', user_id='99999', user_details={'firstName': 'John', 'lastName': 'Doe', 'username': '[email protected]', 'securityGroupIds': ['BCTY8Qhe']})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_wickr.types.update_user_request.UpdateUserRequest]",
    ) -> AsyncOperationResponse[
        "capo_wickr.types.update_user_response.UpdateUserResponse"
    ]:
        import capo_wickr._operations.wickr_admin_api.update_user

        (
            output,
            http_response,
        ) = await capo_wickr._operations.wickr_admin_api.update_user.async_update_user(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_wickr.types.update_user_request.UpdateUserRequest",
    ) -> dict[str, Any]:
        import capo_wickr.types.update_user_request

        return capo_wickr.types.update_user_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_wickr.types.update_user_response.UpdateUserResponse",
    ) -> dict[str, Any]:
        import capo_wickr.types.update_user_response

        return capo_wickr.types.update_user_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateUser", redact_input=_redact_input, redact_output=_redact_output
        ),
    )
    input_: capo_wickr.types.update_user_request.UpdateUserRequest = {
        "network_id": network_id,
        "user_id": user_id,
    }
    if user_details is not None:
        input_["user_details"] = user_details

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output