Use File Metadata with Cloud Storage for C++

After uploading a file to Cloud Storage reference, you can also get
and update the file metadata, for example to update the content type. Files
can also store custom key/value pairs with additional file metadata.

Note: By default, Cloud Storage buckets require
Firebase Authentication to get and update metadata. You can
change your Firebase Security Rules for Cloud Storage
to allow unauthenticated access. Since the default Google App Engine app and
Firebase share this bucket, configuring public access may make newly uploaded
App Engine files publicly accessible as well. Be sure to restrict access to your
Storage bucket again when you set up authentication.

Get File Metadata

File metadata contains common properties such as name, size, and
content_type (often referred to as MIME type) in addition to some less common
ones like content_disposition and time_created. This metadata can be
retrieved from a Cloud Storage reference using the GetMetadata
method.

Update File Metadata

You can update file metadata at any time after the file upload completes by
using the UpdateMetadata method. Refer to the
full list for more information on what properties
can be updated. Only the properties specified in the metadata are updated,
all others are left unmodified.

Handle Errors

There are a number of reasons why errors may occur on getting or updating
metadata, including the file not existing, or the user not having permission
to access the desired file. More information on errors can be found in the
Handle Errors
section of the docs.

Custom Metadata

You can specify custom metadata as an std::map containing std::string
properties.