google-cloud-ai_platform-v1 0.27.0 → 0.29.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.
- checksums.yaml +4 -4
- data/lib/google/cloud/ai_platform/v1/prediction_service/client.rb +102 -0
- data/lib/google/cloud/ai_platform/v1/schedule_service/client.rb +1094 -0
- data/lib/google/cloud/ai_platform/v1/schedule_service/credentials.rb +47 -0
- data/lib/google/cloud/ai_platform/v1/schedule_service/operations.rb +778 -0
- data/lib/google/cloud/ai_platform/v1/schedule_service/paths.rb +187 -0
- data/lib/google/cloud/ai_platform/v1/schedule_service.rb +51 -0
- data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
- data/lib/google/cloud/ai_platform/v1.rb +1 -0
- data/lib/google/cloud/aiplatform/v1/prediction_service_pb.rb +5 -1
- data/lib/google/cloud/aiplatform/v1/prediction_service_services_pb.rb +3 -0
- data/lib/google/cloud/aiplatform/v1/schedule_pb.rb +51 -0
- data/lib/google/cloud/aiplatform/v1/schedule_service_pb.rb +61 -0
- data/lib/google/cloud/aiplatform/v1/schedule_service_services_pb.rb +74 -0
- data/lib/google/cloud/aiplatform/v1/types_pb.rb +3 -1
- data/proto_docs/google/cloud/aiplatform/v1/prediction_service.rb +39 -0
- data/proto_docs/google/cloud/aiplatform/v1/schedule.rb +152 -0
- data/proto_docs/google/cloud/aiplatform/v1/schedule_service.rb +201 -0
- data/proto_docs/google/cloud/aiplatform/v1/types.rb +99 -0
- metadata +12 -2
@@ -0,0 +1,1094 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/aiplatform/v1/schedule_service_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
require "google/iam/v1"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module AIPlatform
|
27
|
+
module V1
|
28
|
+
module ScheduleService
|
29
|
+
##
|
30
|
+
# Client for the ScheduleService service.
|
31
|
+
#
|
32
|
+
# A service for creating and managing Vertex AI's Schedule resources to
|
33
|
+
# periodically launch shceudled runs to make API calls.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :schedule_service_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the ScheduleService Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::AIPlatform::V1::ScheduleService::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all ScheduleService clients
|
50
|
+
# ::Google::Cloud::AIPlatform::V1::ScheduleService::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @yield [config] Configure the Client client.
|
55
|
+
# @yieldparam config [Client::Configuration]
|
56
|
+
#
|
57
|
+
# @return [Client::Configuration]
|
58
|
+
#
|
59
|
+
def self.configure
|
60
|
+
@configure ||= begin
|
61
|
+
namespace = ["Google", "Cloud", "AIPlatform", "V1"]
|
62
|
+
parent_config = while namespace.any?
|
63
|
+
parent_name = namespace.join "::"
|
64
|
+
parent_const = const_get parent_name
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
+
namespace.pop
|
67
|
+
end
|
68
|
+
default_config = Client::Configuration.new parent_config
|
69
|
+
|
70
|
+
default_config
|
71
|
+
end
|
72
|
+
yield @configure if block_given?
|
73
|
+
@configure
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Configure the ScheduleService Client instance.
|
78
|
+
#
|
79
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
80
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
81
|
+
# should be made on {Client.configure}.
|
82
|
+
#
|
83
|
+
# See {::Google::Cloud::AIPlatform::V1::ScheduleService::Client::Configuration}
|
84
|
+
# for a description of the configuration fields.
|
85
|
+
#
|
86
|
+
# @yield [config] Configure the Client client.
|
87
|
+
# @yieldparam config [Client::Configuration]
|
88
|
+
#
|
89
|
+
# @return [Client::Configuration]
|
90
|
+
#
|
91
|
+
def configure
|
92
|
+
yield @config if block_given?
|
93
|
+
@config
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Create a new ScheduleService client object.
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
#
|
101
|
+
# # Create a client using the default configuration
|
102
|
+
# client = ::Google::Cloud::AIPlatform::V1::ScheduleService::Client.new
|
103
|
+
#
|
104
|
+
# # Create a client using a custom configuration
|
105
|
+
# client = ::Google::Cloud::AIPlatform::V1::ScheduleService::Client.new do |config|
|
106
|
+
# config.timeout = 10.0
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# @yield [config] Configure the ScheduleService client.
|
110
|
+
# @yieldparam config [Client::Configuration]
|
111
|
+
#
|
112
|
+
def initialize
|
113
|
+
# These require statements are intentionally placed here to initialize
|
114
|
+
# the gRPC module only when it's required.
|
115
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
116
|
+
require "gapic/grpc"
|
117
|
+
require "google/cloud/aiplatform/v1/schedule_service_services_pb"
|
118
|
+
|
119
|
+
# Create the configuration object
|
120
|
+
@config = Configuration.new Client.configure
|
121
|
+
|
122
|
+
# Yield the configuration if needed
|
123
|
+
yield @config if block_given?
|
124
|
+
|
125
|
+
# Create credentials
|
126
|
+
credentials = @config.credentials
|
127
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
128
|
+
# but only if the default endpoint does not have a region prefix.
|
129
|
+
enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
130
|
+
!@config.endpoint.split(".").first.include?("-")
|
131
|
+
credentials ||= Credentials.default scope: @config.scope,
|
132
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
133
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
134
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
135
|
+
end
|
136
|
+
@quota_project_id = @config.quota_project
|
137
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
138
|
+
|
139
|
+
@operations_client = Operations.new do |config|
|
140
|
+
config.credentials = credentials
|
141
|
+
config.quota_project = @quota_project_id
|
142
|
+
config.endpoint = @config.endpoint
|
143
|
+
end
|
144
|
+
|
145
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
146
|
+
config.credentials = credentials
|
147
|
+
config.quota_project = @quota_project_id
|
148
|
+
config.endpoint = @config.endpoint
|
149
|
+
end
|
150
|
+
|
151
|
+
@iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
|
152
|
+
config.credentials = credentials
|
153
|
+
config.quota_project = @quota_project_id
|
154
|
+
config.endpoint = @config.endpoint
|
155
|
+
end
|
156
|
+
|
157
|
+
@schedule_service_stub = ::Gapic::ServiceStub.new(
|
158
|
+
::Google::Cloud::AIPlatform::V1::ScheduleService::Stub,
|
159
|
+
credentials: credentials,
|
160
|
+
endpoint: @config.endpoint,
|
161
|
+
channel_args: @config.channel_args,
|
162
|
+
interceptors: @config.interceptors
|
163
|
+
)
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Get the associated client for long-running operations.
|
168
|
+
#
|
169
|
+
# @return [::Google::Cloud::AIPlatform::V1::ScheduleService::Operations]
|
170
|
+
#
|
171
|
+
attr_reader :operations_client
|
172
|
+
|
173
|
+
##
|
174
|
+
# Get the associated client for mix-in of the Locations.
|
175
|
+
#
|
176
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
177
|
+
#
|
178
|
+
attr_reader :location_client
|
179
|
+
|
180
|
+
##
|
181
|
+
# Get the associated client for mix-in of the IAMPolicy.
|
182
|
+
#
|
183
|
+
# @return [Google::Iam::V1::IAMPolicy::Client]
|
184
|
+
#
|
185
|
+
attr_reader :iam_policy_client
|
186
|
+
|
187
|
+
# Service calls
|
188
|
+
|
189
|
+
##
|
190
|
+
# Creates a Schedule.
|
191
|
+
#
|
192
|
+
# @overload create_schedule(request, options = nil)
|
193
|
+
# Pass arguments to `create_schedule` via a request object, either of type
|
194
|
+
# {::Google::Cloud::AIPlatform::V1::CreateScheduleRequest} or an equivalent Hash.
|
195
|
+
#
|
196
|
+
# @param request [::Google::Cloud::AIPlatform::V1::CreateScheduleRequest, ::Hash]
|
197
|
+
# A request object representing the call parameters. Required. To specify no
|
198
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
199
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
200
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
201
|
+
#
|
202
|
+
# @overload create_schedule(parent: nil, schedule: nil)
|
203
|
+
# Pass arguments to `create_schedule` via keyword arguments. Note that at
|
204
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
205
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
206
|
+
#
|
207
|
+
# @param parent [::String]
|
208
|
+
# Required. The resource name of the Location to create the Schedule in.
|
209
|
+
# Format: `projects/{project}/locations/{location}`
|
210
|
+
# @param schedule [::Google::Cloud::AIPlatform::V1::Schedule, ::Hash]
|
211
|
+
# Required. The Schedule to create.
|
212
|
+
#
|
213
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
214
|
+
# @yieldparam response [::Google::Cloud::AIPlatform::V1::Schedule]
|
215
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
216
|
+
#
|
217
|
+
# @return [::Google::Cloud::AIPlatform::V1::Schedule]
|
218
|
+
#
|
219
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
220
|
+
#
|
221
|
+
# @example Basic example
|
222
|
+
# require "google/cloud/ai_platform/v1"
|
223
|
+
#
|
224
|
+
# # Create a client object. The client can be reused for multiple calls.
|
225
|
+
# client = Google::Cloud::AIPlatform::V1::ScheduleService::Client.new
|
226
|
+
#
|
227
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
228
|
+
# request = Google::Cloud::AIPlatform::V1::CreateScheduleRequest.new
|
229
|
+
#
|
230
|
+
# # Call the create_schedule method.
|
231
|
+
# result = client.create_schedule request
|
232
|
+
#
|
233
|
+
# # The returned object is of type Google::Cloud::AIPlatform::V1::Schedule.
|
234
|
+
# p result
|
235
|
+
#
|
236
|
+
def create_schedule request, options = nil
|
237
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
238
|
+
|
239
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::CreateScheduleRequest
|
240
|
+
|
241
|
+
# Converts hash and nil to an options object
|
242
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
243
|
+
|
244
|
+
# Customize the options with defaults
|
245
|
+
metadata = @config.rpcs.create_schedule.metadata.to_h
|
246
|
+
|
247
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
248
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
249
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
250
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
|
251
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
252
|
+
|
253
|
+
header_params = {}
|
254
|
+
if request.parent
|
255
|
+
header_params["parent"] = request.parent
|
256
|
+
end
|
257
|
+
|
258
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
259
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
260
|
+
|
261
|
+
options.apply_defaults timeout: @config.rpcs.create_schedule.timeout,
|
262
|
+
metadata: metadata,
|
263
|
+
retry_policy: @config.rpcs.create_schedule.retry_policy
|
264
|
+
|
265
|
+
options.apply_defaults timeout: @config.timeout,
|
266
|
+
metadata: @config.metadata,
|
267
|
+
retry_policy: @config.retry_policy
|
268
|
+
|
269
|
+
@schedule_service_stub.call_rpc :create_schedule, request, options: options do |response, operation|
|
270
|
+
yield response, operation if block_given?
|
271
|
+
return response
|
272
|
+
end
|
273
|
+
rescue ::GRPC::BadStatus => e
|
274
|
+
raise ::Google::Cloud::Error.from_error(e)
|
275
|
+
end
|
276
|
+
|
277
|
+
##
|
278
|
+
# Deletes a Schedule.
|
279
|
+
#
|
280
|
+
# @overload delete_schedule(request, options = nil)
|
281
|
+
# Pass arguments to `delete_schedule` via a request object, either of type
|
282
|
+
# {::Google::Cloud::AIPlatform::V1::DeleteScheduleRequest} or an equivalent Hash.
|
283
|
+
#
|
284
|
+
# @param request [::Google::Cloud::AIPlatform::V1::DeleteScheduleRequest, ::Hash]
|
285
|
+
# A request object representing the call parameters. Required. To specify no
|
286
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
287
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
288
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
289
|
+
#
|
290
|
+
# @overload delete_schedule(name: nil)
|
291
|
+
# Pass arguments to `delete_schedule` via keyword arguments. Note that at
|
292
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
293
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
294
|
+
#
|
295
|
+
# @param name [::String]
|
296
|
+
# Required. The name of the Schedule resource to be deleted.
|
297
|
+
# Format:
|
298
|
+
# `projects/{project}/locations/{location}/schedules/{schedule}`
|
299
|
+
#
|
300
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
301
|
+
# @yieldparam response [::Gapic::Operation]
|
302
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
303
|
+
#
|
304
|
+
# @return [::Gapic::Operation]
|
305
|
+
#
|
306
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
307
|
+
#
|
308
|
+
# @example Basic example
|
309
|
+
# require "google/cloud/ai_platform/v1"
|
310
|
+
#
|
311
|
+
# # Create a client object. The client can be reused for multiple calls.
|
312
|
+
# client = Google::Cloud::AIPlatform::V1::ScheduleService::Client.new
|
313
|
+
#
|
314
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
315
|
+
# request = Google::Cloud::AIPlatform::V1::DeleteScheduleRequest.new
|
316
|
+
#
|
317
|
+
# # Call the delete_schedule method.
|
318
|
+
# result = client.delete_schedule request
|
319
|
+
#
|
320
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
321
|
+
# # check the status of an operation, cancel it, or wait for results.
|
322
|
+
# # Here is how to wait for a response.
|
323
|
+
# result.wait_until_done! timeout: 60
|
324
|
+
# if result.response?
|
325
|
+
# p result.response
|
326
|
+
# else
|
327
|
+
# puts "No response received."
|
328
|
+
# end
|
329
|
+
#
|
330
|
+
def delete_schedule request, options = nil
|
331
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
332
|
+
|
333
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::DeleteScheduleRequest
|
334
|
+
|
335
|
+
# Converts hash and nil to an options object
|
336
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
337
|
+
|
338
|
+
# Customize the options with defaults
|
339
|
+
metadata = @config.rpcs.delete_schedule.metadata.to_h
|
340
|
+
|
341
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
342
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
343
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
344
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
|
345
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
346
|
+
|
347
|
+
header_params = {}
|
348
|
+
if request.name
|
349
|
+
header_params["name"] = request.name
|
350
|
+
end
|
351
|
+
|
352
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
353
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
354
|
+
|
355
|
+
options.apply_defaults timeout: @config.rpcs.delete_schedule.timeout,
|
356
|
+
metadata: metadata,
|
357
|
+
retry_policy: @config.rpcs.delete_schedule.retry_policy
|
358
|
+
|
359
|
+
options.apply_defaults timeout: @config.timeout,
|
360
|
+
metadata: @config.metadata,
|
361
|
+
retry_policy: @config.retry_policy
|
362
|
+
|
363
|
+
@schedule_service_stub.call_rpc :delete_schedule, request, options: options do |response, operation|
|
364
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
365
|
+
yield response, operation if block_given?
|
366
|
+
return response
|
367
|
+
end
|
368
|
+
rescue ::GRPC::BadStatus => e
|
369
|
+
raise ::Google::Cloud::Error.from_error(e)
|
370
|
+
end
|
371
|
+
|
372
|
+
##
|
373
|
+
# Gets a Schedule.
|
374
|
+
#
|
375
|
+
# @overload get_schedule(request, options = nil)
|
376
|
+
# Pass arguments to `get_schedule` via a request object, either of type
|
377
|
+
# {::Google::Cloud::AIPlatform::V1::GetScheduleRequest} or an equivalent Hash.
|
378
|
+
#
|
379
|
+
# @param request [::Google::Cloud::AIPlatform::V1::GetScheduleRequest, ::Hash]
|
380
|
+
# A request object representing the call parameters. Required. To specify no
|
381
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
382
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
383
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
384
|
+
#
|
385
|
+
# @overload get_schedule(name: nil)
|
386
|
+
# Pass arguments to `get_schedule` via keyword arguments. Note that at
|
387
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
388
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
389
|
+
#
|
390
|
+
# @param name [::String]
|
391
|
+
# Required. The name of the Schedule resource.
|
392
|
+
# Format:
|
393
|
+
# `projects/{project}/locations/{location}/schedules/{schedule}`
|
394
|
+
#
|
395
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
396
|
+
# @yieldparam response [::Google::Cloud::AIPlatform::V1::Schedule]
|
397
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
398
|
+
#
|
399
|
+
# @return [::Google::Cloud::AIPlatform::V1::Schedule]
|
400
|
+
#
|
401
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
402
|
+
#
|
403
|
+
# @example Basic example
|
404
|
+
# require "google/cloud/ai_platform/v1"
|
405
|
+
#
|
406
|
+
# # Create a client object. The client can be reused for multiple calls.
|
407
|
+
# client = Google::Cloud::AIPlatform::V1::ScheduleService::Client.new
|
408
|
+
#
|
409
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
410
|
+
# request = Google::Cloud::AIPlatform::V1::GetScheduleRequest.new
|
411
|
+
#
|
412
|
+
# # Call the get_schedule method.
|
413
|
+
# result = client.get_schedule request
|
414
|
+
#
|
415
|
+
# # The returned object is of type Google::Cloud::AIPlatform::V1::Schedule.
|
416
|
+
# p result
|
417
|
+
#
|
418
|
+
def get_schedule request, options = nil
|
419
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
420
|
+
|
421
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::GetScheduleRequest
|
422
|
+
|
423
|
+
# Converts hash and nil to an options object
|
424
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
425
|
+
|
426
|
+
# Customize the options with defaults
|
427
|
+
metadata = @config.rpcs.get_schedule.metadata.to_h
|
428
|
+
|
429
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
430
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
431
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
432
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
|
433
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
434
|
+
|
435
|
+
header_params = {}
|
436
|
+
if request.name
|
437
|
+
header_params["name"] = request.name
|
438
|
+
end
|
439
|
+
|
440
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
441
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
442
|
+
|
443
|
+
options.apply_defaults timeout: @config.rpcs.get_schedule.timeout,
|
444
|
+
metadata: metadata,
|
445
|
+
retry_policy: @config.rpcs.get_schedule.retry_policy
|
446
|
+
|
447
|
+
options.apply_defaults timeout: @config.timeout,
|
448
|
+
metadata: @config.metadata,
|
449
|
+
retry_policy: @config.retry_policy
|
450
|
+
|
451
|
+
@schedule_service_stub.call_rpc :get_schedule, request, options: options do |response, operation|
|
452
|
+
yield response, operation if block_given?
|
453
|
+
return response
|
454
|
+
end
|
455
|
+
rescue ::GRPC::BadStatus => e
|
456
|
+
raise ::Google::Cloud::Error.from_error(e)
|
457
|
+
end
|
458
|
+
|
459
|
+
##
|
460
|
+
# Lists Schedules in a Location.
|
461
|
+
#
|
462
|
+
# @overload list_schedules(request, options = nil)
|
463
|
+
# Pass arguments to `list_schedules` via a request object, either of type
|
464
|
+
# {::Google::Cloud::AIPlatform::V1::ListSchedulesRequest} or an equivalent Hash.
|
465
|
+
#
|
466
|
+
# @param request [::Google::Cloud::AIPlatform::V1::ListSchedulesRequest, ::Hash]
|
467
|
+
# A request object representing the call parameters. Required. To specify no
|
468
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
469
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
470
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
471
|
+
#
|
472
|
+
# @overload list_schedules(parent: nil, filter: nil, page_size: nil, page_token: nil, order_by: nil)
|
473
|
+
# Pass arguments to `list_schedules` via keyword arguments. Note that at
|
474
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
475
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
476
|
+
#
|
477
|
+
# @param parent [::String]
|
478
|
+
# Required. The resource name of the Location to list the Schedules from.
|
479
|
+
# Format: `projects/{project}/locations/{location}`
|
480
|
+
# @param filter [::String]
|
481
|
+
# Lists the Schedules that match the filter expression. The following
|
482
|
+
# fields are supported:
|
483
|
+
#
|
484
|
+
# * `display_name`: Supports `=`, `!=` comparisons, and `:` wildcard.
|
485
|
+
# * `state`: Supports `=` and `!=` comparisons.
|
486
|
+
# * `request`: Supports existence of the <request_type> check.
|
487
|
+
# (e.g. `create_pipeline_job_request:*` --> Schedule has
|
488
|
+
# create_pipeline_job_request).
|
489
|
+
# * `create_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
|
490
|
+
# Values must be in RFC 3339 format.
|
491
|
+
# * `start_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=` comparisons.
|
492
|
+
# Values must be in RFC 3339 format.
|
493
|
+
# * `end_time`: Supports `=`, `!=`, `<`, `>`, `<=`, `>=` comparisons and `:*`
|
494
|
+
# existence check. Values must be in RFC 3339 format.
|
495
|
+
# * `next_run_time`: Supports `=`, `!=`, `<`, `>`, `<=`, and `>=`
|
496
|
+
# comparisons. Values must be in RFC 3339 format.
|
497
|
+
#
|
498
|
+
#
|
499
|
+
# Filter expressions can be combined together using logical operators
|
500
|
+
# (`NOT`, `AND` & `OR`).
|
501
|
+
# The syntax to define filter expression is based on
|
502
|
+
# https://google.aip.dev/160.
|
503
|
+
#
|
504
|
+
# Examples:
|
505
|
+
#
|
506
|
+
# * `state="ACTIVE" AND display_name:"my_schedule_*"`
|
507
|
+
# * `NOT display_name="my_schedule"`
|
508
|
+
# * `create_time>"2021-05-18T00:00:00Z"`
|
509
|
+
# * `end_time>"2021-05-18T00:00:00Z" OR NOT end_time:*`
|
510
|
+
# * `create_pipeline_job_request:*`
|
511
|
+
# @param page_size [::Integer]
|
512
|
+
# The standard list page size.
|
513
|
+
# Default to 100 if not specified.
|
514
|
+
# @param page_token [::String]
|
515
|
+
# The standard list page token.
|
516
|
+
# Typically obtained via
|
517
|
+
# {::Google::Cloud::AIPlatform::V1::ListSchedulesResponse#next_page_token ListSchedulesResponse.next_page_token}
|
518
|
+
# of the previous
|
519
|
+
# {::Google::Cloud::AIPlatform::V1::ScheduleService::Client#list_schedules ScheduleService.ListSchedules}
|
520
|
+
# call.
|
521
|
+
# @param order_by [::String]
|
522
|
+
# A comma-separated list of fields to order by. The default sort order is in
|
523
|
+
# ascending order. Use "desc" after a field name for descending. You can have
|
524
|
+
# multiple order_by fields provided.
|
525
|
+
#
|
526
|
+
# For example, using "create_time desc, end_time" will order results by
|
527
|
+
# create time in descending order, and if there are multiple schedules having
|
528
|
+
# the same create time, order them by the end time in ascending order.
|
529
|
+
#
|
530
|
+
# If order_by is not specified, it will order by default with create_time in
|
531
|
+
# descending order.
|
532
|
+
#
|
533
|
+
# Supported fields:
|
534
|
+
# * `create_time`
|
535
|
+
# * `start_time`
|
536
|
+
# * `end_time`
|
537
|
+
# * `next_run_time`
|
538
|
+
#
|
539
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
540
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Schedule>]
|
541
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
542
|
+
#
|
543
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Schedule>]
|
544
|
+
#
|
545
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
546
|
+
#
|
547
|
+
# @example Basic example
|
548
|
+
# require "google/cloud/ai_platform/v1"
|
549
|
+
#
|
550
|
+
# # Create a client object. The client can be reused for multiple calls.
|
551
|
+
# client = Google::Cloud::AIPlatform::V1::ScheduleService::Client.new
|
552
|
+
#
|
553
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
554
|
+
# request = Google::Cloud::AIPlatform::V1::ListSchedulesRequest.new
|
555
|
+
#
|
556
|
+
# # Call the list_schedules method.
|
557
|
+
# result = client.list_schedules request
|
558
|
+
#
|
559
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
560
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
561
|
+
# result.each do |item|
|
562
|
+
# # Each element is of type ::Google::Cloud::AIPlatform::V1::Schedule.
|
563
|
+
# p item
|
564
|
+
# end
|
565
|
+
#
|
566
|
+
def list_schedules request, options = nil
|
567
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
568
|
+
|
569
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::ListSchedulesRequest
|
570
|
+
|
571
|
+
# Converts hash and nil to an options object
|
572
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
573
|
+
|
574
|
+
# Customize the options with defaults
|
575
|
+
metadata = @config.rpcs.list_schedules.metadata.to_h
|
576
|
+
|
577
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
578
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
579
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
580
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
|
581
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
582
|
+
|
583
|
+
header_params = {}
|
584
|
+
if request.parent
|
585
|
+
header_params["parent"] = request.parent
|
586
|
+
end
|
587
|
+
|
588
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
589
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
590
|
+
|
591
|
+
options.apply_defaults timeout: @config.rpcs.list_schedules.timeout,
|
592
|
+
metadata: metadata,
|
593
|
+
retry_policy: @config.rpcs.list_schedules.retry_policy
|
594
|
+
|
595
|
+
options.apply_defaults timeout: @config.timeout,
|
596
|
+
metadata: @config.metadata,
|
597
|
+
retry_policy: @config.retry_policy
|
598
|
+
|
599
|
+
@schedule_service_stub.call_rpc :list_schedules, request, options: options do |response, operation|
|
600
|
+
response = ::Gapic::PagedEnumerable.new @schedule_service_stub, :list_schedules, request, response, operation, options
|
601
|
+
yield response, operation if block_given?
|
602
|
+
return response
|
603
|
+
end
|
604
|
+
rescue ::GRPC::BadStatus => e
|
605
|
+
raise ::Google::Cloud::Error.from_error(e)
|
606
|
+
end
|
607
|
+
|
608
|
+
##
|
609
|
+
# Pauses a Schedule. Will mark
|
610
|
+
# {::Google::Cloud::AIPlatform::V1::Schedule#state Schedule.state} to 'PAUSED'. If
|
611
|
+
# the schedule is paused, no new runs will be created. Already created runs
|
612
|
+
# will NOT be paused or canceled.
|
613
|
+
#
|
614
|
+
# @overload pause_schedule(request, options = nil)
|
615
|
+
# Pass arguments to `pause_schedule` via a request object, either of type
|
616
|
+
# {::Google::Cloud::AIPlatform::V1::PauseScheduleRequest} or an equivalent Hash.
|
617
|
+
#
|
618
|
+
# @param request [::Google::Cloud::AIPlatform::V1::PauseScheduleRequest, ::Hash]
|
619
|
+
# A request object representing the call parameters. Required. To specify no
|
620
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
621
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
622
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
623
|
+
#
|
624
|
+
# @overload pause_schedule(name: nil)
|
625
|
+
# Pass arguments to `pause_schedule` via keyword arguments. Note that at
|
626
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
627
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
628
|
+
#
|
629
|
+
# @param name [::String]
|
630
|
+
# Required. The name of the Schedule resource to be paused.
|
631
|
+
# Format:
|
632
|
+
# `projects/{project}/locations/{location}/schedules/{schedule}`
|
633
|
+
#
|
634
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
635
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
636
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
637
|
+
#
|
638
|
+
# @return [::Google::Protobuf::Empty]
|
639
|
+
#
|
640
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
641
|
+
#
|
642
|
+
# @example Basic example
|
643
|
+
# require "google/cloud/ai_platform/v1"
|
644
|
+
#
|
645
|
+
# # Create a client object. The client can be reused for multiple calls.
|
646
|
+
# client = Google::Cloud::AIPlatform::V1::ScheduleService::Client.new
|
647
|
+
#
|
648
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
649
|
+
# request = Google::Cloud::AIPlatform::V1::PauseScheduleRequest.new
|
650
|
+
#
|
651
|
+
# # Call the pause_schedule method.
|
652
|
+
# result = client.pause_schedule request
|
653
|
+
#
|
654
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
655
|
+
# p result
|
656
|
+
#
|
657
|
+
def pause_schedule request, options = nil
|
658
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
659
|
+
|
660
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::PauseScheduleRequest
|
661
|
+
|
662
|
+
# Converts hash and nil to an options object
|
663
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
664
|
+
|
665
|
+
# Customize the options with defaults
|
666
|
+
metadata = @config.rpcs.pause_schedule.metadata.to_h
|
667
|
+
|
668
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
669
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
670
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
671
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
|
672
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
673
|
+
|
674
|
+
header_params = {}
|
675
|
+
if request.name
|
676
|
+
header_params["name"] = request.name
|
677
|
+
end
|
678
|
+
|
679
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
680
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
681
|
+
|
682
|
+
options.apply_defaults timeout: @config.rpcs.pause_schedule.timeout,
|
683
|
+
metadata: metadata,
|
684
|
+
retry_policy: @config.rpcs.pause_schedule.retry_policy
|
685
|
+
|
686
|
+
options.apply_defaults timeout: @config.timeout,
|
687
|
+
metadata: @config.metadata,
|
688
|
+
retry_policy: @config.retry_policy
|
689
|
+
|
690
|
+
@schedule_service_stub.call_rpc :pause_schedule, request, options: options do |response, operation|
|
691
|
+
yield response, operation if block_given?
|
692
|
+
return response
|
693
|
+
end
|
694
|
+
rescue ::GRPC::BadStatus => e
|
695
|
+
raise ::Google::Cloud::Error.from_error(e)
|
696
|
+
end
|
697
|
+
|
698
|
+
##
|
699
|
+
# Resumes a paused Schedule to start scheduling new runs. Will mark
|
700
|
+
# {::Google::Cloud::AIPlatform::V1::Schedule#state Schedule.state} to 'ACTIVE'.
|
701
|
+
# Only paused Schedule can be resumed.
|
702
|
+
#
|
703
|
+
# When the Schedule is resumed, new runs will be scheduled starting from the
|
704
|
+
# next execution time after the current time based on the time_specification
|
705
|
+
# in the Schedule. If [Schedule.catchUp][] is set up true, all
|
706
|
+
# missed runs will be scheduled for backfill first.
|
707
|
+
#
|
708
|
+
# @overload resume_schedule(request, options = nil)
|
709
|
+
# Pass arguments to `resume_schedule` via a request object, either of type
|
710
|
+
# {::Google::Cloud::AIPlatform::V1::ResumeScheduleRequest} or an equivalent Hash.
|
711
|
+
#
|
712
|
+
# @param request [::Google::Cloud::AIPlatform::V1::ResumeScheduleRequest, ::Hash]
|
713
|
+
# A request object representing the call parameters. Required. To specify no
|
714
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
715
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
716
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
717
|
+
#
|
718
|
+
# @overload resume_schedule(name: nil, catch_up: nil)
|
719
|
+
# Pass arguments to `resume_schedule` via keyword arguments. Note that at
|
720
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
721
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
722
|
+
#
|
723
|
+
# @param name [::String]
|
724
|
+
# Required. The name of the Schedule resource to be resumed.
|
725
|
+
# Format:
|
726
|
+
# `projects/{project}/locations/{location}/schedules/{schedule}`
|
727
|
+
# @param catch_up [::Boolean]
|
728
|
+
# Optional. Whether to backfill missed runs when the schedule is resumed from
|
729
|
+
# PAUSED state. If set to true, all missed runs will be scheduled. New runs
|
730
|
+
# will be scheduled after the backfill is complete. This will also update
|
731
|
+
# {::Google::Cloud::AIPlatform::V1::Schedule#catch_up Schedule.catch_up} field.
|
732
|
+
# Default to false.
|
733
|
+
#
|
734
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
735
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
736
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
737
|
+
#
|
738
|
+
# @return [::Google::Protobuf::Empty]
|
739
|
+
#
|
740
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
741
|
+
#
|
742
|
+
# @example Basic example
|
743
|
+
# require "google/cloud/ai_platform/v1"
|
744
|
+
#
|
745
|
+
# # Create a client object. The client can be reused for multiple calls.
|
746
|
+
# client = Google::Cloud::AIPlatform::V1::ScheduleService::Client.new
|
747
|
+
#
|
748
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
749
|
+
# request = Google::Cloud::AIPlatform::V1::ResumeScheduleRequest.new
|
750
|
+
#
|
751
|
+
# # Call the resume_schedule method.
|
752
|
+
# result = client.resume_schedule request
|
753
|
+
#
|
754
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
755
|
+
# p result
|
756
|
+
#
|
757
|
+
def resume_schedule request, options = nil
|
758
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
759
|
+
|
760
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::ResumeScheduleRequest
|
761
|
+
|
762
|
+
# Converts hash and nil to an options object
|
763
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
764
|
+
|
765
|
+
# Customize the options with defaults
|
766
|
+
metadata = @config.rpcs.resume_schedule.metadata.to_h
|
767
|
+
|
768
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
769
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
770
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
771
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
|
772
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
773
|
+
|
774
|
+
header_params = {}
|
775
|
+
if request.name
|
776
|
+
header_params["name"] = request.name
|
777
|
+
end
|
778
|
+
|
779
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
780
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
781
|
+
|
782
|
+
options.apply_defaults timeout: @config.rpcs.resume_schedule.timeout,
|
783
|
+
metadata: metadata,
|
784
|
+
retry_policy: @config.rpcs.resume_schedule.retry_policy
|
785
|
+
|
786
|
+
options.apply_defaults timeout: @config.timeout,
|
787
|
+
metadata: @config.metadata,
|
788
|
+
retry_policy: @config.retry_policy
|
789
|
+
|
790
|
+
@schedule_service_stub.call_rpc :resume_schedule, request, options: options do |response, operation|
|
791
|
+
yield response, operation if block_given?
|
792
|
+
return response
|
793
|
+
end
|
794
|
+
rescue ::GRPC::BadStatus => e
|
795
|
+
raise ::Google::Cloud::Error.from_error(e)
|
796
|
+
end
|
797
|
+
|
798
|
+
##
|
799
|
+
# Updates an active or paused Schedule.
|
800
|
+
#
|
801
|
+
# When the Schedule is updated, new runs will be scheduled starting from the
|
802
|
+
# updated next execution time after the update time based on the
|
803
|
+
# time_specification in the updated Schedule. All unstarted runs before the
|
804
|
+
# update time will be skipped while already created runs will NOT be paused
|
805
|
+
# or canceled.
|
806
|
+
#
|
807
|
+
# @overload update_schedule(request, options = nil)
|
808
|
+
# Pass arguments to `update_schedule` via a request object, either of type
|
809
|
+
# {::Google::Cloud::AIPlatform::V1::UpdateScheduleRequest} or an equivalent Hash.
|
810
|
+
#
|
811
|
+
# @param request [::Google::Cloud::AIPlatform::V1::UpdateScheduleRequest, ::Hash]
|
812
|
+
# A request object representing the call parameters. Required. To specify no
|
813
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
814
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
815
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
816
|
+
#
|
817
|
+
# @overload update_schedule(schedule: nil, update_mask: nil)
|
818
|
+
# Pass arguments to `update_schedule` via keyword arguments. Note that at
|
819
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
820
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
821
|
+
#
|
822
|
+
# @param schedule [::Google::Cloud::AIPlatform::V1::Schedule, ::Hash]
|
823
|
+
# Required. The Schedule which replaces the resource on the server.
|
824
|
+
# The following restrictions will be applied:
|
825
|
+
# * The scheduled request type cannot be changed.
|
826
|
+
# * The output_only fields will be ignored if specified.
|
827
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
828
|
+
# Required. The update mask applies to the resource. See
|
829
|
+
# {::Google::Protobuf::FieldMask google.protobuf.FieldMask}.
|
830
|
+
#
|
831
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
832
|
+
# @yieldparam response [::Google::Cloud::AIPlatform::V1::Schedule]
|
833
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
834
|
+
#
|
835
|
+
# @return [::Google::Cloud::AIPlatform::V1::Schedule]
|
836
|
+
#
|
837
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
838
|
+
#
|
839
|
+
# @example Basic example
|
840
|
+
# require "google/cloud/ai_platform/v1"
|
841
|
+
#
|
842
|
+
# # Create a client object. The client can be reused for multiple calls.
|
843
|
+
# client = Google::Cloud::AIPlatform::V1::ScheduleService::Client.new
|
844
|
+
#
|
845
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
846
|
+
# request = Google::Cloud::AIPlatform::V1::UpdateScheduleRequest.new
|
847
|
+
#
|
848
|
+
# # Call the update_schedule method.
|
849
|
+
# result = client.update_schedule request
|
850
|
+
#
|
851
|
+
# # The returned object is of type Google::Cloud::AIPlatform::V1::Schedule.
|
852
|
+
# p result
|
853
|
+
#
|
854
|
+
def update_schedule request, options = nil
|
855
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
856
|
+
|
857
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::UpdateScheduleRequest
|
858
|
+
|
859
|
+
# Converts hash and nil to an options object
|
860
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
861
|
+
|
862
|
+
# Customize the options with defaults
|
863
|
+
metadata = @config.rpcs.update_schedule.metadata.to_h
|
864
|
+
|
865
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
866
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
867
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
868
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
|
869
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
870
|
+
|
871
|
+
header_params = {}
|
872
|
+
if request.schedule&.name
|
873
|
+
header_params["schedule.name"] = request.schedule.name
|
874
|
+
end
|
875
|
+
|
876
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
877
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
878
|
+
|
879
|
+
options.apply_defaults timeout: @config.rpcs.update_schedule.timeout,
|
880
|
+
metadata: metadata,
|
881
|
+
retry_policy: @config.rpcs.update_schedule.retry_policy
|
882
|
+
|
883
|
+
options.apply_defaults timeout: @config.timeout,
|
884
|
+
metadata: @config.metadata,
|
885
|
+
retry_policy: @config.retry_policy
|
886
|
+
|
887
|
+
@schedule_service_stub.call_rpc :update_schedule, request, options: options do |response, operation|
|
888
|
+
yield response, operation if block_given?
|
889
|
+
return response
|
890
|
+
end
|
891
|
+
rescue ::GRPC::BadStatus => e
|
892
|
+
raise ::Google::Cloud::Error.from_error(e)
|
893
|
+
end
|
894
|
+
|
895
|
+
##
|
896
|
+
# Configuration class for the ScheduleService API.
|
897
|
+
#
|
898
|
+
# This class represents the configuration for ScheduleService,
|
899
|
+
# providing control over timeouts, retry behavior, logging, transport
|
900
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
901
|
+
# applied individually to specific RPCs. See
|
902
|
+
# {::Google::Cloud::AIPlatform::V1::ScheduleService::Client::Configuration::Rpcs}
|
903
|
+
# for a list of RPCs that can be configured independently.
|
904
|
+
#
|
905
|
+
# Configuration can be applied globally to all clients, or to a single client
|
906
|
+
# on construction.
|
907
|
+
#
|
908
|
+
# @example
|
909
|
+
#
|
910
|
+
# # Modify the global config, setting the timeout for
|
911
|
+
# # create_schedule to 20 seconds,
|
912
|
+
# # and all remaining timeouts to 10 seconds.
|
913
|
+
# ::Google::Cloud::AIPlatform::V1::ScheduleService::Client.configure do |config|
|
914
|
+
# config.timeout = 10.0
|
915
|
+
# config.rpcs.create_schedule.timeout = 20.0
|
916
|
+
# end
|
917
|
+
#
|
918
|
+
# # Apply the above configuration only to a new client.
|
919
|
+
# client = ::Google::Cloud::AIPlatform::V1::ScheduleService::Client.new do |config|
|
920
|
+
# config.timeout = 10.0
|
921
|
+
# config.rpcs.create_schedule.timeout = 20.0
|
922
|
+
# end
|
923
|
+
#
|
924
|
+
# @!attribute [rw] endpoint
|
925
|
+
# The hostname or hostname:port of the service endpoint.
|
926
|
+
# Defaults to `"aiplatform.googleapis.com"`.
|
927
|
+
# @return [::String]
|
928
|
+
# @!attribute [rw] credentials
|
929
|
+
# Credentials to send with calls. You may provide any of the following types:
|
930
|
+
# * (`String`) The path to a service account key file in JSON format
|
931
|
+
# * (`Hash`) A service account key as a Hash
|
932
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
933
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
934
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
935
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
936
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
937
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
938
|
+
# * (`nil`) indicating no credentials
|
939
|
+
# @return [::Object]
|
940
|
+
# @!attribute [rw] scope
|
941
|
+
# The OAuth scopes
|
942
|
+
# @return [::Array<::String>]
|
943
|
+
# @!attribute [rw] lib_name
|
944
|
+
# The library name as recorded in instrumentation and logging
|
945
|
+
# @return [::String]
|
946
|
+
# @!attribute [rw] lib_version
|
947
|
+
# The library version as recorded in instrumentation and logging
|
948
|
+
# @return [::String]
|
949
|
+
# @!attribute [rw] channel_args
|
950
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
951
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
952
|
+
# @return [::Hash]
|
953
|
+
# @!attribute [rw] interceptors
|
954
|
+
# An array of interceptors that are run before calls are executed.
|
955
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
956
|
+
# @!attribute [rw] timeout
|
957
|
+
# The call timeout in seconds.
|
958
|
+
# @return [::Numeric]
|
959
|
+
# @!attribute [rw] metadata
|
960
|
+
# Additional gRPC headers to be sent with the call.
|
961
|
+
# @return [::Hash{::Symbol=>::String}]
|
962
|
+
# @!attribute [rw] retry_policy
|
963
|
+
# The retry policy. The value is a hash with the following keys:
|
964
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
965
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
966
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
967
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
968
|
+
# trigger a retry.
|
969
|
+
# @return [::Hash]
|
970
|
+
# @!attribute [rw] quota_project
|
971
|
+
# A separate project against which to charge quota.
|
972
|
+
# @return [::String]
|
973
|
+
#
|
974
|
+
class Configuration
|
975
|
+
extend ::Gapic::Config
|
976
|
+
|
977
|
+
DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
|
978
|
+
|
979
|
+
config_attr :endpoint, DEFAULT_ENDPOINT, ::String
|
980
|
+
config_attr :credentials, nil do |value|
|
981
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
982
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
983
|
+
allowed.any? { |klass| klass === value }
|
984
|
+
end
|
985
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
986
|
+
config_attr :lib_name, nil, ::String, nil
|
987
|
+
config_attr :lib_version, nil, ::String, nil
|
988
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
989
|
+
config_attr :interceptors, nil, ::Array, nil
|
990
|
+
config_attr :timeout, nil, ::Numeric, nil
|
991
|
+
config_attr :metadata, nil, ::Hash, nil
|
992
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
993
|
+
config_attr :quota_project, nil, ::String, nil
|
994
|
+
|
995
|
+
# @private
|
996
|
+
def initialize parent_config = nil
|
997
|
+
@parent_config = parent_config unless parent_config.nil?
|
998
|
+
|
999
|
+
yield self if block_given?
|
1000
|
+
end
|
1001
|
+
|
1002
|
+
##
|
1003
|
+
# Configurations for individual RPCs
|
1004
|
+
# @return [Rpcs]
|
1005
|
+
#
|
1006
|
+
def rpcs
|
1007
|
+
@rpcs ||= begin
|
1008
|
+
parent_rpcs = nil
|
1009
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1010
|
+
Rpcs.new parent_rpcs
|
1011
|
+
end
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
##
|
1015
|
+
# Configuration RPC class for the ScheduleService API.
|
1016
|
+
#
|
1017
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1018
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1019
|
+
# the following configuration fields:
|
1020
|
+
#
|
1021
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1022
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1023
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1024
|
+
# include the following keys:
|
1025
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1026
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1027
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1028
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1029
|
+
# trigger a retry.
|
1030
|
+
#
|
1031
|
+
class Rpcs
|
1032
|
+
##
|
1033
|
+
# RPC-specific configuration for `create_schedule`
|
1034
|
+
# @return [::Gapic::Config::Method]
|
1035
|
+
#
|
1036
|
+
attr_reader :create_schedule
|
1037
|
+
##
|
1038
|
+
# RPC-specific configuration for `delete_schedule`
|
1039
|
+
# @return [::Gapic::Config::Method]
|
1040
|
+
#
|
1041
|
+
attr_reader :delete_schedule
|
1042
|
+
##
|
1043
|
+
# RPC-specific configuration for `get_schedule`
|
1044
|
+
# @return [::Gapic::Config::Method]
|
1045
|
+
#
|
1046
|
+
attr_reader :get_schedule
|
1047
|
+
##
|
1048
|
+
# RPC-specific configuration for `list_schedules`
|
1049
|
+
# @return [::Gapic::Config::Method]
|
1050
|
+
#
|
1051
|
+
attr_reader :list_schedules
|
1052
|
+
##
|
1053
|
+
# RPC-specific configuration for `pause_schedule`
|
1054
|
+
# @return [::Gapic::Config::Method]
|
1055
|
+
#
|
1056
|
+
attr_reader :pause_schedule
|
1057
|
+
##
|
1058
|
+
# RPC-specific configuration for `resume_schedule`
|
1059
|
+
# @return [::Gapic::Config::Method]
|
1060
|
+
#
|
1061
|
+
attr_reader :resume_schedule
|
1062
|
+
##
|
1063
|
+
# RPC-specific configuration for `update_schedule`
|
1064
|
+
# @return [::Gapic::Config::Method]
|
1065
|
+
#
|
1066
|
+
attr_reader :update_schedule
|
1067
|
+
|
1068
|
+
# @private
|
1069
|
+
def initialize parent_rpcs = nil
|
1070
|
+
create_schedule_config = parent_rpcs.create_schedule if parent_rpcs.respond_to? :create_schedule
|
1071
|
+
@create_schedule = ::Gapic::Config::Method.new create_schedule_config
|
1072
|
+
delete_schedule_config = parent_rpcs.delete_schedule if parent_rpcs.respond_to? :delete_schedule
|
1073
|
+
@delete_schedule = ::Gapic::Config::Method.new delete_schedule_config
|
1074
|
+
get_schedule_config = parent_rpcs.get_schedule if parent_rpcs.respond_to? :get_schedule
|
1075
|
+
@get_schedule = ::Gapic::Config::Method.new get_schedule_config
|
1076
|
+
list_schedules_config = parent_rpcs.list_schedules if parent_rpcs.respond_to? :list_schedules
|
1077
|
+
@list_schedules = ::Gapic::Config::Method.new list_schedules_config
|
1078
|
+
pause_schedule_config = parent_rpcs.pause_schedule if parent_rpcs.respond_to? :pause_schedule
|
1079
|
+
@pause_schedule = ::Gapic::Config::Method.new pause_schedule_config
|
1080
|
+
resume_schedule_config = parent_rpcs.resume_schedule if parent_rpcs.respond_to? :resume_schedule
|
1081
|
+
@resume_schedule = ::Gapic::Config::Method.new resume_schedule_config
|
1082
|
+
update_schedule_config = parent_rpcs.update_schedule if parent_rpcs.respond_to? :update_schedule
|
1083
|
+
@update_schedule = ::Gapic::Config::Method.new update_schedule_config
|
1084
|
+
|
1085
|
+
yield self if block_given?
|
1086
|
+
end
|
1087
|
+
end
|
1088
|
+
end
|
1089
|
+
end
|
1090
|
+
end
|
1091
|
+
end
|
1092
|
+
end
|
1093
|
+
end
|
1094
|
+
end
|