Skip to content

create_asset

create_asset(
    name: AssetName,
    domain_identifier: DomainId,
    type_identifier: AssetTypeIdentifier,
    owning_project_identifier: ProjectId,
    *,
    config_overrides: Optional[DataZoneClientConfig] = None,
    external_identifier: Optional[ExternalIdentifier] = None,
    type_revision: Optional[Revision] = None,
    description: Optional[Description] = None,
    glossary_terms: Optional[GlossaryTerms] = None,
    forms_input: Optional[FormInputList] = None,
    prediction_configuration: Optional[PredictionConfiguration] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateAssetOutput

Creates an asset in Amazon DataZone catalog.

Before creating assets, make sure that the following requirements are met:

  • --domain-identifier must refer to an existing domain.

  • --owning-project-identifier must be a valid project within the domain.

  • Asset type must be created beforehand using create-asset-type, or be a supported system-defined type. For more information, see create-asset-type.

  • --type-revision (if used) must match a valid revision of the asset type.

  • formsInput is required when it is associated as required in the asset-type. For more information, see create-form-type.

  • Form content must include all required fields as per the form schema (e.g., bucketArn).

You must invoke the following pre-requisite commands before invoking this API:

Parameters:

  • name (AssetName) –

    Asset name.

  • domain_identifier (DomainId) –

    Amazon DataZone domain where the asset is created.

  • external_identifier (Optional[ExternalIdentifier], default: None ) –

    The external identifier of the asset.

    If the value for the externalIdentifier parameter is specified, it must be a unique value.

  • type_identifier (AssetTypeIdentifier) –

    The unique identifier of this asset's type.

  • type_revision (Optional[Revision], default: None ) –

    The revision of this asset's type.

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

    Asset description.

  • glossary_terms (Optional[GlossaryTerms], default: None ) –

    Glossary terms attached to the asset.

  • forms_input (Optional[FormInputList], default: None ) –

    Metadata forms attached to the asset.

  • owning_project_identifier (ProjectId) –

    The unique identifier of the project that owns this asset.

  • prediction_configuration (Optional[PredictionConfiguration], default: None ) –

    The configuration of the automatically generated business-friendly metadata for the asset.

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

    A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.

Raises:

Source code in docs_src/capo_datazone/_services/data_zone.py
def create_asset(
    self,
    name: "capo_datazone.types.asset_name.AssetName",
    domain_identifier: "capo_datazone.types.domain_id.DomainId",
    type_identifier: "capo_datazone.types.asset_type_identifier.AssetTypeIdentifier",
    owning_project_identifier: "capo_datazone.types.project_id.ProjectId",
    *,
    config_overrides: Optional[DataZoneClientConfig] = None,
    external_identifier: Optional[
        "capo_datazone.types.external_identifier.ExternalIdentifier"
    ] = None,
    type_revision: Optional["capo_datazone.types.revision.Revision"] = None,
    description: Optional["capo_datazone.types.description.Description"] = None,
    glossary_terms: Optional[
        "capo_datazone.types.glossary_terms.GlossaryTerms"
    ] = None,
    forms_input: Optional[
        "capo_datazone.types.form_input_list.FormInputList"
    ] = None,
    prediction_configuration: Optional[
        "capo_datazone.types.prediction_configuration.PredictionConfiguration"
    ] = None,
    client_token: Optional["capo_datazone.types.client_token.ClientToken"] = None,
) -> "capo_datazone.types.create_asset_output.CreateAssetOutput":
    """<p>Creates an asset in Amazon DataZone catalog.</p> <p>Before creating assets, make sure that the following requirements are met:</p> <ul> <li> <p> <code>--domain-identifier</code> must refer to an existing domain.</p> </li> <li> <p> <code>--owning-project-identifier</code> must be a valid project within the domain.</p> </li> <li> <p>Asset type must be created beforehand using <code>create-asset-type</code>, or be a supported system-defined type. For more information, see <a href="https://docs.aws.amazon.com/cli/latest/reference/datazone/create-asset-type.html">create-asset-type</a>.</p> </li> <li> <p> <code>--type-revision</code> (if used) must match a valid revision of the asset type.</p> </li> <li> <p> <code>formsInput</code> is required when it is associated as required in the <code>asset-type</code>. For more information, see <a href="https://docs.aws.amazon.com/cli/latest/reference/datazone/create-form-type.html">create-form-type</a>.</p> </li> <li> <p>Form content must include all required fields as per the form schema (e.g., <code>bucketArn</code>).</p> </li> </ul> <p>You must invoke the following pre-requisite commands before invoking this API:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/datazone/latest/APIReference/API_CreateFormType.html">CreateFormType</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/datazone/latest/APIReference/API_CreateAssetType.html">CreateAssetType</a> </p> </li> </ul>

    Args:
        name: <p>Asset name.</p>
        domain_identifier: <p>Amazon DataZone domain where the asset is created.</p>
        external_identifier: <p>The external identifier of the asset.</p> <p>If the value for the <code>externalIdentifier</code> parameter is specified, it must be a unique value.</p>
        type_identifier: <p>The unique identifier of this asset's type.</p>
        type_revision: <p>The revision of this asset's type.</p>
        description: <p>Asset description.</p>
        glossary_terms: <p>Glossary terms attached to the asset.</p>
        forms_input: <p>Metadata forms attached to the asset.</p>
        owning_project_identifier: <p>The unique identifier of the project that owns this asset.</p>
        prediction_configuration: <p>The configuration of the automatically generated business-friendly metadata for the asset.</p>
        client_token: <p>A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.</p>

    Raises:
        capo_datazone.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_datazone.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_datazone.errors.unauthorized_exception.UnauthorizedException: <p>You do not have permission to perform this action.</p>
        capo_datazone.errors.conflict_exception.ConflictException: <p>There is a conflict while performing this action.</p>
        capo_datazone.errors.internal_server_exception.InternalServerException: <p>The request has failed because of an unknown error, exception or failure.</p>
        capo_datazone.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource cannot be found.</p>
        capo_datazone.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request has exceeded the specified service quota.</p>
        capo_datazone.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the Amazon Web Services service.</p>
        capo_datazone.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_datazone.types.create_asset_input.CreateAssetInput]",
    ) -> OperationResponse[
        "capo_datazone.types.create_asset_output.CreateAssetOutput"
    ]:
        import capo_datazone._operations.data_zone.create_asset

        output, http_response = (
            capo_datazone._operations.data_zone.create_asset.create_asset(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_datazone.types.create_asset_input.CreateAssetInput",
    ) -> dict[str, Any]:
        import capo_datazone.types.create_asset_input

        return capo_datazone.types.create_asset_input.redact_sensitive(input_)

    def _redact_output(
        output: "capo_datazone.types.create_asset_output.CreateAssetOutput",
    ) -> dict[str, Any]:
        import capo_datazone.types.create_asset_output

        return capo_datazone.types.create_asset_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateAsset", redact_input=_redact_input, redact_output=_redact_output
        ),
    )
    input_: capo_datazone.types.create_asset_input.CreateAssetInput = {
        "name": name,
        "domain_identifier": domain_identifier,
        "type_identifier": type_identifier,
        "owning_project_identifier": owning_project_identifier,
    }
    if external_identifier is not None:
        input_["external_identifier"] = external_identifier
    if type_revision is not None:
        input_["type_revision"] = type_revision
    if description is not None:
        input_["description"] = description
    if glossary_terms is not None:
        input_["glossary_terms"] = glossary_terms
    if forms_input is not None:
        input_["forms_input"] = forms_input
    if prediction_configuration is not None:
        input_["prediction_configuration"] = prediction_configuration
    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