smplkit 3.0.110 → 3.0.111
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/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/jobs_api.rb +17 -8
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb +5 -2
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job.rb +16 -5
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_environment.rb +162 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb +28 -1
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client.rb +1 -0
- data/lib/smplkit/_generated/jobs/spec/api/jobs_api_spec.rb +7 -4
- data/lib/smplkit/_generated/jobs/spec/api/runs_api_spec.rb +2 -1
- data/lib/smplkit/_generated/jobs/spec/models/job_environment_spec.rb +42 -0
- data/lib/smplkit/_generated/jobs/spec/models/job_spec.rb +6 -0
- data/lib/smplkit/_generated/jobs/spec/models/run_spec.rb +6 -0
- data/lib/smplkit/jobs/client.rb +96 -34
- data/lib/smplkit/jobs/models.rb +319 -20
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 36b7f415bef6f9d2ea27773513c56a49802273232e3e35b00caab0263ef7d767
|
|
4
|
+
data.tar.gz: 90e54bf5540589eb4961b8459ac3a1af5fa0ec15641b1efa98b1f5ccd42d8211
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ae5a296f785aab949ae380c61efeae82793b1287a24d5ba0bfe0163f355170b3afb11bdd3fbad4c6c2d78f75d023635c8109f9777cf8a789e4f0dfbbf37db9b
|
|
7
|
+
data.tar.gz: c94a0a639c7361dc28dca4d6c800cb8b4ef3fd3d910a8194ba370b1de8f093adf7cda470f98c4b9779d7868c1666ce5f1464dc362679bb64f4af423a830146b4
|
|
@@ -20,9 +20,10 @@ module SmplkitGeneratedClient::Jobs
|
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
22
|
# Create Job
|
|
23
|
-
# Create a job for this account. The caller supplies the job's id as `data.id`. Ids are unique within an account and immutable.
|
|
23
|
+
# Create a job for this account. The caller supplies the job's id as `data.id`. Ids are unique within an account and immutable. A recurring job supplies `environments` to choose where it runs and begins scheduling immediately in each enabled environment. A one-off job is created in the environment named by the `X-Smplkit-Environment` header (implied when the credential is scoped to a single environment).
|
|
24
24
|
# @param job_create_request [JobCreateRequest]
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
26
27
|
# @return [JobResponse]
|
|
27
28
|
def create_job(job_create_request, opts = {})
|
|
28
29
|
data, _status_code, _headers = create_job_with_http_info(job_create_request, opts)
|
|
@@ -30,9 +31,10 @@ module SmplkitGeneratedClient::Jobs
|
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
# Create Job
|
|
33
|
-
# Create a job for this account. The caller supplies the job's id as `data.id`. Ids are unique within an account and immutable.
|
|
34
|
+
# Create a job for this account. The caller supplies the job's id as `data.id`. Ids are unique within an account and immutable. A recurring job supplies `environments` to choose where it runs and begins scheduling immediately in each enabled environment. A one-off job is created in the environment named by the `X-Smplkit-Environment` header (implied when the credential is scoped to a single environment).
|
|
34
35
|
# @param job_create_request [JobCreateRequest]
|
|
35
36
|
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
36
38
|
# @return [Array<(JobResponse, Integer, Hash)>] JobResponse data, response status code and response headers
|
|
37
39
|
def create_job_with_http_info(job_create_request, opts = {})
|
|
38
40
|
if @api_client.config.debugging
|
|
@@ -57,6 +59,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
57
59
|
if !content_type.nil?
|
|
58
60
|
header_params['Content-Type'] = content_type
|
|
59
61
|
end
|
|
62
|
+
header_params[:'X-Smplkit-Environment'] = opts[:'x_smplkit_environment'] if !opts[:'x_smplkit_environment'].nil?
|
|
60
63
|
|
|
61
64
|
# form parameters
|
|
62
65
|
form_params = opts[:form_params] || {}
|
|
@@ -212,7 +215,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
212
215
|
end
|
|
213
216
|
|
|
214
217
|
# List Jobs
|
|
215
|
-
# List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, `updated_at`, `next_run_at`, or `enabled`, ascending or descending (prefix `-` for descending). Filter with `filter[enabled]
|
|
218
|
+
# List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, `updated_at`, `next_run_at`, or `enabled`, ascending or descending (prefix `-` for descending). Filter with `filter[enabled]` (enabled in at least one environment), `filter[recurring]`, and `filter[name]` (case-insensitive substring match on the name); filters compose with AND. A scoped caller sees each job's `environments` map narrowed to the environments it may access.
|
|
216
219
|
# @param [Hash] opts the optional parameters
|
|
217
220
|
# @option opts [Boolean] :filter_enabled
|
|
218
221
|
# @option opts [Boolean] :filter_recurring
|
|
@@ -228,7 +231,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
228
231
|
end
|
|
229
232
|
|
|
230
233
|
# List Jobs
|
|
231
|
-
# List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, `updated_at`, `next_run_at`, or `enabled`, ascending or descending (prefix `-` for descending). Filter with `filter[enabled]`
|
|
234
|
+
# List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, `updated_at`, `next_run_at`, or `enabled`, ascending or descending (prefix `-` for descending). Filter with `filter[enabled]` (enabled in at least one environment), `filter[recurring]`, and `filter[name]` (case-insensitive substring match on the name); filters compose with AND. A scoped caller sees each job's `environments` map narrowed to the environments it may access.
|
|
232
235
|
# @param [Hash] opts the optional parameters
|
|
233
236
|
# @option opts [Boolean] :filter_enabled
|
|
234
237
|
# @option opts [Boolean] :filter_recurring
|
|
@@ -294,9 +297,10 @@ module SmplkitGeneratedClient::Jobs
|
|
|
294
297
|
end
|
|
295
298
|
|
|
296
299
|
# Run Job Now
|
|
297
|
-
# Trigger one immediate run of the job (a `MANUAL` run). The job's schedule and enabled state are untouched. The run is enqueued and executed by the worker; if the account is over its run allotment the run will fail with reason `QUOTA_EXCEEDED` rather than being rejected here.
|
|
300
|
+
# Trigger one immediate run of the job (a `MANUAL` run). The job's schedule and enabled state are untouched. The run executes in the environment named by the `X-Smplkit-Environment` header; when the job is enabled in exactly one environment that environment is used, and a single-environment credential implies it. The run executes the job's effective configuration for that environment. It is enqueued and executed by the worker; if the account is over its run allotment the run will fail with reason `QUOTA_EXCEEDED` rather than being rejected here.
|
|
298
301
|
# @param job_id [String]
|
|
299
302
|
# @param [Hash] opts the optional parameters
|
|
303
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
300
304
|
# @return [RunResponse]
|
|
301
305
|
def run_job_now(job_id, opts = {})
|
|
302
306
|
data, _status_code, _headers = run_job_now_with_http_info(job_id, opts)
|
|
@@ -304,9 +308,10 @@ module SmplkitGeneratedClient::Jobs
|
|
|
304
308
|
end
|
|
305
309
|
|
|
306
310
|
# Run Job Now
|
|
307
|
-
# Trigger one immediate run of the job (a `MANUAL` run). The job's schedule and enabled state are untouched. The run is enqueued and executed by the worker; if the account is over its run allotment the run will fail with reason `QUOTA_EXCEEDED` rather than being rejected here.
|
|
311
|
+
# Trigger one immediate run of the job (a `MANUAL` run). The job's schedule and enabled state are untouched. The run executes in the environment named by the `X-Smplkit-Environment` header; when the job is enabled in exactly one environment that environment is used, and a single-environment credential implies it. The run executes the job's effective configuration for that environment. It is enqueued and executed by the worker; if the account is over its run allotment the run will fail with reason `QUOTA_EXCEEDED` rather than being rejected here.
|
|
308
312
|
# @param job_id [String]
|
|
309
313
|
# @param [Hash] opts the optional parameters
|
|
314
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
310
315
|
# @return [Array<(RunResponse, Integer, Hash)>] RunResponse data, response status code and response headers
|
|
311
316
|
def run_job_now_with_http_info(job_id, opts = {})
|
|
312
317
|
if @api_client.config.debugging
|
|
@@ -326,6 +331,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
326
331
|
header_params = opts[:header_params] || {}
|
|
327
332
|
# HTTP header 'Accept' (if needed)
|
|
328
333
|
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
|
|
334
|
+
header_params[:'X-Smplkit-Environment'] = opts[:'x_smplkit_environment'] if !opts[:'x_smplkit_environment'].nil?
|
|
329
335
|
|
|
330
336
|
# form parameters
|
|
331
337
|
form_params = opts[:form_params] || {}
|
|
@@ -357,10 +363,11 @@ module SmplkitGeneratedClient::Jobs
|
|
|
357
363
|
end
|
|
358
364
|
|
|
359
365
|
# Update Job
|
|
360
|
-
# Replace an existing job. Every writable field is overwritten.
|
|
366
|
+
# Replace an existing job. Every writable field is overwritten. Set enablement per environment via the `environments` map (a recurring job), or by recreating a one-off job in the desired environment. Editing the schedule recomputes the next fire time; changing only which environments are enabled preserves the existing cadence.
|
|
361
367
|
# @param job_id [String]
|
|
362
368
|
# @param job_request [JobRequest]
|
|
363
369
|
# @param [Hash] opts the optional parameters
|
|
370
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
364
371
|
# @return [JobResponse]
|
|
365
372
|
def update_job(job_id, job_request, opts = {})
|
|
366
373
|
data, _status_code, _headers = update_job_with_http_info(job_id, job_request, opts)
|
|
@@ -368,10 +375,11 @@ module SmplkitGeneratedClient::Jobs
|
|
|
368
375
|
end
|
|
369
376
|
|
|
370
377
|
# Update Job
|
|
371
|
-
# Replace an existing job. Every writable field is overwritten.
|
|
378
|
+
# Replace an existing job. Every writable field is overwritten. Set enablement per environment via the `environments` map (a recurring job), or by recreating a one-off job in the desired environment. Editing the schedule recomputes the next fire time; changing only which environments are enabled preserves the existing cadence.
|
|
372
379
|
# @param job_id [String]
|
|
373
380
|
# @param job_request [JobRequest]
|
|
374
381
|
# @param [Hash] opts the optional parameters
|
|
382
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
375
383
|
# @return [Array<(JobResponse, Integer, Hash)>] JobResponse data, response status code and response headers
|
|
376
384
|
def update_job_with_http_info(job_id, job_request, opts = {})
|
|
377
385
|
if @api_client.config.debugging
|
|
@@ -400,6 +408,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
400
408
|
if !content_type.nil?
|
|
401
409
|
header_params['Content-Type'] = content_type
|
|
402
410
|
end
|
|
411
|
+
header_params[:'X-Smplkit-Environment'] = opts[:'x_smplkit_environment'] if !opts[:'x_smplkit_environment'].nil?
|
|
403
412
|
|
|
404
413
|
# form parameters
|
|
405
414
|
form_params = opts[:form_params] || {}
|
|
@@ -146,10 +146,11 @@ module SmplkitGeneratedClient::Jobs
|
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
# List Runs
|
|
149
|
-
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
149
|
+
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
150
150
|
# @param [Hash] opts the optional parameters
|
|
151
151
|
# @option opts [String] :filter_job
|
|
152
152
|
# @option opts [String] :filter_status Restrict to runs in the given lifecycle state. One of `PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELED`, or a comma-separated list of them to match any (e.g. `SUCCEEDED,FAILED`).
|
|
153
|
+
# @option opts [String] :filter_environment Comma-separated list of environment keys to scope results to (e.g. `production,staging`). When omitted, results cover every environment you can access.
|
|
153
154
|
# @option opts [String] :filter_created_at Restrict to runs whose `created_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
154
155
|
# @option opts [String] :filter_started_at Restrict to runs whose `started_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
155
156
|
# @option opts [String] :filter_finished_at Restrict to runs whose `finished_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
@@ -164,10 +165,11 @@ module SmplkitGeneratedClient::Jobs
|
|
|
164
165
|
end
|
|
165
166
|
|
|
166
167
|
# List Runs
|
|
167
|
-
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
168
|
+
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
168
169
|
# @param [Hash] opts the optional parameters
|
|
169
170
|
# @option opts [String] :filter_job
|
|
170
171
|
# @option opts [String] :filter_status Restrict to runs in the given lifecycle state. One of `PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELED`, or a comma-separated list of them to match any (e.g. `SUCCEEDED,FAILED`).
|
|
172
|
+
# @option opts [String] :filter_environment Comma-separated list of environment keys to scope results to (e.g. `production,staging`). When omitted, results cover every environment you can access.
|
|
171
173
|
# @option opts [String] :filter_created_at Restrict to runs whose `created_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
172
174
|
# @option opts [String] :filter_started_at Restrict to runs whose `started_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
173
175
|
# @option opts [String] :filter_finished_at Restrict to runs whose `finished_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
@@ -195,6 +197,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
195
197
|
query_params = opts[:query_params] || {}
|
|
196
198
|
query_params[:'filter[job]'] = opts[:'filter_job'] if !opts[:'filter_job'].nil?
|
|
197
199
|
query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].nil?
|
|
200
|
+
query_params[:'filter[environment]'] = opts[:'filter_environment'] if !opts[:'filter_environment'].nil?
|
|
198
201
|
query_params[:'filter[created_at]'] = opts[:'filter_created_at'] if !opts[:'filter_created_at'].nil?
|
|
199
202
|
query_params[:'filter[started_at]'] = opts[:'filter_started_at'] if !opts[:'filter_started_at'].nil?
|
|
200
203
|
query_params[:'filter[finished_at]'] = opts[:'filter_finished_at'] if !opts[:'filter_finished_at'].nil?
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module SmplkitGeneratedClient::Jobs
|
|
17
|
-
# A scheduled unit of work: an HTTP request run on a schedule. The job is the definition; each time it fires the service records a run capturing the request, response, timing, and outcome.
|
|
17
|
+
# A scheduled unit of work: an HTTP request run on a schedule. The job is the definition; each time it fires the service records a run capturing the request, response, timing, and outcome. A job is enabled per environment: set `environments[<env>].enabled` to schedule runs there. A recurring (cron) job may be enabled in several environments at once and fires once per enabled environment; a one-off (`now` or future datetime) job runs a single time in the environment it was created in.
|
|
18
18
|
class Job < ApiModelBase
|
|
19
19
|
# Human-readable name for the job.
|
|
20
20
|
attr_accessor :name
|
|
@@ -22,7 +22,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
22
22
|
# Free-text description for the job.
|
|
23
23
|
attr_accessor :description
|
|
24
24
|
|
|
25
|
-
# Whether the job is
|
|
25
|
+
# Whether the job is enabled in at least one environment. Read-only roll-up of `environments[*].enabled`; set enablement per environment via `environments`.
|
|
26
26
|
attr_accessor :enabled
|
|
27
27
|
|
|
28
28
|
# Job type. Only `http` is supported today.
|
|
@@ -34,6 +34,9 @@ module SmplkitGeneratedClient::Jobs
|
|
|
34
34
|
# The HTTP request to perform, including method, url, headers, body, and timeout.
|
|
35
35
|
attr_accessor :configuration
|
|
36
36
|
|
|
37
|
+
# Per-environment overrides keyed by environment key (e.g. `production`, `staging`). Each entry sets `enabled` (whether the job schedules runs in that environment) and an optional `configuration` override (omit to inherit the base `configuration`). A job with no entry for an environment is disabled there. For a recurring job, supply this map to choose where it runs. For a one-off job, the environment it is created in is recorded here automatically — name it with the `X-Smplkit-Environment` header. Every referenced environment must exist for the account.
|
|
38
|
+
attr_accessor :environments
|
|
39
|
+
|
|
37
40
|
# How overlapping runs are handled. `ALLOW` (the only value today) permits them.
|
|
38
41
|
attr_accessor :concurrency_policy
|
|
39
42
|
|
|
@@ -86,6 +89,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
86
89
|
:'type' => :'type',
|
|
87
90
|
:'schedule' => :'schedule',
|
|
88
91
|
:'configuration' => :'configuration',
|
|
92
|
+
:'environments' => :'environments',
|
|
89
93
|
:'concurrency_policy' => :'concurrency_policy',
|
|
90
94
|
:'next_run_at' => :'next_run_at',
|
|
91
95
|
:'recurring' => :'recurring',
|
|
@@ -115,6 +119,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
115
119
|
:'type' => :'String',
|
|
116
120
|
:'schedule' => :'String',
|
|
117
121
|
:'configuration' => :'JobHttpConfiguration',
|
|
122
|
+
:'environments' => :'Hash<String, JobEnvironment>',
|
|
118
123
|
:'concurrency_policy' => :'String',
|
|
119
124
|
:'next_run_at' => :'Time',
|
|
120
125
|
:'recurring' => :'Boolean',
|
|
@@ -129,6 +134,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
129
134
|
def self.openapi_nullable
|
|
130
135
|
Set.new([
|
|
131
136
|
:'description',
|
|
137
|
+
:'enabled',
|
|
132
138
|
:'next_run_at',
|
|
133
139
|
:'recurring',
|
|
134
140
|
:'created_at',
|
|
@@ -166,8 +172,6 @@ module SmplkitGeneratedClient::Jobs
|
|
|
166
172
|
|
|
167
173
|
if attributes.key?(:'enabled')
|
|
168
174
|
self.enabled = attributes[:'enabled']
|
|
169
|
-
else
|
|
170
|
-
self.enabled = true
|
|
171
175
|
end
|
|
172
176
|
|
|
173
177
|
if attributes.key?(:'type')
|
|
@@ -188,6 +192,12 @@ module SmplkitGeneratedClient::Jobs
|
|
|
188
192
|
self.configuration = nil
|
|
189
193
|
end
|
|
190
194
|
|
|
195
|
+
if attributes.key?(:'environments')
|
|
196
|
+
if (value = attributes[:'environments']).is_a?(Hash)
|
|
197
|
+
self.environments = value
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
191
201
|
if attributes.key?(:'concurrency_policy')
|
|
192
202
|
self.concurrency_policy = attributes[:'concurrency_policy']
|
|
193
203
|
else
|
|
@@ -347,6 +357,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
347
357
|
type == o.type &&
|
|
348
358
|
schedule == o.schedule &&
|
|
349
359
|
configuration == o.configuration &&
|
|
360
|
+
environments == o.environments &&
|
|
350
361
|
concurrency_policy == o.concurrency_policy &&
|
|
351
362
|
next_run_at == o.next_run_at &&
|
|
352
363
|
recurring == o.recurring &&
|
|
@@ -365,7 +376,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
365
376
|
# Calculates hash code according to all attributes.
|
|
366
377
|
# @return [Integer] Hash code
|
|
367
378
|
def hash
|
|
368
|
-
[name, description, enabled, type, schedule, configuration, concurrency_policy, next_run_at, recurring, created_at, updated_at, deleted_at, version].hash
|
|
379
|
+
[name, description, enabled, type, schedule, configuration, environments, concurrency_policy, next_run_at, recurring, created_at, updated_at, deleted_at, version].hash
|
|
369
380
|
end
|
|
370
381
|
|
|
371
382
|
# Builds the object from hash
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#smplkit Jobs API
|
|
3
|
+
|
|
4
|
+
#Scheduled HTTP job execution API for smplkit.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module SmplkitGeneratedClient::Jobs
|
|
17
|
+
# Per-environment override for a job's enablement and configuration.
|
|
18
|
+
class JobEnvironment < ApiModelBase
|
|
19
|
+
# Whether the job schedules runs in this environment. A job runs in an environment only via this field; it is disabled in every environment by default.
|
|
20
|
+
attr_accessor :enabled
|
|
21
|
+
|
|
22
|
+
# Per-environment HTTP request override. Omit to inherit the job's base `configuration`. When present, it fully replaces the base configuration for runs in this environment.
|
|
23
|
+
attr_accessor :configuration
|
|
24
|
+
|
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
26
|
+
def self.attribute_map
|
|
27
|
+
{
|
|
28
|
+
:'enabled' => :'enabled',
|
|
29
|
+
:'configuration' => :'configuration'
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns attribute mapping this model knows about
|
|
34
|
+
def self.acceptable_attribute_map
|
|
35
|
+
attribute_map
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns all the JSON keys this model knows about
|
|
39
|
+
def self.acceptable_attributes
|
|
40
|
+
acceptable_attribute_map.values
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute type mapping.
|
|
44
|
+
def self.openapi_types
|
|
45
|
+
{
|
|
46
|
+
:'enabled' => :'Boolean',
|
|
47
|
+
:'configuration' => :'JobHttpConfiguration'
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# List of attributes with nullable: true
|
|
52
|
+
def self.openapi_nullable
|
|
53
|
+
Set.new([
|
|
54
|
+
:'configuration'
|
|
55
|
+
])
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Initializes the object
|
|
59
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
60
|
+
def initialize(attributes = {})
|
|
61
|
+
if (!attributes.is_a?(Hash))
|
|
62
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::JobEnvironment` initialize method"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
66
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
68
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::JobEnvironment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
70
|
+
end
|
|
71
|
+
h[k.to_sym] = v
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if attributes.key?(:'enabled')
|
|
75
|
+
self.enabled = attributes[:'enabled']
|
|
76
|
+
else
|
|
77
|
+
self.enabled = false
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'configuration')
|
|
81
|
+
self.configuration = attributes[:'configuration']
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
86
|
+
# @return Array for valid properties with the reasons
|
|
87
|
+
def list_invalid_properties
|
|
88
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
89
|
+
invalid_properties = Array.new
|
|
90
|
+
invalid_properties
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Check to see if the all the properties in the model are valid
|
|
94
|
+
# @return true if the model is valid
|
|
95
|
+
def valid?
|
|
96
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
97
|
+
true
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Checks equality by comparing each attribute.
|
|
101
|
+
# @param [Object] Object to be compared
|
|
102
|
+
def ==(o)
|
|
103
|
+
return true if self.equal?(o)
|
|
104
|
+
self.class == o.class &&
|
|
105
|
+
enabled == o.enabled &&
|
|
106
|
+
configuration == o.configuration
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# @see the `==` method
|
|
110
|
+
# @param [Object] Object to be compared
|
|
111
|
+
def eql?(o)
|
|
112
|
+
self == o
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Calculates hash code according to all attributes.
|
|
116
|
+
# @return [Integer] Hash code
|
|
117
|
+
def hash
|
|
118
|
+
[enabled, configuration].hash
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Builds the object from hash
|
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
123
|
+
# @return [Object] Returns the model itself
|
|
124
|
+
def self.build_from_hash(attributes)
|
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
|
126
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
127
|
+
transformed_hash = {}
|
|
128
|
+
openapi_types.each_pair do |key, type|
|
|
129
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
130
|
+
transformed_hash["#{key}"] = nil
|
|
131
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
132
|
+
# check to ensure the input is an array given that the attribute
|
|
133
|
+
# is documented as an array but the input is not
|
|
134
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
135
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
136
|
+
end
|
|
137
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
138
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
new(transformed_hash)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Returns the object in the form of hash
|
|
145
|
+
# @return [Hash] Returns the object in the form of hash
|
|
146
|
+
def to_hash
|
|
147
|
+
hash = {}
|
|
148
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
149
|
+
value = self.send(attr)
|
|
150
|
+
if value.nil?
|
|
151
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
152
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
hash[param] = _to_hash(value)
|
|
156
|
+
end
|
|
157
|
+
hash
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
end
|
|
@@ -22,6 +22,9 @@ module SmplkitGeneratedClient::Jobs
|
|
|
22
22
|
# The job's version at the time the run executed.
|
|
23
23
|
attr_accessor :job_version
|
|
24
24
|
|
|
25
|
+
# The environment this run executed in. A scheduled run inherits the firing job-environment; a manual run is created in the environment you name with the `X-Smplkit-Environment` header; a rerun copies its source run's environment.
|
|
26
|
+
attr_accessor :environment
|
|
27
|
+
|
|
25
28
|
# Why the run exists: `SCHEDULE`, `MANUAL` (Run now), or `RERUN`.
|
|
26
29
|
attr_accessor :trigger
|
|
27
30
|
|
|
@@ -91,6 +94,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
91
94
|
{
|
|
92
95
|
:'job' => :'job',
|
|
93
96
|
:'job_version' => :'job_version',
|
|
97
|
+
:'environment' => :'environment',
|
|
94
98
|
:'trigger' => :'trigger',
|
|
95
99
|
:'rerun_of' => :'rerun_of',
|
|
96
100
|
:'scheduled_for' => :'scheduled_for',
|
|
@@ -123,6 +127,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
123
127
|
{
|
|
124
128
|
:'job' => :'String',
|
|
125
129
|
:'job_version' => :'Integer',
|
|
130
|
+
:'environment' => :'String',
|
|
126
131
|
:'trigger' => :'String',
|
|
127
132
|
:'rerun_of' => :'String',
|
|
128
133
|
:'scheduled_for' => :'Time',
|
|
@@ -185,6 +190,12 @@ module SmplkitGeneratedClient::Jobs
|
|
|
185
190
|
self.job_version = attributes[:'job_version']
|
|
186
191
|
end
|
|
187
192
|
|
|
193
|
+
if attributes.key?(:'environment')
|
|
194
|
+
self.environment = attributes[:'environment']
|
|
195
|
+
else
|
|
196
|
+
self.environment = nil
|
|
197
|
+
end
|
|
198
|
+
|
|
188
199
|
if attributes.key?(:'trigger')
|
|
189
200
|
self.trigger = attributes[:'trigger']
|
|
190
201
|
else
|
|
@@ -259,6 +270,10 @@ module SmplkitGeneratedClient::Jobs
|
|
|
259
270
|
invalid_properties.push('invalid value for "job", job cannot be nil.')
|
|
260
271
|
end
|
|
261
272
|
|
|
273
|
+
if @environment.nil?
|
|
274
|
+
invalid_properties.push('invalid value for "environment", environment cannot be nil.')
|
|
275
|
+
end
|
|
276
|
+
|
|
262
277
|
if @trigger.nil?
|
|
263
278
|
invalid_properties.push('invalid value for "trigger", trigger cannot be nil.')
|
|
264
279
|
end
|
|
@@ -275,6 +290,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
275
290
|
def valid?
|
|
276
291
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
277
292
|
return false if @job.nil?
|
|
293
|
+
return false if @environment.nil?
|
|
278
294
|
return false if @trigger.nil?
|
|
279
295
|
trigger_validator = EnumAttributeValidator.new('String', ["SCHEDULE", "MANUAL", "RERUN"])
|
|
280
296
|
return false unless trigger_validator.valid?(@trigger)
|
|
@@ -296,6 +312,16 @@ module SmplkitGeneratedClient::Jobs
|
|
|
296
312
|
@job = job
|
|
297
313
|
end
|
|
298
314
|
|
|
315
|
+
# Custom attribute writer method with validation
|
|
316
|
+
# @param [Object] environment Value to be assigned
|
|
317
|
+
def environment=(environment)
|
|
318
|
+
if environment.nil?
|
|
319
|
+
fail ArgumentError, 'environment cannot be nil'
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
@environment = environment
|
|
323
|
+
end
|
|
324
|
+
|
|
299
325
|
# Custom attribute writer method checking allowed values (enum).
|
|
300
326
|
# @param [Object] trigger Object to be assigned
|
|
301
327
|
def trigger=(trigger)
|
|
@@ -333,6 +359,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
333
359
|
self.class == o.class &&
|
|
334
360
|
job == o.job &&
|
|
335
361
|
job_version == o.job_version &&
|
|
362
|
+
environment == o.environment &&
|
|
336
363
|
trigger == o.trigger &&
|
|
337
364
|
rerun_of == o.rerun_of &&
|
|
338
365
|
scheduled_for == o.scheduled_for &&
|
|
@@ -358,7 +385,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
358
385
|
# Calculates hash code according to all attributes.
|
|
359
386
|
# @return [Integer] Hash code
|
|
360
387
|
def hash
|
|
361
|
-
[job, job_version, trigger, rerun_of, scheduled_for, status, started_at, finished_at, pending_duration_ms, run_duration_ms, total_duration_ms, failure_reason, error, request, result, created_at].hash
|
|
388
|
+
[job, job_version, environment, trigger, rerun_of, scheduled_for, status, started_at, finished_at, pending_duration_ms, run_duration_ms, total_duration_ms, failure_reason, error, request, result, created_at].hash
|
|
362
389
|
end
|
|
363
390
|
|
|
364
391
|
# Builds the object from hash
|
|
@@ -22,6 +22,7 @@ require 'smplkit_jobs_client/models/http_header'
|
|
|
22
22
|
require 'smplkit_jobs_client/models/job'
|
|
23
23
|
require 'smplkit_jobs_client/models/job_create_request'
|
|
24
24
|
require 'smplkit_jobs_client/models/job_create_resource'
|
|
25
|
+
require 'smplkit_jobs_client/models/job_environment'
|
|
25
26
|
require 'smplkit_jobs_client/models/job_http_configuration'
|
|
26
27
|
require 'smplkit_jobs_client/models/job_list_response'
|
|
27
28
|
require 'smplkit_jobs_client/models/job_request'
|
|
@@ -34,9 +34,10 @@ describe 'JobsApi' do
|
|
|
34
34
|
|
|
35
35
|
# unit tests for create_job
|
|
36
36
|
# Create Job
|
|
37
|
-
# Create a job for this account. The caller supplies the job's id as `data.id`. Ids are unique within an account and immutable.
|
|
37
|
+
# Create a job for this account. The caller supplies the job's id as `data.id`. Ids are unique within an account and immutable. A recurring job supplies `environments` to choose where it runs and begins scheduling immediately in each enabled environment. A one-off job is created in the environment named by the `X-Smplkit-Environment` header (implied when the credential is scoped to a single environment).
|
|
38
38
|
# @param job_create_request
|
|
39
39
|
# @param [Hash] opts the optional parameters
|
|
40
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
40
41
|
# @return [JobResponse]
|
|
41
42
|
describe 'create_job test' do
|
|
42
43
|
it 'should work' do
|
|
@@ -70,7 +71,7 @@ describe 'JobsApi' do
|
|
|
70
71
|
|
|
71
72
|
# unit tests for list_jobs
|
|
72
73
|
# List Jobs
|
|
73
|
-
# List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, `updated_at`, `next_run_at`, or `enabled`, ascending or descending (prefix `-` for descending). Filter with `filter[enabled]`
|
|
74
|
+
# List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, `updated_at`, `next_run_at`, or `enabled`, ascending or descending (prefix `-` for descending). Filter with `filter[enabled]` (enabled in at least one environment), `filter[recurring]`, and `filter[name]` (case-insensitive substring match on the name); filters compose with AND. A scoped caller sees each job's `environments` map narrowed to the environments it may access.
|
|
74
75
|
# @param [Hash] opts the optional parameters
|
|
75
76
|
# @option opts [Boolean] :filter_enabled
|
|
76
77
|
# @option opts [Boolean] :filter_recurring
|
|
@@ -88,9 +89,10 @@ describe 'JobsApi' do
|
|
|
88
89
|
|
|
89
90
|
# unit tests for run_job_now
|
|
90
91
|
# Run Job Now
|
|
91
|
-
# Trigger one immediate run of the job (a `MANUAL` run). The job's schedule and enabled state are untouched. The run is enqueued and executed by the worker; if the account is over its run allotment the run will fail with reason `QUOTA_EXCEEDED` rather than being rejected here.
|
|
92
|
+
# Trigger one immediate run of the job (a `MANUAL` run). The job's schedule and enabled state are untouched. The run executes in the environment named by the `X-Smplkit-Environment` header; when the job is enabled in exactly one environment that environment is used, and a single-environment credential implies it. The run executes the job's effective configuration for that environment. It is enqueued and executed by the worker; if the account is over its run allotment the run will fail with reason `QUOTA_EXCEEDED` rather than being rejected here.
|
|
92
93
|
# @param job_id
|
|
93
94
|
# @param [Hash] opts the optional parameters
|
|
95
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
94
96
|
# @return [RunResponse]
|
|
95
97
|
describe 'run_job_now test' do
|
|
96
98
|
it 'should work' do
|
|
@@ -100,10 +102,11 @@ describe 'JobsApi' do
|
|
|
100
102
|
|
|
101
103
|
# unit tests for update_job
|
|
102
104
|
# Update Job
|
|
103
|
-
# Replace an existing job. Every writable field is overwritten.
|
|
105
|
+
# Replace an existing job. Every writable field is overwritten. Set enablement per environment via the `environments` map (a recurring job), or by recreating a one-off job in the desired environment. Editing the schedule recomputes the next fire time; changing only which environments are enabled preserves the existing cadence.
|
|
104
106
|
# @param job_id
|
|
105
107
|
# @param job_request
|
|
106
108
|
# @param [Hash] opts the optional parameters
|
|
109
|
+
# @option opts [String] :x_smplkit_environment The environment to operate in. Names the single environment a one-off job is born in (or a manual run executes in). Optional when the credential is scoped to a single environment (which is then implied); required when the credential can reach several environments and the choice is otherwise ambiguous. Ignored for a recurring job, whose environments come from its `environments` map.
|
|
107
110
|
# @return [JobResponse]
|
|
108
111
|
describe 'update_job test' do
|
|
109
112
|
it 'should work' do
|
|
@@ -58,10 +58,11 @@ describe 'RunsApi' do
|
|
|
58
58
|
|
|
59
59
|
# unit tests for list_runs
|
|
60
60
|
# List Runs
|
|
61
|
-
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
61
|
+
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
62
62
|
# @param [Hash] opts the optional parameters
|
|
63
63
|
# @option opts [String] :filter_job
|
|
64
64
|
# @option opts [String] :filter_status Restrict to runs in the given lifecycle state. One of `PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELED`, or a comma-separated list of them to match any (e.g. `SUCCEEDED,FAILED`).
|
|
65
|
+
# @option opts [String] :filter_environment Comma-separated list of environment keys to scope results to (e.g. `production,staging`). When omitted, results cover every environment you can access.
|
|
65
66
|
# @option opts [String] :filter_created_at Restrict to runs whose `created_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
66
67
|
# @option opts [String] :filter_started_at Restrict to runs whose `started_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
67
68
|
# @option opts [String] :filter_finished_at Restrict to runs whose `finished_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|