google-cloud-filestore-v1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +167 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google-cloud-filestore-v1.rb +21 -0
  7. data/lib/google/cloud/filestore/v1.rb +38 -0
  8. data/lib/google/cloud/filestore/v1/cloud_filestore_manager.rb +68 -0
  9. data/lib/google/cloud/filestore/v1/cloud_filestore_manager/client.rb +1270 -0
  10. data/lib/google/cloud/filestore/v1/cloud_filestore_manager/credentials.rb +47 -0
  11. data/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb +664 -0
  12. data/lib/google/cloud/filestore/v1/cloud_filestore_manager/paths.rb +88 -0
  13. data/lib/google/cloud/filestore/v1/cloud_filestore_service_pb.rb +197 -0
  14. data/lib/google/cloud/filestore/v1/cloud_filestore_service_services_pb.rb +92 -0
  15. data/lib/google/cloud/filestore/v1/version.rb +28 -0
  16. data/proto_docs/README.md +4 -0
  17. data/proto_docs/google/api/field_behavior.rb +71 -0
  18. data/proto_docs/google/api/resource.rb +283 -0
  19. data/proto_docs/google/cloud/common/operation_metadata.rb +54 -0
  20. data/proto_docs/google/cloud/filestore/v1/cloud_filestore_service.rb +561 -0
  21. data/proto_docs/google/longrunning/operations.rb +164 -0
  22. data/proto_docs/google/protobuf/any.rb +141 -0
  23. data/proto_docs/google/protobuf/duration.rb +98 -0
  24. data/proto_docs/google/protobuf/empty.rb +36 -0
  25. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  26. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  27. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  28. data/proto_docs/google/rpc/status.rb +46 -0
  29. metadata +219 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/filestore/v1"
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/filestore/v1/cloud_filestore_manager"
20
+ require "google/cloud/filestore/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Filestore
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/filestore/v1"
29
+ # client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
38
+ require "google/cloud/filestore/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/filestore/v1/version"
24
+
25
+ require "google/cloud/filestore/v1/cloud_filestore_manager/credentials"
26
+ require "google/cloud/filestore/v1/cloud_filestore_manager/paths"
27
+ require "google/cloud/filestore/v1/cloud_filestore_manager/operations"
28
+ require "google/cloud/filestore/v1/cloud_filestore_manager/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Filestore
33
+ module V1
34
+ ##
35
+ # Configures and manages Cloud Filestore resources.
36
+ #
37
+ # Cloud Filestore Manager v1.
38
+ #
39
+ # The `file.googleapis.com` service implements the Cloud Filestore API and
40
+ # defines the following resource model for managing instances:
41
+ # * The service works with a collection of cloud projects, named: `/projects/*`
42
+ # * Each project has a collection of available locations, named: `/locations/*`
43
+ # * Each location has a collection of instances and backups, named:
44
+ # `/instances/*` and `/backups/*` respectively.
45
+ # * As such, Cloud Filestore instances are resources of the form:
46
+ # `/projects/{project_number}/locations/{location_id}/instances/{instance_id}`
47
+ # and backups are resources of the form:
48
+ # `/projects/{project_number}/locations/{location_id}/backup/{backup_id}`
49
+ #
50
+ # Note that location_id must be a GCP `zone` for instances and but to a GCP
51
+ # `region` for backups; for example:
52
+ # * `projects/12345/locations/us-central1-c/instances/my-filestore`
53
+ # * `projects/12345/locations/us-central1/backups/my-backup`
54
+ #
55
+ # To load this service and instantiate a client:
56
+ #
57
+ # require "google/cloud/filestore/v1/cloud_filestore_manager"
58
+ # client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new
59
+ #
60
+ module CloudFilestoreManager
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+ helper_path = ::File.join __dir__, "cloud_filestore_manager", "helpers.rb"
68
+ require "google/cloud/filestore/v1/cloud_filestore_manager/helpers" if ::File.file? helper_path
@@ -0,0 +1,1270 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/filestore/v1/cloud_filestore_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Filestore
25
+ module V1
26
+ module CloudFilestoreManager
27
+ ##
28
+ # Client for the CloudFilestoreManager service.
29
+ #
30
+ # Configures and manages Cloud Filestore resources.
31
+ #
32
+ # Cloud Filestore Manager v1.
33
+ #
34
+ # The `file.googleapis.com` service implements the Cloud Filestore API and
35
+ # defines the following resource model for managing instances:
36
+ # * The service works with a collection of cloud projects, named: `/projects/*`
37
+ # * Each project has a collection of available locations, named: `/locations/*`
38
+ # * Each location has a collection of instances and backups, named:
39
+ # `/instances/*` and `/backups/*` respectively.
40
+ # * As such, Cloud Filestore instances are resources of the form:
41
+ # `/projects/{project_number}/locations/{location_id}/instances/{instance_id}`
42
+ # and backups are resources of the form:
43
+ # `/projects/{project_number}/locations/{location_id}/backup/{backup_id}`
44
+ #
45
+ # Note that location_id must be a GCP `zone` for instances and but to a GCP
46
+ # `region` for backups; for example:
47
+ # * `projects/12345/locations/us-central1-c/instances/my-filestore`
48
+ # * `projects/12345/locations/us-central1/backups/my-backup`
49
+ #
50
+ class Client
51
+ include Paths
52
+
53
+ # @private
54
+ attr_reader :cloud_filestore_manager_stub
55
+
56
+ ##
57
+ # Configure the CloudFilestoreManager Client class.
58
+ #
59
+ # See {::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client::Configuration}
60
+ # for a description of the configuration fields.
61
+ #
62
+ # @example
63
+ #
64
+ # # Modify the configuration for all CloudFilestoreManager clients
65
+ # ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.configure do |config|
66
+ # config.timeout = 10.0
67
+ # end
68
+ #
69
+ # @yield [config] Configure the Client client.
70
+ # @yieldparam config [Client::Configuration]
71
+ #
72
+ # @return [Client::Configuration]
73
+ #
74
+ def self.configure
75
+ @configure ||= begin
76
+ namespace = ["Google", "Cloud", "Filestore", "V1"]
77
+ parent_config = while namespace.any?
78
+ parent_name = namespace.join "::"
79
+ parent_const = const_get parent_name
80
+ break parent_const.configure if parent_const.respond_to? :configure
81
+ namespace.pop
82
+ end
83
+ default_config = Client::Configuration.new parent_config
84
+
85
+ default_config.rpcs.list_instances.timeout = 60.0
86
+ default_config.rpcs.list_instances.retry_policy = {
87
+ initial_delay: 0.25, max_delay: 32.0, multiplier: 1.3, retry_codes: [14]
88
+ }
89
+
90
+ default_config.rpcs.get_instance.timeout = 60.0
91
+ default_config.rpcs.get_instance.retry_policy = {
92
+ initial_delay: 0.25, max_delay: 32.0, multiplier: 1.3, retry_codes: [14]
93
+ }
94
+
95
+ default_config.rpcs.create_instance.timeout = 60_000.0
96
+
97
+ default_config.rpcs.update_instance.timeout = 14_400.0
98
+
99
+ default_config.rpcs.restore_instance.timeout = 60_000.0
100
+
101
+ default_config.rpcs.delete_instance.timeout = 600.0
102
+
103
+ default_config.rpcs.list_backups.timeout = 60.0
104
+ default_config.rpcs.list_backups.retry_policy = {
105
+ initial_delay: 0.25, max_delay: 32.0, multiplier: 1.3, retry_codes: [14]
106
+ }
107
+
108
+ default_config.rpcs.get_backup.timeout = 60.0
109
+ default_config.rpcs.get_backup.retry_policy = {
110
+ initial_delay: 0.25, max_delay: 32.0, multiplier: 1.3, retry_codes: [14]
111
+ }
112
+
113
+ default_config.rpcs.create_backup.timeout = 60_000.0
114
+
115
+ default_config.rpcs.delete_backup.timeout = 600.0
116
+
117
+ default_config.rpcs.update_backup.timeout = 600.0
118
+
119
+ default_config
120
+ end
121
+ yield @configure if block_given?
122
+ @configure
123
+ end
124
+
125
+ ##
126
+ # Configure the CloudFilestoreManager Client instance.
127
+ #
128
+ # The configuration is set to the derived mode, meaning that values can be changed,
129
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
130
+ # should be made on {Client.configure}.
131
+ #
132
+ # See {::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client::Configuration}
133
+ # for a description of the configuration fields.
134
+ #
135
+ # @yield [config] Configure the Client client.
136
+ # @yieldparam config [Client::Configuration]
137
+ #
138
+ # @return [Client::Configuration]
139
+ #
140
+ def configure
141
+ yield @config if block_given?
142
+ @config
143
+ end
144
+
145
+ ##
146
+ # Create a new CloudFilestoreManager client object.
147
+ #
148
+ # @example
149
+ #
150
+ # # Create a client using the default configuration
151
+ # client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new
152
+ #
153
+ # # Create a client using a custom configuration
154
+ # client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new do |config|
155
+ # config.timeout = 10.0
156
+ # end
157
+ #
158
+ # @yield [config] Configure the CloudFilestoreManager client.
159
+ # @yieldparam config [Client::Configuration]
160
+ #
161
+ def initialize
162
+ # These require statements are intentionally placed here to initialize
163
+ # the gRPC module only when it's required.
164
+ # See https://github.com/googleapis/toolkit/issues/446
165
+ require "gapic/grpc"
166
+ require "google/cloud/filestore/v1/cloud_filestore_service_services_pb"
167
+
168
+ # Create the configuration object
169
+ @config = Configuration.new Client.configure
170
+
171
+ # Yield the configuration if needed
172
+ yield @config if block_given?
173
+
174
+ # Create credentials
175
+ credentials = @config.credentials
176
+ # Use self-signed JWT if the endpoint is unchanged from default,
177
+ # but only if the default endpoint does not have a region prefix.
178
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
179
+ !@config.endpoint.split(".").first.include?("-")
180
+ credentials ||= Credentials.default scope: @config.scope,
181
+ enable_self_signed_jwt: enable_self_signed_jwt
182
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
183
+ credentials = Credentials.new credentials, scope: @config.scope
184
+ end
185
+ @quota_project_id = @config.quota_project
186
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
187
+
188
+ @operations_client = Operations.new do |config|
189
+ config.credentials = credentials
190
+ config.endpoint = @config.endpoint
191
+ end
192
+
193
+ @cloud_filestore_manager_stub = ::Gapic::ServiceStub.new(
194
+ ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Stub,
195
+ credentials: credentials,
196
+ endpoint: @config.endpoint,
197
+ channel_args: @config.channel_args,
198
+ interceptors: @config.interceptors
199
+ )
200
+ end
201
+
202
+ ##
203
+ # Get the associated client for long-running operations.
204
+ #
205
+ # @return [::Google::Cloud::Filestore::V1::CloudFilestoreManager::Operations]
206
+ #
207
+ attr_reader :operations_client
208
+
209
+ # Service calls
210
+
211
+ ##
212
+ # Lists all instances in a project for either a specified location
213
+ # or for all locations.
214
+ #
215
+ # @overload list_instances(request, options = nil)
216
+ # Pass arguments to `list_instances` via a request object, either of type
217
+ # {::Google::Cloud::Filestore::V1::ListInstancesRequest} or an equivalent Hash.
218
+ #
219
+ # @param request [::Google::Cloud::Filestore::V1::ListInstancesRequest, ::Hash]
220
+ # A request object representing the call parameters. Required. To specify no
221
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
222
+ # @param options [::Gapic::CallOptions, ::Hash]
223
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
224
+ #
225
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, order_by: nil, filter: nil)
226
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
227
+ # least one keyword argument is required. To specify no parameters, or to keep all
228
+ # the default parameter values, pass an empty Hash as a request object (see above).
229
+ #
230
+ # @param parent [::String]
231
+ # Required. The project and location for which to retrieve instance information,
232
+ # in the format `projects/{project_id}/locations/{location}`. In Cloud
233
+ # Filestore, locations map to GCP zones, for example **us-west1-b**. To
234
+ # retrieve instance information for all locations, use "-" for the
235
+ # `{location}` value.
236
+ # @param page_size [::Integer]
237
+ # The maximum number of items to return.
238
+ # @param page_token [::String]
239
+ # The next_page_token value to use if there are additional
240
+ # results to retrieve for this list request.
241
+ # @param order_by [::String]
242
+ # Sort results. Supported values are "name", "name desc" or "" (unsorted).
243
+ # @param filter [::String]
244
+ # List filter.
245
+ #
246
+ # @yield [response, operation] Access the result along with the RPC operation
247
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Filestore::V1::Instance>]
248
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
249
+ #
250
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Filestore::V1::Instance>]
251
+ #
252
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
253
+ #
254
+ def list_instances request, options = nil
255
+ raise ::ArgumentError, "request must be provided" if request.nil?
256
+
257
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::ListInstancesRequest
258
+
259
+ # Converts hash and nil to an options object
260
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
261
+
262
+ # Customize the options with defaults
263
+ metadata = @config.rpcs.list_instances.metadata.to_h
264
+
265
+ # Set x-goog-api-client and x-goog-user-project headers
266
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
267
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
268
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
269
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
270
+
271
+ header_params = {
272
+ "parent" => request.parent
273
+ }
274
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
275
+ metadata[:"x-goog-request-params"] ||= request_params_header
276
+
277
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
278
+ metadata: metadata,
279
+ retry_policy: @config.rpcs.list_instances.retry_policy
280
+
281
+ options.apply_defaults timeout: @config.timeout,
282
+ metadata: @config.metadata,
283
+ retry_policy: @config.retry_policy
284
+
285
+ @cloud_filestore_manager_stub.call_rpc :list_instances, request, options: options do |response, operation|
286
+ response = ::Gapic::PagedEnumerable.new @cloud_filestore_manager_stub, :list_instances, request, response, operation, options
287
+ yield response, operation if block_given?
288
+ return response
289
+ end
290
+ rescue ::GRPC::BadStatus => e
291
+ raise ::Google::Cloud::Error.from_error(e)
292
+ end
293
+
294
+ ##
295
+ # Gets the details of a specific instance.
296
+ #
297
+ # @overload get_instance(request, options = nil)
298
+ # Pass arguments to `get_instance` via a request object, either of type
299
+ # {::Google::Cloud::Filestore::V1::GetInstanceRequest} or an equivalent Hash.
300
+ #
301
+ # @param request [::Google::Cloud::Filestore::V1::GetInstanceRequest, ::Hash]
302
+ # A request object representing the call parameters. Required. To specify no
303
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
304
+ # @param options [::Gapic::CallOptions, ::Hash]
305
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
306
+ #
307
+ # @overload get_instance(name: nil)
308
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
309
+ # least one keyword argument is required. To specify no parameters, or to keep all
310
+ # the default parameter values, pass an empty Hash as a request object (see above).
311
+ #
312
+ # @param name [::String]
313
+ # Required. The instance resource name, in the format
314
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`.
315
+ #
316
+ # @yield [response, operation] Access the result along with the RPC operation
317
+ # @yieldparam response [::Google::Cloud::Filestore::V1::Instance]
318
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
319
+ #
320
+ # @return [::Google::Cloud::Filestore::V1::Instance]
321
+ #
322
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
323
+ #
324
+ def get_instance request, options = nil
325
+ raise ::ArgumentError, "request must be provided" if request.nil?
326
+
327
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::GetInstanceRequest
328
+
329
+ # Converts hash and nil to an options object
330
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
331
+
332
+ # Customize the options with defaults
333
+ metadata = @config.rpcs.get_instance.metadata.to_h
334
+
335
+ # Set x-goog-api-client and x-goog-user-project headers
336
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
337
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
338
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
339
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
340
+
341
+ header_params = {
342
+ "name" => request.name
343
+ }
344
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
345
+ metadata[:"x-goog-request-params"] ||= request_params_header
346
+
347
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
348
+ metadata: metadata,
349
+ retry_policy: @config.rpcs.get_instance.retry_policy
350
+
351
+ options.apply_defaults timeout: @config.timeout,
352
+ metadata: @config.metadata,
353
+ retry_policy: @config.retry_policy
354
+
355
+ @cloud_filestore_manager_stub.call_rpc :get_instance, request, options: options do |response, operation|
356
+ yield response, operation if block_given?
357
+ return response
358
+ end
359
+ rescue ::GRPC::BadStatus => e
360
+ raise ::Google::Cloud::Error.from_error(e)
361
+ end
362
+
363
+ ##
364
+ # Creates an instance.
365
+ # When creating from a backup, the capacity of the new instance needs to be
366
+ # equal to or larger than the capacity of the backup (and also equal to or
367
+ # larger than the minimum capacity of the tier).
368
+ #
369
+ # @overload create_instance(request, options = nil)
370
+ # Pass arguments to `create_instance` via a request object, either of type
371
+ # {::Google::Cloud::Filestore::V1::CreateInstanceRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::Filestore::V1::CreateInstanceRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
378
+ #
379
+ # @overload create_instance(parent: nil, instance_id: nil, instance: nil)
380
+ # Pass arguments to `create_instance` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param parent [::String]
385
+ # Required. The instance's project and location, in the format
386
+ # `projects/{project_id}/locations/{location}`. In Cloud Filestore,
387
+ # locations map to GCP zones, for example **us-west1-b**.
388
+ # @param instance_id [::String]
389
+ # Required. The name of the instance to create.
390
+ # The name must be unique for the specified project and location.
391
+ # @param instance [::Google::Cloud::Filestore::V1::Instance, ::Hash]
392
+ # Required. An {::Google::Cloud::Filestore::V1::Instance instance resource}
393
+ #
394
+ # @yield [response, operation] Access the result along with the RPC operation
395
+ # @yieldparam response [::Gapic::Operation]
396
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
397
+ #
398
+ # @return [::Gapic::Operation]
399
+ #
400
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
401
+ #
402
+ def create_instance request, options = nil
403
+ raise ::ArgumentError, "request must be provided" if request.nil?
404
+
405
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::CreateInstanceRequest
406
+
407
+ # Converts hash and nil to an options object
408
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
409
+
410
+ # Customize the options with defaults
411
+ metadata = @config.rpcs.create_instance.metadata.to_h
412
+
413
+ # Set x-goog-api-client and x-goog-user-project headers
414
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
415
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
416
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
417
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
418
+
419
+ header_params = {
420
+ "parent" => request.parent
421
+ }
422
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
423
+ metadata[:"x-goog-request-params"] ||= request_params_header
424
+
425
+ options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
426
+ metadata: metadata,
427
+ retry_policy: @config.rpcs.create_instance.retry_policy
428
+
429
+ options.apply_defaults timeout: @config.timeout,
430
+ metadata: @config.metadata,
431
+ retry_policy: @config.retry_policy
432
+
433
+ @cloud_filestore_manager_stub.call_rpc :create_instance, request, options: options do |response, operation|
434
+ response = ::Gapic::Operation.new response, @operations_client, options: options
435
+ yield response, operation if block_given?
436
+ return response
437
+ end
438
+ rescue ::GRPC::BadStatus => e
439
+ raise ::Google::Cloud::Error.from_error(e)
440
+ end
441
+
442
+ ##
443
+ # Updates the settings of a specific instance.
444
+ #
445
+ # @overload update_instance(request, options = nil)
446
+ # Pass arguments to `update_instance` via a request object, either of type
447
+ # {::Google::Cloud::Filestore::V1::UpdateInstanceRequest} or an equivalent Hash.
448
+ #
449
+ # @param request [::Google::Cloud::Filestore::V1::UpdateInstanceRequest, ::Hash]
450
+ # A request object representing the call parameters. Required. To specify no
451
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
452
+ # @param options [::Gapic::CallOptions, ::Hash]
453
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
454
+ #
455
+ # @overload update_instance(update_mask: nil, instance: nil)
456
+ # Pass arguments to `update_instance` via keyword arguments. Note that at
457
+ # least one keyword argument is required. To specify no parameters, or to keep all
458
+ # the default parameter values, pass an empty Hash as a request object (see above).
459
+ #
460
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
461
+ # Mask of fields to update. At least one path must be supplied in this
462
+ # field. The elements of the repeated paths field may only include these
463
+ # fields:
464
+ #
465
+ # * "description"
466
+ # * "file_shares"
467
+ # * "labels"
468
+ # @param instance [::Google::Cloud::Filestore::V1::Instance, ::Hash]
469
+ # Only fields specified in update_mask are updated.
470
+ #
471
+ # @yield [response, operation] Access the result along with the RPC operation
472
+ # @yieldparam response [::Gapic::Operation]
473
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
474
+ #
475
+ # @return [::Gapic::Operation]
476
+ #
477
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
478
+ #
479
+ def update_instance request, options = nil
480
+ raise ::ArgumentError, "request must be provided" if request.nil?
481
+
482
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::UpdateInstanceRequest
483
+
484
+ # Converts hash and nil to an options object
485
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
486
+
487
+ # Customize the options with defaults
488
+ metadata = @config.rpcs.update_instance.metadata.to_h
489
+
490
+ # Set x-goog-api-client and x-goog-user-project headers
491
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
492
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
493
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
494
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
495
+
496
+ header_params = {
497
+ "instance.name" => request.instance.name
498
+ }
499
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
500
+ metadata[:"x-goog-request-params"] ||= request_params_header
501
+
502
+ options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
503
+ metadata: metadata,
504
+ retry_policy: @config.rpcs.update_instance.retry_policy
505
+
506
+ options.apply_defaults timeout: @config.timeout,
507
+ metadata: @config.metadata,
508
+ retry_policy: @config.retry_policy
509
+
510
+ @cloud_filestore_manager_stub.call_rpc :update_instance, request, options: options do |response, operation|
511
+ response = ::Gapic::Operation.new response, @operations_client, options: options
512
+ yield response, operation if block_given?
513
+ return response
514
+ end
515
+ rescue ::GRPC::BadStatus => e
516
+ raise ::Google::Cloud::Error.from_error(e)
517
+ end
518
+
519
+ ##
520
+ # Restores an existing instance's file share from a backup.
521
+ #
522
+ # The capacity of the instance needs to be equal to or larger than the
523
+ # capacity of the backup (and also equal to or larger than the minimum
524
+ # capacity of the tier).
525
+ #
526
+ # @overload restore_instance(request, options = nil)
527
+ # Pass arguments to `restore_instance` via a request object, either of type
528
+ # {::Google::Cloud::Filestore::V1::RestoreInstanceRequest} or an equivalent Hash.
529
+ #
530
+ # @param request [::Google::Cloud::Filestore::V1::RestoreInstanceRequest, ::Hash]
531
+ # A request object representing the call parameters. Required. To specify no
532
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
533
+ # @param options [::Gapic::CallOptions, ::Hash]
534
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
535
+ #
536
+ # @overload restore_instance(name: nil, file_share: nil, source_backup: nil)
537
+ # Pass arguments to `restore_instance` via keyword arguments. Note that at
538
+ # least one keyword argument is required. To specify no parameters, or to keep all
539
+ # the default parameter values, pass an empty Hash as a request object (see above).
540
+ #
541
+ # @param name [::String]
542
+ # Required. The resource name of the instance, in the format
543
+ # `projects/{project_number}/locations/{location_id}/instances/{instance_id}`.
544
+ # @param file_share [::String]
545
+ # Required. Name of the file share in the Cloud Filestore instance that the backup
546
+ # is being restored to.
547
+ # @param source_backup [::String]
548
+ # The resource name of the backup, in the format
549
+ # `projects/{project_number}/locations/{location_id}/backups/{backup_id}`.
550
+ #
551
+ # @yield [response, operation] Access the result along with the RPC operation
552
+ # @yieldparam response [::Gapic::Operation]
553
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
554
+ #
555
+ # @return [::Gapic::Operation]
556
+ #
557
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
558
+ #
559
+ def restore_instance request, options = nil
560
+ raise ::ArgumentError, "request must be provided" if request.nil?
561
+
562
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::RestoreInstanceRequest
563
+
564
+ # Converts hash and nil to an options object
565
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
566
+
567
+ # Customize the options with defaults
568
+ metadata = @config.rpcs.restore_instance.metadata.to_h
569
+
570
+ # Set x-goog-api-client and x-goog-user-project headers
571
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
572
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
573
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
574
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
575
+
576
+ header_params = {
577
+ "name" => request.name
578
+ }
579
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
580
+ metadata[:"x-goog-request-params"] ||= request_params_header
581
+
582
+ options.apply_defaults timeout: @config.rpcs.restore_instance.timeout,
583
+ metadata: metadata,
584
+ retry_policy: @config.rpcs.restore_instance.retry_policy
585
+
586
+ options.apply_defaults timeout: @config.timeout,
587
+ metadata: @config.metadata,
588
+ retry_policy: @config.retry_policy
589
+
590
+ @cloud_filestore_manager_stub.call_rpc :restore_instance, request, options: options do |response, operation|
591
+ response = ::Gapic::Operation.new response, @operations_client, options: options
592
+ yield response, operation if block_given?
593
+ return response
594
+ end
595
+ rescue ::GRPC::BadStatus => e
596
+ raise ::Google::Cloud::Error.from_error(e)
597
+ end
598
+
599
+ ##
600
+ # Deletes an instance.
601
+ #
602
+ # @overload delete_instance(request, options = nil)
603
+ # Pass arguments to `delete_instance` via a request object, either of type
604
+ # {::Google::Cloud::Filestore::V1::DeleteInstanceRequest} or an equivalent Hash.
605
+ #
606
+ # @param request [::Google::Cloud::Filestore::V1::DeleteInstanceRequest, ::Hash]
607
+ # A request object representing the call parameters. Required. To specify no
608
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
609
+ # @param options [::Gapic::CallOptions, ::Hash]
610
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
611
+ #
612
+ # @overload delete_instance(name: nil)
613
+ # Pass arguments to `delete_instance` via keyword arguments. Note that at
614
+ # least one keyword argument is required. To specify no parameters, or to keep all
615
+ # the default parameter values, pass an empty Hash as a request object (see above).
616
+ #
617
+ # @param name [::String]
618
+ # Required. The instance resource name, in the format
619
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
620
+ #
621
+ # @yield [response, operation] Access the result along with the RPC operation
622
+ # @yieldparam response [::Gapic::Operation]
623
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
624
+ #
625
+ # @return [::Gapic::Operation]
626
+ #
627
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
628
+ #
629
+ def delete_instance request, options = nil
630
+ raise ::ArgumentError, "request must be provided" if request.nil?
631
+
632
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::DeleteInstanceRequest
633
+
634
+ # Converts hash and nil to an options object
635
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
636
+
637
+ # Customize the options with defaults
638
+ metadata = @config.rpcs.delete_instance.metadata.to_h
639
+
640
+ # Set x-goog-api-client and x-goog-user-project headers
641
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
642
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
643
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
644
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
645
+
646
+ header_params = {
647
+ "name" => request.name
648
+ }
649
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
650
+ metadata[:"x-goog-request-params"] ||= request_params_header
651
+
652
+ options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
653
+ metadata: metadata,
654
+ retry_policy: @config.rpcs.delete_instance.retry_policy
655
+
656
+ options.apply_defaults timeout: @config.timeout,
657
+ metadata: @config.metadata,
658
+ retry_policy: @config.retry_policy
659
+
660
+ @cloud_filestore_manager_stub.call_rpc :delete_instance, request, options: options do |response, operation|
661
+ response = ::Gapic::Operation.new response, @operations_client, options: options
662
+ yield response, operation if block_given?
663
+ return response
664
+ end
665
+ rescue ::GRPC::BadStatus => e
666
+ raise ::Google::Cloud::Error.from_error(e)
667
+ end
668
+
669
+ ##
670
+ # Lists all backups in a project for either a specified location or for all
671
+ # locations.
672
+ #
673
+ # @overload list_backups(request, options = nil)
674
+ # Pass arguments to `list_backups` via a request object, either of type
675
+ # {::Google::Cloud::Filestore::V1::ListBackupsRequest} or an equivalent Hash.
676
+ #
677
+ # @param request [::Google::Cloud::Filestore::V1::ListBackupsRequest, ::Hash]
678
+ # A request object representing the call parameters. Required. To specify no
679
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
680
+ # @param options [::Gapic::CallOptions, ::Hash]
681
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
682
+ #
683
+ # @overload list_backups(parent: nil, page_size: nil, page_token: nil, order_by: nil, filter: nil)
684
+ # Pass arguments to `list_backups` via keyword arguments. Note that at
685
+ # least one keyword argument is required. To specify no parameters, or to keep all
686
+ # the default parameter values, pass an empty Hash as a request object (see above).
687
+ #
688
+ # @param parent [::String]
689
+ # Required. The project and location for which to retrieve backup information,
690
+ # in the format `projects/{project_number}/locations/{location}`.
691
+ # In Cloud Filestore, backup locations map to GCP regions,
692
+ # for example **us-west1**.
693
+ # To retrieve backup information for all locations, use "-" for the
694
+ # `{location}` value.
695
+ # @param page_size [::Integer]
696
+ # The maximum number of items to return.
697
+ # @param page_token [::String]
698
+ # The next_page_token value to use if there are additional
699
+ # results to retrieve for this list request.
700
+ # @param order_by [::String]
701
+ # Sort results. Supported values are "name", "name desc" or "" (unsorted).
702
+ # @param filter [::String]
703
+ # List filter.
704
+ #
705
+ # @yield [response, operation] Access the result along with the RPC operation
706
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Filestore::V1::Backup>]
707
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
708
+ #
709
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Filestore::V1::Backup>]
710
+ #
711
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
712
+ #
713
+ def list_backups request, options = nil
714
+ raise ::ArgumentError, "request must be provided" if request.nil?
715
+
716
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::ListBackupsRequest
717
+
718
+ # Converts hash and nil to an options object
719
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
720
+
721
+ # Customize the options with defaults
722
+ metadata = @config.rpcs.list_backups.metadata.to_h
723
+
724
+ # Set x-goog-api-client and x-goog-user-project headers
725
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
726
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
727
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
728
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
729
+
730
+ header_params = {
731
+ "parent" => request.parent
732
+ }
733
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
734
+ metadata[:"x-goog-request-params"] ||= request_params_header
735
+
736
+ options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
737
+ metadata: metadata,
738
+ retry_policy: @config.rpcs.list_backups.retry_policy
739
+
740
+ options.apply_defaults timeout: @config.timeout,
741
+ metadata: @config.metadata,
742
+ retry_policy: @config.retry_policy
743
+
744
+ @cloud_filestore_manager_stub.call_rpc :list_backups, request, options: options do |response, operation|
745
+ response = ::Gapic::PagedEnumerable.new @cloud_filestore_manager_stub, :list_backups, request, response, operation, options
746
+ yield response, operation if block_given?
747
+ return response
748
+ end
749
+ rescue ::GRPC::BadStatus => e
750
+ raise ::Google::Cloud::Error.from_error(e)
751
+ end
752
+
753
+ ##
754
+ # Gets the details of a specific backup.
755
+ #
756
+ # @overload get_backup(request, options = nil)
757
+ # Pass arguments to `get_backup` via a request object, either of type
758
+ # {::Google::Cloud::Filestore::V1::GetBackupRequest} or an equivalent Hash.
759
+ #
760
+ # @param request [::Google::Cloud::Filestore::V1::GetBackupRequest, ::Hash]
761
+ # A request object representing the call parameters. Required. To specify no
762
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
763
+ # @param options [::Gapic::CallOptions, ::Hash]
764
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
765
+ #
766
+ # @overload get_backup(name: nil)
767
+ # Pass arguments to `get_backup` via keyword arguments. Note that at
768
+ # least one keyword argument is required. To specify no parameters, or to keep all
769
+ # the default parameter values, pass an empty Hash as a request object (see above).
770
+ #
771
+ # @param name [::String]
772
+ # Required. The backup resource name, in the format
773
+ # `projects/{project_number}/locations/{location}/backups/{backup_id}`.
774
+ #
775
+ # @yield [response, operation] Access the result along with the RPC operation
776
+ # @yieldparam response [::Google::Cloud::Filestore::V1::Backup]
777
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
778
+ #
779
+ # @return [::Google::Cloud::Filestore::V1::Backup]
780
+ #
781
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
782
+ #
783
+ def get_backup request, options = nil
784
+ raise ::ArgumentError, "request must be provided" if request.nil?
785
+
786
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::GetBackupRequest
787
+
788
+ # Converts hash and nil to an options object
789
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
790
+
791
+ # Customize the options with defaults
792
+ metadata = @config.rpcs.get_backup.metadata.to_h
793
+
794
+ # Set x-goog-api-client and x-goog-user-project headers
795
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
796
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
797
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
798
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
799
+
800
+ header_params = {
801
+ "name" => request.name
802
+ }
803
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
804
+ metadata[:"x-goog-request-params"] ||= request_params_header
805
+
806
+ options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
807
+ metadata: metadata,
808
+ retry_policy: @config.rpcs.get_backup.retry_policy
809
+
810
+ options.apply_defaults timeout: @config.timeout,
811
+ metadata: @config.metadata,
812
+ retry_policy: @config.retry_policy
813
+
814
+ @cloud_filestore_manager_stub.call_rpc :get_backup, request, options: options do |response, operation|
815
+ yield response, operation if block_given?
816
+ return response
817
+ end
818
+ rescue ::GRPC::BadStatus => e
819
+ raise ::Google::Cloud::Error.from_error(e)
820
+ end
821
+
822
+ ##
823
+ # Creates a backup.
824
+ #
825
+ # @overload create_backup(request, options = nil)
826
+ # Pass arguments to `create_backup` via a request object, either of type
827
+ # {::Google::Cloud::Filestore::V1::CreateBackupRequest} or an equivalent Hash.
828
+ #
829
+ # @param request [::Google::Cloud::Filestore::V1::CreateBackupRequest, ::Hash]
830
+ # A request object representing the call parameters. Required. To specify no
831
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
832
+ # @param options [::Gapic::CallOptions, ::Hash]
833
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
834
+ #
835
+ # @overload create_backup(parent: nil, backup: nil, backup_id: nil)
836
+ # Pass arguments to `create_backup` via keyword arguments. Note that at
837
+ # least one keyword argument is required. To specify no parameters, or to keep all
838
+ # the default parameter values, pass an empty Hash as a request object (see above).
839
+ #
840
+ # @param parent [::String]
841
+ # Required. The backup's project and location, in the format
842
+ # `projects/{project_number}/locations/{location}`. In Cloud Filestore,
843
+ # backup locations map to GCP regions, for example **us-west1**.
844
+ # @param backup [::Google::Cloud::Filestore::V1::Backup, ::Hash]
845
+ # Required. A {::Google::Cloud::Filestore::V1::Backup backup resource}
846
+ # @param backup_id [::String]
847
+ # Required. The ID to use for the backup.
848
+ # The ID must be unique within the specified project and location.
849
+ #
850
+ # This value must start with a lowercase letter followed by up to 62
851
+ # lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
852
+ # Values that do not match this pattern will trigger an INVALID_ARGUMENT
853
+ # error.
854
+ #
855
+ # @yield [response, operation] Access the result along with the RPC operation
856
+ # @yieldparam response [::Gapic::Operation]
857
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
858
+ #
859
+ # @return [::Gapic::Operation]
860
+ #
861
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
862
+ #
863
+ def create_backup request, options = nil
864
+ raise ::ArgumentError, "request must be provided" if request.nil?
865
+
866
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::CreateBackupRequest
867
+
868
+ # Converts hash and nil to an options object
869
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
870
+
871
+ # Customize the options with defaults
872
+ metadata = @config.rpcs.create_backup.metadata.to_h
873
+
874
+ # Set x-goog-api-client and x-goog-user-project headers
875
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
876
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
877
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
878
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
879
+
880
+ header_params = {
881
+ "parent" => request.parent
882
+ }
883
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
884
+ metadata[:"x-goog-request-params"] ||= request_params_header
885
+
886
+ options.apply_defaults timeout: @config.rpcs.create_backup.timeout,
887
+ metadata: metadata,
888
+ retry_policy: @config.rpcs.create_backup.retry_policy
889
+
890
+ options.apply_defaults timeout: @config.timeout,
891
+ metadata: @config.metadata,
892
+ retry_policy: @config.retry_policy
893
+
894
+ @cloud_filestore_manager_stub.call_rpc :create_backup, request, options: options do |response, operation|
895
+ response = ::Gapic::Operation.new response, @operations_client, options: options
896
+ yield response, operation if block_given?
897
+ return response
898
+ end
899
+ rescue ::GRPC::BadStatus => e
900
+ raise ::Google::Cloud::Error.from_error(e)
901
+ end
902
+
903
+ ##
904
+ # Deletes a backup.
905
+ #
906
+ # @overload delete_backup(request, options = nil)
907
+ # Pass arguments to `delete_backup` via a request object, either of type
908
+ # {::Google::Cloud::Filestore::V1::DeleteBackupRequest} or an equivalent Hash.
909
+ #
910
+ # @param request [::Google::Cloud::Filestore::V1::DeleteBackupRequest, ::Hash]
911
+ # A request object representing the call parameters. Required. To specify no
912
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
913
+ # @param options [::Gapic::CallOptions, ::Hash]
914
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
915
+ #
916
+ # @overload delete_backup(name: nil)
917
+ # Pass arguments to `delete_backup` via keyword arguments. Note that at
918
+ # least one keyword argument is required. To specify no parameters, or to keep all
919
+ # the default parameter values, pass an empty Hash as a request object (see above).
920
+ #
921
+ # @param name [::String]
922
+ # Required. The backup resource name, in the format
923
+ # `projects/{project_number}/locations/{location}/backups/{backup_id}`
924
+ #
925
+ # @yield [response, operation] Access the result along with the RPC operation
926
+ # @yieldparam response [::Gapic::Operation]
927
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
928
+ #
929
+ # @return [::Gapic::Operation]
930
+ #
931
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
932
+ #
933
+ def delete_backup request, options = nil
934
+ raise ::ArgumentError, "request must be provided" if request.nil?
935
+
936
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::DeleteBackupRequest
937
+
938
+ # Converts hash and nil to an options object
939
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
940
+
941
+ # Customize the options with defaults
942
+ metadata = @config.rpcs.delete_backup.metadata.to_h
943
+
944
+ # Set x-goog-api-client and x-goog-user-project headers
945
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
946
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
947
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
948
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
949
+
950
+ header_params = {
951
+ "name" => request.name
952
+ }
953
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
954
+ metadata[:"x-goog-request-params"] ||= request_params_header
955
+
956
+ options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
957
+ metadata: metadata,
958
+ retry_policy: @config.rpcs.delete_backup.retry_policy
959
+
960
+ options.apply_defaults timeout: @config.timeout,
961
+ metadata: @config.metadata,
962
+ retry_policy: @config.retry_policy
963
+
964
+ @cloud_filestore_manager_stub.call_rpc :delete_backup, request, options: options do |response, operation|
965
+ response = ::Gapic::Operation.new response, @operations_client, options: options
966
+ yield response, operation if block_given?
967
+ return response
968
+ end
969
+ rescue ::GRPC::BadStatus => e
970
+ raise ::Google::Cloud::Error.from_error(e)
971
+ end
972
+
973
+ ##
974
+ # Updates the settings of a specific backup.
975
+ #
976
+ # @overload update_backup(request, options = nil)
977
+ # Pass arguments to `update_backup` via a request object, either of type
978
+ # {::Google::Cloud::Filestore::V1::UpdateBackupRequest} or an equivalent Hash.
979
+ #
980
+ # @param request [::Google::Cloud::Filestore::V1::UpdateBackupRequest, ::Hash]
981
+ # A request object representing the call parameters. Required. To specify no
982
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
983
+ # @param options [::Gapic::CallOptions, ::Hash]
984
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
985
+ #
986
+ # @overload update_backup(backup: nil, update_mask: nil)
987
+ # Pass arguments to `update_backup` via keyword arguments. Note that at
988
+ # least one keyword argument is required. To specify no parameters, or to keep all
989
+ # the default parameter values, pass an empty Hash as a request object (see above).
990
+ #
991
+ # @param backup [::Google::Cloud::Filestore::V1::Backup, ::Hash]
992
+ # Required. A {::Google::Cloud::Filestore::V1::Backup backup resource}
993
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
994
+ # Required. Mask of fields to update. At least one path must be supplied in this
995
+ # field.
996
+ #
997
+ # @yield [response, operation] Access the result along with the RPC operation
998
+ # @yieldparam response [::Gapic::Operation]
999
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1000
+ #
1001
+ # @return [::Gapic::Operation]
1002
+ #
1003
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1004
+ #
1005
+ def update_backup request, options = nil
1006
+ raise ::ArgumentError, "request must be provided" if request.nil?
1007
+
1008
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::UpdateBackupRequest
1009
+
1010
+ # Converts hash and nil to an options object
1011
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1012
+
1013
+ # Customize the options with defaults
1014
+ metadata = @config.rpcs.update_backup.metadata.to_h
1015
+
1016
+ # Set x-goog-api-client and x-goog-user-project headers
1017
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1018
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1019
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
1020
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1021
+
1022
+ header_params = {
1023
+ "backup.name" => request.backup.name
1024
+ }
1025
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1026
+ metadata[:"x-goog-request-params"] ||= request_params_header
1027
+
1028
+ options.apply_defaults timeout: @config.rpcs.update_backup.timeout,
1029
+ metadata: metadata,
1030
+ retry_policy: @config.rpcs.update_backup.retry_policy
1031
+
1032
+ options.apply_defaults timeout: @config.timeout,
1033
+ metadata: @config.metadata,
1034
+ retry_policy: @config.retry_policy
1035
+
1036
+ @cloud_filestore_manager_stub.call_rpc :update_backup, request, options: options do |response, operation|
1037
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1038
+ yield response, operation if block_given?
1039
+ return response
1040
+ end
1041
+ rescue ::GRPC::BadStatus => e
1042
+ raise ::Google::Cloud::Error.from_error(e)
1043
+ end
1044
+
1045
+ ##
1046
+ # Configuration class for the CloudFilestoreManager API.
1047
+ #
1048
+ # This class represents the configuration for CloudFilestoreManager,
1049
+ # providing control over timeouts, retry behavior, logging, transport
1050
+ # parameters, and other low-level controls. Certain parameters can also be
1051
+ # applied individually to specific RPCs. See
1052
+ # {::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client::Configuration::Rpcs}
1053
+ # for a list of RPCs that can be configured independently.
1054
+ #
1055
+ # Configuration can be applied globally to all clients, or to a single client
1056
+ # on construction.
1057
+ #
1058
+ # @example
1059
+ #
1060
+ # # Modify the global config, setting the timeout for
1061
+ # # list_instances to 20 seconds,
1062
+ # # and all remaining timeouts to 10 seconds.
1063
+ # ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.configure do |config|
1064
+ # config.timeout = 10.0
1065
+ # config.rpcs.list_instances.timeout = 20.0
1066
+ # end
1067
+ #
1068
+ # # Apply the above configuration only to a new client.
1069
+ # client = ::Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new do |config|
1070
+ # config.timeout = 10.0
1071
+ # config.rpcs.list_instances.timeout = 20.0
1072
+ # end
1073
+ #
1074
+ # @!attribute [rw] endpoint
1075
+ # The hostname or hostname:port of the service endpoint.
1076
+ # Defaults to `"file.googleapis.com"`.
1077
+ # @return [::String]
1078
+ # @!attribute [rw] credentials
1079
+ # Credentials to send with calls. You may provide any of the following types:
1080
+ # * (`String`) The path to a service account key file in JSON format
1081
+ # * (`Hash`) A service account key as a Hash
1082
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1083
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1084
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1085
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1086
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1087
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1088
+ # * (`nil`) indicating no credentials
1089
+ # @return [::Object]
1090
+ # @!attribute [rw] scope
1091
+ # The OAuth scopes
1092
+ # @return [::Array<::String>]
1093
+ # @!attribute [rw] lib_name
1094
+ # The library name as recorded in instrumentation and logging
1095
+ # @return [::String]
1096
+ # @!attribute [rw] lib_version
1097
+ # The library version as recorded in instrumentation and logging
1098
+ # @return [::String]
1099
+ # @!attribute [rw] channel_args
1100
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1101
+ # `GRPC::Core::Channel` object is provided as the credential.
1102
+ # @return [::Hash]
1103
+ # @!attribute [rw] interceptors
1104
+ # An array of interceptors that are run before calls are executed.
1105
+ # @return [::Array<::GRPC::ClientInterceptor>]
1106
+ # @!attribute [rw] timeout
1107
+ # The call timeout in seconds.
1108
+ # @return [::Numeric]
1109
+ # @!attribute [rw] metadata
1110
+ # Additional gRPC headers to be sent with the call.
1111
+ # @return [::Hash{::Symbol=>::String}]
1112
+ # @!attribute [rw] retry_policy
1113
+ # The retry policy. The value is a hash with the following keys:
1114
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1115
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1116
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1117
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1118
+ # trigger a retry.
1119
+ # @return [::Hash]
1120
+ # @!attribute [rw] quota_project
1121
+ # A separate project against which to charge quota.
1122
+ # @return [::String]
1123
+ #
1124
+ class Configuration
1125
+ extend ::Gapic::Config
1126
+
1127
+ config_attr :endpoint, "file.googleapis.com", ::String
1128
+ config_attr :credentials, nil do |value|
1129
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1130
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1131
+ allowed.any? { |klass| klass === value }
1132
+ end
1133
+ config_attr :scope, nil, ::String, ::Array, nil
1134
+ config_attr :lib_name, nil, ::String, nil
1135
+ config_attr :lib_version, nil, ::String, nil
1136
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1137
+ config_attr :interceptors, nil, ::Array, nil
1138
+ config_attr :timeout, nil, ::Numeric, nil
1139
+ config_attr :metadata, nil, ::Hash, nil
1140
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1141
+ config_attr :quota_project, nil, ::String, nil
1142
+
1143
+ # @private
1144
+ def initialize parent_config = nil
1145
+ @parent_config = parent_config unless parent_config.nil?
1146
+
1147
+ yield self if block_given?
1148
+ end
1149
+
1150
+ ##
1151
+ # Configurations for individual RPCs
1152
+ # @return [Rpcs]
1153
+ #
1154
+ def rpcs
1155
+ @rpcs ||= begin
1156
+ parent_rpcs = nil
1157
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1158
+ Rpcs.new parent_rpcs
1159
+ end
1160
+ end
1161
+
1162
+ ##
1163
+ # Configuration RPC class for the CloudFilestoreManager API.
1164
+ #
1165
+ # Includes fields providing the configuration for each RPC in this service.
1166
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1167
+ # the following configuration fields:
1168
+ #
1169
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1170
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1171
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1172
+ # include the following keys:
1173
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1174
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1175
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1176
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1177
+ # trigger a retry.
1178
+ #
1179
+ class Rpcs
1180
+ ##
1181
+ # RPC-specific configuration for `list_instances`
1182
+ # @return [::Gapic::Config::Method]
1183
+ #
1184
+ attr_reader :list_instances
1185
+ ##
1186
+ # RPC-specific configuration for `get_instance`
1187
+ # @return [::Gapic::Config::Method]
1188
+ #
1189
+ attr_reader :get_instance
1190
+ ##
1191
+ # RPC-specific configuration for `create_instance`
1192
+ # @return [::Gapic::Config::Method]
1193
+ #
1194
+ attr_reader :create_instance
1195
+ ##
1196
+ # RPC-specific configuration for `update_instance`
1197
+ # @return [::Gapic::Config::Method]
1198
+ #
1199
+ attr_reader :update_instance
1200
+ ##
1201
+ # RPC-specific configuration for `restore_instance`
1202
+ # @return [::Gapic::Config::Method]
1203
+ #
1204
+ attr_reader :restore_instance
1205
+ ##
1206
+ # RPC-specific configuration for `delete_instance`
1207
+ # @return [::Gapic::Config::Method]
1208
+ #
1209
+ attr_reader :delete_instance
1210
+ ##
1211
+ # RPC-specific configuration for `list_backups`
1212
+ # @return [::Gapic::Config::Method]
1213
+ #
1214
+ attr_reader :list_backups
1215
+ ##
1216
+ # RPC-specific configuration for `get_backup`
1217
+ # @return [::Gapic::Config::Method]
1218
+ #
1219
+ attr_reader :get_backup
1220
+ ##
1221
+ # RPC-specific configuration for `create_backup`
1222
+ # @return [::Gapic::Config::Method]
1223
+ #
1224
+ attr_reader :create_backup
1225
+ ##
1226
+ # RPC-specific configuration for `delete_backup`
1227
+ # @return [::Gapic::Config::Method]
1228
+ #
1229
+ attr_reader :delete_backup
1230
+ ##
1231
+ # RPC-specific configuration for `update_backup`
1232
+ # @return [::Gapic::Config::Method]
1233
+ #
1234
+ attr_reader :update_backup
1235
+
1236
+ # @private
1237
+ def initialize parent_rpcs = nil
1238
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
1239
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
1240
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
1241
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
1242
+ create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
1243
+ @create_instance = ::Gapic::Config::Method.new create_instance_config
1244
+ update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
1245
+ @update_instance = ::Gapic::Config::Method.new update_instance_config
1246
+ restore_instance_config = parent_rpcs.restore_instance if parent_rpcs.respond_to? :restore_instance
1247
+ @restore_instance = ::Gapic::Config::Method.new restore_instance_config
1248
+ delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
1249
+ @delete_instance = ::Gapic::Config::Method.new delete_instance_config
1250
+ list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
1251
+ @list_backups = ::Gapic::Config::Method.new list_backups_config
1252
+ get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
1253
+ @get_backup = ::Gapic::Config::Method.new get_backup_config
1254
+ create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup
1255
+ @create_backup = ::Gapic::Config::Method.new create_backup_config
1256
+ delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
1257
+ @delete_backup = ::Gapic::Config::Method.new delete_backup_config
1258
+ update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup
1259
+ @update_backup = ::Gapic::Config::Method.new update_backup_config
1260
+
1261
+ yield self if block_given?
1262
+ end
1263
+ end
1264
+ end
1265
+ end
1266
+ end
1267
+ end
1268
+ end
1269
+ end
1270
+ end