google-cloud-storage_transfer-v1 0.1.1 → 0.3.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.
@@ -32,6 +32,8 @@ module Google
32
32
  # source external to Google to a Cloud Storage bucket.
33
33
  #
34
34
  class Client
35
+ include Paths
36
+
35
37
  # @private
36
38
  attr_reader :storage_transfer_service_stub
37
39
 
@@ -64,7 +66,7 @@ module Google
64
66
  end
65
67
  default_config = Client::Configuration.new parent_config
66
68
 
67
- default_config.timeout = 60.0
69
+ default_config.timeout = 30.0
68
70
 
69
71
  default_config
70
72
  end
@@ -137,6 +139,7 @@ module Google
137
139
 
138
140
  @operations_client = Operations.new do |config|
139
141
  config.credentials = credentials
142
+ config.quota_project = @quota_project_id
140
143
  config.endpoint = @config.endpoint
141
144
  end
142
145
 
@@ -162,7 +165,7 @@ module Google
162
165
  # Returns the Google service account that is used by Storage Transfer
163
166
  # Service to access buckets in the project where transfers
164
167
  # run or in other projects. Each Google service account is associated
165
- # with one Google Cloud Platform Console project. Users
168
+ # with one Google Cloud project. Users
166
169
  # should add this service account to the Google Cloud Storage bucket
167
170
  # ACLs to grant access to Storage Transfer Service. This service
168
171
  # account is created and owned by Storage Transfer Service and can
@@ -184,8 +187,8 @@ module Google
184
187
  # the default parameter values, pass an empty Hash as a request object (see above).
185
188
  #
186
189
  # @param project_id [::String]
187
- # Required. The ID of the Google Cloud Platform Console project that the
188
- # Google service account is associated with.
190
+ # Required. The ID of the Google Cloud project that the Google service
191
+ # account is associated with.
189
192
  #
190
193
  # @yield [response, operation] Access the result along with the RPC operation
191
194
  # @yieldparam response [::Google::Cloud::StorageTransfer::V1::GoogleServiceAccount]
@@ -332,8 +335,8 @@ module Google
332
335
  # Updates a transfer job. Updating a job's transfer spec does not affect
333
336
  # transfer operations that are running already.
334
337
  #
335
- # **Note:** The job's {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}
336
- # field can be modified using this RPC (for example, to set a job's status to
338
+ # **Note:** The job's {::Google::Cloud::StorageTransfer::V1::TransferJob#status status} field can be modified
339
+ # using this RPC (for example, to set a job's status to
337
340
  # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED},
338
341
  # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DISABLED DISABLED}, or
339
342
  # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::ENABLED ENABLED}).
@@ -356,19 +359,18 @@ module Google
356
359
  # @param job_name [::String]
357
360
  # Required. The name of job to update.
358
361
  # @param project_id [::String]
359
- # Required. The ID of the Google Cloud Platform Console project that owns the
362
+ # Required. The ID of the Google Cloud project that owns the
360
363
  # job.
361
364
  # @param transfer_job [::Google::Cloud::StorageTransfer::V1::TransferJob, ::Hash]
362
- # Required. The job to update. `transferJob` is expected to specify only
363
- # four fields:
364
- # {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
365
+ # Required. The job to update. `transferJob` is expected to specify one or more of
366
+ # five fields: {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
365
367
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#transfer_spec transfer_spec},
366
368
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#notification_config notification_config},
367
- # and {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. An
368
- # `UpdateTransferJobRequest` that specifies other fields are rejected with
369
- # the error {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}. Updating a
370
- # job status to
371
- # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED} requires
369
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#logging_config logging_config}, and
370
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. An `UpdateTransferJobRequest` that specifies
371
+ # other fields are rejected with the error
372
+ # {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}. Updating a job status
373
+ # to {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED} requires
372
374
  # `storagetransfer.jobs.delete` permissions.
373
375
  # @param update_transfer_job_field_mask [::Google::Protobuf::FieldMask, ::Hash]
374
376
  # The field mask of the fields in `transferJob` that are to be updated in
@@ -376,10 +378,10 @@ module Google
376
378
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
377
379
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#transfer_spec transfer_spec},
378
380
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#notification_config notification_config},
379
- # and {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. To update the
380
- # `transfer_spec` of the job, a complete transfer specification must be
381
- # provided. An incomplete specification missing any required fields is
382
- # rejected with the error
381
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#logging_config logging_config}, and
382
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. To update the `transfer_spec` of the job, a
383
+ # complete transfer specification must be provided. An incomplete
384
+ # specification missing any required fields is rejected with the error
383
385
  # {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}.
384
386
  #
385
387
  # @yield [response, operation] Access the result along with the RPC operation
@@ -465,10 +467,9 @@ module Google
465
467
  # the default parameter values, pass an empty Hash as a request object (see above).
466
468
  #
467
469
  # @param job_name [::String]
468
- # Required.
469
- # The job to get.
470
+ # Required. The job to get.
470
471
  # @param project_id [::String]
471
- # Required. The ID of the Google Cloud Platform Console project that owns the
472
+ # Required. The ID of the Google Cloud project that owns the
472
473
  # job.
473
474
  #
474
475
  # @yield [response, operation] Access the result along with the RPC operation
@@ -807,7 +808,7 @@ module Google
807
808
  ##
808
809
  # Attempts to start a new TransferOperation for the current TransferJob. A
809
810
  # TransferJob has a maximum of one active TransferOperation. If this method
810
- # is called while a TransferOperation is active, an error wil be returned.
811
+ # is called while a TransferOperation is active, an error will be returned.
811
812
  #
812
813
  # @overload run_transfer_job(request, options = nil)
813
814
  # Pass arguments to `run_transfer_job` via a request object, either of type
@@ -827,8 +828,8 @@ module Google
827
828
  # @param job_name [::String]
828
829
  # Required. The name of the transfer job.
829
830
  # @param project_id [::String]
830
- # Required. The ID of the Google Cloud Platform Console project that owns the
831
- # transfer job.
831
+ # Required. The ID of the Google Cloud project that owns the transfer
832
+ # job.
832
833
  #
833
834
  # @yield [response, operation] Access the result along with the RPC operation
834
835
  # @yieldparam response [::Gapic::Operation]
@@ -902,6 +903,486 @@ module Google
902
903
  raise ::Google::Cloud::Error.from_error(e)
903
904
  end
904
905
 
906
+ ##
907
+ # Creates an agent pool resource.
908
+ #
909
+ # @overload create_agent_pool(request, options = nil)
910
+ # Pass arguments to `create_agent_pool` via a request object, either of type
911
+ # {::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest} or an equivalent Hash.
912
+ #
913
+ # @param request [::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest, ::Hash]
914
+ # A request object representing the call parameters. Required. To specify no
915
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
916
+ # @param options [::Gapic::CallOptions, ::Hash]
917
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
918
+ #
919
+ # @overload create_agent_pool(project_id: nil, agent_pool: nil, agent_pool_id: nil)
920
+ # Pass arguments to `create_agent_pool` via keyword arguments. Note that at
921
+ # least one keyword argument is required. To specify no parameters, or to keep all
922
+ # the default parameter values, pass an empty Hash as a request object (see above).
923
+ #
924
+ # @param project_id [::String]
925
+ # Required. The ID of the Google Cloud project that owns the
926
+ # agent pool.
927
+ # @param agent_pool [::Google::Cloud::StorageTransfer::V1::AgentPool, ::Hash]
928
+ # Required. The agent pool to create.
929
+ # @param agent_pool_id [::String]
930
+ # Required. The ID of the agent pool to create.
931
+ #
932
+ # The `agent_pool_id` must meet the following requirements:
933
+ #
934
+ # * Length of 128 characters or less.
935
+ # * Not start with the string `goog`.
936
+ # * Start with a lowercase ASCII character, followed by:
937
+ # * Zero or more: lowercase Latin alphabet characters, numerals,
938
+ # hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`).
939
+ # * One or more numerals or lowercase ASCII characters.
940
+ #
941
+ # As expressed by the regular expression:
942
+ # `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`.
943
+ #
944
+ # @yield [response, operation] Access the result along with the RPC operation
945
+ # @yieldparam response [::Google::Cloud::StorageTransfer::V1::AgentPool]
946
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
947
+ #
948
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
949
+ #
950
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
951
+ #
952
+ # @example Basic example
953
+ # require "google/cloud/storage_transfer/v1"
954
+ #
955
+ # # Create a client object. The client can be reused for multiple calls.
956
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
957
+ #
958
+ # # Create a request. To set request fields, pass in keyword arguments.
959
+ # request = Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest.new
960
+ #
961
+ # # Call the create_agent_pool method.
962
+ # result = client.create_agent_pool request
963
+ #
964
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::AgentPool.
965
+ # p result
966
+ #
967
+ def create_agent_pool request, options = nil
968
+ raise ::ArgumentError, "request must be provided" if request.nil?
969
+
970
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest
971
+
972
+ # Converts hash and nil to an options object
973
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
974
+
975
+ # Customize the options with defaults
976
+ metadata = @config.rpcs.create_agent_pool.metadata.to_h
977
+
978
+ # Set x-goog-api-client and x-goog-user-project headers
979
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
980
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
981
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
982
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
983
+
984
+ header_params = {}
985
+ if request.project_id
986
+ header_params["project_id"] = request.project_id
987
+ end
988
+
989
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
990
+ metadata[:"x-goog-request-params"] ||= request_params_header
991
+
992
+ options.apply_defaults timeout: @config.rpcs.create_agent_pool.timeout,
993
+ metadata: metadata,
994
+ retry_policy: @config.rpcs.create_agent_pool.retry_policy
995
+
996
+ options.apply_defaults timeout: @config.timeout,
997
+ metadata: @config.metadata,
998
+ retry_policy: @config.retry_policy
999
+
1000
+ @storage_transfer_service_stub.call_rpc :create_agent_pool, request, options: options do |response, operation|
1001
+ yield response, operation if block_given?
1002
+ return response
1003
+ end
1004
+ rescue ::GRPC::BadStatus => e
1005
+ raise ::Google::Cloud::Error.from_error(e)
1006
+ end
1007
+
1008
+ ##
1009
+ # Updates an existing agent pool resource.
1010
+ #
1011
+ # @overload update_agent_pool(request, options = nil)
1012
+ # Pass arguments to `update_agent_pool` via a request object, either of type
1013
+ # {::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest} or an equivalent Hash.
1014
+ #
1015
+ # @param request [::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest, ::Hash]
1016
+ # A request object representing the call parameters. Required. To specify no
1017
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1018
+ # @param options [::Gapic::CallOptions, ::Hash]
1019
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1020
+ #
1021
+ # @overload update_agent_pool(agent_pool: nil, update_mask: nil)
1022
+ # Pass arguments to `update_agent_pool` via keyword arguments. Note that at
1023
+ # least one keyword argument is required. To specify no parameters, or to keep all
1024
+ # the default parameter values, pass an empty Hash as a request object (see above).
1025
+ #
1026
+ # @param agent_pool [::Google::Cloud::StorageTransfer::V1::AgentPool, ::Hash]
1027
+ # Required. The agent pool to update. `agent_pool` is expected to specify following
1028
+ # fields:
1029
+ #
1030
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#name name}
1031
+ #
1032
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#display_name display_name}
1033
+ #
1034
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#bandwidth_limit bandwidth_limit}
1035
+ # An `UpdateAgentPoolRequest` with any other fields is rejected
1036
+ # with the error {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}.
1037
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1038
+ # The [field mask]
1039
+ # (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf)
1040
+ # of the fields in `agentPool` to update in this request.
1041
+ # The following `agentPool` fields can be updated:
1042
+ #
1043
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#display_name display_name}
1044
+ #
1045
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#bandwidth_limit bandwidth_limit}
1046
+ #
1047
+ # @yield [response, operation] Access the result along with the RPC operation
1048
+ # @yieldparam response [::Google::Cloud::StorageTransfer::V1::AgentPool]
1049
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1050
+ #
1051
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
1052
+ #
1053
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1054
+ #
1055
+ # @example Basic example
1056
+ # require "google/cloud/storage_transfer/v1"
1057
+ #
1058
+ # # Create a client object. The client can be reused for multiple calls.
1059
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
1060
+ #
1061
+ # # Create a request. To set request fields, pass in keyword arguments.
1062
+ # request = Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest.new
1063
+ #
1064
+ # # Call the update_agent_pool method.
1065
+ # result = client.update_agent_pool request
1066
+ #
1067
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::AgentPool.
1068
+ # p result
1069
+ #
1070
+ def update_agent_pool request, options = nil
1071
+ raise ::ArgumentError, "request must be provided" if request.nil?
1072
+
1073
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest
1074
+
1075
+ # Converts hash and nil to an options object
1076
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1077
+
1078
+ # Customize the options with defaults
1079
+ metadata = @config.rpcs.update_agent_pool.metadata.to_h
1080
+
1081
+ # Set x-goog-api-client and x-goog-user-project headers
1082
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1083
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1084
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
1085
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1086
+
1087
+ header_params = {}
1088
+ if request.agent_pool&.name
1089
+ header_params["agent_pool.name"] = request.agent_pool.name
1090
+ end
1091
+
1092
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1093
+ metadata[:"x-goog-request-params"] ||= request_params_header
1094
+
1095
+ options.apply_defaults timeout: @config.rpcs.update_agent_pool.timeout,
1096
+ metadata: metadata,
1097
+ retry_policy: @config.rpcs.update_agent_pool.retry_policy
1098
+
1099
+ options.apply_defaults timeout: @config.timeout,
1100
+ metadata: @config.metadata,
1101
+ retry_policy: @config.retry_policy
1102
+
1103
+ @storage_transfer_service_stub.call_rpc :update_agent_pool, request, options: options do |response, operation|
1104
+ yield response, operation if block_given?
1105
+ return response
1106
+ end
1107
+ rescue ::GRPC::BadStatus => e
1108
+ raise ::Google::Cloud::Error.from_error(e)
1109
+ end
1110
+
1111
+ ##
1112
+ # Gets an agent pool.
1113
+ #
1114
+ # @overload get_agent_pool(request, options = nil)
1115
+ # Pass arguments to `get_agent_pool` via a request object, either of type
1116
+ # {::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest} or an equivalent Hash.
1117
+ #
1118
+ # @param request [::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest, ::Hash]
1119
+ # A request object representing the call parameters. Required. To specify no
1120
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1121
+ # @param options [::Gapic::CallOptions, ::Hash]
1122
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1123
+ #
1124
+ # @overload get_agent_pool(name: nil)
1125
+ # Pass arguments to `get_agent_pool` via keyword arguments. Note that at
1126
+ # least one keyword argument is required. To specify no parameters, or to keep all
1127
+ # the default parameter values, pass an empty Hash as a request object (see above).
1128
+ #
1129
+ # @param name [::String]
1130
+ # Required. The name of the agent pool to get.
1131
+ #
1132
+ # @yield [response, operation] Access the result along with the RPC operation
1133
+ # @yieldparam response [::Google::Cloud::StorageTransfer::V1::AgentPool]
1134
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1135
+ #
1136
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
1137
+ #
1138
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1139
+ #
1140
+ # @example Basic example
1141
+ # require "google/cloud/storage_transfer/v1"
1142
+ #
1143
+ # # Create a client object. The client can be reused for multiple calls.
1144
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
1145
+ #
1146
+ # # Create a request. To set request fields, pass in keyword arguments.
1147
+ # request = Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest.new
1148
+ #
1149
+ # # Call the get_agent_pool method.
1150
+ # result = client.get_agent_pool request
1151
+ #
1152
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::AgentPool.
1153
+ # p result
1154
+ #
1155
+ def get_agent_pool request, options = nil
1156
+ raise ::ArgumentError, "request must be provided" if request.nil?
1157
+
1158
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest
1159
+
1160
+ # Converts hash and nil to an options object
1161
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1162
+
1163
+ # Customize the options with defaults
1164
+ metadata = @config.rpcs.get_agent_pool.metadata.to_h
1165
+
1166
+ # Set x-goog-api-client and x-goog-user-project headers
1167
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1168
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1169
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
1170
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1171
+
1172
+ header_params = {}
1173
+ if request.name
1174
+ header_params["name"] = request.name
1175
+ end
1176
+
1177
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1178
+ metadata[:"x-goog-request-params"] ||= request_params_header
1179
+
1180
+ options.apply_defaults timeout: @config.rpcs.get_agent_pool.timeout,
1181
+ metadata: metadata,
1182
+ retry_policy: @config.rpcs.get_agent_pool.retry_policy
1183
+
1184
+ options.apply_defaults timeout: @config.timeout,
1185
+ metadata: @config.metadata,
1186
+ retry_policy: @config.retry_policy
1187
+
1188
+ @storage_transfer_service_stub.call_rpc :get_agent_pool, request, options: options do |response, operation|
1189
+ yield response, operation if block_given?
1190
+ return response
1191
+ end
1192
+ rescue ::GRPC::BadStatus => e
1193
+ raise ::Google::Cloud::Error.from_error(e)
1194
+ end
1195
+
1196
+ ##
1197
+ # Lists agent pools.
1198
+ #
1199
+ # @overload list_agent_pools(request, options = nil)
1200
+ # Pass arguments to `list_agent_pools` via a request object, either of type
1201
+ # {::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest} or an equivalent Hash.
1202
+ #
1203
+ # @param request [::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest, ::Hash]
1204
+ # A request object representing the call parameters. Required. To specify no
1205
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1206
+ # @param options [::Gapic::CallOptions, ::Hash]
1207
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1208
+ #
1209
+ # @overload list_agent_pools(project_id: nil, filter: nil, page_size: nil, page_token: nil)
1210
+ # Pass arguments to `list_agent_pools` via keyword arguments. Note that at
1211
+ # least one keyword argument is required. To specify no parameters, or to keep all
1212
+ # the default parameter values, pass an empty Hash as a request object (see above).
1213
+ #
1214
+ # @param project_id [::String]
1215
+ # Required. The ID of the Google Cloud project that owns the job.
1216
+ # @param filter [::String]
1217
+ # An optional list of query parameters specified as JSON text in the
1218
+ # form of:
1219
+ #
1220
+ # `{"agentPoolNames":["agentpool1","agentpool2",...]}`
1221
+ #
1222
+ # Since `agentPoolNames` support multiple values, its values must be
1223
+ # specified with array notation. When the filter is either empty or not
1224
+ # provided, the list returns all agent pools for the project.
1225
+ # @param page_size [::Integer]
1226
+ # The list page size. The max allowed value is `256`.
1227
+ # @param page_token [::String]
1228
+ # The list page token.
1229
+ #
1230
+ # @yield [response, operation] Access the result along with the RPC operation
1231
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::AgentPool>]
1232
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1233
+ #
1234
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::AgentPool>]
1235
+ #
1236
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1237
+ #
1238
+ # @example Basic example
1239
+ # require "google/cloud/storage_transfer/v1"
1240
+ #
1241
+ # # Create a client object. The client can be reused for multiple calls.
1242
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
1243
+ #
1244
+ # # Create a request. To set request fields, pass in keyword arguments.
1245
+ # request = Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest.new
1246
+ #
1247
+ # # Call the list_agent_pools method.
1248
+ # result = client.list_agent_pools request
1249
+ #
1250
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1251
+ # # iterate over all elements by calling #each, and the enumerable
1252
+ # # will lazily make API calls to fetch subsequent pages. Other
1253
+ # # methods are also available for managing paging directly.
1254
+ # result.each do |response|
1255
+ # # Each element is of type ::Google::Cloud::StorageTransfer::V1::AgentPool.
1256
+ # p response
1257
+ # end
1258
+ #
1259
+ def list_agent_pools request, options = nil
1260
+ raise ::ArgumentError, "request must be provided" if request.nil?
1261
+
1262
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest
1263
+
1264
+ # Converts hash and nil to an options object
1265
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1266
+
1267
+ # Customize the options with defaults
1268
+ metadata = @config.rpcs.list_agent_pools.metadata.to_h
1269
+
1270
+ # Set x-goog-api-client and x-goog-user-project headers
1271
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1272
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1273
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
1274
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1275
+
1276
+ header_params = {}
1277
+ if request.project_id
1278
+ header_params["project_id"] = request.project_id
1279
+ end
1280
+
1281
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1282
+ metadata[:"x-goog-request-params"] ||= request_params_header
1283
+
1284
+ options.apply_defaults timeout: @config.rpcs.list_agent_pools.timeout,
1285
+ metadata: metadata,
1286
+ retry_policy: @config.rpcs.list_agent_pools.retry_policy
1287
+
1288
+ options.apply_defaults timeout: @config.timeout,
1289
+ metadata: @config.metadata,
1290
+ retry_policy: @config.retry_policy
1291
+
1292
+ @storage_transfer_service_stub.call_rpc :list_agent_pools, request, options: options do |response, operation|
1293
+ response = ::Gapic::PagedEnumerable.new @storage_transfer_service_stub, :list_agent_pools, request, response, operation, options
1294
+ yield response, operation if block_given?
1295
+ return response
1296
+ end
1297
+ rescue ::GRPC::BadStatus => e
1298
+ raise ::Google::Cloud::Error.from_error(e)
1299
+ end
1300
+
1301
+ ##
1302
+ # Deletes an agent pool.
1303
+ #
1304
+ # @overload delete_agent_pool(request, options = nil)
1305
+ # Pass arguments to `delete_agent_pool` via a request object, either of type
1306
+ # {::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest} or an equivalent Hash.
1307
+ #
1308
+ # @param request [::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest, ::Hash]
1309
+ # A request object representing the call parameters. Required. To specify no
1310
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1311
+ # @param options [::Gapic::CallOptions, ::Hash]
1312
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1313
+ #
1314
+ # @overload delete_agent_pool(name: nil)
1315
+ # Pass arguments to `delete_agent_pool` via keyword arguments. Note that at
1316
+ # least one keyword argument is required. To specify no parameters, or to keep all
1317
+ # the default parameter values, pass an empty Hash as a request object (see above).
1318
+ #
1319
+ # @param name [::String]
1320
+ # Required. The name of the agent pool to delete.
1321
+ #
1322
+ # @yield [response, operation] Access the result along with the RPC operation
1323
+ # @yieldparam response [::Google::Protobuf::Empty]
1324
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1325
+ #
1326
+ # @return [::Google::Protobuf::Empty]
1327
+ #
1328
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1329
+ #
1330
+ # @example Basic example
1331
+ # require "google/cloud/storage_transfer/v1"
1332
+ #
1333
+ # # Create a client object. The client can be reused for multiple calls.
1334
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
1335
+ #
1336
+ # # Create a request. To set request fields, pass in keyword arguments.
1337
+ # request = Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest.new
1338
+ #
1339
+ # # Call the delete_agent_pool method.
1340
+ # result = client.delete_agent_pool request
1341
+ #
1342
+ # # The returned object is of type Google::Protobuf::Empty.
1343
+ # p result
1344
+ #
1345
+ def delete_agent_pool request, options = nil
1346
+ raise ::ArgumentError, "request must be provided" if request.nil?
1347
+
1348
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest
1349
+
1350
+ # Converts hash and nil to an options object
1351
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1352
+
1353
+ # Customize the options with defaults
1354
+ metadata = @config.rpcs.delete_agent_pool.metadata.to_h
1355
+
1356
+ # Set x-goog-api-client and x-goog-user-project headers
1357
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1358
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1359
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
1360
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1361
+
1362
+ header_params = {}
1363
+ if request.name
1364
+ header_params["name"] = request.name
1365
+ end
1366
+
1367
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1368
+ metadata[:"x-goog-request-params"] ||= request_params_header
1369
+
1370
+ options.apply_defaults timeout: @config.rpcs.delete_agent_pool.timeout,
1371
+ metadata: metadata,
1372
+ retry_policy: @config.rpcs.delete_agent_pool.retry_policy
1373
+
1374
+ options.apply_defaults timeout: @config.timeout,
1375
+ metadata: @config.metadata,
1376
+ retry_policy: @config.retry_policy
1377
+
1378
+ @storage_transfer_service_stub.call_rpc :delete_agent_pool, request, options: options do |response, operation|
1379
+ yield response, operation if block_given?
1380
+ return response
1381
+ end
1382
+ rescue ::GRPC::BadStatus => e
1383
+ raise ::Google::Cloud::Error.from_error(e)
1384
+ end
1385
+
905
1386
  ##
906
1387
  # Configuration class for the StorageTransferService API.
907
1388
  #
@@ -1077,6 +1558,31 @@ module Google
1077
1558
  # @return [::Gapic::Config::Method]
1078
1559
  #
1079
1560
  attr_reader :run_transfer_job
1561
+ ##
1562
+ # RPC-specific configuration for `create_agent_pool`
1563
+ # @return [::Gapic::Config::Method]
1564
+ #
1565
+ attr_reader :create_agent_pool
1566
+ ##
1567
+ # RPC-specific configuration for `update_agent_pool`
1568
+ # @return [::Gapic::Config::Method]
1569
+ #
1570
+ attr_reader :update_agent_pool
1571
+ ##
1572
+ # RPC-specific configuration for `get_agent_pool`
1573
+ # @return [::Gapic::Config::Method]
1574
+ #
1575
+ attr_reader :get_agent_pool
1576
+ ##
1577
+ # RPC-specific configuration for `list_agent_pools`
1578
+ # @return [::Gapic::Config::Method]
1579
+ #
1580
+ attr_reader :list_agent_pools
1581
+ ##
1582
+ # RPC-specific configuration for `delete_agent_pool`
1583
+ # @return [::Gapic::Config::Method]
1584
+ #
1585
+ attr_reader :delete_agent_pool
1080
1586
 
1081
1587
  # @private
1082
1588
  def initialize parent_rpcs = nil
@@ -1096,6 +1602,16 @@ module Google
1096
1602
  @resume_transfer_operation = ::Gapic::Config::Method.new resume_transfer_operation_config
1097
1603
  run_transfer_job_config = parent_rpcs.run_transfer_job if parent_rpcs.respond_to? :run_transfer_job
1098
1604
  @run_transfer_job = ::Gapic::Config::Method.new run_transfer_job_config
1605
+ create_agent_pool_config = parent_rpcs.create_agent_pool if parent_rpcs.respond_to? :create_agent_pool
1606
+ @create_agent_pool = ::Gapic::Config::Method.new create_agent_pool_config
1607
+ update_agent_pool_config = parent_rpcs.update_agent_pool if parent_rpcs.respond_to? :update_agent_pool
1608
+ @update_agent_pool = ::Gapic::Config::Method.new update_agent_pool_config
1609
+ get_agent_pool_config = parent_rpcs.get_agent_pool if parent_rpcs.respond_to? :get_agent_pool
1610
+ @get_agent_pool = ::Gapic::Config::Method.new get_agent_pool_config
1611
+ list_agent_pools_config = parent_rpcs.list_agent_pools if parent_rpcs.respond_to? :list_agent_pools
1612
+ @list_agent_pools = ::Gapic::Config::Method.new list_agent_pools_config
1613
+ delete_agent_pool_config = parent_rpcs.delete_agent_pool if parent_rpcs.respond_to? :delete_agent_pool
1614
+ @delete_agent_pool = ::Gapic::Config::Method.new delete_agent_pool_config
1099
1615
 
1100
1616
  yield self if block_given?
1101
1617
  end