Skip to content

Commit 8c5eb6a

Browse files
authored
refactor: even more versioned clients (googleapis#10930)
1 parent dd96abe commit 8c5eb6a

197 files changed

Lines changed: 5174 additions & 4082 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.
184 Bytes
Binary file not shown.
152 Bytes
Binary file not shown.
690 Bytes
Binary file not shown.
393 Bytes
Binary file not shown.
Binary file not shown.

ci/etc/expected_install_directories

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@
4242
./include/google/cloud/apigeeconnect/v1/internal
4343
./include/google/cloud/apigeeconnect/v1/mocks
4444
./include/google/cloud/apikeys
45-
./include/google/cloud/apikeys/internal
4645
./include/google/cloud/apikeys/mocks
46+
./include/google/cloud/apikeys/v2
47+
./include/google/cloud/apikeys/v2/internal
48+
./include/google/cloud/apikeys/v2/mocks
4749
./include/google/cloud/appengine
4850
./include/google/cloud/appengine/mocks
4951
./include/google/cloud/appengine/v1
@@ -75,9 +77,10 @@
7577
./include/google/cloud/baremetalsolution/v2/internal
7678
./include/google/cloud/baremetalsolution/v2/mocks
7779
./include/google/cloud/batch
78-
./include/google/cloud/batch/internal
7980
./include/google/cloud/batch/mocks
8081
./include/google/cloud/batch/v1
82+
./include/google/cloud/batch/v1/internal
83+
./include/google/cloud/batch/v1/mocks
8184
./include/google/cloud/beyondcorp
8285
./include/google/cloud/beyondcorp/appconnections
8386
./include/google/cloud/beyondcorp/appconnections/v1
@@ -182,8 +185,10 @@
182185
./include/google/cloud/datacatalog/mocks
183186
./include/google/cloud/datacatalog/v1
184187
./include/google/cloud/datamigration
185-
./include/google/cloud/datamigration/internal
186188
./include/google/cloud/datamigration/mocks
189+
./include/google/cloud/datamigration/v1
190+
./include/google/cloud/datamigration/v1/internal
191+
./include/google/cloud/datamigration/v1/mocks
187192
./include/google/cloud/dataplex
188193
./include/google/cloud/dataplex/mocks
189194
./include/google/cloud/dataplex/v1
@@ -349,13 +354,15 @@
349354
./include/google/cloud/osconfig/mocks
350355
./include/google/cloud/osconfig/v1
351356
./include/google/cloud/oslogin
352-
./include/google/cloud/oslogin/internal
353357
./include/google/cloud/oslogin/mocks
354358
./include/google/cloud/oslogin/v1
359+
./include/google/cloud/oslogin/v1/internal
360+
./include/google/cloud/oslogin/v1/mocks
355361
./include/google/cloud/policytroubleshooter
356-
./include/google/cloud/policytroubleshooter/internal
357362
./include/google/cloud/policytroubleshooter/mocks
358363
./include/google/cloud/policytroubleshooter/v1
364+
./include/google/cloud/policytroubleshooter/v1/internal
365+
./include/google/cloud/policytroubleshooter/v1/mocks
359366
./include/google/cloud/privateca
360367
./include/google/cloud/privateca/internal
361368
./include/google/cloud/privateca/mocks

generator/generator_config.textproto

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ service {
6262
# API Keys
6363
service {
6464
service_proto_path: "google/api/apikeys/v2/apikeys.proto"
65-
product_path: "google/cloud/apikeys"
65+
product_path: "google/cloud/apikeys/v2"
66+
forwarding_product_path: "google/cloud/apikeys"
6667
initial_copyright_year: "2022"
6768
retryable_status_codes: ["kUnavailable"]
6869
}
@@ -135,7 +136,8 @@ service {
135136
# Batch
136137
service {
137138
service_proto_path: "google/cloud/batch/v1/batch.proto"
138-
product_path: "google/cloud/batch"
139+
product_path: "google/cloud/batch/v1"
140+
forwarding_product_path: "google/cloud/batch"
139141
initial_copyright_year: "2022"
140142
retryable_status_codes: ["kUnavailable"]
141143
}
@@ -485,7 +487,8 @@ service {
485487
# Database Migration
486488
service {
487489
service_proto_path: "google/cloud/clouddms/v1/clouddms.proto"
488-
product_path: "google/cloud/datamigration"
490+
product_path: "google/cloud/datamigration/v1"
491+
forwarding_product_path: "google/cloud/datamigration"
489492
initial_copyright_year: "2022"
490493
retryable_status_codes: ["kUnavailable"]
491494
}
@@ -1033,7 +1036,8 @@ service {
10331036
# IAM Policy Troubleshooter
10341037
service {
10351038
service_proto_path: "google/cloud/policytroubleshooter/v1/checker.proto"
1036-
product_path: "google/cloud/policytroubleshooter"
1039+
product_path: "google/cloud/policytroubleshooter/v1"
1040+
forwarding_product_path: "google/cloud/policytroubleshooter"
10371041
initial_copyright_year: "2022"
10381042
retryable_status_codes: ["kUnavailable"]
10391043
}
@@ -1238,7 +1242,8 @@ service {
12381242
# OS Login
12391243
service {
12401244
service_proto_path: "google/cloud/oslogin/v1/oslogin.proto"
1241-
product_path: "google/cloud/oslogin"
1245+
product_path: "google/cloud/oslogin/v1"
1246+
forwarding_product_path: "google/cloud/oslogin"
12421247
initial_copyright_year: "2022"
12431248
retryable_status_codes: ["kUnavailable"]
12441249
}

google/cloud/apikeys/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+
"v2/",
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(
@@ -58,3 +59,13 @@ cc_library(
5859
"@com_google_googletest//:gtest",
5960
],
6061
)
62+
63+
[cc_test(
64+
name = sample.replace("/", "_").replace(".cc", ""),
65+
srcs = [sample],
66+
tags = ["integration-test"],
67+
deps = [
68+
"//:apikeys",
69+
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
70+
],
71+
) for sample in glob([d + "samples/*.cc" for d in service_dirs])]

google/cloud/apikeys/CMakeLists.txt

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,22 @@ include(GoogleapisConfig)
1818
set(DOXYGEN_PROJECT_NAME "API Keys API C++ Client")
1919
set(DOXYGEN_PROJECT_BRIEF "A C++ Client Library for the API Keys API")
2020
set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION}")
21-
set(DOXYGEN_EXCLUDE_SYMBOLS "internal" "apikeys_internal" "apikeys_testing"
22-
"examples")
23-
set(DOXYGEN_EXAMPLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/samples
24-
${CMAKE_CURRENT_SOURCE_DIR}/quickstart)
21+
set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
22+
set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/quickstart")
23+
24+
unset(mocks_globs)
25+
unset(source_globs)
26+
set(service_dirs "" "v2/")
27+
foreach (dir IN LISTS service_dirs)
28+
string(REPLACE "/" "_" ns "${dir}")
29+
list(APPEND source_globs "${dir}*.h" "${dir}*.cc" "${dir}internal/*")
30+
list(APPEND mocks_globs "${dir}mocks/*.h")
31+
list(APPEND DOXYGEN_EXCLUDE_SYMBOLS "apikeys_${ns}internal")
32+
if (NOT dir STREQUAL "")
33+
list(APPEND DOXYGEN_EXAMPLE_PATH
34+
"${CMAKE_CURRENT_SOURCE_DIR}/${dir}samples")
35+
endif ()
36+
endforeach ()
2537

2638
include(GoogleCloudCppDoxygen)
2739
google_cloud_cpp_doxygen_targets("apikeys" DEPENDS cloud-docs
@@ -47,7 +59,7 @@ target_link_libraries(google_cloud_cpp_apikeys_protos PUBLIC ${proto_deps})
4759
file(
4860
GLOB source_files
4961
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
50-
"*.h" "*.cc" "internal/*.h" "internal/*.cc")
62+
${source_globs})
5163
list(SORT source_files)
5264
add_library(google_cloud_cpp_apikeys ${source_files})
5365
target_include_directories(
@@ -77,7 +89,7 @@ add_library(google-cloud-cpp::apikeys ALIAS google_cloud_cpp_apikeys)
7789
file(
7890
GLOB relative_mock_files
7991
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
80-
"mocks/*.h")
92+
${mocks_globs})
8193
list(SORT relative_mock_files)
8294
set(mock_files)
8395
foreach (file IN LISTS relative_mock_files)
@@ -173,3 +185,10 @@ install(
173185
COMPONENT google_cloud_cpp_development)
174186

175187
external_googleapis_install_pc("google_cloud_cpp_apikeys_protos")
188+
189+
# google-cloud-cpp::apikeys must be defined before we can add the samples.
190+
foreach (dir IN LISTS service_dirs)
191+
if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
192+
google_cloud_cpp_add_samples_relative("apikeys" "${dir}samples/")
193+
endif ()
194+
endforeach ()

0 commit comments

Comments
 (0)