Examples

GET function example for fetching message from Cloud Storage subscription

The following is an example of a GET map rule used to retrieve data from an object in the Cloud Storage bucket and performing authentication explicitly based on the specified credentials file. Logging is enabled, with verbose level and default log file m4gcstorage.mtr created in the map directory.

Replace creds_file, bucket_name and object_name with the credentials file path, bucket name and object name applicable to your environment.

GET("GCSTORAGE", "-CF creds_file -B bucket_name -O object_name -RM OBJECT_DATA -TV")

PUT function example for inserting message to a Cloud Storage topic

The following is an example of a PUT map rule used to write data to an object in the Cloud Storage bucket and overwrite the object if it exists already. Authentication is performed automatically, such as using the GOOGLE_APPLICATION_CREDENTIALS environment variable. Logging is enabled, with error level and appending messages to the specified log file. The last argument, input_data represents the data to be written to the object, and may be a hard-coded data, or, more typically, a reference to a type from another map card.

Replace log_file, bucket_name and object_name with the log file name, bucket name and object name applicable to your environment:

PUT("GCSTORAGE", "-B bucket_name -O object_name -OW -TE+ log_file", input_data)