google-cloud-storage-control-v2 0.a → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/cloud/storage/control/v2/storage_control/client.rb +1480 -0
- data/lib/google/cloud/storage/control/v2/storage_control/credentials.rb +53 -0
- data/lib/google/cloud/storage/control/v2/storage_control/operations.rb +803 -0
- data/lib/google/cloud/storage/control/v2/storage_control/paths.rb +107 -0
- data/lib/google/cloud/storage/control/v2/storage_control.rb +52 -0
- data/lib/google/cloud/storage/control/v2/version.rb +7 -2
- data/lib/google/cloud/storage/control/v2.rb +42 -0
- data/lib/google/storage/control/v2/storage_control_pb.rb +73 -0
- data/lib/google/storage/control/v2/storage_control_services_pb.rb +77 -0
- data/lib/google-cloud-storage-control-v2.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +399 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/field_info.rb +65 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/api/routing.rb +459 -0
- data/proto_docs/google/longrunning/operations.rb +164 -0
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- data/proto_docs/google/storage/control/v2/storage_control.rb +474 -0
- metadata +77 -10
@@ -0,0 +1,1480 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/storage/control/v2/storage_control_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Storage
|
25
|
+
module Control
|
26
|
+
module V2
|
27
|
+
module StorageControl
|
28
|
+
##
|
29
|
+
# Client for the StorageControl service.
|
30
|
+
#
|
31
|
+
# StorageControl service includes selected control plane operations.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
# @private
|
35
|
+
DEFAULT_ENDPOINT_TEMPLATE = "storage.$UNIVERSE_DOMAIN$"
|
36
|
+
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :storage_control_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the StorageControl Client class.
|
44
|
+
#
|
45
|
+
# See {::Google::Cloud::Storage::Control::V2::StorageControl::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# # Modify the configuration for all StorageControl clients
|
51
|
+
# ::Google::Cloud::Storage::Control::V2::StorageControl::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Cloud", "Storage", "Control", "V2"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.timeout = 60.0
|
72
|
+
|
73
|
+
default_config.rpcs.get_folder.timeout = 60.0
|
74
|
+
default_config.rpcs.get_folder.retry_policy = {
|
75
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
|
76
|
+
}
|
77
|
+
|
78
|
+
default_config.rpcs.list_folders.timeout = 60.0
|
79
|
+
default_config.rpcs.list_folders.retry_policy = {
|
80
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
|
81
|
+
}
|
82
|
+
|
83
|
+
default_config.rpcs.rename_folder.timeout = 60.0
|
84
|
+
default_config.rpcs.rename_folder.retry_policy = {
|
85
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
|
86
|
+
}
|
87
|
+
|
88
|
+
default_config.rpcs.get_storage_layout.timeout = 60.0
|
89
|
+
default_config.rpcs.get_storage_layout.retry_policy = {
|
90
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
|
91
|
+
}
|
92
|
+
|
93
|
+
default_config.rpcs.get_managed_folder.timeout = 60.0
|
94
|
+
default_config.rpcs.get_managed_folder.retry_policy = {
|
95
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
|
96
|
+
}
|
97
|
+
|
98
|
+
default_config.rpcs.list_managed_folders.timeout = 60.0
|
99
|
+
default_config.rpcs.list_managed_folders.retry_policy = {
|
100
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
|
101
|
+
}
|
102
|
+
|
103
|
+
default_config
|
104
|
+
end
|
105
|
+
yield @configure if block_given?
|
106
|
+
@configure
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Configure the StorageControl Client instance.
|
111
|
+
#
|
112
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
113
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
114
|
+
# should be made on {Client.configure}.
|
115
|
+
#
|
116
|
+
# See {::Google::Cloud::Storage::Control::V2::StorageControl::Client::Configuration}
|
117
|
+
# for a description of the configuration fields.
|
118
|
+
#
|
119
|
+
# @yield [config] Configure the Client client.
|
120
|
+
# @yieldparam config [Client::Configuration]
|
121
|
+
#
|
122
|
+
# @return [Client::Configuration]
|
123
|
+
#
|
124
|
+
def configure
|
125
|
+
yield @config if block_given?
|
126
|
+
@config
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# The effective universe domain
|
131
|
+
#
|
132
|
+
# @return [String]
|
133
|
+
#
|
134
|
+
def universe_domain
|
135
|
+
@storage_control_stub.universe_domain
|
136
|
+
end
|
137
|
+
|
138
|
+
##
|
139
|
+
# Create a new StorageControl client object.
|
140
|
+
#
|
141
|
+
# @example
|
142
|
+
#
|
143
|
+
# # Create a client using the default configuration
|
144
|
+
# client = ::Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
145
|
+
#
|
146
|
+
# # Create a client using a custom configuration
|
147
|
+
# client = ::Google::Cloud::Storage::Control::V2::StorageControl::Client.new do |config|
|
148
|
+
# config.timeout = 10.0
|
149
|
+
# end
|
150
|
+
#
|
151
|
+
# @yield [config] Configure the StorageControl client.
|
152
|
+
# @yieldparam config [Client::Configuration]
|
153
|
+
#
|
154
|
+
def initialize
|
155
|
+
# These require statements are intentionally placed here to initialize
|
156
|
+
# the gRPC module only when it's required.
|
157
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
158
|
+
require "gapic/grpc"
|
159
|
+
require "google/storage/control/v2/storage_control_services_pb"
|
160
|
+
|
161
|
+
# Create the configuration object
|
162
|
+
@config = Configuration.new Client.configure
|
163
|
+
|
164
|
+
# Yield the configuration if needed
|
165
|
+
yield @config if block_given?
|
166
|
+
|
167
|
+
# Create credentials
|
168
|
+
credentials = @config.credentials
|
169
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
170
|
+
# but only if the default endpoint does not have a region prefix.
|
171
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
172
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
173
|
+
!@config.endpoint.split(".").first.include?("-"))
|
174
|
+
credentials ||= Credentials.default scope: @config.scope,
|
175
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
176
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
177
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
178
|
+
end
|
179
|
+
@quota_project_id = @config.quota_project
|
180
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
181
|
+
|
182
|
+
@operations_client = Operations.new do |config|
|
183
|
+
config.credentials = credentials
|
184
|
+
config.quota_project = @quota_project_id
|
185
|
+
config.endpoint = @config.endpoint
|
186
|
+
config.universe_domain = @config.universe_domain
|
187
|
+
end
|
188
|
+
|
189
|
+
@storage_control_stub = ::Gapic::ServiceStub.new(
|
190
|
+
::Google::Cloud::Storage::Control::V2::StorageControl::Stub,
|
191
|
+
credentials: credentials,
|
192
|
+
endpoint: @config.endpoint,
|
193
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
194
|
+
universe_domain: @config.universe_domain,
|
195
|
+
channel_args: @config.channel_args,
|
196
|
+
interceptors: @config.interceptors,
|
197
|
+
channel_pool_config: @config.channel_pool
|
198
|
+
)
|
199
|
+
end
|
200
|
+
|
201
|
+
##
|
202
|
+
# Get the associated client for long-running operations.
|
203
|
+
#
|
204
|
+
# @return [::Google::Cloud::Storage::Control::V2::StorageControl::Operations]
|
205
|
+
#
|
206
|
+
attr_reader :operations_client
|
207
|
+
|
208
|
+
# Service calls
|
209
|
+
|
210
|
+
##
|
211
|
+
# Creates a new folder. This operation is only applicable to a hierarchical
|
212
|
+
# namespace enabled bucket.
|
213
|
+
# Hierarchical namespace buckets are in allowlist preview.
|
214
|
+
#
|
215
|
+
# @overload create_folder(request, options = nil)
|
216
|
+
# Pass arguments to `create_folder` via a request object, either of type
|
217
|
+
# {::Google::Cloud::Storage::Control::V2::CreateFolderRequest} or an equivalent Hash.
|
218
|
+
#
|
219
|
+
# @param request [::Google::Cloud::Storage::Control::V2::CreateFolderRequest, ::Hash]
|
220
|
+
# A request object representing the call parameters. Required. To specify no
|
221
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
222
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
223
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
224
|
+
#
|
225
|
+
# @overload create_folder(parent: nil, folder: nil, folder_id: nil, recursive: nil, request_id: nil)
|
226
|
+
# Pass arguments to `create_folder` via keyword arguments. Note that at
|
227
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
228
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
229
|
+
#
|
230
|
+
# @param parent [::String]
|
231
|
+
# Required. Name of the bucket in which the folder will reside. The bucket
|
232
|
+
# must be a hierarchical namespace enabled bucket.
|
233
|
+
# @param folder [::Google::Cloud::Storage::Control::V2::Folder, ::Hash]
|
234
|
+
# Required. Properties of the new folder being created.
|
235
|
+
# The bucket and name of the folder are specified in the parent and folder_id
|
236
|
+
# fields, respectively. Populating those fields in `folder` will result in an
|
237
|
+
# error.
|
238
|
+
# @param folder_id [::String]
|
239
|
+
# Required. The full name of a folder, including all its parent folders.
|
240
|
+
# Folders use single '/' characters as a delimiter.
|
241
|
+
# The folder_id must end with a slash.
|
242
|
+
# For example, the folder_id of "books/biographies/" would create a new
|
243
|
+
# "biographies/" folder under the "books/" folder.
|
244
|
+
# @param recursive [::Boolean]
|
245
|
+
# Optional. If true, parent folder doesn't have to be present and all missing
|
246
|
+
# ancestor folders will be created atomically.
|
247
|
+
# @param request_id [::String]
|
248
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
249
|
+
# format, but other formats are still accepted.
|
250
|
+
#
|
251
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
252
|
+
# @yieldparam response [::Google::Cloud::Storage::Control::V2::Folder]
|
253
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
254
|
+
#
|
255
|
+
# @return [::Google::Cloud::Storage::Control::V2::Folder]
|
256
|
+
#
|
257
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
258
|
+
#
|
259
|
+
# @example Basic example
|
260
|
+
# require "google/cloud/storage/control/v2"
|
261
|
+
#
|
262
|
+
# # Create a client object. The client can be reused for multiple calls.
|
263
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
264
|
+
#
|
265
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
266
|
+
# request = Google::Cloud::Storage::Control::V2::CreateFolderRequest.new
|
267
|
+
#
|
268
|
+
# # Call the create_folder method.
|
269
|
+
# result = client.create_folder request
|
270
|
+
#
|
271
|
+
# # The returned object is of type Google::Cloud::Storage::Control::V2::Folder.
|
272
|
+
# p result
|
273
|
+
#
|
274
|
+
def create_folder request, options = nil
|
275
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
276
|
+
|
277
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::CreateFolderRequest
|
278
|
+
|
279
|
+
# Converts hash and nil to an options object
|
280
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
281
|
+
|
282
|
+
# Customize the options with defaults
|
283
|
+
metadata = @config.rpcs.create_folder.metadata.to_h
|
284
|
+
|
285
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
286
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
287
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
288
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
289
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
290
|
+
|
291
|
+
header_params = {}
|
292
|
+
if request.parent && !request.parent.empty?
|
293
|
+
header_params["bucket"] = request.parent
|
294
|
+
end
|
295
|
+
|
296
|
+
request_params_header = URI.encode_www_form header_params
|
297
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
298
|
+
|
299
|
+
options.apply_defaults timeout: @config.rpcs.create_folder.timeout,
|
300
|
+
metadata: metadata,
|
301
|
+
retry_policy: @config.rpcs.create_folder.retry_policy
|
302
|
+
|
303
|
+
options.apply_defaults timeout: @config.timeout,
|
304
|
+
metadata: @config.metadata,
|
305
|
+
retry_policy: @config.retry_policy
|
306
|
+
|
307
|
+
@storage_control_stub.call_rpc :create_folder, request, options: options do |response, operation|
|
308
|
+
yield response, operation if block_given?
|
309
|
+
return response
|
310
|
+
end
|
311
|
+
rescue ::GRPC::BadStatus => e
|
312
|
+
raise ::Google::Cloud::Error.from_error(e)
|
313
|
+
end
|
314
|
+
|
315
|
+
##
|
316
|
+
# Permanently deletes an empty folder. This operation is only applicable to a
|
317
|
+
# hierarchical namespace enabled bucket.
|
318
|
+
# Hierarchical namespace buckets are in allowlist preview.
|
319
|
+
#
|
320
|
+
# @overload delete_folder(request, options = nil)
|
321
|
+
# Pass arguments to `delete_folder` via a request object, either of type
|
322
|
+
# {::Google::Cloud::Storage::Control::V2::DeleteFolderRequest} or an equivalent Hash.
|
323
|
+
#
|
324
|
+
# @param request [::Google::Cloud::Storage::Control::V2::DeleteFolderRequest, ::Hash]
|
325
|
+
# A request object representing the call parameters. Required. To specify no
|
326
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
327
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
328
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
329
|
+
#
|
330
|
+
# @overload delete_folder(name: nil, if_metageneration_match: nil, if_metageneration_not_match: nil, request_id: nil)
|
331
|
+
# Pass arguments to `delete_folder` via keyword arguments. Note that at
|
332
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
333
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
334
|
+
#
|
335
|
+
# @param name [::String]
|
336
|
+
# Required. Name of the folder.
|
337
|
+
# Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
|
338
|
+
# @param if_metageneration_match [::Integer]
|
339
|
+
# Makes the operation only succeed conditional on whether the folder's
|
340
|
+
# current metageneration matches the given value.
|
341
|
+
# @param if_metageneration_not_match [::Integer]
|
342
|
+
# Makes the operation only succeed conditional on whether the folder's
|
343
|
+
# current metageneration does not match the given value.
|
344
|
+
# @param request_id [::String]
|
345
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
346
|
+
# format, but other formats are still accepted.
|
347
|
+
#
|
348
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
349
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
350
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
351
|
+
#
|
352
|
+
# @return [::Google::Protobuf::Empty]
|
353
|
+
#
|
354
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
355
|
+
#
|
356
|
+
# @example Basic example
|
357
|
+
# require "google/cloud/storage/control/v2"
|
358
|
+
#
|
359
|
+
# # Create a client object. The client can be reused for multiple calls.
|
360
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
361
|
+
#
|
362
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
363
|
+
# request = Google::Cloud::Storage::Control::V2::DeleteFolderRequest.new
|
364
|
+
#
|
365
|
+
# # Call the delete_folder method.
|
366
|
+
# result = client.delete_folder request
|
367
|
+
#
|
368
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
369
|
+
# p result
|
370
|
+
#
|
371
|
+
def delete_folder request, options = nil
|
372
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
373
|
+
|
374
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::DeleteFolderRequest
|
375
|
+
|
376
|
+
# Converts hash and nil to an options object
|
377
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
378
|
+
|
379
|
+
# Customize the options with defaults
|
380
|
+
metadata = @config.rpcs.delete_folder.metadata.to_h
|
381
|
+
|
382
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
383
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
384
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
385
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
386
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
387
|
+
|
388
|
+
header_params = {}
|
389
|
+
if request.name
|
390
|
+
regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
|
391
|
+
if regex_match
|
392
|
+
header_params["bucket"] = regex_match["bucket".to_s]
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
request_params_header = URI.encode_www_form header_params
|
397
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
398
|
+
|
399
|
+
options.apply_defaults timeout: @config.rpcs.delete_folder.timeout,
|
400
|
+
metadata: metadata,
|
401
|
+
retry_policy: @config.rpcs.delete_folder.retry_policy
|
402
|
+
|
403
|
+
options.apply_defaults timeout: @config.timeout,
|
404
|
+
metadata: @config.metadata,
|
405
|
+
retry_policy: @config.retry_policy
|
406
|
+
|
407
|
+
@storage_control_stub.call_rpc :delete_folder, request, options: options do |response, operation|
|
408
|
+
yield response, operation if block_given?
|
409
|
+
return response
|
410
|
+
end
|
411
|
+
rescue ::GRPC::BadStatus => e
|
412
|
+
raise ::Google::Cloud::Error.from_error(e)
|
413
|
+
end
|
414
|
+
|
415
|
+
##
|
416
|
+
# Returns metadata for the specified folder. This operation is only
|
417
|
+
# applicable to a hierarchical namespace enabled bucket.
|
418
|
+
# Hierarchical namespace buckets are in allowlist preview.
|
419
|
+
#
|
420
|
+
# @overload get_folder(request, options = nil)
|
421
|
+
# Pass arguments to `get_folder` via a request object, either of type
|
422
|
+
# {::Google::Cloud::Storage::Control::V2::GetFolderRequest} or an equivalent Hash.
|
423
|
+
#
|
424
|
+
# @param request [::Google::Cloud::Storage::Control::V2::GetFolderRequest, ::Hash]
|
425
|
+
# A request object representing the call parameters. Required. To specify no
|
426
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
427
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
428
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
429
|
+
#
|
430
|
+
# @overload get_folder(name: nil, if_metageneration_match: nil, if_metageneration_not_match: nil, request_id: nil)
|
431
|
+
# Pass arguments to `get_folder` via keyword arguments. Note that at
|
432
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
433
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
434
|
+
#
|
435
|
+
# @param name [::String]
|
436
|
+
# Required. Name of the folder.
|
437
|
+
# Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
|
438
|
+
# @param if_metageneration_match [::Integer]
|
439
|
+
# Makes the operation only succeed conditional on whether the folder's
|
440
|
+
# current metageneration matches the given value.
|
441
|
+
# @param if_metageneration_not_match [::Integer]
|
442
|
+
# Makes the operation only succeed conditional on whether the folder's
|
443
|
+
# current metageneration does not match the given value.
|
444
|
+
# @param request_id [::String]
|
445
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
446
|
+
# format, but other formats are still accepted.
|
447
|
+
#
|
448
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
449
|
+
# @yieldparam response [::Google::Cloud::Storage::Control::V2::Folder]
|
450
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
451
|
+
#
|
452
|
+
# @return [::Google::Cloud::Storage::Control::V2::Folder]
|
453
|
+
#
|
454
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
455
|
+
#
|
456
|
+
# @example Basic example
|
457
|
+
# require "google/cloud/storage/control/v2"
|
458
|
+
#
|
459
|
+
# # Create a client object. The client can be reused for multiple calls.
|
460
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
461
|
+
#
|
462
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
463
|
+
# request = Google::Cloud::Storage::Control::V2::GetFolderRequest.new
|
464
|
+
#
|
465
|
+
# # Call the get_folder method.
|
466
|
+
# result = client.get_folder request
|
467
|
+
#
|
468
|
+
# # The returned object is of type Google::Cloud::Storage::Control::V2::Folder.
|
469
|
+
# p result
|
470
|
+
#
|
471
|
+
def get_folder request, options = nil
|
472
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
473
|
+
|
474
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetFolderRequest
|
475
|
+
|
476
|
+
# Converts hash and nil to an options object
|
477
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
478
|
+
|
479
|
+
# Customize the options with defaults
|
480
|
+
metadata = @config.rpcs.get_folder.metadata.to_h
|
481
|
+
|
482
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
483
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
484
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
485
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
486
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
487
|
+
|
488
|
+
header_params = {}
|
489
|
+
if request.name
|
490
|
+
regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
|
491
|
+
if regex_match
|
492
|
+
header_params["bucket"] = regex_match["bucket".to_s]
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
request_params_header = URI.encode_www_form header_params
|
497
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
498
|
+
|
499
|
+
options.apply_defaults timeout: @config.rpcs.get_folder.timeout,
|
500
|
+
metadata: metadata,
|
501
|
+
retry_policy: @config.rpcs.get_folder.retry_policy
|
502
|
+
|
503
|
+
options.apply_defaults timeout: @config.timeout,
|
504
|
+
metadata: @config.metadata,
|
505
|
+
retry_policy: @config.retry_policy
|
506
|
+
|
507
|
+
@storage_control_stub.call_rpc :get_folder, request, options: options do |response, operation|
|
508
|
+
yield response, operation if block_given?
|
509
|
+
return response
|
510
|
+
end
|
511
|
+
rescue ::GRPC::BadStatus => e
|
512
|
+
raise ::Google::Cloud::Error.from_error(e)
|
513
|
+
end
|
514
|
+
|
515
|
+
##
|
516
|
+
# Retrieves a list of folders. This operation is only applicable to a
|
517
|
+
# hierarchical namespace enabled bucket.
|
518
|
+
# Hierarchical namespace buckets are in allowlist preview.
|
519
|
+
#
|
520
|
+
# @overload list_folders(request, options = nil)
|
521
|
+
# Pass arguments to `list_folders` via a request object, either of type
|
522
|
+
# {::Google::Cloud::Storage::Control::V2::ListFoldersRequest} or an equivalent Hash.
|
523
|
+
#
|
524
|
+
# @param request [::Google::Cloud::Storage::Control::V2::ListFoldersRequest, ::Hash]
|
525
|
+
# A request object representing the call parameters. Required. To specify no
|
526
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
527
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
528
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
529
|
+
#
|
530
|
+
# @overload list_folders(parent: nil, page_size: nil, page_token: nil, prefix: nil, delimiter: nil, lexicographic_start: nil, lexicographic_end: nil, request_id: nil)
|
531
|
+
# Pass arguments to `list_folders` via keyword arguments. Note that at
|
532
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
533
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
534
|
+
#
|
535
|
+
# @param parent [::String]
|
536
|
+
# Required. Name of the bucket in which to look for folders. The bucket must
|
537
|
+
# be a hierarchical namespace enabled bucket.
|
538
|
+
# @param page_size [::Integer]
|
539
|
+
# Optional. Maximum number of folders to return in a single response. The
|
540
|
+
# service will use this parameter or 1,000 items, whichever is smaller.
|
541
|
+
# @param page_token [::String]
|
542
|
+
# Optional. A previously-returned page token representing part of the larger
|
543
|
+
# set of results to view.
|
544
|
+
# @param prefix [::String]
|
545
|
+
# Optional. Filter results to folders whose names begin with this prefix.
|
546
|
+
# If set, the value must either be an empty string or end with a '/'.
|
547
|
+
# @param delimiter [::String]
|
548
|
+
# Optional. If set, returns results in a directory-like mode. The results
|
549
|
+
# will only include folders that either exactly match the above prefix, or
|
550
|
+
# are one level below the prefix. The only supported value is '/'.
|
551
|
+
# @param lexicographic_start [::String]
|
552
|
+
# Optional. Filter results to folders whose names are lexicographically equal
|
553
|
+
# to or after lexicographic_start. If lexicographic_end is also set, the
|
554
|
+
# folders listed have names between lexicographic_start (inclusive) and
|
555
|
+
# lexicographic_end (exclusive).
|
556
|
+
# @param lexicographic_end [::String]
|
557
|
+
# Optional. Filter results to folders whose names are lexicographically
|
558
|
+
# before lexicographic_end. If lexicographic_start is also set, the folders
|
559
|
+
# listed have names between lexicographic_start (inclusive) and
|
560
|
+
# lexicographic_end (exclusive).
|
561
|
+
# @param request_id [::String]
|
562
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
563
|
+
# format, but other formats are still accepted.
|
564
|
+
#
|
565
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
566
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Storage::Control::V2::Folder>]
|
567
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
568
|
+
#
|
569
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Storage::Control::V2::Folder>]
|
570
|
+
#
|
571
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
572
|
+
#
|
573
|
+
# @example Basic example
|
574
|
+
# require "google/cloud/storage/control/v2"
|
575
|
+
#
|
576
|
+
# # Create a client object. The client can be reused for multiple calls.
|
577
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
578
|
+
#
|
579
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
580
|
+
# request = Google::Cloud::Storage::Control::V2::ListFoldersRequest.new
|
581
|
+
#
|
582
|
+
# # Call the list_folders method.
|
583
|
+
# result = client.list_folders request
|
584
|
+
#
|
585
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
586
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
587
|
+
# result.each do |item|
|
588
|
+
# # Each element is of type ::Google::Cloud::Storage::Control::V2::Folder.
|
589
|
+
# p item
|
590
|
+
# end
|
591
|
+
#
|
592
|
+
def list_folders request, options = nil
|
593
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
594
|
+
|
595
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::ListFoldersRequest
|
596
|
+
|
597
|
+
# Converts hash and nil to an options object
|
598
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
599
|
+
|
600
|
+
# Customize the options with defaults
|
601
|
+
metadata = @config.rpcs.list_folders.metadata.to_h
|
602
|
+
|
603
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
604
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
605
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
606
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
607
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
608
|
+
|
609
|
+
header_params = {}
|
610
|
+
if request.parent && !request.parent.empty?
|
611
|
+
header_params["bucket"] = request.parent
|
612
|
+
end
|
613
|
+
|
614
|
+
request_params_header = URI.encode_www_form header_params
|
615
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
616
|
+
|
617
|
+
options.apply_defaults timeout: @config.rpcs.list_folders.timeout,
|
618
|
+
metadata: metadata,
|
619
|
+
retry_policy: @config.rpcs.list_folders.retry_policy
|
620
|
+
|
621
|
+
options.apply_defaults timeout: @config.timeout,
|
622
|
+
metadata: @config.metadata,
|
623
|
+
retry_policy: @config.retry_policy
|
624
|
+
|
625
|
+
@storage_control_stub.call_rpc :list_folders, request, options: options do |response, operation|
|
626
|
+
response = ::Gapic::PagedEnumerable.new @storage_control_stub, :list_folders, request, response, operation, options
|
627
|
+
yield response, operation if block_given?
|
628
|
+
return response
|
629
|
+
end
|
630
|
+
rescue ::GRPC::BadStatus => e
|
631
|
+
raise ::Google::Cloud::Error.from_error(e)
|
632
|
+
end
|
633
|
+
|
634
|
+
##
|
635
|
+
# Renames a source folder to a destination folder. This operation is only
|
636
|
+
# applicable to a hierarchical namespace enabled bucket. During a rename, the
|
637
|
+
# source and destination folders are locked until the long running operation
|
638
|
+
# completes.
|
639
|
+
# Hierarchical namespace buckets are in allowlist preview.
|
640
|
+
#
|
641
|
+
# @overload rename_folder(request, options = nil)
|
642
|
+
# Pass arguments to `rename_folder` via a request object, either of type
|
643
|
+
# {::Google::Cloud::Storage::Control::V2::RenameFolderRequest} or an equivalent Hash.
|
644
|
+
#
|
645
|
+
# @param request [::Google::Cloud::Storage::Control::V2::RenameFolderRequest, ::Hash]
|
646
|
+
# A request object representing the call parameters. Required. To specify no
|
647
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
648
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
649
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
650
|
+
#
|
651
|
+
# @overload rename_folder(name: nil, destination_folder_id: nil, if_metageneration_match: nil, if_metageneration_not_match: nil, request_id: nil)
|
652
|
+
# Pass arguments to `rename_folder` via keyword arguments. Note that at
|
653
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
654
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
655
|
+
#
|
656
|
+
# @param name [::String]
|
657
|
+
# Required. Name of the source folder being renamed.
|
658
|
+
# Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
|
659
|
+
# @param destination_folder_id [::String]
|
660
|
+
# Required. The destination folder ID, e.g. `foo/bar/`.
|
661
|
+
# @param if_metageneration_match [::Integer]
|
662
|
+
# Makes the operation only succeed conditional on whether the source
|
663
|
+
# folder's current metageneration matches the given value.
|
664
|
+
# @param if_metageneration_not_match [::Integer]
|
665
|
+
# Makes the operation only succeed conditional on whether the source
|
666
|
+
# folder's current metageneration does not match the given value.
|
667
|
+
# @param request_id [::String]
|
668
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
669
|
+
# format, but other formats are still accepted. This request is only
|
670
|
+
# idempotent if a `request_id` is provided.
|
671
|
+
#
|
672
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
673
|
+
# @yieldparam response [::Gapic::Operation]
|
674
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
675
|
+
#
|
676
|
+
# @return [::Gapic::Operation]
|
677
|
+
#
|
678
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
679
|
+
#
|
680
|
+
# @example Basic example
|
681
|
+
# require "google/cloud/storage/control/v2"
|
682
|
+
#
|
683
|
+
# # Create a client object. The client can be reused for multiple calls.
|
684
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
685
|
+
#
|
686
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
687
|
+
# request = Google::Cloud::Storage::Control::V2::RenameFolderRequest.new
|
688
|
+
#
|
689
|
+
# # Call the rename_folder method.
|
690
|
+
# result = client.rename_folder request
|
691
|
+
#
|
692
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
693
|
+
# # check the status of an operation, cancel it, or wait for results.
|
694
|
+
# # Here is how to wait for a response.
|
695
|
+
# result.wait_until_done! timeout: 60
|
696
|
+
# if result.response?
|
697
|
+
# p result.response
|
698
|
+
# else
|
699
|
+
# puts "No response received."
|
700
|
+
# end
|
701
|
+
#
|
702
|
+
def rename_folder request, options = nil
|
703
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
704
|
+
|
705
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::RenameFolderRequest
|
706
|
+
|
707
|
+
# Converts hash and nil to an options object
|
708
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
709
|
+
|
710
|
+
# Customize the options with defaults
|
711
|
+
metadata = @config.rpcs.rename_folder.metadata.to_h
|
712
|
+
|
713
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
714
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
715
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
716
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
717
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
718
|
+
|
719
|
+
header_params = {}
|
720
|
+
if request.name
|
721
|
+
regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
|
722
|
+
if regex_match
|
723
|
+
header_params["bucket"] = regex_match["bucket".to_s]
|
724
|
+
end
|
725
|
+
end
|
726
|
+
|
727
|
+
request_params_header = URI.encode_www_form header_params
|
728
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
729
|
+
|
730
|
+
options.apply_defaults timeout: @config.rpcs.rename_folder.timeout,
|
731
|
+
metadata: metadata,
|
732
|
+
retry_policy: @config.rpcs.rename_folder.retry_policy
|
733
|
+
|
734
|
+
options.apply_defaults timeout: @config.timeout,
|
735
|
+
metadata: @config.metadata,
|
736
|
+
retry_policy: @config.retry_policy
|
737
|
+
|
738
|
+
@storage_control_stub.call_rpc :rename_folder, request, options: options do |response, operation|
|
739
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
740
|
+
yield response, operation if block_given?
|
741
|
+
return response
|
742
|
+
end
|
743
|
+
rescue ::GRPC::BadStatus => e
|
744
|
+
raise ::Google::Cloud::Error.from_error(e)
|
745
|
+
end
|
746
|
+
|
747
|
+
##
|
748
|
+
# Returns the storage layout configuration for a given bucket.
|
749
|
+
#
|
750
|
+
# @overload get_storage_layout(request, options = nil)
|
751
|
+
# Pass arguments to `get_storage_layout` via a request object, either of type
|
752
|
+
# {::Google::Cloud::Storage::Control::V2::GetStorageLayoutRequest} or an equivalent Hash.
|
753
|
+
#
|
754
|
+
# @param request [::Google::Cloud::Storage::Control::V2::GetStorageLayoutRequest, ::Hash]
|
755
|
+
# A request object representing the call parameters. Required. To specify no
|
756
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
757
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
758
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
759
|
+
#
|
760
|
+
# @overload get_storage_layout(name: nil, prefix: nil, request_id: nil)
|
761
|
+
# Pass arguments to `get_storage_layout` via keyword arguments. Note that at
|
762
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
763
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
764
|
+
#
|
765
|
+
# @param name [::String]
|
766
|
+
# Required. The name of the StorageLayout resource.
|
767
|
+
# Format: `projects/{project}/buckets/{bucket}/storageLayout`
|
768
|
+
# @param prefix [::String]
|
769
|
+
# An optional prefix used for permission check. It is useful when the caller
|
770
|
+
# only has limited permissions under a specific prefix.
|
771
|
+
# @param request_id [::String]
|
772
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
773
|
+
# format, but other formats are still accepted.
|
774
|
+
#
|
775
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
776
|
+
# @yieldparam response [::Google::Cloud::Storage::Control::V2::StorageLayout]
|
777
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
778
|
+
#
|
779
|
+
# @return [::Google::Cloud::Storage::Control::V2::StorageLayout]
|
780
|
+
#
|
781
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
782
|
+
#
|
783
|
+
# @example Basic example
|
784
|
+
# require "google/cloud/storage/control/v2"
|
785
|
+
#
|
786
|
+
# # Create a client object. The client can be reused for multiple calls.
|
787
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
788
|
+
#
|
789
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
790
|
+
# request = Google::Cloud::Storage::Control::V2::GetStorageLayoutRequest.new
|
791
|
+
#
|
792
|
+
# # Call the get_storage_layout method.
|
793
|
+
# result = client.get_storage_layout request
|
794
|
+
#
|
795
|
+
# # The returned object is of type Google::Cloud::Storage::Control::V2::StorageLayout.
|
796
|
+
# p result
|
797
|
+
#
|
798
|
+
def get_storage_layout request, options = nil
|
799
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
800
|
+
|
801
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetStorageLayoutRequest
|
802
|
+
|
803
|
+
# Converts hash and nil to an options object
|
804
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
805
|
+
|
806
|
+
# Customize the options with defaults
|
807
|
+
metadata = @config.rpcs.get_storage_layout.metadata.to_h
|
808
|
+
|
809
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
810
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
811
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
812
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
813
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
814
|
+
|
815
|
+
header_params = {}
|
816
|
+
if request.name
|
817
|
+
regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
|
818
|
+
if regex_match
|
819
|
+
header_params["bucket"] = regex_match["bucket".to_s]
|
820
|
+
end
|
821
|
+
end
|
822
|
+
|
823
|
+
request_params_header = URI.encode_www_form header_params
|
824
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
825
|
+
|
826
|
+
options.apply_defaults timeout: @config.rpcs.get_storage_layout.timeout,
|
827
|
+
metadata: metadata,
|
828
|
+
retry_policy: @config.rpcs.get_storage_layout.retry_policy
|
829
|
+
|
830
|
+
options.apply_defaults timeout: @config.timeout,
|
831
|
+
metadata: @config.metadata,
|
832
|
+
retry_policy: @config.retry_policy
|
833
|
+
|
834
|
+
@storage_control_stub.call_rpc :get_storage_layout, request, options: options do |response, operation|
|
835
|
+
yield response, operation if block_given?
|
836
|
+
return response
|
837
|
+
end
|
838
|
+
rescue ::GRPC::BadStatus => e
|
839
|
+
raise ::Google::Cloud::Error.from_error(e)
|
840
|
+
end
|
841
|
+
|
842
|
+
##
|
843
|
+
# Creates a new managed folder.
|
844
|
+
#
|
845
|
+
# @overload create_managed_folder(request, options = nil)
|
846
|
+
# Pass arguments to `create_managed_folder` via a request object, either of type
|
847
|
+
# {::Google::Cloud::Storage::Control::V2::CreateManagedFolderRequest} or an equivalent Hash.
|
848
|
+
#
|
849
|
+
# @param request [::Google::Cloud::Storage::Control::V2::CreateManagedFolderRequest, ::Hash]
|
850
|
+
# A request object representing the call parameters. Required. To specify no
|
851
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
852
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
853
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
854
|
+
#
|
855
|
+
# @overload create_managed_folder(parent: nil, managed_folder: nil, managed_folder_id: nil, request_id: nil)
|
856
|
+
# Pass arguments to `create_managed_folder` via keyword arguments. Note that at
|
857
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
858
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
859
|
+
#
|
860
|
+
# @param parent [::String]
|
861
|
+
# Required. Name of the bucket this managed folder belongs to.
|
862
|
+
# @param managed_folder [::Google::Cloud::Storage::Control::V2::ManagedFolder, ::Hash]
|
863
|
+
# Required. Properties of the managed folder being created.
|
864
|
+
# The bucket and managed folder names are specified in the `parent` and
|
865
|
+
# `managed_folder_id` fields. Populating these fields in `managed_folder`
|
866
|
+
# will result in an error.
|
867
|
+
# @param managed_folder_id [::String]
|
868
|
+
# Required. The name of the managed folder. It uses a single `/` as delimiter
|
869
|
+
# and leading and trailing `/` are allowed.
|
870
|
+
# @param request_id [::String]
|
871
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
872
|
+
# format, but other formats are still accepted.
|
873
|
+
#
|
874
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
875
|
+
# @yieldparam response [::Google::Cloud::Storage::Control::V2::ManagedFolder]
|
876
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
877
|
+
#
|
878
|
+
# @return [::Google::Cloud::Storage::Control::V2::ManagedFolder]
|
879
|
+
#
|
880
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
881
|
+
#
|
882
|
+
# @example Basic example
|
883
|
+
# require "google/cloud/storage/control/v2"
|
884
|
+
#
|
885
|
+
# # Create a client object. The client can be reused for multiple calls.
|
886
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
887
|
+
#
|
888
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
889
|
+
# request = Google::Cloud::Storage::Control::V2::CreateManagedFolderRequest.new
|
890
|
+
#
|
891
|
+
# # Call the create_managed_folder method.
|
892
|
+
# result = client.create_managed_folder request
|
893
|
+
#
|
894
|
+
# # The returned object is of type Google::Cloud::Storage::Control::V2::ManagedFolder.
|
895
|
+
# p result
|
896
|
+
#
|
897
|
+
def create_managed_folder request, options = nil
|
898
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
899
|
+
|
900
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::CreateManagedFolderRequest
|
901
|
+
|
902
|
+
# Converts hash and nil to an options object
|
903
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
904
|
+
|
905
|
+
# Customize the options with defaults
|
906
|
+
metadata = @config.rpcs.create_managed_folder.metadata.to_h
|
907
|
+
|
908
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
909
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
910
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
911
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
912
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
913
|
+
|
914
|
+
header_params = {}
|
915
|
+
if request.parent && !request.parent.empty?
|
916
|
+
header_params["bucket"] = request.parent
|
917
|
+
end
|
918
|
+
|
919
|
+
request_params_header = URI.encode_www_form header_params
|
920
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
921
|
+
|
922
|
+
options.apply_defaults timeout: @config.rpcs.create_managed_folder.timeout,
|
923
|
+
metadata: metadata,
|
924
|
+
retry_policy: @config.rpcs.create_managed_folder.retry_policy
|
925
|
+
|
926
|
+
options.apply_defaults timeout: @config.timeout,
|
927
|
+
metadata: @config.metadata,
|
928
|
+
retry_policy: @config.retry_policy
|
929
|
+
|
930
|
+
@storage_control_stub.call_rpc :create_managed_folder, request, options: options do |response, operation|
|
931
|
+
yield response, operation if block_given?
|
932
|
+
return response
|
933
|
+
end
|
934
|
+
rescue ::GRPC::BadStatus => e
|
935
|
+
raise ::Google::Cloud::Error.from_error(e)
|
936
|
+
end
|
937
|
+
|
938
|
+
##
|
939
|
+
# Permanently deletes an empty managed folder.
|
940
|
+
#
|
941
|
+
# @overload delete_managed_folder(request, options = nil)
|
942
|
+
# Pass arguments to `delete_managed_folder` via a request object, either of type
|
943
|
+
# {::Google::Cloud::Storage::Control::V2::DeleteManagedFolderRequest} or an equivalent Hash.
|
944
|
+
#
|
945
|
+
# @param request [::Google::Cloud::Storage::Control::V2::DeleteManagedFolderRequest, ::Hash]
|
946
|
+
# A request object representing the call parameters. Required. To specify no
|
947
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
948
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
949
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
950
|
+
#
|
951
|
+
# @overload delete_managed_folder(name: nil, if_metageneration_match: nil, if_metageneration_not_match: nil, allow_non_empty: nil, request_id: nil)
|
952
|
+
# Pass arguments to `delete_managed_folder` via keyword arguments. Note that at
|
953
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
954
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
955
|
+
#
|
956
|
+
# @param name [::String]
|
957
|
+
# Required. Name of the managed folder.
|
958
|
+
# Format:
|
959
|
+
# `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
|
960
|
+
# @param if_metageneration_match [::Integer]
|
961
|
+
# The operation succeeds conditional on the managed folder's current
|
962
|
+
# metageneration matching the value here specified.
|
963
|
+
# @param if_metageneration_not_match [::Integer]
|
964
|
+
# The operation succeeds conditional on the managed folder's current
|
965
|
+
# metageneration NOT matching the value here specified.
|
966
|
+
# @param allow_non_empty [::Boolean]
|
967
|
+
# Allows deletion of a managed folder even if it is not empty.
|
968
|
+
# A managed folder is empty if it manages no child managed folders or
|
969
|
+
# objects. Caller must have permission for
|
970
|
+
# storage.managedFolders.setIamPolicy.
|
971
|
+
# @param request_id [::String]
|
972
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
973
|
+
# format, but other formats are still accepted.
|
974
|
+
#
|
975
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
976
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
977
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
978
|
+
#
|
979
|
+
# @return [::Google::Protobuf::Empty]
|
980
|
+
#
|
981
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
982
|
+
#
|
983
|
+
# @example Basic example
|
984
|
+
# require "google/cloud/storage/control/v2"
|
985
|
+
#
|
986
|
+
# # Create a client object. The client can be reused for multiple calls.
|
987
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
988
|
+
#
|
989
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
990
|
+
# request = Google::Cloud::Storage::Control::V2::DeleteManagedFolderRequest.new
|
991
|
+
#
|
992
|
+
# # Call the delete_managed_folder method.
|
993
|
+
# result = client.delete_managed_folder request
|
994
|
+
#
|
995
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
996
|
+
# p result
|
997
|
+
#
|
998
|
+
def delete_managed_folder request, options = nil
|
999
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1000
|
+
|
1001
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::DeleteManagedFolderRequest
|
1002
|
+
|
1003
|
+
# Converts hash and nil to an options object
|
1004
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1005
|
+
|
1006
|
+
# Customize the options with defaults
|
1007
|
+
metadata = @config.rpcs.delete_managed_folder.metadata.to_h
|
1008
|
+
|
1009
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1010
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1011
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1012
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
1013
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1014
|
+
|
1015
|
+
header_params = {}
|
1016
|
+
if request.name
|
1017
|
+
regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
|
1018
|
+
if regex_match
|
1019
|
+
header_params["bucket"] = regex_match["bucket".to_s]
|
1020
|
+
end
|
1021
|
+
end
|
1022
|
+
|
1023
|
+
request_params_header = URI.encode_www_form header_params
|
1024
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1025
|
+
|
1026
|
+
options.apply_defaults timeout: @config.rpcs.delete_managed_folder.timeout,
|
1027
|
+
metadata: metadata,
|
1028
|
+
retry_policy: @config.rpcs.delete_managed_folder.retry_policy
|
1029
|
+
|
1030
|
+
options.apply_defaults timeout: @config.timeout,
|
1031
|
+
metadata: @config.metadata,
|
1032
|
+
retry_policy: @config.retry_policy
|
1033
|
+
|
1034
|
+
@storage_control_stub.call_rpc :delete_managed_folder, request, options: options do |response, operation|
|
1035
|
+
yield response, operation if block_given?
|
1036
|
+
return response
|
1037
|
+
end
|
1038
|
+
rescue ::GRPC::BadStatus => e
|
1039
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
##
|
1043
|
+
# Returns metadata for the specified managed folder.
|
1044
|
+
#
|
1045
|
+
# @overload get_managed_folder(request, options = nil)
|
1046
|
+
# Pass arguments to `get_managed_folder` via a request object, either of type
|
1047
|
+
# {::Google::Cloud::Storage::Control::V2::GetManagedFolderRequest} or an equivalent Hash.
|
1048
|
+
#
|
1049
|
+
# @param request [::Google::Cloud::Storage::Control::V2::GetManagedFolderRequest, ::Hash]
|
1050
|
+
# A request object representing the call parameters. Required. To specify no
|
1051
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1052
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1053
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1054
|
+
#
|
1055
|
+
# @overload get_managed_folder(name: nil, if_metageneration_match: nil, if_metageneration_not_match: nil, request_id: nil)
|
1056
|
+
# Pass arguments to `get_managed_folder` via keyword arguments. Note that at
|
1057
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1058
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1059
|
+
#
|
1060
|
+
# @param name [::String]
|
1061
|
+
# Required. Name of the managed folder.
|
1062
|
+
# Format:
|
1063
|
+
# `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
|
1064
|
+
# @param if_metageneration_match [::Integer]
|
1065
|
+
# The operation succeeds conditional on the managed folder's current
|
1066
|
+
# metageneration matching the value here specified.
|
1067
|
+
# @param if_metageneration_not_match [::Integer]
|
1068
|
+
# The operation succeeds conditional on the managed folder's current
|
1069
|
+
# metageneration NOT matching the value here specified.
|
1070
|
+
# @param request_id [::String]
|
1071
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
1072
|
+
# format, but other formats are still accepted.
|
1073
|
+
#
|
1074
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1075
|
+
# @yieldparam response [::Google::Cloud::Storage::Control::V2::ManagedFolder]
|
1076
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1077
|
+
#
|
1078
|
+
# @return [::Google::Cloud::Storage::Control::V2::ManagedFolder]
|
1079
|
+
#
|
1080
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1081
|
+
#
|
1082
|
+
# @example Basic example
|
1083
|
+
# require "google/cloud/storage/control/v2"
|
1084
|
+
#
|
1085
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1086
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
1087
|
+
#
|
1088
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1089
|
+
# request = Google::Cloud::Storage::Control::V2::GetManagedFolderRequest.new
|
1090
|
+
#
|
1091
|
+
# # Call the get_managed_folder method.
|
1092
|
+
# result = client.get_managed_folder request
|
1093
|
+
#
|
1094
|
+
# # The returned object is of type Google::Cloud::Storage::Control::V2::ManagedFolder.
|
1095
|
+
# p result
|
1096
|
+
#
|
1097
|
+
def get_managed_folder request, options = nil
|
1098
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1099
|
+
|
1100
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetManagedFolderRequest
|
1101
|
+
|
1102
|
+
# Converts hash and nil to an options object
|
1103
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1104
|
+
|
1105
|
+
# Customize the options with defaults
|
1106
|
+
metadata = @config.rpcs.get_managed_folder.metadata.to_h
|
1107
|
+
|
1108
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1109
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1110
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1111
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
1112
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1113
|
+
|
1114
|
+
header_params = {}
|
1115
|
+
if request.name
|
1116
|
+
regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
|
1117
|
+
if regex_match
|
1118
|
+
header_params["bucket"] = regex_match["bucket".to_s]
|
1119
|
+
end
|
1120
|
+
end
|
1121
|
+
|
1122
|
+
request_params_header = URI.encode_www_form header_params
|
1123
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1124
|
+
|
1125
|
+
options.apply_defaults timeout: @config.rpcs.get_managed_folder.timeout,
|
1126
|
+
metadata: metadata,
|
1127
|
+
retry_policy: @config.rpcs.get_managed_folder.retry_policy
|
1128
|
+
|
1129
|
+
options.apply_defaults timeout: @config.timeout,
|
1130
|
+
metadata: @config.metadata,
|
1131
|
+
retry_policy: @config.retry_policy
|
1132
|
+
|
1133
|
+
@storage_control_stub.call_rpc :get_managed_folder, request, options: options do |response, operation|
|
1134
|
+
yield response, operation if block_given?
|
1135
|
+
return response
|
1136
|
+
end
|
1137
|
+
rescue ::GRPC::BadStatus => e
|
1138
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
##
|
1142
|
+
# Retrieves a list of managed folders for a given bucket.
|
1143
|
+
#
|
1144
|
+
# @overload list_managed_folders(request, options = nil)
|
1145
|
+
# Pass arguments to `list_managed_folders` via a request object, either of type
|
1146
|
+
# {::Google::Cloud::Storage::Control::V2::ListManagedFoldersRequest} or an equivalent Hash.
|
1147
|
+
#
|
1148
|
+
# @param request [::Google::Cloud::Storage::Control::V2::ListManagedFoldersRequest, ::Hash]
|
1149
|
+
# A request object representing the call parameters. Required. To specify no
|
1150
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1151
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1152
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1153
|
+
#
|
1154
|
+
# @overload list_managed_folders(parent: nil, page_size: nil, page_token: nil, prefix: nil, request_id: nil)
|
1155
|
+
# Pass arguments to `list_managed_folders` via keyword arguments. Note that at
|
1156
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1157
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1158
|
+
#
|
1159
|
+
# @param parent [::String]
|
1160
|
+
# Required. Name of the bucket this managed folder belongs to.
|
1161
|
+
# @param page_size [::Integer]
|
1162
|
+
# Optional. Maximum number of managed folders to return in a single response.
|
1163
|
+
# The service will use this parameter or 1,000 items, whichever is smaller.
|
1164
|
+
# @param page_token [::String]
|
1165
|
+
# Optional. A previously-returned page token representing part of the larger
|
1166
|
+
# set of results to view.
|
1167
|
+
# @param prefix [::String]
|
1168
|
+
# Optional. Filter results to match managed folders with name starting with
|
1169
|
+
# this prefix.
|
1170
|
+
# @param request_id [::String]
|
1171
|
+
# Optional. A unique identifier for this request. UUID is the recommended
|
1172
|
+
# format, but other formats are still accepted.
|
1173
|
+
#
|
1174
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1175
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Storage::Control::V2::ManagedFolder>]
|
1176
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1177
|
+
#
|
1178
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Storage::Control::V2::ManagedFolder>]
|
1179
|
+
#
|
1180
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1181
|
+
#
|
1182
|
+
# @example Basic example
|
1183
|
+
# require "google/cloud/storage/control/v2"
|
1184
|
+
#
|
1185
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1186
|
+
# client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
|
1187
|
+
#
|
1188
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1189
|
+
# request = Google::Cloud::Storage::Control::V2::ListManagedFoldersRequest.new
|
1190
|
+
#
|
1191
|
+
# # Call the list_managed_folders method.
|
1192
|
+
# result = client.list_managed_folders request
|
1193
|
+
#
|
1194
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1195
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1196
|
+
# result.each do |item|
|
1197
|
+
# # Each element is of type ::Google::Cloud::Storage::Control::V2::ManagedFolder.
|
1198
|
+
# p item
|
1199
|
+
# end
|
1200
|
+
#
|
1201
|
+
def list_managed_folders request, options = nil
|
1202
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1203
|
+
|
1204
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::ListManagedFoldersRequest
|
1205
|
+
|
1206
|
+
# Converts hash and nil to an options object
|
1207
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1208
|
+
|
1209
|
+
# Customize the options with defaults
|
1210
|
+
metadata = @config.rpcs.list_managed_folders.metadata.to_h
|
1211
|
+
|
1212
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1213
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1214
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1215
|
+
gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
|
1216
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1217
|
+
|
1218
|
+
header_params = {}
|
1219
|
+
if request.parent && !request.parent.empty?
|
1220
|
+
header_params["bucket"] = request.parent
|
1221
|
+
end
|
1222
|
+
|
1223
|
+
request_params_header = URI.encode_www_form header_params
|
1224
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1225
|
+
|
1226
|
+
options.apply_defaults timeout: @config.rpcs.list_managed_folders.timeout,
|
1227
|
+
metadata: metadata,
|
1228
|
+
retry_policy: @config.rpcs.list_managed_folders.retry_policy
|
1229
|
+
|
1230
|
+
options.apply_defaults timeout: @config.timeout,
|
1231
|
+
metadata: @config.metadata,
|
1232
|
+
retry_policy: @config.retry_policy
|
1233
|
+
|
1234
|
+
@storage_control_stub.call_rpc :list_managed_folders, request, options: options do |response, operation|
|
1235
|
+
response = ::Gapic::PagedEnumerable.new @storage_control_stub, :list_managed_folders, request, response, operation, options
|
1236
|
+
yield response, operation if block_given?
|
1237
|
+
return response
|
1238
|
+
end
|
1239
|
+
rescue ::GRPC::BadStatus => e
|
1240
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1241
|
+
end
|
1242
|
+
|
1243
|
+
##
|
1244
|
+
# Configuration class for the StorageControl API.
|
1245
|
+
#
|
1246
|
+
# This class represents the configuration for StorageControl,
|
1247
|
+
# providing control over timeouts, retry behavior, logging, transport
|
1248
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1249
|
+
# applied individually to specific RPCs. See
|
1250
|
+
# {::Google::Cloud::Storage::Control::V2::StorageControl::Client::Configuration::Rpcs}
|
1251
|
+
# for a list of RPCs that can be configured independently.
|
1252
|
+
#
|
1253
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1254
|
+
# on construction.
|
1255
|
+
#
|
1256
|
+
# @example
|
1257
|
+
#
|
1258
|
+
# # Modify the global config, setting the timeout for
|
1259
|
+
# # create_folder to 20 seconds,
|
1260
|
+
# # and all remaining timeouts to 10 seconds.
|
1261
|
+
# ::Google::Cloud::Storage::Control::V2::StorageControl::Client.configure do |config|
|
1262
|
+
# config.timeout = 10.0
|
1263
|
+
# config.rpcs.create_folder.timeout = 20.0
|
1264
|
+
# end
|
1265
|
+
#
|
1266
|
+
# # Apply the above configuration only to a new client.
|
1267
|
+
# client = ::Google::Cloud::Storage::Control::V2::StorageControl::Client.new do |config|
|
1268
|
+
# config.timeout = 10.0
|
1269
|
+
# config.rpcs.create_folder.timeout = 20.0
|
1270
|
+
# end
|
1271
|
+
#
|
1272
|
+
# @!attribute [rw] endpoint
|
1273
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
1274
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
1275
|
+
# @return [::String,nil]
|
1276
|
+
# @!attribute [rw] credentials
|
1277
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1278
|
+
# * (`String`) The path to a service account key file in JSON format
|
1279
|
+
# * (`Hash`) A service account key as a Hash
|
1280
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1281
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
1282
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1283
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1284
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1285
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1286
|
+
# * (`nil`) indicating no credentials
|
1287
|
+
# @return [::Object]
|
1288
|
+
# @!attribute [rw] scope
|
1289
|
+
# The OAuth scopes
|
1290
|
+
# @return [::Array<::String>]
|
1291
|
+
# @!attribute [rw] lib_name
|
1292
|
+
# The library name as recorded in instrumentation and logging
|
1293
|
+
# @return [::String]
|
1294
|
+
# @!attribute [rw] lib_version
|
1295
|
+
# The library version as recorded in instrumentation and logging
|
1296
|
+
# @return [::String]
|
1297
|
+
# @!attribute [rw] channel_args
|
1298
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1299
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
1300
|
+
# @return [::Hash]
|
1301
|
+
# @!attribute [rw] interceptors
|
1302
|
+
# An array of interceptors that are run before calls are executed.
|
1303
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
1304
|
+
# @!attribute [rw] timeout
|
1305
|
+
# The call timeout in seconds.
|
1306
|
+
# @return [::Numeric]
|
1307
|
+
# @!attribute [rw] metadata
|
1308
|
+
# Additional gRPC headers to be sent with the call.
|
1309
|
+
# @return [::Hash{::Symbol=>::String}]
|
1310
|
+
# @!attribute [rw] retry_policy
|
1311
|
+
# The retry policy. The value is a hash with the following keys:
|
1312
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1313
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1314
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1315
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1316
|
+
# trigger a retry.
|
1317
|
+
# @return [::Hash]
|
1318
|
+
# @!attribute [rw] quota_project
|
1319
|
+
# A separate project against which to charge quota.
|
1320
|
+
# @return [::String]
|
1321
|
+
# @!attribute [rw] universe_domain
|
1322
|
+
# The universe domain within which to make requests. This determines the
|
1323
|
+
# default endpoint URL. The default value of nil uses the environment
|
1324
|
+
# universe (usually the default "googleapis.com" universe).
|
1325
|
+
# @return [::String,nil]
|
1326
|
+
#
|
1327
|
+
class Configuration
|
1328
|
+
extend ::Gapic::Config
|
1329
|
+
|
1330
|
+
# @private
|
1331
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
1332
|
+
DEFAULT_ENDPOINT = "storage.googleapis.com"
|
1333
|
+
|
1334
|
+
config_attr :endpoint, nil, ::String, nil
|
1335
|
+
config_attr :credentials, nil do |value|
|
1336
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1337
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
1338
|
+
allowed.any? { |klass| klass === value }
|
1339
|
+
end
|
1340
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1341
|
+
config_attr :lib_name, nil, ::String, nil
|
1342
|
+
config_attr :lib_version, nil, ::String, nil
|
1343
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1344
|
+
config_attr :interceptors, nil, ::Array, nil
|
1345
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1346
|
+
config_attr :metadata, nil, ::Hash, nil
|
1347
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1348
|
+
config_attr :quota_project, nil, ::String, nil
|
1349
|
+
config_attr :universe_domain, nil, ::String, nil
|
1350
|
+
|
1351
|
+
# @private
|
1352
|
+
def initialize parent_config = nil
|
1353
|
+
@parent_config = parent_config unless parent_config.nil?
|
1354
|
+
|
1355
|
+
yield self if block_given?
|
1356
|
+
end
|
1357
|
+
|
1358
|
+
##
|
1359
|
+
# Configurations for individual RPCs
|
1360
|
+
# @return [Rpcs]
|
1361
|
+
#
|
1362
|
+
def rpcs
|
1363
|
+
@rpcs ||= begin
|
1364
|
+
parent_rpcs = nil
|
1365
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1366
|
+
Rpcs.new parent_rpcs
|
1367
|
+
end
|
1368
|
+
end
|
1369
|
+
|
1370
|
+
##
|
1371
|
+
# Configuration for the channel pool
|
1372
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
1373
|
+
#
|
1374
|
+
def channel_pool
|
1375
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
1376
|
+
end
|
1377
|
+
|
1378
|
+
##
|
1379
|
+
# Configuration RPC class for the StorageControl API.
|
1380
|
+
#
|
1381
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1382
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1383
|
+
# the following configuration fields:
|
1384
|
+
#
|
1385
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1386
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1387
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1388
|
+
# include the following keys:
|
1389
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1390
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1391
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1392
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1393
|
+
# trigger a retry.
|
1394
|
+
#
|
1395
|
+
class Rpcs
|
1396
|
+
##
|
1397
|
+
# RPC-specific configuration for `create_folder`
|
1398
|
+
# @return [::Gapic::Config::Method]
|
1399
|
+
#
|
1400
|
+
attr_reader :create_folder
|
1401
|
+
##
|
1402
|
+
# RPC-specific configuration for `delete_folder`
|
1403
|
+
# @return [::Gapic::Config::Method]
|
1404
|
+
#
|
1405
|
+
attr_reader :delete_folder
|
1406
|
+
##
|
1407
|
+
# RPC-specific configuration for `get_folder`
|
1408
|
+
# @return [::Gapic::Config::Method]
|
1409
|
+
#
|
1410
|
+
attr_reader :get_folder
|
1411
|
+
##
|
1412
|
+
# RPC-specific configuration for `list_folders`
|
1413
|
+
# @return [::Gapic::Config::Method]
|
1414
|
+
#
|
1415
|
+
attr_reader :list_folders
|
1416
|
+
##
|
1417
|
+
# RPC-specific configuration for `rename_folder`
|
1418
|
+
# @return [::Gapic::Config::Method]
|
1419
|
+
#
|
1420
|
+
attr_reader :rename_folder
|
1421
|
+
##
|
1422
|
+
# RPC-specific configuration for `get_storage_layout`
|
1423
|
+
# @return [::Gapic::Config::Method]
|
1424
|
+
#
|
1425
|
+
attr_reader :get_storage_layout
|
1426
|
+
##
|
1427
|
+
# RPC-specific configuration for `create_managed_folder`
|
1428
|
+
# @return [::Gapic::Config::Method]
|
1429
|
+
#
|
1430
|
+
attr_reader :create_managed_folder
|
1431
|
+
##
|
1432
|
+
# RPC-specific configuration for `delete_managed_folder`
|
1433
|
+
# @return [::Gapic::Config::Method]
|
1434
|
+
#
|
1435
|
+
attr_reader :delete_managed_folder
|
1436
|
+
##
|
1437
|
+
# RPC-specific configuration for `get_managed_folder`
|
1438
|
+
# @return [::Gapic::Config::Method]
|
1439
|
+
#
|
1440
|
+
attr_reader :get_managed_folder
|
1441
|
+
##
|
1442
|
+
# RPC-specific configuration for `list_managed_folders`
|
1443
|
+
# @return [::Gapic::Config::Method]
|
1444
|
+
#
|
1445
|
+
attr_reader :list_managed_folders
|
1446
|
+
|
1447
|
+
# @private
|
1448
|
+
def initialize parent_rpcs = nil
|
1449
|
+
create_folder_config = parent_rpcs.create_folder if parent_rpcs.respond_to? :create_folder
|
1450
|
+
@create_folder = ::Gapic::Config::Method.new create_folder_config
|
1451
|
+
delete_folder_config = parent_rpcs.delete_folder if parent_rpcs.respond_to? :delete_folder
|
1452
|
+
@delete_folder = ::Gapic::Config::Method.new delete_folder_config
|
1453
|
+
get_folder_config = parent_rpcs.get_folder if parent_rpcs.respond_to? :get_folder
|
1454
|
+
@get_folder = ::Gapic::Config::Method.new get_folder_config
|
1455
|
+
list_folders_config = parent_rpcs.list_folders if parent_rpcs.respond_to? :list_folders
|
1456
|
+
@list_folders = ::Gapic::Config::Method.new list_folders_config
|
1457
|
+
rename_folder_config = parent_rpcs.rename_folder if parent_rpcs.respond_to? :rename_folder
|
1458
|
+
@rename_folder = ::Gapic::Config::Method.new rename_folder_config
|
1459
|
+
get_storage_layout_config = parent_rpcs.get_storage_layout if parent_rpcs.respond_to? :get_storage_layout
|
1460
|
+
@get_storage_layout = ::Gapic::Config::Method.new get_storage_layout_config
|
1461
|
+
create_managed_folder_config = parent_rpcs.create_managed_folder if parent_rpcs.respond_to? :create_managed_folder
|
1462
|
+
@create_managed_folder = ::Gapic::Config::Method.new create_managed_folder_config
|
1463
|
+
delete_managed_folder_config = parent_rpcs.delete_managed_folder if parent_rpcs.respond_to? :delete_managed_folder
|
1464
|
+
@delete_managed_folder = ::Gapic::Config::Method.new delete_managed_folder_config
|
1465
|
+
get_managed_folder_config = parent_rpcs.get_managed_folder if parent_rpcs.respond_to? :get_managed_folder
|
1466
|
+
@get_managed_folder = ::Gapic::Config::Method.new get_managed_folder_config
|
1467
|
+
list_managed_folders_config = parent_rpcs.list_managed_folders if parent_rpcs.respond_to? :list_managed_folders
|
1468
|
+
@list_managed_folders = ::Gapic::Config::Method.new list_managed_folders_config
|
1469
|
+
|
1470
|
+
yield self if block_given?
|
1471
|
+
end
|
1472
|
+
end
|
1473
|
+
end
|
1474
|
+
end
|
1475
|
+
end
|
1476
|
+
end
|
1477
|
+
end
|
1478
|
+
end
|
1479
|
+
end
|
1480
|
+
end
|