google-cloud-compute-v1 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (244) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/AUTHENTICATION.md +12 -12
  4. data/README.md +4 -30
  5. data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +123 -66
  6. data/lib/google/cloud/compute/v1/accelerator_types/rest/service_stub.rb +188 -0
  7. data/lib/google/cloud/compute/v1/accelerator_types/rest.rb +0 -2
  8. data/lib/google/cloud/compute/v1/addresses/rest/client.rb +166 -96
  9. data/lib/google/cloud/compute/v1/addresses/rest/service_stub.rb +279 -0
  10. data/lib/google/cloud/compute/v1/addresses/rest.rb +0 -2
  11. data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +210 -128
  12. data/lib/google/cloud/compute/v1/autoscalers/rest/service_stub.rb +373 -0
  13. data/lib/google/cloud/compute/v1/autoscalers/rest.rb +0 -2
  14. data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +228 -143
  15. data/lib/google/cloud/compute/v1/backend_buckets/rest/service_stub.rb +413 -0
  16. data/lib/google/cloud/compute/v1/backend_buckets/rest.rb +0 -2
  17. data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +294 -187
  18. data/lib/google/cloud/compute/v1/backend_services/rest/service_stub.rb +553 -0
  19. data/lib/google/cloud/compute/v1/backend_services/rest.rb +0 -2
  20. data/lib/google/cloud/compute/v1/compute_pb.rb +816 -135
  21. data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +123 -66
  22. data/lib/google/cloud/compute/v1/disk_types/rest/service_stub.rb +188 -0
  23. data/lib/google/cloud/compute/v1/disk_types/rest.rb +0 -2
  24. data/lib/google/cloud/compute/v1/disks/rest/client.rb +334 -213
  25. data/lib/google/cloud/compute/v1/disks/rest/service_stub.rb +644 -0
  26. data/lib/google/cloud/compute/v1/disks/rest.rb +0 -2
  27. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +180 -107
  28. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/service_stub.rb +317 -0
  29. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest.rb +0 -2
  30. data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +463 -280
  31. data/lib/google/cloud/compute/v1/firewall_policies/rest/service_stub.rb +869 -0
  32. data/lib/google/cloud/compute/v1/firewall_policies/rest.rb +0 -2
  33. data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +185 -113
  34. data/lib/google/cloud/compute/v1/firewalls/rest/service_stub.rb +321 -0
  35. data/lib/google/cloud/compute/v1/firewalls/rest.rb +0 -2
  36. data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +292 -127
  37. data/lib/google/cloud/compute/v1/forwarding_rules/rest/service_stub.rb +417 -0
  38. data/lib/google/cloud/compute/v1/forwarding_rules/rest.rb +0 -2
  39. data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +141 -81
  40. data/lib/google/cloud/compute/v1/global_addresses/rest/service_stub.rb +229 -0
  41. data/lib/google/cloud/compute/v1/global_addresses/rest.rb +0 -2
  42. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +259 -112
  43. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/service_stub.rb +365 -0
  44. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest.rb +0 -2
  45. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +207 -128
  46. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/service_stub.rb +370 -0
  47. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest.rb +0 -2
  48. data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +159 -88
  49. data/lib/google/cloud/compute/v1/global_operations/rest/service_stub.rb +274 -0
  50. data/lib/google/cloud/compute/v1/global_operations/rest.rb +0 -2
  51. data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +116 -64
  52. data/lib/google/cloud/compute/v1/global_organization_operations/rest/service_stub.rb +186 -0
  53. data/lib/google/cloud/compute/v1/global_organization_operations/rest.rb +0 -2
  54. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +170 -97
  55. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/service_stub.rb +275 -0
  56. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest.rb +0 -2
  57. data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +210 -128
  58. data/lib/google/cloud/compute/v1/health_checks/rest/service_stub.rb +371 -0
  59. data/lib/google/cloud/compute/v1/health_checks/rest.rb +0 -2
  60. data/lib/google/cloud/compute/v1/images/rest/client.rb +284 -174
  61. data/lib/google/cloud/compute/v1/images/rest/service_stub.rb +542 -0
  62. data/lib/google/cloud/compute/v1/images/rest.rb +0 -2
  63. data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +497 -328
  64. data/lib/google/cloud/compute/v1/instance_group_managers/rest/service_stub.rb +974 -0
  65. data/lib/google/cloud/compute/v1/instance_group_managers/rest.rb +0 -2
  66. data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +255 -161
  67. data/lib/google/cloud/compute/v1/instance_groups/rest/service_stub.rb +467 -0
  68. data/lib/google/cloud/compute/v1/instance_groups/rest.rb +0 -2
  69. data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +198 -117
  70. data/lib/google/cloud/compute/v1/instance_templates/rest/service_stub.rb +362 -0
  71. data/lib/google/cloud/compute/v1/instance_templates/rest.rb +0 -2
  72. data/lib/google/cloud/compute/v1/instances/rest/client.rb +1079 -609
  73. data/lib/google/cloud/compute/v1/instances/rest/service_stub.rb +1975 -0
  74. data/lib/google/cloud/compute/v1/instances/rest.rb +0 -2
  75. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +188 -112
  76. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/service_stub.rb +326 -0
  77. data/lib/google/cloud/compute/v1/interconnect_attachments/rest.rb +0 -2
  78. data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +98 -51
  79. data/lib/google/cloud/compute/v1/interconnect_locations/rest/service_stub.rb +138 -0
  80. data/lib/google/cloud/compute/v1/interconnect_locations/rest.rb +0 -2
  81. data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +184 -108
  82. data/lib/google/cloud/compute/v1/interconnects/rest/service_stub.rb +318 -0
  83. data/lib/google/cloud/compute/v1/interconnects/rest.rb +0 -2
  84. data/lib/google/cloud/compute/v1/license_codes/rest/client.rb +91 -48
  85. data/lib/google/cloud/compute/v1/license_codes/rest/service_stub.rb +133 -0
  86. data/lib/google/cloud/compute/v1/license_codes/rest.rb +0 -2
  87. data/lib/google/cloud/compute/v1/licenses/rest/client.rb +198 -117
  88. data/lib/google/cloud/compute/v1/licenses/rest/service_stub.rb +362 -0
  89. data/lib/google/cloud/compute/v1/licenses/rest.rb +0 -2
  90. data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +123 -66
  91. data/lib/google/cloud/compute/v1/machine_types/rest/service_stub.rb +188 -0
  92. data/lib/google/cloud/compute/v1/machine_types/rest.rb +0 -2
  93. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +251 -157
  94. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/service_stub.rb +465 -0
  95. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest.rb +0 -2
  96. data/lib/google/cloud/compute/v1/networks/rest/client.rb +349 -173
  97. data/lib/google/cloud/compute/v1/networks/rest/service_stub.rb +553 -0
  98. data/lib/google/cloud/compute/v1/networks/rest.rb +0 -2
  99. data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +333 -211
  100. data/lib/google/cloud/compute/v1/node_groups/rest/service_stub.rb +646 -0
  101. data/lib/google/cloud/compute/v1/node_groups/rest.rb +0 -2
  102. data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +223 -132
  103. data/lib/google/cloud/compute/v1/node_templates/rest/service_stub.rb +412 -0
  104. data/lib/google/cloud/compute/v1/node_templates/rest.rb +0 -2
  105. data/lib/google/cloud/compute/v1/node_types/rest/client.rb +123 -66
  106. data/lib/google/cloud/compute/v1/node_types/rest/service_stub.rb +188 -0
  107. data/lib/google/cloud/compute/v1/node_types/rest.rb +0 -2
  108. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +206 -124
  109. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/service_stub.rb +369 -0
  110. data/lib/google/cloud/compute/v1/packet_mirrorings/rest.rb +0 -2
  111. data/lib/google/cloud/compute/v1/projects/rest/client.rb +338 -219
  112. data/lib/google/cloud/compute/v1/projects/rest/service_stub.rb +643 -0
  113. data/lib/google/cloud/compute/v1/projects/rest.rb +0 -2
  114. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +170 -97
  115. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/service_stub.rb +275 -0
  116. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest.rb +0 -2
  117. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +196 -112
  118. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/service_stub.rb +325 -0
  119. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest.rb +0 -2
  120. data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +185 -113
  121. data/lib/google/cloud/compute/v1/region_autoscalers/rest/service_stub.rb +323 -0
  122. data/lib/google/cloud/compute/v1/region_autoscalers/rest.rb +0 -2
  123. data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +203 -125
  124. data/lib/google/cloud/compute/v1/region_backend_services/rest/service_stub.rb +365 -0
  125. data/lib/google/cloud/compute/v1/region_backend_services/rest.rb +0 -2
  126. data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +145 -82
  127. data/lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb +234 -0
  128. data/lib/google/cloud/compute/v1/region_commitments/rest.rb +0 -2
  129. data/lib/google/cloud/compute/v1/region_disk_types/rest/client.rb +98 -51
  130. data/lib/google/cloud/compute/v1/region_disk_types/rest/service_stub.rb +138 -0
  131. data/lib/google/cloud/compute/v1/region_disk_types/rest.rb +0 -2
  132. data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +309 -198
  133. data/lib/google/cloud/compute/v1/region_disks/rest/service_stub.rb +593 -0
  134. data/lib/google/cloud/compute/v1/region_disks/rest.rb +0 -2
  135. data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +163 -97
  136. data/lib/google/cloud/compute/v1/region_health_check_services/rest/service_stub.rb +275 -0
  137. data/lib/google/cloud/compute/v1/region_health_check_services/rest.rb +0 -2
  138. data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +185 -113
  139. data/lib/google/cloud/compute/v1/region_health_checks/rest/service_stub.rb +321 -0
  140. data/lib/google/cloud/compute/v1/region_health_checks/rest.rb +0 -2
  141. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +472 -313
  142. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/service_stub.rb +924 -0
  143. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest.rb +0 -2
  144. data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +143 -84
  145. data/lib/google/cloud/compute/v1/region_instance_groups/rest/service_stub.rb +234 -0
  146. data/lib/google/cloud/compute/v1/region_instance_groups/rest.rb +0 -2
  147. data/lib/google/cloud/compute/v1/region_instances/rest/client.rb +75 -40
  148. data/lib/google/cloud/compute/v1/region_instances/rest/service_stub.rb +92 -0
  149. data/lib/google/cloud/compute/v1/region_instances/rest.rb +0 -2
  150. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +141 -81
  151. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/service_stub.rb +229 -0
  152. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest.rb +0 -2
  153. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +141 -81
  154. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/service_stub.rb +229 -0
  155. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest.rb +0 -2
  156. data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +134 -73
  157. data/lib/google/cloud/compute/v1/region_operations/rest/service_stub.rb +224 -0
  158. data/lib/google/cloud/compute/v1/region_operations/rest.rb +0 -2
  159. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +141 -81
  160. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/service_stub.rb +229 -0
  161. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest.rb +0 -2
  162. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +163 -97
  163. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/service_stub.rb +275 -0
  164. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest.rb +0 -2
  165. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +185 -113
  166. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/service_stub.rb +321 -0
  167. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest.rb +0 -2
  168. data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +203 -125
  169. data/lib/google/cloud/compute/v1/region_url_maps/rest/service_stub.rb +365 -0
  170. data/lib/google/cloud/compute/v1/region_url_maps/rest.rb +0 -2
  171. data/lib/google/cloud/compute/v1/regions/rest/client.rb +98 -51
  172. data/lib/google/cloud/compute/v1/regions/rest/service_stub.rb +138 -0
  173. data/lib/google/cloud/compute/v1/regions/rest.rb +0 -2
  174. data/lib/google/cloud/compute/v1/reservations/rest/client.rb +245 -148
  175. data/lib/google/cloud/compute/v1/reservations/rest/service_stub.rb +458 -0
  176. data/lib/google/cloud/compute/v1/reservations/rest.rb +0 -2
  177. data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +223 -132
  178. data/lib/google/cloud/compute/v1/resource_policies/rest/service_stub.rb +412 -0
  179. data/lib/google/cloud/compute/v1/resource_policies/rest.rb +0 -2
  180. data/lib/google/cloud/compute/v1/routers/rest/client.rb +274 -166
  181. data/lib/google/cloud/compute/v1/routers/rest/service_stub.rb +507 -0
  182. data/lib/google/cloud/compute/v1/routers/rest.rb +0 -2
  183. data/lib/google/cloud/compute/v1/routes/rest/client.rb +141 -81
  184. data/lib/google/cloud/compute/v1/routes/rest/service_stub.rb +229 -0
  185. data/lib/google/cloud/compute/v1/routes/rest.rb +0 -2
  186. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +270 -166
  187. data/lib/google/cloud/compute/v1/security_policies/rest/service_stub.rb +504 -0
  188. data/lib/google/cloud/compute/v1/security_policies/rest.rb +0 -2
  189. data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +197 -115
  190. data/lib/google/cloud/compute/v1/snapshots/rest/service_stub.rb +360 -0
  191. data/lib/google/cloud/compute/v1/snapshots/rest.rb +0 -2
  192. data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +166 -96
  193. data/lib/google/cloud/compute/v1/ssl_certificates/rest/service_stub.rb +279 -0
  194. data/lib/google/cloud/compute/v1/ssl_certificates/rest.rb +0 -2
  195. data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +185 -110
  196. data/lib/google/cloud/compute/v1/ssl_policies/rest/service_stub.rb +324 -0
  197. data/lib/google/cloud/compute/v1/ssl_policies/rest.rb +0 -2
  198. data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +314 -195
  199. data/lib/google/cloud/compute/v1/subnetworks/rest/service_stub.rb +600 -0
  200. data/lib/google/cloud/compute/v1/subnetworks/rest.rb +0 -2
  201. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +163 -97
  202. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/service_stub.rb +275 -0
  203. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest.rb +0 -2
  204. data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +210 -128
  205. data/lib/google/cloud/compute/v1/target_http_proxies/rest/service_stub.rb +371 -0
  206. data/lib/google/cloud/compute/v1/target_http_proxies/rest.rb +0 -2
  207. data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +334 -159
  208. data/lib/google/cloud/compute/v1/target_https_proxies/rest/service_stub.rb +509 -0
  209. data/lib/google/cloud/compute/v1/target_https_proxies/rest.rb +0 -2
  210. data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +166 -96
  211. data/lib/google/cloud/compute/v1/target_instances/rest/service_stub.rb +279 -0
  212. data/lib/google/cloud/compute/v1/target_instances/rest.rb +0 -2
  213. data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +294 -188
  214. data/lib/google/cloud/compute/v1/target_pools/rest/service_stub.rb +554 -0
  215. data/lib/google/cloud/compute/v1/target_pools/rest.rb +0 -2
  216. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +229 -145
  217. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/service_stub.rb +413 -0
  218. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest.rb +0 -2
  219. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +185 -113
  220. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/service_stub.rb +321 -0
  221. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest.rb +0 -2
  222. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +166 -96
  223. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/service_stub.rb +279 -0
  224. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest.rb +0 -2
  225. data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +250 -156
  226. data/lib/google/cloud/compute/v1/url_maps/rest/service_stub.rb +461 -0
  227. data/lib/google/cloud/compute/v1/url_maps/rest.rb +0 -2
  228. data/lib/google/cloud/compute/v1/version.rb +1 -1
  229. data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +227 -135
  230. data/lib/google/cloud/compute/v1/vpn_gateways/rest/service_stub.rb +412 -0
  231. data/lib/google/cloud/compute/v1/vpn_gateways/rest.rb +0 -2
  232. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +166 -96
  233. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/service_stub.rb +279 -0
  234. data/lib/google/cloud/compute/v1/vpn_tunnels/rest.rb +0 -2
  235. data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +134 -73
  236. data/lib/google/cloud/compute/v1/zone_operations/rest/service_stub.rb +224 -0
  237. data/lib/google/cloud/compute/v1/zone_operations/rest.rb +0 -2
  238. data/lib/google/cloud/compute/v1/zones/rest/client.rb +98 -51
  239. data/lib/google/cloud/compute/v1/zones/rest/service_stub.rb +138 -0
  240. data/lib/google/cloud/compute/v1/zones/rest.rb +0 -2
  241. data/lib/google/cloud/compute/v1.rb +5 -0
  242. data/proto_docs/README.md +1 -1
  243. data/proto_docs/google/cloud/compute/v1/compute.rb +2526 -640
  244. metadata +84 -8
@@ -0,0 +1,365 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/compute/v1/compute_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Compute
24
+ module V1
25
+ module RegionBackendServices
26
+ module Rest
27
+ ##
28
+ # REST service stub for the RegionBackendServices service.
29
+ # service stub contains baseline method implementations
30
+ # including transcoding, making the REST call and deserialing the response
31
+ #
32
+ class ServiceStub
33
+ def initialize endpoint:, credentials:
34
+ # These require statements are intentionally placed here to initialize
35
+ # the REST modules only when it's required.
36
+ require "gapic/rest"
37
+
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
39
+ end
40
+
41
+ ##
42
+ # Baseline implementation for the delete REST call
43
+ #
44
+ # @param request_pb [::Google::Cloud::Compute::V1::DeleteRegionBackendServiceRequest]
45
+ # A request object representing the call parameters. Required.
46
+ # @param options [::Gapic::CallOptions]
47
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
48
+ #
49
+ # @yield [result, response] Access the result along with the Faraday response object
50
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
51
+ # @yieldparam response [::Faraday::Response]
52
+ #
53
+ # @return [::Google::Cloud::Compute::V1::Operation]
54
+ # A result object deserialized from the server's reply
55
+ def delete request_pb, options = nil
56
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
57
+
58
+ uri, _body, query_string_params = transcode_delete_request request_pb
59
+ response = @client_stub.make_delete_request(
60
+ uri: uri,
61
+ params: query_string_params,
62
+ options: options
63
+ )
64
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
65
+
66
+ yield result, response if block_given?
67
+ result
68
+ end
69
+
70
+ ##
71
+ # GRPC transcoding helper method for the delete REST call
72
+ #
73
+ # @param request_pb [::Google::Cloud::Compute::V1::DeleteRegionBackendServiceRequest]
74
+ # A request object representing the call parameters. Required.
75
+ # @return [Array(String, [String, nil], Hash{String => String})]
76
+ # Uri, Body, Query string parameters
77
+ def transcode_delete_request request_pb
78
+ uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/backendServices/#{request_pb.backend_service}"
79
+ body = nil
80
+ query_string_params = {}
81
+ query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?
82
+
83
+ [uri, body, query_string_params]
84
+ end
85
+
86
+ ##
87
+ # Baseline implementation for the get REST call
88
+ #
89
+ # @param request_pb [::Google::Cloud::Compute::V1::GetRegionBackendServiceRequest]
90
+ # A request object representing the call parameters. Required.
91
+ # @param options [::Gapic::CallOptions]
92
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
93
+ #
94
+ # @yield [result, response] Access the result along with the Faraday response object
95
+ # @yieldparam result [::Google::Cloud::Compute::V1::BackendService]
96
+ # @yieldparam response [::Faraday::Response]
97
+ #
98
+ # @return [::Google::Cloud::Compute::V1::BackendService]
99
+ # A result object deserialized from the server's reply
100
+ def get request_pb, options = nil
101
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
102
+
103
+ uri, _body, _query_string_params = transcode_get_request request_pb
104
+ response = @client_stub.make_get_request(
105
+ uri: uri,
106
+ options: options
107
+ )
108
+ result = ::Google::Cloud::Compute::V1::BackendService.decode_json response.body, ignore_unknown_fields: true
109
+
110
+ yield result, response if block_given?
111
+ result
112
+ end
113
+
114
+ ##
115
+ # GRPC transcoding helper method for the get REST call
116
+ #
117
+ # @param request_pb [::Google::Cloud::Compute::V1::GetRegionBackendServiceRequest]
118
+ # A request object representing the call parameters. Required.
119
+ # @return [Array(String, [String, nil], Hash{String => String})]
120
+ # Uri, Body, Query string parameters
121
+ def transcode_get_request request_pb
122
+ uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/backendServices/#{request_pb.backend_service}"
123
+ body = nil
124
+ query_string_params = {}
125
+
126
+ [uri, body, query_string_params]
127
+ end
128
+
129
+ ##
130
+ # Baseline implementation for the get_health REST call
131
+ #
132
+ # @param request_pb [::Google::Cloud::Compute::V1::GetHealthRegionBackendServiceRequest]
133
+ # A request object representing the call parameters. Required.
134
+ # @param options [::Gapic::CallOptions]
135
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
136
+ #
137
+ # @yield [result, response] Access the result along with the Faraday response object
138
+ # @yieldparam result [::Google::Cloud::Compute::V1::BackendServiceGroupHealth]
139
+ # @yieldparam response [::Faraday::Response]
140
+ #
141
+ # @return [::Google::Cloud::Compute::V1::BackendServiceGroupHealth]
142
+ # A result object deserialized from the server's reply
143
+ def get_health request_pb, options = nil
144
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
145
+
146
+ uri, body, _query_string_params = transcode_get_health_request request_pb
147
+ response = @client_stub.make_post_request(
148
+ uri: uri,
149
+ body: body,
150
+ options: options
151
+ )
152
+ result = ::Google::Cloud::Compute::V1::BackendServiceGroupHealth.decode_json response.body, ignore_unknown_fields: true
153
+
154
+ yield result, response if block_given?
155
+ result
156
+ end
157
+
158
+ ##
159
+ # GRPC transcoding helper method for the get_health REST call
160
+ #
161
+ # @param request_pb [::Google::Cloud::Compute::V1::GetHealthRegionBackendServiceRequest]
162
+ # A request object representing the call parameters. Required.
163
+ # @return [Array(String, [String, nil], Hash{String => String})]
164
+ # Uri, Body, Query string parameters
165
+ def transcode_get_health_request request_pb
166
+ uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/backendServices/#{request_pb.backend_service}/getHealth"
167
+ body = request_pb.resource_group_reference_resource.to_json
168
+ query_string_params = {}
169
+
170
+ [uri, body, query_string_params]
171
+ end
172
+
173
+ ##
174
+ # Baseline implementation for the insert REST call
175
+ #
176
+ # @param request_pb [::Google::Cloud::Compute::V1::InsertRegionBackendServiceRequest]
177
+ # A request object representing the call parameters. Required.
178
+ # @param options [::Gapic::CallOptions]
179
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
180
+ #
181
+ # @yield [result, response] Access the result along with the Faraday response object
182
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
183
+ # @yieldparam response [::Faraday::Response]
184
+ #
185
+ # @return [::Google::Cloud::Compute::V1::Operation]
186
+ # A result object deserialized from the server's reply
187
+ def insert request_pb, options = nil
188
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
189
+
190
+ uri, body, query_string_params = transcode_insert_request request_pb
191
+ response = @client_stub.make_post_request(
192
+ uri: uri,
193
+ body: body,
194
+ params: query_string_params,
195
+ options: options
196
+ )
197
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
198
+
199
+ yield result, response if block_given?
200
+ result
201
+ end
202
+
203
+ ##
204
+ # GRPC transcoding helper method for the insert REST call
205
+ #
206
+ # @param request_pb [::Google::Cloud::Compute::V1::InsertRegionBackendServiceRequest]
207
+ # A request object representing the call parameters. Required.
208
+ # @return [Array(String, [String, nil], Hash{String => String})]
209
+ # Uri, Body, Query string parameters
210
+ def transcode_insert_request request_pb
211
+ uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/backendServices"
212
+ body = request_pb.backend_service_resource.to_json
213
+ query_string_params = {}
214
+ query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?
215
+
216
+ [uri, body, query_string_params]
217
+ end
218
+
219
+ ##
220
+ # Baseline implementation for the list REST call
221
+ #
222
+ # @param request_pb [::Google::Cloud::Compute::V1::ListRegionBackendServicesRequest]
223
+ # A request object representing the call parameters. Required.
224
+ # @param options [::Gapic::CallOptions]
225
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
226
+ #
227
+ # @yield [result, response] Access the result along with the Faraday response object
228
+ # @yieldparam result [::Google::Cloud::Compute::V1::BackendServiceList]
229
+ # @yieldparam response [::Faraday::Response]
230
+ #
231
+ # @return [::Google::Cloud::Compute::V1::BackendServiceList]
232
+ # A result object deserialized from the server's reply
233
+ def list request_pb, options = nil
234
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
235
+
236
+ uri, _body, query_string_params = transcode_list_request request_pb
237
+ response = @client_stub.make_get_request(
238
+ uri: uri,
239
+ params: query_string_params,
240
+ options: options
241
+ )
242
+ result = ::Google::Cloud::Compute::V1::BackendServiceList.decode_json response.body, ignore_unknown_fields: true
243
+
244
+ yield result, response if block_given?
245
+ result
246
+ end
247
+
248
+ ##
249
+ # GRPC transcoding helper method for the list REST call
250
+ #
251
+ # @param request_pb [::Google::Cloud::Compute::V1::ListRegionBackendServicesRequest]
252
+ # A request object representing the call parameters. Required.
253
+ # @return [Array(String, [String, nil], Hash{String => String})]
254
+ # Uri, Body, Query string parameters
255
+ def transcode_list_request request_pb
256
+ uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/backendServices"
257
+ body = nil
258
+ query_string_params = {}
259
+ query_string_params["filter"] = request_pb.filter.to_s if request_pb.has_filter?
260
+ query_string_params["maxResults"] = request_pb.max_results.to_s if request_pb.has_max_results?
261
+ query_string_params["orderBy"] = request_pb.order_by.to_s if request_pb.has_order_by?
262
+ query_string_params["pageToken"] = request_pb.page_token.to_s if request_pb.has_page_token?
263
+ query_string_params["returnPartialSuccess"] = request_pb.return_partial_success.to_s if request_pb.has_return_partial_success?
264
+
265
+ [uri, body, query_string_params]
266
+ end
267
+
268
+ ##
269
+ # Baseline implementation for the patch REST call
270
+ #
271
+ # @param request_pb [::Google::Cloud::Compute::V1::PatchRegionBackendServiceRequest]
272
+ # A request object representing the call parameters. Required.
273
+ # @param options [::Gapic::CallOptions]
274
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
275
+ #
276
+ # @yield [result, response] Access the result along with the Faraday response object
277
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
278
+ # @yieldparam response [::Faraday::Response]
279
+ #
280
+ # @return [::Google::Cloud::Compute::V1::Operation]
281
+ # A result object deserialized from the server's reply
282
+ def patch request_pb, options = nil
283
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
284
+
285
+ uri, body, query_string_params = transcode_patch_request request_pb
286
+ response = @client_stub.make_patch_request(
287
+ uri: uri,
288
+ body: body,
289
+ params: query_string_params,
290
+ options: options
291
+ )
292
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
293
+
294
+ yield result, response if block_given?
295
+ result
296
+ end
297
+
298
+ ##
299
+ # GRPC transcoding helper method for the patch REST call
300
+ #
301
+ # @param request_pb [::Google::Cloud::Compute::V1::PatchRegionBackendServiceRequest]
302
+ # A request object representing the call parameters. Required.
303
+ # @return [Array(String, [String, nil], Hash{String => String})]
304
+ # Uri, Body, Query string parameters
305
+ def transcode_patch_request request_pb
306
+ uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/backendServices/#{request_pb.backend_service}"
307
+ body = request_pb.backend_service_resource.to_json
308
+ query_string_params = {}
309
+ query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?
310
+
311
+ [uri, body, query_string_params]
312
+ end
313
+
314
+ ##
315
+ # Baseline implementation for the update REST call
316
+ #
317
+ # @param request_pb [::Google::Cloud::Compute::V1::UpdateRegionBackendServiceRequest]
318
+ # A request object representing the call parameters. Required.
319
+ # @param options [::Gapic::CallOptions]
320
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
321
+ #
322
+ # @yield [result, response] Access the result along with the Faraday response object
323
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
324
+ # @yieldparam response [::Faraday::Response]
325
+ #
326
+ # @return [::Google::Cloud::Compute::V1::Operation]
327
+ # A result object deserialized from the server's reply
328
+ def update request_pb, options = nil
329
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
330
+
331
+ uri, body, query_string_params = transcode_update_request request_pb
332
+ response = @client_stub.make_put_request(
333
+ uri: uri,
334
+ body: body,
335
+ params: query_string_params,
336
+ options: options
337
+ )
338
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
339
+
340
+ yield result, response if block_given?
341
+ result
342
+ end
343
+
344
+ ##
345
+ # GRPC transcoding helper method for the update REST call
346
+ #
347
+ # @param request_pb [::Google::Cloud::Compute::V1::UpdateRegionBackendServiceRequest]
348
+ # A request object representing the call parameters. Required.
349
+ # @return [Array(String, [String, nil], Hash{String => String})]
350
+ # Uri, Body, Query string parameters
351
+ def transcode_update_request request_pb
352
+ uri = "/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/backendServices/#{request_pb.backend_service}"
353
+ body = request_pb.backend_service_resource.to_json
354
+ query_string_params = {}
355
+ query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?
356
+
357
+ [uri, body, query_string_params]
358
+ end
359
+ end
360
+ end
361
+ end
362
+ end
363
+ end
364
+ end
365
+ end
@@ -16,8 +16,6 @@
16
16
 
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
- require "gapic/rest"
20
- require "google/cloud/compute/v1/region_backend_services/rest/grpc_transcoding"
21
19
  require "google/cloud/compute/v1/region_backend_services/rest/client"
22
20
 
23
21
  module Google
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/compute/v1/compute_pb"
21
+ require "google/cloud/compute/v1/region_commitments/rest/service_stub"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -31,8 +32,6 @@ module Google
31
32
  # The RegionCommitments API.
32
33
  #
33
34
  class Client
34
- include GrpcTranscoding
35
-
36
35
  # @private
37
36
  attr_reader :region_commitments_stub
38
37
 
@@ -42,13 +41,12 @@ module Google
42
41
  # See {::Google::Cloud::Compute::V1::RegionCommitments::Rest::Client::Configuration}
43
42
  # for a description of the configuration fields.
44
43
  #
45
- # ## Example
46
- #
47
- # To modify the configuration for all RegionCommitments clients:
44
+ # @example
48
45
  #
49
- # ::Google::Cloud::Compute::V1::RegionCommitments::Rest::Client.configure do |config|
50
- # config.timeout = 10.0
51
- # end
46
+ # # Modify the configuration for all RegionCommitments clients
47
+ # ::Google::Cloud::Compute::V1::RegionCommitments::Rest::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
52
50
  #
53
51
  # @yield [config] Configure the Client client.
54
52
  # @yieldparam config [Client::Configuration]
@@ -66,6 +64,23 @@ module Google
66
64
  end
67
65
  default_config = Client::Configuration.new parent_config
68
66
 
67
+ default_config.rpcs.aggregated_list.timeout = 600.0
68
+ default_config.rpcs.aggregated_list.retry_policy = {
69
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
70
+ }
71
+
72
+ default_config.rpcs.get.timeout = 600.0
73
+ default_config.rpcs.get.retry_policy = {
74
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
75
+ }
76
+
77
+ default_config.rpcs.insert.timeout = 600.0
78
+
79
+ default_config.rpcs.list.timeout = 600.0
80
+ default_config.rpcs.list.retry_policy = {
81
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
82
+ }
83
+
69
84
  default_config
70
85
  end
71
86
  yield @configure if block_given?
@@ -95,28 +110,20 @@ module Google
95
110
  ##
96
111
  # Create a new RegionCommitments REST client object.
97
112
  #
98
- # ## Examples
113
+ # @example
99
114
  #
100
- # To create a new RegionCommitments REST client with the default
101
- # configuration:
115
+ # # Create a client using the default configuration
116
+ # client = ::Google::Cloud::Compute::V1::RegionCommitments::Rest::Client.new
102
117
  #
103
- # client = ::Google::Cloud::Compute::V1::RegionCommitments::Rest::Client.new
104
- #
105
- # To create a new RegionCommitments REST client with a custom
106
- # configuration:
107
- #
108
- # client = ::Google::Cloud::Compute::V1::RegionCommitments::Rest::Client.new do |config|
109
- # config.timeout = 10.0
110
- # end
118
+ # # Create a client using a custom configuration
119
+ # client = ::Google::Cloud::Compute::V1::RegionCommitments::Rest::Client.new do |config|
120
+ # config.timeout = 10.0
121
+ # end
111
122
  #
112
123
  # @yield [config] Configure the RegionCommitments client.
113
124
  # @yieldparam config [Client::Configuration]
114
125
  #
115
126
  def initialize
116
- # These require statements are intentionally placed here to initialize
117
- # the REST modules only when it's required.
118
- require "gapic/rest"
119
-
120
127
  # Create the configuration object
121
128
  @config = Configuration.new Client.configure
122
129
 
@@ -126,11 +133,11 @@ module Google
126
133
  # Create credentials
127
134
  credentials = @config.credentials
128
135
  credentials ||= Credentials.default scope: @config.scope
129
- if credentials.is_a?(String) || credentials.is_a?(Hash)
136
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
130
137
  credentials = Credentials.new credentials, scope: @config.scope
131
138
  end
132
139
 
133
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: @config.endpoint, credentials: credentials
140
+ @region_commitments_stub = ::Google::Cloud::Compute::V1::RegionCommitments::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
134
141
  end
135
142
 
136
143
  # Service calls
@@ -178,12 +185,12 @@ module Google
178
185
  # @param project [::String]
179
186
  # Project ID for this request.
180
187
  # @param return_partial_success [::Boolean]
181
- # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false and the logic is the same as today.
182
- # @yield [result, env] Access the result along with the Faraday environment object
183
- # @yieldparam result [::Google::Cloud::Compute::V1::CommitmentAggregatedList]
188
+ # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
189
+ # @yield [result, response] Access the result along with the Faraday response object
190
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::CommitmentsScopedList>]
184
191
  # @yieldparam response [::Faraday::Response]
185
192
  #
186
- # @return [::Google::Cloud::Compute::V1::CommitmentAggregatedList]
193
+ # @return [::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::CommitmentsScopedList>]
187
194
  #
188
195
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
189
196
  def aggregated_list request, options = nil
@@ -195,7 +202,7 @@ module Google
195
202
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
196
203
 
197
204
  # Customize the options with defaults
198
- call_metadata = {}
205
+ call_metadata = @config.rpcs.aggregated_list.metadata.to_h
199
206
 
200
207
  # Set x-goog-api-client header
201
208
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -203,19 +210,17 @@ module Google
203
210
  gapic_version: ::Google::Cloud::Compute::V1::VERSION,
204
211
  transports_version_send: [:rest]
205
212
 
206
- options.apply_defaults timeout: @config.timeout,
213
+ options.apply_defaults timeout: @config.rpcs.aggregated_list.timeout,
207
214
  metadata: call_metadata
208
215
 
209
- uri, _body, query_string_params = transcode_aggregated_list request
210
- response = @client_stub.make_get_request(
211
- uri: uri,
212
- params: query_string_params,
213
- options: options
214
- )
215
- result = ::Google::Cloud::Compute::V1::CommitmentAggregatedList.decode_json response.body, ignore_unknown_fields: true
216
+ options.apply_defaults timeout: @config.timeout,
217
+ metadata: @config.metadata
216
218
 
217
- yield result, response if block_given?
218
- result
219
+ @region_commitments_stub.aggregated_list request, options do |result, response|
220
+ result = ::Gapic::Rest::PagedEnumerable.new @region_commitments_stub, :aggregated_list, "items", request, result, options
221
+ yield result, response if block_given?
222
+ return result
223
+ end
219
224
  rescue ::Faraday::Error => e
220
225
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
221
226
  raise ::Google::Cloud::Error.from_error(gapic_error)
@@ -247,7 +252,7 @@ module Google
247
252
  # Project ID for this request.
248
253
  # @param region [::String]
249
254
  # Name of the region for this request.
250
- # @yield [result, env] Access the result along with the Faraday environment object
255
+ # @yield [result, response] Access the result along with the Faraday response object
251
256
  # @yieldparam result [::Google::Cloud::Compute::V1::Commitment]
252
257
  # @yieldparam response [::Faraday::Response]
253
258
  #
@@ -263,7 +268,7 @@ module Google
263
268
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
264
269
 
265
270
  # Customize the options with defaults
266
- call_metadata = {}
271
+ call_metadata = @config.rpcs.get.metadata.to_h
267
272
 
268
273
  # Set x-goog-api-client header
269
274
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -271,18 +276,16 @@ module Google
271
276
  gapic_version: ::Google::Cloud::Compute::V1::VERSION,
272
277
  transports_version_send: [:rest]
273
278
 
274
- options.apply_defaults timeout: @config.timeout,
279
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
275
280
  metadata: call_metadata
276
281
 
277
- uri, _body, _query_string_params = transcode_get request
278
- response = @client_stub.make_get_request(
279
- uri: uri,
280
- options: options
281
- )
282
- result = ::Google::Cloud::Compute::V1::Commitment.decode_json response.body, ignore_unknown_fields: true
282
+ options.apply_defaults timeout: @config.timeout,
283
+ metadata: @config.metadata
283
284
 
284
- yield result, response if block_given?
285
- result
285
+ @region_commitments_stub.get request, options do |result, response|
286
+ yield result, response if block_given?
287
+ return result
288
+ end
286
289
  rescue ::Faraday::Error => e
287
290
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
288
291
  raise ::Google::Cloud::Error.from_error(gapic_error)
@@ -320,11 +323,11 @@ module Google
320
323
  # For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments.
321
324
  #
322
325
  # The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
323
- # @yield [result, env] Access the result along with the Faraday environment object
324
- # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
326
+ # @yield [result, response] Access the result along with the Faraday response object
327
+ # @yieldparam result [::Gapic::Rest::BaseOperation]
325
328
  # @yieldparam response [::Faraday::Response]
326
329
  #
327
- # @return [::Google::Cloud::Compute::V1::Operation]
330
+ # @return [::Gapic::Rest::BaseOperation]
328
331
  #
329
332
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
330
333
  def insert request, options = nil
@@ -336,7 +339,7 @@ module Google
336
339
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
337
340
 
338
341
  # Customize the options with defaults
339
- call_metadata = {}
342
+ call_metadata = @config.rpcs.insert.metadata.to_h
340
343
 
341
344
  # Set x-goog-api-client header
342
345
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -344,20 +347,17 @@ module Google
344
347
  gapic_version: ::Google::Cloud::Compute::V1::VERSION,
345
348
  transports_version_send: [:rest]
346
349
 
347
- options.apply_defaults timeout: @config.timeout,
350
+ options.apply_defaults timeout: @config.rpcs.insert.timeout,
348
351
  metadata: call_metadata
349
352
 
350
- uri, body, query_string_params = transcode_insert request
351
- response = @client_stub.make_post_request(
352
- uri: uri,
353
- body: body,
354
- params: query_string_params,
355
- options: options
356
- )
357
- result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
358
-
359
- yield result, response if block_given?
360
- result
353
+ options.apply_defaults timeout: @config.timeout,
354
+ metadata: @config.metadata
355
+
356
+ @region_commitments_stub.insert request, options do |result, response|
357
+ result = ::Gapic::Rest::BaseOperation.new result
358
+ yield result, response if block_given?
359
+ return result
360
+ end
361
361
  rescue ::Faraday::Error => e
362
362
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
363
363
  raise ::Google::Cloud::Error.from_error(gapic_error)
@@ -406,12 +406,12 @@ module Google
406
406
  # @param region [::String]
407
407
  # Name of the region for this request.
408
408
  # @param return_partial_success [::Boolean]
409
- # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false and the logic is the same as today.
410
- # @yield [result, env] Access the result along with the Faraday environment object
411
- # @yieldparam result [::Google::Cloud::Compute::V1::CommitmentList]
409
+ # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
410
+ # @yield [result, response] Access the result along with the Faraday response object
411
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Commitment>]
412
412
  # @yieldparam response [::Faraday::Response]
413
413
  #
414
- # @return [::Google::Cloud::Compute::V1::CommitmentList]
414
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Commitment>]
415
415
  #
416
416
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
417
417
  def list request, options = nil
@@ -423,7 +423,7 @@ module Google
423
423
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
424
424
 
425
425
  # Customize the options with defaults
426
- call_metadata = {}
426
+ call_metadata = @config.rpcs.list.metadata.to_h
427
427
 
428
428
  # Set x-goog-api-client header
429
429
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -431,19 +431,17 @@ module Google
431
431
  gapic_version: ::Google::Cloud::Compute::V1::VERSION,
432
432
  transports_version_send: [:rest]
433
433
 
434
- options.apply_defaults timeout: @config.timeout,
434
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
435
435
  metadata: call_metadata
436
436
 
437
- uri, _body, query_string_params = transcode_list request
438
- response = @client_stub.make_get_request(
439
- uri: uri,
440
- params: query_string_params,
441
- options: options
442
- )
443
- result = ::Google::Cloud::Compute::V1::CommitmentList.decode_json response.body, ignore_unknown_fields: true
437
+ options.apply_defaults timeout: @config.timeout,
438
+ metadata: @config.metadata
444
439
 
445
- yield result, response if block_given?
446
- result
440
+ @region_commitments_stub.list request, options do |result, response|
441
+ result = ::Gapic::Rest::PagedEnumerable.new @region_commitments_stub, :list, "items", request, result, options
442
+ yield result, response if block_given?
443
+ return result
444
+ end
447
445
  rescue ::Faraday::Error => e
448
446
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
449
447
  raise ::Google::Cloud::Error.from_error(gapic_error)
@@ -498,6 +496,9 @@ module Google
498
496
  # @!attribute [rw] timeout
499
497
  # The call timeout in seconds.
500
498
  # @return [::Numeric]
499
+ # @!attribute [rw] metadata
500
+ # Additional REST headers to be sent with the call.
501
+ # @return [::Hash{::Symbol=>::String}]
501
502
  #
502
503
  class Configuration
503
504
  extend ::Gapic::Config
@@ -511,6 +512,7 @@ module Google
511
512
  config_attr :lib_name, nil, ::String, nil
512
513
  config_attr :lib_version, nil, ::String, nil
513
514
  config_attr :timeout, nil, ::Numeric, nil
515
+ config_attr :metadata, nil, ::Hash, nil
514
516
 
515
517
  # @private
516
518
  def initialize parent_config = nil
@@ -518,6 +520,67 @@ module Google
518
520
 
519
521
  yield self if block_given?
520
522
  end
523
+
524
+ ##
525
+ # Configurations for individual RPCs
526
+ # @return [Rpcs]
527
+ #
528
+ def rpcs
529
+ @rpcs ||= begin
530
+ parent_rpcs = nil
531
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
532
+ Rpcs.new parent_rpcs
533
+ end
534
+ end
535
+
536
+ ##
537
+ # Configuration RPC class for the RegionCommitments API.
538
+ #
539
+ # Includes fields providing the configuration for each RPC in this service.
540
+ # Each configuration object is of type `Gapic::Config::Method` and includes
541
+ # the following configuration fields:
542
+ #
543
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
544
+ #
545
+ # there is one other field (`retry_policy`) that can be set
546
+ # but is currently not supported for REST Gapic libraries.
547
+ #
548
+ class Rpcs
549
+ ##
550
+ # RPC-specific configuration for `aggregated_list`
551
+ # @return [::Gapic::Config::Method]
552
+ #
553
+ attr_reader :aggregated_list
554
+ ##
555
+ # RPC-specific configuration for `get`
556
+ # @return [::Gapic::Config::Method]
557
+ #
558
+ attr_reader :get
559
+ ##
560
+ # RPC-specific configuration for `insert`
561
+ # @return [::Gapic::Config::Method]
562
+ #
563
+ attr_reader :insert
564
+ ##
565
+ # RPC-specific configuration for `list`
566
+ # @return [::Gapic::Config::Method]
567
+ #
568
+ attr_reader :list
569
+
570
+ # @private
571
+ def initialize parent_rpcs = nil
572
+ aggregated_list_config = parent_rpcs.aggregated_list if parent_rpcs.respond_to? :aggregated_list
573
+ @aggregated_list = ::Gapic::Config::Method.new aggregated_list_config
574
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
575
+ @get = ::Gapic::Config::Method.new get_config
576
+ insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert
577
+ @insert = ::Gapic::Config::Method.new insert_config
578
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
579
+ @list = ::Gapic::Config::Method.new list_config
580
+
581
+ yield self if block_given?
582
+ end
583
+ end
521
584
  end
522
585
  end
523
586
  end