Skip to content

unshare_directory async

unshare_directory(
    directory_id: DirectoryId,
    unshare_target: UnshareTarget,
    *,
    config_overrides: Optional[AsyncDirectoryServiceClientConfig] = None,
) -> UnshareDirectoryResult

Stops the directory sharing between the directory owner and consumer accounts.

Parameters:

  • directory_id (DirectoryId) –

    The identifier of the Managed Microsoft AD directory that you want to stop sharing.

  • unshare_target (UnshareTarget) –

    Identifier for the directory consumer account with whom the directory has to be unshared.

Raises:

Source code in docs_src/capo_directory_service/_services/async_directory_service.py
async def unshare_directory(
    self,
    directory_id: "capo_directory_service.types.directory_id.DirectoryId",
    unshare_target: "capo_directory_service.types.unshare_target.UnshareTarget",
    *,
    config_overrides: Optional[AsyncDirectoryServiceClientConfig] = None,
) -> "capo_directory_service.types.unshare_directory_result.UnshareDirectoryResult":
    """<p>Stops the directory sharing between the directory owner and consumer accounts. </p>

    Args:
        directory_id: <p>The identifier of the Managed Microsoft AD directory that you want to stop sharing.</p>
        unshare_target: <p>Identifier for the directory consumer account with whom the directory has to be unshared.</p>

    Raises:
        capo_directory_service.errors.client_exception.ClientException: <p>A client exception has occurred.</p>
        capo_directory_service.errors.directory_not_shared_exception.DirectoryNotSharedException: <p>The specified directory has not been shared with this Amazon Web Services account.</p>
        capo_directory_service.errors.entity_does_not_exist_exception.EntityDoesNotExistException: <p>The specified entity could not be found.</p>
        capo_directory_service.errors.invalid_target_exception.InvalidTargetException: <p>The specified shared target is not valid.</p>
        capo_directory_service.errors.service_exception.ServiceException: <p>An exception has occurred in Directory Service.</p>
        capo_directory_service.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_directory_service.types.unshare_directory_request.UnshareDirectoryRequest]",
    ) -> AsyncOperationResponse[
        "capo_directory_service.types.unshare_directory_result.UnshareDirectoryResult"
    ]:
        import capo_directory_service._operations.directory_service_20150416.unshare_directory

        (
            output,
            http_response,
        ) = await capo_directory_service._operations.directory_service_20150416.unshare_directory.async_unshare_directory(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UnshareDirectory")
    )
    input_: capo_directory_service.types.unshare_directory_request.UnshareDirectoryRequest = {
        "directory_id": directory_id,
        "unshare_target": unshare_target,
    }

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