Skip to content

create_asset_filter async

create_asset_filter(
    domain_identifier: DomainId,
    asset_identifier: AssetId,
    name: FilterName,
    configuration: AssetFilterConfiguration,
    *,
    config_overrides: Optional[AsyncDataZoneClientConfig] = None,
    description: Optional[Description] = None,
    client_token: Optional[str] = None,
) -> CreateAssetFilterOutput

Creates a data asset filter.

Asset filters provide a sophisticated way to create controlled views of data assets by selecting specific columns or applying row-level filters. This capability is crucial for organizations that need to share data while maintaining security and privacy controls. For example, your database might be filtered to show only non-PII fields to certain users, or sales data might be filtered by region for different regional teams. Asset filters enable fine-grained access control while maintaining a single source of truth.

Prerequisites:

  • A valid domain (--domain-identifier) must exist.

  • A data asset (--asset-identifier) must already be created under that domain.

  • The asset must have the referenced columns available in its schema for column-based filtering.

  • You cannot specify both (columnConfiguration, rowConfiguration)at the same time.

Parameters:

  • domain_identifier (DomainId) –

    The ID of the domain in which you want to create an asset filter.

  • asset_identifier (AssetId) –

    The ID of the data asset.

  • name (FilterName) –

    The name of the asset filter.

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

    The description of the asset filter.

  • configuration (AssetFilterConfiguration) –

    The configuration of the asset filter.

  • client_token (Optional[str], 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/async_data_zone.py
async def create_asset_filter(
    self,
    domain_identifier: "capo_datazone.types.domain_id.DomainId",
    asset_identifier: "capo_datazone.types.asset_id.AssetId",
    name: "capo_datazone.types.filter_name.FilterName",
    configuration: "capo_datazone.types.asset_filter_configuration.AssetFilterConfiguration",
    *,
    config_overrides: Optional[AsyncDataZoneClientConfig] = None,
    description: Optional["capo_datazone.types.description.Description"] = None,
    client_token: Optional[str] = None,
) -> "capo_datazone.types.create_asset_filter_output.CreateAssetFilterOutput":
    """<p>Creates a data asset filter.</p> <p>Asset filters provide a sophisticated way to create controlled views of data assets by selecting specific columns or applying row-level filters. This capability is crucial for organizations that need to share data while maintaining security and privacy controls. For example, your database might be filtered to show only non-PII fields to certain users, or sales data might be filtered by region for different regional teams. Asset filters enable fine-grained access control while maintaining a single source of truth.</p> <p>Prerequisites:</p> <ul> <li> <p>A valid domain (<code>--domain-identifier</code>) must exist. </p> </li> <li> <p>A data asset (<code>--asset-identifier</code>) must already be created under that domain.</p> </li> <li> <p>The asset must have the referenced columns available in its schema for column-based filtering.</p> </li> <li> <p>You cannot specify both (<code>columnConfiguration</code>, <code>rowConfiguration</code>)at the same time.</p> </li> </ul>

    Args:
        domain_identifier: <p>The ID of the domain in which you want to create an asset filter.</p>
        asset_identifier: <p>The ID of the data asset.</p>
        name: <p>The name of the asset filter.</p>
        description: <p>The description of the asset filter.</p>
        configuration: <p>The configuration of the asset filter.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_datazone.types.create_asset_filter_input.CreateAssetFilterInput]",
    ) -> AsyncOperationResponse[
        "capo_datazone.types.create_asset_filter_output.CreateAssetFilterOutput"
    ]:
        import capo_datazone._operations.data_zone.create_asset_filter

        (
            output,
            http_response,
        ) = await capo_datazone._operations.data_zone.create_asset_filter.async_create_asset_filter(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

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

        return capo_datazone.types.create_asset_filter_input.redact_sensitive(
            input_
        )

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

        return capo_datazone.types.create_asset_filter_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateAssetFilter",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_datazone.types.create_asset_filter_input.CreateAssetFilterInput = {
        "domain_identifier": domain_identifier,
        "asset_identifier": asset_identifier,
        "name": name,
        "configuration": configuration,
    }
    if description is not None:
        input_["description"] = description
    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