google-cloud-scheduler-v1beta1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google-cloud-scheduler-v1beta1.rb +21 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/scheduler/v1beta1.rb +35 -0
- data/lib/google/cloud/scheduler/v1beta1/cloud_scheduler.rb +50 -0
- data/lib/google/cloud/scheduler/v1beta1/cloud_scheduler/client.rb +978 -0
- data/lib/google/cloud/scheduler/v1beta1/cloud_scheduler/credentials.rb +51 -0
- data/lib/google/cloud/scheduler/v1beta1/cloud_scheduler/paths.rb +86 -0
- data/lib/google/cloud/scheduler/v1beta1/cloudscheduler_pb.rb +66 -0
- data/lib/google/cloud/scheduler/v1beta1/cloudscheduler_services_pb.rb +83 -0
- data/lib/google/cloud/scheduler/v1beta1/job_pb.rb +59 -0
- data/lib/google/cloud/scheduler/v1beta1/target_pb.rb +73 -0
- data/lib/google/cloud/scheduler/v1beta1/version.rb +28 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/scheduler/v1beta1/cloudscheduler.rb +155 -0
- data/proto_docs/google/cloud/scheduler/v1beta1/job.rb +231 -0
- data/proto_docs/google/cloud/scheduler/v1beta1/target.rb +385 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +187 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
# This gem does not autoload during Bundler.require. To load this gem,
|
20
|
+
# issue explicit require statements for the packages desired, e.g.:
|
21
|
+
# require "google/cloud/scheduler/v1beta1"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/common_resources.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/resource_pb'
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_file("google/cloud/common_resources.proto", :syntax => :proto3) do
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module Google
|
13
|
+
module Cloud
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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/scheduler/v1beta1/cloud_scheduler"
|
20
|
+
require "google/cloud/scheduler/v1beta1/version"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Scheduler
|
25
|
+
##
|
26
|
+
# To load this package, including all its services, and instantiate a client:
|
27
|
+
#
|
28
|
+
# require "google/cloud/scheduler/v1beta1"
|
29
|
+
# client = ::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client.new
|
30
|
+
#
|
31
|
+
module V1beta1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/scheduler/v1beta1/version"
|
24
|
+
|
25
|
+
require "google/cloud/scheduler/v1beta1/cloud_scheduler/credentials"
|
26
|
+
require "google/cloud/scheduler/v1beta1/cloud_scheduler/paths"
|
27
|
+
require "google/cloud/scheduler/v1beta1/cloud_scheduler/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Scheduler
|
32
|
+
module V1beta1
|
33
|
+
##
|
34
|
+
# The Cloud Scheduler API allows external entities to reliably
|
35
|
+
# schedule asynchronous jobs.
|
36
|
+
#
|
37
|
+
# To load this service and instantiate a client:
|
38
|
+
#
|
39
|
+
# require "google/cloud/scheduler/v1beta1/cloud_scheduler"
|
40
|
+
# client = ::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client.new
|
41
|
+
#
|
42
|
+
module CloudScheduler
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
helper_path = ::File.join __dir__, "cloud_scheduler", "helpers.rb"
|
50
|
+
require "google/cloud/scheduler/v1beta1/cloud_scheduler/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,978 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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/scheduler/v1beta1/cloudscheduler_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Scheduler
|
25
|
+
module V1beta1
|
26
|
+
module CloudScheduler
|
27
|
+
##
|
28
|
+
# Client for the CloudScheduler service.
|
29
|
+
#
|
30
|
+
# The Cloud Scheduler API allows external entities to reliably
|
31
|
+
# schedule asynchronous jobs.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
include Paths
|
35
|
+
|
36
|
+
# @private
|
37
|
+
attr_reader :cloud_scheduler_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the CloudScheduler Client class.
|
41
|
+
#
|
42
|
+
# See {::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# ## Example
|
46
|
+
#
|
47
|
+
# To modify the configuration for all CloudScheduler clients:
|
48
|
+
#
|
49
|
+
# ::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client.configure do |config|
|
50
|
+
# config.timeout = 10.0
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# @yield [config] Configure the Client client.
|
54
|
+
# @yieldparam config [Client::Configuration]
|
55
|
+
#
|
56
|
+
# @return [Client::Configuration]
|
57
|
+
#
|
58
|
+
def self.configure
|
59
|
+
@configure ||= begin
|
60
|
+
namespace = ["Google", "Cloud", "Scheduler", "V1beta1"]
|
61
|
+
parent_config = while namespace.any?
|
62
|
+
parent_name = namespace.join "::"
|
63
|
+
parent_const = const_get parent_name
|
64
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
65
|
+
namespace.pop
|
66
|
+
end
|
67
|
+
default_config = Client::Configuration.new parent_config
|
68
|
+
|
69
|
+
default_config.rpcs.list_jobs.timeout = 600.0
|
70
|
+
default_config.rpcs.list_jobs.retry_policy = {
|
71
|
+
initial_delay: 0.1,
|
72
|
+
max_delay: 60.0,
|
73
|
+
multiplier: 1.3,
|
74
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
75
|
+
}
|
76
|
+
|
77
|
+
default_config.rpcs.get_job.timeout = 600.0
|
78
|
+
default_config.rpcs.get_job.retry_policy = {
|
79
|
+
initial_delay: 0.1,
|
80
|
+
max_delay: 60.0,
|
81
|
+
multiplier: 1.3,
|
82
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
83
|
+
}
|
84
|
+
|
85
|
+
default_config.rpcs.create_job.timeout = 600.0
|
86
|
+
|
87
|
+
default_config.rpcs.update_job.timeout = 600.0
|
88
|
+
|
89
|
+
default_config.rpcs.delete_job.timeout = 600.0
|
90
|
+
default_config.rpcs.delete_job.retry_policy = {
|
91
|
+
initial_delay: 0.1,
|
92
|
+
max_delay: 60.0,
|
93
|
+
multiplier: 1.3,
|
94
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
95
|
+
}
|
96
|
+
|
97
|
+
default_config.rpcs.pause_job.timeout = 600.0
|
98
|
+
default_config.rpcs.pause_job.retry_policy = {
|
99
|
+
initial_delay: 0.1,
|
100
|
+
max_delay: 60.0,
|
101
|
+
multiplier: 1.3,
|
102
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
103
|
+
}
|
104
|
+
|
105
|
+
default_config.rpcs.resume_job.timeout = 600.0
|
106
|
+
default_config.rpcs.resume_job.retry_policy = {
|
107
|
+
initial_delay: 0.1,
|
108
|
+
max_delay: 60.0,
|
109
|
+
multiplier: 1.3,
|
110
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
111
|
+
}
|
112
|
+
|
113
|
+
default_config.rpcs.run_job.timeout = 600.0
|
114
|
+
|
115
|
+
default_config
|
116
|
+
end
|
117
|
+
yield @configure if block_given?
|
118
|
+
@configure
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Configure the CloudScheduler Client instance.
|
123
|
+
#
|
124
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
125
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
126
|
+
# should be made on {Client.configure}.
|
127
|
+
#
|
128
|
+
# See {::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client::Configuration}
|
129
|
+
# for a description of the configuration fields.
|
130
|
+
#
|
131
|
+
# @yield [config] Configure the Client client.
|
132
|
+
# @yieldparam config [Client::Configuration]
|
133
|
+
#
|
134
|
+
# @return [Client::Configuration]
|
135
|
+
#
|
136
|
+
def configure
|
137
|
+
yield @config if block_given?
|
138
|
+
@config
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# Create a new CloudScheduler client object.
|
143
|
+
#
|
144
|
+
# ## Examples
|
145
|
+
#
|
146
|
+
# To create a new CloudScheduler client with the default
|
147
|
+
# configuration:
|
148
|
+
#
|
149
|
+
# client = ::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client.new
|
150
|
+
#
|
151
|
+
# To create a new CloudScheduler client with a custom
|
152
|
+
# configuration:
|
153
|
+
#
|
154
|
+
# client = ::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client.new do |config|
|
155
|
+
# config.timeout = 10.0
|
156
|
+
# end
|
157
|
+
#
|
158
|
+
# @yield [config] Configure the CloudScheduler client.
|
159
|
+
# @yieldparam config [Client::Configuration]
|
160
|
+
#
|
161
|
+
def initialize
|
162
|
+
# These require statements are intentionally placed here to initialize
|
163
|
+
# the gRPC module only when it's required.
|
164
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
165
|
+
require "gapic/grpc"
|
166
|
+
require "google/cloud/scheduler/v1beta1/cloudscheduler_services_pb"
|
167
|
+
|
168
|
+
# Create the configuration object
|
169
|
+
@config = Configuration.new Client.configure
|
170
|
+
|
171
|
+
# Yield the configuration if needed
|
172
|
+
yield @config if block_given?
|
173
|
+
|
174
|
+
# Create credentials
|
175
|
+
credentials = @config.credentials
|
176
|
+
credentials ||= Credentials.default scope: @config.scope
|
177
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
178
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
179
|
+
end
|
180
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
181
|
+
|
182
|
+
@cloud_scheduler_stub = ::Gapic::ServiceStub.new(
|
183
|
+
::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Stub,
|
184
|
+
credentials: credentials,
|
185
|
+
endpoint: @config.endpoint,
|
186
|
+
channel_args: @config.channel_args,
|
187
|
+
interceptors: @config.interceptors
|
188
|
+
)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Service calls
|
192
|
+
|
193
|
+
##
|
194
|
+
# Lists jobs.
|
195
|
+
#
|
196
|
+
# @overload list_jobs(request, options = nil)
|
197
|
+
# Pass arguments to `list_jobs` via a request object, either of type
|
198
|
+
# {::Google::Cloud::Scheduler::V1beta1::ListJobsRequest} or an equivalent Hash.
|
199
|
+
#
|
200
|
+
# @param request [::Google::Cloud::Scheduler::V1beta1::ListJobsRequest, ::Hash]
|
201
|
+
# A request object representing the call parameters. Required. To specify no
|
202
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
203
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
204
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
205
|
+
#
|
206
|
+
# @overload list_jobs(parent: nil, page_size: nil, page_token: nil)
|
207
|
+
# Pass arguments to `list_jobs` via keyword arguments. Note that at
|
208
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
209
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
210
|
+
#
|
211
|
+
# @param parent [::String]
|
212
|
+
# Required. The location name. For example:
|
213
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID`.
|
214
|
+
# @param page_size [::Integer]
|
215
|
+
# Requested page size.
|
216
|
+
#
|
217
|
+
# The maximum page size is 500. If unspecified, the page size will
|
218
|
+
# be the maximum. Fewer jobs than requested might be returned,
|
219
|
+
# even if more jobs exist; use next_page_token to determine if more
|
220
|
+
# jobs exist.
|
221
|
+
# @param page_token [::String]
|
222
|
+
# A token identifying a page of results the server will return. To
|
223
|
+
# request the first page results, page_token must be empty. To
|
224
|
+
# request the next page of results, page_token must be the value of
|
225
|
+
# {::Google::Cloud::Scheduler::V1beta1::ListJobsResponse#next_page_token next_page_token} returned from
|
226
|
+
# the previous call to {::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client#list_jobs ListJobs}. It is an error to
|
227
|
+
# switch the value of [filter][google.cloud.scheduler.v1beta1.ListJobsRequest.filter] or
|
228
|
+
# [order_by][google.cloud.scheduler.v1beta1.ListJobsRequest.order_by] while iterating through pages.
|
229
|
+
#
|
230
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
231
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Scheduler::V1beta1::Job>]
|
232
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
233
|
+
#
|
234
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Scheduler::V1beta1::Job>]
|
235
|
+
#
|
236
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
237
|
+
#
|
238
|
+
def list_jobs request, options = nil
|
239
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
240
|
+
|
241
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Scheduler::V1beta1::ListJobsRequest
|
242
|
+
|
243
|
+
# Converts hash and nil to an options object
|
244
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
245
|
+
|
246
|
+
# Customize the options with defaults
|
247
|
+
metadata = @config.rpcs.list_jobs.metadata.to_h
|
248
|
+
|
249
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
250
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
251
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
252
|
+
gapic_version: ::Google::Cloud::Scheduler::V1beta1::VERSION
|
253
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
254
|
+
|
255
|
+
header_params = {
|
256
|
+
"parent" => request.parent
|
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.list_jobs.timeout,
|
262
|
+
metadata: metadata,
|
263
|
+
retry_policy: @config.rpcs.list_jobs.retry_policy
|
264
|
+
options.apply_defaults metadata: @config.metadata,
|
265
|
+
retry_policy: @config.retry_policy
|
266
|
+
|
267
|
+
@cloud_scheduler_stub.call_rpc :list_jobs, request, options: options do |response, operation|
|
268
|
+
response = ::Gapic::PagedEnumerable.new @cloud_scheduler_stub, :list_jobs, request, response, operation, options
|
269
|
+
yield response, operation if block_given?
|
270
|
+
return response
|
271
|
+
end
|
272
|
+
rescue ::GRPC::BadStatus => e
|
273
|
+
raise ::Google::Cloud::Error.from_error(e)
|
274
|
+
end
|
275
|
+
|
276
|
+
##
|
277
|
+
# Gets a job.
|
278
|
+
#
|
279
|
+
# @overload get_job(request, options = nil)
|
280
|
+
# Pass arguments to `get_job` via a request object, either of type
|
281
|
+
# {::Google::Cloud::Scheduler::V1beta1::GetJobRequest} or an equivalent Hash.
|
282
|
+
#
|
283
|
+
# @param request [::Google::Cloud::Scheduler::V1beta1::GetJobRequest, ::Hash]
|
284
|
+
# A request object representing the call parameters. Required. To specify no
|
285
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
286
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
287
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
288
|
+
#
|
289
|
+
# @overload get_job(name: nil)
|
290
|
+
# Pass arguments to `get_job` via keyword arguments. Note that at
|
291
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
292
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
293
|
+
#
|
294
|
+
# @param name [::String]
|
295
|
+
# Required. The job name. For example:
|
296
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
297
|
+
#
|
298
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
299
|
+
# @yieldparam response [::Google::Cloud::Scheduler::V1beta1::Job]
|
300
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
301
|
+
#
|
302
|
+
# @return [::Google::Cloud::Scheduler::V1beta1::Job]
|
303
|
+
#
|
304
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
305
|
+
#
|
306
|
+
def get_job request, options = nil
|
307
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
308
|
+
|
309
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Scheduler::V1beta1::GetJobRequest
|
310
|
+
|
311
|
+
# Converts hash and nil to an options object
|
312
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
313
|
+
|
314
|
+
# Customize the options with defaults
|
315
|
+
metadata = @config.rpcs.get_job.metadata.to_h
|
316
|
+
|
317
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
318
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
319
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
320
|
+
gapic_version: ::Google::Cloud::Scheduler::V1beta1::VERSION
|
321
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
322
|
+
|
323
|
+
header_params = {
|
324
|
+
"name" => request.name
|
325
|
+
}
|
326
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
327
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
328
|
+
|
329
|
+
options.apply_defaults timeout: @config.rpcs.get_job.timeout,
|
330
|
+
metadata: metadata,
|
331
|
+
retry_policy: @config.rpcs.get_job.retry_policy
|
332
|
+
options.apply_defaults metadata: @config.metadata,
|
333
|
+
retry_policy: @config.retry_policy
|
334
|
+
|
335
|
+
@cloud_scheduler_stub.call_rpc :get_job, request, options: options do |response, operation|
|
336
|
+
yield response, operation if block_given?
|
337
|
+
return response
|
338
|
+
end
|
339
|
+
rescue ::GRPC::BadStatus => e
|
340
|
+
raise ::Google::Cloud::Error.from_error(e)
|
341
|
+
end
|
342
|
+
|
343
|
+
##
|
344
|
+
# Creates a job.
|
345
|
+
#
|
346
|
+
# @overload create_job(request, options = nil)
|
347
|
+
# Pass arguments to `create_job` via a request object, either of type
|
348
|
+
# {::Google::Cloud::Scheduler::V1beta1::CreateJobRequest} or an equivalent Hash.
|
349
|
+
#
|
350
|
+
# @param request [::Google::Cloud::Scheduler::V1beta1::CreateJobRequest, ::Hash]
|
351
|
+
# A request object representing the call parameters. Required. To specify no
|
352
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
353
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
354
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
355
|
+
#
|
356
|
+
# @overload create_job(parent: nil, job: nil)
|
357
|
+
# Pass arguments to `create_job` via keyword arguments. Note that at
|
358
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
359
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
360
|
+
#
|
361
|
+
# @param parent [::String]
|
362
|
+
# Required. The location name. For example:
|
363
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID`.
|
364
|
+
# @param job [::Google::Cloud::Scheduler::V1beta1::Job, ::Hash]
|
365
|
+
# Required. The job to add. The user can optionally specify a name for the
|
366
|
+
# job in {::Google::Cloud::Scheduler::V1beta1::Job#name name}. {::Google::Cloud::Scheduler::V1beta1::Job#name name} cannot be the same as an
|
367
|
+
# existing job. If a name is not specified then the system will
|
368
|
+
# generate a random unique name that will be returned
|
369
|
+
# ({::Google::Cloud::Scheduler::V1beta1::Job#name name}) in the response.
|
370
|
+
#
|
371
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
372
|
+
# @yieldparam response [::Google::Cloud::Scheduler::V1beta1::Job]
|
373
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
374
|
+
#
|
375
|
+
# @return [::Google::Cloud::Scheduler::V1beta1::Job]
|
376
|
+
#
|
377
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
378
|
+
#
|
379
|
+
def create_job request, options = nil
|
380
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
381
|
+
|
382
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Scheduler::V1beta1::CreateJobRequest
|
383
|
+
|
384
|
+
# Converts hash and nil to an options object
|
385
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
386
|
+
|
387
|
+
# Customize the options with defaults
|
388
|
+
metadata = @config.rpcs.create_job.metadata.to_h
|
389
|
+
|
390
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
391
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
392
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
393
|
+
gapic_version: ::Google::Cloud::Scheduler::V1beta1::VERSION
|
394
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
395
|
+
|
396
|
+
header_params = {
|
397
|
+
"parent" => request.parent
|
398
|
+
}
|
399
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
400
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
401
|
+
|
402
|
+
options.apply_defaults timeout: @config.rpcs.create_job.timeout,
|
403
|
+
metadata: metadata,
|
404
|
+
retry_policy: @config.rpcs.create_job.retry_policy
|
405
|
+
options.apply_defaults metadata: @config.metadata,
|
406
|
+
retry_policy: @config.retry_policy
|
407
|
+
|
408
|
+
@cloud_scheduler_stub.call_rpc :create_job, request, options: options do |response, operation|
|
409
|
+
yield response, operation if block_given?
|
410
|
+
return response
|
411
|
+
end
|
412
|
+
rescue ::GRPC::BadStatus => e
|
413
|
+
raise ::Google::Cloud::Error.from_error(e)
|
414
|
+
end
|
415
|
+
|
416
|
+
##
|
417
|
+
# Updates a job.
|
418
|
+
#
|
419
|
+
# If successful, the updated {::Google::Cloud::Scheduler::V1beta1::Job Job} is returned. If the job does
|
420
|
+
# not exist, `NOT_FOUND` is returned.
|
421
|
+
#
|
422
|
+
# If UpdateJob does not successfully return, it is possible for the
|
423
|
+
# job to be in an {::Google::Cloud::Scheduler::V1beta1::Job::State::UPDATE_FAILED Job.State.UPDATE_FAILED} state. A job in this state may
|
424
|
+
# not be executed. If this happens, retry the UpdateJob request
|
425
|
+
# until a successful response is received.
|
426
|
+
#
|
427
|
+
# @overload update_job(request, options = nil)
|
428
|
+
# Pass arguments to `update_job` via a request object, either of type
|
429
|
+
# {::Google::Cloud::Scheduler::V1beta1::UpdateJobRequest} or an equivalent Hash.
|
430
|
+
#
|
431
|
+
# @param request [::Google::Cloud::Scheduler::V1beta1::UpdateJobRequest, ::Hash]
|
432
|
+
# A request object representing the call parameters. Required. To specify no
|
433
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
434
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
435
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
436
|
+
#
|
437
|
+
# @overload update_job(job: nil, update_mask: nil)
|
438
|
+
# Pass arguments to `update_job` via keyword arguments. Note that at
|
439
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
440
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
441
|
+
#
|
442
|
+
# @param job [::Google::Cloud::Scheduler::V1beta1::Job, ::Hash]
|
443
|
+
# Required. The new job properties. {::Google::Cloud::Scheduler::V1beta1::Job#name name} must be specified.
|
444
|
+
#
|
445
|
+
# Output only fields cannot be modified using UpdateJob.
|
446
|
+
# Any value specified for an output only field will be ignored.
|
447
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
448
|
+
# A mask used to specify which fields of the job are being updated.
|
449
|
+
#
|
450
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
451
|
+
# @yieldparam response [::Google::Cloud::Scheduler::V1beta1::Job]
|
452
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
453
|
+
#
|
454
|
+
# @return [::Google::Cloud::Scheduler::V1beta1::Job]
|
455
|
+
#
|
456
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
457
|
+
#
|
458
|
+
def update_job request, options = nil
|
459
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
460
|
+
|
461
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Scheduler::V1beta1::UpdateJobRequest
|
462
|
+
|
463
|
+
# Converts hash and nil to an options object
|
464
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
465
|
+
|
466
|
+
# Customize the options with defaults
|
467
|
+
metadata = @config.rpcs.update_job.metadata.to_h
|
468
|
+
|
469
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
470
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
471
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
472
|
+
gapic_version: ::Google::Cloud::Scheduler::V1beta1::VERSION
|
473
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
474
|
+
|
475
|
+
header_params = {
|
476
|
+
"job.name" => request.job.name
|
477
|
+
}
|
478
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
479
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
480
|
+
|
481
|
+
options.apply_defaults timeout: @config.rpcs.update_job.timeout,
|
482
|
+
metadata: metadata,
|
483
|
+
retry_policy: @config.rpcs.update_job.retry_policy
|
484
|
+
options.apply_defaults metadata: @config.metadata,
|
485
|
+
retry_policy: @config.retry_policy
|
486
|
+
|
487
|
+
@cloud_scheduler_stub.call_rpc :update_job, request, options: options do |response, operation|
|
488
|
+
yield response, operation if block_given?
|
489
|
+
return response
|
490
|
+
end
|
491
|
+
rescue ::GRPC::BadStatus => e
|
492
|
+
raise ::Google::Cloud::Error.from_error(e)
|
493
|
+
end
|
494
|
+
|
495
|
+
##
|
496
|
+
# Deletes a job.
|
497
|
+
#
|
498
|
+
# @overload delete_job(request, options = nil)
|
499
|
+
# Pass arguments to `delete_job` via a request object, either of type
|
500
|
+
# {::Google::Cloud::Scheduler::V1beta1::DeleteJobRequest} or an equivalent Hash.
|
501
|
+
#
|
502
|
+
# @param request [::Google::Cloud::Scheduler::V1beta1::DeleteJobRequest, ::Hash]
|
503
|
+
# A request object representing the call parameters. Required. To specify no
|
504
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
505
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
506
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
507
|
+
#
|
508
|
+
# @overload delete_job(name: nil)
|
509
|
+
# Pass arguments to `delete_job` via keyword arguments. Note that at
|
510
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
511
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
512
|
+
#
|
513
|
+
# @param name [::String]
|
514
|
+
# Required. The job name. For example:
|
515
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
516
|
+
#
|
517
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
518
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
519
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
520
|
+
#
|
521
|
+
# @return [::Google::Protobuf::Empty]
|
522
|
+
#
|
523
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
524
|
+
#
|
525
|
+
def delete_job request, options = nil
|
526
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
527
|
+
|
528
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Scheduler::V1beta1::DeleteJobRequest
|
529
|
+
|
530
|
+
# Converts hash and nil to an options object
|
531
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
532
|
+
|
533
|
+
# Customize the options with defaults
|
534
|
+
metadata = @config.rpcs.delete_job.metadata.to_h
|
535
|
+
|
536
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
537
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
538
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
539
|
+
gapic_version: ::Google::Cloud::Scheduler::V1beta1::VERSION
|
540
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
541
|
+
|
542
|
+
header_params = {
|
543
|
+
"name" => request.name
|
544
|
+
}
|
545
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
546
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
547
|
+
|
548
|
+
options.apply_defaults timeout: @config.rpcs.delete_job.timeout,
|
549
|
+
metadata: metadata,
|
550
|
+
retry_policy: @config.rpcs.delete_job.retry_policy
|
551
|
+
options.apply_defaults metadata: @config.metadata,
|
552
|
+
retry_policy: @config.retry_policy
|
553
|
+
|
554
|
+
@cloud_scheduler_stub.call_rpc :delete_job, request, options: options do |response, operation|
|
555
|
+
yield response, operation if block_given?
|
556
|
+
return response
|
557
|
+
end
|
558
|
+
rescue ::GRPC::BadStatus => e
|
559
|
+
raise ::Google::Cloud::Error.from_error(e)
|
560
|
+
end
|
561
|
+
|
562
|
+
##
|
563
|
+
# Pauses a job.
|
564
|
+
#
|
565
|
+
# If a job is paused then the system will stop executing the job
|
566
|
+
# until it is re-enabled via {::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client#resume_job ResumeJob}. The
|
567
|
+
# state of the job is stored in {::Google::Cloud::Scheduler::V1beta1::Job#state state}; if paused it
|
568
|
+
# will be set to {::Google::Cloud::Scheduler::V1beta1::Job::State::PAUSED Job.State.PAUSED}. A job must be in {::Google::Cloud::Scheduler::V1beta1::Job::State::ENABLED Job.State.ENABLED}
|
569
|
+
# to be paused.
|
570
|
+
#
|
571
|
+
# @overload pause_job(request, options = nil)
|
572
|
+
# Pass arguments to `pause_job` via a request object, either of type
|
573
|
+
# {::Google::Cloud::Scheduler::V1beta1::PauseJobRequest} or an equivalent Hash.
|
574
|
+
#
|
575
|
+
# @param request [::Google::Cloud::Scheduler::V1beta1::PauseJobRequest, ::Hash]
|
576
|
+
# A request object representing the call parameters. Required. To specify no
|
577
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
578
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
579
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
580
|
+
#
|
581
|
+
# @overload pause_job(name: nil)
|
582
|
+
# Pass arguments to `pause_job` via keyword arguments. Note that at
|
583
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
584
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
585
|
+
#
|
586
|
+
# @param name [::String]
|
587
|
+
# Required. The job name. For example:
|
588
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
589
|
+
#
|
590
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
591
|
+
# @yieldparam response [::Google::Cloud::Scheduler::V1beta1::Job]
|
592
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
593
|
+
#
|
594
|
+
# @return [::Google::Cloud::Scheduler::V1beta1::Job]
|
595
|
+
#
|
596
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
597
|
+
#
|
598
|
+
def pause_job request, options = nil
|
599
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
600
|
+
|
601
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Scheduler::V1beta1::PauseJobRequest
|
602
|
+
|
603
|
+
# Converts hash and nil to an options object
|
604
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
605
|
+
|
606
|
+
# Customize the options with defaults
|
607
|
+
metadata = @config.rpcs.pause_job.metadata.to_h
|
608
|
+
|
609
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
610
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
611
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
612
|
+
gapic_version: ::Google::Cloud::Scheduler::V1beta1::VERSION
|
613
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
614
|
+
|
615
|
+
header_params = {
|
616
|
+
"name" => request.name
|
617
|
+
}
|
618
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
619
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
620
|
+
|
621
|
+
options.apply_defaults timeout: @config.rpcs.pause_job.timeout,
|
622
|
+
metadata: metadata,
|
623
|
+
retry_policy: @config.rpcs.pause_job.retry_policy
|
624
|
+
options.apply_defaults metadata: @config.metadata,
|
625
|
+
retry_policy: @config.retry_policy
|
626
|
+
|
627
|
+
@cloud_scheduler_stub.call_rpc :pause_job, request, options: options do |response, operation|
|
628
|
+
yield response, operation if block_given?
|
629
|
+
return response
|
630
|
+
end
|
631
|
+
rescue ::GRPC::BadStatus => e
|
632
|
+
raise ::Google::Cloud::Error.from_error(e)
|
633
|
+
end
|
634
|
+
|
635
|
+
##
|
636
|
+
# Resume a job.
|
637
|
+
#
|
638
|
+
# This method reenables a job after it has been {::Google::Cloud::Scheduler::V1beta1::Job::State::PAUSED Job.State.PAUSED}. The
|
639
|
+
# state of a job is stored in {::Google::Cloud::Scheduler::V1beta1::Job#state Job.state}; after calling this method it
|
640
|
+
# will be set to {::Google::Cloud::Scheduler::V1beta1::Job::State::ENABLED Job.State.ENABLED}. A job must be in
|
641
|
+
# {::Google::Cloud::Scheduler::V1beta1::Job::State::PAUSED Job.State.PAUSED} to be resumed.
|
642
|
+
#
|
643
|
+
# @overload resume_job(request, options = nil)
|
644
|
+
# Pass arguments to `resume_job` via a request object, either of type
|
645
|
+
# {::Google::Cloud::Scheduler::V1beta1::ResumeJobRequest} or an equivalent Hash.
|
646
|
+
#
|
647
|
+
# @param request [::Google::Cloud::Scheduler::V1beta1::ResumeJobRequest, ::Hash]
|
648
|
+
# A request object representing the call parameters. Required. To specify no
|
649
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
650
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
651
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
652
|
+
#
|
653
|
+
# @overload resume_job(name: nil)
|
654
|
+
# Pass arguments to `resume_job` via keyword arguments. Note that at
|
655
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
656
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
657
|
+
#
|
658
|
+
# @param name [::String]
|
659
|
+
# Required. The job name. For example:
|
660
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
661
|
+
#
|
662
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
663
|
+
# @yieldparam response [::Google::Cloud::Scheduler::V1beta1::Job]
|
664
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
665
|
+
#
|
666
|
+
# @return [::Google::Cloud::Scheduler::V1beta1::Job]
|
667
|
+
#
|
668
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
669
|
+
#
|
670
|
+
def resume_job request, options = nil
|
671
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
672
|
+
|
673
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Scheduler::V1beta1::ResumeJobRequest
|
674
|
+
|
675
|
+
# Converts hash and nil to an options object
|
676
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
677
|
+
|
678
|
+
# Customize the options with defaults
|
679
|
+
metadata = @config.rpcs.resume_job.metadata.to_h
|
680
|
+
|
681
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
682
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
683
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
684
|
+
gapic_version: ::Google::Cloud::Scheduler::V1beta1::VERSION
|
685
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
686
|
+
|
687
|
+
header_params = {
|
688
|
+
"name" => request.name
|
689
|
+
}
|
690
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
691
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
692
|
+
|
693
|
+
options.apply_defaults timeout: @config.rpcs.resume_job.timeout,
|
694
|
+
metadata: metadata,
|
695
|
+
retry_policy: @config.rpcs.resume_job.retry_policy
|
696
|
+
options.apply_defaults metadata: @config.metadata,
|
697
|
+
retry_policy: @config.retry_policy
|
698
|
+
|
699
|
+
@cloud_scheduler_stub.call_rpc :resume_job, request, options: options do |response, operation|
|
700
|
+
yield response, operation if block_given?
|
701
|
+
return response
|
702
|
+
end
|
703
|
+
rescue ::GRPC::BadStatus => e
|
704
|
+
raise ::Google::Cloud::Error.from_error(e)
|
705
|
+
end
|
706
|
+
|
707
|
+
##
|
708
|
+
# Forces a job to run now.
|
709
|
+
#
|
710
|
+
# When this method is called, Cloud Scheduler will dispatch the job, even
|
711
|
+
# if the job is already running.
|
712
|
+
#
|
713
|
+
# @overload run_job(request, options = nil)
|
714
|
+
# Pass arguments to `run_job` via a request object, either of type
|
715
|
+
# {::Google::Cloud::Scheduler::V1beta1::RunJobRequest} or an equivalent Hash.
|
716
|
+
#
|
717
|
+
# @param request [::Google::Cloud::Scheduler::V1beta1::RunJobRequest, ::Hash]
|
718
|
+
# A request object representing the call parameters. Required. To specify no
|
719
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
720
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
721
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
722
|
+
#
|
723
|
+
# @overload run_job(name: nil)
|
724
|
+
# Pass arguments to `run_job` via keyword arguments. Note that at
|
725
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
726
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
727
|
+
#
|
728
|
+
# @param name [::String]
|
729
|
+
# Required. The job name. For example:
|
730
|
+
# `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
|
731
|
+
#
|
732
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
733
|
+
# @yieldparam response [::Google::Cloud::Scheduler::V1beta1::Job]
|
734
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
735
|
+
#
|
736
|
+
# @return [::Google::Cloud::Scheduler::V1beta1::Job]
|
737
|
+
#
|
738
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
739
|
+
#
|
740
|
+
def run_job request, options = nil
|
741
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
742
|
+
|
743
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Scheduler::V1beta1::RunJobRequest
|
744
|
+
|
745
|
+
# Converts hash and nil to an options object
|
746
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
747
|
+
|
748
|
+
# Customize the options with defaults
|
749
|
+
metadata = @config.rpcs.run_job.metadata.to_h
|
750
|
+
|
751
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
752
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
753
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
754
|
+
gapic_version: ::Google::Cloud::Scheduler::V1beta1::VERSION
|
755
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
756
|
+
|
757
|
+
header_params = {
|
758
|
+
"name" => request.name
|
759
|
+
}
|
760
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
761
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
762
|
+
|
763
|
+
options.apply_defaults timeout: @config.rpcs.run_job.timeout,
|
764
|
+
metadata: metadata,
|
765
|
+
retry_policy: @config.rpcs.run_job.retry_policy
|
766
|
+
options.apply_defaults metadata: @config.metadata,
|
767
|
+
retry_policy: @config.retry_policy
|
768
|
+
|
769
|
+
@cloud_scheduler_stub.call_rpc :run_job, request, options: options do |response, operation|
|
770
|
+
yield response, operation if block_given?
|
771
|
+
return response
|
772
|
+
end
|
773
|
+
rescue ::GRPC::BadStatus => e
|
774
|
+
raise ::Google::Cloud::Error.from_error(e)
|
775
|
+
end
|
776
|
+
|
777
|
+
##
|
778
|
+
# Configuration class for the CloudScheduler API.
|
779
|
+
#
|
780
|
+
# This class represents the configuration for CloudScheduler,
|
781
|
+
# providing control over timeouts, retry behavior, logging, transport
|
782
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
783
|
+
# applied individually to specific RPCs. See
|
784
|
+
# {::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client::Configuration::Rpcs}
|
785
|
+
# for a list of RPCs that can be configured independently.
|
786
|
+
#
|
787
|
+
# Configuration can be applied globally to all clients, or to a single client
|
788
|
+
# on construction.
|
789
|
+
#
|
790
|
+
# # Examples
|
791
|
+
#
|
792
|
+
# To modify the global config, setting the timeout for list_jobs
|
793
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
794
|
+
#
|
795
|
+
# ::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client.configure do |config|
|
796
|
+
# config.timeout = 10.0
|
797
|
+
# config.rpcs.list_jobs.timeout = 20.0
|
798
|
+
# end
|
799
|
+
#
|
800
|
+
# To apply the above configuration only to a new client:
|
801
|
+
#
|
802
|
+
# client = ::Google::Cloud::Scheduler::V1beta1::CloudScheduler::Client.new do |config|
|
803
|
+
# config.timeout = 10.0
|
804
|
+
# config.rpcs.list_jobs.timeout = 20.0
|
805
|
+
# end
|
806
|
+
#
|
807
|
+
# @!attribute [rw] endpoint
|
808
|
+
# The hostname or hostname:port of the service endpoint.
|
809
|
+
# Defaults to `"cloudscheduler.googleapis.com"`.
|
810
|
+
# @return [::String]
|
811
|
+
# @!attribute [rw] credentials
|
812
|
+
# Credentials to send with calls. You may provide any of the following types:
|
813
|
+
# * (`String`) The path to a service account key file in JSON format
|
814
|
+
# * (`Hash`) A service account key as a Hash
|
815
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
816
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
817
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
818
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
819
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
820
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
821
|
+
# * (`nil`) indicating no credentials
|
822
|
+
# @return [::Object]
|
823
|
+
# @!attribute [rw] scope
|
824
|
+
# The OAuth scopes
|
825
|
+
# @return [::Array<::String>]
|
826
|
+
# @!attribute [rw] lib_name
|
827
|
+
# The library name as recorded in instrumentation and logging
|
828
|
+
# @return [::String]
|
829
|
+
# @!attribute [rw] lib_version
|
830
|
+
# The library version as recorded in instrumentation and logging
|
831
|
+
# @return [::String]
|
832
|
+
# @!attribute [rw] channel_args
|
833
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
834
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
835
|
+
# @return [::Hash]
|
836
|
+
# @!attribute [rw] interceptors
|
837
|
+
# An array of interceptors that are run before calls are executed.
|
838
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
839
|
+
# @!attribute [rw] timeout
|
840
|
+
# The call timeout in seconds.
|
841
|
+
# @return [::Numeric]
|
842
|
+
# @!attribute [rw] metadata
|
843
|
+
# Additional gRPC headers to be sent with the call.
|
844
|
+
# @return [::Hash{::Symbol=>::String}]
|
845
|
+
# @!attribute [rw] retry_policy
|
846
|
+
# The retry policy. The value is a hash with the following keys:
|
847
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
848
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
849
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
850
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
851
|
+
# trigger a retry.
|
852
|
+
# @return [::Hash]
|
853
|
+
#
|
854
|
+
class Configuration
|
855
|
+
extend ::Gapic::Config
|
856
|
+
|
857
|
+
config_attr :endpoint, "cloudscheduler.googleapis.com", String
|
858
|
+
config_attr :credentials, nil do |value|
|
859
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
860
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
861
|
+
allowed.any? { |klass| klass === value }
|
862
|
+
end
|
863
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
864
|
+
config_attr :lib_name, nil, ::String, nil
|
865
|
+
config_attr :lib_version, nil, ::String, nil
|
866
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
867
|
+
config_attr :interceptors, nil, ::Array, nil
|
868
|
+
config_attr :timeout, nil, ::Numeric, nil
|
869
|
+
config_attr :metadata, nil, ::Hash, nil
|
870
|
+
config_attr :retry_policy, nil, ::Hash, Proc, nil
|
871
|
+
|
872
|
+
# @private
|
873
|
+
def initialize parent_config = nil
|
874
|
+
@parent_config = parent_config unless parent_config.nil?
|
875
|
+
|
876
|
+
yield self if block_given?
|
877
|
+
end
|
878
|
+
|
879
|
+
##
|
880
|
+
# Configurations for individual RPCs
|
881
|
+
# @return [Rpcs]
|
882
|
+
#
|
883
|
+
def rpcs
|
884
|
+
@rpcs ||= begin
|
885
|
+
parent_rpcs = nil
|
886
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
887
|
+
Rpcs.new parent_rpcs
|
888
|
+
end
|
889
|
+
end
|
890
|
+
|
891
|
+
##
|
892
|
+
# Configuration RPC class for the CloudScheduler API.
|
893
|
+
#
|
894
|
+
# Includes fields providing the configuration for each RPC in this service.
|
895
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
896
|
+
# the following configuration fields:
|
897
|
+
#
|
898
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
899
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
900
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
901
|
+
# include the following keys:
|
902
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
903
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
904
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
905
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
906
|
+
# trigger a retry.
|
907
|
+
#
|
908
|
+
class Rpcs
|
909
|
+
##
|
910
|
+
# RPC-specific configuration for `list_jobs`
|
911
|
+
# @return [::Gapic::Config::Method]
|
912
|
+
#
|
913
|
+
attr_reader :list_jobs
|
914
|
+
##
|
915
|
+
# RPC-specific configuration for `get_job`
|
916
|
+
# @return [::Gapic::Config::Method]
|
917
|
+
#
|
918
|
+
attr_reader :get_job
|
919
|
+
##
|
920
|
+
# RPC-specific configuration for `create_job`
|
921
|
+
# @return [::Gapic::Config::Method]
|
922
|
+
#
|
923
|
+
attr_reader :create_job
|
924
|
+
##
|
925
|
+
# RPC-specific configuration for `update_job`
|
926
|
+
# @return [::Gapic::Config::Method]
|
927
|
+
#
|
928
|
+
attr_reader :update_job
|
929
|
+
##
|
930
|
+
# RPC-specific configuration for `delete_job`
|
931
|
+
# @return [::Gapic::Config::Method]
|
932
|
+
#
|
933
|
+
attr_reader :delete_job
|
934
|
+
##
|
935
|
+
# RPC-specific configuration for `pause_job`
|
936
|
+
# @return [::Gapic::Config::Method]
|
937
|
+
#
|
938
|
+
attr_reader :pause_job
|
939
|
+
##
|
940
|
+
# RPC-specific configuration for `resume_job`
|
941
|
+
# @return [::Gapic::Config::Method]
|
942
|
+
#
|
943
|
+
attr_reader :resume_job
|
944
|
+
##
|
945
|
+
# RPC-specific configuration for `run_job`
|
946
|
+
# @return [::Gapic::Config::Method]
|
947
|
+
#
|
948
|
+
attr_reader :run_job
|
949
|
+
|
950
|
+
# @private
|
951
|
+
def initialize parent_rpcs = nil
|
952
|
+
list_jobs_config = parent_rpcs&.list_jobs if parent_rpcs&.respond_to? :list_jobs
|
953
|
+
@list_jobs = ::Gapic::Config::Method.new list_jobs_config
|
954
|
+
get_job_config = parent_rpcs&.get_job if parent_rpcs&.respond_to? :get_job
|
955
|
+
@get_job = ::Gapic::Config::Method.new get_job_config
|
956
|
+
create_job_config = parent_rpcs&.create_job if parent_rpcs&.respond_to? :create_job
|
957
|
+
@create_job = ::Gapic::Config::Method.new create_job_config
|
958
|
+
update_job_config = parent_rpcs&.update_job if parent_rpcs&.respond_to? :update_job
|
959
|
+
@update_job = ::Gapic::Config::Method.new update_job_config
|
960
|
+
delete_job_config = parent_rpcs&.delete_job if parent_rpcs&.respond_to? :delete_job
|
961
|
+
@delete_job = ::Gapic::Config::Method.new delete_job_config
|
962
|
+
pause_job_config = parent_rpcs&.pause_job if parent_rpcs&.respond_to? :pause_job
|
963
|
+
@pause_job = ::Gapic::Config::Method.new pause_job_config
|
964
|
+
resume_job_config = parent_rpcs&.resume_job if parent_rpcs&.respond_to? :resume_job
|
965
|
+
@resume_job = ::Gapic::Config::Method.new resume_job_config
|
966
|
+
run_job_config = parent_rpcs&.run_job if parent_rpcs&.respond_to? :run_job
|
967
|
+
@run_job = ::Gapic::Config::Method.new run_job_config
|
968
|
+
|
969
|
+
yield self if block_given?
|
970
|
+
end
|
971
|
+
end
|
972
|
+
end
|
973
|
+
end
|
974
|
+
end
|
975
|
+
end
|
976
|
+
end
|
977
|
+
end
|
978
|
+
end
|