googleapis / google-cloud-cpp

C++ Client Libraries for Google Cloud Services
https://cloud.google.com/
Apache License 2.0
554 stars 374 forks source link

Refactor storage credentials #14787

Open dbolduc opened 1 month ago

dbolduc commented 1 month ago

Storage introduced credentials in the public namespace google::cloud::storage::oauth2. These credential classes are now deprecated in favor of GUAC (google::cloud::Credentials):

https://github.com/googleapis/google-cloud-cpp/blob/80a518a357c93eec7ddc49666efcd7984135dafb/google/cloud/storage/oauth2/credentials.h#L45

However, the storage internals are implemented in terms of google::cloud::storage::oauth2::Credentials.

https://github.com/googleapis/google-cloud-cpp/blob/80a518a357c93eec7ddc49666efcd7984135dafb/google/cloud/storage/client.cc#L50

We map GUAC -> storage credentials.

https://github.com/googleapis/google-cloud-cpp/blob/80a518a357c93eec7ddc49666efcd7984135dafb/google/cloud/storage/client_options.cc#L296-L300

This is backwards. We need to map storage credentials to GUAC and use GUAC in the implementation, if we ever want to remove the deprecated credentials in google::cloud::storage::oauth2.

dbolduc commented 1 month ago

For the record, we do not need to refactor. We can "delete" the storage::oauth2 classes by moving them into storage_internal and keeping the implementation mostly the same.

We might do this to unblock the next major release.

It is just that the resulting implementation would be unnecessarily complicated compared with using GUAC types.