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,375 @@
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
+ # Rule-based sub-gate. When the rules match and the caller falls in the per-condition rollout bucket, evaluation short-circuits and the gate returns `true`; otherwise it falls through to the next entry.
18
+ class ListGatesResponseDataInnerStackInnerOneOf < ApiModelBase
19
+ # Client-supplied stable id for the stack entry (used for React keys, audit diffs, and as the default per-condition rollout salt).
20
+ attr_accessor :id
21
+
22
+ # Discriminator. `condition` = rule-based predicate sub-gate.
23
+ attr_accessor :type
24
+
25
+ # Human label shown in the dashboard.
26
+ attr_accessor :name
27
+
28
+ # Id of the project template this entry was seeded from, or `null` if hand-authored.
29
+ attr_accessor :from_template
30
+
31
+ # Combinator across `rules`. `all` = AND (default), `any` = OR.
32
+ attr_accessor :pass
33
+
34
+ # Predicates evaluated under `pass`. Empty array = match nothing.
35
+ attr_accessor :rules
36
+
37
+ # Per-condition rollout in basis points. After the rules match, the caller is bucketed at this %; in-bucket → gate `true`, otherwise fall through to the next entry. Absent ⇒ 10000 (100%, every matching caller passes).
38
+ attr_accessor :rollout_pct
39
+
40
+ # Attribute used to hash the caller into the per-condition bucket. Default `userID`.
41
+ attr_accessor :bucket_by
42
+
43
+ # Per-condition hash salt. Defaults to the entry `id`, then the gate salt.
44
+ attr_accessor :salt
45
+
46
+ attr_accessor :ramp
47
+
48
+ # If `true`, dashboard hides edit controls (e.g. the trailing public-floor entry).
49
+ attr_accessor :locked
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'id' => :'id',
77
+ :'type' => :'type',
78
+ :'name' => :'name',
79
+ :'from_template' => :'fromTemplate',
80
+ :'pass' => :'pass',
81
+ :'rules' => :'rules',
82
+ :'rollout_pct' => :'rolloutPct',
83
+ :'bucket_by' => :'bucketBy',
84
+ :'salt' => :'salt',
85
+ :'ramp' => :'ramp',
86
+ :'locked' => :'locked'
87
+ }
88
+ end
89
+
90
+ # Returns attribute mapping this model knows about
91
+ def self.acceptable_attribute_map
92
+ attribute_map
93
+ end
94
+
95
+ # Returns all the JSON keys this model knows about
96
+ def self.acceptable_attributes
97
+ acceptable_attribute_map.values
98
+ end
99
+
100
+ # Attribute type mapping.
101
+ def self.openapi_types
102
+ {
103
+ :'id' => :'String',
104
+ :'type' => :'String',
105
+ :'name' => :'String',
106
+ :'from_template' => :'String',
107
+ :'pass' => :'String',
108
+ :'rules' => :'Array<ListGatesResponseDataInnerRulesInner>',
109
+ :'rollout_pct' => :'Integer',
110
+ :'bucket_by' => :'String',
111
+ :'salt' => :'String',
112
+ :'ramp' => :'ListGatesResponseDataInnerStackInnerOneOfRamp',
113
+ :'locked' => :'Boolean'
114
+ }
115
+ end
116
+
117
+ # List of attributes with nullable: true
118
+ def self.openapi_nullable
119
+ Set.new([
120
+ :'from_template',
121
+ ])
122
+ end
123
+
124
+ # Initializes the object
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ def initialize(attributes = {})
127
+ if (!attributes.is_a?(Hash))
128
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::ListGatesResponseDataInnerStackInnerOneOf` initialize method"
129
+ end
130
+
131
+ # check to see if the attribute exists and convert string to symbol for hash key
132
+ acceptable_attribute_map = self.class.acceptable_attribute_map
133
+ attributes = attributes.each_with_object({}) { |(k, v), h|
134
+ if (!acceptable_attribute_map.key?(k.to_sym))
135
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::ListGatesResponseDataInnerStackInnerOneOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
136
+ end
137
+ h[k.to_sym] = v
138
+ }
139
+
140
+ if attributes.key?(:'id')
141
+ self.id = attributes[:'id']
142
+ else
143
+ self.id = nil
144
+ end
145
+
146
+ if attributes.key?(:'type')
147
+ self.type = attributes[:'type']
148
+ else
149
+ self.type = nil
150
+ end
151
+
152
+ if attributes.key?(:'name')
153
+ self.name = attributes[:'name']
154
+ end
155
+
156
+ if attributes.key?(:'from_template')
157
+ self.from_template = attributes[:'from_template']
158
+ end
159
+
160
+ if attributes.key?(:'pass')
161
+ self.pass = attributes[:'pass']
162
+ end
163
+
164
+ if attributes.key?(:'rules')
165
+ if (value = attributes[:'rules']).is_a?(Array)
166
+ self.rules = value
167
+ end
168
+ else
169
+ self.rules = nil
170
+ end
171
+
172
+ if attributes.key?(:'rollout_pct')
173
+ self.rollout_pct = attributes[:'rollout_pct']
174
+ end
175
+
176
+ if attributes.key?(:'bucket_by')
177
+ self.bucket_by = attributes[:'bucket_by']
178
+ end
179
+
180
+ if attributes.key?(:'salt')
181
+ self.salt = attributes[:'salt']
182
+ end
183
+
184
+ if attributes.key?(:'ramp')
185
+ self.ramp = attributes[:'ramp']
186
+ end
187
+
188
+ if attributes.key?(:'locked')
189
+ self.locked = attributes[:'locked']
190
+ end
191
+ end
192
+
193
+ # Show invalid properties with the reasons. Usually used together with valid?
194
+ # @return Array for valid properties with the reasons
195
+ def list_invalid_properties
196
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
197
+ invalid_properties = Array.new
198
+ if @id.nil?
199
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
200
+ end
201
+
202
+ if @id.to_s.length < 1
203
+ invalid_properties.push('invalid value for "id", the character length must be greater than or equal to 1.')
204
+ end
205
+
206
+ if @type.nil?
207
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
208
+ end
209
+
210
+ if @rules.nil?
211
+ invalid_properties.push('invalid value for "rules", rules cannot be nil.')
212
+ end
213
+
214
+ if !@rollout_pct.nil? && @rollout_pct > 10000
215
+ invalid_properties.push('invalid value for "rollout_pct", must be smaller than or equal to 10000.')
216
+ end
217
+
218
+ if !@rollout_pct.nil? && @rollout_pct < 0
219
+ invalid_properties.push('invalid value for "rollout_pct", must be greater than or equal to 0.')
220
+ end
221
+
222
+ invalid_properties
223
+ end
224
+
225
+ # Check to see if the all the properties in the model are valid
226
+ # @return true if the model is valid
227
+ def valid?
228
+ warn '[DEPRECATED] the `valid?` method is obsolete'
229
+ return false if @id.nil?
230
+ return false if @id.to_s.length < 1
231
+ return false if @type.nil?
232
+ type_validator = EnumAttributeValidator.new('String', ["condition"])
233
+ return false unless type_validator.valid?(@type)
234
+ pass_validator = EnumAttributeValidator.new('String', ["all", "any"])
235
+ return false unless pass_validator.valid?(@pass)
236
+ return false if @rules.nil?
237
+ return false if !@rollout_pct.nil? && @rollout_pct > 10000
238
+ return false if !@rollout_pct.nil? && @rollout_pct < 0
239
+ true
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] id Value to be assigned
244
+ def id=(id)
245
+ if id.nil?
246
+ fail ArgumentError, 'id cannot be nil'
247
+ end
248
+
249
+ if id.to_s.length < 1
250
+ fail ArgumentError, 'invalid value for "id", the character length must be greater than or equal to 1.'
251
+ end
252
+
253
+ @id = id
254
+ end
255
+
256
+ # Custom attribute writer method checking allowed values (enum).
257
+ # @param [Object] type Object to be assigned
258
+ def type=(type)
259
+ validator = EnumAttributeValidator.new('String', ["condition"])
260
+ unless validator.valid?(type)
261
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
262
+ end
263
+ @type = type
264
+ end
265
+
266
+ # Custom attribute writer method checking allowed values (enum).
267
+ # @param [Object] pass Object to be assigned
268
+ def pass=(pass)
269
+ validator = EnumAttributeValidator.new('String', ["all", "any"])
270
+ unless validator.valid?(pass)
271
+ fail ArgumentError, "invalid value for \"pass\", must be one of #{validator.allowable_values}."
272
+ end
273
+ @pass = pass
274
+ end
275
+
276
+ # Custom attribute writer method with validation
277
+ # @param [Object] rules Value to be assigned
278
+ def rules=(rules)
279
+ if rules.nil?
280
+ fail ArgumentError, 'rules cannot be nil'
281
+ end
282
+
283
+ @rules = rules
284
+ end
285
+
286
+ # Custom attribute writer method with validation
287
+ # @param [Object] rollout_pct Value to be assigned
288
+ def rollout_pct=(rollout_pct)
289
+ if rollout_pct.nil?
290
+ fail ArgumentError, 'rollout_pct cannot be nil'
291
+ end
292
+
293
+ if rollout_pct > 10000
294
+ fail ArgumentError, 'invalid value for "rollout_pct", must be smaller than or equal to 10000.'
295
+ end
296
+
297
+ if rollout_pct < 0
298
+ fail ArgumentError, 'invalid value for "rollout_pct", must be greater than or equal to 0.'
299
+ end
300
+
301
+ @rollout_pct = rollout_pct
302
+ end
303
+
304
+ # Checks equality by comparing each attribute.
305
+ # @param [Object] Object to be compared
306
+ def ==(o)
307
+ return true if self.equal?(o)
308
+ self.class == o.class &&
309
+ id == o.id &&
310
+ type == o.type &&
311
+ name == o.name &&
312
+ from_template == o.from_template &&
313
+ pass == o.pass &&
314
+ rules == o.rules &&
315
+ rollout_pct == o.rollout_pct &&
316
+ bucket_by == o.bucket_by &&
317
+ salt == o.salt &&
318
+ ramp == o.ramp &&
319
+ locked == o.locked
320
+ end
321
+
322
+ # @see the `==` method
323
+ # @param [Object] Object to be compared
324
+ def eql?(o)
325
+ self == o
326
+ end
327
+
328
+ # Calculates hash code according to all attributes.
329
+ # @return [Integer] Hash code
330
+ def hash
331
+ [id, type, name, from_template, pass, rules, rollout_pct, bucket_by, salt, ramp, locked].hash
332
+ end
333
+
334
+ # Builds the object from hash
335
+ # @param [Hash] attributes Model attributes in the form of hash
336
+ # @return [Object] Returns the model itself
337
+ def self.build_from_hash(attributes)
338
+ return nil unless attributes.is_a?(Hash)
339
+ attributes = attributes.transform_keys(&:to_sym)
340
+ transformed_hash = {}
341
+ openapi_types.each_pair do |key, type|
342
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
343
+ transformed_hash["#{key}"] = nil
344
+ elsif type =~ /\AArray<(.*)>/i
345
+ # check to ensure the input is an array given that the attribute
346
+ # is documented as an array but the input is not
347
+ if attributes[attribute_map[key]].is_a?(Array)
348
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
349
+ end
350
+ elsif !attributes[attribute_map[key]].nil?
351
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
352
+ end
353
+ end
354
+ new(transformed_hash)
355
+ end
356
+
357
+ # Returns the object in the form of hash
358
+ # @return [Hash] Returns the object in the form of hash
359
+ def to_hash
360
+ hash = {}
361
+ self.class.attribute_map.each_pair do |attr, param|
362
+ value = self.send(attr)
363
+ if value.nil?
364
+ is_nullable = self.class.openapi_nullable.include?(attr)
365
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
366
+ end
367
+
368
+ hash[param] = _to_hash(value)
369
+ end
370
+ hash
371
+ end
372
+
373
+ end
374
+
375
+ end
@@ -0,0 +1,331 @@
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
+ # Percentage-rollout sub-gate. Hashes `bucketBy` (default `userID`) with `salt` and returns `true` for `rolloutPct/10000` fraction of callers (or the ramp's effective % when `ramp` is set).
18
+ class ListGatesResponseDataInnerStackInnerOneOf1 < ApiModelBase
19
+ # Client-supplied stable id for the stack entry.
20
+ attr_accessor :id
21
+
22
+ # Discriminator. `rollout` = percentage-bucket sub-gate.
23
+ attr_accessor :type
24
+
25
+ # Human label shown in the dashboard.
26
+ attr_accessor :name
27
+
28
+ # Source template id, or `null`.
29
+ attr_accessor :from_template
30
+
31
+ # Bucket size in basis points (0–10000 = 0%–100%). `5000` = 50%, `100` = 1%, allows sub-1% precision.
32
+ attr_accessor :rollout_pct
33
+
34
+ # Attribute used to hash the caller into a bucket. Defaults to `user.userID`. Use e.g. `accountID` to bucket whole accounts together.
35
+ attr_accessor :bucket_by
36
+
37
+ # Per-entry hash salt. Defaults to the gate's salt. Set explicitly to keep two rollouts independent or correlated across gates.
38
+ attr_accessor :salt
39
+
40
+ attr_accessor :ramp
41
+
42
+ # If `true`, dashboard hides edit controls.
43
+ attr_accessor :locked
44
+
45
+ class EnumAttributeValidator
46
+ attr_reader :datatype
47
+ attr_reader :allowable_values
48
+
49
+ def initialize(datatype, allowable_values)
50
+ @allowable_values = allowable_values.map do |value|
51
+ case datatype.to_s
52
+ when /Integer/i
53
+ value.to_i
54
+ when /Float/i
55
+ value.to_f
56
+ else
57
+ value
58
+ end
59
+ end
60
+ end
61
+
62
+ def valid?(value)
63
+ !value || allowable_values.include?(value)
64
+ end
65
+ end
66
+
67
+ # Attribute mapping from ruby-style variable name to JSON key.
68
+ def self.attribute_map
69
+ {
70
+ :'id' => :'id',
71
+ :'type' => :'type',
72
+ :'name' => :'name',
73
+ :'from_template' => :'fromTemplate',
74
+ :'rollout_pct' => :'rolloutPct',
75
+ :'bucket_by' => :'bucketBy',
76
+ :'salt' => :'salt',
77
+ :'ramp' => :'ramp',
78
+ :'locked' => :'locked'
79
+ }
80
+ end
81
+
82
+ # Returns attribute mapping this model knows about
83
+ def self.acceptable_attribute_map
84
+ attribute_map
85
+ end
86
+
87
+ # Returns all the JSON keys this model knows about
88
+ def self.acceptable_attributes
89
+ acceptable_attribute_map.values
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'id' => :'String',
96
+ :'type' => :'String',
97
+ :'name' => :'String',
98
+ :'from_template' => :'String',
99
+ :'rollout_pct' => :'Integer',
100
+ :'bucket_by' => :'String',
101
+ :'salt' => :'String',
102
+ :'ramp' => :'ListGatesResponseDataInnerStackInnerOneOfRamp',
103
+ :'locked' => :'Boolean'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ :'from_template',
111
+ ])
112
+ end
113
+
114
+ # Initializes the object
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ def initialize(attributes = {})
117
+ if (!attributes.is_a?(Hash))
118
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::ListGatesResponseDataInnerStackInnerOneOf1` initialize method"
119
+ end
120
+
121
+ # check to see if the attribute exists and convert string to symbol for hash key
122
+ acceptable_attribute_map = self.class.acceptable_attribute_map
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!acceptable_attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::ListGatesResponseDataInnerStackInnerOneOf1`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'id')
131
+ self.id = attributes[:'id']
132
+ else
133
+ self.id = nil
134
+ end
135
+
136
+ if attributes.key?(:'type')
137
+ self.type = attributes[:'type']
138
+ else
139
+ self.type = nil
140
+ end
141
+
142
+ if attributes.key?(:'name')
143
+ self.name = attributes[:'name']
144
+ end
145
+
146
+ if attributes.key?(:'from_template')
147
+ self.from_template = attributes[:'from_template']
148
+ end
149
+
150
+ if attributes.key?(:'rollout_pct')
151
+ self.rollout_pct = attributes[:'rollout_pct']
152
+ else
153
+ self.rollout_pct = nil
154
+ end
155
+
156
+ if attributes.key?(:'bucket_by')
157
+ self.bucket_by = attributes[:'bucket_by']
158
+ end
159
+
160
+ if attributes.key?(:'salt')
161
+ self.salt = attributes[:'salt']
162
+ end
163
+
164
+ if attributes.key?(:'ramp')
165
+ self.ramp = attributes[:'ramp']
166
+ end
167
+
168
+ if attributes.key?(:'locked')
169
+ self.locked = attributes[:'locked']
170
+ end
171
+ end
172
+
173
+ # Show invalid properties with the reasons. Usually used together with valid?
174
+ # @return Array for valid properties with the reasons
175
+ def list_invalid_properties
176
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
177
+ invalid_properties = Array.new
178
+ if @id.nil?
179
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
180
+ end
181
+
182
+ if @id.to_s.length < 1
183
+ invalid_properties.push('invalid value for "id", the character length must be greater than or equal to 1.')
184
+ end
185
+
186
+ if @type.nil?
187
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
188
+ end
189
+
190
+ if @rollout_pct.nil?
191
+ invalid_properties.push('invalid value for "rollout_pct", rollout_pct cannot be nil.')
192
+ end
193
+
194
+ if @rollout_pct > 10000
195
+ invalid_properties.push('invalid value for "rollout_pct", must be smaller than or equal to 10000.')
196
+ end
197
+
198
+ if @rollout_pct < 0
199
+ invalid_properties.push('invalid value for "rollout_pct", must be greater than or equal to 0.')
200
+ end
201
+
202
+ invalid_properties
203
+ end
204
+
205
+ # Check to see if the all the properties in the model are valid
206
+ # @return true if the model is valid
207
+ def valid?
208
+ warn '[DEPRECATED] the `valid?` method is obsolete'
209
+ return false if @id.nil?
210
+ return false if @id.to_s.length < 1
211
+ return false if @type.nil?
212
+ type_validator = EnumAttributeValidator.new('String', ["rollout"])
213
+ return false unless type_validator.valid?(@type)
214
+ return false if @rollout_pct.nil?
215
+ return false if @rollout_pct > 10000
216
+ return false if @rollout_pct < 0
217
+ true
218
+ end
219
+
220
+ # Custom attribute writer method with validation
221
+ # @param [Object] id Value to be assigned
222
+ def id=(id)
223
+ if id.nil?
224
+ fail ArgumentError, 'id cannot be nil'
225
+ end
226
+
227
+ if id.to_s.length < 1
228
+ fail ArgumentError, 'invalid value for "id", the character length must be greater than or equal to 1.'
229
+ end
230
+
231
+ @id = id
232
+ end
233
+
234
+ # Custom attribute writer method checking allowed values (enum).
235
+ # @param [Object] type Object to be assigned
236
+ def type=(type)
237
+ validator = EnumAttributeValidator.new('String', ["rollout"])
238
+ unless validator.valid?(type)
239
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
240
+ end
241
+ @type = type
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] rollout_pct Value to be assigned
246
+ def rollout_pct=(rollout_pct)
247
+ if rollout_pct.nil?
248
+ fail ArgumentError, 'rollout_pct cannot be nil'
249
+ end
250
+
251
+ if rollout_pct > 10000
252
+ fail ArgumentError, 'invalid value for "rollout_pct", must be smaller than or equal to 10000.'
253
+ end
254
+
255
+ if rollout_pct < 0
256
+ fail ArgumentError, 'invalid value for "rollout_pct", must be greater than or equal to 0.'
257
+ end
258
+
259
+ @rollout_pct = rollout_pct
260
+ end
261
+
262
+ # Checks equality by comparing each attribute.
263
+ # @param [Object] Object to be compared
264
+ def ==(o)
265
+ return true if self.equal?(o)
266
+ self.class == o.class &&
267
+ id == o.id &&
268
+ type == o.type &&
269
+ name == o.name &&
270
+ from_template == o.from_template &&
271
+ rollout_pct == o.rollout_pct &&
272
+ bucket_by == o.bucket_by &&
273
+ salt == o.salt &&
274
+ ramp == o.ramp &&
275
+ locked == o.locked
276
+ end
277
+
278
+ # @see the `==` method
279
+ # @param [Object] Object to be compared
280
+ def eql?(o)
281
+ self == o
282
+ end
283
+
284
+ # Calculates hash code according to all attributes.
285
+ # @return [Integer] Hash code
286
+ def hash
287
+ [id, type, name, from_template, rollout_pct, bucket_by, salt, ramp, locked].hash
288
+ end
289
+
290
+ # Builds the object from hash
291
+ # @param [Hash] attributes Model attributes in the form of hash
292
+ # @return [Object] Returns the model itself
293
+ def self.build_from_hash(attributes)
294
+ return nil unless attributes.is_a?(Hash)
295
+ attributes = attributes.transform_keys(&:to_sym)
296
+ transformed_hash = {}
297
+ openapi_types.each_pair do |key, type|
298
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
299
+ transformed_hash["#{key}"] = nil
300
+ elsif type =~ /\AArray<(.*)>/i
301
+ # check to ensure the input is an array given that the attribute
302
+ # is documented as an array but the input is not
303
+ if attributes[attribute_map[key]].is_a?(Array)
304
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
305
+ end
306
+ elsif !attributes[attribute_map[key]].nil?
307
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
308
+ end
309
+ end
310
+ new(transformed_hash)
311
+ end
312
+
313
+ # Returns the object in the form of hash
314
+ # @return [Hash] Returns the object in the form of hash
315
+ def to_hash
316
+ hash = {}
317
+ self.class.attribute_map.each_pair do |attr, param|
318
+ value = self.send(attr)
319
+ if value.nil?
320
+ is_nullable = self.class.openapi_nullable.include?(attr)
321
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
322
+ end
323
+
324
+ hash[param] = _to_hash(value)
325
+ end
326
+ hash
327
+ end
328
+
329
+ end
330
+
331
+ end