google-cloud-compute-v1 2.5.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +37 -10
  4. data/lib/google/cloud/compute/v1/accelerator_types/rest/service_stub.rb +14 -2
  5. data/lib/google/cloud/compute/v1/addresses/rest/client.rb +38 -10
  6. data/lib/google/cloud/compute/v1/addresses/rest/service_stub.rb +14 -2
  7. data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +38 -10
  8. data/lib/google/cloud/compute/v1/autoscalers/rest/service_stub.rb +14 -2
  9. data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +311 -8
  10. data/lib/google/cloud/compute/v1/backend_buckets/rest/service_stub.rb +196 -2
  11. data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +230 -10
  12. data/lib/google/cloud/compute/v1/backend_services/rest/service_stub.rb +134 -2
  13. data/lib/google/cloud/compute/v1/compute_pb.rb +79 -1
  14. data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +37 -10
  15. data/lib/google/cloud/compute/v1/disk_types/rest/service_stub.rb +14 -2
  16. data/lib/google/cloud/compute/v1/disks/rest/client.rb +38 -10
  17. data/lib/google/cloud/compute/v1/disks/rest/service_stub.rb +14 -2
  18. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +35 -8
  19. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/service_stub.rb +14 -2
  20. data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +35 -8
  21. data/lib/google/cloud/compute/v1/firewall_policies/rest/service_stub.rb +14 -2
  22. data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +35 -8
  23. data/lib/google/cloud/compute/v1/firewalls/rest/service_stub.rb +14 -2
  24. data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +38 -10
  25. data/lib/google/cloud/compute/v1/forwarding_rules/rest/service_stub.rb +14 -2
  26. data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +35 -8
  27. data/lib/google/cloud/compute/v1/global_addresses/rest/service_stub.rb +14 -2
  28. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +35 -8
  29. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/service_stub.rb +14 -2
  30. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +36 -9
  31. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/service_stub.rb +14 -2
  32. data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +37 -10
  33. data/lib/google/cloud/compute/v1/global_operations/rest/service_stub.rb +14 -2
  34. data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +34 -8
  35. data/lib/google/cloud/compute/v1/global_organization_operations/rest/service_stub.rb +14 -2
  36. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +35 -8
  37. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/service_stub.rb +14 -2
  38. data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +38 -10
  39. data/lib/google/cloud/compute/v1/health_checks/rest/service_stub.rb +14 -2
  40. data/lib/google/cloud/compute/v1/image_family_views/rest/client.rb +33 -7
  41. data/lib/google/cloud/compute/v1/image_family_views/rest/service_stub.rb +14 -2
  42. data/lib/google/cloud/compute/v1/images/rest/client.rb +35 -8
  43. data/lib/google/cloud/compute/v1/images/rest/service_stub.rb +14 -2
  44. data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +41 -13
  45. data/lib/google/cloud/compute/v1/instance_group_managers/rest/service_stub.rb +14 -2
  46. data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +39 -11
  47. data/lib/google/cloud/compute/v1/instance_groups/rest/service_stub.rb +14 -2
  48. data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +38 -10
  49. data/lib/google/cloud/compute/v1/instance_templates/rest/service_stub.rb +14 -2
  50. data/lib/google/cloud/compute/v1/instances/rest/client.rb +143 -11
  51. data/lib/google/cloud/compute/v1/instances/rest/service_stub.rb +76 -2
  52. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +38 -10
  53. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/service_stub.rb +14 -2
  54. data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +34 -8
  55. data/lib/google/cloud/compute/v1/interconnect_locations/rest/service_stub.rb +14 -2
  56. data/lib/google/cloud/compute/v1/interconnect_remote_locations/rest/client.rb +34 -8
  57. data/lib/google/cloud/compute/v1/interconnect_remote_locations/rest/service_stub.rb +14 -2
  58. data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +128 -9
  59. data/lib/google/cloud/compute/v1/interconnects/rest/service_stub.rb +74 -2
  60. data/lib/google/cloud/compute/v1/license_codes/rest/client.rb +33 -7
  61. data/lib/google/cloud/compute/v1/license_codes/rest/service_stub.rb +14 -2
  62. data/lib/google/cloud/compute/v1/licenses/rest/client.rb +35 -8
  63. data/lib/google/cloud/compute/v1/licenses/rest/service_stub.rb +14 -2
  64. data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +35 -8
  65. data/lib/google/cloud/compute/v1/machine_images/rest/service_stub.rb +14 -2
  66. data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +37 -10
  67. data/lib/google/cloud/compute/v1/machine_types/rest/service_stub.rb +14 -2
  68. data/lib/google/cloud/compute/v1/network_attachments/rest/client.rb +142 -10
  69. data/lib/google/cloud/compute/v1/network_attachments/rest/service_stub.rb +76 -2
  70. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/client.rb +37 -9
  71. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/service_stub.rb +14 -2
  72. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +39 -11
  73. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/service_stub.rb +14 -2
  74. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/client.rb +35 -8
  75. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/service_stub.rb +14 -2
  76. data/lib/google/cloud/compute/v1/networks/rest/client.rb +36 -9
  77. data/lib/google/cloud/compute/v1/networks/rest/service_stub.rb +14 -2
  78. data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +39 -11
  79. data/lib/google/cloud/compute/v1/node_groups/rest/service_stub.rb +14 -2
  80. data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +38 -10
  81. data/lib/google/cloud/compute/v1/node_templates/rest/service_stub.rb +14 -2
  82. data/lib/google/cloud/compute/v1/node_types/rest/client.rb +37 -10
  83. data/lib/google/cloud/compute/v1/node_types/rest/service_stub.rb +14 -2
  84. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +38 -10
  85. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/service_stub.rb +14 -2
  86. data/lib/google/cloud/compute/v1/projects/rest/client.rb +36 -9
  87. data/lib/google/cloud/compute/v1/projects/rest/service_stub.rb +14 -2
  88. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +236 -11
  89. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/service_stub.rb +134 -2
  90. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +242 -10
  91. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/service_stub.rb +136 -2
  92. data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +35 -8
  93. data/lib/google/cloud/compute/v1/region_autoscalers/rest/service_stub.rb +14 -2
  94. data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +335 -8
  95. data/lib/google/cloud/compute/v1/region_backend_services/rest/service_stub.rb +198 -2
  96. data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +38 -10
  97. data/lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb +14 -2
  98. data/lib/google/cloud/compute/v1/region_disk_types/rest/client.rb +34 -8
  99. data/lib/google/cloud/compute/v1/region_disk_types/rest/service_stub.rb +14 -2
  100. data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +35 -8
  101. data/lib/google/cloud/compute/v1/region_disks/rest/service_stub.rb +14 -2
  102. data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +35 -8
  103. data/lib/google/cloud/compute/v1/region_health_check_services/rest/service_stub.rb +14 -2
  104. data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +35 -8
  105. data/lib/google/cloud/compute/v1/region_health_checks/rest/service_stub.rb +14 -2
  106. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +38 -11
  107. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/service_stub.rb +14 -2
  108. data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +36 -9
  109. data/lib/google/cloud/compute/v1/region_instance_groups/rest/service_stub.rb +14 -2
  110. data/lib/google/cloud/compute/v1/region_instance_templates/rest/client.rb +35 -8
  111. data/lib/google/cloud/compute/v1/region_instance_templates/rest/service_stub.rb +14 -2
  112. data/lib/google/cloud/compute/v1/region_instances/rest/client.rb +34 -7
  113. data/lib/google/cloud/compute/v1/region_instances/rest/service_stub.rb +14 -2
  114. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +348 -11
  115. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/service_stub.rb +199 -2
  116. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/client.rb +35 -8
  117. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/service_stub.rb +14 -2
  118. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +35 -8
  119. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/service_stub.rb +14 -2
  120. data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +34 -8
  121. data/lib/google/cloud/compute/v1/region_operations/rest/service_stub.rb +14 -2
  122. data/lib/google/cloud/compute/v1/region_security_policies/rest/client.rb +451 -12
  123. data/lib/google/cloud/compute/v1/region_security_policies/rest/service_stub.rb +260 -2
  124. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +35 -8
  125. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/service_stub.rb +14 -2
  126. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/client.rb +36 -9
  127. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/service_stub.rb +14 -2
  128. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +35 -8
  129. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/service_stub.rb +14 -2
  130. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +35 -8
  131. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/service_stub.rb +14 -2
  132. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/client.rb +35 -8
  133. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/service_stub.rb +14 -2
  134. data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +35 -8
  135. data/lib/google/cloud/compute/v1/region_url_maps/rest/service_stub.rb +14 -2
  136. data/lib/google/cloud/compute/v1/regions/rest/client.rb +34 -8
  137. data/lib/google/cloud/compute/v1/regions/rest/service_stub.rb +14 -2
  138. data/lib/google/cloud/compute/v1/reservations/rest/client.rb +38 -10
  139. data/lib/google/cloud/compute/v1/reservations/rest/service_stub.rb +14 -2
  140. data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +38 -10
  141. data/lib/google/cloud/compute/v1/resource_policies/rest/service_stub.rb +14 -2
  142. data/lib/google/cloud/compute/v1/rest.rb +1 -0
  143. data/lib/google/cloud/compute/v1/routers/rest/client.rb +135 -11
  144. data/lib/google/cloud/compute/v1/routers/rest/service_stub.rb +75 -2
  145. data/lib/google/cloud/compute/v1/routes/rest/client.rb +35 -8
  146. data/lib/google/cloud/compute/v1/routes/rest/service_stub.rb +14 -2
  147. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +45 -13
  148. data/lib/google/cloud/compute/v1/security_policies/rest/service_stub.rb +14 -2
  149. data/lib/google/cloud/compute/v1/service_attachments/rest/client.rb +38 -10
  150. data/lib/google/cloud/compute/v1/service_attachments/rest/service_stub.rb +14 -2
  151. data/lib/google/cloud/compute/v1/snapshot_settings_service/credentials.rb +52 -0
  152. data/lib/google/cloud/compute/v1/snapshot_settings_service/rest/client.rb +507 -0
  153. data/lib/google/cloud/compute/v1/snapshot_settings_service/rest/service_stub.rb +179 -0
  154. data/lib/google/cloud/compute/v1/snapshot_settings_service/rest.rb +51 -0
  155. data/lib/google/cloud/compute/v1/snapshot_settings_service.rb +47 -0
  156. data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +35 -8
  157. data/lib/google/cloud/compute/v1/snapshots/rest/service_stub.rb +14 -2
  158. data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +38 -10
  159. data/lib/google/cloud/compute/v1/ssl_certificates/rest/service_stub.rb +14 -2
  160. data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +39 -11
  161. data/lib/google/cloud/compute/v1/ssl_policies/rest/service_stub.rb +14 -2
  162. data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +39 -11
  163. data/lib/google/cloud/compute/v1/subnetworks/rest/service_stub.rb +14 -2
  164. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +35 -8
  165. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/service_stub.rb +14 -2
  166. data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +38 -10
  167. data/lib/google/cloud/compute/v1/target_http_proxies/rest/service_stub.rb +14 -2
  168. data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +38 -10
  169. data/lib/google/cloud/compute/v1/target_https_proxies/rest/service_stub.rb +14 -2
  170. data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +142 -10
  171. data/lib/google/cloud/compute/v1/target_instances/rest/service_stub.rb +76 -2
  172. data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +142 -10
  173. data/lib/google/cloud/compute/v1/target_pools/rest/service_stub.rb +76 -2
  174. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +35 -8
  175. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/service_stub.rb +14 -2
  176. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +38 -10
  177. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/service_stub.rb +14 -2
  178. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +38 -10
  179. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/service_stub.rb +14 -2
  180. data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +38 -10
  181. data/lib/google/cloud/compute/v1/url_maps/rest/service_stub.rb +14 -2
  182. data/lib/google/cloud/compute/v1/version.rb +1 -1
  183. data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +38 -10
  184. data/lib/google/cloud/compute/v1/vpn_gateways/rest/service_stub.rb +14 -2
  185. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +38 -10
  186. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/service_stub.rb +14 -2
  187. data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +34 -8
  188. data/lib/google/cloud/compute/v1/zone_operations/rest/service_stub.rb +14 -2
  189. data/lib/google/cloud/compute/v1/zones/rest/client.rb +34 -8
  190. data/lib/google/cloud/compute/v1/zones/rest/service_stub.rb +14 -2
  191. data/lib/google/cloud/compute/v1.rb +1 -0
  192. data/proto_docs/google/api/client.rb +14 -0
  193. data/proto_docs/google/cloud/compute/v1/compute.rb +1654 -196
  194. data/proto_docs/google/protobuf/any.rb +144 -0
  195. metadata +11 -5
@@ -0,0 +1,507 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/errors"
20
+ require "google/cloud/compute/v1/compute_pb"
21
+ require "google/cloud/compute/v1/snapshot_settings_service/rest/service_stub"
22
+ require "google/cloud/compute/v1/global_operations/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Compute
27
+ module V1
28
+ module SnapshotSettingsService
29
+ module Rest
30
+ ##
31
+ # REST client for the SnapshotSettingsService service.
32
+ #
33
+ # The SnapshotSettings API.
34
+ #
35
+ class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "compute.$UNIVERSE_DOMAIN$"
38
+
39
+ # @private
40
+ attr_reader :snapshot_settings_service_stub
41
+
42
+ ##
43
+ # Configure the SnapshotSettingsService Client class.
44
+ #
45
+ # See {::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all SnapshotSettingsService clients
51
+ # ::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Compute", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.rpcs.get.timeout = 600.0
72
+ default_config.rpcs.get.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
74
+ }
75
+
76
+ default_config.rpcs.patch.timeout = 600.0
77
+
78
+ default_config
79
+ end
80
+ yield @configure if block_given?
81
+ @configure
82
+ end
83
+
84
+ ##
85
+ # Configure the SnapshotSettingsService Client instance.
86
+ #
87
+ # The configuration is set to the derived mode, meaning that values can be changed,
88
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
89
+ # should be made on {Client.configure}.
90
+ #
91
+ # See {::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client::Configuration}
92
+ # for a description of the configuration fields.
93
+ #
94
+ # @yield [config] Configure the Client client.
95
+ # @yieldparam config [Client::Configuration]
96
+ #
97
+ # @return [Client::Configuration]
98
+ #
99
+ def configure
100
+ yield @config if block_given?
101
+ @config
102
+ end
103
+
104
+ ##
105
+ # The effective universe domain
106
+ #
107
+ # @return [String]
108
+ #
109
+ def universe_domain
110
+ @snapshot_settings_service_stub.universe_domain
111
+ end
112
+
113
+ ##
114
+ # Create a new SnapshotSettingsService REST client object.
115
+ #
116
+ # @example
117
+ #
118
+ # # Create a client using the default configuration
119
+ # client = ::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client.new
120
+ #
121
+ # # Create a client using a custom configuration
122
+ # client = ::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client.new do |config|
123
+ # config.timeout = 10.0
124
+ # end
125
+ #
126
+ # @yield [config] Configure the SnapshotSettingsService client.
127
+ # @yieldparam config [Client::Configuration]
128
+ #
129
+ def initialize
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint.nil? ||
141
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-"))
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+
149
+ @quota_project_id = @config.quota_project
150
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
151
+
152
+ @global_operations = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client.new do |config|
153
+ config.credentials = credentials
154
+ config.quota_project = @quota_project_id
155
+ config.endpoint = @config.endpoint
156
+ config.universe_domain = @config.universe_domain
157
+ end
158
+
159
+ @snapshot_settings_service_stub = ::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::ServiceStub.new(
160
+ endpoint: @config.endpoint,
161
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
162
+ universe_domain: @config.universe_domain,
163
+ credentials: credentials
164
+ )
165
+ end
166
+
167
+ ##
168
+ # Get the associated client for long-running operations via GlobalOperations.
169
+ #
170
+ # @return [::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client]
171
+ #
172
+ attr_reader :global_operations
173
+
174
+ # Service calls
175
+
176
+ ##
177
+ # Get snapshot settings.
178
+ #
179
+ # @overload get(request, options = nil)
180
+ # Pass arguments to `get` via a request object, either of type
181
+ # {::Google::Cloud::Compute::V1::GetSnapshotSettingRequest} or an equivalent Hash.
182
+ #
183
+ # @param request [::Google::Cloud::Compute::V1::GetSnapshotSettingRequest, ::Hash]
184
+ # A request object representing the call parameters. Required. To specify no
185
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
186
+ # @param options [::Gapic::CallOptions, ::Hash]
187
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
188
+ #
189
+ # @overload get(project: nil)
190
+ # Pass arguments to `get` via keyword arguments. Note that at
191
+ # least one keyword argument is required. To specify no parameters, or to keep all
192
+ # the default parameter values, pass an empty Hash as a request object (see above).
193
+ #
194
+ # @param project [::String]
195
+ # Project ID for this request.
196
+ # @yield [result, operation] Access the result along with the TransportOperation object
197
+ # @yieldparam result [::Google::Cloud::Compute::V1::SnapshotSettings]
198
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
199
+ #
200
+ # @return [::Google::Cloud::Compute::V1::SnapshotSettings]
201
+ #
202
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
203
+ #
204
+ # @example Basic example
205
+ # require "google/cloud/compute/v1"
206
+ #
207
+ # # Create a client object. The client can be reused for multiple calls.
208
+ # client = Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client.new
209
+ #
210
+ # # Create a request. To set request fields, pass in keyword arguments.
211
+ # request = Google::Cloud::Compute::V1::GetSnapshotSettingRequest.new
212
+ #
213
+ # # Call the get method.
214
+ # result = client.get request
215
+ #
216
+ # # The returned object is of type Google::Cloud::Compute::V1::SnapshotSettings.
217
+ # p result
218
+ #
219
+ def get request, options = nil
220
+ raise ::ArgumentError, "request must be provided" if request.nil?
221
+
222
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetSnapshotSettingRequest
223
+
224
+ # Converts hash and nil to an options object
225
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
226
+
227
+ # Customize the options with defaults
228
+ call_metadata = @config.rpcs.get.metadata.to_h
229
+
230
+ # Set x-goog-api-client and x-goog-user-project headers
231
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
232
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
233
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
234
+ transports_version_send: [:rest]
235
+
236
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
237
+
238
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
239
+ metadata: call_metadata,
240
+ retry_policy: @config.rpcs.get.retry_policy
241
+
242
+ options.apply_defaults timeout: @config.timeout,
243
+ metadata: @config.metadata,
244
+ retry_policy: @config.retry_policy
245
+
246
+ @snapshot_settings_service_stub.get request, options do |result, operation|
247
+ yield result, operation if block_given?
248
+ return result
249
+ end
250
+ rescue ::Gapic::Rest::Error => e
251
+ raise ::Google::Cloud::Error.from_error(e)
252
+ end
253
+
254
+ ##
255
+ # Patch snapshot settings.
256
+ #
257
+ # @overload patch(request, options = nil)
258
+ # Pass arguments to `patch` via a request object, either of type
259
+ # {::Google::Cloud::Compute::V1::PatchSnapshotSettingRequest} or an equivalent Hash.
260
+ #
261
+ # @param request [::Google::Cloud::Compute::V1::PatchSnapshotSettingRequest, ::Hash]
262
+ # A request object representing the call parameters. Required. To specify no
263
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
264
+ # @param options [::Gapic::CallOptions, ::Hash]
265
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
266
+ #
267
+ # @overload patch(project: nil, request_id: nil, snapshot_settings_resource: nil, update_mask: nil)
268
+ # Pass arguments to `patch` via keyword arguments. Note that at
269
+ # least one keyword argument is required. To specify no parameters, or to keep all
270
+ # the default parameter values, pass an empty Hash as a request object (see above).
271
+ #
272
+ # @param project [::String]
273
+ # Project ID for this request.
274
+ # @param request_id [::String]
275
+ # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. 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. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
276
+ # @param snapshot_settings_resource [::Google::Cloud::Compute::V1::SnapshotSettings, ::Hash]
277
+ # The body resource for this request
278
+ # @param update_mask [::String]
279
+ # update_mask indicates fields to be updated as part of this request.
280
+ # @yield [result, operation] Access the result along with the TransportOperation object
281
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
282
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
283
+ #
284
+ # @return [::Gapic::GenericLRO::Operation]
285
+ #
286
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
287
+ #
288
+ # @example Basic example
289
+ # require "google/cloud/compute/v1"
290
+ #
291
+ # # Create a client object. The client can be reused for multiple calls.
292
+ # client = Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client.new
293
+ #
294
+ # # Create a request. To set request fields, pass in keyword arguments.
295
+ # request = Google::Cloud::Compute::V1::PatchSnapshotSettingRequest.new
296
+ #
297
+ # # Call the patch method.
298
+ # result = client.patch request
299
+ #
300
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
301
+ # p result
302
+ #
303
+ def patch request, options = nil
304
+ raise ::ArgumentError, "request must be provided" if request.nil?
305
+
306
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::PatchSnapshotSettingRequest
307
+
308
+ # Converts hash and nil to an options object
309
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
310
+
311
+ # Customize the options with defaults
312
+ call_metadata = @config.rpcs.patch.metadata.to_h
313
+
314
+ # Set x-goog-api-client and x-goog-user-project headers
315
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
316
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
317
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
318
+ transports_version_send: [:rest]
319
+
320
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
321
+
322
+ options.apply_defaults timeout: @config.rpcs.patch.timeout,
323
+ metadata: call_metadata,
324
+ retry_policy: @config.rpcs.patch.retry_policy
325
+
326
+ options.apply_defaults timeout: @config.timeout,
327
+ metadata: @config.metadata,
328
+ retry_policy: @config.retry_policy
329
+
330
+ @snapshot_settings_service_stub.patch request, options do |result, response|
331
+ result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
332
+ operation: result,
333
+ client: global_operations,
334
+ request_values: {
335
+ "project" => request.project
336
+ },
337
+ options: options
338
+ )
339
+ yield result, response if block_given?
340
+ return result
341
+ end
342
+ rescue ::Gapic::Rest::Error => e
343
+ raise ::Google::Cloud::Error.from_error(e)
344
+ end
345
+
346
+ ##
347
+ # Configuration class for the SnapshotSettingsService REST API.
348
+ #
349
+ # This class represents the configuration for SnapshotSettingsService REST,
350
+ # providing control over timeouts, retry behavior, logging, transport
351
+ # parameters, and other low-level controls. Certain parameters can also be
352
+ # applied individually to specific RPCs. See
353
+ # {::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client::Configuration::Rpcs}
354
+ # for a list of RPCs that can be configured independently.
355
+ #
356
+ # Configuration can be applied globally to all clients, or to a single client
357
+ # on construction.
358
+ #
359
+ # @example
360
+ #
361
+ # # Modify the global config, setting the timeout for
362
+ # # get to 20 seconds,
363
+ # # and all remaining timeouts to 10 seconds.
364
+ # ::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client.configure do |config|
365
+ # config.timeout = 10.0
366
+ # config.rpcs.get.timeout = 20.0
367
+ # end
368
+ #
369
+ # # Apply the above configuration only to a new client.
370
+ # client = ::Google::Cloud::Compute::V1::SnapshotSettingsService::Rest::Client.new do |config|
371
+ # config.timeout = 10.0
372
+ # config.rpcs.get.timeout = 20.0
373
+ # end
374
+ #
375
+ # @!attribute [rw] endpoint
376
+ # A custom service endpoint, as a hostname or hostname:port. The default is
377
+ # nil, indicating to use the default endpoint in the current universe domain.
378
+ # @return [::String,nil]
379
+ # @!attribute [rw] credentials
380
+ # Credentials to send with calls. You may provide any of the following types:
381
+ # * (`String`) The path to a service account key file in JSON format
382
+ # * (`Hash`) A service account key as a Hash
383
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
384
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
385
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
386
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
387
+ # * (`nil`) indicating no credentials
388
+ # @return [::Object]
389
+ # @!attribute [rw] scope
390
+ # The OAuth scopes
391
+ # @return [::Array<::String>]
392
+ # @!attribute [rw] lib_name
393
+ # The library name as recorded in instrumentation and logging
394
+ # @return [::String]
395
+ # @!attribute [rw] lib_version
396
+ # The library version as recorded in instrumentation and logging
397
+ # @return [::String]
398
+ # @!attribute [rw] timeout
399
+ # The call timeout in seconds.
400
+ # @return [::Numeric]
401
+ # @!attribute [rw] metadata
402
+ # Additional headers to be sent with the call.
403
+ # @return [::Hash{::Symbol=>::String}]
404
+ # @!attribute [rw] retry_policy
405
+ # The retry policy. The value is a hash with the following keys:
406
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
407
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
408
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
409
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
410
+ # trigger a retry.
411
+ # @return [::Hash]
412
+ # @!attribute [rw] quota_project
413
+ # A separate project against which to charge quota.
414
+ # @return [::String]
415
+ # @!attribute [rw] universe_domain
416
+ # The universe domain within which to make requests. This determines the
417
+ # default endpoint URL. The default value of nil uses the environment
418
+ # universe (usually the default "googleapis.com" universe).
419
+ # @return [::String,nil]
420
+ #
421
+ class Configuration
422
+ extend ::Gapic::Config
423
+
424
+ # @private
425
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
426
+ DEFAULT_ENDPOINT = "compute.googleapis.com"
427
+
428
+ config_attr :endpoint, nil, ::String, nil
429
+ config_attr :credentials, nil do |value|
430
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
431
+ allowed.any? { |klass| klass === value }
432
+ end
433
+ config_attr :scope, nil, ::String, ::Array, nil
434
+ config_attr :lib_name, nil, ::String, nil
435
+ config_attr :lib_version, nil, ::String, nil
436
+ config_attr :timeout, nil, ::Numeric, nil
437
+ config_attr :metadata, nil, ::Hash, nil
438
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
439
+ config_attr :quota_project, nil, ::String, nil
440
+ config_attr :universe_domain, nil, ::String, nil
441
+
442
+ # @private
443
+ def initialize parent_config = nil
444
+ @parent_config = parent_config unless parent_config.nil?
445
+
446
+ yield self if block_given?
447
+ end
448
+
449
+ ##
450
+ # Configurations for individual RPCs
451
+ # @return [Rpcs]
452
+ #
453
+ def rpcs
454
+ @rpcs ||= begin
455
+ parent_rpcs = nil
456
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
457
+ Rpcs.new parent_rpcs
458
+ end
459
+ end
460
+
461
+ ##
462
+ # Configuration RPC class for the SnapshotSettingsService API.
463
+ #
464
+ # Includes fields providing the configuration for each RPC in this service.
465
+ # Each configuration object is of type `Gapic::Config::Method` and includes
466
+ # the following configuration fields:
467
+ #
468
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
469
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
470
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
471
+ # include the following keys:
472
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
473
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
474
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
475
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
476
+ # trigger a retry.
477
+ #
478
+ class Rpcs
479
+ ##
480
+ # RPC-specific configuration for `get`
481
+ # @return [::Gapic::Config::Method]
482
+ #
483
+ attr_reader :get
484
+ ##
485
+ # RPC-specific configuration for `patch`
486
+ # @return [::Gapic::Config::Method]
487
+ #
488
+ attr_reader :patch
489
+
490
+ # @private
491
+ def initialize parent_rpcs = nil
492
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
493
+ @get = ::Gapic::Config::Method.new get_config
494
+ patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch
495
+ @patch = ::Gapic::Config::Method.new patch_config
496
+
497
+ yield self if block_given?
498
+ end
499
+ end
500
+ end
501
+ end
502
+ end
503
+ end
504
+ end
505
+ end
506
+ end
507
+ end
@@ -0,0 +1,179 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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 SnapshotSettingsService
26
+ module Rest
27
+ ##
28
+ # REST service stub for the SnapshotSettingsService 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:, endpoint_template:, universe_domain:, 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,
39
+ endpoint_template: endpoint_template,
40
+ universe_domain: universe_domain,
41
+ credentials: credentials,
42
+ numeric_enums: false,
43
+ raise_faraday_errors: false
44
+ end
45
+
46
+ ##
47
+ # The effective universe domain
48
+ #
49
+ # @return [String]
50
+ #
51
+ def universe_domain
52
+ @client_stub.universe_domain
53
+ end
54
+
55
+ ##
56
+ # Baseline implementation for the get REST call
57
+ #
58
+ # @param request_pb [::Google::Cloud::Compute::V1::GetSnapshotSettingRequest]
59
+ # A request object representing the call parameters. Required.
60
+ # @param options [::Gapic::CallOptions]
61
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
62
+ #
63
+ # @yield [result, operation] Access the result along with the TransportOperation object
64
+ # @yieldparam result [::Google::Cloud::Compute::V1::SnapshotSettings]
65
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
66
+ #
67
+ # @return [::Google::Cloud::Compute::V1::SnapshotSettings]
68
+ # A result object deserialized from the server's reply
69
+ def get request_pb, options = nil
70
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
71
+
72
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_request request_pb
73
+ query_string_params = if query_string_params.any?
74
+ query_string_params.to_h { |p| p.split "=", 2 }
75
+ else
76
+ {}
77
+ end
78
+
79
+ response = @client_stub.make_http_request(
80
+ verb,
81
+ uri: uri,
82
+ body: body || "",
83
+ params: query_string_params,
84
+ options: options
85
+ )
86
+ operation = ::Gapic::Rest::TransportOperation.new response
87
+ result = ::Google::Cloud::Compute::V1::SnapshotSettings.decode_json response.body, ignore_unknown_fields: true
88
+
89
+ yield result, operation if block_given?
90
+ result
91
+ end
92
+
93
+ ##
94
+ # Baseline implementation for the patch REST call
95
+ #
96
+ # @param request_pb [::Google::Cloud::Compute::V1::PatchSnapshotSettingRequest]
97
+ # A request object representing the call parameters. Required.
98
+ # @param options [::Gapic::CallOptions]
99
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
100
+ #
101
+ # @yield [result, operation] Access the result along with the TransportOperation object
102
+ # @yieldparam result [::Google::Cloud::Compute::V1::Operation]
103
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
104
+ #
105
+ # @return [::Google::Cloud::Compute::V1::Operation]
106
+ # A result object deserialized from the server's reply
107
+ def patch request_pb, options = nil
108
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
109
+
110
+ verb, uri, query_string_params, body = ServiceStub.transcode_patch_request request_pb
111
+ query_string_params = if query_string_params.any?
112
+ query_string_params.to_h { |p| p.split "=", 2 }
113
+ else
114
+ {}
115
+ end
116
+
117
+ response = @client_stub.make_http_request(
118
+ verb,
119
+ uri: uri,
120
+ body: body || "",
121
+ params: query_string_params,
122
+ options: options
123
+ )
124
+ operation = ::Gapic::Rest::TransportOperation.new response
125
+ result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true
126
+
127
+ yield result, operation if block_given?
128
+ result
129
+ end
130
+
131
+ ##
132
+ # @private
133
+ #
134
+ # GRPC transcoding helper method for the get REST call
135
+ #
136
+ # @param request_pb [::Google::Cloud::Compute::V1::GetSnapshotSettingRequest]
137
+ # A request object representing the call parameters. Required.
138
+ # @return [Array(String, [String, nil], Hash{String => String})]
139
+ # Uri, Body, Query string parameters
140
+ def self.transcode_get_request request_pb
141
+ transcoder = Gapic::Rest::GrpcTranscoder.new
142
+ .with_bindings(
143
+ uri_method: :get,
144
+ uri_template: "/compute/v1/projects/{project}/global/snapshotSettings",
145
+ matches: [
146
+ ["project", %r{^[^/]+/?$}, false]
147
+ ]
148
+ )
149
+ transcoder.transcode request_pb
150
+ end
151
+
152
+ ##
153
+ # @private
154
+ #
155
+ # GRPC transcoding helper method for the patch REST call
156
+ #
157
+ # @param request_pb [::Google::Cloud::Compute::V1::PatchSnapshotSettingRequest]
158
+ # A request object representing the call parameters. Required.
159
+ # @return [Array(String, [String, nil], Hash{String => String})]
160
+ # Uri, Body, Query string parameters
161
+ def self.transcode_patch_request request_pb
162
+ transcoder = Gapic::Rest::GrpcTranscoder.new
163
+ .with_bindings(
164
+ uri_method: :patch,
165
+ uri_template: "/compute/v1/projects/{project}/global/snapshotSettings",
166
+ body: "snapshot_settings_resource",
167
+ matches: [
168
+ ["project", %r{^[^/]+/?$}, false]
169
+ ]
170
+ )
171
+ transcoder.transcode request_pb
172
+ end
173
+ end
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
179
+ end