Class: SmplkitGeneratedClient::Jobs::RunsApi
- Inherits:
-
Object
- Object
- SmplkitGeneratedClient::Jobs::RunsApi
- Defined in:
- lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#cancel_run(run_id, opts = {}) ⇒ RunResponse
Cancel Run Cancel a pending or running run.
-
#cancel_run_with_http_info(run_id, opts = {}) ⇒ Array<(RunResponse, Integer, Hash)>
Cancel Run Cancel a pending or running run.
-
#get_run(run_id, opts = {}) ⇒ RunResponse
Get Run Retrieve a single run by its id.
-
#get_run_stats(opts = {}) ⇒ RunStatsResponse
Get Run Stats Report aggregated statistics over this account's runs.
-
#get_run_stats_with_http_info(opts = {}) ⇒ Array<(RunStatsResponse, Integer, Hash)>
Get Run Stats Report aggregated statistics over this account's runs.
-
#get_run_with_http_info(run_id, opts = {}) ⇒ Array<(RunResponse, Integer, Hash)>
Get Run Retrieve a single run by its id.
-
#initialize(api_client = ApiClient.default) ⇒ RunsApi
constructor
A new instance of RunsApi.
-
#list_runs(opts = {}) ⇒ RunListResponse
List Runs List runs for this account (cursor paginated).
-
#list_runs_with_http_info(opts = {}) ⇒ Array<(RunListResponse, Integer, Hash)>
List Runs List runs for this account (cursor paginated).
-
#rerun_run(run_id, opts = {}) ⇒ RunResponse
Rerun Run Spawn a new run from a prior run, using the job's current configuration.
-
#rerun_run_with_http_info(run_id, opts = {}) ⇒ Array<(RunResponse, Integer, Hash)>
Rerun Run Spawn a new run from a prior run, using the job's current configuration.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#cancel_run(run_id, opts = {}) ⇒ RunResponse
Cancel Run
Cancel a pending or running run. Returns 404 if the run does not exist and 409 if it is already in a terminal state. Canceling a running run stops us tracking it, but the HTTP request may already be in flight — cancel means "stop tracking," not "guaranteed it didn't happen." A run that has already started running still counts toward your monthly run allowance even if you cancel it; a run canceled while it is still pending does not count.
27 28 29 30 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 27 def cancel_run(run_id, opts = {}) data, _status_code, _headers = cancel_run_with_http_info(run_id, opts) data end |
#cancel_run_with_http_info(run_id, opts = {}) ⇒ Array<(RunResponse, Integer, Hash)>
Cancel Run Cancel a pending or running run. Returns `404` if the run does not exist and `409` if it is already in a terminal state. Canceling a running run stops us tracking it, but the HTTP request may already be in flight — cancel means "stop tracking," not "guaranteed it didn't happen." A run that has already started running still counts toward your monthly run allowance even if you cancel it; a run canceled while it is still pending does not count.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 37 def cancel_run_with_http_info(run_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RunsApi.cancel_run ...' end # verify the required parameter 'run_id' is set if @api_client.config.client_side_validation && run_id.nil? fail ArgumentError, "Missing the required parameter 'run_id' when calling RunsApi.cancel_run" end # resource path local_var_path = '/api/v1/runs/{run_id}/actions/cancel'.sub('{run_id}', CGI.escape(run_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RunResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"RunsApi.cancel_run", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: RunsApi#cancel_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_run(run_id, opts = {}) ⇒ RunResponse
Get Run Retrieve a single run by its id.
90 91 92 93 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 90 def get_run(run_id, opts = {}) data, _status_code, _headers = get_run_with_http_info(run_id, opts) data end |
#get_run_stats(opts = {}) ⇒ RunStatsResponse
Get Run Stats
Report aggregated statistics over this account's runs. One request answers the common monitoring questions: how many runs matched the filters (total), how they broke down by lifecycle state (tally), how they were distributed over time (buckets, when the bucket directive is given), which runs failed most recently (recent_failures, at most 3, newest first), and what fires next (next_scheduled). Filters compose with AND: - filter[created_at] — a half-open [start,end) date range (see the parameter for the interval syntax). - filter[environment] — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. next_scheduled honors only the environment filter: it reports the soonest PENDING run with a fire time at or after the request, no matter when that run was created. The resource id is always current — statistics are computed at read time, not stored.
155 156 157 158 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 155 def get_run_stats(opts = {}) data, _status_code, _headers = get_run_stats_with_http_info(opts) data end |
#get_run_stats_with_http_info(opts = {}) ⇒ Array<(RunStatsResponse, Integer, Hash)>
Get Run Stats Report aggregated statistics over this account's runs. One request answers the common monitoring questions: how many runs matched the filters (`total`), how they broke down by lifecycle state (`tally`), how they were distributed over time (`buckets`, when the `bucket` directive is given), which runs failed most recently (`recent_failures`, at most 3, newest first), and what fires next (`next_scheduled`). Filters compose with AND: - `filter` — a half-open `[start,end)` date range (see the parameter for the interval syntax). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. `next_scheduled` honors only the environment filter: it reports the soonest `PENDING` run with a fire time at or after the request, no matter when that run was created. The resource id is always `current` — statistics are computed at read time, not stored.
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 167 def get_run_stats_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RunsApi.get_run_stats ...' end allowable_values = ["1m", "5m", "15m", "1h", "6h", "1d"] if @api_client.config.client_side_validation && opts[:'bucket'] && !allowable_values.include?(opts[:'bucket']) fail ArgumentError, "invalid value for \"bucket\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/v1/run_stats' # query parameters query_params = opts[:query_params] || {} query_params[:'filter[created_at]'] = opts[:'filter_created_at'] if !opts[:'filter_created_at'].nil? query_params[:'filter[environment]'] = opts[:'filter_environment'] if !opts[:'filter_environment'].nil? query_params[:'bucket'] = opts[:'bucket'] if !opts[:'bucket'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RunStatsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"RunsApi.get_run_stats", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: RunsApi#get_run_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_run_with_http_info(run_id, opts = {}) ⇒ Array<(RunResponse, Integer, Hash)>
Get Run Retrieve a single run by its id.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 100 def get_run_with_http_info(run_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RunsApi.get_run ...' end # verify the required parameter 'run_id' is set if @api_client.config.client_side_validation && run_id.nil? fail ArgumentError, "Missing the required parameter 'run_id' when calling RunsApi.get_run" end # resource path local_var_path = '/api/v1/runs/{run_id}'.sub('{run_id}', CGI.escape(run_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RunResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"RunsApi.get_run", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: RunsApi#get_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_runs(opts = {}) ⇒ RunListResponse
List Runs
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[trigger] — one trigger (SCHEDULE, MANUAL, RERUN, RETRY) or a comma-separated list of them (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). Set last_run_only=true to collapse the result to the last completed run for each job-and-environment combination. "Completed" means a terminal state — succeeded, failed, or canceled; in-flight runs (pending or running) are not included, so a job that is mid-run still surfaces its previous completed result and a combination with no completed run yet returns nothing. The filters above still apply, evaluated before the collapse, so each row is the most recent completed run in its group that also satisfies them.
234 235 236 237 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 234 def list_runs(opts = {}) data, _status_code, _headers = list_runs_with_http_info(opts) data end |
#list_runs_with_http_info(opts = {}) ⇒ Array<(RunListResponse, Integer, Hash)>
List Runs 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=id` — a single job's run history. - `filter` — one state or a comma-separated list (any-of). - `filter` — one trigger (`SCHEDULE`, `MANUAL`, `RERUN`, `RETRY`) or a comma-separated list of them (any-of). - `filter` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter` / `filter` / `filter` / `filter` — half-open `[start,end)` date ranges (see each parameter for the interval syntax). Set `last_run_only=true` to collapse the result to the last completed run for each job-and-environment combination. "Completed" means a terminal state — succeeded, failed, or canceled; in-flight runs (pending or running) are not included, so a job that is mid-run still surfaces its previous completed result and a combination with no completed run yet returns nothing. The filters above still apply, evaluated before the collapse, so each row is the most recent completed run in its group that also satisfies them.
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 255 def list_runs_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RunsApi.list_runs ...' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling RunsApi.list_runs, must be greater than or equal to 1.' end allowable_values = ["created_at", "-created_at", "finished_at", "-finished_at", "job", "-job", "scheduled_for", "-scheduled_for", "started_at", "-started_at", "status", "-status", "total_duration_ms", "-total_duration_ms"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/v1/runs' # query parameters query_params = opts[:query_params] || {} query_params[:'filter[job]'] = opts[:'filter_job'] if !opts[:'filter_job'].nil? query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].nil? query_params[:'filter[environment]'] = opts[:'filter_environment'] if !opts[:'filter_environment'].nil? query_params[:'filter[trigger]'] = opts[:'filter_trigger'] if !opts[:'filter_trigger'].nil? query_params[:'filter[created_at]'] = opts[:'filter_created_at'] if !opts[:'filter_created_at'].nil? query_params[:'filter[started_at]'] = opts[:'filter_started_at'] if !opts[:'filter_started_at'].nil? query_params[:'filter[finished_at]'] = opts[:'filter_finished_at'] if !opts[:'filter_finished_at'].nil? query_params[:'filter[scheduled_for]'] = opts[:'filter_scheduled_for'] if !opts[:'filter_scheduled_for'].nil? query_params[:'last_run_only'] = opts[:'last_run_only'] if !opts[:'last_run_only'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'page[after]'] = opts[:'page_after'] if !opts[:'page_after'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RunListResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"RunsApi.list_runs", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: RunsApi#list_runs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#rerun_run(run_id, opts = {}) ⇒ RunResponse
Rerun Run
Spawn a new run from a prior run, using the job's current configuration. Returns 404 if the run does not exist and 409 if the run's parent job has been deleted.
324 325 326 327 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 324 def rerun_run(run_id, opts = {}) data, _status_code, _headers = rerun_run_with_http_info(run_id, opts) data end |
#rerun_run_with_http_info(run_id, opts = {}) ⇒ Array<(RunResponse, Integer, Hash)>
Rerun Run Spawn a new run from a prior run, using the job's current configuration. Returns `404` if the run does not exist and `409` if the run's parent job has been deleted.
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb', line 334 def rerun_run_with_http_info(run_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RunsApi.rerun_run ...' end # verify the required parameter 'run_id' is set if @api_client.config.client_side_validation && run_id.nil? fail ArgumentError, "Missing the required parameter 'run_id' when calling RunsApi.rerun_run" end # resource path local_var_path = '/api/v1/runs/{run_id}/actions/rerun'.sub('{run_id}', CGI.escape(run_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RunResponse' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] = opts.merge( :operation => :"RunsApi.rerun_run", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: RunsApi#rerun_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |