Skip to content

put_asset

put_asset(
    asset_type_id: AssetTypeId,
    identifier: AssetId,
    name: AssetName,
    forms: AssetFormMap,
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    description: Optional[AssetDescription] = None,
    client_token: Optional[HashString] = None,
) -> PutAssetResponse

Creates or updates an asset in Glue Data Catalog. If the asset already exists, this operation updates it; otherwise, a new asset is created.

Parameters:

  • asset_type_id (AssetTypeId) –

    The identifier of the asset type for the asset.

  • identifier (AssetId) –

    The unique identifier of the asset. If an asset with this identifier already exists, it is updated.

  • name (AssetName) –

    The name of the asset.

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

    The description of the asset.

  • forms (AssetFormMap) –

    The forms to set on the asset, keyed by form name. Each entry specifies the form type and its JSON content.

  • 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/glue.py
def put_asset(
    self,
    asset_type_id: "capo_glue.types.asset_type_id.AssetTypeId",
    identifier: "capo_glue.types.asset_id.AssetId",
    name: "capo_glue.types.asset_name.AssetName",
    forms: "capo_glue.types.asset_form_map.AssetFormMap",
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    description: Optional[
        "capo_glue.types.asset_description.AssetDescription"
    ] = None,
    client_token: Optional["capo_glue.types.hash_string.HashString"] = None,
) -> "capo_glue.types.put_asset_response.PutAssetResponse":
    """<p>Creates or updates an asset in Glue Data Catalog. If the asset already exists, this operation updates it; otherwise, a new asset is created.</p>

    Args:
        asset_type_id: <p>The identifier of the asset type for the asset.</p>
        identifier: <p>The unique identifier of the asset. If an asset with this identifier already exists, it is updated.</p>
        name: <p>The name of the asset.</p>
        description: <p>The description of the asset.</p>
        forms: <p>The forms to set on the asset, keyed by form name. Each entry specifies the form type and its JSON content.</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.
    """

    def _handler(
        req: "OperationRequest[capo_glue.types.put_asset_request.PutAssetRequest]",
    ) -> OperationResponse["capo_glue.types.put_asset_response.PutAssetResponse"]:
        import capo_glue._operations.aws_glue.put_asset

        output, http_response = capo_glue._operations.aws_glue.put_asset.put_asset(
            req.options, req.input
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutAsset")
    )
    input_: capo_glue.types.put_asset_request.PutAssetRequest = {
        "asset_type_id": asset_type_id,
        "identifier": identifier,
        "name": name,
        "forms": forms,
    }
    if description is not None:
        input_["description"] = description
    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