Vinz2168 opened a new pull request, #12005:
URL: https://github.com/apache/nifi/pull/12005

   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with 
-->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 
-->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-16671](https://issues.apache.org/jira/browse/NIFI-16671)
   
   This PR adds `GetGCSObjectMetadata` to `nifi-gcp-processors`. It is the 
Google Cloud Storage counterpart of `GetS3ObjectMetadata`: it checks whether an 
object exists and reads its metadata without downloading the content.
   
   - Extends `AbstractGCSProcessor` and shares the common GCS properties: GCP 
Credentials Provider Service, Project ID, Number of retries (client 
`RetrySettings`), Storage API URL and Proxy Configuration Service.
   - `Bucket` defaults to `${gcs.bucket}` and `Key` defaults to `${filename}`. 
Both support FlowFile attribute Expression Language.
   - `Metadata Target`:
     - `FlowFile Attributes` (default) writes the same `gcs.*` attributes as 
`FetchGCSObject`, plus `gcs.content.type` and one `gcs.metadata.<key>` 
attribute per custom metadata entry. `filename` and `mime.type` are not changed.
     - `FlowFile Body` replaces the content with a JSON object and sets 
`mime.type` to `application/json; charset=UTF-8`.
   - `gcs.bucket` and `gcs.key` are written in both modes.
   - Relationships:
     - `found`
     - `not found`: HTTP 404, or no blob returned by the client.
     - `failure`: any other error. Sets `gcs.error.code` and 
`gcs.error.message` and penalizes the FlowFile.
   - Custom metadata entries with a null value are skipped in both modes.
   - The JSON body uses header-style names, as in `GetS3ObjectMetadata`: 
`Content-Length`, `Content-Type`, `Content-Disposition`, `Content-Encoding`, 
`Content-Language`, `Cache-Control`, `ETag`, `Last-Modified` (epoch 
milliseconds), `Storage-Class`, `CRC32C`, `MD5`, `Generation` and 
`Metageneration`. Fields without a value are omitted. Custom metadata entries 
are top-level fields.
   - Required permission: `storage.objects.get`.
   
   Unit tests use a mocked `Storage` client, following `FetchGCSObjectTest` and 
`DeleteGCSObjectTest`. They cover:
   - found with both Metadata Targets
   - not found from a 404 exception and from a null blob
   - failure with error attributes, including an unexpected exception
   - null custom metadata values
   - Expression Language on Bucket and Key
   - empty Key
   - the `AbstractGCSTest` storage options checks
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-00000`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-00000`
   - [x] Pull request contains [commits 
signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
 with a registered key indicating `Verified` status
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [ ] Build completed using `./mvnw clean install -P contrib-check` (only 
the module build below was run)
     - [x] JDK 21
     - [ ] JDK 25
   
   Module build `./mvnw -pl 
nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors -am clean install -P 
contrib-check`: BUILD SUCCESS with JDK 21.0.12, 206 tests in 
nifi-gcp-processors, Checkstyle, PMD and RAT passing.
   
   ### Licensing
   
   - [x] No new dependencies
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to