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