Skip to content

add_data_source async

add_data_source(
    domain_name: DomainName,
    name: DataSourceName,
    data_source_type: DataSourceType,
    *,
    config_overrides: Optional[AsyncOpenSearchClientConfig] = None,
    description: Optional[DataSourceDescription] = None,
) -> AddDataSourceResponse

Creates a new direct-query data source to the specified domain. For more information, see Creating Amazon OpenSearch Service data source integrations with Amazon S3.

Parameters:

Raises:

  • BaseException –

    An error occurred while processing the request.

  • DependencyFailureException –

    An exception for when a failure in one of the dependencies results in the service being unable to fetch details about the resource.

  • DisabledOperationException –

    An error occured because the client wanted to access an unsupported operation.

  • InternalException –

    Request processing failed because of an unknown error, exception, or internal failure.

  • LimitExceededException –

    An exception for trying to create more than the allowed number of resources or sub-resources.

  • ResourceNotFoundException –

    An exception for accessing or deleting a resource that doesn't exist.

  • ValidationException –

    An exception for accessing or deleting a resource that doesn't exist.

  • UnknownServiceError –

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

Source code in docs_src/capo_opensearch/_services/async_open_search.py
async def add_data_source(
    self,
    domain_name: "capo_opensearch.types.domain_name.DomainName",
    name: "capo_opensearch.types.data_source_name.DataSourceName",
    data_source_type: "capo_opensearch.types.data_source_type.DataSourceType",
    *,
    config_overrides: Optional[AsyncOpenSearchClientConfig] = None,
    description: Optional[
        "capo_opensearch.types.data_source_description.DataSourceDescription"
    ] = None,
) -> "capo_opensearch.types.add_data_source_response.AddDataSourceResponse":
    """<p>Creates a new direct-query data source to the specified domain. For more information, see <a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/direct-query-s3-creating.html">Creating Amazon OpenSearch Service data source integrations with Amazon S3</a>.</p>

    Args:
        domain_name: <p>The name of the domain to add the data source to.</p>
        name: <p>A name for the data source.</p>
        data_source_type: <p>The type of data source.</p>
        description: <p>A description of the data source.</p>

    Raises:
        capo_opensearch.errors.base_exception.BaseException: <p>An error occurred while processing the request.</p>
        capo_opensearch.errors.dependency_failure_exception.DependencyFailureException: <p>An exception for when a failure in one of the dependencies results in the service being unable to fetch details about the resource.</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.limit_exceeded_exception.LimitExceededException: <p>An exception for trying to create more than the allowed number of resources or sub-resources.</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.add_data_source_request.AddDataSourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_opensearch.types.add_data_source_response.AddDataSourceResponse"
    ]:
        import capo_opensearch._operations.amazon_open_search_service.add_data_source

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddDataSource")
    )
    input_: capo_opensearch.types.add_data_source_request.AddDataSourceRequest = {
        "domain_name": domain_name,
        "name": name,
        "data_source_type": data_source_type,
    }
    if description is not None:
        input_["description"] = description

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