google-cloud-storage-control-v2 1.2.1 → 1.4.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.
@@ -73,6 +73,11 @@ module Google
73
73
 
74
74
  default_config.timeout = 60.0
75
75
 
76
+ default_config.rpcs.create_folder.timeout = 60.0
77
+ default_config.rpcs.create_folder.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
79
+ }
80
+
76
81
  default_config.rpcs.get_folder.timeout = 60.0
77
82
  default_config.rpcs.get_folder.retry_policy = {
78
83
  initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
@@ -103,6 +108,71 @@ module Google
103
108
  initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
104
109
  }
105
110
 
111
+ default_config.rpcs.create_anywhere_cache.timeout = 60.0
112
+ default_config.rpcs.create_anywhere_cache.retry_policy = {
113
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
114
+ }
115
+
116
+ default_config.rpcs.update_anywhere_cache.timeout = 60.0
117
+ default_config.rpcs.update_anywhere_cache.retry_policy = {
118
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
119
+ }
120
+
121
+ default_config.rpcs.disable_anywhere_cache.timeout = 60.0
122
+ default_config.rpcs.disable_anywhere_cache.retry_policy = {
123
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
124
+ }
125
+
126
+ default_config.rpcs.pause_anywhere_cache.timeout = 60.0
127
+ default_config.rpcs.pause_anywhere_cache.retry_policy = {
128
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
129
+ }
130
+
131
+ default_config.rpcs.resume_anywhere_cache.timeout = 60.0
132
+ default_config.rpcs.resume_anywhere_cache.retry_policy = {
133
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
134
+ }
135
+
136
+ default_config.rpcs.get_anywhere_cache.timeout = 60.0
137
+ default_config.rpcs.get_anywhere_cache.retry_policy = {
138
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
139
+ }
140
+
141
+ default_config.rpcs.list_anywhere_caches.timeout = 60.0
142
+ default_config.rpcs.list_anywhere_caches.retry_policy = {
143
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
144
+ }
145
+
146
+ default_config.rpcs.get_project_intelligence_config.timeout = 60.0
147
+ default_config.rpcs.get_project_intelligence_config.retry_policy = {
148
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
149
+ }
150
+
151
+ default_config.rpcs.update_project_intelligence_config.timeout = 60.0
152
+ default_config.rpcs.update_project_intelligence_config.retry_policy = {
153
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
154
+ }
155
+
156
+ default_config.rpcs.get_folder_intelligence_config.timeout = 60.0
157
+ default_config.rpcs.get_folder_intelligence_config.retry_policy = {
158
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
159
+ }
160
+
161
+ default_config.rpcs.update_folder_intelligence_config.timeout = 60.0
162
+ default_config.rpcs.update_folder_intelligence_config.retry_policy = {
163
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
164
+ }
165
+
166
+ default_config.rpcs.get_organization_intelligence_config.timeout = 60.0
167
+ default_config.rpcs.get_organization_intelligence_config.retry_policy = {
168
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
169
+ }
170
+
171
+ default_config.rpcs.update_organization_intelligence_config.timeout = 60.0
172
+ default_config.rpcs.update_organization_intelligence_config.retry_policy = {
173
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [8, 14, 4, 13, 2]
174
+ }
175
+
106
176
  default_config
107
177
  end
108
178
  yield @configure if block_given?
@@ -1262,174 +1332,1404 @@ module Google
1262
1332
  end
1263
1333
 
1264
1334
  ##
1265
- # Configuration class for the StorageControl API.
1335
+ # Creates an Anywhere Cache instance.
1266
1336
  #
1267
- # This class represents the configuration for StorageControl,
1268
- # providing control over timeouts, retry behavior, logging, transport
1269
- # parameters, and other low-level controls. Certain parameters can also be
1270
- # applied individually to specific RPCs. See
1271
- # {::Google::Cloud::Storage::Control::V2::StorageControl::Client::Configuration::Rpcs}
1272
- # for a list of RPCs that can be configured independently.
1337
+ # @overload create_anywhere_cache(request, options = nil)
1338
+ # Pass arguments to `create_anywhere_cache` via a request object, either of type
1339
+ # {::Google::Cloud::Storage::Control::V2::CreateAnywhereCacheRequest} or an equivalent Hash.
1273
1340
  #
1274
- # Configuration can be applied globally to all clients, or to a single client
1275
- # on construction.
1341
+ # @param request [::Google::Cloud::Storage::Control::V2::CreateAnywhereCacheRequest, ::Hash]
1342
+ # A request object representing the call parameters. Required. To specify no
1343
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1344
+ # @param options [::Gapic::CallOptions, ::Hash]
1345
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1276
1346
  #
1277
- # @example
1347
+ # @overload create_anywhere_cache(parent: nil, anywhere_cache: nil, request_id: nil)
1348
+ # Pass arguments to `create_anywhere_cache` via keyword arguments. Note that at
1349
+ # least one keyword argument is required. To specify no parameters, or to keep all
1350
+ # the default parameter values, pass an empty Hash as a request object (see above).
1278
1351
  #
1279
- # # Modify the global config, setting the timeout for
1280
- # # create_folder to 20 seconds,
1281
- # # and all remaining timeouts to 10 seconds.
1282
- # ::Google::Cloud::Storage::Control::V2::StorageControl::Client.configure do |config|
1283
- # config.timeout = 10.0
1284
- # config.rpcs.create_folder.timeout = 20.0
1285
- # end
1352
+ # @param parent [::String]
1353
+ # Required. The bucket to which this cache belongs.
1354
+ # Format: `projects/{project}/buckets/{bucket}`
1355
+ # @param anywhere_cache [::Google::Cloud::Storage::Control::V2::AnywhereCache, ::Hash]
1356
+ # Required. Properties of the Anywhere Cache instance being created.
1357
+ # The parent bucket name is specified in the `parent` field. Server uses the
1358
+ # default value of `ttl` or `admission_policy` if not specified in
1359
+ # request.
1360
+ # @param request_id [::String]
1361
+ # Optional. A unique identifier for this request. UUID is the recommended
1362
+ # format, but other formats are still accepted. This request is only
1363
+ # idempotent if a `request_id` is provided.
1286
1364
  #
1287
- # # Apply the above configuration only to a new client.
1288
- # client = ::Google::Cloud::Storage::Control::V2::StorageControl::Client.new do |config|
1289
- # config.timeout = 10.0
1290
- # config.rpcs.create_folder.timeout = 20.0
1291
- # end
1365
+ # @yield [response, operation] Access the result along with the RPC operation
1366
+ # @yieldparam response [::Gapic::Operation]
1367
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1292
1368
  #
1293
- # @!attribute [rw] endpoint
1294
- # A custom service endpoint, as a hostname or hostname:port. The default is
1295
- # nil, indicating to use the default endpoint in the current universe domain.
1296
- # @return [::String,nil]
1297
- # @!attribute [rw] credentials
1298
- # Credentials to send with calls. You may provide any of the following types:
1299
- # * (`String`) The path to a service account key file in JSON format
1300
- # * (`Hash`) A service account key as a Hash
1301
- # * (`Google::Auth::Credentials`) A googleauth credentials object
1302
- # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1303
- # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1304
- # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1305
- # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1306
- # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1307
- # * (`nil`) indicating no credentials
1369
+ # @return [::Gapic::Operation]
1308
1370
  #
1309
- # Warning: If you accept a credential configuration (JSON file or Hash) from an
1310
- # external source for authentication to Google Cloud, you must validate it before
1311
- # providing it to a Google API client library. Providing an unvalidated credential
1312
- # configuration to Google APIs can compromise the security of your systems and data.
1313
- # For more information, refer to [Validate credential configurations from external
1314
- # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1315
- # @return [::Object]
1316
- # @!attribute [rw] scope
1317
- # The OAuth scopes
1318
- # @return [::Array<::String>]
1319
- # @!attribute [rw] lib_name
1320
- # The library name as recorded in instrumentation and logging
1321
- # @return [::String]
1322
- # @!attribute [rw] lib_version
1323
- # The library version as recorded in instrumentation and logging
1324
- # @return [::String]
1325
- # @!attribute [rw] channel_args
1326
- # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1327
- # `GRPC::Core::Channel` object is provided as the credential.
1328
- # @return [::Hash]
1329
- # @!attribute [rw] interceptors
1330
- # An array of interceptors that are run before calls are executed.
1331
- # @return [::Array<::GRPC::ClientInterceptor>]
1332
- # @!attribute [rw] timeout
1333
- # The call timeout in seconds.
1334
- # @return [::Numeric]
1335
- # @!attribute [rw] metadata
1336
- # Additional gRPC headers to be sent with the call.
1337
- # @return [::Hash{::Symbol=>::String}]
1338
- # @!attribute [rw] retry_policy
1339
- # The retry policy. The value is a hash with the following keys:
1340
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1341
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1342
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1343
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1344
- # trigger a retry.
1345
- # @return [::Hash]
1346
- # @!attribute [rw] quota_project
1347
- # A separate project against which to charge quota.
1348
- # @return [::String]
1349
- # @!attribute [rw] universe_domain
1350
- # The universe domain within which to make requests. This determines the
1351
- # default endpoint URL. The default value of nil uses the environment
1352
- # universe (usually the default "googleapis.com" universe).
1353
- # @return [::String,nil]
1354
- # @!attribute [rw] logger
1355
- # A custom logger to use for request/response debug logging, or the value
1356
- # `:default` (the default) to construct a default logger, or `nil` to
1357
- # explicitly disable logging.
1358
- # @return [::Logger,:default,nil]
1371
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1359
1372
  #
1360
- class Configuration
1361
- extend ::Gapic::Config
1373
+ # @example Basic example
1374
+ # require "google/cloud/storage/control/v2"
1375
+ #
1376
+ # # Create a client object. The client can be reused for multiple calls.
1377
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
1378
+ #
1379
+ # # Create a request. To set request fields, pass in keyword arguments.
1380
+ # request = Google::Cloud::Storage::Control::V2::CreateAnywhereCacheRequest.new
1381
+ #
1382
+ # # Call the create_anywhere_cache method.
1383
+ # result = client.create_anywhere_cache request
1384
+ #
1385
+ # # The returned object is of type Gapic::Operation. You can use it to
1386
+ # # check the status of an operation, cancel it, or wait for results.
1387
+ # # Here is how to wait for a response.
1388
+ # result.wait_until_done! timeout: 60
1389
+ # if result.response?
1390
+ # p result.response
1391
+ # else
1392
+ # puts "No response received."
1393
+ # end
1394
+ #
1395
+ def create_anywhere_cache request, options = nil
1396
+ raise ::ArgumentError, "request must be provided" if request.nil?
1362
1397
 
1363
- # @private
1364
- # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1365
- DEFAULT_ENDPOINT = "storage.googleapis.com"
1398
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::CreateAnywhereCacheRequest
1366
1399
 
1367
- config_attr :endpoint, nil, ::String, nil
1368
- config_attr :credentials, nil do |value|
1369
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1370
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
1371
- allowed.any? { |klass| klass === value }
1372
- end
1373
- config_attr :scope, nil, ::String, ::Array, nil
1374
- config_attr :lib_name, nil, ::String, nil
1375
- config_attr :lib_version, nil, ::String, nil
1376
- config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1377
- config_attr :interceptors, nil, ::Array, nil
1378
- config_attr :timeout, nil, ::Numeric, nil
1379
- config_attr :metadata, nil, ::Hash, nil
1380
- config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1381
- config_attr :quota_project, nil, ::String, nil
1382
- config_attr :universe_domain, nil, ::String, nil
1383
- config_attr :logger, :default, ::Logger, nil, :default
1400
+ # Converts hash and nil to an options object
1401
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1384
1402
 
1385
- # @private
1386
- def initialize parent_config = nil
1387
- @parent_config = parent_config unless parent_config.nil?
1403
+ # Customize the options with defaults
1404
+ metadata = @config.rpcs.create_anywhere_cache.metadata.to_h
1388
1405
 
1389
- yield self if block_given?
1390
- end
1406
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1407
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1408
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1409
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
1410
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1411
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1391
1412
 
1392
- ##
1393
- # Configurations for individual RPCs
1394
- # @return [Rpcs]
1395
- #
1396
- def rpcs
1397
- @rpcs ||= begin
1398
- parent_rpcs = nil
1399
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1400
- Rpcs.new parent_rpcs
1401
- end
1413
+ header_params = {}
1414
+ if request.parent && !request.parent.empty?
1415
+ header_params["bucket"] = request.parent
1402
1416
  end
1403
1417
 
1404
- ##
1405
- # Configuration for the channel pool
1406
- # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1407
- #
1408
- def channel_pool
1409
- @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1418
+ request_params_header = URI.encode_www_form header_params
1419
+ metadata[:"x-goog-request-params"] ||= request_params_header
1420
+
1421
+ options.apply_defaults timeout: @config.rpcs.create_anywhere_cache.timeout,
1422
+ metadata: metadata,
1423
+ retry_policy: @config.rpcs.create_anywhere_cache.retry_policy
1424
+
1425
+ options.apply_defaults timeout: @config.timeout,
1426
+ metadata: @config.metadata,
1427
+ retry_policy: @config.retry_policy
1428
+
1429
+ @storage_control_stub.call_rpc :create_anywhere_cache, request, options: options do |response, operation|
1430
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1431
+ yield response, operation if block_given?
1432
+ throw :response, response
1410
1433
  end
1434
+ rescue ::GRPC::BadStatus => e
1435
+ raise ::Google::Cloud::Error.from_error(e)
1436
+ end
1411
1437
 
1412
- ##
1413
- # Configuration RPC class for the StorageControl API.
1414
- #
1415
- # Includes fields providing the configuration for each RPC in this service.
1416
- # Each configuration object is of type `Gapic::Config::Method` and includes
1417
- # the following configuration fields:
1418
- #
1419
- # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1420
- # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1421
- # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1422
- # include the following keys:
1423
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1424
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1425
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1426
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1427
- # trigger a retry.
1428
- #
1429
- class Rpcs
1430
- ##
1431
- # RPC-specific configuration for `create_folder`
1432
- # @return [::Gapic::Config::Method]
1438
+ ##
1439
+ # Updates an Anywhere Cache instance. Mutable fields include `ttl` and
1440
+ # `admission_policy`.
1441
+ #
1442
+ # @overload update_anywhere_cache(request, options = nil)
1443
+ # Pass arguments to `update_anywhere_cache` via a request object, either of type
1444
+ # {::Google::Cloud::Storage::Control::V2::UpdateAnywhereCacheRequest} or an equivalent Hash.
1445
+ #
1446
+ # @param request [::Google::Cloud::Storage::Control::V2::UpdateAnywhereCacheRequest, ::Hash]
1447
+ # A request object representing the call parameters. Required. To specify no
1448
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1449
+ # @param options [::Gapic::CallOptions, ::Hash]
1450
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1451
+ #
1452
+ # @overload update_anywhere_cache(anywhere_cache: nil, update_mask: nil, request_id: nil)
1453
+ # Pass arguments to `update_anywhere_cache` via keyword arguments. Note that at
1454
+ # least one keyword argument is required. To specify no parameters, or to keep all
1455
+ # the default parameter values, pass an empty Hash as a request object (see above).
1456
+ #
1457
+ # @param anywhere_cache [::Google::Cloud::Storage::Control::V2::AnywhereCache, ::Hash]
1458
+ # Required. The Anywhere Cache instance to be updated.
1459
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1460
+ # Required. List of fields to be updated. Mutable fields of AnywhereCache
1461
+ # include `ttl` and `admission_policy`.
1462
+ #
1463
+ # To specify ALL fields, specify a single field with the value `*`. Note: We
1464
+ # recommend against doing this. If a new field is introduced at a later time,
1465
+ # an older client updating with the `*` may accidentally reset the new
1466
+ # field's value.
1467
+ #
1468
+ # Not specifying any fields is an error.
1469
+ # @param request_id [::String]
1470
+ # Optional. A unique identifier for this request. UUID is the recommended
1471
+ # format, but other formats are still accepted. This request is only
1472
+ # idempotent if a `request_id` is provided.
1473
+ #
1474
+ # @yield [response, operation] Access the result along with the RPC operation
1475
+ # @yieldparam response [::Gapic::Operation]
1476
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1477
+ #
1478
+ # @return [::Gapic::Operation]
1479
+ #
1480
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1481
+ #
1482
+ # @example Basic example
1483
+ # require "google/cloud/storage/control/v2"
1484
+ #
1485
+ # # Create a client object. The client can be reused for multiple calls.
1486
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
1487
+ #
1488
+ # # Create a request. To set request fields, pass in keyword arguments.
1489
+ # request = Google::Cloud::Storage::Control::V2::UpdateAnywhereCacheRequest.new
1490
+ #
1491
+ # # Call the update_anywhere_cache method.
1492
+ # result = client.update_anywhere_cache request
1493
+ #
1494
+ # # The returned object is of type Gapic::Operation. You can use it to
1495
+ # # check the status of an operation, cancel it, or wait for results.
1496
+ # # Here is how to wait for a response.
1497
+ # result.wait_until_done! timeout: 60
1498
+ # if result.response?
1499
+ # p result.response
1500
+ # else
1501
+ # puts "No response received."
1502
+ # end
1503
+ #
1504
+ def update_anywhere_cache request, options = nil
1505
+ raise ::ArgumentError, "request must be provided" if request.nil?
1506
+
1507
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::UpdateAnywhereCacheRequest
1508
+
1509
+ # Converts hash and nil to an options object
1510
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1511
+
1512
+ # Customize the options with defaults
1513
+ metadata = @config.rpcs.update_anywhere_cache.metadata.to_h
1514
+
1515
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1516
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1517
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1518
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
1519
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1520
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1521
+
1522
+ header_params = {}
1523
+ if request.anywhere_cache&.name
1524
+ regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.anywhere_cache.name
1525
+ if regex_match
1526
+ header_params["bucket"] = regex_match["bucket".to_s]
1527
+ end
1528
+ end
1529
+
1530
+ request_params_header = URI.encode_www_form header_params
1531
+ metadata[:"x-goog-request-params"] ||= request_params_header
1532
+
1533
+ options.apply_defaults timeout: @config.rpcs.update_anywhere_cache.timeout,
1534
+ metadata: metadata,
1535
+ retry_policy: @config.rpcs.update_anywhere_cache.retry_policy
1536
+
1537
+ options.apply_defaults timeout: @config.timeout,
1538
+ metadata: @config.metadata,
1539
+ retry_policy: @config.retry_policy
1540
+
1541
+ @storage_control_stub.call_rpc :update_anywhere_cache, request, options: options do |response, operation|
1542
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1543
+ yield response, operation if block_given?
1544
+ throw :response, response
1545
+ end
1546
+ rescue ::GRPC::BadStatus => e
1547
+ raise ::Google::Cloud::Error.from_error(e)
1548
+ end
1549
+
1550
+ ##
1551
+ # Disables an Anywhere Cache instance. A disabled instance is read-only. The
1552
+ # disablement could be revoked by calling ResumeAnywhereCache. The cache
1553
+ # instance will be deleted automatically if it remains in the disabled state
1554
+ # for at least one hour.
1555
+ #
1556
+ # @overload disable_anywhere_cache(request, options = nil)
1557
+ # Pass arguments to `disable_anywhere_cache` via a request object, either of type
1558
+ # {::Google::Cloud::Storage::Control::V2::DisableAnywhereCacheRequest} or an equivalent Hash.
1559
+ #
1560
+ # @param request [::Google::Cloud::Storage::Control::V2::DisableAnywhereCacheRequest, ::Hash]
1561
+ # A request object representing the call parameters. Required. To specify no
1562
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1563
+ # @param options [::Gapic::CallOptions, ::Hash]
1564
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1565
+ #
1566
+ # @overload disable_anywhere_cache(name: nil, request_id: nil)
1567
+ # Pass arguments to `disable_anywhere_cache` via keyword arguments. Note that at
1568
+ # least one keyword argument is required. To specify no parameters, or to keep all
1569
+ # the default parameter values, pass an empty Hash as a request object (see above).
1570
+ #
1571
+ # @param name [::String]
1572
+ # Required. The name field in the request should be:
1573
+ # `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
1574
+ # @param request_id [::String]
1575
+ # Optional. A unique identifier for this request. UUID is the recommended
1576
+ # format, but other formats are still accepted. This request is only
1577
+ # idempotent if a `request_id` is provided.
1578
+ #
1579
+ # @yield [response, operation] Access the result along with the RPC operation
1580
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::AnywhereCache]
1581
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1582
+ #
1583
+ # @return [::Google::Cloud::Storage::Control::V2::AnywhereCache]
1584
+ #
1585
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1586
+ #
1587
+ # @example Basic example
1588
+ # require "google/cloud/storage/control/v2"
1589
+ #
1590
+ # # Create a client object. The client can be reused for multiple calls.
1591
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
1592
+ #
1593
+ # # Create a request. To set request fields, pass in keyword arguments.
1594
+ # request = Google::Cloud::Storage::Control::V2::DisableAnywhereCacheRequest.new
1595
+ #
1596
+ # # Call the disable_anywhere_cache method.
1597
+ # result = client.disable_anywhere_cache request
1598
+ #
1599
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::AnywhereCache.
1600
+ # p result
1601
+ #
1602
+ def disable_anywhere_cache request, options = nil
1603
+ raise ::ArgumentError, "request must be provided" if request.nil?
1604
+
1605
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::DisableAnywhereCacheRequest
1606
+
1607
+ # Converts hash and nil to an options object
1608
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1609
+
1610
+ # Customize the options with defaults
1611
+ metadata = @config.rpcs.disable_anywhere_cache.metadata.to_h
1612
+
1613
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1614
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1615
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1616
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
1617
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1618
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1619
+
1620
+ header_params = {}
1621
+ if request.name
1622
+ regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
1623
+ if regex_match
1624
+ header_params["bucket"] = regex_match["bucket".to_s]
1625
+ end
1626
+ end
1627
+
1628
+ request_params_header = URI.encode_www_form header_params
1629
+ metadata[:"x-goog-request-params"] ||= request_params_header
1630
+
1631
+ options.apply_defaults timeout: @config.rpcs.disable_anywhere_cache.timeout,
1632
+ metadata: metadata,
1633
+ retry_policy: @config.rpcs.disable_anywhere_cache.retry_policy
1634
+
1635
+ options.apply_defaults timeout: @config.timeout,
1636
+ metadata: @config.metadata,
1637
+ retry_policy: @config.retry_policy
1638
+
1639
+ @storage_control_stub.call_rpc :disable_anywhere_cache, request, options: options do |response, operation|
1640
+ yield response, operation if block_given?
1641
+ end
1642
+ rescue ::GRPC::BadStatus => e
1643
+ raise ::Google::Cloud::Error.from_error(e)
1644
+ end
1645
+
1646
+ ##
1647
+ # Pauses an Anywhere Cache instance.
1648
+ #
1649
+ # @overload pause_anywhere_cache(request, options = nil)
1650
+ # Pass arguments to `pause_anywhere_cache` via a request object, either of type
1651
+ # {::Google::Cloud::Storage::Control::V2::PauseAnywhereCacheRequest} or an equivalent Hash.
1652
+ #
1653
+ # @param request [::Google::Cloud::Storage::Control::V2::PauseAnywhereCacheRequest, ::Hash]
1654
+ # A request object representing the call parameters. Required. To specify no
1655
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1656
+ # @param options [::Gapic::CallOptions, ::Hash]
1657
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1658
+ #
1659
+ # @overload pause_anywhere_cache(name: nil, request_id: nil)
1660
+ # Pass arguments to `pause_anywhere_cache` via keyword arguments. Note that at
1661
+ # least one keyword argument is required. To specify no parameters, or to keep all
1662
+ # the default parameter values, pass an empty Hash as a request object (see above).
1663
+ #
1664
+ # @param name [::String]
1665
+ # Required. The name field in the request should be:
1666
+ # `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
1667
+ # @param request_id [::String]
1668
+ # Optional. A unique identifier for this request. UUID is the recommended
1669
+ # format, but other formats are still accepted. This request is only
1670
+ # idempotent if a `request_id` is provided.
1671
+ #
1672
+ # @yield [response, operation] Access the result along with the RPC operation
1673
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::AnywhereCache]
1674
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1675
+ #
1676
+ # @return [::Google::Cloud::Storage::Control::V2::AnywhereCache]
1677
+ #
1678
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1679
+ #
1680
+ # @example Basic example
1681
+ # require "google/cloud/storage/control/v2"
1682
+ #
1683
+ # # Create a client object. The client can be reused for multiple calls.
1684
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
1685
+ #
1686
+ # # Create a request. To set request fields, pass in keyword arguments.
1687
+ # request = Google::Cloud::Storage::Control::V2::PauseAnywhereCacheRequest.new
1688
+ #
1689
+ # # Call the pause_anywhere_cache method.
1690
+ # result = client.pause_anywhere_cache request
1691
+ #
1692
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::AnywhereCache.
1693
+ # p result
1694
+ #
1695
+ def pause_anywhere_cache request, options = nil
1696
+ raise ::ArgumentError, "request must be provided" if request.nil?
1697
+
1698
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::PauseAnywhereCacheRequest
1699
+
1700
+ # Converts hash and nil to an options object
1701
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1702
+
1703
+ # Customize the options with defaults
1704
+ metadata = @config.rpcs.pause_anywhere_cache.metadata.to_h
1705
+
1706
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1707
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1708
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1709
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
1710
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1711
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1712
+
1713
+ header_params = {}
1714
+ if request.name
1715
+ regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
1716
+ if regex_match
1717
+ header_params["bucket"] = regex_match["bucket".to_s]
1718
+ end
1719
+ end
1720
+
1721
+ request_params_header = URI.encode_www_form header_params
1722
+ metadata[:"x-goog-request-params"] ||= request_params_header
1723
+
1724
+ options.apply_defaults timeout: @config.rpcs.pause_anywhere_cache.timeout,
1725
+ metadata: metadata,
1726
+ retry_policy: @config.rpcs.pause_anywhere_cache.retry_policy
1727
+
1728
+ options.apply_defaults timeout: @config.timeout,
1729
+ metadata: @config.metadata,
1730
+ retry_policy: @config.retry_policy
1731
+
1732
+ @storage_control_stub.call_rpc :pause_anywhere_cache, request, options: options do |response, operation|
1733
+ yield response, operation if block_given?
1734
+ end
1735
+ rescue ::GRPC::BadStatus => e
1736
+ raise ::Google::Cloud::Error.from_error(e)
1737
+ end
1738
+
1739
+ ##
1740
+ # Resumes a disabled or paused Anywhere Cache instance.
1741
+ #
1742
+ # @overload resume_anywhere_cache(request, options = nil)
1743
+ # Pass arguments to `resume_anywhere_cache` via a request object, either of type
1744
+ # {::Google::Cloud::Storage::Control::V2::ResumeAnywhereCacheRequest} or an equivalent Hash.
1745
+ #
1746
+ # @param request [::Google::Cloud::Storage::Control::V2::ResumeAnywhereCacheRequest, ::Hash]
1747
+ # A request object representing the call parameters. Required. To specify no
1748
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1749
+ # @param options [::Gapic::CallOptions, ::Hash]
1750
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1751
+ #
1752
+ # @overload resume_anywhere_cache(name: nil, request_id: nil)
1753
+ # Pass arguments to `resume_anywhere_cache` via keyword arguments. Note that at
1754
+ # least one keyword argument is required. To specify no parameters, or to keep all
1755
+ # the default parameter values, pass an empty Hash as a request object (see above).
1756
+ #
1757
+ # @param name [::String]
1758
+ # Required. The name field in the request should be:
1759
+ # `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
1760
+ # @param request_id [::String]
1761
+ # Optional. A unique identifier for this request. UUID is the recommended
1762
+ # format, but other formats are still accepted. This request is only
1763
+ # idempotent if a `request_id` is provided.
1764
+ #
1765
+ # @yield [response, operation] Access the result along with the RPC operation
1766
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::AnywhereCache]
1767
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1768
+ #
1769
+ # @return [::Google::Cloud::Storage::Control::V2::AnywhereCache]
1770
+ #
1771
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1772
+ #
1773
+ # @example Basic example
1774
+ # require "google/cloud/storage/control/v2"
1775
+ #
1776
+ # # Create a client object. The client can be reused for multiple calls.
1777
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
1778
+ #
1779
+ # # Create a request. To set request fields, pass in keyword arguments.
1780
+ # request = Google::Cloud::Storage::Control::V2::ResumeAnywhereCacheRequest.new
1781
+ #
1782
+ # # Call the resume_anywhere_cache method.
1783
+ # result = client.resume_anywhere_cache request
1784
+ #
1785
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::AnywhereCache.
1786
+ # p result
1787
+ #
1788
+ def resume_anywhere_cache request, options = nil
1789
+ raise ::ArgumentError, "request must be provided" if request.nil?
1790
+
1791
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::ResumeAnywhereCacheRequest
1792
+
1793
+ # Converts hash and nil to an options object
1794
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1795
+
1796
+ # Customize the options with defaults
1797
+ metadata = @config.rpcs.resume_anywhere_cache.metadata.to_h
1798
+
1799
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1800
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1801
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1802
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
1803
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1804
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1805
+
1806
+ header_params = {}
1807
+ if request.name
1808
+ regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
1809
+ if regex_match
1810
+ header_params["bucket"] = regex_match["bucket".to_s]
1811
+ end
1812
+ end
1813
+
1814
+ request_params_header = URI.encode_www_form header_params
1815
+ metadata[:"x-goog-request-params"] ||= request_params_header
1816
+
1817
+ options.apply_defaults timeout: @config.rpcs.resume_anywhere_cache.timeout,
1818
+ metadata: metadata,
1819
+ retry_policy: @config.rpcs.resume_anywhere_cache.retry_policy
1820
+
1821
+ options.apply_defaults timeout: @config.timeout,
1822
+ metadata: @config.metadata,
1823
+ retry_policy: @config.retry_policy
1824
+
1825
+ @storage_control_stub.call_rpc :resume_anywhere_cache, request, options: options do |response, operation|
1826
+ yield response, operation if block_given?
1827
+ end
1828
+ rescue ::GRPC::BadStatus => e
1829
+ raise ::Google::Cloud::Error.from_error(e)
1830
+ end
1831
+
1832
+ ##
1833
+ # Gets an Anywhere Cache instance.
1834
+ #
1835
+ # @overload get_anywhere_cache(request, options = nil)
1836
+ # Pass arguments to `get_anywhere_cache` via a request object, either of type
1837
+ # {::Google::Cloud::Storage::Control::V2::GetAnywhereCacheRequest} or an equivalent Hash.
1838
+ #
1839
+ # @param request [::Google::Cloud::Storage::Control::V2::GetAnywhereCacheRequest, ::Hash]
1840
+ # A request object representing the call parameters. Required. To specify no
1841
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1842
+ # @param options [::Gapic::CallOptions, ::Hash]
1843
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1844
+ #
1845
+ # @overload get_anywhere_cache(name: nil, request_id: nil)
1846
+ # Pass arguments to `get_anywhere_cache` via keyword arguments. Note that at
1847
+ # least one keyword argument is required. To specify no parameters, or to keep all
1848
+ # the default parameter values, pass an empty Hash as a request object (see above).
1849
+ #
1850
+ # @param name [::String]
1851
+ # Required. The name field in the request should be:
1852
+ # `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
1853
+ # @param request_id [::String]
1854
+ # Optional. A unique identifier for this request. UUID is the recommended
1855
+ # format, but other formats are still accepted.
1856
+ #
1857
+ # @yield [response, operation] Access the result along with the RPC operation
1858
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::AnywhereCache]
1859
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1860
+ #
1861
+ # @return [::Google::Cloud::Storage::Control::V2::AnywhereCache]
1862
+ #
1863
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1864
+ #
1865
+ # @example Basic example
1866
+ # require "google/cloud/storage/control/v2"
1867
+ #
1868
+ # # Create a client object. The client can be reused for multiple calls.
1869
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
1870
+ #
1871
+ # # Create a request. To set request fields, pass in keyword arguments.
1872
+ # request = Google::Cloud::Storage::Control::V2::GetAnywhereCacheRequest.new
1873
+ #
1874
+ # # Call the get_anywhere_cache method.
1875
+ # result = client.get_anywhere_cache request
1876
+ #
1877
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::AnywhereCache.
1878
+ # p result
1879
+ #
1880
+ def get_anywhere_cache request, options = nil
1881
+ raise ::ArgumentError, "request must be provided" if request.nil?
1882
+
1883
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetAnywhereCacheRequest
1884
+
1885
+ # Converts hash and nil to an options object
1886
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1887
+
1888
+ # Customize the options with defaults
1889
+ metadata = @config.rpcs.get_anywhere_cache.metadata.to_h
1890
+
1891
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1892
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1893
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1894
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
1895
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1896
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1897
+
1898
+ header_params = {}
1899
+ if request.name
1900
+ regex_match = %r{^(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?$}.match request.name
1901
+ if regex_match
1902
+ header_params["bucket"] = regex_match["bucket".to_s]
1903
+ end
1904
+ end
1905
+
1906
+ request_params_header = URI.encode_www_form header_params
1907
+ metadata[:"x-goog-request-params"] ||= request_params_header
1908
+
1909
+ options.apply_defaults timeout: @config.rpcs.get_anywhere_cache.timeout,
1910
+ metadata: metadata,
1911
+ retry_policy: @config.rpcs.get_anywhere_cache.retry_policy
1912
+
1913
+ options.apply_defaults timeout: @config.timeout,
1914
+ metadata: @config.metadata,
1915
+ retry_policy: @config.retry_policy
1916
+
1917
+ @storage_control_stub.call_rpc :get_anywhere_cache, request, options: options do |response, operation|
1918
+ yield response, operation if block_given?
1919
+ end
1920
+ rescue ::GRPC::BadStatus => e
1921
+ raise ::Google::Cloud::Error.from_error(e)
1922
+ end
1923
+
1924
+ ##
1925
+ # Lists Anywhere Cache instances for a given bucket.
1926
+ #
1927
+ # @overload list_anywhere_caches(request, options = nil)
1928
+ # Pass arguments to `list_anywhere_caches` via a request object, either of type
1929
+ # {::Google::Cloud::Storage::Control::V2::ListAnywhereCachesRequest} or an equivalent Hash.
1930
+ #
1931
+ # @param request [::Google::Cloud::Storage::Control::V2::ListAnywhereCachesRequest, ::Hash]
1932
+ # A request object representing the call parameters. Required. To specify no
1933
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1934
+ # @param options [::Gapic::CallOptions, ::Hash]
1935
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1936
+ #
1937
+ # @overload list_anywhere_caches(parent: nil, page_size: nil, page_token: nil, request_id: nil)
1938
+ # Pass arguments to `list_anywhere_caches` via keyword arguments. Note that at
1939
+ # least one keyword argument is required. To specify no parameters, or to keep all
1940
+ # the default parameter values, pass an empty Hash as a request object (see above).
1941
+ #
1942
+ # @param parent [::String]
1943
+ # Required. The bucket to which this cache belongs.
1944
+ # @param page_size [::Integer]
1945
+ # Maximum number of caches to return in a single response.
1946
+ # The service will use this parameter or 1,000 items, whichever is smaller.
1947
+ # @param page_token [::String]
1948
+ # A previously-returned page token representing part of the larger set of
1949
+ # results to view.
1950
+ # @param request_id [::String]
1951
+ # Optional. A unique identifier for this request. UUID is the recommended
1952
+ # format, but other formats are still accepted.
1953
+ #
1954
+ # @yield [response, operation] Access the result along with the RPC operation
1955
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Storage::Control::V2::AnywhereCache>]
1956
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1957
+ #
1958
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Storage::Control::V2::AnywhereCache>]
1959
+ #
1960
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1961
+ #
1962
+ # @example Basic example
1963
+ # require "google/cloud/storage/control/v2"
1964
+ #
1965
+ # # Create a client object. The client can be reused for multiple calls.
1966
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
1967
+ #
1968
+ # # Create a request. To set request fields, pass in keyword arguments.
1969
+ # request = Google::Cloud::Storage::Control::V2::ListAnywhereCachesRequest.new
1970
+ #
1971
+ # # Call the list_anywhere_caches method.
1972
+ # result = client.list_anywhere_caches request
1973
+ #
1974
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1975
+ # # over elements, and API calls will be issued to fetch pages as needed.
1976
+ # result.each do |item|
1977
+ # # Each element is of type ::Google::Cloud::Storage::Control::V2::AnywhereCache.
1978
+ # p item
1979
+ # end
1980
+ #
1981
+ def list_anywhere_caches request, options = nil
1982
+ raise ::ArgumentError, "request must be provided" if request.nil?
1983
+
1984
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::ListAnywhereCachesRequest
1985
+
1986
+ # Converts hash and nil to an options object
1987
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1988
+
1989
+ # Customize the options with defaults
1990
+ metadata = @config.rpcs.list_anywhere_caches.metadata.to_h
1991
+
1992
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1993
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1994
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1995
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
1996
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1997
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1998
+
1999
+ header_params = {}
2000
+ if request.parent && !request.parent.empty?
2001
+ header_params["bucket"] = request.parent
2002
+ end
2003
+
2004
+ request_params_header = URI.encode_www_form header_params
2005
+ metadata[:"x-goog-request-params"] ||= request_params_header
2006
+
2007
+ options.apply_defaults timeout: @config.rpcs.list_anywhere_caches.timeout,
2008
+ metadata: metadata,
2009
+ retry_policy: @config.rpcs.list_anywhere_caches.retry_policy
2010
+
2011
+ options.apply_defaults timeout: @config.timeout,
2012
+ metadata: @config.metadata,
2013
+ retry_policy: @config.retry_policy
2014
+
2015
+ @storage_control_stub.call_rpc :list_anywhere_caches, request, options: options do |response, operation|
2016
+ response = ::Gapic::PagedEnumerable.new @storage_control_stub, :list_anywhere_caches, request, response, operation, options
2017
+ yield response, operation if block_given?
2018
+ throw :response, response
2019
+ end
2020
+ rescue ::GRPC::BadStatus => e
2021
+ raise ::Google::Cloud::Error.from_error(e)
2022
+ end
2023
+
2024
+ ##
2025
+ # Returns the Project scoped singleton IntelligenceConfig resource.
2026
+ #
2027
+ # @overload get_project_intelligence_config(request, options = nil)
2028
+ # Pass arguments to `get_project_intelligence_config` via a request object, either of type
2029
+ # {::Google::Cloud::Storage::Control::V2::GetProjectIntelligenceConfigRequest} or an equivalent Hash.
2030
+ #
2031
+ # @param request [::Google::Cloud::Storage::Control::V2::GetProjectIntelligenceConfigRequest, ::Hash]
2032
+ # A request object representing the call parameters. Required. To specify no
2033
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2034
+ # @param options [::Gapic::CallOptions, ::Hash]
2035
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2036
+ #
2037
+ # @overload get_project_intelligence_config(name: nil)
2038
+ # Pass arguments to `get_project_intelligence_config` via keyword arguments. Note that at
2039
+ # least one keyword argument is required. To specify no parameters, or to keep all
2040
+ # the default parameter values, pass an empty Hash as a request object (see above).
2041
+ #
2042
+ # @param name [::String]
2043
+ # Required. The name of the `IntelligenceConfig` resource associated with
2044
+ # your project.
2045
+ #
2046
+ # Format: `projects/{id}/locations/global/intelligenceConfig`
2047
+ #
2048
+ # @yield [response, operation] Access the result along with the RPC operation
2049
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2050
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2051
+ #
2052
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2053
+ #
2054
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2055
+ #
2056
+ # @example Basic example
2057
+ # require "google/cloud/storage/control/v2"
2058
+ #
2059
+ # # Create a client object. The client can be reused for multiple calls.
2060
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
2061
+ #
2062
+ # # Create a request. To set request fields, pass in keyword arguments.
2063
+ # request = Google::Cloud::Storage::Control::V2::GetProjectIntelligenceConfigRequest.new
2064
+ #
2065
+ # # Call the get_project_intelligence_config method.
2066
+ # result = client.get_project_intelligence_config request
2067
+ #
2068
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
2069
+ # p result
2070
+ #
2071
+ def get_project_intelligence_config request, options = nil
2072
+ raise ::ArgumentError, "request must be provided" if request.nil?
2073
+
2074
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetProjectIntelligenceConfigRequest
2075
+
2076
+ # Converts hash and nil to an options object
2077
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2078
+
2079
+ # Customize the options with defaults
2080
+ metadata = @config.rpcs.get_project_intelligence_config.metadata.to_h
2081
+
2082
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2083
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2084
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2085
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
2086
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2087
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2088
+
2089
+ header_params = {}
2090
+ if request.name
2091
+ header_params["name"] = request.name
2092
+ end
2093
+
2094
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2095
+ metadata[:"x-goog-request-params"] ||= request_params_header
2096
+
2097
+ options.apply_defaults timeout: @config.rpcs.get_project_intelligence_config.timeout,
2098
+ metadata: metadata,
2099
+ retry_policy: @config.rpcs.get_project_intelligence_config.retry_policy
2100
+
2101
+ options.apply_defaults timeout: @config.timeout,
2102
+ metadata: @config.metadata,
2103
+ retry_policy: @config.retry_policy
2104
+
2105
+ @storage_control_stub.call_rpc :get_project_intelligence_config, request, options: options do |response, operation|
2106
+ yield response, operation if block_given?
2107
+ end
2108
+ rescue ::GRPC::BadStatus => e
2109
+ raise ::Google::Cloud::Error.from_error(e)
2110
+ end
2111
+
2112
+ ##
2113
+ # Updates the Project scoped singleton IntelligenceConfig resource.
2114
+ #
2115
+ # @overload update_project_intelligence_config(request, options = nil)
2116
+ # Pass arguments to `update_project_intelligence_config` via a request object, either of type
2117
+ # {::Google::Cloud::Storage::Control::V2::UpdateProjectIntelligenceConfigRequest} or an equivalent Hash.
2118
+ #
2119
+ # @param request [::Google::Cloud::Storage::Control::V2::UpdateProjectIntelligenceConfigRequest, ::Hash]
2120
+ # A request object representing the call parameters. Required. To specify no
2121
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2122
+ # @param options [::Gapic::CallOptions, ::Hash]
2123
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2124
+ #
2125
+ # @overload update_project_intelligence_config(intelligence_config: nil, update_mask: nil, request_id: nil)
2126
+ # Pass arguments to `update_project_intelligence_config` via keyword arguments. Note that at
2127
+ # least one keyword argument is required. To specify no parameters, or to keep all
2128
+ # the default parameter values, pass an empty Hash as a request object (see above).
2129
+ #
2130
+ # @param intelligence_config [::Google::Cloud::Storage::Control::V2::IntelligenceConfig, ::Hash]
2131
+ # Required. The `IntelligenceConfig` resource to be updated.
2132
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2133
+ # Required. The `update_mask` that specifies the fields within the
2134
+ # `IntelligenceConfig` resource that should be modified by this update. Only
2135
+ # the listed fields are updated.
2136
+ # @param request_id [::String]
2137
+ # Optional. The ID that uniquely identifies the request, preventing duplicate
2138
+ # processing.
2139
+ #
2140
+ # @yield [response, operation] Access the result along with the RPC operation
2141
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2142
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2143
+ #
2144
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2145
+ #
2146
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2147
+ #
2148
+ # @example Basic example
2149
+ # require "google/cloud/storage/control/v2"
2150
+ #
2151
+ # # Create a client object. The client can be reused for multiple calls.
2152
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
2153
+ #
2154
+ # # Create a request. To set request fields, pass in keyword arguments.
2155
+ # request = Google::Cloud::Storage::Control::V2::UpdateProjectIntelligenceConfigRequest.new
2156
+ #
2157
+ # # Call the update_project_intelligence_config method.
2158
+ # result = client.update_project_intelligence_config request
2159
+ #
2160
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
2161
+ # p result
2162
+ #
2163
+ def update_project_intelligence_config request, options = nil
2164
+ raise ::ArgumentError, "request must be provided" if request.nil?
2165
+
2166
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::UpdateProjectIntelligenceConfigRequest
2167
+
2168
+ # Converts hash and nil to an options object
2169
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2170
+
2171
+ # Customize the options with defaults
2172
+ metadata = @config.rpcs.update_project_intelligence_config.metadata.to_h
2173
+
2174
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2175
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2176
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2177
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
2178
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2179
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2180
+
2181
+ header_params = {}
2182
+ if request.intelligence_config&.name
2183
+ header_params["intelligence_config.name"] = request.intelligence_config.name
2184
+ end
2185
+
2186
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2187
+ metadata[:"x-goog-request-params"] ||= request_params_header
2188
+
2189
+ options.apply_defaults timeout: @config.rpcs.update_project_intelligence_config.timeout,
2190
+ metadata: metadata,
2191
+ retry_policy: @config.rpcs.update_project_intelligence_config.retry_policy
2192
+
2193
+ options.apply_defaults timeout: @config.timeout,
2194
+ metadata: @config.metadata,
2195
+ retry_policy: @config.retry_policy
2196
+
2197
+ @storage_control_stub.call_rpc :update_project_intelligence_config, request, options: options do |response, operation|
2198
+ yield response, operation if block_given?
2199
+ end
2200
+ rescue ::GRPC::BadStatus => e
2201
+ raise ::Google::Cloud::Error.from_error(e)
2202
+ end
2203
+
2204
+ ##
2205
+ # Returns the Folder scoped singleton IntelligenceConfig resource.
2206
+ #
2207
+ # @overload get_folder_intelligence_config(request, options = nil)
2208
+ # Pass arguments to `get_folder_intelligence_config` via a request object, either of type
2209
+ # {::Google::Cloud::Storage::Control::V2::GetFolderIntelligenceConfigRequest} or an equivalent Hash.
2210
+ #
2211
+ # @param request [::Google::Cloud::Storage::Control::V2::GetFolderIntelligenceConfigRequest, ::Hash]
2212
+ # A request object representing the call parameters. Required. To specify no
2213
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2214
+ # @param options [::Gapic::CallOptions, ::Hash]
2215
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2216
+ #
2217
+ # @overload get_folder_intelligence_config(name: nil)
2218
+ # Pass arguments to `get_folder_intelligence_config` via keyword arguments. Note that at
2219
+ # least one keyword argument is required. To specify no parameters, or to keep all
2220
+ # the default parameter values, pass an empty Hash as a request object (see above).
2221
+ #
2222
+ # @param name [::String]
2223
+ # Required. The name of the `IntelligenceConfig` resource associated with
2224
+ # your folder.
2225
+ #
2226
+ # Format: `folders/{id}/locations/global/intelligenceConfig`
2227
+ #
2228
+ # @yield [response, operation] Access the result along with the RPC operation
2229
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2230
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2231
+ #
2232
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2233
+ #
2234
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2235
+ #
2236
+ # @example Basic example
2237
+ # require "google/cloud/storage/control/v2"
2238
+ #
2239
+ # # Create a client object. The client can be reused for multiple calls.
2240
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
2241
+ #
2242
+ # # Create a request. To set request fields, pass in keyword arguments.
2243
+ # request = Google::Cloud::Storage::Control::V2::GetFolderIntelligenceConfigRequest.new
2244
+ #
2245
+ # # Call the get_folder_intelligence_config method.
2246
+ # result = client.get_folder_intelligence_config request
2247
+ #
2248
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
2249
+ # p result
2250
+ #
2251
+ def get_folder_intelligence_config request, options = nil
2252
+ raise ::ArgumentError, "request must be provided" if request.nil?
2253
+
2254
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetFolderIntelligenceConfigRequest
2255
+
2256
+ # Converts hash and nil to an options object
2257
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2258
+
2259
+ # Customize the options with defaults
2260
+ metadata = @config.rpcs.get_folder_intelligence_config.metadata.to_h
2261
+
2262
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2263
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2264
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2265
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
2266
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2267
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2268
+
2269
+ header_params = {}
2270
+ if request.name
2271
+ header_params["name"] = request.name
2272
+ end
2273
+
2274
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2275
+ metadata[:"x-goog-request-params"] ||= request_params_header
2276
+
2277
+ options.apply_defaults timeout: @config.rpcs.get_folder_intelligence_config.timeout,
2278
+ metadata: metadata,
2279
+ retry_policy: @config.rpcs.get_folder_intelligence_config.retry_policy
2280
+
2281
+ options.apply_defaults timeout: @config.timeout,
2282
+ metadata: @config.metadata,
2283
+ retry_policy: @config.retry_policy
2284
+
2285
+ @storage_control_stub.call_rpc :get_folder_intelligence_config, request, options: options do |response, operation|
2286
+ yield response, operation if block_given?
2287
+ end
2288
+ rescue ::GRPC::BadStatus => e
2289
+ raise ::Google::Cloud::Error.from_error(e)
2290
+ end
2291
+
2292
+ ##
2293
+ # Updates the Folder scoped singleton IntelligenceConfig resource.
2294
+ #
2295
+ # @overload update_folder_intelligence_config(request, options = nil)
2296
+ # Pass arguments to `update_folder_intelligence_config` via a request object, either of type
2297
+ # {::Google::Cloud::Storage::Control::V2::UpdateFolderIntelligenceConfigRequest} or an equivalent Hash.
2298
+ #
2299
+ # @param request [::Google::Cloud::Storage::Control::V2::UpdateFolderIntelligenceConfigRequest, ::Hash]
2300
+ # A request object representing the call parameters. Required. To specify no
2301
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2302
+ # @param options [::Gapic::CallOptions, ::Hash]
2303
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2304
+ #
2305
+ # @overload update_folder_intelligence_config(intelligence_config: nil, update_mask: nil, request_id: nil)
2306
+ # Pass arguments to `update_folder_intelligence_config` via keyword arguments. Note that at
2307
+ # least one keyword argument is required. To specify no parameters, or to keep all
2308
+ # the default parameter values, pass an empty Hash as a request object (see above).
2309
+ #
2310
+ # @param intelligence_config [::Google::Cloud::Storage::Control::V2::IntelligenceConfig, ::Hash]
2311
+ # Required. The `IntelligenceConfig` resource to be updated.
2312
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2313
+ # Required. The `update_mask` that specifies the fields within the
2314
+ # `IntelligenceConfig` resource that should be modified by this update. Only
2315
+ # the listed fields are updated.
2316
+ # @param request_id [::String]
2317
+ # Optional. The ID that uniquely identifies the request, preventing duplicate
2318
+ # processing.
2319
+ #
2320
+ # @yield [response, operation] Access the result along with the RPC operation
2321
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2322
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2323
+ #
2324
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2325
+ #
2326
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2327
+ #
2328
+ # @example Basic example
2329
+ # require "google/cloud/storage/control/v2"
2330
+ #
2331
+ # # Create a client object. The client can be reused for multiple calls.
2332
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
2333
+ #
2334
+ # # Create a request. To set request fields, pass in keyword arguments.
2335
+ # request = Google::Cloud::Storage::Control::V2::UpdateFolderIntelligenceConfigRequest.new
2336
+ #
2337
+ # # Call the update_folder_intelligence_config method.
2338
+ # result = client.update_folder_intelligence_config request
2339
+ #
2340
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
2341
+ # p result
2342
+ #
2343
+ def update_folder_intelligence_config request, options = nil
2344
+ raise ::ArgumentError, "request must be provided" if request.nil?
2345
+
2346
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::UpdateFolderIntelligenceConfigRequest
2347
+
2348
+ # Converts hash and nil to an options object
2349
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2350
+
2351
+ # Customize the options with defaults
2352
+ metadata = @config.rpcs.update_folder_intelligence_config.metadata.to_h
2353
+
2354
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2355
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2356
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2357
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
2358
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2359
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2360
+
2361
+ header_params = {}
2362
+ if request.intelligence_config&.name
2363
+ header_params["intelligence_config.name"] = request.intelligence_config.name
2364
+ end
2365
+
2366
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2367
+ metadata[:"x-goog-request-params"] ||= request_params_header
2368
+
2369
+ options.apply_defaults timeout: @config.rpcs.update_folder_intelligence_config.timeout,
2370
+ metadata: metadata,
2371
+ retry_policy: @config.rpcs.update_folder_intelligence_config.retry_policy
2372
+
2373
+ options.apply_defaults timeout: @config.timeout,
2374
+ metadata: @config.metadata,
2375
+ retry_policy: @config.retry_policy
2376
+
2377
+ @storage_control_stub.call_rpc :update_folder_intelligence_config, request, options: options do |response, operation|
2378
+ yield response, operation if block_given?
2379
+ end
2380
+ rescue ::GRPC::BadStatus => e
2381
+ raise ::Google::Cloud::Error.from_error(e)
2382
+ end
2383
+
2384
+ ##
2385
+ # Returns the Organization scoped singleton IntelligenceConfig resource.
2386
+ #
2387
+ # @overload get_organization_intelligence_config(request, options = nil)
2388
+ # Pass arguments to `get_organization_intelligence_config` via a request object, either of type
2389
+ # {::Google::Cloud::Storage::Control::V2::GetOrganizationIntelligenceConfigRequest} or an equivalent Hash.
2390
+ #
2391
+ # @param request [::Google::Cloud::Storage::Control::V2::GetOrganizationIntelligenceConfigRequest, ::Hash]
2392
+ # A request object representing the call parameters. Required. To specify no
2393
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2394
+ # @param options [::Gapic::CallOptions, ::Hash]
2395
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2396
+ #
2397
+ # @overload get_organization_intelligence_config(name: nil)
2398
+ # Pass arguments to `get_organization_intelligence_config` via keyword arguments. Note that at
2399
+ # least one keyword argument is required. To specify no parameters, or to keep all
2400
+ # the default parameter values, pass an empty Hash as a request object (see above).
2401
+ #
2402
+ # @param name [::String]
2403
+ # Required. The name of the `IntelligenceConfig` resource associated with
2404
+ # your organization.
2405
+ #
2406
+ # Format: `organizations/{org_id}/locations/global/intelligenceConfig`
2407
+ #
2408
+ # @yield [response, operation] Access the result along with the RPC operation
2409
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2410
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2411
+ #
2412
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2413
+ #
2414
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2415
+ #
2416
+ # @example Basic example
2417
+ # require "google/cloud/storage/control/v2"
2418
+ #
2419
+ # # Create a client object. The client can be reused for multiple calls.
2420
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
2421
+ #
2422
+ # # Create a request. To set request fields, pass in keyword arguments.
2423
+ # request = Google::Cloud::Storage::Control::V2::GetOrganizationIntelligenceConfigRequest.new
2424
+ #
2425
+ # # Call the get_organization_intelligence_config method.
2426
+ # result = client.get_organization_intelligence_config request
2427
+ #
2428
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
2429
+ # p result
2430
+ #
2431
+ def get_organization_intelligence_config request, options = nil
2432
+ raise ::ArgumentError, "request must be provided" if request.nil?
2433
+
2434
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::GetOrganizationIntelligenceConfigRequest
2435
+
2436
+ # Converts hash and nil to an options object
2437
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2438
+
2439
+ # Customize the options with defaults
2440
+ metadata = @config.rpcs.get_organization_intelligence_config.metadata.to_h
2441
+
2442
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2443
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2444
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2445
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
2446
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2447
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2448
+
2449
+ header_params = {}
2450
+ if request.name
2451
+ header_params["name"] = request.name
2452
+ end
2453
+
2454
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2455
+ metadata[:"x-goog-request-params"] ||= request_params_header
2456
+
2457
+ options.apply_defaults timeout: @config.rpcs.get_organization_intelligence_config.timeout,
2458
+ metadata: metadata,
2459
+ retry_policy: @config.rpcs.get_organization_intelligence_config.retry_policy
2460
+
2461
+ options.apply_defaults timeout: @config.timeout,
2462
+ metadata: @config.metadata,
2463
+ retry_policy: @config.retry_policy
2464
+
2465
+ @storage_control_stub.call_rpc :get_organization_intelligence_config, request, options: options do |response, operation|
2466
+ yield response, operation if block_given?
2467
+ end
2468
+ rescue ::GRPC::BadStatus => e
2469
+ raise ::Google::Cloud::Error.from_error(e)
2470
+ end
2471
+
2472
+ ##
2473
+ # Updates the Organization scoped singleton IntelligenceConfig resource.
2474
+ #
2475
+ # @overload update_organization_intelligence_config(request, options = nil)
2476
+ # Pass arguments to `update_organization_intelligence_config` via a request object, either of type
2477
+ # {::Google::Cloud::Storage::Control::V2::UpdateOrganizationIntelligenceConfigRequest} or an equivalent Hash.
2478
+ #
2479
+ # @param request [::Google::Cloud::Storage::Control::V2::UpdateOrganizationIntelligenceConfigRequest, ::Hash]
2480
+ # A request object representing the call parameters. Required. To specify no
2481
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2482
+ # @param options [::Gapic::CallOptions, ::Hash]
2483
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2484
+ #
2485
+ # @overload update_organization_intelligence_config(intelligence_config: nil, update_mask: nil, request_id: nil)
2486
+ # Pass arguments to `update_organization_intelligence_config` via keyword arguments. Note that at
2487
+ # least one keyword argument is required. To specify no parameters, or to keep all
2488
+ # the default parameter values, pass an empty Hash as a request object (see above).
2489
+ #
2490
+ # @param intelligence_config [::Google::Cloud::Storage::Control::V2::IntelligenceConfig, ::Hash]
2491
+ # Required. The `IntelligenceConfig` resource to be updated.
2492
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2493
+ # Required. The `update_mask` that specifies the fields within the
2494
+ # `IntelligenceConfig` resource that should be modified by this update. Only
2495
+ # the listed fields are updated.
2496
+ # @param request_id [::String]
2497
+ # Optional. The ID that uniquely identifies the request, preventing duplicate
2498
+ # processing.
2499
+ #
2500
+ # @yield [response, operation] Access the result along with the RPC operation
2501
+ # @yieldparam response [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2502
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2503
+ #
2504
+ # @return [::Google::Cloud::Storage::Control::V2::IntelligenceConfig]
2505
+ #
2506
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2507
+ #
2508
+ # @example Basic example
2509
+ # require "google/cloud/storage/control/v2"
2510
+ #
2511
+ # # Create a client object. The client can be reused for multiple calls.
2512
+ # client = Google::Cloud::Storage::Control::V2::StorageControl::Client.new
2513
+ #
2514
+ # # Create a request. To set request fields, pass in keyword arguments.
2515
+ # request = Google::Cloud::Storage::Control::V2::UpdateOrganizationIntelligenceConfigRequest.new
2516
+ #
2517
+ # # Call the update_organization_intelligence_config method.
2518
+ # result = client.update_organization_intelligence_config request
2519
+ #
2520
+ # # The returned object is of type Google::Cloud::Storage::Control::V2::IntelligenceConfig.
2521
+ # p result
2522
+ #
2523
+ def update_organization_intelligence_config request, options = nil
2524
+ raise ::ArgumentError, "request must be provided" if request.nil?
2525
+
2526
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Storage::Control::V2::UpdateOrganizationIntelligenceConfigRequest
2527
+
2528
+ # Converts hash and nil to an options object
2529
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2530
+
2531
+ # Customize the options with defaults
2532
+ metadata = @config.rpcs.update_organization_intelligence_config.metadata.to_h
2533
+
2534
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2535
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2536
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2537
+ gapic_version: ::Google::Cloud::Storage::Control::V2::VERSION
2538
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2539
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2540
+
2541
+ header_params = {}
2542
+ if request.intelligence_config&.name
2543
+ header_params["intelligence_config.name"] = request.intelligence_config.name
2544
+ end
2545
+
2546
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2547
+ metadata[:"x-goog-request-params"] ||= request_params_header
2548
+
2549
+ options.apply_defaults timeout: @config.rpcs.update_organization_intelligence_config.timeout,
2550
+ metadata: metadata,
2551
+ retry_policy: @config.rpcs.update_organization_intelligence_config.retry_policy
2552
+
2553
+ options.apply_defaults timeout: @config.timeout,
2554
+ metadata: @config.metadata,
2555
+ retry_policy: @config.retry_policy
2556
+
2557
+ @storage_control_stub.call_rpc :update_organization_intelligence_config, request, options: options do |response, operation|
2558
+ yield response, operation if block_given?
2559
+ end
2560
+ rescue ::GRPC::BadStatus => e
2561
+ raise ::Google::Cloud::Error.from_error(e)
2562
+ end
2563
+
2564
+ ##
2565
+ # Configuration class for the StorageControl API.
2566
+ #
2567
+ # This class represents the configuration for StorageControl,
2568
+ # providing control over timeouts, retry behavior, logging, transport
2569
+ # parameters, and other low-level controls. Certain parameters can also be
2570
+ # applied individually to specific RPCs. See
2571
+ # {::Google::Cloud::Storage::Control::V2::StorageControl::Client::Configuration::Rpcs}
2572
+ # for a list of RPCs that can be configured independently.
2573
+ #
2574
+ # Configuration can be applied globally to all clients, or to a single client
2575
+ # on construction.
2576
+ #
2577
+ # @example
2578
+ #
2579
+ # # Modify the global config, setting the timeout for
2580
+ # # create_folder to 20 seconds,
2581
+ # # and all remaining timeouts to 10 seconds.
2582
+ # ::Google::Cloud::Storage::Control::V2::StorageControl::Client.configure do |config|
2583
+ # config.timeout = 10.0
2584
+ # config.rpcs.create_folder.timeout = 20.0
2585
+ # end
2586
+ #
2587
+ # # Apply the above configuration only to a new client.
2588
+ # client = ::Google::Cloud::Storage::Control::V2::StorageControl::Client.new do |config|
2589
+ # config.timeout = 10.0
2590
+ # config.rpcs.create_folder.timeout = 20.0
2591
+ # end
2592
+ #
2593
+ # @!attribute [rw] endpoint
2594
+ # A custom service endpoint, as a hostname or hostname:port. The default is
2595
+ # nil, indicating to use the default endpoint in the current universe domain.
2596
+ # @return [::String,nil]
2597
+ # @!attribute [rw] credentials
2598
+ # Credentials to send with calls. You may provide any of the following types:
2599
+ # * (`String`) The path to a service account key file in JSON format
2600
+ # * (`Hash`) A service account key as a Hash
2601
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
2602
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
2603
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2604
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2605
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2606
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2607
+ # * (`nil`) indicating no credentials
2608
+ #
2609
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2610
+ # external source for authentication to Google Cloud, you must validate it before
2611
+ # providing it to a Google API client library. Providing an unvalidated credential
2612
+ # configuration to Google APIs can compromise the security of your systems and data.
2613
+ # For more information, refer to [Validate credential configurations from external
2614
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2615
+ # @return [::Object]
2616
+ # @!attribute [rw] scope
2617
+ # The OAuth scopes
2618
+ # @return [::Array<::String>]
2619
+ # @!attribute [rw] lib_name
2620
+ # The library name as recorded in instrumentation and logging
2621
+ # @return [::String]
2622
+ # @!attribute [rw] lib_version
2623
+ # The library version as recorded in instrumentation and logging
2624
+ # @return [::String]
2625
+ # @!attribute [rw] channel_args
2626
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
2627
+ # `GRPC::Core::Channel` object is provided as the credential.
2628
+ # @return [::Hash]
2629
+ # @!attribute [rw] interceptors
2630
+ # An array of interceptors that are run before calls are executed.
2631
+ # @return [::Array<::GRPC::ClientInterceptor>]
2632
+ # @!attribute [rw] timeout
2633
+ # The call timeout in seconds.
2634
+ # @return [::Numeric]
2635
+ # @!attribute [rw] metadata
2636
+ # Additional gRPC headers to be sent with the call.
2637
+ # @return [::Hash{::Symbol=>::String}]
2638
+ # @!attribute [rw] retry_policy
2639
+ # The retry policy. The value is a hash with the following keys:
2640
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2641
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2642
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2643
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2644
+ # trigger a retry.
2645
+ # @return [::Hash]
2646
+ # @!attribute [rw] quota_project
2647
+ # A separate project against which to charge quota.
2648
+ # @return [::String]
2649
+ # @!attribute [rw] universe_domain
2650
+ # The universe domain within which to make requests. This determines the
2651
+ # default endpoint URL. The default value of nil uses the environment
2652
+ # universe (usually the default "googleapis.com" universe).
2653
+ # @return [::String,nil]
2654
+ # @!attribute [rw] logger
2655
+ # A custom logger to use for request/response debug logging, or the value
2656
+ # `:default` (the default) to construct a default logger, or `nil` to
2657
+ # explicitly disable logging.
2658
+ # @return [::Logger,:default,nil]
2659
+ #
2660
+ class Configuration
2661
+ extend ::Gapic::Config
2662
+
2663
+ # @private
2664
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
2665
+ DEFAULT_ENDPOINT = "storage.googleapis.com"
2666
+
2667
+ config_attr :endpoint, nil, ::String, nil
2668
+ config_attr :credentials, nil do |value|
2669
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
2670
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
2671
+ allowed.any? { |klass| klass === value }
2672
+ end
2673
+ config_attr :scope, nil, ::String, ::Array, nil
2674
+ config_attr :lib_name, nil, ::String, nil
2675
+ config_attr :lib_version, nil, ::String, nil
2676
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
2677
+ config_attr :interceptors, nil, ::Array, nil
2678
+ config_attr :timeout, nil, ::Numeric, nil
2679
+ config_attr :metadata, nil, ::Hash, nil
2680
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2681
+ config_attr :quota_project, nil, ::String, nil
2682
+ config_attr :universe_domain, nil, ::String, nil
2683
+ config_attr :logger, :default, ::Logger, nil, :default
2684
+
2685
+ # @private
2686
+ def initialize parent_config = nil
2687
+ @parent_config = parent_config unless parent_config.nil?
2688
+
2689
+ yield self if block_given?
2690
+ end
2691
+
2692
+ ##
2693
+ # Configurations for individual RPCs
2694
+ # @return [Rpcs]
2695
+ #
2696
+ def rpcs
2697
+ @rpcs ||= begin
2698
+ parent_rpcs = nil
2699
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
2700
+ Rpcs.new parent_rpcs
2701
+ end
2702
+ end
2703
+
2704
+ ##
2705
+ # Configuration for the channel pool
2706
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
2707
+ #
2708
+ def channel_pool
2709
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
2710
+ end
2711
+
2712
+ ##
2713
+ # Configuration RPC class for the StorageControl API.
2714
+ #
2715
+ # Includes fields providing the configuration for each RPC in this service.
2716
+ # Each configuration object is of type `Gapic::Config::Method` and includes
2717
+ # the following configuration fields:
2718
+ #
2719
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
2720
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2721
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2722
+ # include the following keys:
2723
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2724
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2725
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2726
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2727
+ # trigger a retry.
2728
+ #
2729
+ class Rpcs
2730
+ ##
2731
+ # RPC-specific configuration for `create_folder`
2732
+ # @return [::Gapic::Config::Method]
1433
2733
  #
1434
2734
  attr_reader :create_folder
1435
2735
  ##
@@ -1477,6 +2777,71 @@ module Google
1477
2777
  # @return [::Gapic::Config::Method]
1478
2778
  #
1479
2779
  attr_reader :list_managed_folders
2780
+ ##
2781
+ # RPC-specific configuration for `create_anywhere_cache`
2782
+ # @return [::Gapic::Config::Method]
2783
+ #
2784
+ attr_reader :create_anywhere_cache
2785
+ ##
2786
+ # RPC-specific configuration for `update_anywhere_cache`
2787
+ # @return [::Gapic::Config::Method]
2788
+ #
2789
+ attr_reader :update_anywhere_cache
2790
+ ##
2791
+ # RPC-specific configuration for `disable_anywhere_cache`
2792
+ # @return [::Gapic::Config::Method]
2793
+ #
2794
+ attr_reader :disable_anywhere_cache
2795
+ ##
2796
+ # RPC-specific configuration for `pause_anywhere_cache`
2797
+ # @return [::Gapic::Config::Method]
2798
+ #
2799
+ attr_reader :pause_anywhere_cache
2800
+ ##
2801
+ # RPC-specific configuration for `resume_anywhere_cache`
2802
+ # @return [::Gapic::Config::Method]
2803
+ #
2804
+ attr_reader :resume_anywhere_cache
2805
+ ##
2806
+ # RPC-specific configuration for `get_anywhere_cache`
2807
+ # @return [::Gapic::Config::Method]
2808
+ #
2809
+ attr_reader :get_anywhere_cache
2810
+ ##
2811
+ # RPC-specific configuration for `list_anywhere_caches`
2812
+ # @return [::Gapic::Config::Method]
2813
+ #
2814
+ attr_reader :list_anywhere_caches
2815
+ ##
2816
+ # RPC-specific configuration for `get_project_intelligence_config`
2817
+ # @return [::Gapic::Config::Method]
2818
+ #
2819
+ attr_reader :get_project_intelligence_config
2820
+ ##
2821
+ # RPC-specific configuration for `update_project_intelligence_config`
2822
+ # @return [::Gapic::Config::Method]
2823
+ #
2824
+ attr_reader :update_project_intelligence_config
2825
+ ##
2826
+ # RPC-specific configuration for `get_folder_intelligence_config`
2827
+ # @return [::Gapic::Config::Method]
2828
+ #
2829
+ attr_reader :get_folder_intelligence_config
2830
+ ##
2831
+ # RPC-specific configuration for `update_folder_intelligence_config`
2832
+ # @return [::Gapic::Config::Method]
2833
+ #
2834
+ attr_reader :update_folder_intelligence_config
2835
+ ##
2836
+ # RPC-specific configuration for `get_organization_intelligence_config`
2837
+ # @return [::Gapic::Config::Method]
2838
+ #
2839
+ attr_reader :get_organization_intelligence_config
2840
+ ##
2841
+ # RPC-specific configuration for `update_organization_intelligence_config`
2842
+ # @return [::Gapic::Config::Method]
2843
+ #
2844
+ attr_reader :update_organization_intelligence_config
1480
2845
 
1481
2846
  # @private
1482
2847
  def initialize parent_rpcs = nil
@@ -1500,6 +2865,32 @@ module Google
1500
2865
  @get_managed_folder = ::Gapic::Config::Method.new get_managed_folder_config
1501
2866
  list_managed_folders_config = parent_rpcs.list_managed_folders if parent_rpcs.respond_to? :list_managed_folders
1502
2867
  @list_managed_folders = ::Gapic::Config::Method.new list_managed_folders_config
2868
+ create_anywhere_cache_config = parent_rpcs.create_anywhere_cache if parent_rpcs.respond_to? :create_anywhere_cache
2869
+ @create_anywhere_cache = ::Gapic::Config::Method.new create_anywhere_cache_config
2870
+ update_anywhere_cache_config = parent_rpcs.update_anywhere_cache if parent_rpcs.respond_to? :update_anywhere_cache
2871
+ @update_anywhere_cache = ::Gapic::Config::Method.new update_anywhere_cache_config
2872
+ disable_anywhere_cache_config = parent_rpcs.disable_anywhere_cache if parent_rpcs.respond_to? :disable_anywhere_cache
2873
+ @disable_anywhere_cache = ::Gapic::Config::Method.new disable_anywhere_cache_config
2874
+ pause_anywhere_cache_config = parent_rpcs.pause_anywhere_cache if parent_rpcs.respond_to? :pause_anywhere_cache
2875
+ @pause_anywhere_cache = ::Gapic::Config::Method.new pause_anywhere_cache_config
2876
+ resume_anywhere_cache_config = parent_rpcs.resume_anywhere_cache if parent_rpcs.respond_to? :resume_anywhere_cache
2877
+ @resume_anywhere_cache = ::Gapic::Config::Method.new resume_anywhere_cache_config
2878
+ get_anywhere_cache_config = parent_rpcs.get_anywhere_cache if parent_rpcs.respond_to? :get_anywhere_cache
2879
+ @get_anywhere_cache = ::Gapic::Config::Method.new get_anywhere_cache_config
2880
+ list_anywhere_caches_config = parent_rpcs.list_anywhere_caches if parent_rpcs.respond_to? :list_anywhere_caches
2881
+ @list_anywhere_caches = ::Gapic::Config::Method.new list_anywhere_caches_config
2882
+ get_project_intelligence_config_config = parent_rpcs.get_project_intelligence_config if parent_rpcs.respond_to? :get_project_intelligence_config
2883
+ @get_project_intelligence_config = ::Gapic::Config::Method.new get_project_intelligence_config_config
2884
+ update_project_intelligence_config_config = parent_rpcs.update_project_intelligence_config if parent_rpcs.respond_to? :update_project_intelligence_config
2885
+ @update_project_intelligence_config = ::Gapic::Config::Method.new update_project_intelligence_config_config
2886
+ get_folder_intelligence_config_config = parent_rpcs.get_folder_intelligence_config if parent_rpcs.respond_to? :get_folder_intelligence_config
2887
+ @get_folder_intelligence_config = ::Gapic::Config::Method.new get_folder_intelligence_config_config
2888
+ update_folder_intelligence_config_config = parent_rpcs.update_folder_intelligence_config if parent_rpcs.respond_to? :update_folder_intelligence_config
2889
+ @update_folder_intelligence_config = ::Gapic::Config::Method.new update_folder_intelligence_config_config
2890
+ get_organization_intelligence_config_config = parent_rpcs.get_organization_intelligence_config if parent_rpcs.respond_to? :get_organization_intelligence_config
2891
+ @get_organization_intelligence_config = ::Gapic::Config::Method.new get_organization_intelligence_config_config
2892
+ update_organization_intelligence_config_config = parent_rpcs.update_organization_intelligence_config if parent_rpcs.respond_to? :update_organization_intelligence_config
2893
+ @update_organization_intelligence_config = ::Gapic::Config::Method.new update_organization_intelligence_config_config
1503
2894
 
1504
2895
  yield self if block_given?
1505
2896
  end