createAssetFilter method

Future<CreateAssetFilterOutput> createAssetFilter({
  1. required String assetIdentifier,
  2. required AssetFilterConfiguration configuration,
  3. required String domainIdentifier,
  4. required String name,
  5. String? clientToken,
  6. String? description,
})

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.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter assetIdentifier : The ID of the data asset.

Parameter configuration : The configuration of the asset filter.

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

Parameter name : The name of the asset filter.

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

Parameter description : The description of the asset filter.

Implementation

Future<CreateAssetFilterOutput> createAssetFilter({
  required String assetIdentifier,
  required AssetFilterConfiguration configuration,
  required String domainIdentifier,
  required String name,
  String? clientToken,
  String? description,
}) async {
  final $payload = <String, dynamic>{
    'configuration': configuration,
    'name': name,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v2/domains/${Uri.encodeComponent(domainIdentifier)}/assets/${Uri.encodeComponent(assetIdentifier)}/filters',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAssetFilterOutput.fromJson(response);
}