Skip to content

put_attachment async

put_attachment(
    asset_identifier: AssetId,
    attachment_name: AttachmentName,
    content: FormContent,
    form_type_id: FormTypeId,
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    iterable_form_name: Optional[IterableFormName] = None,
    item_identifier: Optional[ItemIdentifier] = None,
    client_token: Optional[HashString] = None,
) -> PutAttachmentResponse

Attaches a form to an asset or an iterable form item in Glue Data Catalog. If an attachment with the same name already exists, it is overwritten.

Parameters:

  • asset_identifier (AssetId) –

    The unique identifier of the asset to attach the form to.

  • iterable_form_name (Optional[IterableFormName], default: None ) –

    The name of the iterable form. When specified along with itemIdentifier, the attachment targets an item within the iterable form rather than the asset itself.

  • item_identifier (Optional[ItemIdentifier], default: None ) –

    The identifier of the item within the iterable form. Required when iterableFormName is specified.

  • attachment_name (AttachmentName) –

    The name of the attachment.

  • content (FormContent) –

    The JSON content of the form, conforming to the schema of the specified form type.

  • form_type_id (FormTypeId) –

    The identifier of the form type for this attachment.

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

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Raises:

Source code in docs_src/capo_glue/_services/async_glue.py
async def put_attachment(
    self,
    asset_identifier: "capo_glue.types.asset_id.AssetId",
    attachment_name: "capo_glue.types.attachment_name.AttachmentName",
    content: "capo_glue.types.form_content.FormContent",
    form_type_id: "capo_glue.types.form_type_id.FormTypeId",
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    iterable_form_name: Optional[
        "capo_glue.types.iterable_form_name.IterableFormName"
    ] = None,
    item_identifier: Optional[
        "capo_glue.types.item_identifier.ItemIdentifier"
    ] = None,
    client_token: Optional["capo_glue.types.hash_string.HashString"] = None,
) -> "capo_glue.types.put_attachment_response.PutAttachmentResponse":
    """<p>Attaches a form to an asset or an iterable form item in Glue Data Catalog. If an attachment with the same name already exists, it is overwritten.</p>

    Args:
        asset_identifier: <p>The unique identifier of the asset to attach the form to.</p>
        iterable_form_name: <p>The name of the iterable form. When specified along with <code>itemIdentifier</code>, the attachment targets an item within the iterable form rather than the asset itself.</p>
        item_identifier: <p>The identifier of the item within the iterable form. Required when <code>iterableFormName</code> is specified.</p>
        attachment_name: <p>The name of the attachment.</p>
        content: <p>The JSON content of the form, conforming to the schema of the specified form type.</p>
        form_type_id: <p>The identifier of the form type for this attachment.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>

    Raises:
        capo_glue.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        capo_glue.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Two processes are trying to modify a resource simultaneously.</p>
        capo_glue.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist</p>
        capo_glue.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.throttling_exception.ThrottlingException: <p>The throttling threshhold was exceeded.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_glue.types.put_attachment_request.PutAttachmentRequest]",
    ) -> AsyncOperationResponse[
        "capo_glue.types.put_attachment_response.PutAttachmentResponse"
    ]:
        import capo_glue._operations.aws_glue.put_attachment

        (
            output,
            http_response,
        ) = await capo_glue._operations.aws_glue.put_attachment.async_put_attachment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutAttachment")
    )
    input_: capo_glue.types.put_attachment_request.PutAttachmentRequest = {
        "asset_identifier": asset_identifier,
        "attachment_name": attachment_name,
        "content": content,
        "form_type_id": form_type_id,
    }
    if iterable_form_name is not None:
        input_["iterable_form_name"] = iterable_form_name
    if item_identifier is not None:
        input_["item_identifier"] = item_identifier
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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