google-cloud-filestore-v1 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,23 +27,23 @@ module Google
27
27
  ##
28
28
  # Client for the CloudFilestoreManager service.
29
29
  #
30
- # Configures and manages Cloud Filestore resources.
30
+ # Configures and manages Filestore resources.
31
31
  #
32
- # Cloud Filestore Manager v1.
32
+ # Filestore Manager v1.
33
33
  #
34
- # The `file.googleapis.com` service implements the Cloud Filestore API and
34
+ # The `file.googleapis.com` service implements the Filestore API and
35
35
  # defines the following resource model for managing instances:
36
36
  # * The service works with a collection of cloud projects, named: `/projects/*`
37
37
  # * Each project has a collection of available locations, named: `/locations/*`
38
38
  # * Each location has a collection of instances and backups, named:
39
39
  # `/instances/*` and `/backups/*` respectively.
40
- # * As such, Cloud Filestore instances are resources of the form:
40
+ # * As such, Filestore instances are resources of the form:
41
41
  # `/projects/{project_number}/locations/{location_id}/instances/{instance_id}`
42
42
  # and backups are resources of the form:
43
43
  # `/projects/{project_number}/locations/{location_id}/backup/{backup_id}`
44
44
  #
45
- # Note that location_id must be a GCP `zone` for instances and but to a GCP
46
- # `region` for backups; for example:
45
+ # Note that location_id must be a Google Cloud `zone` for instances, but
46
+ # a Google Cloud `region` for backups; for example:
47
47
  # * `projects/12345/locations/us-central1-c/instances/my-filestore`
48
48
  # * `projects/12345/locations/us-central1/backups/my-backup`
49
49
  #
@@ -231,8 +231,9 @@ module Google
231
231
  # @param parent [::String]
232
232
  # Required. The project and location for which to retrieve instance
233
233
  # information, in the format `projects/{project_id}/locations/{location}`. In
234
- # Cloud Filestore, locations map to GCP zones, for example **us-west1-b**. To
235
- # retrieve instance information for all locations, use "-" for the
234
+ # Cloud Filestore, locations map to Google Cloud zones, for example
235
+ # **us-west1-b**. To retrieve instance information for all locations, use "-"
236
+ # for the
236
237
  # `{location}` value.
237
238
  # @param page_size [::Integer]
238
239
  # The maximum number of items to return.
@@ -264,13 +265,11 @@ module Google
264
265
  # # Call the list_instances method.
265
266
  # result = client.list_instances request
266
267
  #
267
- # # The returned object is of type Gapic::PagedEnumerable. You can
268
- # # iterate over all elements by calling #each, and the enumerable
269
- # # will lazily make API calls to fetch subsequent pages. Other
270
- # # methods are also available for managing paging directly.
271
- # result.each do |response|
268
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
269
+ # # over elements, and API calls will be issued to fetch pages as needed.
270
+ # result.each do |item|
272
271
  # # Each element is of type ::Google::Cloud::Filestore::V1::Instance.
273
- # p response
272
+ # p item
274
273
  # end
275
274
  #
276
275
  def list_instances request, options = nil
@@ -424,8 +423,8 @@ module Google
424
423
  #
425
424
  # @param parent [::String]
426
425
  # Required. The instance's project and location, in the format
427
- # `projects/{project_id}/locations/{location}`. In Cloud Filestore,
428
- # locations map to GCP zones, for example **us-west1-b**.
426
+ # `projects/{project_id}/locations/{location}`. In Filestore,
427
+ # locations map to Google Cloud zones, for example **us-west1-b**.
429
428
  # @param instance_id [::String]
430
429
  # Required. The name of the instance to create.
431
430
  # The name must be unique for the specified project and location.
@@ -452,14 +451,14 @@ module Google
452
451
  # # Call the create_instance method.
453
452
  # result = client.create_instance request
454
453
  #
455
- # # The returned object is of type Gapic::Operation. You can use this
456
- # # object to check the status of an operation, cancel it, or wait
457
- # # for results. Here is how to block until completion:
454
+ # # The returned object is of type Gapic::Operation. You can use it to
455
+ # # check the status of an operation, cancel it, or wait for results.
456
+ # # Here is how to wait for a response.
458
457
  # result.wait_until_done! timeout: 60
459
458
  # if result.response?
460
459
  # p result.response
461
460
  # else
462
- # puts "Error!"
461
+ # puts "No response received."
463
462
  # end
464
463
  #
465
464
  def create_instance request, options = nil
@@ -553,14 +552,14 @@ module Google
553
552
  # # Call the update_instance method.
554
553
  # result = client.update_instance request
555
554
  #
556
- # # The returned object is of type Gapic::Operation. You can use this
557
- # # object to check the status of an operation, cancel it, or wait
558
- # # for results. Here is how to block until completion:
555
+ # # The returned object is of type Gapic::Operation. You can use it to
556
+ # # check the status of an operation, cancel it, or wait for results.
557
+ # # Here is how to wait for a response.
559
558
  # result.wait_until_done! timeout: 60
560
559
  # if result.response?
561
560
  # p result.response
562
561
  # else
563
- # puts "Error!"
562
+ # puts "No response received."
564
563
  # end
565
564
  #
566
565
  def update_instance request, options = nil
@@ -631,8 +630,8 @@ module Google
631
630
  # Required. The resource name of the instance, in the format
632
631
  # `projects/{project_number}/locations/{location_id}/instances/{instance_id}`.
633
632
  # @param file_share [::String]
634
- # Required. Name of the file share in the Cloud Filestore instance that the
635
- # backup is being restored to.
633
+ # Required. Name of the file share in the Filestore instance that the backup
634
+ # is being restored to.
636
635
  # @param source_backup [::String]
637
636
  # The resource name of the backup, in the format
638
637
  # `projects/{project_number}/locations/{location_id}/backups/{backup_id}`.
@@ -657,14 +656,14 @@ module Google
657
656
  # # Call the restore_instance method.
658
657
  # result = client.restore_instance request
659
658
  #
660
- # # The returned object is of type Gapic::Operation. You can use this
661
- # # object to check the status of an operation, cancel it, or wait
662
- # # for results. Here is how to block until completion:
659
+ # # The returned object is of type Gapic::Operation. You can use it to
660
+ # # check the status of an operation, cancel it, or wait for results.
661
+ # # Here is how to wait for a response.
663
662
  # result.wait_until_done! timeout: 60
664
663
  # if result.response?
665
664
  # p result.response
666
665
  # else
667
- # puts "Error!"
666
+ # puts "No response received."
668
667
  # end
669
668
  #
670
669
  def restore_instance request, options = nil
@@ -722,7 +721,7 @@ module Google
722
721
  # @param options [::Gapic::CallOptions, ::Hash]
723
722
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
724
723
  #
725
- # @overload delete_instance(name: nil)
724
+ # @overload delete_instance(name: nil, force: nil)
726
725
  # Pass arguments to `delete_instance` via keyword arguments. Note that at
727
726
  # least one keyword argument is required. To specify no parameters, or to keep all
728
727
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -730,6 +729,9 @@ module Google
730
729
  # @param name [::String]
731
730
  # Required. The instance resource name, in the format
732
731
  # `projects/{project_id}/locations/{location}/instances/{instance_id}`
732
+ # @param force [::Boolean]
733
+ # If set to true, all snapshots of the instance will also be deleted.
734
+ # (Otherwise, the request will only work if the instance has no snapshots.)
733
735
  #
734
736
  # @yield [response, operation] Access the result along with the RPC operation
735
737
  # @yieldparam response [::Gapic::Operation]
@@ -751,14 +753,14 @@ module Google
751
753
  # # Call the delete_instance method.
752
754
  # result = client.delete_instance request
753
755
  #
754
- # # The returned object is of type Gapic::Operation. You can use this
755
- # # object to check the status of an operation, cancel it, or wait
756
- # # for results. Here is how to block until completion:
756
+ # # The returned object is of type Gapic::Operation. You can use it to
757
+ # # check the status of an operation, cancel it, or wait for results.
758
+ # # Here is how to wait for a response.
757
759
  # result.wait_until_done! timeout: 60
758
760
  # if result.response?
759
761
  # p result.response
760
762
  # else
761
- # puts "Error!"
763
+ # puts "No response received."
762
764
  # end
763
765
  #
764
766
  def delete_instance request, options = nil
@@ -803,6 +805,486 @@ module Google
803
805
  raise ::Google::Cloud::Error.from_error(e)
804
806
  end
805
807
 
808
+ ##
809
+ # Lists all snapshots in a project for either a specified location
810
+ # or for all locations.
811
+ #
812
+ # @overload list_snapshots(request, options = nil)
813
+ # Pass arguments to `list_snapshots` via a request object, either of type
814
+ # {::Google::Cloud::Filestore::V1::ListSnapshotsRequest} or an equivalent Hash.
815
+ #
816
+ # @param request [::Google::Cloud::Filestore::V1::ListSnapshotsRequest, ::Hash]
817
+ # A request object representing the call parameters. Required. To specify no
818
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
819
+ # @param options [::Gapic::CallOptions, ::Hash]
820
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
821
+ #
822
+ # @overload list_snapshots(parent: nil, page_size: nil, page_token: nil, order_by: nil, filter: nil)
823
+ # Pass arguments to `list_snapshots` via keyword arguments. Note that at
824
+ # least one keyword argument is required. To specify no parameters, or to keep all
825
+ # the default parameter values, pass an empty Hash as a request object (see above).
826
+ #
827
+ # @param parent [::String]
828
+ # Required. The instance for which to retrieve snapshot information,
829
+ # in the format
830
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`.
831
+ # @param page_size [::Integer]
832
+ # The maximum number of items to return.
833
+ # @param page_token [::String]
834
+ # The next_page_token value to use if there are additional
835
+ # results to retrieve for this list request.
836
+ # @param order_by [::String]
837
+ # Sort results. Supported values are "name", "name desc" or "" (unsorted).
838
+ # @param filter [::String]
839
+ # List filter.
840
+ #
841
+ # @yield [response, operation] Access the result along with the RPC operation
842
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Filestore::V1::Snapshot>]
843
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
844
+ #
845
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Filestore::V1::Snapshot>]
846
+ #
847
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
848
+ #
849
+ # @example Basic example
850
+ # require "google/cloud/filestore/v1"
851
+ #
852
+ # # Create a client object. The client can be reused for multiple calls.
853
+ # client = Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new
854
+ #
855
+ # # Create a request. To set request fields, pass in keyword arguments.
856
+ # request = Google::Cloud::Filestore::V1::ListSnapshotsRequest.new
857
+ #
858
+ # # Call the list_snapshots method.
859
+ # result = client.list_snapshots request
860
+ #
861
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
862
+ # # over elements, and API calls will be issued to fetch pages as needed.
863
+ # result.each do |item|
864
+ # # Each element is of type ::Google::Cloud::Filestore::V1::Snapshot.
865
+ # p item
866
+ # end
867
+ #
868
+ def list_snapshots request, options = nil
869
+ raise ::ArgumentError, "request must be provided" if request.nil?
870
+
871
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::ListSnapshotsRequest
872
+
873
+ # Converts hash and nil to an options object
874
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
875
+
876
+ # Customize the options with defaults
877
+ metadata = @config.rpcs.list_snapshots.metadata.to_h
878
+
879
+ # Set x-goog-api-client and x-goog-user-project headers
880
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
881
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
882
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
883
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
884
+
885
+ header_params = {}
886
+ if request.parent
887
+ header_params["parent"] = request.parent
888
+ end
889
+
890
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
891
+ metadata[:"x-goog-request-params"] ||= request_params_header
892
+
893
+ options.apply_defaults timeout: @config.rpcs.list_snapshots.timeout,
894
+ metadata: metadata,
895
+ retry_policy: @config.rpcs.list_snapshots.retry_policy
896
+
897
+ options.apply_defaults timeout: @config.timeout,
898
+ metadata: @config.metadata,
899
+ retry_policy: @config.retry_policy
900
+
901
+ @cloud_filestore_manager_stub.call_rpc :list_snapshots, request, options: options do |response, operation|
902
+ response = ::Gapic::PagedEnumerable.new @cloud_filestore_manager_stub, :list_snapshots, request, response, operation, options
903
+ yield response, operation if block_given?
904
+ return response
905
+ end
906
+ rescue ::GRPC::BadStatus => e
907
+ raise ::Google::Cloud::Error.from_error(e)
908
+ end
909
+
910
+ ##
911
+ # Gets the details of a specific snapshot.
912
+ #
913
+ # @overload get_snapshot(request, options = nil)
914
+ # Pass arguments to `get_snapshot` via a request object, either of type
915
+ # {::Google::Cloud::Filestore::V1::GetSnapshotRequest} or an equivalent Hash.
916
+ #
917
+ # @param request [::Google::Cloud::Filestore::V1::GetSnapshotRequest, ::Hash]
918
+ # A request object representing the call parameters. Required. To specify no
919
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
920
+ # @param options [::Gapic::CallOptions, ::Hash]
921
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
922
+ #
923
+ # @overload get_snapshot(name: nil)
924
+ # Pass arguments to `get_snapshot` via keyword arguments. Note that at
925
+ # least one keyword argument is required. To specify no parameters, or to keep all
926
+ # the default parameter values, pass an empty Hash as a request object (see above).
927
+ #
928
+ # @param name [::String]
929
+ # Required. The snapshot resource name, in the format
930
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
931
+ #
932
+ # @yield [response, operation] Access the result along with the RPC operation
933
+ # @yieldparam response [::Google::Cloud::Filestore::V1::Snapshot]
934
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
935
+ #
936
+ # @return [::Google::Cloud::Filestore::V1::Snapshot]
937
+ #
938
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
939
+ #
940
+ # @example Basic example
941
+ # require "google/cloud/filestore/v1"
942
+ #
943
+ # # Create a client object. The client can be reused for multiple calls.
944
+ # client = Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new
945
+ #
946
+ # # Create a request. To set request fields, pass in keyword arguments.
947
+ # request = Google::Cloud::Filestore::V1::GetSnapshotRequest.new
948
+ #
949
+ # # Call the get_snapshot method.
950
+ # result = client.get_snapshot request
951
+ #
952
+ # # The returned object is of type Google::Cloud::Filestore::V1::Snapshot.
953
+ # p result
954
+ #
955
+ def get_snapshot request, options = nil
956
+ raise ::ArgumentError, "request must be provided" if request.nil?
957
+
958
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::GetSnapshotRequest
959
+
960
+ # Converts hash and nil to an options object
961
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
962
+
963
+ # Customize the options with defaults
964
+ metadata = @config.rpcs.get_snapshot.metadata.to_h
965
+
966
+ # Set x-goog-api-client and x-goog-user-project headers
967
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
968
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
969
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
970
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
971
+
972
+ header_params = {}
973
+ if request.name
974
+ header_params["name"] = request.name
975
+ end
976
+
977
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
978
+ metadata[:"x-goog-request-params"] ||= request_params_header
979
+
980
+ options.apply_defaults timeout: @config.rpcs.get_snapshot.timeout,
981
+ metadata: metadata,
982
+ retry_policy: @config.rpcs.get_snapshot.retry_policy
983
+
984
+ options.apply_defaults timeout: @config.timeout,
985
+ metadata: @config.metadata,
986
+ retry_policy: @config.retry_policy
987
+
988
+ @cloud_filestore_manager_stub.call_rpc :get_snapshot, request, options: options do |response, operation|
989
+ yield response, operation if block_given?
990
+ return response
991
+ end
992
+ rescue ::GRPC::BadStatus => e
993
+ raise ::Google::Cloud::Error.from_error(e)
994
+ end
995
+
996
+ ##
997
+ # Creates a snapshot.
998
+ #
999
+ # @overload create_snapshot(request, options = nil)
1000
+ # Pass arguments to `create_snapshot` via a request object, either of type
1001
+ # {::Google::Cloud::Filestore::V1::CreateSnapshotRequest} or an equivalent Hash.
1002
+ #
1003
+ # @param request [::Google::Cloud::Filestore::V1::CreateSnapshotRequest, ::Hash]
1004
+ # A request object representing the call parameters. Required. To specify no
1005
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1006
+ # @param options [::Gapic::CallOptions, ::Hash]
1007
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1008
+ #
1009
+ # @overload create_snapshot(parent: nil, snapshot_id: nil, snapshot: nil)
1010
+ # Pass arguments to `create_snapshot` via keyword arguments. Note that at
1011
+ # least one keyword argument is required. To specify no parameters, or to keep all
1012
+ # the default parameter values, pass an empty Hash as a request object (see above).
1013
+ #
1014
+ # @param parent [::String]
1015
+ # Required. The Filestore Instance to create the snapshots of, in the format
1016
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
1017
+ # @param snapshot_id [::String]
1018
+ # Required. The ID to use for the snapshot.
1019
+ # The ID must be unique within the specified instance.
1020
+ #
1021
+ # This value must start with a lowercase letter followed by up to 62
1022
+ # lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
1023
+ # @param snapshot [::Google::Cloud::Filestore::V1::Snapshot, ::Hash]
1024
+ # Required. A snapshot resource.
1025
+ #
1026
+ # @yield [response, operation] Access the result along with the RPC operation
1027
+ # @yieldparam response [::Gapic::Operation]
1028
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1029
+ #
1030
+ # @return [::Gapic::Operation]
1031
+ #
1032
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1033
+ #
1034
+ # @example Basic example
1035
+ # require "google/cloud/filestore/v1"
1036
+ #
1037
+ # # Create a client object. The client can be reused for multiple calls.
1038
+ # client = Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new
1039
+ #
1040
+ # # Create a request. To set request fields, pass in keyword arguments.
1041
+ # request = Google::Cloud::Filestore::V1::CreateSnapshotRequest.new
1042
+ #
1043
+ # # Call the create_snapshot method.
1044
+ # result = client.create_snapshot request
1045
+ #
1046
+ # # The returned object is of type Gapic::Operation. You can use it to
1047
+ # # check the status of an operation, cancel it, or wait for results.
1048
+ # # Here is how to wait for a response.
1049
+ # result.wait_until_done! timeout: 60
1050
+ # if result.response?
1051
+ # p result.response
1052
+ # else
1053
+ # puts "No response received."
1054
+ # end
1055
+ #
1056
+ def create_snapshot request, options = nil
1057
+ raise ::ArgumentError, "request must be provided" if request.nil?
1058
+
1059
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::CreateSnapshotRequest
1060
+
1061
+ # Converts hash and nil to an options object
1062
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1063
+
1064
+ # Customize the options with defaults
1065
+ metadata = @config.rpcs.create_snapshot.metadata.to_h
1066
+
1067
+ # Set x-goog-api-client and x-goog-user-project headers
1068
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1069
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1070
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
1071
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1072
+
1073
+ header_params = {}
1074
+ if request.parent
1075
+ header_params["parent"] = request.parent
1076
+ end
1077
+
1078
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1079
+ metadata[:"x-goog-request-params"] ||= request_params_header
1080
+
1081
+ options.apply_defaults timeout: @config.rpcs.create_snapshot.timeout,
1082
+ metadata: metadata,
1083
+ retry_policy: @config.rpcs.create_snapshot.retry_policy
1084
+
1085
+ options.apply_defaults timeout: @config.timeout,
1086
+ metadata: @config.metadata,
1087
+ retry_policy: @config.retry_policy
1088
+
1089
+ @cloud_filestore_manager_stub.call_rpc :create_snapshot, request, options: options do |response, operation|
1090
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1091
+ yield response, operation if block_given?
1092
+ return response
1093
+ end
1094
+ rescue ::GRPC::BadStatus => e
1095
+ raise ::Google::Cloud::Error.from_error(e)
1096
+ end
1097
+
1098
+ ##
1099
+ # Deletes a snapshot.
1100
+ #
1101
+ # @overload delete_snapshot(request, options = nil)
1102
+ # Pass arguments to `delete_snapshot` via a request object, either of type
1103
+ # {::Google::Cloud::Filestore::V1::DeleteSnapshotRequest} or an equivalent Hash.
1104
+ #
1105
+ # @param request [::Google::Cloud::Filestore::V1::DeleteSnapshotRequest, ::Hash]
1106
+ # A request object representing the call parameters. Required. To specify no
1107
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1108
+ # @param options [::Gapic::CallOptions, ::Hash]
1109
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1110
+ #
1111
+ # @overload delete_snapshot(name: nil)
1112
+ # Pass arguments to `delete_snapshot` via keyword arguments. Note that at
1113
+ # least one keyword argument is required. To specify no parameters, or to keep all
1114
+ # the default parameter values, pass an empty Hash as a request object (see above).
1115
+ #
1116
+ # @param name [::String]
1117
+ # Required. The snapshot resource name, in the format
1118
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
1119
+ #
1120
+ # @yield [response, operation] Access the result along with the RPC operation
1121
+ # @yieldparam response [::Gapic::Operation]
1122
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1123
+ #
1124
+ # @return [::Gapic::Operation]
1125
+ #
1126
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1127
+ #
1128
+ # @example Basic example
1129
+ # require "google/cloud/filestore/v1"
1130
+ #
1131
+ # # Create a client object. The client can be reused for multiple calls.
1132
+ # client = Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new
1133
+ #
1134
+ # # Create a request. To set request fields, pass in keyword arguments.
1135
+ # request = Google::Cloud::Filestore::V1::DeleteSnapshotRequest.new
1136
+ #
1137
+ # # Call the delete_snapshot method.
1138
+ # result = client.delete_snapshot request
1139
+ #
1140
+ # # The returned object is of type Gapic::Operation. You can use it to
1141
+ # # check the status of an operation, cancel it, or wait for results.
1142
+ # # Here is how to wait for a response.
1143
+ # result.wait_until_done! timeout: 60
1144
+ # if result.response?
1145
+ # p result.response
1146
+ # else
1147
+ # puts "No response received."
1148
+ # end
1149
+ #
1150
+ def delete_snapshot request, options = nil
1151
+ raise ::ArgumentError, "request must be provided" if request.nil?
1152
+
1153
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::DeleteSnapshotRequest
1154
+
1155
+ # Converts hash and nil to an options object
1156
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1157
+
1158
+ # Customize the options with defaults
1159
+ metadata = @config.rpcs.delete_snapshot.metadata.to_h
1160
+
1161
+ # Set x-goog-api-client and x-goog-user-project headers
1162
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1163
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1164
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
1165
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1166
+
1167
+ header_params = {}
1168
+ if request.name
1169
+ header_params["name"] = request.name
1170
+ end
1171
+
1172
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1173
+ metadata[:"x-goog-request-params"] ||= request_params_header
1174
+
1175
+ options.apply_defaults timeout: @config.rpcs.delete_snapshot.timeout,
1176
+ metadata: metadata,
1177
+ retry_policy: @config.rpcs.delete_snapshot.retry_policy
1178
+
1179
+ options.apply_defaults timeout: @config.timeout,
1180
+ metadata: @config.metadata,
1181
+ retry_policy: @config.retry_policy
1182
+
1183
+ @cloud_filestore_manager_stub.call_rpc :delete_snapshot, request, options: options do |response, operation|
1184
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1185
+ yield response, operation if block_given?
1186
+ return response
1187
+ end
1188
+ rescue ::GRPC::BadStatus => e
1189
+ raise ::Google::Cloud::Error.from_error(e)
1190
+ end
1191
+
1192
+ ##
1193
+ # Updates the settings of a specific snapshot.
1194
+ #
1195
+ # @overload update_snapshot(request, options = nil)
1196
+ # Pass arguments to `update_snapshot` via a request object, either of type
1197
+ # {::Google::Cloud::Filestore::V1::UpdateSnapshotRequest} or an equivalent Hash.
1198
+ #
1199
+ # @param request [::Google::Cloud::Filestore::V1::UpdateSnapshotRequest, ::Hash]
1200
+ # A request object representing the call parameters. Required. To specify no
1201
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1202
+ # @param options [::Gapic::CallOptions, ::Hash]
1203
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1204
+ #
1205
+ # @overload update_snapshot(update_mask: nil, snapshot: nil)
1206
+ # Pass arguments to `update_snapshot` via keyword arguments. Note that at
1207
+ # least one keyword argument is required. To specify no parameters, or to keep all
1208
+ # the default parameter values, pass an empty Hash as a request object (see above).
1209
+ #
1210
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1211
+ # Required. Mask of fields to update. At least one path must be supplied in
1212
+ # this field.
1213
+ # @param snapshot [::Google::Cloud::Filestore::V1::Snapshot, ::Hash]
1214
+ # Required. A snapshot resource.
1215
+ #
1216
+ # @yield [response, operation] Access the result along with the RPC operation
1217
+ # @yieldparam response [::Gapic::Operation]
1218
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1219
+ #
1220
+ # @return [::Gapic::Operation]
1221
+ #
1222
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1223
+ #
1224
+ # @example Basic example
1225
+ # require "google/cloud/filestore/v1"
1226
+ #
1227
+ # # Create a client object. The client can be reused for multiple calls.
1228
+ # client = Google::Cloud::Filestore::V1::CloudFilestoreManager::Client.new
1229
+ #
1230
+ # # Create a request. To set request fields, pass in keyword arguments.
1231
+ # request = Google::Cloud::Filestore::V1::UpdateSnapshotRequest.new
1232
+ #
1233
+ # # Call the update_snapshot method.
1234
+ # result = client.update_snapshot request
1235
+ #
1236
+ # # The returned object is of type Gapic::Operation. You can use it to
1237
+ # # check the status of an operation, cancel it, or wait for results.
1238
+ # # Here is how to wait for a response.
1239
+ # result.wait_until_done! timeout: 60
1240
+ # if result.response?
1241
+ # p result.response
1242
+ # else
1243
+ # puts "No response received."
1244
+ # end
1245
+ #
1246
+ def update_snapshot request, options = nil
1247
+ raise ::ArgumentError, "request must be provided" if request.nil?
1248
+
1249
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Filestore::V1::UpdateSnapshotRequest
1250
+
1251
+ # Converts hash and nil to an options object
1252
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1253
+
1254
+ # Customize the options with defaults
1255
+ metadata = @config.rpcs.update_snapshot.metadata.to_h
1256
+
1257
+ # Set x-goog-api-client and x-goog-user-project headers
1258
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1259
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1260
+ gapic_version: ::Google::Cloud::Filestore::V1::VERSION
1261
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1262
+
1263
+ header_params = {}
1264
+ if request.snapshot&.name
1265
+ header_params["snapshot.name"] = request.snapshot.name
1266
+ end
1267
+
1268
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1269
+ metadata[:"x-goog-request-params"] ||= request_params_header
1270
+
1271
+ options.apply_defaults timeout: @config.rpcs.update_snapshot.timeout,
1272
+ metadata: metadata,
1273
+ retry_policy: @config.rpcs.update_snapshot.retry_policy
1274
+
1275
+ options.apply_defaults timeout: @config.timeout,
1276
+ metadata: @config.metadata,
1277
+ retry_policy: @config.retry_policy
1278
+
1279
+ @cloud_filestore_manager_stub.call_rpc :update_snapshot, request, options: options do |response, operation|
1280
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1281
+ yield response, operation if block_given?
1282
+ return response
1283
+ end
1284
+ rescue ::GRPC::BadStatus => e
1285
+ raise ::Google::Cloud::Error.from_error(e)
1286
+ end
1287
+
806
1288
  ##
807
1289
  # Lists all backups in a project for either a specified location or for all
808
1290
  # locations.
@@ -825,9 +1307,9 @@ module Google
825
1307
  # @param parent [::String]
826
1308
  # Required. The project and location for which to retrieve backup
827
1309
  # information, in the format
828
- # `projects/{project_number}/locations/{location}`. In Cloud Filestore,
829
- # backup locations map to GCP regions, for example **us-west1**. To retrieve
830
- # backup information for all locations, use "-" for the
1310
+ # `projects/{project_number}/locations/{location}`. In Filestore, backup
1311
+ # locations map to Google Cloud regions, for example **us-west1**. To
1312
+ # retrieve backup information for all locations, use "-" for the
831
1313
  # `{location}` value.
832
1314
  # @param page_size [::Integer]
833
1315
  # The maximum number of items to return.
@@ -859,13 +1341,11 @@ module Google
859
1341
  # # Call the list_backups method.
860
1342
  # result = client.list_backups request
861
1343
  #
862
- # # The returned object is of type Gapic::PagedEnumerable. You can
863
- # # iterate over all elements by calling #each, and the enumerable
864
- # # will lazily make API calls to fetch subsequent pages. Other
865
- # # methods are also available for managing paging directly.
866
- # result.each do |response|
1344
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1345
+ # # over elements, and API calls will be issued to fetch pages as needed.
1346
+ # result.each do |item|
867
1347
  # # Each element is of type ::Google::Cloud::Filestore::V1::Backup.
868
- # p response
1348
+ # p item
869
1349
  # end
870
1350
  #
871
1351
  def list_backups request, options = nil
@@ -1016,8 +1496,8 @@ module Google
1016
1496
  #
1017
1497
  # @param parent [::String]
1018
1498
  # Required. The backup's project and location, in the format
1019
- # `projects/{project_number}/locations/{location}`. In Cloud Filestore,
1020
- # backup locations map to GCP regions, for example **us-west1**.
1499
+ # `projects/{project_number}/locations/{location}`. In Filestore,
1500
+ # backup locations map to Google Cloud regions, for example **us-west1**.
1021
1501
  # @param backup [::Google::Cloud::Filestore::V1::Backup, ::Hash]
1022
1502
  # Required. A {::Google::Cloud::Filestore::V1::Backup backup resource}
1023
1503
  # @param backup_id [::String]
@@ -1049,14 +1529,14 @@ module Google
1049
1529
  # # Call the create_backup method.
1050
1530
  # result = client.create_backup request
1051
1531
  #
1052
- # # The returned object is of type Gapic::Operation. You can use this
1053
- # # object to check the status of an operation, cancel it, or wait
1054
- # # for results. Here is how to block until completion:
1532
+ # # The returned object is of type Gapic::Operation. You can use it to
1533
+ # # check the status of an operation, cancel it, or wait for results.
1534
+ # # Here is how to wait for a response.
1055
1535
  # result.wait_until_done! timeout: 60
1056
1536
  # if result.response?
1057
1537
  # p result.response
1058
1538
  # else
1059
- # puts "Error!"
1539
+ # puts "No response received."
1060
1540
  # end
1061
1541
  #
1062
1542
  def create_backup request, options = nil
@@ -1143,14 +1623,14 @@ module Google
1143
1623
  # # Call the delete_backup method.
1144
1624
  # result = client.delete_backup request
1145
1625
  #
1146
- # # The returned object is of type Gapic::Operation. You can use this
1147
- # # object to check the status of an operation, cancel it, or wait
1148
- # # for results. Here is how to block until completion:
1626
+ # # The returned object is of type Gapic::Operation. You can use it to
1627
+ # # check the status of an operation, cancel it, or wait for results.
1628
+ # # Here is how to wait for a response.
1149
1629
  # result.wait_until_done! timeout: 60
1150
1630
  # if result.response?
1151
1631
  # p result.response
1152
1632
  # else
1153
- # puts "Error!"
1633
+ # puts "No response received."
1154
1634
  # end
1155
1635
  #
1156
1636
  def delete_backup request, options = nil
@@ -1239,14 +1719,14 @@ module Google
1239
1719
  # # Call the update_backup method.
1240
1720
  # result = client.update_backup request
1241
1721
  #
1242
- # # The returned object is of type Gapic::Operation. You can use this
1243
- # # object to check the status of an operation, cancel it, or wait
1244
- # # for results. Here is how to block until completion:
1722
+ # # The returned object is of type Gapic::Operation. You can use it to
1723
+ # # check the status of an operation, cancel it, or wait for results.
1724
+ # # Here is how to wait for a response.
1245
1725
  # result.wait_until_done! timeout: 60
1246
1726
  # if result.response?
1247
1727
  # p result.response
1248
1728
  # else
1249
- # puts "Error!"
1729
+ # puts "No response received."
1250
1730
  # end
1251
1731
  #
1252
1732
  def update_backup request, options = nil
@@ -1329,9 +1809,9 @@ module Google
1329
1809
  # * (`String`) The path to a service account key file in JSON format
1330
1810
  # * (`Hash`) A service account key as a Hash
1331
1811
  # * (`Google::Auth::Credentials`) A googleauth credentials object
1332
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1812
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1333
1813
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1334
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1814
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1335
1815
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1336
1816
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1337
1817
  # * (`nil`) indicating no credentials
@@ -1457,6 +1937,31 @@ module Google
1457
1937
  #
1458
1938
  attr_reader :delete_instance
1459
1939
  ##
1940
+ # RPC-specific configuration for `list_snapshots`
1941
+ # @return [::Gapic::Config::Method]
1942
+ #
1943
+ attr_reader :list_snapshots
1944
+ ##
1945
+ # RPC-specific configuration for `get_snapshot`
1946
+ # @return [::Gapic::Config::Method]
1947
+ #
1948
+ attr_reader :get_snapshot
1949
+ ##
1950
+ # RPC-specific configuration for `create_snapshot`
1951
+ # @return [::Gapic::Config::Method]
1952
+ #
1953
+ attr_reader :create_snapshot
1954
+ ##
1955
+ # RPC-specific configuration for `delete_snapshot`
1956
+ # @return [::Gapic::Config::Method]
1957
+ #
1958
+ attr_reader :delete_snapshot
1959
+ ##
1960
+ # RPC-specific configuration for `update_snapshot`
1961
+ # @return [::Gapic::Config::Method]
1962
+ #
1963
+ attr_reader :update_snapshot
1964
+ ##
1460
1965
  # RPC-specific configuration for `list_backups`
1461
1966
  # @return [::Gapic::Config::Method]
1462
1967
  #
@@ -1496,6 +2001,16 @@ module Google
1496
2001
  @restore_instance = ::Gapic::Config::Method.new restore_instance_config
1497
2002
  delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
1498
2003
  @delete_instance = ::Gapic::Config::Method.new delete_instance_config
2004
+ list_snapshots_config = parent_rpcs.list_snapshots if parent_rpcs.respond_to? :list_snapshots
2005
+ @list_snapshots = ::Gapic::Config::Method.new list_snapshots_config
2006
+ get_snapshot_config = parent_rpcs.get_snapshot if parent_rpcs.respond_to? :get_snapshot
2007
+ @get_snapshot = ::Gapic::Config::Method.new get_snapshot_config
2008
+ create_snapshot_config = parent_rpcs.create_snapshot if parent_rpcs.respond_to? :create_snapshot
2009
+ @create_snapshot = ::Gapic::Config::Method.new create_snapshot_config
2010
+ delete_snapshot_config = parent_rpcs.delete_snapshot if parent_rpcs.respond_to? :delete_snapshot
2011
+ @delete_snapshot = ::Gapic::Config::Method.new delete_snapshot_config
2012
+ update_snapshot_config = parent_rpcs.update_snapshot if parent_rpcs.respond_to? :update_snapshot
2013
+ @update_snapshot = ::Gapic::Config::Method.new update_snapshot_config
1499
2014
  list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
1500
2015
  @list_backups = ::Gapic::Config::Method.new list_backups_config
1501
2016
  get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup