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