Skip to content

detach_data_source async

detach_data_source(
    id: Id,
    data_source_arn: ARN,
    *,
    config_overrides: Optional[AsyncOpenSearchClientConfig] = None,
) -> DetachDataSourceResponse

Removes a data source from an OpenSearch application. The application must be in the ACTIVE state. This operation removes the data source saved object from the application and deletes the attachment record. Throws a ConflictException if the specified data source has a PENDING attachment, and a ResourceNotFoundException if the data source is not currently attached to the application.

Parameters:

  • id (Id) –

    The unique identifier or name of the OpenSearch application to detach the data source from.

Raises:

Source code in docs_src/capo_opensearch/_services/async_open_search.py
async def detach_data_source(
    self,
    id: "capo_opensearch.types.id.Id",
    data_source_arn: "capo_opensearch.types.arn.ARN",
    *,
    config_overrides: Optional[AsyncOpenSearchClientConfig] = None,
) -> "capo_opensearch.types.detach_data_source_response.DetachDataSourceResponse":
    """<p>Removes a data source from an OpenSearch application. The application must be in the <code>ACTIVE</code> state. This operation removes the data source saved object from the application and deletes the attachment record. Throws a <code>ConflictException</code> if the specified data source has a <code>PENDING</code> attachment, and a <code>ResourceNotFoundException</code> if the data source is not currently attached to the application.</p>

    Args:
        id: <p>The unique identifier or name of the OpenSearch application to detach the data source from.</p>

    Raises:
        capo_opensearch.errors.access_denied_exception.AccessDeniedException: <p>An error occurred because you don't have permissions to access the resource.</p>
        capo_opensearch.errors.conflict_exception.ConflictException: <p>An error occurred because the client attempts to remove a resource that is currently in use.</p>
        capo_opensearch.errors.disabled_operation_exception.DisabledOperationException: <p>An error occured because the client wanted to access an unsupported operation.</p>
        capo_opensearch.errors.internal_exception.InternalException: <p>Request processing failed because of an unknown error, exception, or internal failure.</p>
        capo_opensearch.errors.resource_not_found_exception.ResourceNotFoundException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.validation_exception.ValidationException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_opensearch.types.detach_data_source_request.DetachDataSourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_opensearch.types.detach_data_source_response.DetachDataSourceResponse"
    ]:
        import capo_opensearch._operations.amazon_open_search_service.detach_data_source

        (
            output,
            http_response,
        ) = await capo_opensearch._operations.amazon_open_search_service.detach_data_source.async_detach_data_source(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DetachDataSource")
    )
    input_: capo_opensearch.types.detach_data_source_request.DetachDataSourceRequest = {
        "id": id,
        "data_source_arn": data_source_arn,
    }

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