hatchet-sdk 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +45 -0
  4. data/lib/hatchet/clients/rest/.openapi-generator/FILES +9 -0
  5. data/lib/hatchet/clients/rest/README.md +16 -3
  6. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/filter_api.rb +4 -0
  7. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/operator_api.rb +405 -0
  8. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/webhook_api.rb +2 -0
  9. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/worker_api.rb +3 -0
  10. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_runs_api.rb +3 -0
  11. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta.rb +14 -4
  12. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_tenant_invite_request.rb +14 -4
  13. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/feature_flag_id.rb +2 -1
  14. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request.rb +105 -0
  15. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_pause.rb +343 -0
  16. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_unpause.rb +262 -0
  17. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_invite.rb +11 -1
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member.rb +11 -1
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member_role.rb +2 -1
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_invite_request.rb +14 -4
  21. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_member_request.rb +14 -4
  22. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_http_operator_request.rb +346 -0
  23. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event.rb +14 -4
  24. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator.rb +372 -0
  25. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator_list.rb +231 -0
  26. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_summary.rb +14 -4
  27. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_http_operator_request.rb +252 -0
  28. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run.rb +14 -4
  29. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker.rb +24 -4
  30. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow.rb +43 -1
  31. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_pause_scheduled_cron_run_queue_behavior.rb +40 -0
  32. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_update_request.rb +7 -8
  33. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +9 -0
  34. data/lib/hatchet/concurrency.rb +85 -18
  35. data/lib/hatchet/context.rb +5 -2
  36. data/lib/hatchet/contracts/v1/workflows_pb.rb +1 -1
  37. data/lib/hatchet/durable_context.rb +5 -12
  38. data/lib/hatchet/features/cel.rb +2 -2
  39. data/lib/hatchet/features/cron.rb +5 -5
  40. data/lib/hatchet/features/events.rb +7 -7
  41. data/lib/hatchet/features/filters.rb +7 -7
  42. data/lib/hatchet/features/logs.rb +2 -2
  43. data/lib/hatchet/features/metrics.rb +6 -6
  44. data/lib/hatchet/features/rate_limits.rb +2 -2
  45. data/lib/hatchet/features/runs.rb +4 -5
  46. data/lib/hatchet/features/scheduled.rb +7 -7
  47. data/lib/hatchet/features/tenant.rb +2 -2
  48. data/lib/hatchet/features/workers.rb +5 -5
  49. data/lib/hatchet/features/workflows.rb +6 -6
  50. data/lib/hatchet/version.rb +1 -1
  51. data/lib/hatchet/workflow.rb +58 -33
  52. data/lib/hatchet-sdk.rb +65 -32
  53. data/sig/hatchet/concurrency.rbs +12 -2
  54. metadata +11 -2
@@ -101,6 +101,7 @@ module HatchetSdkRest
101
101
  return data, status_code, headers
102
102
  end
103
103
 
104
+ # Delete a webhook
104
105
  # Delete a webhook
105
106
  # @param tenant [String] The tenant id
106
107
  # @param v1_webhook [String] The name of the webhook to delete
@@ -111,6 +112,7 @@ module HatchetSdkRest
111
112
  data
112
113
  end
113
114
 
115
+ # Delete a webhook
114
116
  # Delete a webhook
115
117
  # @param tenant [String] The tenant id
116
118
  # @param v1_webhook [String] The name of the webhook to delete
@@ -98,6 +98,7 @@ module HatchetSdkRest
98
98
  # @option opts [Integer] :limit The number to limit by
99
99
  # @option opts [Array<WorkerStatus>] :statuses Filter by worker status
100
100
  # @option opts [Array<String>] :labels Filter by worker labels
101
+ # @option opts [Boolean] :include_operators Whether to include engine-managed operator workers, which are hidden by default
101
102
  # @return [WorkerList]
102
103
  def worker_list(tenant, opts = {})
103
104
  data, _status_code, _headers = worker_list_with_http_info(tenant, opts)
@@ -112,6 +113,7 @@ module HatchetSdkRest
112
113
  # @option opts [Integer] :limit The number to limit by
113
114
  # @option opts [Array<WorkerStatus>] :statuses Filter by worker status
114
115
  # @option opts [Array<String>] :labels Filter by worker labels
116
+ # @option opts [Boolean] :include_operators Whether to include engine-managed operator workers, which are hidden by default
115
117
  # @return [Array<(WorkerList, Integer, Hash)>] WorkerList data, response status code and response headers
116
118
  def worker_list_with_http_info(tenant, opts = {})
117
119
  if @api_client.config.debugging
@@ -138,6 +140,7 @@ module HatchetSdkRest
138
140
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
139
141
  query_params[:'statuses'] = @api_client.build_collection_param(opts[:'statuses'], :multi) if !opts[:'statuses'].nil?
140
142
  query_params[:'labels'] = @api_client.build_collection_param(opts[:'labels'], :multi) if !opts[:'labels'].nil?
143
+ query_params[:'includeOperators'] = opts[:'include_operators'] if !opts[:'include_operators'].nil?
141
144
 
142
145
  # header parameters
143
146
  header_params = opts[:header_params] || {}
@@ -358,6 +358,7 @@ module HatchetSdkRest
358
358
  # Get a workflow run and its metadata to display on the \"detail\" page
359
359
  # @param v1_workflow_run [String] The workflow run id to get
360
360
  # @param [Hash] opts the optional parameters
361
+ # @option opts [Boolean] :include_orchestrator_events Whether to include the DAG orchestrator&#39;s task events, which are hidden by default
361
362
  # @return [V1WorkflowRunDetails]
362
363
  def v1_workflow_run_get(v1_workflow_run, opts = {})
363
364
  data, _status_code, _headers = v1_workflow_run_get_with_http_info(v1_workflow_run, opts)
@@ -368,6 +369,7 @@ module HatchetSdkRest
368
369
  # Get a workflow run and its metadata to display on the \&quot;detail\&quot; page
369
370
  # @param v1_workflow_run [String] The workflow run id to get
370
371
  # @param [Hash] opts the optional parameters
372
+ # @option opts [Boolean] :include_orchestrator_events Whether to include the DAG orchestrator&#39;s task events, which are hidden by default
371
373
  # @return [Array<(V1WorkflowRunDetails, Integer, Hash)>] V1WorkflowRunDetails data, response status code and response headers
372
374
  def v1_workflow_run_get_with_http_info(v1_workflow_run, opts = {})
373
375
  if @api_client.config.debugging
@@ -390,6 +392,7 @@ module HatchetSdkRest
390
392
 
391
393
  # query parameters
392
394
  query_params = opts[:query_params] || {}
395
+ query_params[:'includeOrchestratorEvents'] = opts[:'include_orchestrator_events'] if !opts[:'include_orchestrator_events'].nil?
393
396
 
394
397
  # header parameters
395
398
  header_params = opts[:header_params] || {}
@@ -46,6 +46,9 @@ module HatchetSdkRest
46
46
  # the embedded worker API token, only set on authdisabled builds
47
47
  attr_accessor :auth_disabled_token
48
48
 
49
+ # whether this instance is running in embedded mode
50
+ attr_accessor :embedded
51
+
49
52
  # Attribute mapping from ruby-style variable name to JSON key.
50
53
  def self.attribute_map
51
54
  {
@@ -59,7 +62,8 @@ module HatchetSdkRest
59
62
  :'observability_enabled' => :'observabilityEnabled',
60
63
  :'prometheus_server_enabled' => :'prometheusServerEnabled',
61
64
  :'auth_disabled' => :'authDisabled',
62
- :'auth_disabled_token' => :'authDisabledToken'
65
+ :'auth_disabled_token' => :'authDisabledToken',
66
+ :'embedded' => :'embedded'
63
67
  }
64
68
  end
65
69
 
@@ -86,7 +90,8 @@ module HatchetSdkRest
86
90
  :'observability_enabled' => :'Boolean',
87
91
  :'prometheus_server_enabled' => :'Boolean',
88
92
  :'auth_disabled' => :'Boolean',
89
- :'auth_disabled_token' => :'String'
93
+ :'auth_disabled_token' => :'String',
94
+ :'embedded' => :'Boolean'
90
95
  }
91
96
  end
92
97
 
@@ -155,6 +160,10 @@ module HatchetSdkRest
155
160
  if attributes.key?(:'auth_disabled_token')
156
161
  self.auth_disabled_token = attributes[:'auth_disabled_token']
157
162
  end
163
+
164
+ if attributes.key?(:'embedded')
165
+ self.embedded = attributes[:'embedded']
166
+ end
158
167
  end
159
168
 
160
169
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -187,7 +196,8 @@ module HatchetSdkRest
187
196
  observability_enabled == o.observability_enabled &&
188
197
  prometheus_server_enabled == o.prometheus_server_enabled &&
189
198
  auth_disabled == o.auth_disabled &&
190
- auth_disabled_token == o.auth_disabled_token
199
+ auth_disabled_token == o.auth_disabled_token &&
200
+ embedded == o.embedded
191
201
  end
192
202
 
193
203
  # @see the `==` method
@@ -199,7 +209,7 @@ module HatchetSdkRest
199
209
  # Calculates hash code according to all attributes.
200
210
  # @return [Integer] Hash code
201
211
  def hash
202
- [auth, pylon_app_id, posthog, allow_signup, allow_invites, allow_create_tenant, allow_change_password, observability_enabled, prometheus_server_enabled, auth_disabled, auth_disabled_token].hash
212
+ [auth, pylon_app_id, posthog, allow_signup, allow_invites, allow_create_tenant, allow_change_password, observability_enabled, prometheus_server_enabled, auth_disabled, auth_disabled_token, embedded].hash
203
213
  end
204
214
 
205
215
  # Builds the object from hash
@@ -21,6 +21,9 @@ module HatchetSdkRest
21
21
  # The role of the user in the tenant.
22
22
  attr_accessor :role
23
23
 
24
+ # Whether the invited user can view payloads. Defaults to true.
25
+ attr_accessor :can_view_payloads
26
+
24
27
  class EnumAttributeValidator
25
28
  attr_reader :datatype
26
29
  attr_reader :allowable_values
@@ -47,7 +50,8 @@ module HatchetSdkRest
47
50
  def self.attribute_map
48
51
  {
49
52
  :'email' => :'email',
50
- :'role' => :'role'
53
+ :'role' => :'role',
54
+ :'can_view_payloads' => :'canViewPayloads'
51
55
  }
52
56
  end
53
57
 
@@ -65,7 +69,8 @@ module HatchetSdkRest
65
69
  def self.openapi_types
66
70
  {
67
71
  :'email' => :'String',
68
- :'role' => :'TenantMemberRole'
72
+ :'role' => :'TenantMemberRole',
73
+ :'can_view_payloads' => :'Boolean'
69
74
  }
70
75
  end
71
76
 
@@ -102,6 +107,10 @@ module HatchetSdkRest
102
107
  else
103
108
  self.role = nil
104
109
  end
110
+
111
+ if attributes.key?(:'can_view_payloads')
112
+ self.can_view_payloads = attributes[:'can_view_payloads']
113
+ end
105
114
  end
106
115
 
107
116
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -155,7 +164,8 @@ module HatchetSdkRest
155
164
  return true if self.equal?(o)
156
165
  self.class == o.class &&
157
166
  email == o.email &&
158
- role == o.role
167
+ role == o.role &&
168
+ can_view_payloads == o.can_view_payloads
159
169
  end
160
170
 
161
171
  # @see the `==` method
@@ -167,7 +177,7 @@ module HatchetSdkRest
167
177
  # Calculates hash code according to all attributes.
168
178
  # @return [Integer] Hash code
169
179
  def hash
170
- [email, role].hash
180
+ [email, role, can_view_payloads].hash
171
181
  end
172
182
 
173
183
  # Builds the object from hash
@@ -18,9 +18,10 @@ module HatchetSdkRest
18
18
  TENANT_LOG_WORKFLOW_FILTER_ENABLED = "tenant-log-workflow-filter-enabled".freeze
19
19
  TRACE_MINIMAP_ENABLED = "trace-minimap-enabled".freeze
20
20
  ORGANIZATION_SSO_ENABLED = "organization-sso-enabled".freeze
21
+ OPERATOR_DETAILS_ENABLED = "operator-details-enabled".freeze
21
22
 
22
23
  def self.all_vars
23
- @all_vars ||= [TENANT_LOG_WORKFLOW_FILTER_ENABLED, TRACE_MINIMAP_ENABLED, ORGANIZATION_SSO_ENABLED].freeze
24
+ @all_vars ||= [TENANT_LOG_WORKFLOW_FILTER_ENABLED, TRACE_MINIMAP_ENABLED, ORGANIZATION_SSO_ENABLED, OPERATOR_DETAILS_ENABLED].freeze
24
25
  end
25
26
 
26
27
  # Builds the enum from string
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ module PauseWorkflowRequest
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'PauseWorkflowRequestPause',
23
+ :'PauseWorkflowRequestUnpause'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.iso8601(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = HatchetSdkRest.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -0,0 +1,343 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ class PauseWorkflowRequestPause
18
+ # Discriminator indicating this request pauses the workflow.
19
+ attr_accessor :action
20
+
21
+ # The behavior of cron runs triggered while the workflow is paused.
22
+ attr_accessor :paused_workflow_cron_run_queue_behavior
23
+
24
+ # The behavior of scheduled runs triggered while the workflow is paused.
25
+ attr_accessor :paused_workflow_scheduled_run_queue_behavior
26
+
27
+ # The TTL for queued runs while the workflow is paused before they get dropped, expressed as a Go-style duration string (e.g. \"1d7h30m\").
28
+ attr_accessor :paused_workflow_queue_ttl
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'action' => :'action',
56
+ :'paused_workflow_cron_run_queue_behavior' => :'pausedWorkflowCronRunQueueBehavior',
57
+ :'paused_workflow_scheduled_run_queue_behavior' => :'pausedWorkflowScheduledRunQueueBehavior',
58
+ :'paused_workflow_queue_ttl' => :'pausedWorkflowQueueTTL'
59
+ }
60
+ end
61
+
62
+ # Returns attribute mapping this model knows about
63
+ def self.acceptable_attribute_map
64
+ attribute_map
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ acceptable_attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'action' => :'String',
76
+ :'paused_workflow_cron_run_queue_behavior' => :'WorkflowPauseScheduledCronRunQueueBehavior',
77
+ :'paused_workflow_scheduled_run_queue_behavior' => :'WorkflowPauseScheduledCronRunQueueBehavior',
78
+ :'paused_workflow_queue_ttl' => :'String'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::PauseWorkflowRequestPause` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ acceptable_attribute_map = self.class.acceptable_attribute_map
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!acceptable_attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::PauseWorkflowRequestPause`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'action')
105
+ self.action = attributes[:'action']
106
+ else
107
+ self.action = nil
108
+ end
109
+
110
+ if attributes.key?(:'paused_workflow_cron_run_queue_behavior')
111
+ self.paused_workflow_cron_run_queue_behavior = attributes[:'paused_workflow_cron_run_queue_behavior']
112
+ else
113
+ self.paused_workflow_cron_run_queue_behavior = nil
114
+ end
115
+
116
+ if attributes.key?(:'paused_workflow_scheduled_run_queue_behavior')
117
+ self.paused_workflow_scheduled_run_queue_behavior = attributes[:'paused_workflow_scheduled_run_queue_behavior']
118
+ else
119
+ self.paused_workflow_scheduled_run_queue_behavior = nil
120
+ end
121
+
122
+ if attributes.key?(:'paused_workflow_queue_ttl')
123
+ self.paused_workflow_queue_ttl = attributes[:'paused_workflow_queue_ttl']
124
+ else
125
+ self.paused_workflow_queue_ttl = nil
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
133
+ invalid_properties = Array.new
134
+ if @action.nil?
135
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
136
+ end
137
+
138
+ if @paused_workflow_cron_run_queue_behavior.nil?
139
+ invalid_properties.push('invalid value for "paused_workflow_cron_run_queue_behavior", paused_workflow_cron_run_queue_behavior cannot be nil.')
140
+ end
141
+
142
+ if @paused_workflow_scheduled_run_queue_behavior.nil?
143
+ invalid_properties.push('invalid value for "paused_workflow_scheduled_run_queue_behavior", paused_workflow_scheduled_run_queue_behavior cannot be nil.')
144
+ end
145
+
146
+ if @paused_workflow_queue_ttl.nil?
147
+ invalid_properties.push('invalid value for "paused_workflow_queue_ttl", paused_workflow_queue_ttl cannot be nil.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ warn '[DEPRECATED] the `valid?` method is obsolete'
157
+ return false if @action.nil?
158
+ action_validator = EnumAttributeValidator.new('String', ["pause"])
159
+ return false unless action_validator.valid?(@action)
160
+ return false if @paused_workflow_cron_run_queue_behavior.nil?
161
+ return false if @paused_workflow_scheduled_run_queue_behavior.nil?
162
+ return false if @paused_workflow_queue_ttl.nil?
163
+ true
164
+ end
165
+
166
+ # Custom attribute writer method checking allowed values (enum).
167
+ # @param [Object] action Object to be assigned
168
+ def action=(action)
169
+ validator = EnumAttributeValidator.new('String', ["pause"])
170
+ unless validator.valid?(action)
171
+ fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
172
+ end
173
+ @action = action
174
+ end
175
+
176
+ # Custom attribute writer method with validation
177
+ # @param [Object] paused_workflow_cron_run_queue_behavior Value to be assigned
178
+ def paused_workflow_cron_run_queue_behavior=(paused_workflow_cron_run_queue_behavior)
179
+ if paused_workflow_cron_run_queue_behavior.nil?
180
+ fail ArgumentError, 'paused_workflow_cron_run_queue_behavior cannot be nil'
181
+ end
182
+
183
+ @paused_workflow_cron_run_queue_behavior = paused_workflow_cron_run_queue_behavior
184
+ end
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] paused_workflow_scheduled_run_queue_behavior Value to be assigned
188
+ def paused_workflow_scheduled_run_queue_behavior=(paused_workflow_scheduled_run_queue_behavior)
189
+ if paused_workflow_scheduled_run_queue_behavior.nil?
190
+ fail ArgumentError, 'paused_workflow_scheduled_run_queue_behavior cannot be nil'
191
+ end
192
+
193
+ @paused_workflow_scheduled_run_queue_behavior = paused_workflow_scheduled_run_queue_behavior
194
+ end
195
+
196
+ # Custom attribute writer method with validation
197
+ # @param [Object] paused_workflow_queue_ttl Value to be assigned
198
+ def paused_workflow_queue_ttl=(paused_workflow_queue_ttl)
199
+ if paused_workflow_queue_ttl.nil?
200
+ fail ArgumentError, 'paused_workflow_queue_ttl cannot be nil'
201
+ end
202
+
203
+ @paused_workflow_queue_ttl = paused_workflow_queue_ttl
204
+ end
205
+
206
+ # Checks equality by comparing each attribute.
207
+ # @param [Object] Object to be compared
208
+ def ==(o)
209
+ return true if self.equal?(o)
210
+ self.class == o.class &&
211
+ action == o.action &&
212
+ paused_workflow_cron_run_queue_behavior == o.paused_workflow_cron_run_queue_behavior &&
213
+ paused_workflow_scheduled_run_queue_behavior == o.paused_workflow_scheduled_run_queue_behavior &&
214
+ paused_workflow_queue_ttl == o.paused_workflow_queue_ttl
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [action, paused_workflow_cron_run_queue_behavior, paused_workflow_scheduled_run_queue_behavior, paused_workflow_queue_ttl].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ return nil unless attributes.is_a?(Hash)
234
+ attributes = attributes.transform_keys(&:to_sym)
235
+ transformed_hash = {}
236
+ openapi_types.each_pair do |key, type|
237
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
238
+ transformed_hash["#{key}"] = nil
239
+ elsif type =~ /\AArray<(.*)>/i
240
+ # check to ensure the input is an array given that the attribute
241
+ # is documented as an array but the input is not
242
+ if attributes[attribute_map[key]].is_a?(Array)
243
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
244
+ end
245
+ elsif !attributes[attribute_map[key]].nil?
246
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
247
+ end
248
+ end
249
+ new(transformed_hash)
250
+ end
251
+
252
+ # Deserializes the data based on type
253
+ # @param string type Data type
254
+ # @param string value Value to be deserialized
255
+ # @return [Object] Deserialized data
256
+ def self._deserialize(type, value)
257
+ case type.to_sym
258
+ when :Time
259
+ Time.parse(value)
260
+ when :Date
261
+ Date.parse(value)
262
+ when :String
263
+ value.to_s
264
+ when :Integer
265
+ value.to_i
266
+ when :Float
267
+ value.to_f
268
+ when :Boolean
269
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
270
+ true
271
+ else
272
+ false
273
+ end
274
+ when :Object
275
+ # generic object (usually a Hash), return directly
276
+ value
277
+ when /\AArray<(?<inner_type>.+)>\z/
278
+ inner_type = Regexp.last_match[:inner_type]
279
+ value.map { |v| _deserialize(inner_type, v) }
280
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
281
+ k_type = Regexp.last_match[:k_type]
282
+ v_type = Regexp.last_match[:v_type]
283
+ {}.tap do |hash|
284
+ value.each do |k, v|
285
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
286
+ end
287
+ end
288
+ else # model
289
+ # models (e.g. Pet) or oneOf
290
+ klass = HatchetSdkRest.const_get(type)
291
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
292
+ end
293
+ end
294
+
295
+ # Returns the string representation of the object
296
+ # @return [String] String presentation of the object
297
+ def to_s
298
+ to_hash.to_s
299
+ end
300
+
301
+ # to_body is an alias to to_hash (backward compatibility)
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_body
304
+ to_hash
305
+ end
306
+
307
+ # Returns the object in the form of hash
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_hash
310
+ hash = {}
311
+ self.class.attribute_map.each_pair do |attr, param|
312
+ value = self.send(attr)
313
+ if value.nil?
314
+ is_nullable = self.class.openapi_nullable.include?(attr)
315
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
316
+ end
317
+
318
+ hash[param] = _to_hash(value)
319
+ end
320
+ hash
321
+ end
322
+
323
+ # Outputs non-array value in the form of hash
324
+ # For object, use to_hash. Otherwise, just return the value
325
+ # @param [Object] value Any valid value
326
+ # @return [Hash] Returns the value in the form of hash
327
+ def _to_hash(value)
328
+ if value.is_a?(Array)
329
+ value.compact.map { |v| _to_hash(v) }
330
+ elsif value.is_a?(Hash)
331
+ {}.tap do |hash|
332
+ value.each { |k, v| hash[k] = _to_hash(v) }
333
+ end
334
+ elsif value.respond_to? :to_hash
335
+ value.to_hash
336
+ else
337
+ value
338
+ end
339
+ end
340
+
341
+ end
342
+
343
+ end