Skip to content

Commit 69b7501

Browse files
authored
refactor: I'm running out of versioned clients (#10936)
1 parent 55657eb commit 69b7501

329 files changed

Lines changed: 8550 additions & 6567 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
434 Bytes
Binary file not shown.
336 Bytes
Binary file not shown.
51 Bytes
Binary file not shown.
199 Bytes
Binary file not shown.
156 Bytes
Binary file not shown.

ci/etc/expected_install_directories

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,20 +482,25 @@
482482
./include/google/cloud/storage
483483
./include/google/cloud/storage/internal
484484
./include/google/cloud/storagetransfer
485-
./include/google/cloud/storagetransfer/internal
486485
./include/google/cloud/storagetransfer/mocks
486+
./include/google/cloud/storagetransfer/v1
487+
./include/google/cloud/storagetransfer/v1/internal
488+
./include/google/cloud/storagetransfer/v1/mocks
487489
./include/google/cloud/talent
488-
./include/google/cloud/talent/internal
489490
./include/google/cloud/talent/mocks
490491
./include/google/cloud/talent/v4
492+
./include/google/cloud/talent/v4/internal
493+
./include/google/cloud/talent/v4/mocks
491494
./include/google/cloud/tasks
492-
./include/google/cloud/tasks/internal
493495
./include/google/cloud/tasks/mocks
494496
./include/google/cloud/tasks/v2
497+
./include/google/cloud/tasks/v2/internal
498+
./include/google/cloud/tasks/v2/mocks
495499
./include/google/cloud/texttospeech
496-
./include/google/cloud/texttospeech/internal
497500
./include/google/cloud/texttospeech/mocks
498501
./include/google/cloud/texttospeech/v1
502+
./include/google/cloud/texttospeech/v1/internal
503+
./include/google/cloud/texttospeech/v1/mocks
499504
./include/google/cloud/tpu
500505
./include/google/cloud/tpu/mocks
501506
./include/google/cloud/tpu/v1
@@ -505,8 +510,10 @@
505510
./include/google/cloud/tpu/v2/internal
506511
./include/google/cloud/tpu/v2/mocks
507512
./include/google/cloud/trace
508-
./include/google/cloud/trace/internal
509513
./include/google/cloud/trace/mocks
514+
./include/google/cloud/trace/v2
515+
./include/google/cloud/trace/v2/internal
516+
./include/google/cloud/trace/v2/mocks
510517
./include/google/cloud/translate
511518
./include/google/cloud/translate/internal
512519
./include/google/cloud/translate/mocks

generator/generator_config.textproto

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,59 +1622,67 @@ service {
16221622
# Storage Transfer Service
16231623
service {
16241624
service_proto_path: "google/storagetransfer/v1/transfer.proto"
1625-
product_path: "google/cloud/storagetransfer"
1625+
product_path: "google/cloud/storagetransfer/v1"
1626+
forwarding_product_path: "google/cloud/storagetransfer"
16261627
initial_copyright_year: "2022"
16271628
retryable_status_codes: ["kUnavailable"]
16281629
}
16291630

16301631
# Talent
16311632
service {
16321633
service_proto_path: "google/cloud/talent/v4/company_service.proto"
1633-
product_path: "google/cloud/talent"
1634+
product_path: "google/cloud/talent/v4"
1635+
forwarding_product_path: "google/cloud/talent"
16341636
initial_copyright_year: "2022"
16351637
retryable_status_codes: ["kUnavailable"]
16361638
}
16371639

16381640
service {
16391641
service_proto_path: "google/cloud/talent/v4/completion_service.proto"
1640-
product_path: "google/cloud/talent"
1642+
product_path: "google/cloud/talent/v4"
1643+
forwarding_product_path: "google/cloud/talent"
16411644
initial_copyright_year: "2022"
16421645
retryable_status_codes: ["kUnavailable"]
16431646
}
16441647

16451648
service {
16461649
service_proto_path: "google/cloud/talent/v4/event_service.proto"
1647-
product_path: "google/cloud/talent"
1650+
product_path: "google/cloud/talent/v4"
1651+
forwarding_product_path: "google/cloud/talent"
16481652
initial_copyright_year: "2022"
16491653
retryable_status_codes: ["kUnavailable"]
16501654
}
16511655

16521656
service {
16531657
service_proto_path: "google/cloud/talent/v4/job_service.proto"
1654-
product_path: "google/cloud/talent"
1658+
product_path: "google/cloud/talent/v4"
1659+
forwarding_product_path: "google/cloud/talent"
16551660
initial_copyright_year: "2022"
16561661
retryable_status_codes: ["kUnavailable"]
16571662
}
16581663

16591664
service {
16601665
service_proto_path: "google/cloud/talent/v4/tenant_service.proto"
1661-
product_path: "google/cloud/talent"
1666+
product_path: "google/cloud/talent/v4"
1667+
forwarding_product_path: "google/cloud/talent"
16621668
initial_copyright_year: "2022"
16631669
retryable_status_codes: ["kUnavailable"]
16641670
}
16651671

16661672
# Tasks
16671673
service {
16681674
service_proto_path: "google/cloud/tasks/v2/cloudtasks.proto"
1669-
product_path: "google/cloud/tasks"
1675+
product_path: "google/cloud/tasks/v2"
1676+
forwarding_product_path: "google/cloud/tasks"
16701677
initial_copyright_year: "2021"
16711678
retryable_status_codes: ["kInternal", "kUnavailable"]
16721679
}
16731680

16741681
# Text-to-Speech
16751682
service {
16761683
service_proto_path: "google/cloud/texttospeech/v1/cloud_tts.proto"
1677-
product_path: "google/cloud/texttospeech"
1684+
product_path: "google/cloud/texttospeech/v1"
1685+
forwarding_product_path: "google/cloud/texttospeech"
16781686
initial_copyright_year: "2022"
16791687
retryable_status_codes: ["kUnavailable"]
16801688
}
@@ -1698,7 +1706,8 @@ service {
16981706
# Cloud Trace
16991707
service {
17001708
service_proto_path: "google/devtools/cloudtrace/v2/tracing.proto"
1701-
product_path: "google/cloud/trace"
1709+
product_path: "google/cloud/trace/v2"
1710+
forwarding_product_path: "google/cloud/trace"
17021711
initial_copyright_year: "2022"
17031712
retryable_status_codes: ["kUnavailable"]
17041713
}

google/cloud/storagetransfer/BUILD.bazel

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,26 @@ package(default_visibility = ["//visibility:private"])
1616

1717
licenses(["notice"]) # Apache 2.0
1818

19+
service_dirs = [
20+
"",
21+
"v1/",
22+
]
23+
24+
src_dirs = service_dirs + [d + "internal/" for d in service_dirs]
25+
1926
filegroup(
2027
name = "srcs",
21-
srcs = glob([
22-
"*.cc",
23-
"internal/*.cc",
24-
]),
28+
srcs = glob([d + "*.cc" for d in src_dirs]),
2529
)
2630

2731
filegroup(
2832
name = "hdrs",
29-
srcs = glob([
30-
"*.h",
31-
"internal/*.h",
32-
]),
33+
srcs = glob([d + "*.h" for d in src_dirs]),
3334
)
3435

3536
filegroup(
3637
name = "mocks",
37-
srcs = glob(["mocks/*.h"]),
38+
srcs = glob([d + "mocks/*.h" for d in service_dirs]),
3839
)
3940

4041
cc_library(
@@ -63,3 +64,13 @@ cc_library(
6364
"@com_google_googletest//:gtest",
6465
],
6566
)
67+
68+
[cc_test(
69+
name = sample.replace("/", "_").replace(".cc", ""),
70+
srcs = [sample],
71+
tags = ["integration-test"],
72+
deps = [
73+
"//:storagetransfer",
74+
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
75+
],
76+
) for sample in glob([d + "samples/*.cc" for d in service_dirs])]

google/cloud/storagetransfer/CMakeLists.txt

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,22 @@ include(GoogleapisConfig)
2828
set(DOXYGEN_PROJECT_NAME "Storage Transfer API C++ Client")
2929
set(DOXYGEN_PROJECT_BRIEF "A C++ Client Library for the Storage Transfer API")
3030
set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION}")
31-
set(DOXYGEN_EXCLUDE_SYMBOLS "internal" "storagetransfer_internal"
32-
"storagetransfer_testing" "examples")
33-
set(DOXYGEN_EXAMPLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/samples
34-
${CMAKE_CURRENT_SOURCE_DIR}/quickstart)
31+
set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
32+
set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/quickstart")
33+
34+
unset(mocks_globs)
35+
unset(source_globs)
36+
set(service_dirs "" "v1/")
37+
foreach (dir IN LISTS service_dirs)
38+
string(REPLACE "/" "_" ns "${dir}")
39+
list(APPEND source_globs "${dir}*.h" "${dir}*.cc" "${dir}internal/*")
40+
list(APPEND mocks_globs "${dir}mocks/*.h")
41+
list(APPEND DOXYGEN_EXCLUDE_SYMBOLS "storagetransfer_${ns}internal")
42+
if (NOT dir STREQUAL "")
43+
list(APPEND DOXYGEN_EXAMPLE_PATH
44+
"${CMAKE_CURRENT_SOURCE_DIR}/${dir}samples")
45+
endif ()
46+
endforeach ()
3547

3648
include(GoogleCloudCppDoxygen)
3749
google_cloud_cpp_doxygen_targets("storagetransfer" DEPENDS cloud-docs
@@ -58,7 +70,7 @@ target_link_libraries(google_cloud_cpp_storagetransfer_protos
5870
file(
5971
GLOB source_files
6072
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
61-
"*.h" "*.cc" "internal/*.h" "internal/*.cc")
73+
${source_globs})
6274
list(SORT source_files)
6375
add_library(google_cloud_cpp_storagetransfer ${source_files})
6476
target_include_directories(
@@ -89,7 +101,7 @@ add_library(google-cloud-cpp::storagetransfer ALIAS
89101
file(
90102
GLOB relative_mock_files
91103
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
92-
"mocks/*.h")
104+
${mocks_globs})
93105
list(SORT relative_mock_files)
94106
set(mock_files)
95107
foreach (file IN LISTS relative_mock_files)
@@ -193,3 +205,12 @@ install(
193205
COMPONENT google_cloud_cpp_development)
194206

195207
external_googleapis_install_pc("google_cloud_cpp_storagetransfer_protos")
208+
209+
# google-cloud-cpp::storagetransfer must be defined before we can add the
210+
# samples.
211+
foreach (dir IN LISTS service_dirs)
212+
if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
213+
google_cloud_cpp_add_samples_relative("storagetransfer"
214+
"${dir}samples/")
215+
endif ()
216+
endforeach ()

google/cloud/storagetransfer/doc/main.dox

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ library. Use the `google::cloud::EndpointOption` when initializing the client
9393
library to change this default.
9494

9595
<!-- inject-endpoint-snippet-start -->
96-
For example, this will override the default endpoint for `storagetransfer::StorageTransferServiceClient`:
96+
For example, this will override the default endpoint for `storagetransfer_v1::StorageTransferServiceClient`:
9797

9898
@snippet storage_transfer_client_samples.cc set-client-endpoint
9999

@@ -138,15 +138,15 @@ can override the default policies.
138138

139139
// <!-- inject-endpoint-pages-start -->
140140

141-
/*! @page storagetransfer::StorageTransferServiceClient-endpoint-snippet Override storagetransfer::StorageTransferServiceClient Endpoint Configuration
141+
/*! @page storagetransfer_v1::StorageTransferServiceClient-endpoint-snippet Override storagetransfer_v1::StorageTransferServiceClient Endpoint Configuration
142142

143-
@snippet google/cloud/storagetransfer/samples/storage_transfer_client_samples.cc set-client-endpoint
143+
@snippet google/cloud/storagetransfer/v1/samples/storage_transfer_client_samples.cc set-client-endpoint
144144

145145
*/
146146

147-
/*! @page storagetransfer::StorageTransferServiceClient-service-account-snippet Override storagetransfer::StorageTransferServiceClient Authentication Defaults
147+
/*! @page storagetransfer_v1::StorageTransferServiceClient-service-account-snippet Override storagetransfer_v1::StorageTransferServiceClient Authentication Defaults
148148

149-
@snippet google/cloud/storagetransfer/samples/storage_transfer_client_samples.cc with-service-account
149+
@snippet google/cloud/storagetransfer/v1/samples/storage_transfer_client_samples.cc with-service-account
150150

151151
*/
152152
// <!-- inject-endpoint-pages-end -->

0 commit comments

Comments
 (0)