diff --git a/ci/abi-dumps/google_cloud_cpp_storage.expected.abi.dump.gz b/ci/abi-dumps/google_cloud_cpp_storage.expected.abi.dump.gz index ae451d400e8ea..fb09695e3244b 100644 Binary files a/ci/abi-dumps/google_cloud_cpp_storage.expected.abi.dump.gz and b/ci/abi-dumps/google_cloud_cpp_storage.expected.abi.dump.gz differ diff --git a/ci/abi-dumps/google_cloud_cpp_storage_grpc.expected.abi.dump.gz b/ci/abi-dumps/google_cloud_cpp_storage_grpc.expected.abi.dump.gz index 316542011311d..b2a7317b27a8d 100644 Binary files a/ci/abi-dumps/google_cloud_cpp_storage_grpc.expected.abi.dump.gz and b/ci/abi-dumps/google_cloud_cpp_storage_grpc.expected.abi.dump.gz differ diff --git a/doc/v3-migration-guide.md b/doc/v3-migration-guide.md index 54e28de2c4661..dd860d9473b9c 100644 --- a/doc/v3-migration-guide.md +++ b/doc/v3-migration-guide.md @@ -555,71 +555,6 @@ void CreateClient() { -
-Removed Client(Connection, NoDecorations) constructor - -The `Client` constructor that accepted a `StorageConnection` and the -`NoDecorations` tag has been removed. This was intended only for test code. - -**Before:** - -```cpp -#include "google/cloud/storage/client.h" -#include "google/cloud/storage/testing/mock_storage_connection.h" - -void TestClient() { - auto mock = std::make_shared(); - // ... - auto client = google::cloud::storage::Client( - mock, google::cloud::storage::Client::NoDecorations{}); -} -``` - -**After:** - -```cpp -#include "google/cloud/storage/client.h" -#include "google/cloud/storage/testing/mock_storage_connection.h" - -void TestClient() { - auto mock = std::make_shared(); - // ... - auto client = google::cloud::storage::internal::ClientImplDetails::CreateWithoutDecorations(mock); -} -``` - -
- -
-Removed Client::raw_client() - -The `Client::raw_client()` method has been removed. This was intended only for -internal use or testing. If you need access to the underlying connection for -testing purposes, use `google::cloud::storage::internal::ClientImplDetails`. - -**Before:** - -```cpp -#include "google/cloud/storage/client.h" - -void UseRawClient(google::cloud::storage::Client client) { - auto connection = client.raw_client(); -} -``` - -**After:** - -```cpp -#include "google/cloud/storage/client.h" - -void UseRawClient(google::cloud::storage::Client client) { - auto connection = - google::cloud::storage::internal::ClientImplDetails::GetConnection(client); -} -``` - -
- ### IAM
diff --git a/google/cloud/storage/client.h b/google/cloud/storage/client.h index 6c8b8ec463d6f..a6f9ee70a2d50 100644 --- a/google/cloud/storage/client.h +++ b/google/cloud/storage/client.h @@ -3441,6 +3441,27 @@ class Client { /// Define a tag to disable automatic decorations of the StorageConnection. struct NoDecorations {}; + /// Builds a client with a specific StorageConnection, without decorations. + /// @deprecated This was intended only for test code, applications should not + /// use it. + GOOGLE_CLOUD_CPP_DEPRECATED( + "applications should not need this." + " Please file a bug at https://github.com/googleapis/google-cloud-cpp" + " if you do.") + explicit Client(std::shared_ptr connection, + NoDecorations) + : Client(InternalOnlyNoDecorations{}, std::move(connection)) {} + + /// Access the underlying `StorageConnection`. + /// @deprecated Only intended for implementors, do not use. + GOOGLE_CLOUD_CPP_DEPRECATED( + "applications should not need this." + " Please file a bug at https://github.com/googleapis/google-cloud-cpp" + " if you do.") + std::shared_ptr raw_client() const { + return connection_; + } + private: friend class internal::NonResumableParallelUploadState; friend class internal::ResumableParallelUploadState; diff --git a/google/cloud/storage/grpc_plugin_test.cc b/google/cloud/storage/grpc_plugin_test.cc index df66fbeaaf4a8..8be88c86aae45 100644 --- a/google/cloud/storage/grpc_plugin_test.cc +++ b/google/cloud/storage/grpc_plugin_test.cc @@ -117,9 +117,9 @@ TEST(GrpcPluginTest, HybridUsesGrpcBufferOptions) { ScopedEnvironment("GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG", absl::nullopt); auto client = MakeGrpcClient( TestOptions().set("media")); - auto connection = ClientImplDetails::GetConnection(client); - EXPECT_GE(connection->options().get(), - 32 * 1024 * 1024UL); + EXPECT_GE( + client.raw_client()->options().get(), + 32 * 1024 * 1024L); } TEST(GrpcPluginTest, BackwardsCompatibilityShims) {