google-cloud-compute-v1 0.5.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/AUTHENTICATION.md +7 -25
- data/README.md +4 -4
- data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +2 -2
- data/lib/google/cloud/compute/v1/addresses/rest/client.rb +37 -8
- data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +59 -14
- data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +158 -19
- data/lib/google/cloud/compute/v1/backend_buckets/rest/service_stub.rb +46 -0
- data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +169 -23
- data/lib/google/cloud/compute/v1/backend_services/rest/service_stub.rb +46 -0
- data/lib/google/cloud/compute/v1/compute_pb.rb +534 -2
- data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +2 -2
- data/lib/google/cloud/compute/v1/disks/rest/client.rb +93 -24
- data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +44 -10
- data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +98 -31
- data/lib/google/cloud/compute/v1/firewall_policies/rest/service_stub.rb +2 -2
- data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +54 -13
- data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +70 -17
- data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +34 -7
- data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +64 -16
- data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +55 -14
- data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +2 -2
- data/lib/google/cloud/compute/v1/global_operations/rest/nonstandard_lro.rb +68 -0
- data/lib/google/cloud/compute/v1/global_operations.rb +1 -0
- data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +1 -1
- data/lib/google/cloud/compute/v1/global_organization_operations/rest/nonstandard_lro.rb +68 -0
- data/lib/google/cloud/compute/v1/global_organization_operations.rb +1 -0
- data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +47 -13
- data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +55 -14
- data/lib/google/cloud/compute/v1/images/rest/client.rb +64 -16
- data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +172 -47
- data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +71 -18
- data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +34 -7
- data/lib/google/cloud/compute/v1/instances/rest/client.rb +521 -96
- data/lib/google/cloud/compute/v1/instances/rest/service_stub.rb +91 -0
- data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +48 -11
- data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +1 -1
- data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +44 -10
- data/lib/google/cloud/compute/v1/licenses/rest/client.rb +34 -7
- data/lib/google/cloud/compute/v1/machine_images/credentials.rb +52 -0
- data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +804 -0
- data/lib/google/cloud/compute/v1/machine_images/rest/service_stub.rb +363 -0
- data/lib/google/cloud/compute/v1/machine_images/rest.rb +33 -0
- data/lib/google/cloud/compute/v1/machine_images.rb +44 -0
- data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +2 -2
- data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +60 -15
- data/lib/google/cloud/compute/v1/networks/rest/client.rb +85 -23
- data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +82 -21
- data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +37 -8
- data/lib/google/cloud/compute/v1/node_types/rest/client.rb +2 -2
- data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +48 -11
- data/lib/google/cloud/compute/v1/projects/rest/client.rb +107 -31
- data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +47 -13
- data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +51 -14
- data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +58 -13
- data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +58 -13
- data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +116 -5
- data/lib/google/cloud/compute/v1/region_commitments/rest/service_stub.rb +48 -0
- 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 +92 -23
- data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +47 -10
- data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +58 -13
- data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +171 -46
- data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +26 -5
- data/lib/google/cloud/compute/v1/region_instances/rest/client.rb +24 -3
- data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +36 -7
- data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +38 -9
- data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +1 -1
- data/lib/google/cloud/compute/v1/region_operations/rest/nonstandard_lro.rb +68 -0
- data/lib/google/cloud/compute/v1/region_operations.rb +1 -0
- data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +38 -9
- data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +47 -10
- data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +62 -17
- data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +58 -13
- data/lib/google/cloud/compute/v1/regions/rest/client.rb +3 -3
- data/lib/google/cloud/compute/v1/reservations/rest/client.rb +138 -11
- data/lib/google/cloud/compute/v1/reservations/rest/service_stub.rb +48 -0
- data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +37 -8
- data/lib/google/cloud/compute/v1/routers/rest/client.rb +60 -15
- data/lib/google/cloud/compute/v1/routes/rest/client.rb +34 -7
- data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +75 -20
- data/lib/google/cloud/compute/v1/service_attachments/rest/client.rb +51 -14
- data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +116 -7
- data/lib/google/cloud/compute/v1/snapshots/rest/service_stub.rb +46 -0
- data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +37 -10
- data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +45 -11
- data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +71 -18
- data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +47 -13
- data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +56 -15
- data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +86 -24
- data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +37 -8
- data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +92 -23
- data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +74 -19
- data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +54 -13
- data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +37 -8
- data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +65 -17
- data/lib/google/cloud/compute/v1/version.rb +1 -1
- data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +48 -11
- data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +37 -8
- data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +1 -1
- data/lib/google/cloud/compute/v1/zone_operations/rest/nonstandard_lro.rb +68 -0
- data/lib/google/cloud/compute/v1/zone_operations.rb +1 -0
- data/lib/google/cloud/compute/v1/zones/rest/client.rb +1 -1
- data/lib/google/cloud/compute/v1.rb +3 -0
- data/proto_docs/README.md +1 -1
- data/proto_docs/google/api/resource.rb +10 -71
- data/proto_docs/google/cloud/compute/v1/compute.rb +1647 -330
- metadata +14 -7
@@ -0,0 +1,804 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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/machine_images/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 MachineImages
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the MachineImages service.
|
32
|
+
#
|
33
|
+
# The MachineImages API.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
# @private
|
37
|
+
attr_reader :machine_images_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the MachineImages Client class.
|
41
|
+
#
|
42
|
+
# See {::Google::Cloud::Compute::V1::MachineImages::Rest::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
#
|
47
|
+
# # Modify the configuration for all MachineImages clients
|
48
|
+
# ::Google::Cloud::Compute::V1::MachineImages::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.get_iam_policy.timeout = 600.0
|
76
|
+
default_config.rpcs.get_iam_policy.retry_policy = {
|
77
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
78
|
+
}
|
79
|
+
|
80
|
+
default_config.rpcs.insert.timeout = 600.0
|
81
|
+
|
82
|
+
default_config.rpcs.list.timeout = 600.0
|
83
|
+
default_config.rpcs.list.retry_policy = {
|
84
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
85
|
+
}
|
86
|
+
|
87
|
+
default_config.rpcs.set_iam_policy.timeout = 600.0
|
88
|
+
|
89
|
+
default_config.rpcs.test_iam_permissions.timeout = 600.0
|
90
|
+
|
91
|
+
default_config
|
92
|
+
end
|
93
|
+
yield @configure if block_given?
|
94
|
+
@configure
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Configure the MachineImages Client instance.
|
99
|
+
#
|
100
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
101
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
102
|
+
# should be made on {Client.configure}.
|
103
|
+
#
|
104
|
+
# See {::Google::Cloud::Compute::V1::MachineImages::Rest::Client::Configuration}
|
105
|
+
# for a description of the configuration fields.
|
106
|
+
#
|
107
|
+
# @yield [config] Configure the Client client.
|
108
|
+
# @yieldparam config [Client::Configuration]
|
109
|
+
#
|
110
|
+
# @return [Client::Configuration]
|
111
|
+
#
|
112
|
+
def configure
|
113
|
+
yield @config if block_given?
|
114
|
+
@config
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Create a new MachineImages REST client object.
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
#
|
122
|
+
# # Create a client using the default configuration
|
123
|
+
# client = ::Google::Cloud::Compute::V1::MachineImages::Rest::Client.new
|
124
|
+
#
|
125
|
+
# # Create a client using a custom configuration
|
126
|
+
# client = ::Google::Cloud::Compute::V1::MachineImages::Rest::Client.new do |config|
|
127
|
+
# config.timeout = 10.0
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# @yield [config] Configure the MachineImages client.
|
131
|
+
# @yieldparam config [Client::Configuration]
|
132
|
+
#
|
133
|
+
def initialize
|
134
|
+
# Create the configuration object
|
135
|
+
@config = Configuration.new Client.configure
|
136
|
+
|
137
|
+
# Yield the configuration if needed
|
138
|
+
yield @config if block_given?
|
139
|
+
|
140
|
+
# Create credentials
|
141
|
+
credentials = @config.credentials
|
142
|
+
credentials ||= Credentials.default scope: @config.scope
|
143
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
144
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
145
|
+
end
|
146
|
+
|
147
|
+
@global_operations = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client.new do |config|
|
148
|
+
config.credentials = credentials
|
149
|
+
config.endpoint = @config.endpoint
|
150
|
+
end
|
151
|
+
|
152
|
+
@machine_images_stub = ::Google::Cloud::Compute::V1::MachineImages::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# Get the associated client for long-running operations via GlobalOperations.
|
157
|
+
#
|
158
|
+
# @return [::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client]
|
159
|
+
#
|
160
|
+
attr_reader :global_operations
|
161
|
+
|
162
|
+
# Service calls
|
163
|
+
|
164
|
+
##
|
165
|
+
# Deletes the specified machine image. Deleting a machine image 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::DeleteMachineImageRequest} or an equivalent Hash.
|
170
|
+
#
|
171
|
+
# @param request [::Google::Cloud::Compute::V1::DeleteMachineImageRequest, ::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
|
+
# Note: currently retry functionality is not implemented. While it is possible
|
177
|
+
# to set it using ::Gapic::CallOptions, it will not be applied
|
178
|
+
#
|
179
|
+
# @overload delete(machine_image: nil, project: nil, request_id: nil)
|
180
|
+
# Pass arguments to `delete` via keyword arguments. Note that at
|
181
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
182
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
183
|
+
#
|
184
|
+
# @param machine_image [::String]
|
185
|
+
# The name of the machine image to delete.
|
186
|
+
# @param project [::String]
|
187
|
+
# Project ID 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, response] Access the result along with the Faraday response object
|
191
|
+
# @yieldparam result [::Gapic::GenericLRO::Operation]
|
192
|
+
# @yieldparam response [::Faraday::Response]
|
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::DeleteMachineImageRequest
|
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 header
|
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
|
+
options.apply_defaults timeout: @config.rpcs.delete.timeout,
|
215
|
+
metadata: call_metadata
|
216
|
+
|
217
|
+
options.apply_defaults timeout: @config.timeout,
|
218
|
+
metadata: @config.metadata
|
219
|
+
|
220
|
+
@machine_images_stub.delete request, options do |result, response|
|
221
|
+
result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
|
222
|
+
operation: result,
|
223
|
+
client: global_operations,
|
224
|
+
request_values: {
|
225
|
+
"project" => request.project
|
226
|
+
},
|
227
|
+
options: options
|
228
|
+
)
|
229
|
+
yield result, response if block_given?
|
230
|
+
return result
|
231
|
+
end
|
232
|
+
rescue ::Faraday::Error => e
|
233
|
+
gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
|
234
|
+
raise ::Google::Cloud::Error.from_error(gapic_error)
|
235
|
+
end
|
236
|
+
|
237
|
+
##
|
238
|
+
# Returns the specified machine image. Gets a list of available machine images by making a list() request.
|
239
|
+
#
|
240
|
+
# @overload get(request, options = nil)
|
241
|
+
# Pass arguments to `get` via a request object, either of type
|
242
|
+
# {::Google::Cloud::Compute::V1::GetMachineImageRequest} or an equivalent Hash.
|
243
|
+
#
|
244
|
+
# @param request [::Google::Cloud::Compute::V1::GetMachineImageRequest, ::Hash]
|
245
|
+
# A request object representing the call parameters. Required. To specify no
|
246
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
247
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
248
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
249
|
+
# Note: currently retry functionality is not implemented. While it is possible
|
250
|
+
# to set it using ::Gapic::CallOptions, it will not be applied
|
251
|
+
#
|
252
|
+
# @overload get(machine_image: nil, project: nil)
|
253
|
+
# Pass arguments to `get` via keyword arguments. Note that at
|
254
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
255
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
256
|
+
#
|
257
|
+
# @param machine_image [::String]
|
258
|
+
# The name of the machine image.
|
259
|
+
# @param project [::String]
|
260
|
+
# Project ID for this request.
|
261
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
262
|
+
# @yieldparam result [::Google::Cloud::Compute::V1::MachineImage]
|
263
|
+
# @yieldparam response [::Faraday::Response]
|
264
|
+
#
|
265
|
+
# @return [::Google::Cloud::Compute::V1::MachineImage]
|
266
|
+
#
|
267
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
268
|
+
def get request, options = nil
|
269
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
270
|
+
|
271
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetMachineImageRequest
|
272
|
+
|
273
|
+
# Converts hash and nil to an options object
|
274
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
275
|
+
|
276
|
+
# Customize the options with defaults
|
277
|
+
call_metadata = @config.rpcs.get.metadata.to_h
|
278
|
+
|
279
|
+
# Set x-goog-api-client header
|
280
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
281
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
282
|
+
gapic_version: ::Google::Cloud::Compute::V1::VERSION,
|
283
|
+
transports_version_send: [:rest]
|
284
|
+
|
285
|
+
options.apply_defaults timeout: @config.rpcs.get.timeout,
|
286
|
+
metadata: call_metadata
|
287
|
+
|
288
|
+
options.apply_defaults timeout: @config.timeout,
|
289
|
+
metadata: @config.metadata
|
290
|
+
|
291
|
+
@machine_images_stub.get request, options do |result, response|
|
292
|
+
yield result, response if block_given?
|
293
|
+
return result
|
294
|
+
end
|
295
|
+
rescue ::Faraday::Error => e
|
296
|
+
gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
|
297
|
+
raise ::Google::Cloud::Error.from_error(gapic_error)
|
298
|
+
end
|
299
|
+
|
300
|
+
##
|
301
|
+
# Gets the access control policy for a resource. May be empty if no such policy or resource exists.
|
302
|
+
#
|
303
|
+
# @overload get_iam_policy(request, options = nil)
|
304
|
+
# Pass arguments to `get_iam_policy` via a request object, either of type
|
305
|
+
# {::Google::Cloud::Compute::V1::GetIamPolicyMachineImageRequest} or an equivalent Hash.
|
306
|
+
#
|
307
|
+
# @param request [::Google::Cloud::Compute::V1::GetIamPolicyMachineImageRequest, ::Hash]
|
308
|
+
# A request object representing the call parameters. Required. To specify no
|
309
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
310
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
311
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
312
|
+
# Note: currently retry functionality is not implemented. While it is possible
|
313
|
+
# to set it using ::Gapic::CallOptions, it will not be applied
|
314
|
+
#
|
315
|
+
# @overload get_iam_policy(options_requested_policy_version: nil, project: nil, resource: nil)
|
316
|
+
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
317
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
318
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
319
|
+
#
|
320
|
+
# @param options_requested_policy_version [::Integer]
|
321
|
+
# Requested IAM Policy version.
|
322
|
+
# @param project [::String]
|
323
|
+
# Project ID for this request.
|
324
|
+
# @param resource [::String]
|
325
|
+
# Name or id of the resource for this request.
|
326
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
327
|
+
# @yieldparam result [::Google::Cloud::Compute::V1::Policy]
|
328
|
+
# @yieldparam response [::Faraday::Response]
|
329
|
+
#
|
330
|
+
# @return [::Google::Cloud::Compute::V1::Policy]
|
331
|
+
#
|
332
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
333
|
+
def get_iam_policy request, options = nil
|
334
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
335
|
+
|
336
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetIamPolicyMachineImageRequest
|
337
|
+
|
338
|
+
# Converts hash and nil to an options object
|
339
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
340
|
+
|
341
|
+
# Customize the options with defaults
|
342
|
+
call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
343
|
+
|
344
|
+
# Set x-goog-api-client header
|
345
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
346
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
347
|
+
gapic_version: ::Google::Cloud::Compute::V1::VERSION,
|
348
|
+
transports_version_send: [:rest]
|
349
|
+
|
350
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
351
|
+
metadata: call_metadata
|
352
|
+
|
353
|
+
options.apply_defaults timeout: @config.timeout,
|
354
|
+
metadata: @config.metadata
|
355
|
+
|
356
|
+
@machine_images_stub.get_iam_policy request, options do |result, response|
|
357
|
+
yield result, response if block_given?
|
358
|
+
return result
|
359
|
+
end
|
360
|
+
rescue ::Faraday::Error => e
|
361
|
+
gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
|
362
|
+
raise ::Google::Cloud::Error.from_error(gapic_error)
|
363
|
+
end
|
364
|
+
|
365
|
+
##
|
366
|
+
# Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.
|
367
|
+
#
|
368
|
+
# @overload insert(request, options = nil)
|
369
|
+
# Pass arguments to `insert` via a request object, either of type
|
370
|
+
# {::Google::Cloud::Compute::V1::InsertMachineImageRequest} or an equivalent Hash.
|
371
|
+
#
|
372
|
+
# @param request [::Google::Cloud::Compute::V1::InsertMachineImageRequest, ::Hash]
|
373
|
+
# A request object representing the call parameters. Required. To specify no
|
374
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
375
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
376
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
377
|
+
# Note: currently retry functionality is not implemented. While it is possible
|
378
|
+
# to set it using ::Gapic::CallOptions, it will not be applied
|
379
|
+
#
|
380
|
+
# @overload insert(machine_image_resource: nil, project: nil, request_id: nil, source_instance: nil)
|
381
|
+
# Pass arguments to `insert` via keyword arguments. Note that at
|
382
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
383
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
384
|
+
#
|
385
|
+
# @param machine_image_resource [::Google::Cloud::Compute::V1::MachineImage, ::Hash]
|
386
|
+
# The body resource for this request
|
387
|
+
# @param project [::String]
|
388
|
+
# Project ID for this request.
|
389
|
+
# @param request_id [::String]
|
390
|
+
# 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).
|
391
|
+
# @param source_instance [::String]
|
392
|
+
# Required. Source instance that is used to create the machine image from.
|
393
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
394
|
+
# @yieldparam result [::Gapic::GenericLRO::Operation]
|
395
|
+
# @yieldparam response [::Faraday::Response]
|
396
|
+
#
|
397
|
+
# @return [::Gapic::GenericLRO::Operation]
|
398
|
+
#
|
399
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
400
|
+
def insert request, options = nil
|
401
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
402
|
+
|
403
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::InsertMachineImageRequest
|
404
|
+
|
405
|
+
# Converts hash and nil to an options object
|
406
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
407
|
+
|
408
|
+
# Customize the options with defaults
|
409
|
+
call_metadata = @config.rpcs.insert.metadata.to_h
|
410
|
+
|
411
|
+
# Set x-goog-api-client header
|
412
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
413
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
414
|
+
gapic_version: ::Google::Cloud::Compute::V1::VERSION,
|
415
|
+
transports_version_send: [:rest]
|
416
|
+
|
417
|
+
options.apply_defaults timeout: @config.rpcs.insert.timeout,
|
418
|
+
metadata: call_metadata
|
419
|
+
|
420
|
+
options.apply_defaults timeout: @config.timeout,
|
421
|
+
metadata: @config.metadata
|
422
|
+
|
423
|
+
@machine_images_stub.insert request, options do |result, response|
|
424
|
+
result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
|
425
|
+
operation: result,
|
426
|
+
client: global_operations,
|
427
|
+
request_values: {
|
428
|
+
"project" => request.project
|
429
|
+
},
|
430
|
+
options: options
|
431
|
+
)
|
432
|
+
yield result, response if block_given?
|
433
|
+
return result
|
434
|
+
end
|
435
|
+
rescue ::Faraday::Error => e
|
436
|
+
gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
|
437
|
+
raise ::Google::Cloud::Error.from_error(gapic_error)
|
438
|
+
end
|
439
|
+
|
440
|
+
##
|
441
|
+
# Retrieves a list of machine images that are contained within the specified project.
|
442
|
+
#
|
443
|
+
# @overload list(request, options = nil)
|
444
|
+
# Pass arguments to `list` via a request object, either of type
|
445
|
+
# {::Google::Cloud::Compute::V1::ListMachineImagesRequest} or an equivalent Hash.
|
446
|
+
#
|
447
|
+
# @param request [::Google::Cloud::Compute::V1::ListMachineImagesRequest, ::Hash]
|
448
|
+
# A request object representing the call parameters. Required. To specify no
|
449
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
450
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
451
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
452
|
+
# Note: currently retry functionality is not implemented. While it is possible
|
453
|
+
# to set it using ::Gapic::CallOptions, it will not be applied
|
454
|
+
#
|
455
|
+
# @overload list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil)
|
456
|
+
# Pass arguments to `list` via keyword arguments. Note that at
|
457
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
458
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
459
|
+
#
|
460
|
+
# @param filter [::String]
|
461
|
+
# A filter expression that filters resources listed in the response. The 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) ```
|
462
|
+
# @param max_results [::Integer]
|
463
|
+
# 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`)
|
464
|
+
# @param order_by [::String]
|
465
|
+
# 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.
|
466
|
+
# @param page_token [::String]
|
467
|
+
# Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
|
468
|
+
# @param project [::String]
|
469
|
+
# Project ID for this request.
|
470
|
+
# @param return_partial_success [::Boolean]
|
471
|
+
# Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
|
472
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
473
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::MachineImage>]
|
474
|
+
# @yieldparam response [::Faraday::Response]
|
475
|
+
#
|
476
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::MachineImage>]
|
477
|
+
#
|
478
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
479
|
+
def list request, options = nil
|
480
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
481
|
+
|
482
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListMachineImagesRequest
|
483
|
+
|
484
|
+
# Converts hash and nil to an options object
|
485
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
486
|
+
|
487
|
+
# Customize the options with defaults
|
488
|
+
call_metadata = @config.rpcs.list.metadata.to_h
|
489
|
+
|
490
|
+
# Set x-goog-api-client header
|
491
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
492
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
493
|
+
gapic_version: ::Google::Cloud::Compute::V1::VERSION,
|
494
|
+
transports_version_send: [:rest]
|
495
|
+
|
496
|
+
options.apply_defaults timeout: @config.rpcs.list.timeout,
|
497
|
+
metadata: call_metadata
|
498
|
+
|
499
|
+
options.apply_defaults timeout: @config.timeout,
|
500
|
+
metadata: @config.metadata
|
501
|
+
|
502
|
+
@machine_images_stub.list request, options do |result, response|
|
503
|
+
result = ::Gapic::Rest::PagedEnumerable.new @machine_images_stub, :list, "items", request, result, options
|
504
|
+
yield result, response if block_given?
|
505
|
+
return result
|
506
|
+
end
|
507
|
+
rescue ::Faraday::Error => e
|
508
|
+
gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
|
509
|
+
raise ::Google::Cloud::Error.from_error(gapic_error)
|
510
|
+
end
|
511
|
+
|
512
|
+
##
|
513
|
+
# Sets the access control policy on the specified resource. Replaces any existing policy.
|
514
|
+
#
|
515
|
+
# @overload set_iam_policy(request, options = nil)
|
516
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
517
|
+
# {::Google::Cloud::Compute::V1::SetIamPolicyMachineImageRequest} or an equivalent Hash.
|
518
|
+
#
|
519
|
+
# @param request [::Google::Cloud::Compute::V1::SetIamPolicyMachineImageRequest, ::Hash]
|
520
|
+
# A request object representing the call parameters. Required. To specify no
|
521
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
522
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
523
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
524
|
+
# Note: currently retry functionality is not implemented. While it is possible
|
525
|
+
# to set it using ::Gapic::CallOptions, it will not be applied
|
526
|
+
#
|
527
|
+
# @overload set_iam_policy(global_set_policy_request_resource: nil, project: nil, resource: nil)
|
528
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
529
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
530
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
531
|
+
#
|
532
|
+
# @param global_set_policy_request_resource [::Google::Cloud::Compute::V1::GlobalSetPolicyRequest, ::Hash]
|
533
|
+
# The body resource for this request
|
534
|
+
# @param project [::String]
|
535
|
+
# Project ID for this request.
|
536
|
+
# @param resource [::String]
|
537
|
+
# Name or id of the resource for this request.
|
538
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
539
|
+
# @yieldparam result [::Google::Cloud::Compute::V1::Policy]
|
540
|
+
# @yieldparam response [::Faraday::Response]
|
541
|
+
#
|
542
|
+
# @return [::Google::Cloud::Compute::V1::Policy]
|
543
|
+
#
|
544
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
545
|
+
def set_iam_policy request, options = nil
|
546
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
547
|
+
|
548
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetIamPolicyMachineImageRequest
|
549
|
+
|
550
|
+
# Converts hash and nil to an options object
|
551
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
552
|
+
|
553
|
+
# Customize the options with defaults
|
554
|
+
call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
555
|
+
|
556
|
+
# Set x-goog-api-client header
|
557
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
558
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
559
|
+
gapic_version: ::Google::Cloud::Compute::V1::VERSION,
|
560
|
+
transports_version_send: [:rest]
|
561
|
+
|
562
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
563
|
+
metadata: call_metadata
|
564
|
+
|
565
|
+
options.apply_defaults timeout: @config.timeout,
|
566
|
+
metadata: @config.metadata
|
567
|
+
|
568
|
+
@machine_images_stub.set_iam_policy request, options do |result, response|
|
569
|
+
yield result, response if block_given?
|
570
|
+
return result
|
571
|
+
end
|
572
|
+
rescue ::Faraday::Error => e
|
573
|
+
gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
|
574
|
+
raise ::Google::Cloud::Error.from_error(gapic_error)
|
575
|
+
end
|
576
|
+
|
577
|
+
##
|
578
|
+
# Returns permissions that a caller has on the specified resource.
|
579
|
+
#
|
580
|
+
# @overload test_iam_permissions(request, options = nil)
|
581
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
582
|
+
# {::Google::Cloud::Compute::V1::TestIamPermissionsMachineImageRequest} or an equivalent Hash.
|
583
|
+
#
|
584
|
+
# @param request [::Google::Cloud::Compute::V1::TestIamPermissionsMachineImageRequest, ::Hash]
|
585
|
+
# A request object representing the call parameters. Required. To specify no
|
586
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
587
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
588
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
589
|
+
# Note: currently retry functionality is not implemented. While it is possible
|
590
|
+
# to set it using ::Gapic::CallOptions, it will not be applied
|
591
|
+
#
|
592
|
+
# @overload test_iam_permissions(project: nil, resource: nil, test_permissions_request_resource: nil)
|
593
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
594
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
595
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
596
|
+
#
|
597
|
+
# @param project [::String]
|
598
|
+
# Project ID for this request.
|
599
|
+
# @param resource [::String]
|
600
|
+
# Name or id of the resource for this request.
|
601
|
+
# @param test_permissions_request_resource [::Google::Cloud::Compute::V1::TestPermissionsRequest, ::Hash]
|
602
|
+
# The body resource for this request
|
603
|
+
# @yield [result, response] Access the result along with the Faraday response object
|
604
|
+
# @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
|
605
|
+
# @yieldparam response [::Faraday::Response]
|
606
|
+
#
|
607
|
+
# @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
|
608
|
+
#
|
609
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
610
|
+
def test_iam_permissions request, options = nil
|
611
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
612
|
+
|
613
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::TestIamPermissionsMachineImageRequest
|
614
|
+
|
615
|
+
# Converts hash and nil to an options object
|
616
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
617
|
+
|
618
|
+
# Customize the options with defaults
|
619
|
+
call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
620
|
+
|
621
|
+
# Set x-goog-api-client header
|
622
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
623
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
624
|
+
gapic_version: ::Google::Cloud::Compute::V1::VERSION,
|
625
|
+
transports_version_send: [:rest]
|
626
|
+
|
627
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
628
|
+
metadata: call_metadata
|
629
|
+
|
630
|
+
options.apply_defaults timeout: @config.timeout,
|
631
|
+
metadata: @config.metadata
|
632
|
+
|
633
|
+
@machine_images_stub.test_iam_permissions request, options do |result, response|
|
634
|
+
yield result, response if block_given?
|
635
|
+
return result
|
636
|
+
end
|
637
|
+
rescue ::Faraday::Error => e
|
638
|
+
gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
|
639
|
+
raise ::Google::Cloud::Error.from_error(gapic_error)
|
640
|
+
end
|
641
|
+
|
642
|
+
##
|
643
|
+
# Configuration class for the MachineImages REST API.
|
644
|
+
#
|
645
|
+
# This class represents the configuration for MachineImages REST,
|
646
|
+
# providing control over credentials, timeouts, retry behavior, logging.
|
647
|
+
#
|
648
|
+
# Configuration can be applied globally to all clients, or to a single client
|
649
|
+
# on construction.
|
650
|
+
#
|
651
|
+
# # Examples
|
652
|
+
#
|
653
|
+
# To modify the global config, setting the timeout for all calls to 10 seconds:
|
654
|
+
#
|
655
|
+
# ::Google::Cloud::Compute::V1::MachineImages::Client.configure do |config|
|
656
|
+
# config.timeout = 10.0
|
657
|
+
# end
|
658
|
+
#
|
659
|
+
# To apply the above configuration only to a new client:
|
660
|
+
#
|
661
|
+
# client = ::Google::Cloud::Compute::V1::MachineImages::Client.new do |config|
|
662
|
+
# config.timeout = 10.0
|
663
|
+
# end
|
664
|
+
#
|
665
|
+
# @!attribute [rw] endpoint
|
666
|
+
# The hostname or hostname:port of the service endpoint.
|
667
|
+
# Defaults to `"compute.googleapis.com"`.
|
668
|
+
# @return [::String]
|
669
|
+
# @!attribute [rw] credentials
|
670
|
+
# Credentials to send with calls. You may provide any of the following types:
|
671
|
+
# * (`String`) The path to a service account key file in JSON format
|
672
|
+
# * (`Hash`) A service account key as a Hash
|
673
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
674
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
675
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
676
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
677
|
+
# * (`nil`) indicating no credentials
|
678
|
+
# @return [::Object]
|
679
|
+
# @!attribute [rw] scope
|
680
|
+
# The OAuth scopes
|
681
|
+
# @return [::Array<::String>]
|
682
|
+
# @!attribute [rw] lib_name
|
683
|
+
# The library name as recorded in instrumentation and logging
|
684
|
+
# @return [::String]
|
685
|
+
# @!attribute [rw] lib_version
|
686
|
+
# The library version as recorded in instrumentation and logging
|
687
|
+
# @return [::String]
|
688
|
+
# @!attribute [rw] timeout
|
689
|
+
# The call timeout in seconds.
|
690
|
+
# @return [::Numeric]
|
691
|
+
# @!attribute [rw] metadata
|
692
|
+
# Additional REST headers to be sent with the call.
|
693
|
+
# @return [::Hash{::Symbol=>::String}]
|
694
|
+
#
|
695
|
+
class Configuration
|
696
|
+
extend ::Gapic::Config
|
697
|
+
|
698
|
+
config_attr :endpoint, "compute.googleapis.com", ::String
|
699
|
+
config_attr :credentials, nil do |value|
|
700
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
701
|
+
allowed.any? { |klass| klass === value }
|
702
|
+
end
|
703
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
704
|
+
config_attr :lib_name, nil, ::String, nil
|
705
|
+
config_attr :lib_version, nil, ::String, nil
|
706
|
+
config_attr :timeout, nil, ::Numeric, nil
|
707
|
+
config_attr :metadata, nil, ::Hash, nil
|
708
|
+
|
709
|
+
# @private
|
710
|
+
def initialize parent_config = nil
|
711
|
+
@parent_config = parent_config unless parent_config.nil?
|
712
|
+
|
713
|
+
yield self if block_given?
|
714
|
+
end
|
715
|
+
|
716
|
+
##
|
717
|
+
# Configurations for individual RPCs
|
718
|
+
# @return [Rpcs]
|
719
|
+
#
|
720
|
+
def rpcs
|
721
|
+
@rpcs ||= begin
|
722
|
+
parent_rpcs = nil
|
723
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
724
|
+
Rpcs.new parent_rpcs
|
725
|
+
end
|
726
|
+
end
|
727
|
+
|
728
|
+
##
|
729
|
+
# Configuration RPC class for the MachineImages API.
|
730
|
+
#
|
731
|
+
# Includes fields providing the configuration for each RPC in this service.
|
732
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
733
|
+
# the following configuration fields:
|
734
|
+
#
|
735
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
736
|
+
#
|
737
|
+
# there is one other field (`retry_policy`) that can be set
|
738
|
+
# but is currently not supported for REST Gapic libraries.
|
739
|
+
#
|
740
|
+
class Rpcs
|
741
|
+
##
|
742
|
+
# RPC-specific configuration for `delete`
|
743
|
+
# @return [::Gapic::Config::Method]
|
744
|
+
#
|
745
|
+
attr_reader :delete
|
746
|
+
##
|
747
|
+
# RPC-specific configuration for `get`
|
748
|
+
# @return [::Gapic::Config::Method]
|
749
|
+
#
|
750
|
+
attr_reader :get
|
751
|
+
##
|
752
|
+
# RPC-specific configuration for `get_iam_policy`
|
753
|
+
# @return [::Gapic::Config::Method]
|
754
|
+
#
|
755
|
+
attr_reader :get_iam_policy
|
756
|
+
##
|
757
|
+
# RPC-specific configuration for `insert`
|
758
|
+
# @return [::Gapic::Config::Method]
|
759
|
+
#
|
760
|
+
attr_reader :insert
|
761
|
+
##
|
762
|
+
# RPC-specific configuration for `list`
|
763
|
+
# @return [::Gapic::Config::Method]
|
764
|
+
#
|
765
|
+
attr_reader :list
|
766
|
+
##
|
767
|
+
# RPC-specific configuration for `set_iam_policy`
|
768
|
+
# @return [::Gapic::Config::Method]
|
769
|
+
#
|
770
|
+
attr_reader :set_iam_policy
|
771
|
+
##
|
772
|
+
# RPC-specific configuration for `test_iam_permissions`
|
773
|
+
# @return [::Gapic::Config::Method]
|
774
|
+
#
|
775
|
+
attr_reader :test_iam_permissions
|
776
|
+
|
777
|
+
# @private
|
778
|
+
def initialize parent_rpcs = nil
|
779
|
+
delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete
|
780
|
+
@delete = ::Gapic::Config::Method.new delete_config
|
781
|
+
get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
|
782
|
+
@get = ::Gapic::Config::Method.new get_config
|
783
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
784
|
+
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
785
|
+
insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert
|
786
|
+
@insert = ::Gapic::Config::Method.new insert_config
|
787
|
+
list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
|
788
|
+
@list = ::Gapic::Config::Method.new list_config
|
789
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
790
|
+
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
791
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
792
|
+
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
793
|
+
|
794
|
+
yield self if block_given?
|
795
|
+
end
|
796
|
+
end
|
797
|
+
end
|
798
|
+
end
|
799
|
+
end
|
800
|
+
end
|
801
|
+
end
|
802
|
+
end
|
803
|
+
end
|
804
|
+
end
|