Skip to content

create_lookup

create_lookup(
    name: LookupName,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    description: Optional[LookupDescription] = None,
    body: Optional[LookupBody] = None,
    query_id: Optional[LookupQueryId] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateLookupResponse

Creates a lookup table from CSV content. A lookup table is a named set of rows that telemetry queries can join against. Every column is stored as a string. Lookup table names must be unique within the account and Region.

Parameters:

  • name (LookupName) –

    The name of the lookup table. Lookup table names must be unique within the account and Region.

  • description (Optional[LookupDescription], default: None ) –

    A description of the lookup table. An empty string is equivalent to omitting this field: the table is created with no description.

  • body (Optional[LookupBody], default: None ) –

    The CSV content of the lookup table. Exactly one of body and queryId must be specified.

  • query_id (Optional[LookupQueryId], default: None ) –

    The identifier of a query whose results become the lookup table's content.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The ARN of a customer managed KMS key used to encrypt the lookup table's content.

  • tags (Optional[TagMap], default: None ) –

    Resource tags.

  • client_token (Optional[ClientToken], default: None ) –

    Idempotency token for safe retries. Retrying with the same token returns the original lookup table instead of creating a duplicate.

Raises:

Examples:

Create a lookup table The following example creates a lookup table from CSV content. The first CSV record is the header and supplies the column names. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.create_lookup(name='service_owners', description='Owning team per service', body='service,team\ncheckout,payments\nsearch,discovery\n', tags={'Team': 'observability'}, client_token='3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73')
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def create_lookup(
    self,
    name: "capo_cloudwatchomni.types.lookup_name.LookupName",
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    description: Optional[
        "capo_cloudwatchomni.types.lookup_description.LookupDescription"
    ] = None,
    body: Optional["capo_cloudwatchomni.types.lookup_body.LookupBody"] = None,
    query_id: Optional[
        "capo_cloudwatchomni.types.lookup_query_id.LookupQueryId"
    ] = None,
    kms_key_arn: Optional["capo_cloudwatchomni.types.kms_key_arn.KmsKeyArn"] = None,
    tags: Optional["capo_cloudwatchomni.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_cloudwatchomni.types.client_token.ClientToken"
    ] = None,
) -> "capo_cloudwatchomni.types.create_lookup_response.CreateLookupResponse":
    r"""Creates a lookup table from CSV content. A lookup table is a named set of rows that telemetry queries can join against. Every column is stored as a string. Lookup table names must be unique within the account and Region.

    Args:
        name: The name of the lookup table. Lookup table names must be unique within the account and Region.
        description: A description of the lookup table. An empty string is equivalent to omitting this field: the table is created with no description.
        body: The CSV content of the lookup table. Exactly one of body and queryId must be specified.
        query_id: The identifier of a query whose results become the lookup table's content.
        kms_key_arn: The ARN of a customer managed KMS key used to encrypt the lookup table's content.
        tags: Resource tags.
        client_token: Idempotency token for safe retries. Retrying with the same token returns the original lookup table instead of creating a duplicate.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.conflict_exception.ConflictException: The operation could not be completed because of a conflict with the current state of the resource.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: A service quota was exceeded.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create a lookup table
        The following example creates a lookup table from CSV content. The first CSV record is the header and supplies the column names. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.create_lookup(name='service_owners', description='Owning team per service', body='service,team\ncheckout,payments\nsearch,discovery\n', tags={'Team': 'observability'}, client_token='3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73')
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.create_lookup_request.CreateLookupRequest]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.create_lookup_response.CreateLookupResponse"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_lookup

        output, http_response = (
            capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_lookup.create_lookup(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cloudwatchomni.types.create_lookup_request.CreateLookupRequest",
    ) -> dict[str, Any]:
        import capo_cloudwatchomni.types.create_lookup_request

        return capo_cloudwatchomni.types.create_lookup_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateLookup", redact_input=_redact_input),
    )
    input_: capo_cloudwatchomni.types.create_lookup_request.CreateLookupRequest = {
        "name": name
    }
    if description is not None:
        input_["description"] = description
    if body is not None:
        input_["body"] = body
    if query_id is not None:
        input_["query_id"] = query_id
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output