OpenSearchService / Client / attach_data_source

attach_data_source

OpenSearchService.Client.attach_data_source(**kwargs)

Attaches a data source to an OpenSearch application. The data source can be an Amazon OpenSearch Service domain or an Amazon OpenSearch Serverless collection. If both the application and data source are in the ACTIVE state, the attachment completes immediately and returns a status of ATTACHED. If either resource is not yet active, the operation stores the request and returns a status of PENDING. A background process then completes the attachment when both resources become active. Pending attachments that are not completed within 24 hours are marked as FAILED. This operation is idempotent. If a data source is already attached or pending for the same application, the existing attachment is returned.

See also: AWS API Documentation

Request Syntax

response = client.attach_data_source(
    id='string',
    dataSourceArn='string',
    workspaceId='string',
    workspaceConfiguration={
        'name': 'string',
        'workspaceType': 'string'
    },
    clientToken='string'
)
Parameters:
  • id (string) –

    [REQUIRED]

    The unique identifier or name of the OpenSearch application to attach the data source to. This is the same identifier used with UpdateApplication, GetApplication, and DeleteApplication.

  • dataSourceArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the domain. See Identifiers for IAM Entities in Using Amazon Web Services Identity and Access Management for more information.

  • workspaceId (string) – The identifier of an existing workspace to update with the new data source. Mutually exclusive with workspaceConfiguration.

  • workspaceConfiguration (dict) –

    Configuration for creating a new workspace during the attachment. If specified, a workspace is created and linked to the data source after the attachment completes. Mutually exclusive with workspaceId.

    • name (string) – [REQUIRED]

      The name of the workspace to create. Must be between 1 and 40 characters and can contain alphanumeric characters, parentheses, brackets, hyphens, underscores, and spaces.

    • workspaceType (string) – [REQUIRED]

      The type of workspace to create, which determines the use-case features enabled for the workspace. Valid values are OBSERVABILITY, SECURITY_ANALYTICS, and SEARCH.

  • clientToken (string) – A unique, case-sensitive identifier to ensure idempotency of the request. If you retry a request with the same client token and the same parameters, the retry succeeds without performing any further actions.

Return type:

dict

Returns:

Response Syntax

{
    'attachmentId': 'string',
    'id': 'string',
    'arn': 'string',
    'dataSourceArn': 'string',
    'status': 'PENDING'|'ATTACHED'|'FAILED'
}

Response Structure

  • (dict) –

    • attachmentId (string) –

      The unique identifier assigned to the data source attachment.

    • id (string) –

      The unique identifier of the OpenSearch application.

    • arn (string) –

      The Amazon Resource Name (ARN) of the domain. See Identifiers for IAM Entities in Using Amazon Web Services Identity and Access Management for more information.

    • dataSourceArn (string) –

      The Amazon Resource Name (ARN) of the domain. See Identifiers for IAM Entities in Using Amazon Web Services Identity and Access Management for more information.

    • status (string) –

      The status of the data source attachment. Valid values are PENDING (waiting for resources to become active), ATTACHED (successfully attached), and FAILED (attachment timed out or encountered a non-retryable error).

Exceptions

  • OpenSearchService.Client.exceptions.ValidationException

  • OpenSearchService.Client.exceptions.AccessDeniedException

  • OpenSearchService.Client.exceptions.InternalException

  • OpenSearchService.Client.exceptions.ConflictException

  • OpenSearchService.Client.exceptions.ResourceNotFoundException

  • OpenSearchService.Client.exceptions.DisabledOperationException