This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1030151a2241c2949b17582bee8d2d8fe283bcb8 Author: Nicolas Filotto <[email protected]> AuthorDate: Tue Mar 22 16:06:09 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-google-storage --- .../component/google/storage/google-storage.json | 28 +++++++++ .../src/main/docs/google-storage-component.adoc | 70 +--------------------- .../storage/GoogleCloudStorageConstants.java | 49 +++++++++++++++ .../google/storage/GoogleCloudStorageConsumer.java | 2 +- .../google/storage/GoogleCloudStorageEndpoint.java | 2 +- 5 files changed, 82 insertions(+), 69 deletions(-) diff --git a/components/camel-google/camel-google-storage/src/generated/resources/org/apache/camel/component/google/storage/google-storage.json b/components/camel-google/camel-google-storage/src/generated/resources/org/apache/camel/component/google/storage/google-storage.json index 576b619..86a7dfb 100644 --- a/components/camel-google/camel-google-storage/src/generated/resources/org/apache/camel/component/google/storage/google-storage.json +++ b/components/camel-google/camel-google-storage/src/generated/resources/org/apache/camel/component/google/storage/google-storage.json @@ -41,6 +41,34 @@ "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.storage.GoogleCloudStorageOperations", "enum": [ "copyObject", "listObjects", "deleteObject", "deleteBucket", "listBuckets", "getObject", "createDownloadLink" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudSto [...] "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] }, + "headers": { + "CamelGoogleCloudStorageOperation": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.google.storage.GoogleCloudStorageOperations", "enum": [ "copyObject", "listObjects", "deleteObject", "deleteBucket", "listBuckets", "getObject", "createDownloadLink" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform." }, + "CamelGoogleCloudStorageBucketName": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The bucket Name which this object will be stored or which will be used for the current operation" }, + "CamelGoogleCloudStorageObjectName": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The object Name which will be used for the current operation" }, + "CamelGoogleCloudStorageDestinationObjectName": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The object Destination Name which will be used for the current operation" }, + "CamelGoogleCloudStorageDestinationBucketName": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The bucket Destination Name which will be used for the current operation" }, + "CamelGoogleCloudStorageDownloadLinkExpirationTime": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "300000", "description": "The time in millisecond the download link will be valid." }, + "CamelGoogleCloudStorageContentLength": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content length of this object." }, + "CamelGoogleCloudStorageContentType": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content type of this object." }, + "CamelGoogleCloudStorageCacheControl": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Cache-Control metadata can specify two different aspects of how data is served from Cloud Storage: whether the data can be cached and whether the data can be transformed" }, + "CamelGoogleCloudStorageContentDisposition": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content disposition of this object." }, + "CamelGoogleCloudStorageContentEncoding": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content encoding of this object." }, + "CamelGoogleCloudStorageContentMd5": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The md5 checksum of this object." }, + "CamelFileName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the blob" }, + "CamelGoogleCloudStorageComponentCount": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The component count of this object" }, + "CamelGoogleCloudStorageContentLanguage": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Content-Language metadata indicates the language(s) that the object is intended for." }, + "CamelGoogleCloudStorageCustomTime": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Custom-Time metadata is a user-specified date and time represented in the RFC 3339 format YYYY-MM-DD'T'HH:MM:SS.SS'Z' or YYYY-MM-DD'T'HH:MM:SS'Z' when milliseconds are zero. This metadata is typically set in order to use the DaysS [...] + "CamelGoogleCloudStorageCrc32cHex": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The CRC32c of the object" }, + "CamelGoogleCloudStorageETag": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ETag for the Object." }, + "CamelGoogleCloudStorageGeneration": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Is the generation number of the object for which you are retrieving information." }, + "CamelGoogleCloudStorageBlobId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "com.google.cloud.storage.BlobId", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The blob id of the object" }, + "CamelGoogleCloudStorageKmsKeyName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The KMS key name" }, + "CamelGoogleCloudStorageMediaLink": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The media link" }, + "CamelGoogleCloudStorageMetageneration": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The metageneration of the object" }, + "CamelGoogleCloudStorageStorageClass": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "com.google.cloud.storage.StorageClass", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The storage class of the object" }, + "CamelGoogleCloudStorageCreateTime": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The creation time of the object" }, + "CamelGoogleCloudStorageLastUpdate": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The last update of the object" } + }, "properties": { "bucketName": { "kind": "path", "displayName": "Bucket Name", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageConfiguration", "configurationField": "configuration", "description": "Bucket name or ARN" }, "autoCreateBucket": { "kind": "parameter", "displayName": "Auto Create Bucket", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.google.storage.GoogleCloudStorageConfiguration", "configurationField": "configuration", "description": "Setting the autocreation of the bucket bucketName." }, diff --git a/components/camel-google/camel-google-storage/src/main/docs/google-storage-component.adoc b/components/camel-google/camel-google-storage/src/main/docs/google-storage-component.adoc index b010d5f..ea4afa5 100644 --- a/components/camel-google/camel-google-storage/src/main/docs/google-storage-component.adoc +++ b/components/camel-google/camel-google-storage/src/main/docs/google-storage-component.adoc @@ -89,73 +89,9 @@ include::partial$component-endpoint-options.adoc[] == Usage -=== Message headers evaluated by the Google Storage Producer - -[width="100%",cols="10%,10%,80%",options="header",] -|======================================================================= -|Header |Type |Description - -|`CamelGoogleCloudStorageBucketName` |`String` |The bucket Name which this object will be stored or which will be used for the current operation - -|`CamelGoogleCloudStorageObjectName` |`String` |The object Name which will be used for the current operation - -|`CamelGoogleCloudStorageDestinationBucketName` |`String` |The bucket Destination Name which will be used for the current operation - -|`CamelGoogleCloudStorageDestinationObjectName` |`String` |The object Destination Name which will be used for the current operation - -|`CamelGoogleCloudStorageContentLength` |`Long` |The content length of this object. - -|`CamelGoogleCloudStorageContentType` |`String` |The content type of this object. - -|`CamelGoogleCloudStorageContentDisposition` |`String` |The content disposition of this object. - -|`CamelGoogleCloudStorageContentEncoding` |`String` |The content encoding of this object. - -|`CamelGoogleCloudStorageContentMd5` |`String` |The md5 checksum of this object. - -|`CamelGoogleCloudStorageOperation` |`String` |The operation to perform. Permitted values are copyObject, listObjects, deleteObject, deleteBucket, listBuckets, getObject, createDownloadLink - -|`CamelGoogleCloudStorageDownloadLinkExpirationTime` |`Long` |The time in millisecond the download link will be valid. - -|======================================================================= - -=== Message headers set by the Google Storage Producer - -[width="100%",cols="10%,10%,80%",options="header",] -|======================================================================= -|Header |Type |Description - -|`CamelGoogleCloudStorageETag` |`String` |The ETag value for the newly uploaded object. - -|======================================================================= - -=== Message headers set by the Google Storage Consumer - -[width="100%",cols="10%,10%,80%",options="header",] -|======================================================================= -|Header |Type |Description -|`CamelGoogleCloudStorageBucketName` |`String` |The bucket Name which this object will be stored or which will be used for the current operation -|`CamelGoogleCloudStorageObjectName` |`String` |The object Name which will be used for the current operation -| `CamelGoogleCloudStorageCacheControl` |`String` | The Cache-Control metadata can specify two different aspects of how data is served from Cloud Storage: whether the data can be cached and whether the data can be transformed -| `CamelGoogleCloudStorageComponentCount` |`String` | The component count of this object -| `CamelGoogleCloudStorageContentDisposition` |`String` |The content disposition of this object. -| `CamelGoogleCloudStorageContentEncoding` |`String` |The content encoding of this object. -| `CamelGoogleCloudStorageContentLanguage` |`String` | The Content-Language metadata indicates the language(s) that the object is intended for. -| `CamelGoogleCloudStorageContentType` |`String` |The content type of this object. -| `CamelGoogleCloudStorageCustomTime` |`String` | The Custom-Time metadata is a user-specified date and time represented in the RFC 3339 format YYYY-MM-DD'T'HH:MM:SS.SS'Z' or YYYY-MM-DD'T'HH:MM:SS'Z' when milliseconds are zero. This metadata is typically set in order to use the DaysSinceCustomTime condition in Object Lifecycle Management. -| `CamelGoogleCloudStorageCrc32cHex` |`String` | The CRC32c of the object -| `CamelGoogleCloudStorageETag` |`String` | The ETag for the Object. -| `CamelGoogleCloudStorageGeneration` |`String` | Is the generation number of the object for which you are retrieving information. -| `CamelGoogleCloudStorageBlobId` |`String` | The blob id of the object -| `CamelGoogleCloudStorageKmsKeyName` |`String` | The KMS key name -| `CamelGoogleCloudStorageContentMd5` |`String` |The md5 checksum of this object. -| `CamelGoogleCloudStorageMediaLink` |`String` | The media link -| `CamelGoogleCloudStorageMetageneration` | `String` | The metageneration of the object -| `CamelGoogleCloudStorageContentLength` |`Long` |The content length of this object. -| `CamelGoogleCloudStorageStorageClass` | `String` | The storage class of the object -| `CamelGoogleCloudStorageCreateTime` |`String` | The creation time of the object -| `CamelGoogleCloudStorageLastUpdate` |`String` | The last update of the object -|======================================================================= +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END === Google Storage Producer operations diff --git a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConstants.java b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConstants.java index 5967ecb..1187073 100644 --- a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConstants.java +++ b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConstants.java @@ -16,32 +16,81 @@ */ package org.apache.camel.component.google.storage; +import org.apache.camel.Exchange; +import org.apache.camel.spi.Metadata; + public final class GoogleCloudStorageConstants { + @Metadata(label = "producer", description = "The operation to perform.", + javaType = "org.apache.camel.component.google.storage.GoogleCloudStorageOperations") public static final String OPERATION = "CamelGoogleCloudStorageOperation"; + @Metadata(label = "producer", + description = "The bucket Name which this object will be stored or which will be used for the current operation", + javaType = "String") public static final String BUCKET_NAME = "CamelGoogleCloudStorageBucketName"; + @Metadata(label = "producer", description = "The object Name which will be used for the current operation", + javaType = "String") public static final String OBJECT_NAME = "CamelGoogleCloudStorageObjectName"; + @Metadata(label = "producer", description = "The object Destination Name which will be used for the current operation", + javaType = "String") public static final String DESTINATION_OBJECT_NAME = "CamelGoogleCloudStorageDestinationObjectName"; + @Metadata(label = "producer", description = "The bucket Destination Name which will be used for the current operation", + javaType = "String") public static final String DESTINATION_BUCKET_NAME = "CamelGoogleCloudStorageDestinationBucketName"; + @Metadata(label = "producer", description = "The time in millisecond the download link will be valid.", javaType = "Long", + defaultValue = "300000") public static final String DOWNLOAD_LINK_EXPIRATION_TIME = "CamelGoogleCloudStorageDownloadLinkExpirationTime"; + @Metadata(description = "The content length of this object.", javaType = "Long") public static final String CONTENT_LENGTH = "CamelGoogleCloudStorageContentLength"; + @Metadata(description = "The content type of this object.", javaType = "String") public static final String CONTENT_TYPE = "CamelGoogleCloudStorageContentType"; + @Metadata(description = "The Cache-Control metadata can specify two different aspects of how data is served from Cloud Storage: " + + + "whether the data can be cached and whether the data can be transformed", + javaType = "String") public static final String CACHE_CONTROL = "CamelGoogleCloudStorageCacheControl"; + @Metadata(description = "The content disposition of this object.", javaType = "String") public static final String CONTENT_DISPOSITION = "CamelGoogleCloudStorageContentDisposition"; + @Metadata(description = "The content encoding of this object.", javaType = "String") public static final String CONTENT_ENCODING = "CamelGoogleCloudStorageContentEncoding"; + @Metadata(description = "The md5 checksum of this object.", javaType = "String") public static final String CONTENT_MD5 = "CamelGoogleCloudStorageContentMd5"; + @Metadata(label = "consumer", description = "The name of the blob", javaType = "String") + public static final String FILE_NAME = Exchange.FILE_NAME; + @Metadata(label = "consumer", description = "The component count of this object", javaType = "Integer") public static final String METADATA_COMPONENT_COUNT = "CamelGoogleCloudStorageComponentCount"; + @Metadata(label = "consumer", + description = "The Content-Language metadata indicates the language(s) that the object is intended for.", + javaType = "String") public static final String METADATA_CONTENT_LANGUAGE = "CamelGoogleCloudStorageContentLanguage"; + @Metadata(label = "consumer", description = "The Custom-Time metadata is a user-specified date and time represented " + + "in the RFC 3339 format YYYY-MM-DD'T'HH:MM:SS.SS'Z' or YYYY-MM-DD'T'HH:MM:SS'Z' when milliseconds are zero. " + + + "This metadata is typically set in order to use the DaysSinceCustomTime condition in Object Lifecycle Management.", + javaType = "Long") public static final String METADATA_CUSTOM_TIME = "CamelGoogleCloudStorageCustomTime"; + @Metadata(label = "consumer", description = "The CRC32c of the object", javaType = "String") public static final String METADATA_CRC32C_HEX = "CamelGoogleCloudStorageCrc32cHex"; + @Metadata(description = "The ETag for the Object.", javaType = "String") public static final String METADATA_ETAG = "CamelGoogleCloudStorageETag"; + @Metadata(label = "consumer", + description = "Is the generation number of the object for which you are retrieving information.", + javaType = "Long") public static final String METADATA_GENERATION = "CamelGoogleCloudStorageGeneration"; + @Metadata(label = "consumer", description = "The blob id of the object", javaType = "com.google.cloud.storage.BlobId") public static final String METADATA_BLOB_ID = "CamelGoogleCloudStorageBlobId"; + @Metadata(label = "consumer", description = "The KMS key name", javaType = "String") public static final String METADATA_KMS_KEY_NAME = "CamelGoogleCloudStorageKmsKeyName"; + @Metadata(label = "consumer", description = "The media link", javaType = "String") public static final String METADATA_MEDIA_LINK = "CamelGoogleCloudStorageMediaLink"; + @Metadata(label = "consumer", description = "The metageneration of the object", javaType = "Long") public static final String METADATA_METAGENERATION = "CamelGoogleCloudStorageMetageneration"; + @Metadata(label = "consumer", description = "The storage class of the object", + javaType = "com.google.cloud.storage.StorageClass") public static final String METADATA_STORAGE_CLASS = "CamelGoogleCloudStorageStorageClass"; + @Metadata(label = "consumer", description = "The creation time of the object", javaType = "Long") public static final String METADATA_CREATE_TIME = "CamelGoogleCloudStorageCreateTime"; + @Metadata(label = "consumer", description = "The last update of the object", javaType = "Date") public static final String METADATA_LAST_UPDATE = "CamelGoogleCloudStorageLastUpdate"; /** diff --git a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java index 5f37612..b2a754d 100644 --- a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java +++ b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java @@ -341,7 +341,7 @@ public class GoogleCloudStorageConsumer extends ScheduledBatchPollingConsumer { protected String evaluateFileExpression(Exchange exchange, String downloadFileName, String blogName) { CamelContext camelContext = exchange.getContext(); // use blob as file name - exchange.getMessage().setHeader(Exchange.FILE_NAME, blogName); + exchange.getMessage().setHeader(GoogleCloudStorageConstants.FILE_NAME, blogName); String eval = downloadFileName; if (!downloadFileName.contains("$")) { diff --git a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpoint.java b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpoint.java index 38d7cfe..53a6b22 100644 --- a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpoint.java +++ b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageEndpoint.java @@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory; * behavior of Consumer and Producer. */ @UriEndpoint(firstVersion = "3.9.0", scheme = "google-storage", title = "Google Storage", syntax = "google-storage:bucketName", - category = { Category.CLOUD }) + category = { Category.CLOUD }, headersClass = GoogleCloudStorageConstants.class) public class GoogleCloudStorageEndpoint extends ScheduledPollEndpoint { private static final Logger LOG = LoggerFactory.getLogger(GoogleCloudStorageEndpoint.class);
