google-cloud-compute-v1 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +2 -2
  3. data/lib/google/cloud/compute/v1/addresses/rest/client.rb +2 -2
  4. data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +3 -3
  5. data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +3 -3
  6. data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +3 -3
  7. data/lib/google/cloud/compute/v1/compute_pb.rb +145 -0
  8. data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +3 -3
  9. data/lib/google/cloud/compute/v1/disks/rest/client.rb +94 -3
  10. data/lib/google/cloud/compute/v1/disks/rest/service_stub.rb +62 -0
  11. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +2 -2
  12. data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +4 -4
  13. data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +2 -2
  14. data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +2 -2
  15. data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +3 -3
  16. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +2 -2
  17. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +3 -3
  18. data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +2 -2
  19. data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +2 -2
  20. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +2 -2
  21. data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +3 -3
  22. data/lib/google/cloud/compute/v1/image_family_views/rest/client.rb +2 -2
  23. data/lib/google/cloud/compute/v1/images/rest/client.rb +5 -5
  24. data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +3 -3
  25. data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +2 -2
  26. data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +93 -6
  27. data/lib/google/cloud/compute/v1/instance_templates/rest/service_stub.rb +59 -0
  28. data/lib/google/cloud/compute/v1/instances/rest/client.rb +91 -3
  29. data/lib/google/cloud/compute/v1/instances/rest/service_stub.rb +62 -0
  30. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +2 -2
  31. data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +2 -2
  32. data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +2 -2
  33. data/lib/google/cloud/compute/v1/license_codes/rest/client.rb +2 -2
  34. data/lib/google/cloud/compute/v1/licenses/rest/client.rb +2 -2
  35. data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +3 -3
  36. data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +3 -3
  37. data/lib/google/cloud/compute/v1/network_attachments/rest/client.rb +2 -2
  38. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/client.rb +2 -2
  39. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +3 -3
  40. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/client.rb +2 -2
  41. data/lib/google/cloud/compute/v1/networks/rest/client.rb +3 -3
  42. data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +90 -2
  43. data/lib/google/cloud/compute/v1/node_groups/rest/service_stub.rb +62 -0
  44. data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +3 -3
  45. data/lib/google/cloud/compute/v1/node_types/rest/client.rb +3 -3
  46. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +2 -2
  47. data/lib/google/cloud/compute/v1/projects/rest/client.rb +2 -2
  48. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +2 -2
  49. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +2 -2
  50. data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +2 -2
  51. data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +2 -2
  52. data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +3 -3
  53. data/lib/google/cloud/compute/v1/region_disk_types/rest/client.rb +3 -3
  54. data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +93 -2
  55. data/lib/google/cloud/compute/v1/region_disks/rest/service_stub.rb +62 -0
  56. data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +2 -2
  57. data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +3 -3
  58. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +2 -2
  59. data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +2 -2
  60. data/lib/google/cloud/compute/v1/region_instance_templates/credentials.rb +52 -0
  61. data/lib/google/cloud/compute/v1/region_instance_templates/rest/client.rb +624 -0
  62. data/lib/google/cloud/compute/v1/region_instance_templates/rest/service_stub.rb +291 -0
  63. data/lib/google/cloud/compute/v1/region_instance_templates/rest.rb +51 -0
  64. data/lib/google/cloud/compute/v1/region_instance_templates.rb +47 -0
  65. data/lib/google/cloud/compute/v1/region_instances/rest/client.rb +2 -2
  66. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +3 -3
  67. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/client.rb +2 -2
  68. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +2 -2
  69. data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +2 -2
  70. data/lib/google/cloud/compute/v1/region_security_policies/rest/client.rb +2 -2
  71. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +2 -2
  72. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/client.rb +2 -2
  73. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +3 -3
  74. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +3 -3
  75. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/client.rb +2 -2
  76. data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +3 -3
  77. data/lib/google/cloud/compute/v1/regions/rest/client.rb +3 -3
  78. data/lib/google/cloud/compute/v1/reservations/rest/client.rb +2 -2
  79. data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +2 -2
  80. data/lib/google/cloud/compute/v1/rest.rb +1 -0
  81. data/lib/google/cloud/compute/v1/routers/rest/client.rb +3 -3
  82. data/lib/google/cloud/compute/v1/routes/rest/client.rb +3 -3
  83. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +2 -2
  84. data/lib/google/cloud/compute/v1/service_attachments/rest/client.rb +2 -2
  85. data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +3 -3
  86. data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +3 -3
  87. data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +3 -3
  88. data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +3 -3
  89. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +2 -2
  90. data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +3 -3
  91. data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +3 -3
  92. data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +3 -3
  93. data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +3 -3
  94. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +3 -3
  95. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +3 -3
  96. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +3 -3
  97. data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +3 -3
  98. data/lib/google/cloud/compute/v1/version.rb +1 -1
  99. data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +3 -3
  100. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +3 -3
  101. data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +2 -2
  102. data/lib/google/cloud/compute/v1/zones/rest/client.rb +3 -3
  103. data/lib/google/cloud/compute/v1.rb +1 -0
  104. data/proto_docs/google/api/client.rb +9 -3
  105. data/proto_docs/google/cloud/compute/v1/compute.rb +414 -29
  106. metadata +9 -4
@@ -0,0 +1,624 @@
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/region_instance_templates/rest/service_stub"
22
+ require "google/cloud/compute/v1/region_operations/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Compute
27
+ module V1
28
+ module RegionInstanceTemplates
29
+ module Rest
30
+ ##
31
+ # REST client for the RegionInstanceTemplates service.
32
+ #
33
+ # The RegionInstanceTemplates API.
34
+ #
35
+ class Client
36
+ # @private
37
+ attr_reader :region_instance_templates_stub
38
+
39
+ ##
40
+ # Configure the RegionInstanceTemplates Client class.
41
+ #
42
+ # See {::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all RegionInstanceTemplates clients
48
+ # ::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Compute", "V1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.delete.timeout = 600.0
69
+
70
+ default_config.rpcs.get.timeout = 600.0
71
+ default_config.rpcs.get.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
73
+ }
74
+
75
+ default_config.rpcs.insert.timeout = 600.0
76
+
77
+ default_config.rpcs.list.timeout = 600.0
78
+ default_config.rpcs.list.retry_policy = {
79
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
80
+ }
81
+
82
+ default_config
83
+ end
84
+ yield @configure if block_given?
85
+ @configure
86
+ end
87
+
88
+ ##
89
+ # Configure the RegionInstanceTemplates Client instance.
90
+ #
91
+ # The configuration is set to the derived mode, meaning that values can be changed,
92
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
93
+ # should be made on {Client.configure}.
94
+ #
95
+ # See {::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::Client::Configuration}
96
+ # for a description of the configuration fields.
97
+ #
98
+ # @yield [config] Configure the Client client.
99
+ # @yieldparam config [Client::Configuration]
100
+ #
101
+ # @return [Client::Configuration]
102
+ #
103
+ def configure
104
+ yield @config if block_given?
105
+ @config
106
+ end
107
+
108
+ ##
109
+ # Create a new RegionInstanceTemplates REST client object.
110
+ #
111
+ # @example
112
+ #
113
+ # # Create a client using the default configuration
114
+ # client = ::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::Client.new
115
+ #
116
+ # # Create a client using a custom configuration
117
+ # client = ::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::Client.new do |config|
118
+ # config.timeout = 10.0
119
+ # end
120
+ #
121
+ # @yield [config] Configure the RegionInstanceTemplates client.
122
+ # @yieldparam config [Client::Configuration]
123
+ #
124
+ def initialize
125
+ # Create the configuration object
126
+ @config = Configuration.new Client.configure
127
+
128
+ # Yield the configuration if needed
129
+ yield @config if block_given?
130
+
131
+ # Create credentials
132
+ credentials = @config.credentials
133
+ # Use self-signed JWT if the endpoint is unchanged from default,
134
+ # but only if the default endpoint does not have a region prefix.
135
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
136
+ !@config.endpoint.split(".").first.include?("-")
137
+ credentials ||= Credentials.default scope: @config.scope,
138
+ enable_self_signed_jwt: enable_self_signed_jwt
139
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
140
+ credentials = Credentials.new credentials, scope: @config.scope
141
+ end
142
+
143
+ @quota_project_id = @config.quota_project
144
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
145
+
146
+ @region_operations = ::Google::Cloud::Compute::V1::RegionOperations::Rest::Client.new do |config|
147
+ config.credentials = credentials
148
+ config.quota_project = @quota_project_id
149
+ config.endpoint = @config.endpoint
150
+ end
151
+
152
+ @region_instance_templates_stub = ::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
153
+ end
154
+
155
+ ##
156
+ # Get the associated client for long-running operations via RegionOperations.
157
+ #
158
+ # @return [::Google::Cloud::Compute::V1::RegionOperations::Rest::Client]
159
+ #
160
+ attr_reader :region_operations
161
+
162
+ # Service calls
163
+
164
+ ##
165
+ # Deletes the specified instance template. Deleting an instance template is permanent and cannot be undone.
166
+ #
167
+ # @overload delete(request, options = nil)
168
+ # Pass arguments to `delete` via a request object, either of type
169
+ # {::Google::Cloud::Compute::V1::DeleteRegionInstanceTemplateRequest} or an equivalent Hash.
170
+ #
171
+ # @param request [::Google::Cloud::Compute::V1::DeleteRegionInstanceTemplateRequest, ::Hash]
172
+ # A request object representing the call parameters. Required. To specify no
173
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
174
+ # @param options [::Gapic::CallOptions, ::Hash]
175
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
176
+ #
177
+ # @overload delete(instance_template: nil, project: nil, region: nil, request_id: nil)
178
+ # Pass arguments to `delete` via keyword arguments. Note that at
179
+ # least one keyword argument is required. To specify no parameters, or to keep all
180
+ # the default parameter values, pass an empty Hash as a request object (see above).
181
+ #
182
+ # @param instance_template [::String]
183
+ # The name of the instance template to delete.
184
+ # @param project [::String]
185
+ # Project ID for this request.
186
+ # @param region [::String]
187
+ # The name of the region for this request.
188
+ # @param request_id [::String]
189
+ # 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).
190
+ # @yield [result, operation] Access the result along with the TransportOperation object
191
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
192
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
193
+ #
194
+ # @return [::Gapic::GenericLRO::Operation]
195
+ #
196
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
197
+ def delete request, options = nil
198
+ raise ::ArgumentError, "request must be provided" if request.nil?
199
+
200
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DeleteRegionInstanceTemplateRequest
201
+
202
+ # Converts hash and nil to an options object
203
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
204
+
205
+ # Customize the options with defaults
206
+ call_metadata = @config.rpcs.delete.metadata.to_h
207
+
208
+ # Set x-goog-api-client and x-goog-user-project headers
209
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
210
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
211
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
212
+ transports_version_send: [:rest]
213
+
214
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
215
+
216
+ options.apply_defaults timeout: @config.rpcs.delete.timeout,
217
+ metadata: call_metadata,
218
+ retry_policy: @config.rpcs.delete.retry_policy
219
+
220
+ options.apply_defaults timeout: @config.timeout,
221
+ metadata: @config.metadata,
222
+ retry_policy: @config.retry_policy
223
+
224
+ @region_instance_templates_stub.delete request, options do |result, response|
225
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
226
+ operation: result,
227
+ client: region_operations,
228
+ request_values: {
229
+ "project" => request.project,
230
+ "region" => request.region
231
+ },
232
+ options: options
233
+ )
234
+ yield result, response if block_given?
235
+ return result
236
+ end
237
+ rescue ::Gapic::Rest::Error => e
238
+ raise ::Google::Cloud::Error.from_error(e)
239
+ end
240
+
241
+ ##
242
+ # Returns the specified instance template.
243
+ #
244
+ # @overload get(request, options = nil)
245
+ # Pass arguments to `get` via a request object, either of type
246
+ # {::Google::Cloud::Compute::V1::GetRegionInstanceTemplateRequest} or an equivalent Hash.
247
+ #
248
+ # @param request [::Google::Cloud::Compute::V1::GetRegionInstanceTemplateRequest, ::Hash]
249
+ # A request object representing the call parameters. Required. To specify no
250
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
251
+ # @param options [::Gapic::CallOptions, ::Hash]
252
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
253
+ #
254
+ # @overload get(instance_template: nil, project: nil, region: nil)
255
+ # Pass arguments to `get` via keyword arguments. Note that at
256
+ # least one keyword argument is required. To specify no parameters, or to keep all
257
+ # the default parameter values, pass an empty Hash as a request object (see above).
258
+ #
259
+ # @param instance_template [::String]
260
+ # The name of the instance template.
261
+ # @param project [::String]
262
+ # Project ID for this request.
263
+ # @param region [::String]
264
+ # The name of the region for this request.
265
+ # @yield [result, operation] Access the result along with the TransportOperation object
266
+ # @yieldparam result [::Google::Cloud::Compute::V1::InstanceTemplate]
267
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
268
+ #
269
+ # @return [::Google::Cloud::Compute::V1::InstanceTemplate]
270
+ #
271
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
272
+ def get request, options = nil
273
+ raise ::ArgumentError, "request must be provided" if request.nil?
274
+
275
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetRegionInstanceTemplateRequest
276
+
277
+ # Converts hash and nil to an options object
278
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
279
+
280
+ # Customize the options with defaults
281
+ call_metadata = @config.rpcs.get.metadata.to_h
282
+
283
+ # Set x-goog-api-client and x-goog-user-project headers
284
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
285
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
286
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
287
+ transports_version_send: [:rest]
288
+
289
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
290
+
291
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
292
+ metadata: call_metadata,
293
+ retry_policy: @config.rpcs.get.retry_policy
294
+
295
+ options.apply_defaults timeout: @config.timeout,
296
+ metadata: @config.metadata,
297
+ retry_policy: @config.retry_policy
298
+
299
+ @region_instance_templates_stub.get request, options do |result, operation|
300
+ yield result, operation if block_given?
301
+ return result
302
+ end
303
+ rescue ::Gapic::Rest::Error => e
304
+ raise ::Google::Cloud::Error.from_error(e)
305
+ end
306
+
307
+ ##
308
+ # Creates an instance template in the specified project and region using the global instance template whose URL is included in the request.
309
+ #
310
+ # @overload insert(request, options = nil)
311
+ # Pass arguments to `insert` via a request object, either of type
312
+ # {::Google::Cloud::Compute::V1::InsertRegionInstanceTemplateRequest} or an equivalent Hash.
313
+ #
314
+ # @param request [::Google::Cloud::Compute::V1::InsertRegionInstanceTemplateRequest, ::Hash]
315
+ # A request object representing the call parameters. Required. To specify no
316
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
317
+ # @param options [::Gapic::CallOptions, ::Hash]
318
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
319
+ #
320
+ # @overload insert(instance_template_resource: nil, project: nil, region: nil, request_id: nil)
321
+ # Pass arguments to `insert` via keyword arguments. Note that at
322
+ # least one keyword argument is required. To specify no parameters, or to keep all
323
+ # the default parameter values, pass an empty Hash as a request object (see above).
324
+ #
325
+ # @param instance_template_resource [::Google::Cloud::Compute::V1::InstanceTemplate, ::Hash]
326
+ # The body resource for this request
327
+ # @param project [::String]
328
+ # Project ID for this request.
329
+ # @param region [::String]
330
+ # The name of the region for this request.
331
+ # @param request_id [::String]
332
+ # 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).
333
+ # @yield [result, operation] Access the result along with the TransportOperation object
334
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
335
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
336
+ #
337
+ # @return [::Gapic::GenericLRO::Operation]
338
+ #
339
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
340
+ def insert request, options = nil
341
+ raise ::ArgumentError, "request must be provided" if request.nil?
342
+
343
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::InsertRegionInstanceTemplateRequest
344
+
345
+ # Converts hash and nil to an options object
346
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
347
+
348
+ # Customize the options with defaults
349
+ call_metadata = @config.rpcs.insert.metadata.to_h
350
+
351
+ # Set x-goog-api-client and x-goog-user-project headers
352
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
353
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
354
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
355
+ transports_version_send: [:rest]
356
+
357
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
358
+
359
+ options.apply_defaults timeout: @config.rpcs.insert.timeout,
360
+ metadata: call_metadata,
361
+ retry_policy: @config.rpcs.insert.retry_policy
362
+
363
+ options.apply_defaults timeout: @config.timeout,
364
+ metadata: @config.metadata,
365
+ retry_policy: @config.retry_policy
366
+
367
+ @region_instance_templates_stub.insert request, options do |result, response|
368
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
369
+ operation: result,
370
+ client: region_operations,
371
+ request_values: {
372
+ "project" => request.project,
373
+ "region" => request.region
374
+ },
375
+ options: options
376
+ )
377
+ yield result, response if block_given?
378
+ return result
379
+ end
380
+ rescue ::Gapic::Rest::Error => e
381
+ raise ::Google::Cloud::Error.from_error(e)
382
+ end
383
+
384
+ ##
385
+ # Retrieves a list of instance templates that are contained within the specified project and region.
386
+ #
387
+ # @overload list(request, options = nil)
388
+ # Pass arguments to `list` via a request object, either of type
389
+ # {::Google::Cloud::Compute::V1::ListRegionInstanceTemplatesRequest} or an equivalent Hash.
390
+ #
391
+ # @param request [::Google::Cloud::Compute::V1::ListRegionInstanceTemplatesRequest, ::Hash]
392
+ # A request object representing the call parameters. Required. To specify no
393
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
394
+ # @param options [::Gapic::CallOptions, ::Hash]
395
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
396
+ #
397
+ # @overload list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, region: nil, return_partial_success: nil)
398
+ # Pass arguments to `list` via keyword arguments. Note that at
399
+ # least one keyword argument is required. To specify no parameters, or to keep all
400
+ # the default parameter values, pass an empty Hash as a request object (see above).
401
+ #
402
+ # @param filter [::String]
403
+ # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`.
404
+ # @param max_results [::Integer]
405
+ # The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
406
+ # @param order_by [::String]
407
+ # Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
408
+ # @param page_token [::String]
409
+ # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
410
+ # @param project [::String]
411
+ # Project ID for this request.
412
+ # @param region [::String]
413
+ # The name of the regions for this request.
414
+ # @param return_partial_success [::Boolean]
415
+ # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
416
+ # @yield [result, operation] Access the result along with the TransportOperation object
417
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceTemplate>]
418
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
419
+ #
420
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstanceTemplate>]
421
+ #
422
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
423
+ def list request, options = nil
424
+ raise ::ArgumentError, "request must be provided" if request.nil?
425
+
426
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListRegionInstanceTemplatesRequest
427
+
428
+ # Converts hash and nil to an options object
429
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
430
+
431
+ # Customize the options with defaults
432
+ call_metadata = @config.rpcs.list.metadata.to_h
433
+
434
+ # Set x-goog-api-client and x-goog-user-project headers
435
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
436
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
437
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
438
+ transports_version_send: [:rest]
439
+
440
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
441
+
442
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
443
+ metadata: call_metadata,
444
+ retry_policy: @config.rpcs.list.retry_policy
445
+
446
+ options.apply_defaults timeout: @config.timeout,
447
+ metadata: @config.metadata,
448
+ retry_policy: @config.retry_policy
449
+
450
+ @region_instance_templates_stub.list request, options do |result, operation|
451
+ result = ::Gapic::Rest::PagedEnumerable.new @region_instance_templates_stub, :list, "items", request, result, options
452
+ yield result, operation if block_given?
453
+ return result
454
+ end
455
+ rescue ::Gapic::Rest::Error => e
456
+ raise ::Google::Cloud::Error.from_error(e)
457
+ end
458
+
459
+ ##
460
+ # Configuration class for the RegionInstanceTemplates REST API.
461
+ #
462
+ # This class represents the configuration for RegionInstanceTemplates REST,
463
+ # providing control over timeouts, retry behavior, logging, transport
464
+ # parameters, and other low-level controls. Certain parameters can also be
465
+ # applied individually to specific RPCs. See
466
+ # {::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::Client::Configuration::Rpcs}
467
+ # for a list of RPCs that can be configured independently.
468
+ #
469
+ # Configuration can be applied globally to all clients, or to a single client
470
+ # on construction.
471
+ #
472
+ # @example
473
+ #
474
+ # # Modify the global config, setting the timeout for
475
+ # # delete to 20 seconds,
476
+ # # and all remaining timeouts to 10 seconds.
477
+ # ::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::Client.configure do |config|
478
+ # config.timeout = 10.0
479
+ # config.rpcs.delete.timeout = 20.0
480
+ # end
481
+ #
482
+ # # Apply the above configuration only to a new client.
483
+ # client = ::Google::Cloud::Compute::V1::RegionInstanceTemplates::Rest::Client.new do |config|
484
+ # config.timeout = 10.0
485
+ # config.rpcs.delete.timeout = 20.0
486
+ # end
487
+ #
488
+ # @!attribute [rw] endpoint
489
+ # The hostname or hostname:port of the service endpoint.
490
+ # Defaults to `"compute.googleapis.com"`.
491
+ # @return [::String]
492
+ # @!attribute [rw] credentials
493
+ # Credentials to send with calls. You may provide any of the following types:
494
+ # * (`String`) The path to a service account key file in JSON format
495
+ # * (`Hash`) A service account key as a Hash
496
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
497
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
498
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
499
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
500
+ # * (`nil`) indicating no credentials
501
+ # @return [::Object]
502
+ # @!attribute [rw] scope
503
+ # The OAuth scopes
504
+ # @return [::Array<::String>]
505
+ # @!attribute [rw] lib_name
506
+ # The library name as recorded in instrumentation and logging
507
+ # @return [::String]
508
+ # @!attribute [rw] lib_version
509
+ # The library version as recorded in instrumentation and logging
510
+ # @return [::String]
511
+ # @!attribute [rw] timeout
512
+ # The call timeout in seconds.
513
+ # @return [::Numeric]
514
+ # @!attribute [rw] metadata
515
+ # Additional headers to be sent with the call.
516
+ # @return [::Hash{::Symbol=>::String}]
517
+ # @!attribute [rw] retry_policy
518
+ # The retry policy. The value is a hash with the following keys:
519
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
520
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
521
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
522
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
523
+ # trigger a retry.
524
+ # @return [::Hash]
525
+ # @!attribute [rw] quota_project
526
+ # A separate project against which to charge quota.
527
+ # @return [::String]
528
+ #
529
+ class Configuration
530
+ extend ::Gapic::Config
531
+
532
+ config_attr :endpoint, "compute.googleapis.com", ::String
533
+ config_attr :credentials, nil do |value|
534
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
535
+ allowed.any? { |klass| klass === value }
536
+ end
537
+ config_attr :scope, nil, ::String, ::Array, nil
538
+ config_attr :lib_name, nil, ::String, nil
539
+ config_attr :lib_version, nil, ::String, nil
540
+ config_attr :timeout, nil, ::Numeric, nil
541
+ config_attr :metadata, nil, ::Hash, nil
542
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
543
+ config_attr :quota_project, nil, ::String, nil
544
+
545
+ # @private
546
+ def initialize parent_config = nil
547
+ @parent_config = parent_config unless parent_config.nil?
548
+
549
+ yield self if block_given?
550
+ end
551
+
552
+ ##
553
+ # Configurations for individual RPCs
554
+ # @return [Rpcs]
555
+ #
556
+ def rpcs
557
+ @rpcs ||= begin
558
+ parent_rpcs = nil
559
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
560
+ Rpcs.new parent_rpcs
561
+ end
562
+ end
563
+
564
+ ##
565
+ # Configuration RPC class for the RegionInstanceTemplates API.
566
+ #
567
+ # Includes fields providing the configuration for each RPC in this service.
568
+ # Each configuration object is of type `Gapic::Config::Method` and includes
569
+ # the following configuration fields:
570
+ #
571
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
572
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
573
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
574
+ # include the following keys:
575
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
576
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
577
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
578
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
579
+ # trigger a retry.
580
+ #
581
+ class Rpcs
582
+ ##
583
+ # RPC-specific configuration for `delete`
584
+ # @return [::Gapic::Config::Method]
585
+ #
586
+ attr_reader :delete
587
+ ##
588
+ # RPC-specific configuration for `get`
589
+ # @return [::Gapic::Config::Method]
590
+ #
591
+ attr_reader :get
592
+ ##
593
+ # RPC-specific configuration for `insert`
594
+ # @return [::Gapic::Config::Method]
595
+ #
596
+ attr_reader :insert
597
+ ##
598
+ # RPC-specific configuration for `list`
599
+ # @return [::Gapic::Config::Method]
600
+ #
601
+ attr_reader :list
602
+
603
+ # @private
604
+ def initialize parent_rpcs = nil
605
+ delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete
606
+ @delete = ::Gapic::Config::Method.new delete_config
607
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
608
+ @get = ::Gapic::Config::Method.new get_config
609
+ insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert
610
+ @insert = ::Gapic::Config::Method.new insert_config
611
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
612
+ @list = ::Gapic::Config::Method.new list_config
613
+
614
+ yield self if block_given?
615
+ end
616
+ end
617
+ end
618
+ end
619
+ end
620
+ end
621
+ end
622
+ end
623
+ end
624
+ end