From 1d9e119084bdfa82796f1ccd50f8d030c2758be5 Mon Sep 17 00:00:00 2001 From: Tamas Palfy Date: Mon, 19 Sep 2022 17:01:18 +0200 Subject: [PATCH] NIFI-10523 - Improved Google Drive processor documentations. This closes #6430. Signed-off-by: Peter Turcsanyi --- .../gcp/drive/FetchGoogleDrive.java | 3 +- .../processors/gcp/drive/ListGoogleDrive.java | 8 ++- .../additionalDetails.html | 51 +++++++++++++++ .../additionalDetails.html | 62 +++++++++++++++++++ 4 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/resources/docs/org.apache.nifi.processors.gcp.drive.FetchGoogleDrive/additionalDetails.html create mode 100644 nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/resources/docs/org.apache.nifi.processors.gcp.drive.ListGoogleDrive/additionalDetails.html diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/FetchGoogleDrive.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/FetchGoogleDrive.java index 70d97cc511..347534fe9e 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/FetchGoogleDrive.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/FetchGoogleDrive.java @@ -49,7 +49,8 @@ import java.util.Set; @InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED) @Tags({"google", "drive", "storage", "fetch"}) -@CapabilityDescription("Fetches files from a Google Drive Folder. Designed to be used in tandem with ListGoogleDrive.") +@CapabilityDescription("Fetches files from a Google Drive Folder. Designed to be used in tandem with ListGoogleDrive. " + + "For how to setup access to Google Drive please see additional details.") @SeeAlso({ListGoogleDrive.class}) @WritesAttributes({ @WritesAttribute(attribute = FetchGoogleDrive.ERROR_CODE_ATTRIBUTE, description = "The error code returned by Google Drive when the fetch of a file fails"), diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/ListGoogleDrive.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/ListGoogleDrive.java index e5fcbf8f20..02a61d9252 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/ListGoogleDrive.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/drive/ListGoogleDrive.java @@ -71,7 +71,8 @@ import java.util.concurrent.TimeUnit; "Each listed file may result in one flowfile, the metadata being written as flowfile attributes. " + "Or - in case the 'Record Writer' property is set - the entire result is written as records to a single flowfile. " + "This Processor is designed to run on Primary Node only in a cluster. If the primary node changes, the new Primary Node will pick up where the " + - "previous node left off without duplicating all of the data.") + "previous node left off without duplicating all of the data. " + + "For how to setup access to Google Drive please see additional details.") @SeeAlso({FetchGoogleDrive.class}) @InputRequirement(Requirement.INPUT_FORBIDDEN) @WritesAttributes({@WritesAttribute(attribute = GoogleDriveFileInfo.ID, description = "The id of the file"), @@ -89,9 +90,10 @@ public class ListGoogleDrive extends AbstractListProcessor public static final PropertyDescriptor FOLDER_ID = new PropertyDescriptor.Builder() .name("folder-id") .displayName("Folder ID") - .description("The ID of the folder from which to pull list of files. Needs to be shared with a Service Account." + + .description("The ID of the folder from which to pull list of files." + + " For how to setup access to Google Drive and obtain Folder ID please see additional details." + " WARNING: Unauthorized access to the folder is treated as if the folder was empty." + - " This results in the processor not creating result flowfiles. No additional error message is provided.") + " This results in the processor not creating outgoing FlowFiles. No additional error message is provided.") .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) .required(true) diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/resources/docs/org.apache.nifi.processors.gcp.drive.FetchGoogleDrive/additionalDetails.html b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/resources/docs/org.apache.nifi.processors.gcp.drive.FetchGoogleDrive/additionalDetails.html new file mode 100644 index 0000000000..cdcd1421fe --- /dev/null +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/resources/docs/org.apache.nifi.processors.gcp.drive.FetchGoogleDrive/additionalDetails.html @@ -0,0 +1,51 @@ + + + + + + + FetchGoogleDrive + + + + +

Accessing Google Drive from NiFi

+ +

+ This processor uses Google Cloud credentials for authentication to access Google Drive. + The following steps are required to prepare the Google Cloud and Google Drive accounts for the processors: +

+
    +
  1. Enable Google Drive API in Google Cloud + +
  2. +
  3. Grant access to Google Drive folder +
      +
    • In Google Cloud Console navigate to IAM & Admin -> Service Accounts.
    • +
    • Take a note of the email of the service account you are going to use.
    • +
    • Navigate to the folder to be listed in Google Drive.
    • +
    • Right-click on the Folder -> Share.
    • +
    • Enter the service account email.
    • +
    +
  4. +
+ + + \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/resources/docs/org.apache.nifi.processors.gcp.drive.ListGoogleDrive/additionalDetails.html b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/resources/docs/org.apache.nifi.processors.gcp.drive.ListGoogleDrive/additionalDetails.html new file mode 100644 index 0000000000..b089b7e15b --- /dev/null +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/resources/docs/org.apache.nifi.processors.gcp.drive.ListGoogleDrive/additionalDetails.html @@ -0,0 +1,62 @@ + + + + + + + ListGoogleDrive + + + + +

Accessing Google Drive from NiFi

+ +

+ This processor uses Google Cloud credentials for authentication to access Google Drive. + The following steps are required to prepare the Google Cloud and Google Drive accounts for the processors: +

+
    +
  1. Enable Google Drive API in Google Cloud + +
  2. +
  3. Grant access to Google Drive folder +
      +
    • In Google Cloud Console navigate to IAM & Admin -> Service Accounts.
    • +
    • Take a note of the email of the service account you are going to use.
    • +
    • Navigate to the folder to be listed in Google Drive.
    • +
    • Right-click on the Folder -> Share.
    • +
    • Enter the service account email.
    • +
    +
  4. +
  5. Find Folder ID +
      +
    • Navigate to the folder to be listed in Google Drive and enter it. The URL in your browser will include the ID at the end of + the URL. + For example, if the URL were https://drive.google.com/drive/folders/1trTraPVCnX5_TNwO8d9P_bz278xWOmGm, the + Folder ID would be 1trTraPVCnX5_TNwO8d9P_bz278xWOmGm +
    • +
    +
  6. +
  7. Set Folder ID in 'Folder ID' property +
  8. +
+ + + \ No newline at end of file