shipeasy-sdk 2.1.0 → 2.3.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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/docs/skill/SKILL.md +6 -2
  4. data/lib/generators/shipeasy/install/USAGE +24 -0
  5. data/lib/generators/shipeasy/install/install_generator.rb +86 -0
  6. data/lib/generators/shipeasy/install/templates/initializer.rb.tt +41 -0
  7. data/lib/shipeasy/admin.rb +85 -0
  8. data/lib/shipeasy/sdk/version.rb +1 -1
  9. data/lib/shipeasy_admin/api/alert_rules_api.rb +292 -0
  10. data/lib/shipeasy_admin/api/attributes_api.rb +82 -0
  11. data/lib/shipeasy_admin/api/configs_api.rb +680 -0
  12. data/lib/shipeasy_admin/api/events_api.rb +438 -0
  13. data/lib/shipeasy_admin/api/experiments_api.rb +727 -0
  14. data/lib/shipeasy_admin/api/gates_api.rb +438 -0
  15. data/lib/shipeasy_admin/api/i18n_api.rb +507 -0
  16. data/lib/shipeasy_admin/api/killswitches_api.rb +526 -0
  17. data/lib/shipeasy_admin/api/metrics_api.rb +281 -0
  18. data/lib/shipeasy_admin/api/ops_api.rb +525 -0
  19. data/lib/shipeasy_admin/api/projects_api.rb +153 -0
  20. data/lib/shipeasy_admin/api/universes_api.rb +306 -0
  21. data/lib/shipeasy_admin/api_client.rb +441 -0
  22. data/lib/shipeasy_admin/api_error.rb +58 -0
  23. data/lib/shipeasy_admin/api_model_base.rb +88 -0
  24. data/lib/shipeasy_admin/configuration.rb +397 -0
  25. data/lib/shipeasy_admin/models/approve_event_request.rb +198 -0
  26. data/lib/shipeasy_admin/models/approve_event_response.rb +166 -0
  27. data/lib/shipeasy_admin/models/create_alert_rule_request.rb +408 -0
  28. data/lib/shipeasy_admin/models/create_alert_rule_response.rb +165 -0
  29. data/lib/shipeasy_admin/models/create_config_request.rb +280 -0
  30. data/lib/shipeasy_admin/models/create_config_response.rb +201 -0
  31. data/lib/shipeasy_admin/models/create_event_request.rb +253 -0
  32. data/lib/shipeasy_admin/models/create_event_response.rb +193 -0
  33. data/lib/shipeasy_admin/models/create_experiment_request.rb +869 -0
  34. data/lib/shipeasy_admin/models/create_experiment_request_goal_metric.rb +336 -0
  35. data/lib/shipeasy_admin/models/create_experiment_response.rb +212 -0
  36. data/lib/shipeasy_admin/models/create_gate_request.rb +529 -0
  37. data/lib/shipeasy_admin/models/create_gate_response.rb +212 -0
  38. data/lib/shipeasy_admin/models/create_i18n_profile_request.rb +188 -0
  39. data/lib/shipeasy_admin/models/create_i18n_profile_response.rb +193 -0
  40. data/lib/shipeasy_admin/models/create_killswitch_request.rb +263 -0
  41. data/lib/shipeasy_admin/models/create_killswitch_response.rb +201 -0
  42. data/lib/shipeasy_admin/models/create_metric_request.rb +415 -0
  43. data/lib/shipeasy_admin/models/create_metric_response.rb +193 -0
  44. data/lib/shipeasy_admin/models/create_ops_item_request.rb +287 -0
  45. data/lib/shipeasy_admin/models/create_ops_item_response.rb +177 -0
  46. data/lib/shipeasy_admin/models/create_universe_request.rb +289 -0
  47. data/lib/shipeasy_admin/models/create_universe_response.rb +212 -0
  48. data/lib/shipeasy_admin/models/delete_alert_rule_response.rb +188 -0
  49. data/lib/shipeasy_admin/models/delete_config_response.rb +188 -0
  50. data/lib/shipeasy_admin/models/delete_event_response.rb +189 -0
  51. data/lib/shipeasy_admin/models/delete_experiment_response.rb +188 -0
  52. data/lib/shipeasy_admin/models/delete_gate_response.rb +188 -0
  53. data/lib/shipeasy_admin/models/delete_killswitch_response.rb +188 -0
  54. data/lib/shipeasy_admin/models/delete_metric_response.rb +189 -0
  55. data/lib/shipeasy_admin/models/delete_universe_response.rb +188 -0
  56. data/lib/shipeasy_admin/models/disable_gate_response.rb +190 -0
  57. data/lib/shipeasy_admin/models/discard_config_draft_request.rb +190 -0
  58. data/lib/shipeasy_admin/models/discard_config_draft_response.rb +188 -0
  59. data/lib/shipeasy_admin/models/enable_gate_response.rb +190 -0
  60. data/lib/shipeasy_admin/models/error_response.rb +185 -0
  61. data/lib/shipeasy_admin/models/get_config_response.rb +351 -0
  62. data/lib/shipeasy_admin/models/get_current_project_response.rb +606 -0
  63. data/lib/shipeasy_admin/models/get_current_project_response_module_translations.rb +104 -0
  64. data/lib/shipeasy_admin/models/get_event_response.rb +344 -0
  65. data/lib/shipeasy_admin/models/get_experiment_response.rb +688 -0
  66. data/lib/shipeasy_admin/models/get_experiment_results_response.rb +243 -0
  67. data/lib/shipeasy_admin/models/get_experiment_results_response_experiment.rb +248 -0
  68. data/lib/shipeasy_admin/models/get_experiment_results_response_results_inner.rb +252 -0
  69. data/lib/shipeasy_admin/models/get_experiment_timeseries_response.rb +192 -0
  70. data/lib/shipeasy_admin/models/get_experiment_timeseries_response_experiment.rb +261 -0
  71. data/lib/shipeasy_admin/models/get_experiment_timeseries_response_series_inner.rb +278 -0
  72. data/lib/shipeasy_admin/models/get_killswitch_response.rb +270 -0
  73. data/lib/shipeasy_admin/models/get_metric_response.rb +378 -0
  74. data/lib/shipeasy_admin/models/get_ops_item_response.rb +349 -0
  75. data/lib/shipeasy_admin/models/link_pr_to_ops_item_request.rb +186 -0
  76. data/lib/shipeasy_admin/models/link_pr_to_ops_item_response.rb +166 -0
  77. data/lib/shipeasy_admin/models/list_alert_rules_response_inner.rb +478 -0
  78. data/lib/shipeasy_admin/models/list_alert_rules_response_inner_notify.rb +177 -0
  79. data/lib/shipeasy_admin/models/list_alert_rules_response_inner_notify_slack_channel.rb +211 -0
  80. data/lib/shipeasy_admin/models/list_attributes_response_inner.rb +176 -0
  81. data/lib/shipeasy_admin/models/list_config_activity_response_inner.rb +280 -0
  82. data/lib/shipeasy_admin/models/list_configs_response.rb +178 -0
  83. data/lib/shipeasy_admin/models/list_configs_response_data_inner.rb +351 -0
  84. data/lib/shipeasy_admin/models/list_configs_response_data_inner_drafts_value.rb +237 -0
  85. data/lib/shipeasy_admin/models/list_configs_response_data_inner_envs_value.rb +237 -0
  86. data/lib/shipeasy_admin/models/list_events_response_inner.rb +344 -0
  87. data/lib/shipeasy_admin/models/list_events_response_inner_properties_inner.rb +289 -0
  88. data/lib/shipeasy_admin/models/list_experiments_response.rb +178 -0
  89. data/lib/shipeasy_admin/models/list_experiments_response_data_inner.rb +688 -0
  90. data/lib/shipeasy_admin/models/list_experiments_response_data_inner_groups_inner.rb +258 -0
  91. data/lib/shipeasy_admin/models/list_gates_response.rb +178 -0
  92. data/lib/shipeasy_admin/models/list_gates_response_data_inner.rb +395 -0
  93. data/lib/shipeasy_admin/models/list_gates_response_data_inner_enabled.rb +104 -0
  94. data/lib/shipeasy_admin/models/list_gates_response_data_inner_rules_inner.rb +238 -0
  95. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner.rb +105 -0
  96. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of.rb +375 -0
  97. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of1.rb +331 -0
  98. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of_ramp.rb +319 -0
  99. data/lib/shipeasy_admin/models/list_i18n_drafts_response_inner.rb +272 -0
  100. data/lib/shipeasy_admin/models/list_i18n_keys_response.rb +195 -0
  101. data/lib/shipeasy_admin/models/list_i18n_keys_response_keys_inner.rb +284 -0
  102. data/lib/shipeasy_admin/models/list_i18n_profiles_response_inner.rb +224 -0
  103. data/lib/shipeasy_admin/models/list_killswitches_response.rb +178 -0
  104. data/lib/shipeasy_admin/models/list_killswitches_response_data_inner.rb +270 -0
  105. data/lib/shipeasy_admin/models/list_killswitches_response_data_inner_envs_value.rb +248 -0
  106. data/lib/shipeasy_admin/models/list_metrics_response_inner.rb +378 -0
  107. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir.rb +295 -0
  108. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg.rb +113 -0
  109. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of.rb +188 -0
  110. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of1.rb +188 -0
  111. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of2.rb +188 -0
  112. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of3.rb +188 -0
  113. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of4.rb +188 -0
  114. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of5.rb +188 -0
  115. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of6.rb +188 -0
  116. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of7.rb +217 -0
  117. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of8.rb +233 -0
  118. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9.rb +240 -0
  119. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9_numerator.rb +266 -0
  120. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9_numerator_filters_inner.rb +264 -0
  121. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_group_by.rb +228 -0
  122. data/lib/shipeasy_admin/models/list_ops_items_response_inner.rb +349 -0
  123. data/lib/shipeasy_admin/models/list_slack_channels_response.rb +195 -0
  124. data/lib/shipeasy_admin/models/list_slack_channels_response_channels_inner.rb +203 -0
  125. data/lib/shipeasy_admin/models/list_universes_response.rb +178 -0
  126. data/lib/shipeasy_admin/models/list_universes_response_data_inner.rb +305 -0
  127. data/lib/shipeasy_admin/models/notify_ops_request.rb +261 -0
  128. data/lib/shipeasy_admin/models/notify_ops_response.rb +193 -0
  129. data/lib/shipeasy_admin/models/publish_config_draft_request.rb +190 -0
  130. data/lib/shipeasy_admin/models/publish_config_draft_response.rb +260 -0
  131. data/lib/shipeasy_admin/models/publish_i18n_profile_request.rb +149 -0
  132. data/lib/shipeasy_admin/models/publish_i18n_profile_response.rb +404 -0
  133. data/lib/shipeasy_admin/models/push_i18n_keys_request.rb +205 -0
  134. data/lib/shipeasy_admin/models/push_i18n_keys_request_keys_inner.rb +192 -0
  135. data/lib/shipeasy_admin/models/push_i18n_keys_response.rb +261 -0
  136. data/lib/shipeasy_admin/models/reanalyze_experiment_response.rb +214 -0
  137. data/lib/shipeasy_admin/models/save_config_draft_request.rb +202 -0
  138. data/lib/shipeasy_admin/models/save_config_draft_response.rb +286 -0
  139. data/lib/shipeasy_admin/models/set_experiment_metrics_request.rb +168 -0
  140. data/lib/shipeasy_admin/models/set_experiment_metrics_request_metrics_inner.rb +216 -0
  141. data/lib/shipeasy_admin/models/set_experiment_metrics_response.rb +179 -0
  142. data/lib/shipeasy_admin/models/set_experiment_metrics_response_metrics_inner.rb +201 -0
  143. data/lib/shipeasy_admin/models/set_experiment_status_request.rb +190 -0
  144. data/lib/shipeasy_admin/models/set_experiment_status_response.rb +214 -0
  145. data/lib/shipeasy_admin/models/set_killswitch_switch_request.rb +264 -0
  146. data/lib/shipeasy_admin/models/set_killswitch_switch_response.rb +288 -0
  147. data/lib/shipeasy_admin/models/unset_killswitch_switch_request.rb +237 -0
  148. data/lib/shipeasy_admin/models/unset_killswitch_switch_response.rb +289 -0
  149. data/lib/shipeasy_admin/models/update_alert_rule_request.rb +306 -0
  150. data/lib/shipeasy_admin/models/update_alert_rule_response.rb +165 -0
  151. data/lib/shipeasy_admin/models/update_config_request.rb +198 -0
  152. data/lib/shipeasy_admin/models/update_config_response.rb +165 -0
  153. data/lib/shipeasy_admin/models/update_event_request.rb +198 -0
  154. data/lib/shipeasy_admin/models/update_event_response.rb +166 -0
  155. data/lib/shipeasy_admin/models/update_experiment_request.rb +746 -0
  156. data/lib/shipeasy_admin/models/update_experiment_response.rb +165 -0
  157. data/lib/shipeasy_admin/models/update_gate_request.rb +403 -0
  158. data/lib/shipeasy_admin/models/update_gate_response.rb +166 -0
  159. data/lib/shipeasy_admin/models/update_i18n_key_request.rb +176 -0
  160. data/lib/shipeasy_admin/models/update_i18n_key_response.rb +166 -0
  161. data/lib/shipeasy_admin/models/update_killswitch_request.rb +224 -0
  162. data/lib/shipeasy_admin/models/update_killswitch_response.rb +165 -0
  163. data/lib/shipeasy_admin/models/update_ops_item_request.rb +205 -0
  164. data/lib/shipeasy_admin/models/update_ops_item_response.rb +166 -0
  165. data/lib/shipeasy_admin/models/update_universe_request.rb +213 -0
  166. data/lib/shipeasy_admin/models/update_universe_response.rb +165 -0
  167. data/lib/shipeasy_admin/models/upsert_project_request.rb +222 -0
  168. data/lib/shipeasy_admin/models/upsert_project_response.rb +260 -0
  169. data/lib/shipeasy_admin/version.rb +15 -0
  170. data/lib/shipeasy_admin.rb +196 -0
  171. metadata +230 -2
@@ -0,0 +1,478 @@
1
+ =begin
2
+ #Shipeasy Admin API
3
+
4
+ #REST API for managing feature gates, experiments, configs, universes, and killswitches in a Shipeasy project. Authenticate with an admin SDK key (`Authorization: Bearer sdk_admin_…`) and scope every request to a project via the `X-Project-Id` header. Mint admin keys via `POST /api/admin/keys` with `type: \"admin\"`. Keys expire after 90 days; rotate with the `revoke` action.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.23.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Shipeasy::Admin::Generated
17
+ # One metric-threshold alert rule.
18
+ class ListAlertRulesResponseInner < ApiModelBase
19
+ # Stable opaque alert-rule id.
20
+ attr_accessor :id
21
+
22
+ # Human label for the rule.
23
+ attr_accessor :name
24
+
25
+ # Id of the metric the rule evaluates. Immutable after create.
26
+ attr_accessor :metric_id
27
+
28
+ # Display name of the bound metric, or `null` if the metric no longer exists.
29
+ attr_accessor :metric_name
30
+
31
+ # How the metric value is compared to the threshold (gt/gte/lt/lte).
32
+ attr_accessor :comparator
33
+
34
+ # Threshold the metric value is compared against.
35
+ attr_accessor :threshold
36
+
37
+ # Lookback window (hours) the metric is aggregated over.
38
+ attr_accessor :window_hours
39
+
40
+ # Severity of the raised alert.
41
+ attr_accessor :severity
42
+
43
+ # Whether the rule is evaluated by the cron.
44
+ attr_accessor :enabled
45
+
46
+ attr_accessor :notify
47
+
48
+ # ISO-8601 timestamp of creation.
49
+ attr_accessor :created_at
50
+
51
+ # ISO-8601 timestamp of the last update.
52
+ attr_accessor :updated_at
53
+
54
+ class EnumAttributeValidator
55
+ attr_reader :datatype
56
+ attr_reader :allowable_values
57
+
58
+ def initialize(datatype, allowable_values)
59
+ @allowable_values = allowable_values.map do |value|
60
+ case datatype.to_s
61
+ when /Integer/i
62
+ value.to_i
63
+ when /Float/i
64
+ value.to_f
65
+ else
66
+ value
67
+ end
68
+ end
69
+ end
70
+
71
+ def valid?(value)
72
+ !value || allowable_values.include?(value)
73
+ end
74
+ end
75
+
76
+ # Attribute mapping from ruby-style variable name to JSON key.
77
+ def self.attribute_map
78
+ {
79
+ :'id' => :'id',
80
+ :'name' => :'name',
81
+ :'metric_id' => :'metricId',
82
+ :'metric_name' => :'metricName',
83
+ :'comparator' => :'comparator',
84
+ :'threshold' => :'threshold',
85
+ :'window_hours' => :'windowHours',
86
+ :'severity' => :'severity',
87
+ :'enabled' => :'enabled',
88
+ :'notify' => :'notify',
89
+ :'created_at' => :'createdAt',
90
+ :'updated_at' => :'updatedAt'
91
+ }
92
+ end
93
+
94
+ # Returns attribute mapping this model knows about
95
+ def self.acceptable_attribute_map
96
+ attribute_map
97
+ end
98
+
99
+ # Returns all the JSON keys this model knows about
100
+ def self.acceptable_attributes
101
+ acceptable_attribute_map.values
102
+ end
103
+
104
+ # Attribute type mapping.
105
+ def self.openapi_types
106
+ {
107
+ :'id' => :'String',
108
+ :'name' => :'String',
109
+ :'metric_id' => :'String',
110
+ :'metric_name' => :'String',
111
+ :'comparator' => :'String',
112
+ :'threshold' => :'Float',
113
+ :'window_hours' => :'Integer',
114
+ :'severity' => :'String',
115
+ :'enabled' => :'Boolean',
116
+ :'notify' => :'ListAlertRulesResponseInnerNotify',
117
+ :'created_at' => :'String',
118
+ :'updated_at' => :'String'
119
+ }
120
+ end
121
+
122
+ # List of attributes with nullable: true
123
+ def self.openapi_nullable
124
+ Set.new([
125
+ :'metric_name',
126
+ :'notify',
127
+ ])
128
+ end
129
+
130
+ # Initializes the object
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ def initialize(attributes = {})
133
+ if (!attributes.is_a?(Hash))
134
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::ListAlertRulesResponseInner` initialize method"
135
+ end
136
+
137
+ # check to see if the attribute exists and convert string to symbol for hash key
138
+ acceptable_attribute_map = self.class.acceptable_attribute_map
139
+ attributes = attributes.each_with_object({}) { |(k, v), h|
140
+ if (!acceptable_attribute_map.key?(k.to_sym))
141
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::ListAlertRulesResponseInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
142
+ end
143
+ h[k.to_sym] = v
144
+ }
145
+
146
+ if attributes.key?(:'id')
147
+ self.id = attributes[:'id']
148
+ else
149
+ self.id = nil
150
+ end
151
+
152
+ if attributes.key?(:'name')
153
+ self.name = attributes[:'name']
154
+ else
155
+ self.name = nil
156
+ end
157
+
158
+ if attributes.key?(:'metric_id')
159
+ self.metric_id = attributes[:'metric_id']
160
+ else
161
+ self.metric_id = nil
162
+ end
163
+
164
+ if attributes.key?(:'metric_name')
165
+ self.metric_name = attributes[:'metric_name']
166
+ else
167
+ self.metric_name = nil
168
+ end
169
+
170
+ if attributes.key?(:'comparator')
171
+ self.comparator = attributes[:'comparator']
172
+ else
173
+ self.comparator = nil
174
+ end
175
+
176
+ if attributes.key?(:'threshold')
177
+ self.threshold = attributes[:'threshold']
178
+ else
179
+ self.threshold = nil
180
+ end
181
+
182
+ if attributes.key?(:'window_hours')
183
+ self.window_hours = attributes[:'window_hours']
184
+ else
185
+ self.window_hours = nil
186
+ end
187
+
188
+ if attributes.key?(:'severity')
189
+ self.severity = attributes[:'severity']
190
+ else
191
+ self.severity = nil
192
+ end
193
+
194
+ if attributes.key?(:'enabled')
195
+ self.enabled = attributes[:'enabled']
196
+ else
197
+ self.enabled = nil
198
+ end
199
+
200
+ if attributes.key?(:'notify')
201
+ self.notify = attributes[:'notify']
202
+ else
203
+ self.notify = nil
204
+ end
205
+
206
+ if attributes.key?(:'created_at')
207
+ self.created_at = attributes[:'created_at']
208
+ else
209
+ self.created_at = nil
210
+ end
211
+
212
+ if attributes.key?(:'updated_at')
213
+ self.updated_at = attributes[:'updated_at']
214
+ else
215
+ self.updated_at = nil
216
+ end
217
+ end
218
+
219
+ # Show invalid properties with the reasons. Usually used together with valid?
220
+ # @return Array for valid properties with the reasons
221
+ def list_invalid_properties
222
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
223
+ invalid_properties = Array.new
224
+ if @id.nil?
225
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
226
+ end
227
+
228
+ if @name.nil?
229
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
230
+ end
231
+
232
+ if @metric_id.nil?
233
+ invalid_properties.push('invalid value for "metric_id", metric_id cannot be nil.')
234
+ end
235
+
236
+ if @comparator.nil?
237
+ invalid_properties.push('invalid value for "comparator", comparator cannot be nil.')
238
+ end
239
+
240
+ if @threshold.nil?
241
+ invalid_properties.push('invalid value for "threshold", threshold cannot be nil.')
242
+ end
243
+
244
+ if @window_hours.nil?
245
+ invalid_properties.push('invalid value for "window_hours", window_hours cannot be nil.')
246
+ end
247
+
248
+ if @window_hours > 9007199254740991
249
+ invalid_properties.push('invalid value for "window_hours", must be smaller than or equal to 9007199254740991.')
250
+ end
251
+
252
+ if @window_hours < -9007199254740991
253
+ invalid_properties.push('invalid value for "window_hours", must be greater than or equal to -9007199254740991.')
254
+ end
255
+
256
+ if @severity.nil?
257
+ invalid_properties.push('invalid value for "severity", severity cannot be nil.')
258
+ end
259
+
260
+ if @enabled.nil?
261
+ invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
262
+ end
263
+
264
+ if @created_at.nil?
265
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
266
+ end
267
+
268
+ if @updated_at.nil?
269
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
270
+ end
271
+
272
+ invalid_properties
273
+ end
274
+
275
+ # Check to see if the all the properties in the model are valid
276
+ # @return true if the model is valid
277
+ def valid?
278
+ warn '[DEPRECATED] the `valid?` method is obsolete'
279
+ return false if @id.nil?
280
+ return false if @name.nil?
281
+ return false if @metric_id.nil?
282
+ return false if @comparator.nil?
283
+ comparator_validator = EnumAttributeValidator.new('String', ["gt", "gte", "lt", "lte"])
284
+ return false unless comparator_validator.valid?(@comparator)
285
+ return false if @threshold.nil?
286
+ return false if @window_hours.nil?
287
+ return false if @window_hours > 9007199254740991
288
+ return false if @window_hours < -9007199254740991
289
+ return false if @severity.nil?
290
+ severity_validator = EnumAttributeValidator.new('String', ["danger", "warn", "info"])
291
+ return false unless severity_validator.valid?(@severity)
292
+ return false if @enabled.nil?
293
+ return false if @created_at.nil?
294
+ return false if @updated_at.nil?
295
+ true
296
+ end
297
+
298
+ # Custom attribute writer method with validation
299
+ # @param [Object] id Value to be assigned
300
+ def id=(id)
301
+ if id.nil?
302
+ fail ArgumentError, 'id cannot be nil'
303
+ end
304
+
305
+ @id = id
306
+ end
307
+
308
+ # Custom attribute writer method with validation
309
+ # @param [Object] name Value to be assigned
310
+ def name=(name)
311
+ if name.nil?
312
+ fail ArgumentError, 'name cannot be nil'
313
+ end
314
+
315
+ @name = name
316
+ end
317
+
318
+ # Custom attribute writer method with validation
319
+ # @param [Object] metric_id Value to be assigned
320
+ def metric_id=(metric_id)
321
+ if metric_id.nil?
322
+ fail ArgumentError, 'metric_id cannot be nil'
323
+ end
324
+
325
+ @metric_id = metric_id
326
+ end
327
+
328
+ # Custom attribute writer method checking allowed values (enum).
329
+ # @param [Object] comparator Object to be assigned
330
+ def comparator=(comparator)
331
+ validator = EnumAttributeValidator.new('String', ["gt", "gte", "lt", "lte"])
332
+ unless validator.valid?(comparator)
333
+ fail ArgumentError, "invalid value for \"comparator\", must be one of #{validator.allowable_values}."
334
+ end
335
+ @comparator = comparator
336
+ end
337
+
338
+ # Custom attribute writer method with validation
339
+ # @param [Object] threshold Value to be assigned
340
+ def threshold=(threshold)
341
+ if threshold.nil?
342
+ fail ArgumentError, 'threshold cannot be nil'
343
+ end
344
+
345
+ @threshold = threshold
346
+ end
347
+
348
+ # Custom attribute writer method with validation
349
+ # @param [Object] window_hours Value to be assigned
350
+ def window_hours=(window_hours)
351
+ if window_hours.nil?
352
+ fail ArgumentError, 'window_hours cannot be nil'
353
+ end
354
+
355
+ if window_hours > 9007199254740991
356
+ fail ArgumentError, 'invalid value for "window_hours", must be smaller than or equal to 9007199254740991.'
357
+ end
358
+
359
+ if window_hours < -9007199254740991
360
+ fail ArgumentError, 'invalid value for "window_hours", must be greater than or equal to -9007199254740991.'
361
+ end
362
+
363
+ @window_hours = window_hours
364
+ end
365
+
366
+ # Custom attribute writer method checking allowed values (enum).
367
+ # @param [Object] severity Object to be assigned
368
+ def severity=(severity)
369
+ validator = EnumAttributeValidator.new('String', ["danger", "warn", "info"])
370
+ unless validator.valid?(severity)
371
+ fail ArgumentError, "invalid value for \"severity\", must be one of #{validator.allowable_values}."
372
+ end
373
+ @severity = severity
374
+ end
375
+
376
+ # Custom attribute writer method with validation
377
+ # @param [Object] enabled Value to be assigned
378
+ def enabled=(enabled)
379
+ if enabled.nil?
380
+ fail ArgumentError, 'enabled cannot be nil'
381
+ end
382
+
383
+ @enabled = enabled
384
+ end
385
+
386
+ # Custom attribute writer method with validation
387
+ # @param [Object] created_at Value to be assigned
388
+ def created_at=(created_at)
389
+ if created_at.nil?
390
+ fail ArgumentError, 'created_at cannot be nil'
391
+ end
392
+
393
+ @created_at = created_at
394
+ end
395
+
396
+ # Custom attribute writer method with validation
397
+ # @param [Object] updated_at Value to be assigned
398
+ def updated_at=(updated_at)
399
+ if updated_at.nil?
400
+ fail ArgumentError, 'updated_at cannot be nil'
401
+ end
402
+
403
+ @updated_at = updated_at
404
+ end
405
+
406
+ # Checks equality by comparing each attribute.
407
+ # @param [Object] Object to be compared
408
+ def ==(o)
409
+ return true if self.equal?(o)
410
+ self.class == o.class &&
411
+ id == o.id &&
412
+ name == o.name &&
413
+ metric_id == o.metric_id &&
414
+ metric_name == o.metric_name &&
415
+ comparator == o.comparator &&
416
+ threshold == o.threshold &&
417
+ window_hours == o.window_hours &&
418
+ severity == o.severity &&
419
+ enabled == o.enabled &&
420
+ notify == o.notify &&
421
+ created_at == o.created_at &&
422
+ updated_at == o.updated_at
423
+ end
424
+
425
+ # @see the `==` method
426
+ # @param [Object] Object to be compared
427
+ def eql?(o)
428
+ self == o
429
+ end
430
+
431
+ # Calculates hash code according to all attributes.
432
+ # @return [Integer] Hash code
433
+ def hash
434
+ [id, name, metric_id, metric_name, comparator, threshold, window_hours, severity, enabled, notify, created_at, updated_at].hash
435
+ end
436
+
437
+ # Builds the object from hash
438
+ # @param [Hash] attributes Model attributes in the form of hash
439
+ # @return [Object] Returns the model itself
440
+ def self.build_from_hash(attributes)
441
+ return nil unless attributes.is_a?(Hash)
442
+ attributes = attributes.transform_keys(&:to_sym)
443
+ transformed_hash = {}
444
+ openapi_types.each_pair do |key, type|
445
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
446
+ transformed_hash["#{key}"] = nil
447
+ elsif type =~ /\AArray<(.*)>/i
448
+ # check to ensure the input is an array given that the attribute
449
+ # is documented as an array but the input is not
450
+ if attributes[attribute_map[key]].is_a?(Array)
451
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
452
+ end
453
+ elsif !attributes[attribute_map[key]].nil?
454
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
455
+ end
456
+ end
457
+ new(transformed_hash)
458
+ end
459
+
460
+ # Returns the object in the form of hash
461
+ # @return [Hash] Returns the object in the form of hash
462
+ def to_hash
463
+ hash = {}
464
+ self.class.attribute_map.each_pair do |attr, param|
465
+ value = self.send(attr)
466
+ if value.nil?
467
+ is_nullable = self.class.openapi_nullable.include?(attr)
468
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
469
+ end
470
+
471
+ hash[param] = _to_hash(value)
472
+ end
473
+ hash
474
+ end
475
+
476
+ end
477
+
478
+ end
@@ -0,0 +1,177 @@
1
+ =begin
2
+ #Shipeasy Admin API
3
+
4
+ #REST API for managing feature gates, experiments, configs, universes, and killswitches in a Shipeasy project. Authenticate with an admin SDK key (`Authorization: Bearer sdk_admin_…`) and scope every request to a project via the `X-Project-Id` header. Mint admin keys via `POST /api/admin/keys` with `type: \"admin\"`. Keys expire after 90 days; rotate with the `revoke` action.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.23.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Shipeasy::Admin::Generated
17
+ # Delivery target for this rule's alert; `null` = use the project default.
18
+ class ListAlertRulesResponseInnerNotify < ApiModelBase
19
+ attr_accessor :slack_channel
20
+
21
+ # Email address to notify for this rule (overrides the default recipient).
22
+ attr_accessor :email
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'slack_channel' => :'slackChannel',
28
+ :'email' => :'email'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'slack_channel' => :'ListAlertRulesResponseInnerNotifySlackChannel',
46
+ :'email' => :'String'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ :'slack_channel',
54
+ :'email'
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::ListAlertRulesResponseInnerNotify` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::ListAlertRulesResponseInnerNotify`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'slack_channel')
75
+ self.slack_channel = attributes[:'slack_channel']
76
+ end
77
+
78
+ if attributes.key?(:'email')
79
+ self.email = attributes[:'email']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
+ invalid_properties = Array.new
88
+ pattern = Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/)
89
+ if !@email.nil? && @email !~ pattern
90
+ invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.")
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
+ return false if !@email.nil? && @email !~ Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/)
101
+ true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] email Value to be assigned
106
+ def email=(email)
107
+ pattern = Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/)
108
+ if !email.nil? && email !~ pattern
109
+ fail ArgumentError, "invalid value for \"email\", must conform to the pattern #{pattern}."
110
+ end
111
+
112
+ @email = email
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ slack_channel == o.slack_channel &&
121
+ email == o.email
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [slack_channel, email].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ transformed_hash = {}
143
+ openapi_types.each_pair do |key, type|
144
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[attribute_map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ self.class.attribute_map.each_pair do |attr, param|
164
+ value = self.send(attr)
165
+ if value.nil?
166
+ is_nullable = self.class.openapi_nullable.include?(attr)
167
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
168
+ end
169
+
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ hash
173
+ end
174
+
175
+ end
176
+
177
+ end