Vincenzo Lombardo created NIFI-16671:
----------------------------------------
Summary: Add GetGCSObjectMetadata Processor
Key: NIFI-16671
URL: https://issues.apache.org/jira/browse/NIFI-16671
Project: Apache NiFi
Issue Type: Improvement
Components: Extensions
Reporter: Vincenzo Lombardo
The AWS bundle provides GetS3ObjectMetadata to check whether an object exists
and to retrieve its metadata without downloading its content. The GCP bundle
has no equivalent: PutGCSObject, FetchGCSObject, DeleteGCSObject and
ListGCSBucket are available, but checking a single object requires either
fetching it (downloading the whole content) or listing the bucket.
Typical use cases:
- verify an object after PutGCSObject (size, CRC32C/MD5, custom metadata)
before deleting the local source;
- route FlowFiles on the existence of an object (found / not found) without
downloading it;
- enrich FlowFiles with object metadata (size, update time, storage class,
custom metadata).
This issue proposes a new processor, GetGCSObjectMetadata, in
nifi-gcp-processors, aligned with GetS3ObjectMetadata and built on
AbstractGCSProcessor.
Properties
- GCP Credentials Provider Service, Project ID, Number of retries, Storage API
URL, Proxy Configuration Service: as in the other GCS processors (Number of
retries configures the client RetrySettings).
- Bucket (default ${gcs.bucket}, FlowFile attribute EL)
- Key (default ${filename}, FlowFile attribute EL)
- Metadata Target: FlowFile Attributes (default) or FlowFile Body (JSON object
replacing the content)
Relationships
- found: the object exists; metadata written according to Metadata Target.
- not found: no object at Bucket/Key (HTTP 404).
- failure: any other error after the client retries (e.g. 403), with
gcs.error.code and gcs.error.message; the FlowFile is penalized.
Attributes (Metadata Target = FlowFile Attributes)
The same gcs.* attributes written by FetchGCSObject (bucket, key, size, cache
control, component count, content disposition/encoding/language, CRC32C,
create/update time, encryption, etag, generated id, generation, MD5, media
link, metageneration, owner, ACLs, URI), plus gcs.content.type and one
gcs.metadata.<key> attribute per custom metadata entry. filename and mime.type
are not changed.
With FlowFile Body, mime.type is set to application/json. gcs.bucket and
gcs.key are written in both modes.
Notes
- Required permission: storage.objects.get. Not restricted, no state, input
required.
- Unit tests with a mocked Storage client: found (both targets), not found (404
exception and null blob), failure with error attributes, null custom metadata
values skipped, EL on Bucket/Key.
Open points for review
- Default Metadata Target: Attributes (consistent with FetchGCSObject) or
FlowFile Body.
- JSON field names in FlowFile Body: header-style names as in
GetS3ObjectMetadata (Content-Length, ETag, Last-Modified...) or the gcs.* names.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)