Skip to content

update_connection_alias_permission async

update_connection_alias_permission(
    alias_id: ConnectionAliasId,
    connection_alias_permission: ConnectionAliasPermission,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> UpdateConnectionAliasPermissionResult

Shares or unshares a connection alias with one account by specifying whether that account has permission to associate the connection alias with a directory. If the association permission is granted, the connection alias is shared with that account. If the association permission is revoked, the connection alias is unshared with the account. For more information, see Cross-Region Redirection for Amazon WorkSpaces.

  • Before performing this operation, call DescribeConnectionAliases to make sure that the current state of the connection alias is CREATED.

  • To delete a connection alias that has been shared, the shared account must first disassociate the connection alias from any directories it has been associated with. Then you must unshare the connection alias from the account it has been shared with. You can delete a connection alias only after it is no longer shared with any accounts or associated with any directories.

Parameters:

  • alias_id (ConnectionAliasId) –

    The identifier of the connection alias that you want to update permissions for.

  • connection_alias_permission (ConnectionAliasPermission) –

    Indicates whether to share or unshare the connection alias with the specified Amazon Web Services account.

Raises:

Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def update_connection_alias_permission(
    self,
    alias_id: "capo_workspaces.types.connection_alias_id.ConnectionAliasId",
    connection_alias_permission: "capo_workspaces.types.connection_alias_permission.ConnectionAliasPermission",
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> "capo_workspaces.types.update_connection_alias_permission_result.UpdateConnectionAliasPermissionResult":
    """<p>Shares or unshares a connection alias with one account by specifying whether that account has permission to associate the connection alias with a directory. If the association permission is granted, the connection alias is shared with that account. If the association permission is revoked, the connection alias is unshared with the account. For more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/cross-region-redirection.html"> Cross-Region Redirection for Amazon WorkSpaces</a>.</p> <note> <ul> <li> <p>Before performing this operation, call <a href="https://docs.aws.amazon.com/workspaces/latest/api/API_DescribeConnectionAliases.html"> DescribeConnectionAliases</a> to make sure that the current state of the connection alias is <code>CREATED</code>.</p> </li> <li> <p>To delete a connection alias that has been shared, the shared account must first disassociate the connection alias from any directories it has been associated with. Then you must unshare the connection alias from the account it has been shared with. You can delete a connection alias only after it is no longer shared with any accounts or associated with any directories.</p> </li> </ul> </note>

    Args:
        alias_id: <p>The identifier of the connection alias that you want to update permissions for.</p>
        connection_alias_permission: <p>Indicates whether to share or unshare the connection alias with the specified Amazon Web Services account.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.invalid_parameter_values_exception.InvalidParameterValuesException: <p>One or more parameter values are not valid.</p>
        capo_workspaces.errors.invalid_resource_state_exception.InvalidResourceStateException: <p>The state of the resource is not valid for this operation.</p>
        capo_workspaces.errors.operation_not_supported_exception.OperationNotSupportedException: <p>This operation is not supported.</p>
        capo_workspaces.errors.resource_associated_exception.ResourceAssociatedException: <p>The resource is associated with a directory.</p>
        capo_workspaces.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>Your resource limits have been exceeded.</p>
        capo_workspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces.types.update_connection_alias_permission_request.UpdateConnectionAliasPermissionRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.update_connection_alias_permission_result.UpdateConnectionAliasPermissionResult"
    ]:
        import capo_workspaces._operations.workspaces_service.update_connection_alias_permission

        (
            output,
            http_response,
        ) = await capo_workspaces._operations.workspaces_service.update_connection_alias_permission.async_update_connection_alias_permission(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateConnectionAliasPermission")
    )
    input_: capo_workspaces.types.update_connection_alias_permission_request.UpdateConnectionAliasPermissionRequest = {
        "alias_id": alias_id,
        "connection_alias_permission": connection_alias_permission,
    }

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