smplkit 3.0.126 → 3.0.127

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdea2d8c6bc1209eb15b7cee203d4198828d11649e44736b3f03e56b6e8f6cdc
4
- data.tar.gz: 0d16250d5093312a3ed248ec166d7c0d3dd2a48bc75c0fc5af485e4ab80fe717
3
+ metadata.gz: 1d036e83c8a42e16dc643edf8910fea3861ce5073f86743d785cedb5578c8eb9
4
+ data.tar.gz: 0441f1da63de7e782c9364310cd8f54d8dfda38209c7dfea6b4a49ccf1550e3e
5
5
  SHA512:
6
- metadata.gz: 574c2b071db99724ec992a120c18de9384cca97b6b9148f1403ac210b1b77d04b954b4d0b76c9f9dd19dc19c8be0e6bd3ccd623bbdf25a99e6b58543310fa140
7
- data.tar.gz: 7ca2b72b43196e42dd3d7b5c1869e45d38be55abd9c988d8c90dc640ef9f5c32a73319126b7684a5154a63b33526d5470c1d46ec4aa9ffcbf7d981b26c4a96b3
6
+ metadata.gz: e3825d3f8bac19ce16c6a89419d71954902be40d5376b1de98311a371b36e35279462439e47548c1b3e66f966afa5b7b079297d44a0ce193f9a0442599c3a606
7
+ data.tar.gz: 385012586c7f071762d366ac6bc5dbff007ec04d36312861753c5834ffa45f1245bb1d2a9290e5ef59a14bcd4b34602c17d9fecea368102f1200bad4c9ba4078
@@ -20,10 +20,9 @@ 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. The job's kind follows from its `schedule`: omit the schedule for a permanent **manual** job (triggered on demand), give a cron expression for a **recurring** job, or a datetime / `now` for a **one-off** job. A recurring or manual job supplies `environments` to choose where it runs; a recurring job 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); a `now` one-off enqueues its single run immediately.
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. The job's kind follows from its `schedule`: omit the schedule for a permanent **manual** job (triggered on demand), give a cron expression for a **recurring** job, or a datetime / `now` for a **one-off** job. Supply `environments` to choose where the job runs: a recurring job begins scheduling immediately in each enabled environment, while a one-off job names its target environment(s) by the keys of that map and enqueues one run per environment (a single-environment credential implies the one environment when the map is empty). A `now` one-off enqueues its run(s) immediately.
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.
27
26
  # @return [JobResponse]
28
27
  def create_job(job_create_request, opts = {})
29
28
  data, _status_code, _headers = create_job_with_http_info(job_create_request, opts)
@@ -31,10 +30,9 @@ module SmplkitGeneratedClient::Jobs
31
30
  end
32
31
 
33
32
  # Create Job
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. The job's kind follows from its `schedule`: omit the schedule for a permanent **manual** job (triggered on demand), give a cron expression for a **recurring** job, or a datetime / `now` for a **one-off** job. A recurring or manual job supplies `environments` to choose where it runs; a recurring job 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); a `now` one-off enqueues its single run immediately.
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. The job's kind follows from its `schedule`: omit the schedule for a permanent **manual** job (triggered on demand), give a cron expression for a **recurring** job, or a datetime / `now` for a **one-off** job. Supply `environments` to choose where the job runs: a recurring job begins scheduling immediately in each enabled environment, while a one-off job names its target environment(s) by the keys of that map and enqueues one run per environment (a single-environment credential implies the one environment when the map is empty). A `now` one-off enqueues its run(s) immediately.
35
34
  # @param job_create_request [JobCreateRequest]
36
35
  # @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.
38
36
  # @return [Array<(JobResponse, Integer, Hash)>] JobResponse data, response status code and response headers
39
37
  def create_job_with_http_info(job_create_request, opts = {})
40
38
  if @api_client.config.debugging
@@ -59,7 +57,6 @@ module SmplkitGeneratedClient::Jobs
59
57
  if !content_type.nil?
60
58
  header_params['Content-Type'] = content_type
61
59
  end
62
- header_params[:'X-Smplkit-Environment'] = opts[:'x_smplkit_environment'] if !opts[:'x_smplkit_environment'].nil?
63
60
 
64
61
  # form parameters
65
62
  form_params = opts[:form_params] || {}
@@ -297,10 +294,10 @@ module SmplkitGeneratedClient::Jobs
297
294
  end
298
295
 
299
296
  # Run Job Now
300
- # Trigger one immediate run of the job in a specified environment (a `MANUAL` run). This is the primary execution path for a manual job and is also usable ad hoc for a recurring job (\"run now\"). 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 environment must be one the job is **enabled** in (409 otherwise). 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.
297
+ # Trigger one immediate run of the job in a specified environment (a `MANUAL` run). This is the primary execution path for a manual job and is also usable ad hoc for a recurring job (\"run now\"). The job's schedule and enabled state are untouched. The run executes in the environment named by the request body's `environment`; when the job is enabled in exactly one environment that environment is used, and a single-environment credential implies it. The environment must be one the job is **enabled** in (409 otherwise). 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.
301
298
  # @param job_id [String]
302
299
  # @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 &#x60;environments&#x60; map.
300
+ # @option opts [RunNowRequest] :run_now_request
304
301
  # @return [RunResponse]
305
302
  def run_job_now(job_id, opts = {})
306
303
  data, _status_code, _headers = run_job_now_with_http_info(job_id, opts)
@@ -308,10 +305,10 @@ module SmplkitGeneratedClient::Jobs
308
305
  end
309
306
 
310
307
  # Run Job Now
311
- # Trigger one immediate run of the job in a specified environment (a &#x60;MANUAL&#x60; run). This is the primary execution path for a manual job and is also usable ad hoc for a recurring job (\&quot;run now\&quot;). The job&#39;s schedule and enabled state are untouched. The run executes in the environment named by the &#x60;X-Smplkit-Environment&#x60; header; when the job is enabled in exactly one environment that environment is used, and a single-environment credential implies it. The environment must be one the job is **enabled** in (409 otherwise). The run executes the job&#39;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 &#x60;QUOTA_EXCEEDED&#x60; rather than being rejected here.
308
+ # Trigger one immediate run of the job in a specified environment (a &#x60;MANUAL&#x60; run). This is the primary execution path for a manual job and is also usable ad hoc for a recurring job (\&quot;run now\&quot;). The job&#39;s schedule and enabled state are untouched. The run executes in the environment named by the request body&#39;s &#x60;environment&#x60;; when the job is enabled in exactly one environment that environment is used, and a single-environment credential implies it. The environment must be one the job is **enabled** in (409 otherwise). The run executes the job&#39;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 &#x60;QUOTA_EXCEEDED&#x60; rather than being rejected here.
312
309
  # @param job_id [String]
313
310
  # @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 &#x60;environments&#x60; map.
311
+ # @option opts [RunNowRequest] :run_now_request
315
312
  # @return [Array<(RunResponse, Integer, Hash)>] RunResponse data, response status code and response headers
316
313
  def run_job_now_with_http_info(job_id, opts = {})
317
314
  if @api_client.config.debugging
@@ -331,13 +328,17 @@ module SmplkitGeneratedClient::Jobs
331
328
  header_params = opts[:header_params] || {}
332
329
  # HTTP header 'Accept' (if needed)
333
330
  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?
331
+ # HTTP header 'Content-Type'
332
+ content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
333
+ if !content_type.nil?
334
+ header_params['Content-Type'] = content_type
335
+ end
335
336
 
336
337
  # form parameters
337
338
  form_params = opts[:form_params] || {}
338
339
 
339
340
  # http body (model)
340
- post_body = opts[:debug_body]
341
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'run_now_request'])
341
342
 
342
343
  # return_type
343
344
  return_type = opts[:debug_return_type] || 'RunResponse'
@@ -363,11 +364,10 @@ module SmplkitGeneratedClient::Jobs
363
364
  end
364
365
 
365
366
  # Update Job
366
- # Replace an existing job. Every writable field is overwritten. The job's kind is re-derived from the new `schedule` (omit it for a manual job). Set enablement per environment via the `environments` map (a recurring or manual job), or by recreating a one-off job in the desired environment. Each environment may carry its own cron `schedule` override (recurring jobs only). Editing a recurring environment's effective schedule recomputes its next fire time; an edit that leaves it unchanged preserves the existing cadence.
367
+ # Replace an existing job. Every writable field is overwritten. The job's kind is re-derived from the new `schedule` (omit it for a manual job). Set enablement per environment via the `environments` map (a recurring or manual job), or by recreating a one-off job naming its target environment(s) in that map. Each environment may carry its own cron `schedule` override (recurring jobs only). Editing a recurring environment's effective schedule recomputes its next fire time; an edit that leaves it unchanged preserves the existing cadence.
367
368
  # @param job_id [String]
368
369
  # @param job_request [JobRequest]
369
370
  # @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 &#x60;environments&#x60; map.
371
371
  # @return [JobResponse]
372
372
  def update_job(job_id, job_request, opts = {})
373
373
  data, _status_code, _headers = update_job_with_http_info(job_id, job_request, opts)
@@ -375,11 +375,10 @@ module SmplkitGeneratedClient::Jobs
375
375
  end
376
376
 
377
377
  # Update Job
378
- # Replace an existing job. Every writable field is overwritten. The job&#39;s kind is re-derived from the new &#x60;schedule&#x60; (omit it for a manual job). Set enablement per environment via the &#x60;environments&#x60; map (a recurring or manual job), or by recreating a one-off job in the desired environment. Each environment may carry its own cron &#x60;schedule&#x60; override (recurring jobs only). Editing a recurring environment&#39;s effective schedule recomputes its next fire time; an edit that leaves it unchanged preserves the existing cadence.
378
+ # Replace an existing job. Every writable field is overwritten. The job&#39;s kind is re-derived from the new &#x60;schedule&#x60; (omit it for a manual job). Set enablement per environment via the &#x60;environments&#x60; map (a recurring or manual job), or by recreating a one-off job naming its target environment(s) in that map. Each environment may carry its own cron &#x60;schedule&#x60; override (recurring jobs only). Editing a recurring environment&#39;s effective schedule recomputes its next fire time; an edit that leaves it unchanged preserves the existing cadence.
379
379
  # @param job_id [String]
380
380
  # @param job_request [JobRequest]
381
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 &#x60;environments&#x60; map.
383
382
  # @return [Array<(JobResponse, Integer, Hash)>] JobResponse data, response status code and response headers
384
383
  def update_job_with_http_info(job_id, job_request, opts = {})
385
384
  if @api_client.config.debugging
@@ -408,7 +407,6 @@ module SmplkitGeneratedClient::Jobs
408
407
  if !content_type.nil?
409
408
  header_params['Content-Type'] = content_type
410
409
  end
411
- header_params[:'X-Smplkit-Environment'] = opts[:'x_smplkit_environment'] if !opts[:'x_smplkit_environment'].nil?
412
410
 
413
411
  # form parameters
414
412
  form_params = opts[:form_params] || {}
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Jobs
17
- # A unit of work: an HTTP request, run on a schedule or triggered on demand. The job is the definition; each time it fires the service records a run capturing the request, response, timing, and outcome. A job runs per environment: set `environments[<env>].enabled` to enable it there, and optionally give that environment its own `schedule` or `configuration`. A job's `kind` follows from its `schedule`: a **recurring** (cron) job may be enabled in several environments at once and fires once per enabled environment, each on its own next-fire schedule; a **manual** job (no schedule) is permanent and never auto-fires — it runs only when triggered; a **one-off** (`now` or a future datetime) job runs a single time in the environment it was created in and is then spent.
17
+ # A unit of work: an HTTP request, run on a schedule or triggered on demand. The job is the definition; each time it fires the service records a run capturing the request, response, timing, and outcome. A job runs per environment: set `environments[<env>].enabled` to enable it there, and optionally give that environment its own `schedule` or `configuration`. A job's `kind` follows from its `schedule`: a **recurring** (cron) job may be enabled in several environments at once and fires once per enabled environment, each on its own next-fire schedule; a **manual** job (no schedule) is permanent and never auto-fires — it runs only when triggered; a **one-off** (`now` or a future datetime) job runs a single time in each environment it was created in (one run per environment) and is then spent.
18
18
  class Job < ApiModelBase
19
19
  # Human-readable name for the job.
20
20
  attr_accessor :name
@@ -34,7 +34,7 @@ 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 is a flat, sparse overlay: only the leaves that differ from the base definition are present, and everything absent is inherited. Set `enabled` to `true` to run the job in that environment (the base is disabled everywhere; an environment with no entry, or an entry without `enabled: true`, does not run). Overridable leaves are `url`, `method`, `timeout`, `body`, `success_status`, `tls_verify`, `ca_cert`, `schedule` and `timezone` (recurring jobs only), `retry_policy` (the `id` of a retry policy), and an individual header as `headers.<name>` (e.g. `headers.Authorization`). On read, each entry also reports the read-only `next_run_at` for that environment (the next fire time, or `null`). For a recurring or manual 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.
37
+ # Per-environment overrides keyed by environment key (e.g. `production`, `staging`). Each entry is a flat, sparse overlay: only the leaves that differ from the base definition are present, and everything absent is inherited. Set `enabled` to `true` to run the job in that environment (the base is disabled everywhere; an environment with no entry, or an entry without `enabled: true`, does not run). Overridable leaves are `url`, `method`, `timeout`, `body`, `success_status`, `tls_verify`, `ca_cert`, `schedule` and `timezone` (recurring jobs only), `retry_policy` (the `id` of a retry policy), and an individual header as `headers.<name>` (e.g. `headers.Authorization`). On read, each entry also reports the read-only `next_run_at` for that environment (the next fire time, or `null`). For a recurring or manual job, supply this map to choose where it runs. For a one-off job, name its target environment(s) here as the map keys one run is enqueued per named environment; when the map is empty a single-environment credential implies the one environment. Every referenced environment must exist for the account.
38
38
  attr_accessor :environments
39
39
 
40
40
  # How overlapping runs are handled. `ALLOW` (the only value today) permits them.
@@ -22,7 +22,7 @@ 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.
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 in the run request body (implied when your credential is scoped to a single environment); a rerun copies its source run's environment.
26
26
  attr_accessor :environment
27
27
 
28
28
  # Why the run exists: `SCHEDULE`, `MANUAL` (Run now), `RERUN`, or `RETRY` (an automatic retry of a failed run).
@@ -0,0 +1,150 @@
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
+ # Request body for the run-now action (`POST /jobs/{id}/actions/run`). A plain object (not a JSON:API envelope), matching the platform convention for action endpoints. The body itself is optional — omit it entirely when the target environment is unambiguous.
18
+ class RunNowRequest < ApiModelBase
19
+ # The environment to run the job in. Must be one the job is **enabled** in (otherwise the request is rejected). Optional when the target is unambiguous: when the job is enabled in exactly one environment, or your credential is scoped to a single environment, that environment is used.
20
+ attr_accessor :environment
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'environment' => :'environment'
26
+ }
27
+ end
28
+
29
+ # Returns attribute mapping this model knows about
30
+ def self.acceptable_attribute_map
31
+ attribute_map
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ acceptable_attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'environment' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ :'environment'
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::RunNowRequest` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ acceptable_attribute_map = self.class.acceptable_attribute_map
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!acceptable_attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::RunNowRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'environment')
70
+ self.environment = attributes[:'environment']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ warn '[DEPRECATED] the `valid?` method is obsolete'
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ environment == o.environment
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [environment].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Returns the object in the form of hash
133
+ # @return [Hash] Returns the object in the form of hash
134
+ def to_hash
135
+ hash = {}
136
+ self.class.attribute_map.each_pair do |attr, param|
137
+ value = self.send(attr)
138
+ if value.nil?
139
+ is_nullable = self.class.openapi_nullable.include?(attr)
140
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
141
+ end
142
+
143
+ hash[param] = _to_hash(value)
144
+ end
145
+ hash
146
+ end
147
+
148
+ end
149
+
150
+ end
@@ -41,6 +41,7 @@ require 'smplkit_jobs_client/models/run'
41
41
  require 'smplkit_jobs_client/models/run_list_links'
42
42
  require 'smplkit_jobs_client/models/run_list_meta'
43
43
  require 'smplkit_jobs_client/models/run_list_response'
44
+ require 'smplkit_jobs_client/models/run_now_request'
44
45
  require 'smplkit_jobs_client/models/run_resource'
45
46
  require 'smplkit_jobs_client/models/run_response'
46
47
  require 'smplkit_jobs_client/models/run_retry'
@@ -34,10 +34,9 @@ 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&#39;s id as &#x60;data.id&#x60;. Ids are unique within an account and immutable. The job&#39;s kind follows from its &#x60;schedule&#x60;: omit the schedule for a permanent **manual** job (triggered on demand), give a cron expression for a **recurring** job, or a datetime / &#x60;now&#x60; for a **one-off** job. A recurring or manual job supplies &#x60;environments&#x60; to choose where it runs; a recurring job begins scheduling immediately in each enabled environment. A one-off job is created in the environment named by the &#x60;X-Smplkit-Environment&#x60; header (implied when the credential is scoped to a single environment); a &#x60;now&#x60; one-off enqueues its single run immediately.
37
+ # Create a job for this account. The caller supplies the job&#39;s id as &#x60;data.id&#x60;. Ids are unique within an account and immutable. The job&#39;s kind follows from its &#x60;schedule&#x60;: omit the schedule for a permanent **manual** job (triggered on demand), give a cron expression for a **recurring** job, or a datetime / &#x60;now&#x60; for a **one-off** job. Supply &#x60;environments&#x60; to choose where the job runs: a recurring job begins scheduling immediately in each enabled environment, while a one-off job names its target environment(s) by the keys of that map and enqueues one run per environment (a single-environment credential implies the one environment when the map is empty). A &#x60;now&#x60; one-off enqueues its run(s) immediately.
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 &#x60;environments&#x60; map.
41
40
  # @return [JobResponse]
42
41
  describe 'create_job test' do
43
42
  it 'should work' do
@@ -89,10 +88,10 @@ describe 'JobsApi' do
89
88
 
90
89
  # unit tests for run_job_now
91
90
  # Run Job Now
92
- # Trigger one immediate run of the job in a specified environment (a &#x60;MANUAL&#x60; run). This is the primary execution path for a manual job and is also usable ad hoc for a recurring job (\&quot;run now\&quot;). The job&#39;s schedule and enabled state are untouched. The run executes in the environment named by the &#x60;X-Smplkit-Environment&#x60; header; when the job is enabled in exactly one environment that environment is used, and a single-environment credential implies it. The environment must be one the job is **enabled** in (409 otherwise). The run executes the job&#39;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 &#x60;QUOTA_EXCEEDED&#x60; rather than being rejected here.
91
+ # Trigger one immediate run of the job in a specified environment (a &#x60;MANUAL&#x60; run). This is the primary execution path for a manual job and is also usable ad hoc for a recurring job (\&quot;run now\&quot;). The job&#39;s schedule and enabled state are untouched. The run executes in the environment named by the request body&#39;s &#x60;environment&#x60;; when the job is enabled in exactly one environment that environment is used, and a single-environment credential implies it. The environment must be one the job is **enabled** in (409 otherwise). The run executes the job&#39;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 &#x60;QUOTA_EXCEEDED&#x60; rather than being rejected here.
93
92
  # @param job_id
94
93
  # @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 &#x60;environments&#x60; map.
94
+ # @option opts [RunNowRequest] :run_now_request
96
95
  # @return [RunResponse]
97
96
  describe 'run_job_now test' do
98
97
  it 'should work' do
@@ -102,11 +101,10 @@ describe 'JobsApi' do
102
101
 
103
102
  # unit tests for update_job
104
103
  # Update Job
105
- # Replace an existing job. Every writable field is overwritten. The job&#39;s kind is re-derived from the new &#x60;schedule&#x60; (omit it for a manual job). Set enablement per environment via the &#x60;environments&#x60; map (a recurring or manual job), or by recreating a one-off job in the desired environment. Each environment may carry its own cron &#x60;schedule&#x60; override (recurring jobs only). Editing a recurring environment&#39;s effective schedule recomputes its next fire time; an edit that leaves it unchanged preserves the existing cadence.
104
+ # Replace an existing job. Every writable field is overwritten. The job&#39;s kind is re-derived from the new &#x60;schedule&#x60; (omit it for a manual job). Set enablement per environment via the &#x60;environments&#x60; map (a recurring or manual job), or by recreating a one-off job naming its target environment(s) in that map. Each environment may carry its own cron &#x60;schedule&#x60; override (recurring jobs only). Editing a recurring environment&#39;s effective schedule recomputes its next fire time; an edit that leaves it unchanged preserves the existing cadence.
106
105
  # @param job_id
107
106
  # @param job_request
108
107
  # @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 &#x60;environments&#x60; map.
110
108
  # @return [JobResponse]
111
109
  describe 'update_job test' do
112
110
  it 'should work' do
@@ -0,0 +1,36 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for SmplkitGeneratedClient::Jobs::RunNowRequest
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe SmplkitGeneratedClient::Jobs::RunNowRequest do
21
+ #let(:instance) { SmplkitGeneratedClient::Jobs::RunNowRequest.new }
22
+
23
+ describe 'test an instance of RunNowRequest' do
24
+ it 'should create an instance of RunNowRequest' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::Jobs::RunNowRequest)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "environment"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ end
@@ -395,7 +395,7 @@ module Smplkit
395
395
  _new_job(
396
396
  id, name: name, schedule: schedule, timezone: timezone, retry_policy: retry_policy,
397
397
  configuration: configuration, description: description, environments: environments,
398
- concurrency_policy: concurrency_policy, environment: nil
398
+ concurrency_policy: concurrency_policy
399
399
  )
400
400
  end
401
401
 
@@ -429,7 +429,7 @@ module Smplkit
429
429
  _new_job(
430
430
  id, name: name, schedule: nil, retry_policy: retry_policy,
431
431
  configuration: configuration, description: description, environments: environments,
432
- concurrency_policy: concurrency_policy, environment: nil
432
+ concurrency_policy: concurrency_policy
433
433
  )
434
434
  end
435
435
 
@@ -458,8 +458,9 @@ module Smplkit
458
458
  concurrency_policy: "ALLOW", retry_policy: nil, environment: nil)
459
459
  _new_job(
460
460
  id, name: name, schedule: schedule.iso8601, retry_policy: retry_policy,
461
- configuration: configuration, description: description, environments: nil,
462
- concurrency_policy: concurrency_policy, environment: environment
461
+ configuration: configuration, description: description,
462
+ environments: birth_env_map(environment.nil? ? @environment : environment),
463
+ concurrency_policy: concurrency_policy
463
464
  )
464
465
  end
465
466
 
@@ -525,7 +526,12 @@ module Smplkit
525
526
  # set to +MANUAL+.
526
527
  def run(id, environment: nil)
527
528
  env = environment.nil? ? @environment : environment
528
- resp = Jobs.call_api { @api.run_job_now(id, x_smplkit_environment: env) }
529
+ # The target environment now travels in the run-now request body (the
530
+ # X-Smplkit-Environment header was dropped). When no environment is
531
+ # resolved, send no body at all so the service implies it.
532
+ opts = {}
533
+ opts[:run_now_request] = SmplkitGeneratedClient::Jobs::RunNowRequest.new(environment: env) unless env.nil?
534
+ resp = Jobs.call_api { @api.run_job_now(id, opts) }
529
535
  Run.from_resource(resp.data, runs: @runs)
530
536
  end
531
537
 
@@ -540,18 +546,19 @@ module Smplkit
540
546
  # @api private — POST a new job. Called by {Smplkit::Jobs::Job#save} on
541
547
  # unsaved instances. The jobs service requires a caller-supplied
542
548
  # +data.id+ on create and 409s on conflict. A one-off job's birth
543
- # environment travels as the +X-Smplkit-Environment+ header.
549
+ # environment travels as an enabled entry in the body's +environments+
550
+ # map (see {#_new_job}); there is no request header.
544
551
  def _create_job(job)
545
552
  raise ArgumentError, "Job.id is required on create (caller-supplied key)" if job.id.nil? || job.id.empty?
546
553
 
547
- resp = Jobs.call_api { @api.create_job(build_create_body(job), x_smplkit_environment: job.birth_environment) }
554
+ resp = Jobs.call_api { @api.create_job(build_create_body(job)) }
548
555
  Job.from_resource(resp.data, client: self)
549
556
  end
550
557
 
551
558
  # @api private — Full-replace PUT for an existing job. Called by
552
- # {Smplkit::Jobs::Job#save} on instances with +created_at+. The client's
553
- # configured environment (if any) travels as the +X-Smplkit-Environment+
554
- # header.
559
+ # {Smplkit::Jobs::Job#save} on instances with +created_at+. The target
560
+ # environment travels in the body (the +environments+ map), so the update
561
+ # carries no environment header.
555
562
  #
556
563
  # Header values come back in plaintext on the GET path, so a fetched job
557
564
  # round-trips through this full-replace PUT with its header values intact
@@ -559,7 +566,7 @@ module Smplkit
559
566
  def _update_job(job)
560
567
  raise ArgumentError, "cannot update a Job with no id" if job.id.nil?
561
568
 
562
- resp = Jobs.call_api { @api.update_job(job.id, build_body(job), x_smplkit_environment: @environment) }
569
+ resp = Jobs.call_api { @api.update_job(job.id, build_body(job)) }
563
570
  Job.from_resource(resp.data, client: self)
564
571
  end
565
572
 
@@ -569,7 +576,7 @@ module Smplkit
569
576
  # public constructors ({#new_recurring_job}, {#new_manual_job}, {#schedule})
570
577
  # funnel through here.
571
578
  def _new_job(id, name:, schedule:, configuration:, description:,
572
- environments:, concurrency_policy:, environment:,
579
+ environments:, concurrency_policy:,
573
580
  timezone: nil, retry_policy: nil)
574
581
  Job.new(
575
582
  self,
@@ -581,11 +588,21 @@ module Smplkit
581
588
  configuration: configuration,
582
589
  description: description,
583
590
  environments: Jobs.normalize_environments(environments),
584
- concurrency_policy: concurrency_policy,
585
- birth_environment: environment.nil? ? @environment : environment
591
+ concurrency_policy: concurrency_policy
586
592
  )
587
593
  end
588
594
 
595
+ # A one-off job's birth environment as an enabled +environments+ entry.
596
+ # The target environment of a one-off job is now conveyed by a key of the
597
+ # body's +environments+ map (there is no request header). Returns +nil+
598
+ # when the environment is unknown, leaving the map empty so a
599
+ # single-environment credential implies it server-side.
600
+ def birth_env_map(environment)
601
+ return nil if environment.nil? || environment.empty?
602
+
603
+ { environment => JobEnvironment.new(enabled: true) }
604
+ end
605
+
589
606
  # Convert the wrapper +environments+ map to the flat per-environment overlay
590
607
  # the generated +Job+ model carries (ADR-056). Each value is the
591
608
  # environment's sparse leaf-path overlay: +enabled+ plus only the leaves it
@@ -562,16 +562,10 @@ module Smplkit
562
562
  # server-side write.
563
563
  attr_accessor :version
564
564
 
565
- # @api private — For a one-off job, the environment it is born in, sent as
566
- # the +X-Smplkit-Environment+ header by {JobsClient#_create_job}. Ignored
567
- # for recurring and manual jobs, whose environments come from
568
- # {#environments}.
569
- attr_accessor :birth_environment
570
-
571
565
  def initialize(client = nil, id:, name:, configuration:, schedule: nil,
572
566
  timezone: nil, retry_policy: nil, description: nil, environments: nil,
573
567
  kind: nil, type: "http", concurrency_policy: "ALLOW",
574
- birth_environment: nil, created_at: nil,
568
+ created_at: nil,
575
569
  updated_at: nil, deleted_at: nil, version: nil)
576
570
  @client = client
577
571
  @id = id
@@ -585,7 +579,6 @@ module Smplkit
585
579
  self.retry_policy = retry_policy
586
580
  @configuration = configuration
587
581
  @concurrency_policy = concurrency_policy
588
- @birth_environment = birth_environment
589
582
  @created_at = created_at
590
583
  @updated_at = updated_at
591
584
  @deleted_at = deleted_at
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smplkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.126
4
+ version: 3.0.127
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC
@@ -783,6 +783,7 @@ files:
783
783
  - lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_links.rb
784
784
  - lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_meta.rb
785
785
  - lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_response.rb
786
+ - lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_now_request.rb
786
787
  - lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_resource.rb
787
788
  - lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_response.rb
788
789
  - lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_retry.rb
@@ -816,6 +817,7 @@ files:
816
817
  - lib/smplkit/_generated/jobs/spec/models/run_list_links_spec.rb
817
818
  - lib/smplkit/_generated/jobs/spec/models/run_list_meta_spec.rb
818
819
  - lib/smplkit/_generated/jobs/spec/models/run_list_response_spec.rb
820
+ - lib/smplkit/_generated/jobs/spec/models/run_now_request_spec.rb
819
821
  - lib/smplkit/_generated/jobs/spec/models/run_resource_spec.rb
820
822
  - lib/smplkit/_generated/jobs/spec/models/run_response_spec.rb
821
823
  - lib/smplkit/_generated/jobs/spec/models/run_retry_spec.rb