google-iam-v1beta 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +75 -0
- data/lib/google-iam-v1beta.rb +21 -0
- data/lib/google/iam/v1beta.rb +33 -0
- data/lib/google/iam/v1beta/version.rb +26 -0
- data/lib/google/iam/v1beta/workload_identity_pool_pb.rb +141 -0
- data/lib/google/iam/v1beta/workload_identity_pool_services_pb.rb +103 -0
- data/lib/google/iam/v1beta/workload_identity_pools.rb +48 -0
- data/lib/google/iam/v1beta/workload_identity_pools/client.rb +1364 -0
- data/lib/google/iam/v1beta/workload_identity_pools/credentials.rb +49 -0
- data/lib/google/iam/v1beta/workload_identity_pools/operations.rb +568 -0
- data/lib/google/iam/v1beta/workload_identity_pools/paths.rb +71 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/iam/v1beta/workload_identity_pool.rb +463 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +205 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Iam
|
23
|
+
module V1beta
|
24
|
+
module WorkloadIdentityPools
|
25
|
+
# Credentials for the WorkloadIdentityPools API.
|
26
|
+
class Credentials < ::Google::Auth::Credentials
|
27
|
+
self.scope = [
|
28
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
29
|
+
]
|
30
|
+
self.env_vars = [
|
31
|
+
"IAM_CREDENTIALS",
|
32
|
+
"IAM_KEYFILE",
|
33
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
34
|
+
"GOOGLE_CLOUD_KEYFILE",
|
35
|
+
"GCLOUD_KEYFILE",
|
36
|
+
"IAM_CREDENTIALS_JSON",
|
37
|
+
"IAM_KEYFILE_JSON",
|
38
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
39
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
40
|
+
"GCLOUD_KEYFILE_JSON"
|
41
|
+
]
|
42
|
+
self.paths = [
|
43
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
44
|
+
]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,568 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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 "gapic/operation"
|
20
|
+
require "google/longrunning/operations_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Iam
|
24
|
+
module V1beta
|
25
|
+
module WorkloadIdentityPools
|
26
|
+
# Service that implements Longrunning Operations API.
|
27
|
+
class Operations
|
28
|
+
# @private
|
29
|
+
attr_reader :operations_stub
|
30
|
+
|
31
|
+
##
|
32
|
+
# Configuration for the WorkloadIdentityPools Operations API.
|
33
|
+
#
|
34
|
+
# @yield [config] Configure the Operations client.
|
35
|
+
# @yieldparam config [Operations::Configuration]
|
36
|
+
#
|
37
|
+
# @return [Operations::Configuration]
|
38
|
+
#
|
39
|
+
def self.configure
|
40
|
+
@configure ||= Operations::Configuration.new
|
41
|
+
yield @configure if block_given?
|
42
|
+
@configure
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Configure the WorkloadIdentityPools Operations instance.
|
47
|
+
#
|
48
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
49
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
50
|
+
# should be made on {Operations.configure}.
|
51
|
+
#
|
52
|
+
# @yield [config] Configure the Operations client.
|
53
|
+
# @yieldparam config [Operations::Configuration]
|
54
|
+
#
|
55
|
+
# @return [Operations::Configuration]
|
56
|
+
#
|
57
|
+
def configure
|
58
|
+
yield @config if block_given?
|
59
|
+
@config
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# Create a new Operations client object.
|
64
|
+
#
|
65
|
+
# @yield [config] Configure the Client client.
|
66
|
+
# @yieldparam config [Operations::Configuration]
|
67
|
+
#
|
68
|
+
def initialize
|
69
|
+
# These require statements are intentionally placed here to initialize
|
70
|
+
# the gRPC module only when it's required.
|
71
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
72
|
+
require "gapic/grpc"
|
73
|
+
require "google/longrunning/operations_services_pb"
|
74
|
+
|
75
|
+
# Create the configuration object
|
76
|
+
@config = Configuration.new Operations.configure
|
77
|
+
|
78
|
+
# Yield the configuration if needed
|
79
|
+
yield @config if block_given?
|
80
|
+
|
81
|
+
# Create credentials
|
82
|
+
credentials = @config.credentials
|
83
|
+
credentials ||= Credentials.default scope: @config.scope
|
84
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
85
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
86
|
+
end
|
87
|
+
@quota_project_id = @config.quota_project
|
88
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
89
|
+
|
90
|
+
@operations_stub = ::Gapic::ServiceStub.new(
|
91
|
+
::Google::Longrunning::Operations::Stub,
|
92
|
+
credentials: credentials,
|
93
|
+
endpoint: @config.endpoint,
|
94
|
+
channel_args: @config.channel_args,
|
95
|
+
interceptors: @config.interceptors
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Service calls
|
100
|
+
|
101
|
+
##
|
102
|
+
# Lists operations that match the specified filter in the request. If the
|
103
|
+
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
104
|
+
#
|
105
|
+
# NOTE: the `name` binding below allows API services to override the binding
|
106
|
+
# to use different resource name schemes, such as `users/*/operations`.
|
107
|
+
#
|
108
|
+
# @overload list_operations(request, options = nil)
|
109
|
+
# Pass arguments to `list_operations` via a request object, either of type
|
110
|
+
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
111
|
+
#
|
112
|
+
# @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
|
113
|
+
# A request object representing the call parameters. Required. To specify no
|
114
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
115
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
116
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
117
|
+
#
|
118
|
+
# @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
|
119
|
+
# Pass arguments to `list_operations` via keyword arguments. Note that at
|
120
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
121
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
122
|
+
#
|
123
|
+
# @param name [::String]
|
124
|
+
# The name of the operation collection.
|
125
|
+
# @param filter [::String]
|
126
|
+
# The standard list filter.
|
127
|
+
# @param page_size [::Integer]
|
128
|
+
# The standard list page size.
|
129
|
+
# @param page_token [::String]
|
130
|
+
# The standard list page token.
|
131
|
+
#
|
132
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
133
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
|
134
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
135
|
+
#
|
136
|
+
# @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
|
137
|
+
#
|
138
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
139
|
+
#
|
140
|
+
def list_operations request, options = nil
|
141
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
142
|
+
|
143
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
|
144
|
+
|
145
|
+
# Converts hash and nil to an options object
|
146
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
147
|
+
|
148
|
+
# Customize the options with defaults
|
149
|
+
metadata = @config.rpcs.list_operations.metadata.to_h
|
150
|
+
|
151
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
152
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
153
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
154
|
+
gapic_version: ::Google::Iam::V1beta::VERSION
|
155
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
156
|
+
|
157
|
+
header_params = {
|
158
|
+
"name" => request.name
|
159
|
+
}
|
160
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
161
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
162
|
+
|
163
|
+
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
164
|
+
metadata: metadata,
|
165
|
+
retry_policy: @config.rpcs.list_operations.retry_policy
|
166
|
+
options.apply_defaults metadata: @config.metadata,
|
167
|
+
retry_policy: @config.retry_policy
|
168
|
+
|
169
|
+
@operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
|
170
|
+
wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
|
171
|
+
response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
172
|
+
yield response, operation if block_given?
|
173
|
+
return response
|
174
|
+
end
|
175
|
+
rescue ::GRPC::BadStatus => e
|
176
|
+
raise ::Google::Cloud::Error.from_error(e)
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# Gets the latest state of a long-running operation. Clients can use this
|
181
|
+
# method to poll the operation result at intervals as recommended by the API
|
182
|
+
# service.
|
183
|
+
#
|
184
|
+
# @overload get_operation(request, options = nil)
|
185
|
+
# Pass arguments to `get_operation` via a request object, either of type
|
186
|
+
# {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
|
187
|
+
#
|
188
|
+
# @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
|
189
|
+
# A request object representing the call parameters. Required. To specify no
|
190
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
191
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
192
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
193
|
+
#
|
194
|
+
# @overload get_operation(name: nil)
|
195
|
+
# Pass arguments to `get_operation` via keyword arguments. Note that at
|
196
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
197
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
198
|
+
#
|
199
|
+
# @param name [::String]
|
200
|
+
# The name of the operation resource.
|
201
|
+
#
|
202
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
203
|
+
# @yieldparam response [::Gapic::Operation]
|
204
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
205
|
+
#
|
206
|
+
# @return [::Gapic::Operation]
|
207
|
+
#
|
208
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
209
|
+
#
|
210
|
+
def get_operation request, options = nil
|
211
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
212
|
+
|
213
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
|
214
|
+
|
215
|
+
# Converts hash and nil to an options object
|
216
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
217
|
+
|
218
|
+
# Customize the options with defaults
|
219
|
+
metadata = @config.rpcs.get_operation.metadata.to_h
|
220
|
+
|
221
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
222
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
223
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
224
|
+
gapic_version: ::Google::Iam::V1beta::VERSION
|
225
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
226
|
+
|
227
|
+
header_params = {
|
228
|
+
"name" => request.name
|
229
|
+
}
|
230
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
231
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
232
|
+
|
233
|
+
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
234
|
+
metadata: metadata,
|
235
|
+
retry_policy: @config.rpcs.get_operation.retry_policy
|
236
|
+
options.apply_defaults metadata: @config.metadata,
|
237
|
+
retry_policy: @config.retry_policy
|
238
|
+
|
239
|
+
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
240
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
241
|
+
yield response, operation if block_given?
|
242
|
+
return response
|
243
|
+
end
|
244
|
+
rescue ::GRPC::BadStatus => e
|
245
|
+
raise ::Google::Cloud::Error.from_error(e)
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# Deletes a long-running operation. This method indicates that the client is
|
250
|
+
# no longer interested in the operation result. It does not cancel the
|
251
|
+
# operation. If the server doesn't support this method, it returns
|
252
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
253
|
+
#
|
254
|
+
# @overload delete_operation(request, options = nil)
|
255
|
+
# Pass arguments to `delete_operation` via a request object, either of type
|
256
|
+
# {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
|
257
|
+
#
|
258
|
+
# @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
|
259
|
+
# A request object representing the call parameters. Required. To specify no
|
260
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
261
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
262
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
263
|
+
#
|
264
|
+
# @overload delete_operation(name: nil)
|
265
|
+
# Pass arguments to `delete_operation` via keyword arguments. Note that at
|
266
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
267
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
268
|
+
#
|
269
|
+
# @param name [::String]
|
270
|
+
# The name of the operation resource to be deleted.
|
271
|
+
#
|
272
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
273
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
274
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
275
|
+
#
|
276
|
+
# @return [::Google::Protobuf::Empty]
|
277
|
+
#
|
278
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
279
|
+
#
|
280
|
+
def delete_operation request, options = nil
|
281
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
282
|
+
|
283
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
|
284
|
+
|
285
|
+
# Converts hash and nil to an options object
|
286
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
287
|
+
|
288
|
+
# Customize the options with defaults
|
289
|
+
metadata = @config.rpcs.delete_operation.metadata.to_h
|
290
|
+
|
291
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
292
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
293
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
294
|
+
gapic_version: ::Google::Iam::V1beta::VERSION
|
295
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
296
|
+
|
297
|
+
header_params = {
|
298
|
+
"name" => request.name
|
299
|
+
}
|
300
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
301
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
302
|
+
|
303
|
+
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
304
|
+
metadata: metadata,
|
305
|
+
retry_policy: @config.rpcs.delete_operation.retry_policy
|
306
|
+
options.apply_defaults metadata: @config.metadata,
|
307
|
+
retry_policy: @config.retry_policy
|
308
|
+
|
309
|
+
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
310
|
+
yield response, operation if block_given?
|
311
|
+
return response
|
312
|
+
end
|
313
|
+
rescue ::GRPC::BadStatus => e
|
314
|
+
raise ::Google::Cloud::Error.from_error(e)
|
315
|
+
end
|
316
|
+
|
317
|
+
##
|
318
|
+
# Starts asynchronous cancellation on a long-running operation. The server
|
319
|
+
# makes a best effort to cancel the operation, but success is not
|
320
|
+
# guaranteed. If the server doesn't support this method, it returns
|
321
|
+
# `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
322
|
+
# Operations.GetOperation or
|
323
|
+
# other methods to check whether the cancellation succeeded or whether the
|
324
|
+
# operation completed despite cancellation. On successful cancellation,
|
325
|
+
# the operation is not deleted; instead, it becomes an operation with
|
326
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
|
327
|
+
# corresponding to `Code.CANCELLED`.
|
328
|
+
#
|
329
|
+
# @overload cancel_operation(request, options = nil)
|
330
|
+
# Pass arguments to `cancel_operation` via a request object, either of type
|
331
|
+
# {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
|
332
|
+
#
|
333
|
+
# @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
|
334
|
+
# A request object representing the call parameters. Required. To specify no
|
335
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
336
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
337
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
338
|
+
#
|
339
|
+
# @overload cancel_operation(name: nil)
|
340
|
+
# Pass arguments to `cancel_operation` via keyword arguments. Note that at
|
341
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
342
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
343
|
+
#
|
344
|
+
# @param name [::String]
|
345
|
+
# The name of the operation resource to be cancelled.
|
346
|
+
#
|
347
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
348
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
349
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
350
|
+
#
|
351
|
+
# @return [::Google::Protobuf::Empty]
|
352
|
+
#
|
353
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
354
|
+
#
|
355
|
+
def cancel_operation request, options = nil
|
356
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
357
|
+
|
358
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
|
359
|
+
|
360
|
+
# Converts hash and nil to an options object
|
361
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
362
|
+
|
363
|
+
# Customize the options with defaults
|
364
|
+
metadata = @config.rpcs.cancel_operation.metadata.to_h
|
365
|
+
|
366
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
367
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
368
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
369
|
+
gapic_version: ::Google::Iam::V1beta::VERSION
|
370
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
371
|
+
|
372
|
+
header_params = {
|
373
|
+
"name" => request.name
|
374
|
+
}
|
375
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
376
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
377
|
+
|
378
|
+
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
379
|
+
metadata: metadata,
|
380
|
+
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
381
|
+
options.apply_defaults metadata: @config.metadata,
|
382
|
+
retry_policy: @config.retry_policy
|
383
|
+
|
384
|
+
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
385
|
+
yield response, operation if block_given?
|
386
|
+
return response
|
387
|
+
end
|
388
|
+
rescue ::GRPC::BadStatus => e
|
389
|
+
raise ::Google::Cloud::Error.from_error(e)
|
390
|
+
end
|
391
|
+
|
392
|
+
##
|
393
|
+
# Configuration class for the Operations API.
|
394
|
+
#
|
395
|
+
# This class represents the configuration for Operations,
|
396
|
+
# providing control over timeouts, retry behavior, logging, transport
|
397
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
398
|
+
# applied individually to specific RPCs. See
|
399
|
+
# {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
|
400
|
+
# for a list of RPCs that can be configured independently.
|
401
|
+
#
|
402
|
+
# Configuration can be applied globally to all clients, or to a single client
|
403
|
+
# on construction.
|
404
|
+
#
|
405
|
+
# # Examples
|
406
|
+
#
|
407
|
+
# To modify the global config, setting the timeout for list_operations
|
408
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
409
|
+
#
|
410
|
+
# ::Google::Longrunning::Operations::Client.configure do |config|
|
411
|
+
# config.timeout = 10.0
|
412
|
+
# config.rpcs.list_operations.timeout = 20.0
|
413
|
+
# end
|
414
|
+
#
|
415
|
+
# To apply the above configuration only to a new client:
|
416
|
+
#
|
417
|
+
# client = ::Google::Longrunning::Operations::Client.new do |config|
|
418
|
+
# config.timeout = 10.0
|
419
|
+
# config.rpcs.list_operations.timeout = 20.0
|
420
|
+
# end
|
421
|
+
#
|
422
|
+
# @!attribute [rw] endpoint
|
423
|
+
# The hostname or hostname:port of the service endpoint.
|
424
|
+
# Defaults to `"iam.googleapis.com"`.
|
425
|
+
# @return [::String]
|
426
|
+
# @!attribute [rw] credentials
|
427
|
+
# Credentials to send with calls. You may provide any of the following types:
|
428
|
+
# * (`String`) The path to a service account key file in JSON format
|
429
|
+
# * (`Hash`) A service account key as a Hash
|
430
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
431
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
432
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
433
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
434
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
435
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
436
|
+
# * (`nil`) indicating no credentials
|
437
|
+
# @return [::Object]
|
438
|
+
# @!attribute [rw] scope
|
439
|
+
# The OAuth scopes
|
440
|
+
# @return [::Array<::String>]
|
441
|
+
# @!attribute [rw] lib_name
|
442
|
+
# The library name as recorded in instrumentation and logging
|
443
|
+
# @return [::String]
|
444
|
+
# @!attribute [rw] lib_version
|
445
|
+
# The library version as recorded in instrumentation and logging
|
446
|
+
# @return [::String]
|
447
|
+
# @!attribute [rw] channel_args
|
448
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
449
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
450
|
+
# @return [::Hash]
|
451
|
+
# @!attribute [rw] interceptors
|
452
|
+
# An array of interceptors that are run before calls are executed.
|
453
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
454
|
+
# @!attribute [rw] timeout
|
455
|
+
# The call timeout in seconds.
|
456
|
+
# @return [::Numeric]
|
457
|
+
# @!attribute [rw] metadata
|
458
|
+
# Additional gRPC headers to be sent with the call.
|
459
|
+
# @return [::Hash{::Symbol=>::String}]
|
460
|
+
# @!attribute [rw] retry_policy
|
461
|
+
# The retry policy. The value is a hash with the following keys:
|
462
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
463
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
464
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
465
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
466
|
+
# trigger a retry.
|
467
|
+
# @return [::Hash]
|
468
|
+
# @!attribute [rw] quota_project
|
469
|
+
# A separate project against which to charge quota.
|
470
|
+
# @return [::String]
|
471
|
+
#
|
472
|
+
class Configuration
|
473
|
+
extend ::Gapic::Config
|
474
|
+
|
475
|
+
config_attr :endpoint, "iam.googleapis.com", ::String
|
476
|
+
config_attr :credentials, nil do |value|
|
477
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
478
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
479
|
+
allowed.any? { |klass| klass === value }
|
480
|
+
end
|
481
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
482
|
+
config_attr :lib_name, nil, ::String, nil
|
483
|
+
config_attr :lib_version, nil, ::String, nil
|
484
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
485
|
+
config_attr :interceptors, nil, ::Array, nil
|
486
|
+
config_attr :timeout, nil, ::Numeric, nil
|
487
|
+
config_attr :metadata, nil, ::Hash, nil
|
488
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
489
|
+
config_attr :quota_project, nil, ::String, nil
|
490
|
+
|
491
|
+
# @private
|
492
|
+
def initialize parent_config = nil
|
493
|
+
@parent_config = parent_config unless parent_config.nil?
|
494
|
+
|
495
|
+
yield self if block_given?
|
496
|
+
end
|
497
|
+
|
498
|
+
##
|
499
|
+
# Configurations for individual RPCs
|
500
|
+
# @return [Rpcs]
|
501
|
+
#
|
502
|
+
def rpcs
|
503
|
+
@rpcs ||= begin
|
504
|
+
parent_rpcs = nil
|
505
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
506
|
+
Rpcs.new parent_rpcs
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
##
|
511
|
+
# Configuration RPC class for the Operations API.
|
512
|
+
#
|
513
|
+
# Includes fields providing the configuration for each RPC in this service.
|
514
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
515
|
+
# the following configuration fields:
|
516
|
+
#
|
517
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
518
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
519
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
520
|
+
# include the following keys:
|
521
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
522
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
523
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
524
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
525
|
+
# trigger a retry.
|
526
|
+
#
|
527
|
+
class Rpcs
|
528
|
+
##
|
529
|
+
# RPC-specific configuration for `list_operations`
|
530
|
+
# @return [::Gapic::Config::Method]
|
531
|
+
#
|
532
|
+
attr_reader :list_operations
|
533
|
+
##
|
534
|
+
# RPC-specific configuration for `get_operation`
|
535
|
+
# @return [::Gapic::Config::Method]
|
536
|
+
#
|
537
|
+
attr_reader :get_operation
|
538
|
+
##
|
539
|
+
# RPC-specific configuration for `delete_operation`
|
540
|
+
# @return [::Gapic::Config::Method]
|
541
|
+
#
|
542
|
+
attr_reader :delete_operation
|
543
|
+
##
|
544
|
+
# RPC-specific configuration for `cancel_operation`
|
545
|
+
# @return [::Gapic::Config::Method]
|
546
|
+
#
|
547
|
+
attr_reader :cancel_operation
|
548
|
+
|
549
|
+
# @private
|
550
|
+
def initialize parent_rpcs = nil
|
551
|
+
list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
|
552
|
+
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
553
|
+
get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
|
554
|
+
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
555
|
+
delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
|
556
|
+
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
557
|
+
cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
|
558
|
+
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
559
|
+
|
560
|
+
yield self if block_given?
|
561
|
+
end
|
562
|
+
end
|
563
|
+
end
|
564
|
+
end
|
565
|
+
end
|
566
|
+
end
|
567
|
+
end
|
568
|
+
end
|