google-apis-cloudscheduler_v1beta1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module CloudschedulerV1beta1
18
+ # Version of the google-apis-cloudscheduler_v1beta1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20201202"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,300 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module CloudschedulerV1beta1
24
+
25
+ class AppEngineHttpTarget
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class AppEngineRouting
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class Empty
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class HttpTarget
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class Job
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class ListJobsResponse
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class ListLocationsResponse
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class Location
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class OAuthToken
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class OidcToken
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class PauseJobRequest
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class PubsubMessage
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class PubsubTarget
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class ResumeJobRequest
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ include Google::Apis::Core::JsonObjectSupport
107
+ end
108
+
109
+ class RetryConfig
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+
112
+ include Google::Apis::Core::JsonObjectSupport
113
+ end
114
+
115
+ class RunJobRequest
116
+ class Representation < Google::Apis::Core::JsonRepresentation; end
117
+
118
+ include Google::Apis::Core::JsonObjectSupport
119
+ end
120
+
121
+ class Status
122
+ class Representation < Google::Apis::Core::JsonRepresentation; end
123
+
124
+ include Google::Apis::Core::JsonObjectSupport
125
+ end
126
+
127
+ class AppEngineHttpTarget
128
+ # @private
129
+ class Representation < Google::Apis::Core::JsonRepresentation
130
+ property :app_engine_routing, as: 'appEngineRouting', class: Google::Apis::CloudschedulerV1beta1::AppEngineRouting, decorator: Google::Apis::CloudschedulerV1beta1::AppEngineRouting::Representation
131
+
132
+ property :body, :base64 => true, as: 'body'
133
+ hash :headers, as: 'headers'
134
+ property :http_method, as: 'httpMethod'
135
+ property :relative_uri, as: 'relativeUri'
136
+ end
137
+ end
138
+
139
+ class AppEngineRouting
140
+ # @private
141
+ class Representation < Google::Apis::Core::JsonRepresentation
142
+ property :host, as: 'host'
143
+ property :instance, as: 'instance'
144
+ property :service, as: 'service'
145
+ property :version, as: 'version'
146
+ end
147
+ end
148
+
149
+ class Empty
150
+ # @private
151
+ class Representation < Google::Apis::Core::JsonRepresentation
152
+ end
153
+ end
154
+
155
+ class HttpTarget
156
+ # @private
157
+ class Representation < Google::Apis::Core::JsonRepresentation
158
+ property :body, :base64 => true, as: 'body'
159
+ hash :headers, as: 'headers'
160
+ property :http_method, as: 'httpMethod'
161
+ property :oauth_token, as: 'oauthToken', class: Google::Apis::CloudschedulerV1beta1::OAuthToken, decorator: Google::Apis::CloudschedulerV1beta1::OAuthToken::Representation
162
+
163
+ property :oidc_token, as: 'oidcToken', class: Google::Apis::CloudschedulerV1beta1::OidcToken, decorator: Google::Apis::CloudschedulerV1beta1::OidcToken::Representation
164
+
165
+ property :uri, as: 'uri'
166
+ end
167
+ end
168
+
169
+ class Job
170
+ # @private
171
+ class Representation < Google::Apis::Core::JsonRepresentation
172
+ property :app_engine_http_target, as: 'appEngineHttpTarget', class: Google::Apis::CloudschedulerV1beta1::AppEngineHttpTarget, decorator: Google::Apis::CloudschedulerV1beta1::AppEngineHttpTarget::Representation
173
+
174
+ property :attempt_deadline, as: 'attemptDeadline'
175
+ property :description, as: 'description'
176
+ property :http_target, as: 'httpTarget', class: Google::Apis::CloudschedulerV1beta1::HttpTarget, decorator: Google::Apis::CloudschedulerV1beta1::HttpTarget::Representation
177
+
178
+ property :last_attempt_time, as: 'lastAttemptTime'
179
+ property :legacy_app_engine_cron, as: 'legacyAppEngineCron'
180
+ property :name, as: 'name'
181
+ property :pubsub_target, as: 'pubsubTarget', class: Google::Apis::CloudschedulerV1beta1::PubsubTarget, decorator: Google::Apis::CloudschedulerV1beta1::PubsubTarget::Representation
182
+
183
+ property :retry_config, as: 'retryConfig', class: Google::Apis::CloudschedulerV1beta1::RetryConfig, decorator: Google::Apis::CloudschedulerV1beta1::RetryConfig::Representation
184
+
185
+ property :schedule, as: 'schedule'
186
+ property :schedule_time, as: 'scheduleTime'
187
+ property :state, as: 'state'
188
+ property :status, as: 'status', class: Google::Apis::CloudschedulerV1beta1::Status, decorator: Google::Apis::CloudschedulerV1beta1::Status::Representation
189
+
190
+ property :time_zone, as: 'timeZone'
191
+ property :user_update_time, as: 'userUpdateTime'
192
+ end
193
+ end
194
+
195
+ class ListJobsResponse
196
+ # @private
197
+ class Representation < Google::Apis::Core::JsonRepresentation
198
+ collection :jobs, as: 'jobs', class: Google::Apis::CloudschedulerV1beta1::Job, decorator: Google::Apis::CloudschedulerV1beta1::Job::Representation
199
+
200
+ property :next_page_token, as: 'nextPageToken'
201
+ end
202
+ end
203
+
204
+ class ListLocationsResponse
205
+ # @private
206
+ class Representation < Google::Apis::Core::JsonRepresentation
207
+ collection :locations, as: 'locations', class: Google::Apis::CloudschedulerV1beta1::Location, decorator: Google::Apis::CloudschedulerV1beta1::Location::Representation
208
+
209
+ property :next_page_token, as: 'nextPageToken'
210
+ end
211
+ end
212
+
213
+ class Location
214
+ # @private
215
+ class Representation < Google::Apis::Core::JsonRepresentation
216
+ property :display_name, as: 'displayName'
217
+ hash :labels, as: 'labels'
218
+ property :location_id, as: 'locationId'
219
+ hash :metadata, as: 'metadata'
220
+ property :name, as: 'name'
221
+ end
222
+ end
223
+
224
+ class OAuthToken
225
+ # @private
226
+ class Representation < Google::Apis::Core::JsonRepresentation
227
+ property :scope, as: 'scope'
228
+ property :service_account_email, as: 'serviceAccountEmail'
229
+ end
230
+ end
231
+
232
+ class OidcToken
233
+ # @private
234
+ class Representation < Google::Apis::Core::JsonRepresentation
235
+ property :audience, as: 'audience'
236
+ property :service_account_email, as: 'serviceAccountEmail'
237
+ end
238
+ end
239
+
240
+ class PauseJobRequest
241
+ # @private
242
+ class Representation < Google::Apis::Core::JsonRepresentation
243
+ end
244
+ end
245
+
246
+ class PubsubMessage
247
+ # @private
248
+ class Representation < Google::Apis::Core::JsonRepresentation
249
+ hash :attributes, as: 'attributes'
250
+ property :data, :base64 => true, as: 'data'
251
+ property :message_id, as: 'messageId'
252
+ property :ordering_key, as: 'orderingKey'
253
+ property :publish_time, as: 'publishTime'
254
+ end
255
+ end
256
+
257
+ class PubsubTarget
258
+ # @private
259
+ class Representation < Google::Apis::Core::JsonRepresentation
260
+ hash :attributes, as: 'attributes'
261
+ property :data, :base64 => true, as: 'data'
262
+ property :topic_name, as: 'topicName'
263
+ end
264
+ end
265
+
266
+ class ResumeJobRequest
267
+ # @private
268
+ class Representation < Google::Apis::Core::JsonRepresentation
269
+ end
270
+ end
271
+
272
+ class RetryConfig
273
+ # @private
274
+ class Representation < Google::Apis::Core::JsonRepresentation
275
+ property :max_backoff_duration, as: 'maxBackoffDuration'
276
+ property :max_doublings, as: 'maxDoublings'
277
+ property :max_retry_duration, as: 'maxRetryDuration'
278
+ property :min_backoff_duration, as: 'minBackoffDuration'
279
+ property :retry_count, as: 'retryCount'
280
+ end
281
+ end
282
+
283
+ class RunJobRequest
284
+ # @private
285
+ class Representation < Google::Apis::Core::JsonRepresentation
286
+ property :legacy_app_engine_cron, as: 'legacyAppEngineCron'
287
+ end
288
+ end
289
+
290
+ class Status
291
+ # @private
292
+ class Representation < Google::Apis::Core::JsonRepresentation
293
+ property :code, as: 'code'
294
+ collection :details, as: 'details'
295
+ property :message, as: 'message'
296
+ end
297
+ end
298
+ end
299
+ end
300
+ end
@@ -0,0 +1,436 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module CloudschedulerV1beta1
23
+ # Cloud Scheduler API
24
+ #
25
+ # Creates and manages jobs run on a regular recurring schedule.
26
+ #
27
+ # @example
28
+ # require 'google/apis/cloudscheduler_v1beta1'
29
+ #
30
+ # Cloudscheduler = Google::Apis::CloudschedulerV1beta1 # Alias the module
31
+ # service = Cloudscheduler::CloudSchedulerService.new
32
+ #
33
+ # @see https://cloud.google.com/scheduler/
34
+ class CloudSchedulerService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://cloudscheduler.googleapis.com/', '',
47
+ client_name: 'google-apis-cloudscheduler_v1beta1',
48
+ client_version: Google::Apis::CloudschedulerV1beta1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Gets information about a location.
53
+ # @param [String] name
54
+ # Resource name for the location.
55
+ # @param [String] fields
56
+ # Selector specifying which fields to include in a partial response.
57
+ # @param [String] quota_user
58
+ # Available to use for quota purposes for server-side applications. Can be any
59
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
60
+ # @param [Google::Apis::RequestOptions] options
61
+ # Request-specific options
62
+ #
63
+ # @yield [result, err] Result & error if block supplied
64
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::Location] parsed result object
65
+ # @yieldparam err [StandardError] error object if request failed
66
+ #
67
+ # @return [Google::Apis::CloudschedulerV1beta1::Location]
68
+ #
69
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
70
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
71
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
72
+ def get_project_location(name, fields: nil, quota_user: nil, options: nil, &block)
73
+ command = make_simple_command(:get, 'v1beta1/{+name}', options)
74
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::Location::Representation
75
+ command.response_class = Google::Apis::CloudschedulerV1beta1::Location
76
+ command.params['name'] = name unless name.nil?
77
+ command.query['fields'] = fields unless fields.nil?
78
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
79
+ execute_or_queue_command(command, &block)
80
+ end
81
+
82
+ # Lists information about the supported locations for this service.
83
+ # @param [String] name
84
+ # The resource that owns the locations collection, if applicable.
85
+ # @param [String] filter
86
+ # The standard list filter.
87
+ # @param [Fixnum] page_size
88
+ # The standard list page size.
89
+ # @param [String] page_token
90
+ # The standard list page token.
91
+ # @param [String] fields
92
+ # Selector specifying which fields to include in a partial response.
93
+ # @param [String] quota_user
94
+ # Available to use for quota purposes for server-side applications. Can be any
95
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
96
+ # @param [Google::Apis::RequestOptions] options
97
+ # Request-specific options
98
+ #
99
+ # @yield [result, err] Result & error if block supplied
100
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::ListLocationsResponse] parsed result object
101
+ # @yieldparam err [StandardError] error object if request failed
102
+ #
103
+ # @return [Google::Apis::CloudschedulerV1beta1::ListLocationsResponse]
104
+ #
105
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
106
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
107
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
108
+ def list_project_locations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
109
+ command = make_simple_command(:get, 'v1beta1/{+name}/locations', options)
110
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::ListLocationsResponse::Representation
111
+ command.response_class = Google::Apis::CloudschedulerV1beta1::ListLocationsResponse
112
+ command.params['name'] = name unless name.nil?
113
+ command.query['filter'] = filter unless filter.nil?
114
+ command.query['pageSize'] = page_size unless page_size.nil?
115
+ command.query['pageToken'] = page_token unless page_token.nil?
116
+ command.query['fields'] = fields unless fields.nil?
117
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
118
+ execute_or_queue_command(command, &block)
119
+ end
120
+
121
+ # Creates a job.
122
+ # @param [String] parent
123
+ # Required. The location name. For example: `projects/PROJECT_ID/locations/
124
+ # LOCATION_ID`.
125
+ # @param [Google::Apis::CloudschedulerV1beta1::Job] job_object
126
+ # @param [String] fields
127
+ # Selector specifying which fields to include in a partial response.
128
+ # @param [String] quota_user
129
+ # Available to use for quota purposes for server-side applications. Can be any
130
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
131
+ # @param [Google::Apis::RequestOptions] options
132
+ # Request-specific options
133
+ #
134
+ # @yield [result, err] Result & error if block supplied
135
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::Job] parsed result object
136
+ # @yieldparam err [StandardError] error object if request failed
137
+ #
138
+ # @return [Google::Apis::CloudschedulerV1beta1::Job]
139
+ #
140
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
141
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
142
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
143
+ def create_project_location_job(parent, job_object = nil, fields: nil, quota_user: nil, options: nil, &block)
144
+ command = make_simple_command(:post, 'v1beta1/{+parent}/jobs', options)
145
+ command.request_representation = Google::Apis::CloudschedulerV1beta1::Job::Representation
146
+ command.request_object = job_object
147
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::Job::Representation
148
+ command.response_class = Google::Apis::CloudschedulerV1beta1::Job
149
+ command.params['parent'] = parent unless parent.nil?
150
+ command.query['fields'] = fields unless fields.nil?
151
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
152
+ execute_or_queue_command(command, &block)
153
+ end
154
+
155
+ # Deletes a job.
156
+ # @param [String] name
157
+ # Required. The job name. For example: `projects/PROJECT_ID/locations/
158
+ # LOCATION_ID/jobs/JOB_ID`.
159
+ # @param [Boolean] legacy_app_engine_cron
160
+ # This field is used to manage the legacy App Engine Cron jobs using the Cloud
161
+ # Scheduler API. If the field is set to true, the job in the __cron queue with
162
+ # the corresponding name will be deleted instead.
163
+ # @param [String] fields
164
+ # Selector specifying which fields to include in a partial response.
165
+ # @param [String] quota_user
166
+ # Available to use for quota purposes for server-side applications. Can be any
167
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
168
+ # @param [Google::Apis::RequestOptions] options
169
+ # Request-specific options
170
+ #
171
+ # @yield [result, err] Result & error if block supplied
172
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::Empty] parsed result object
173
+ # @yieldparam err [StandardError] error object if request failed
174
+ #
175
+ # @return [Google::Apis::CloudschedulerV1beta1::Empty]
176
+ #
177
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
178
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
179
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
180
+ def delete_project_location_job(name, legacy_app_engine_cron: nil, fields: nil, quota_user: nil, options: nil, &block)
181
+ command = make_simple_command(:delete, 'v1beta1/{+name}', options)
182
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::Empty::Representation
183
+ command.response_class = Google::Apis::CloudschedulerV1beta1::Empty
184
+ command.params['name'] = name unless name.nil?
185
+ command.query['legacyAppEngineCron'] = legacy_app_engine_cron unless legacy_app_engine_cron.nil?
186
+ command.query['fields'] = fields unless fields.nil?
187
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
188
+ execute_or_queue_command(command, &block)
189
+ end
190
+
191
+ # Gets a job.
192
+ # @param [String] name
193
+ # Required. The job name. For example: `projects/PROJECT_ID/locations/
194
+ # LOCATION_ID/jobs/JOB_ID`.
195
+ # @param [String] fields
196
+ # Selector specifying which fields to include in a partial response.
197
+ # @param [String] quota_user
198
+ # Available to use for quota purposes for server-side applications. Can be any
199
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
200
+ # @param [Google::Apis::RequestOptions] options
201
+ # Request-specific options
202
+ #
203
+ # @yield [result, err] Result & error if block supplied
204
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::Job] parsed result object
205
+ # @yieldparam err [StandardError] error object if request failed
206
+ #
207
+ # @return [Google::Apis::CloudschedulerV1beta1::Job]
208
+ #
209
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
210
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
211
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
212
+ def get_project_location_job(name, fields: nil, quota_user: nil, options: nil, &block)
213
+ command = make_simple_command(:get, 'v1beta1/{+name}', options)
214
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::Job::Representation
215
+ command.response_class = Google::Apis::CloudschedulerV1beta1::Job
216
+ command.params['name'] = name unless name.nil?
217
+ command.query['fields'] = fields unless fields.nil?
218
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
219
+ execute_or_queue_command(command, &block)
220
+ end
221
+
222
+ # Lists jobs.
223
+ # @param [String] parent
224
+ # Required. The location name. For example: `projects/PROJECT_ID/locations/
225
+ # LOCATION_ID`.
226
+ # @param [Boolean] legacy_app_engine_cron
227
+ # This field is used to manage the legacy App Engine Cron jobs using the Cloud
228
+ # Scheduler API. If the field is set to true, the jobs in the __cron queue will
229
+ # be listed instead.
230
+ # @param [Fixnum] page_size
231
+ # Requested page size. The maximum page size is 500. If unspecified, the page
232
+ # size will be the maximum. Fewer jobs than requested might be returned, even if
233
+ # more jobs exist; use next_page_token to determine if more jobs exist.
234
+ # @param [String] page_token
235
+ # A token identifying a page of results the server will return. To request the
236
+ # first page results, page_token must be empty. To request the next page of
237
+ # results, page_token must be the value of next_page_token returned from the
238
+ # previous call to ListJobs. It is an error to switch the value of filter or
239
+ # order_by while iterating through pages.
240
+ # @param [String] fields
241
+ # Selector specifying which fields to include in a partial response.
242
+ # @param [String] quota_user
243
+ # Available to use for quota purposes for server-side applications. Can be any
244
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
245
+ # @param [Google::Apis::RequestOptions] options
246
+ # Request-specific options
247
+ #
248
+ # @yield [result, err] Result & error if block supplied
249
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::ListJobsResponse] parsed result object
250
+ # @yieldparam err [StandardError] error object if request failed
251
+ #
252
+ # @return [Google::Apis::CloudschedulerV1beta1::ListJobsResponse]
253
+ #
254
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
255
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
256
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
257
+ def list_project_location_jobs(parent, legacy_app_engine_cron: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
258
+ command = make_simple_command(:get, 'v1beta1/{+parent}/jobs', options)
259
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::ListJobsResponse::Representation
260
+ command.response_class = Google::Apis::CloudschedulerV1beta1::ListJobsResponse
261
+ command.params['parent'] = parent unless parent.nil?
262
+ command.query['legacyAppEngineCron'] = legacy_app_engine_cron unless legacy_app_engine_cron.nil?
263
+ command.query['pageSize'] = page_size unless page_size.nil?
264
+ command.query['pageToken'] = page_token unless page_token.nil?
265
+ command.query['fields'] = fields unless fields.nil?
266
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
267
+ execute_or_queue_command(command, &block)
268
+ end
269
+
270
+ # Updates a job. If successful, the updated Job is returned. If the job does not
271
+ # exist, `NOT_FOUND` is returned. If UpdateJob does not successfully return, it
272
+ # is possible for the job to be in an Job.State.UPDATE_FAILED state. A job in
273
+ # this state may not be executed. If this happens, retry the UpdateJob request
274
+ # until a successful response is received.
275
+ # @param [String] name
276
+ # Optionally caller-specified in CreateJob, after which it becomes output only.
277
+ # The job name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/jobs/
278
+ # JOB_ID`. * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
279
+ # hyphens (-), colons (:), or periods (.). For more information, see [
280
+ # Identifying projects](https://cloud.google.com/resource-manager/docs/creating-
281
+ # managing-projects#identifying_projects) * `LOCATION_ID` is the canonical ID
282
+ # for the job's location. The list of available locations can be obtained by
283
+ # calling ListLocations. For more information, see https://cloud.google.com/
284
+ # about/locations/. * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-
285
+ # 9]), hyphens (-), or underscores (_). The maximum length is 500 characters.
286
+ # @param [Google::Apis::CloudschedulerV1beta1::Job] job_object
287
+ # @param [String] update_mask
288
+ # A mask used to specify which fields of the job are being updated.
289
+ # @param [String] fields
290
+ # Selector specifying which fields to include in a partial response.
291
+ # @param [String] quota_user
292
+ # Available to use for quota purposes for server-side applications. Can be any
293
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
294
+ # @param [Google::Apis::RequestOptions] options
295
+ # Request-specific options
296
+ #
297
+ # @yield [result, err] Result & error if block supplied
298
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::Job] parsed result object
299
+ # @yieldparam err [StandardError] error object if request failed
300
+ #
301
+ # @return [Google::Apis::CloudschedulerV1beta1::Job]
302
+ #
303
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
304
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
305
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
306
+ def patch_project_location_job(name, job_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
307
+ command = make_simple_command(:patch, 'v1beta1/{+name}', options)
308
+ command.request_representation = Google::Apis::CloudschedulerV1beta1::Job::Representation
309
+ command.request_object = job_object
310
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::Job::Representation
311
+ command.response_class = Google::Apis::CloudschedulerV1beta1::Job
312
+ command.params['name'] = name unless name.nil?
313
+ command.query['updateMask'] = update_mask unless update_mask.nil?
314
+ command.query['fields'] = fields unless fields.nil?
315
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
316
+ execute_or_queue_command(command, &block)
317
+ end
318
+
319
+ # Pauses a job. If a job is paused then the system will stop executing the job
320
+ # until it is re-enabled via ResumeJob. The state of the job is stored in state;
321
+ # if paused it will be set to Job.State.PAUSED. A job must be in Job.State.
322
+ # ENABLED to be paused.
323
+ # @param [String] name
324
+ # Required. The job name. For example: `projects/PROJECT_ID/locations/
325
+ # LOCATION_ID/jobs/JOB_ID`.
326
+ # @param [Google::Apis::CloudschedulerV1beta1::PauseJobRequest] pause_job_request_object
327
+ # @param [String] fields
328
+ # Selector specifying which fields to include in a partial response.
329
+ # @param [String] quota_user
330
+ # Available to use for quota purposes for server-side applications. Can be any
331
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
332
+ # @param [Google::Apis::RequestOptions] options
333
+ # Request-specific options
334
+ #
335
+ # @yield [result, err] Result & error if block supplied
336
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::Job] parsed result object
337
+ # @yieldparam err [StandardError] error object if request failed
338
+ #
339
+ # @return [Google::Apis::CloudschedulerV1beta1::Job]
340
+ #
341
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
342
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
343
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
344
+ def pause_job(name, pause_job_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
345
+ command = make_simple_command(:post, 'v1beta1/{+name}:pause', options)
346
+ command.request_representation = Google::Apis::CloudschedulerV1beta1::PauseJobRequest::Representation
347
+ command.request_object = pause_job_request_object
348
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::Job::Representation
349
+ command.response_class = Google::Apis::CloudschedulerV1beta1::Job
350
+ command.params['name'] = name unless name.nil?
351
+ command.query['fields'] = fields unless fields.nil?
352
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
353
+ execute_or_queue_command(command, &block)
354
+ end
355
+
356
+ # Resume a job. This method reenables a job after it has been Job.State.PAUSED.
357
+ # The state of a job is stored in Job.state; after calling this method it will
358
+ # be set to Job.State.ENABLED. A job must be in Job.State.PAUSED to be resumed.
359
+ # @param [String] name
360
+ # Required. The job name. For example: `projects/PROJECT_ID/locations/
361
+ # LOCATION_ID/jobs/JOB_ID`.
362
+ # @param [Google::Apis::CloudschedulerV1beta1::ResumeJobRequest] resume_job_request_object
363
+ # @param [String] fields
364
+ # Selector specifying which fields to include in a partial response.
365
+ # @param [String] quota_user
366
+ # Available to use for quota purposes for server-side applications. Can be any
367
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
368
+ # @param [Google::Apis::RequestOptions] options
369
+ # Request-specific options
370
+ #
371
+ # @yield [result, err] Result & error if block supplied
372
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::Job] parsed result object
373
+ # @yieldparam err [StandardError] error object if request failed
374
+ #
375
+ # @return [Google::Apis::CloudschedulerV1beta1::Job]
376
+ #
377
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
378
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
379
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
380
+ def resume_job(name, resume_job_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
381
+ command = make_simple_command(:post, 'v1beta1/{+name}:resume', options)
382
+ command.request_representation = Google::Apis::CloudschedulerV1beta1::ResumeJobRequest::Representation
383
+ command.request_object = resume_job_request_object
384
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::Job::Representation
385
+ command.response_class = Google::Apis::CloudschedulerV1beta1::Job
386
+ command.params['name'] = name unless name.nil?
387
+ command.query['fields'] = fields unless fields.nil?
388
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
389
+ execute_or_queue_command(command, &block)
390
+ end
391
+
392
+ # Forces a job to run now. When this method is called, Cloud Scheduler will
393
+ # dispatch the job, even if the job is already running.
394
+ # @param [String] name
395
+ # Required. The job name. For example: `projects/PROJECT_ID/locations/
396
+ # LOCATION_ID/jobs/JOB_ID`.
397
+ # @param [Google::Apis::CloudschedulerV1beta1::RunJobRequest] run_job_request_object
398
+ # @param [String] fields
399
+ # Selector specifying which fields to include in a partial response.
400
+ # @param [String] quota_user
401
+ # Available to use for quota purposes for server-side applications. Can be any
402
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
403
+ # @param [Google::Apis::RequestOptions] options
404
+ # Request-specific options
405
+ #
406
+ # @yield [result, err] Result & error if block supplied
407
+ # @yieldparam result [Google::Apis::CloudschedulerV1beta1::Job] parsed result object
408
+ # @yieldparam err [StandardError] error object if request failed
409
+ #
410
+ # @return [Google::Apis::CloudschedulerV1beta1::Job]
411
+ #
412
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
413
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
414
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
415
+ def run_job(name, run_job_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
416
+ command = make_simple_command(:post, 'v1beta1/{+name}:run', options)
417
+ command.request_representation = Google::Apis::CloudschedulerV1beta1::RunJobRequest::Representation
418
+ command.request_object = run_job_request_object
419
+ command.response_representation = Google::Apis::CloudschedulerV1beta1::Job::Representation
420
+ command.response_class = Google::Apis::CloudschedulerV1beta1::Job
421
+ command.params['name'] = name unless name.nil?
422
+ command.query['fields'] = fields unless fields.nil?
423
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
424
+ execute_or_queue_command(command, &block)
425
+ end
426
+
427
+ protected
428
+
429
+ def apply_command_defaults(command)
430
+ command.query['key'] = key unless key.nil?
431
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
432
+ end
433
+ end
434
+ end
435
+ end
436
+ end