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,746 @@
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
+ # Body for `PATCH /api/admin/experiments/{id}`. Partial — only supplied fields change. `allocation_pct`, `groups`, `salt`, `universe`, `params` are immutable while the experiment is running (stop first).
18
+ class UpdateExperimentRequest < ApiModelBase
19
+ # Stable experiment key. Single segment or `folder.name` (a-z, 0-9, `_`/`-`; max 128 chars). Used by SDKs as `Shipeasy.getExperiment(user, '<name>')`. Immutable after create.
20
+ attr_accessor :name
21
+
22
+ attr_accessor :description
23
+
24
+ attr_accessor :hypothesis
25
+
26
+ attr_accessor :tag
27
+
28
+ attr_accessor :owner_email
29
+
30
+ attr_accessor :audience
31
+
32
+ # User-attribute name used as the bucketing key — e.g. `user_id` (default), `session_id`, `device_id`, or a custom attribute like `company_id` to keep a whole org on one variant. Defaults to `user_id` when omitted.
33
+ attr_accessor :bucket_by
34
+
35
+ # Optional folder name used to group items in the dashboard. Part of the SDK lookup key: an item in folder `checkout` named `new-cart` is referenced as `checkout/new-cart` from the SDK.
36
+ attr_accessor :folder
37
+
38
+ attr_accessor :targeting_gate
39
+
40
+ # Basis-points allocation (0–10000). Use `allocation_percent` (0–100) for percent. Immutable while the experiment is running.
41
+ attr_accessor :allocation_pct
42
+
43
+ # Allocation as a **percentage** (0–100). Friendlier alias for `allocation_pct`; converted to basis points server-side. Wins over `allocation_pct` if both are supplied. Immutable while running.
44
+ attr_accessor :allocation_percent
45
+
46
+ # Hash salt. Immutable while running.
47
+ attr_accessor :salt
48
+
49
+ # New universe name. Immutable while running. Returns `422` if the universe doesn't exist.
50
+ attr_accessor :universe
51
+
52
+ # Map of param-name → scalar type. Defines the shape of `groups[].params`. Example: `{ headline: 'string', show_cta: 'bool' }`.
53
+ attr_accessor :params
54
+
55
+ # Replacement groups. Weights must sum to 10000. Immutable while running.
56
+ attr_accessor :groups
57
+
58
+ attr_accessor :significance_threshold
59
+
60
+ attr_accessor :min_runtime_days
61
+
62
+ attr_accessor :min_sample_size
63
+
64
+ attr_accessor :sequential_testing
65
+
66
+ attr_accessor :goal_metric
67
+
68
+ # Replaces the guardrail set wholesale (event auto-upserted per entry).
69
+ attr_accessor :guardrail_metrics
70
+
71
+ class EnumAttributeValidator
72
+ attr_reader :datatype
73
+ attr_reader :allowable_values
74
+
75
+ def initialize(datatype, allowable_values)
76
+ @allowable_values = allowable_values.map do |value|
77
+ case datatype.to_s
78
+ when /Integer/i
79
+ value.to_i
80
+ when /Float/i
81
+ value.to_f
82
+ else
83
+ value
84
+ end
85
+ end
86
+ end
87
+
88
+ def valid?(value)
89
+ !value || allowable_values.include?(value)
90
+ end
91
+ end
92
+
93
+ # Attribute mapping from ruby-style variable name to JSON key.
94
+ def self.attribute_map
95
+ {
96
+ :'name' => :'name',
97
+ :'description' => :'description',
98
+ :'hypothesis' => :'hypothesis',
99
+ :'tag' => :'tag',
100
+ :'owner_email' => :'owner_email',
101
+ :'audience' => :'audience',
102
+ :'bucket_by' => :'bucket_by',
103
+ :'folder' => :'folder',
104
+ :'targeting_gate' => :'targeting_gate',
105
+ :'allocation_pct' => :'allocation_pct',
106
+ :'allocation_percent' => :'allocation_percent',
107
+ :'salt' => :'salt',
108
+ :'universe' => :'universe',
109
+ :'params' => :'params',
110
+ :'groups' => :'groups',
111
+ :'significance_threshold' => :'significance_threshold',
112
+ :'min_runtime_days' => :'min_runtime_days',
113
+ :'min_sample_size' => :'min_sample_size',
114
+ :'sequential_testing' => :'sequential_testing',
115
+ :'goal_metric' => :'goal_metric',
116
+ :'guardrail_metrics' => :'guardrail_metrics'
117
+ }
118
+ end
119
+
120
+ # Returns attribute mapping this model knows about
121
+ def self.acceptable_attribute_map
122
+ attribute_map
123
+ end
124
+
125
+ # Returns all the JSON keys this model knows about
126
+ def self.acceptable_attributes
127
+ acceptable_attribute_map.values
128
+ end
129
+
130
+ # Attribute type mapping.
131
+ def self.openapi_types
132
+ {
133
+ :'name' => :'String',
134
+ :'description' => :'String',
135
+ :'hypothesis' => :'String',
136
+ :'tag' => :'String',
137
+ :'owner_email' => :'String',
138
+ :'audience' => :'String',
139
+ :'bucket_by' => :'String',
140
+ :'folder' => :'String',
141
+ :'targeting_gate' => :'String',
142
+ :'allocation_pct' => :'Integer',
143
+ :'allocation_percent' => :'Float',
144
+ :'salt' => :'String',
145
+ :'universe' => :'String',
146
+ :'params' => :'Hash<String, String>',
147
+ :'groups' => :'Array<ListExperimentsResponseDataInnerGroupsInner>',
148
+ :'significance_threshold' => :'Float',
149
+ :'min_runtime_days' => :'Integer',
150
+ :'min_sample_size' => :'Integer',
151
+ :'sequential_testing' => :'Boolean',
152
+ :'goal_metric' => :'CreateExperimentRequestGoalMetric',
153
+ :'guardrail_metrics' => :'Array<CreateExperimentRequestGoalMetric>'
154
+ }
155
+ end
156
+
157
+ # List of attributes with nullable: true
158
+ def self.openapi_nullable
159
+ Set.new([
160
+ :'description',
161
+ :'hypothesis',
162
+ :'tag',
163
+ :'owner_email',
164
+ :'audience',
165
+ :'bucket_by',
166
+ :'folder',
167
+ :'targeting_gate',
168
+ ])
169
+ end
170
+
171
+ # Initializes the object
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ def initialize(attributes = {})
174
+ if (!attributes.is_a?(Hash))
175
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::UpdateExperimentRequest` initialize method"
176
+ end
177
+
178
+ # check to see if the attribute exists and convert string to symbol for hash key
179
+ acceptable_attribute_map = self.class.acceptable_attribute_map
180
+ attributes = attributes.each_with_object({}) { |(k, v), h|
181
+ if (!acceptable_attribute_map.key?(k.to_sym))
182
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::UpdateExperimentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
183
+ end
184
+ h[k.to_sym] = v
185
+ }
186
+
187
+ if attributes.key?(:'name')
188
+ self.name = attributes[:'name']
189
+ end
190
+
191
+ if attributes.key?(:'description')
192
+ self.description = attributes[:'description']
193
+ end
194
+
195
+ if attributes.key?(:'hypothesis')
196
+ self.hypothesis = attributes[:'hypothesis']
197
+ end
198
+
199
+ if attributes.key?(:'tag')
200
+ self.tag = attributes[:'tag']
201
+ end
202
+
203
+ if attributes.key?(:'owner_email')
204
+ self.owner_email = attributes[:'owner_email']
205
+ end
206
+
207
+ if attributes.key?(:'audience')
208
+ self.audience = attributes[:'audience']
209
+ end
210
+
211
+ if attributes.key?(:'bucket_by')
212
+ self.bucket_by = attributes[:'bucket_by']
213
+ end
214
+
215
+ if attributes.key?(:'folder')
216
+ self.folder = attributes[:'folder']
217
+ end
218
+
219
+ if attributes.key?(:'targeting_gate')
220
+ self.targeting_gate = attributes[:'targeting_gate']
221
+ end
222
+
223
+ if attributes.key?(:'allocation_pct')
224
+ self.allocation_pct = attributes[:'allocation_pct']
225
+ end
226
+
227
+ if attributes.key?(:'allocation_percent')
228
+ self.allocation_percent = attributes[:'allocation_percent']
229
+ end
230
+
231
+ if attributes.key?(:'salt')
232
+ self.salt = attributes[:'salt']
233
+ end
234
+
235
+ if attributes.key?(:'universe')
236
+ self.universe = attributes[:'universe']
237
+ end
238
+
239
+ if attributes.key?(:'params')
240
+ if (value = attributes[:'params']).is_a?(Hash)
241
+ self.params = value
242
+ end
243
+ end
244
+
245
+ if attributes.key?(:'groups')
246
+ if (value = attributes[:'groups']).is_a?(Array)
247
+ self.groups = value
248
+ end
249
+ end
250
+
251
+ if attributes.key?(:'significance_threshold')
252
+ self.significance_threshold = attributes[:'significance_threshold']
253
+ end
254
+
255
+ if attributes.key?(:'min_runtime_days')
256
+ self.min_runtime_days = attributes[:'min_runtime_days']
257
+ end
258
+
259
+ if attributes.key?(:'min_sample_size')
260
+ self.min_sample_size = attributes[:'min_sample_size']
261
+ end
262
+
263
+ if attributes.key?(:'sequential_testing')
264
+ self.sequential_testing = attributes[:'sequential_testing']
265
+ end
266
+
267
+ if attributes.key?(:'goal_metric')
268
+ self.goal_metric = attributes[:'goal_metric']
269
+ end
270
+
271
+ if attributes.key?(:'guardrail_metrics')
272
+ if (value = attributes[:'guardrail_metrics']).is_a?(Array)
273
+ self.guardrail_metrics = value
274
+ end
275
+ end
276
+ end
277
+
278
+ # Show invalid properties with the reasons. Usually used together with valid?
279
+ # @return Array for valid properties with the reasons
280
+ def list_invalid_properties
281
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
282
+ invalid_properties = Array.new
283
+ if !@name.nil? && @name.to_s.length > 128
284
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 128.')
285
+ end
286
+
287
+ pattern = Regexp.new(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/)
288
+ if !@name.nil? && @name !~ pattern
289
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
290
+ end
291
+
292
+ if !@description.nil? && @description.to_s.length > 2000
293
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
294
+ end
295
+
296
+ if !@hypothesis.nil? && @hypothesis.to_s.length > 4000
297
+ invalid_properties.push('invalid value for "hypothesis", the character length must be smaller than or equal to 4000.')
298
+ end
299
+
300
+ if !@tag.nil? && @tag.to_s.length > 64
301
+ invalid_properties.push('invalid value for "tag", the character length must be smaller than or equal to 64.')
302
+ end
303
+
304
+ if !@owner_email.nil? && @owner_email.to_s.length > 254
305
+ invalid_properties.push('invalid value for "owner_email", the character length must be smaller than or equal to 254.')
306
+ end
307
+
308
+ if !@audience.nil? && @audience.to_s.length > 256
309
+ invalid_properties.push('invalid value for "audience", the character length must be smaller than or equal to 256.')
310
+ end
311
+
312
+ if !@bucket_by.nil? && @bucket_by.to_s.length > 128
313
+ invalid_properties.push('invalid value for "bucket_by", the character length must be smaller than or equal to 128.')
314
+ end
315
+
316
+ if !@bucket_by.nil? && @bucket_by.to_s.length < 1
317
+ invalid_properties.push('invalid value for "bucket_by", the character length must be greater than or equal to 1.')
318
+ end
319
+
320
+ pattern = Regexp.new(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
321
+ if !@bucket_by.nil? && @bucket_by !~ pattern
322
+ invalid_properties.push("invalid value for \"bucket_by\", must conform to the pattern #{pattern}.")
323
+ end
324
+
325
+ if !@folder.nil? && @folder.to_s.length > 256
326
+ invalid_properties.push('invalid value for "folder", the character length must be smaller than or equal to 256.')
327
+ end
328
+
329
+ pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
330
+ if !@folder.nil? && @folder !~ pattern
331
+ invalid_properties.push("invalid value for \"folder\", must conform to the pattern #{pattern}.")
332
+ end
333
+
334
+ if !@allocation_pct.nil? && @allocation_pct > 10000
335
+ invalid_properties.push('invalid value for "allocation_pct", must be smaller than or equal to 10000.')
336
+ end
337
+
338
+ if !@allocation_pct.nil? && @allocation_pct < 0
339
+ invalid_properties.push('invalid value for "allocation_pct", must be greater than or equal to 0.')
340
+ end
341
+
342
+ if !@allocation_percent.nil? && @allocation_percent > 100
343
+ invalid_properties.push('invalid value for "allocation_percent", must be smaller than or equal to 100.')
344
+ end
345
+
346
+ if !@allocation_percent.nil? && @allocation_percent < 0
347
+ invalid_properties.push('invalid value for "allocation_percent", must be greater than or equal to 0.')
348
+ end
349
+
350
+ if !@salt.nil? && @salt.to_s.length > 64
351
+ invalid_properties.push('invalid value for "salt", the character length must be smaller than or equal to 64.')
352
+ end
353
+
354
+ if !@salt.nil? && @salt.to_s.length < 1
355
+ invalid_properties.push('invalid value for "salt", the character length must be greater than or equal to 1.')
356
+ end
357
+
358
+ if !@groups.nil? && @groups.length < 2
359
+ invalid_properties.push('invalid value for "groups", number of items must be greater than or equal to 2.')
360
+ end
361
+
362
+ if !@significance_threshold.nil? && @significance_threshold > 0.5
363
+ invalid_properties.push('invalid value for "significance_threshold", must be smaller than or equal to 0.5.')
364
+ end
365
+
366
+ if !@significance_threshold.nil? && @significance_threshold < 0.00010
367
+ invalid_properties.push('invalid value for "significance_threshold", must be greater than or equal to 0.00010.')
368
+ end
369
+
370
+ if !@min_runtime_days.nil? && @min_runtime_days > 365
371
+ invalid_properties.push('invalid value for "min_runtime_days", must be smaller than or equal to 365.')
372
+ end
373
+
374
+ if !@min_runtime_days.nil? && @min_runtime_days < 0
375
+ invalid_properties.push('invalid value for "min_runtime_days", must be greater than or equal to 0.')
376
+ end
377
+
378
+ if !@min_sample_size.nil? && @min_sample_size > 9007199254740991
379
+ invalid_properties.push('invalid value for "min_sample_size", must be smaller than or equal to 9007199254740991.')
380
+ end
381
+
382
+ if !@min_sample_size.nil? && @min_sample_size < 1
383
+ invalid_properties.push('invalid value for "min_sample_size", must be greater than or equal to 1.')
384
+ end
385
+
386
+ if !@guardrail_metrics.nil? && @guardrail_metrics.length > 10
387
+ invalid_properties.push('invalid value for "guardrail_metrics", number of items must be less than or equal to 10.')
388
+ end
389
+
390
+ invalid_properties
391
+ end
392
+
393
+ # Check to see if the all the properties in the model are valid
394
+ # @return true if the model is valid
395
+ def valid?
396
+ warn '[DEPRECATED] the `valid?` method is obsolete'
397
+ return false if !@name.nil? && @name.to_s.length > 128
398
+ return false if !@name.nil? && @name !~ Regexp.new(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/)
399
+ return false if !@description.nil? && @description.to_s.length > 2000
400
+ return false if !@hypothesis.nil? && @hypothesis.to_s.length > 4000
401
+ return false if !@tag.nil? && @tag.to_s.length > 64
402
+ return false if !@owner_email.nil? && @owner_email.to_s.length > 254
403
+ return false if !@audience.nil? && @audience.to_s.length > 256
404
+ return false if !@bucket_by.nil? && @bucket_by.to_s.length > 128
405
+ return false if !@bucket_by.nil? && @bucket_by.to_s.length < 1
406
+ return false if !@bucket_by.nil? && @bucket_by !~ Regexp.new(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
407
+ return false if !@folder.nil? && @folder.to_s.length > 256
408
+ return false if !@folder.nil? && @folder !~ Regexp.new(/^[a-zA-Z0-9_-]+$/)
409
+ return false if !@allocation_pct.nil? && @allocation_pct > 10000
410
+ return false if !@allocation_pct.nil? && @allocation_pct < 0
411
+ return false if !@allocation_percent.nil? && @allocation_percent > 100
412
+ return false if !@allocation_percent.nil? && @allocation_percent < 0
413
+ return false if !@salt.nil? && @salt.to_s.length > 64
414
+ return false if !@salt.nil? && @salt.to_s.length < 1
415
+ return false if !@groups.nil? && @groups.length < 2
416
+ return false if !@significance_threshold.nil? && @significance_threshold > 0.5
417
+ return false if !@significance_threshold.nil? && @significance_threshold < 0.00010
418
+ return false if !@min_runtime_days.nil? && @min_runtime_days > 365
419
+ return false if !@min_runtime_days.nil? && @min_runtime_days < 0
420
+ return false if !@min_sample_size.nil? && @min_sample_size > 9007199254740991
421
+ return false if !@min_sample_size.nil? && @min_sample_size < 1
422
+ return false if !@guardrail_metrics.nil? && @guardrail_metrics.length > 10
423
+ true
424
+ end
425
+
426
+ # Custom attribute writer method with validation
427
+ # @param [Object] name Value to be assigned
428
+ def name=(name)
429
+ if name.nil?
430
+ fail ArgumentError, 'name cannot be nil'
431
+ end
432
+
433
+ if name.to_s.length > 128
434
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 128.'
435
+ end
436
+
437
+ pattern = Regexp.new(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/)
438
+ if name !~ pattern
439
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
440
+ end
441
+
442
+ @name = name
443
+ end
444
+
445
+ # Custom attribute writer method with validation
446
+ # @param [Object] description Value to be assigned
447
+ def description=(description)
448
+ if !description.nil? && description.to_s.length > 2000
449
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
450
+ end
451
+
452
+ @description = description
453
+ end
454
+
455
+ # Custom attribute writer method with validation
456
+ # @param [Object] hypothesis Value to be assigned
457
+ def hypothesis=(hypothesis)
458
+ if !hypothesis.nil? && hypothesis.to_s.length > 4000
459
+ fail ArgumentError, 'invalid value for "hypothesis", the character length must be smaller than or equal to 4000.'
460
+ end
461
+
462
+ @hypothesis = hypothesis
463
+ end
464
+
465
+ # Custom attribute writer method with validation
466
+ # @param [Object] tag Value to be assigned
467
+ def tag=(tag)
468
+ if !tag.nil? && tag.to_s.length > 64
469
+ fail ArgumentError, 'invalid value for "tag", the character length must be smaller than or equal to 64.'
470
+ end
471
+
472
+ @tag = tag
473
+ end
474
+
475
+ # Custom attribute writer method with validation
476
+ # @param [Object] owner_email Value to be assigned
477
+ def owner_email=(owner_email)
478
+ if !owner_email.nil? && owner_email.to_s.length > 254
479
+ fail ArgumentError, 'invalid value for "owner_email", the character length must be smaller than or equal to 254.'
480
+ end
481
+
482
+ @owner_email = owner_email
483
+ end
484
+
485
+ # Custom attribute writer method with validation
486
+ # @param [Object] audience Value to be assigned
487
+ def audience=(audience)
488
+ if !audience.nil? && audience.to_s.length > 256
489
+ fail ArgumentError, 'invalid value for "audience", the character length must be smaller than or equal to 256.'
490
+ end
491
+
492
+ @audience = audience
493
+ end
494
+
495
+ # Custom attribute writer method with validation
496
+ # @param [Object] bucket_by Value to be assigned
497
+ def bucket_by=(bucket_by)
498
+ if !bucket_by.nil? && bucket_by.to_s.length > 128
499
+ fail ArgumentError, 'invalid value for "bucket_by", the character length must be smaller than or equal to 128.'
500
+ end
501
+
502
+ if !bucket_by.nil? && bucket_by.to_s.length < 1
503
+ fail ArgumentError, 'invalid value for "bucket_by", the character length must be greater than or equal to 1.'
504
+ end
505
+
506
+ pattern = Regexp.new(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
507
+ if !bucket_by.nil? && bucket_by !~ pattern
508
+ fail ArgumentError, "invalid value for \"bucket_by\", must conform to the pattern #{pattern}."
509
+ end
510
+
511
+ @bucket_by = bucket_by
512
+ end
513
+
514
+ # Custom attribute writer method with validation
515
+ # @param [Object] folder Value to be assigned
516
+ def folder=(folder)
517
+ if !folder.nil? && folder.to_s.length > 256
518
+ fail ArgumentError, 'invalid value for "folder", the character length must be smaller than or equal to 256.'
519
+ end
520
+
521
+ pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
522
+ if !folder.nil? && folder !~ pattern
523
+ fail ArgumentError, "invalid value for \"folder\", must conform to the pattern #{pattern}."
524
+ end
525
+
526
+ @folder = folder
527
+ end
528
+
529
+ # Custom attribute writer method with validation
530
+ # @param [Object] allocation_pct Value to be assigned
531
+ def allocation_pct=(allocation_pct)
532
+ if allocation_pct.nil?
533
+ fail ArgumentError, 'allocation_pct cannot be nil'
534
+ end
535
+
536
+ if allocation_pct > 10000
537
+ fail ArgumentError, 'invalid value for "allocation_pct", must be smaller than or equal to 10000.'
538
+ end
539
+
540
+ if allocation_pct < 0
541
+ fail ArgumentError, 'invalid value for "allocation_pct", must be greater than or equal to 0.'
542
+ end
543
+
544
+ @allocation_pct = allocation_pct
545
+ end
546
+
547
+ # Custom attribute writer method with validation
548
+ # @param [Object] allocation_percent Value to be assigned
549
+ def allocation_percent=(allocation_percent)
550
+ if allocation_percent.nil?
551
+ fail ArgumentError, 'allocation_percent cannot be nil'
552
+ end
553
+
554
+ if allocation_percent > 100
555
+ fail ArgumentError, 'invalid value for "allocation_percent", must be smaller than or equal to 100.'
556
+ end
557
+
558
+ if allocation_percent < 0
559
+ fail ArgumentError, 'invalid value for "allocation_percent", must be greater than or equal to 0.'
560
+ end
561
+
562
+ @allocation_percent = allocation_percent
563
+ end
564
+
565
+ # Custom attribute writer method with validation
566
+ # @param [Object] salt Value to be assigned
567
+ def salt=(salt)
568
+ if salt.nil?
569
+ fail ArgumentError, 'salt cannot be nil'
570
+ end
571
+
572
+ if salt.to_s.length > 64
573
+ fail ArgumentError, 'invalid value for "salt", the character length must be smaller than or equal to 64.'
574
+ end
575
+
576
+ if salt.to_s.length < 1
577
+ fail ArgumentError, 'invalid value for "salt", the character length must be greater than or equal to 1.'
578
+ end
579
+
580
+ @salt = salt
581
+ end
582
+
583
+ # Custom attribute writer method with validation
584
+ # @param [Object] groups Value to be assigned
585
+ def groups=(groups)
586
+ if groups.nil?
587
+ fail ArgumentError, 'groups cannot be nil'
588
+ end
589
+
590
+ if groups.length < 2
591
+ fail ArgumentError, 'invalid value for "groups", number of items must be greater than or equal to 2.'
592
+ end
593
+
594
+ @groups = groups
595
+ end
596
+
597
+ # Custom attribute writer method with validation
598
+ # @param [Object] significance_threshold Value to be assigned
599
+ def significance_threshold=(significance_threshold)
600
+ if significance_threshold.nil?
601
+ fail ArgumentError, 'significance_threshold cannot be nil'
602
+ end
603
+
604
+ if significance_threshold > 0.5
605
+ fail ArgumentError, 'invalid value for "significance_threshold", must be smaller than or equal to 0.5.'
606
+ end
607
+
608
+ if significance_threshold < 0.00010
609
+ fail ArgumentError, 'invalid value for "significance_threshold", must be greater than or equal to 0.00010.'
610
+ end
611
+
612
+ @significance_threshold = significance_threshold
613
+ end
614
+
615
+ # Custom attribute writer method with validation
616
+ # @param [Object] min_runtime_days Value to be assigned
617
+ def min_runtime_days=(min_runtime_days)
618
+ if min_runtime_days.nil?
619
+ fail ArgumentError, 'min_runtime_days cannot be nil'
620
+ end
621
+
622
+ if min_runtime_days > 365
623
+ fail ArgumentError, 'invalid value for "min_runtime_days", must be smaller than or equal to 365.'
624
+ end
625
+
626
+ if min_runtime_days < 0
627
+ fail ArgumentError, 'invalid value for "min_runtime_days", must be greater than or equal to 0.'
628
+ end
629
+
630
+ @min_runtime_days = min_runtime_days
631
+ end
632
+
633
+ # Custom attribute writer method with validation
634
+ # @param [Object] min_sample_size Value to be assigned
635
+ def min_sample_size=(min_sample_size)
636
+ if min_sample_size.nil?
637
+ fail ArgumentError, 'min_sample_size cannot be nil'
638
+ end
639
+
640
+ if min_sample_size > 9007199254740991
641
+ fail ArgumentError, 'invalid value for "min_sample_size", must be smaller than or equal to 9007199254740991.'
642
+ end
643
+
644
+ if min_sample_size < 1
645
+ fail ArgumentError, 'invalid value for "min_sample_size", must be greater than or equal to 1.'
646
+ end
647
+
648
+ @min_sample_size = min_sample_size
649
+ end
650
+
651
+ # Custom attribute writer method with validation
652
+ # @param [Object] guardrail_metrics Value to be assigned
653
+ def guardrail_metrics=(guardrail_metrics)
654
+ if guardrail_metrics.nil?
655
+ fail ArgumentError, 'guardrail_metrics cannot be nil'
656
+ end
657
+
658
+ if guardrail_metrics.length > 10
659
+ fail ArgumentError, 'invalid value for "guardrail_metrics", number of items must be less than or equal to 10.'
660
+ end
661
+
662
+ @guardrail_metrics = guardrail_metrics
663
+ end
664
+
665
+ # Checks equality by comparing each attribute.
666
+ # @param [Object] Object to be compared
667
+ def ==(o)
668
+ return true if self.equal?(o)
669
+ self.class == o.class &&
670
+ name == o.name &&
671
+ description == o.description &&
672
+ hypothesis == o.hypothesis &&
673
+ tag == o.tag &&
674
+ owner_email == o.owner_email &&
675
+ audience == o.audience &&
676
+ bucket_by == o.bucket_by &&
677
+ folder == o.folder &&
678
+ targeting_gate == o.targeting_gate &&
679
+ allocation_pct == o.allocation_pct &&
680
+ allocation_percent == o.allocation_percent &&
681
+ salt == o.salt &&
682
+ universe == o.universe &&
683
+ params == o.params &&
684
+ groups == o.groups &&
685
+ significance_threshold == o.significance_threshold &&
686
+ min_runtime_days == o.min_runtime_days &&
687
+ min_sample_size == o.min_sample_size &&
688
+ sequential_testing == o.sequential_testing &&
689
+ goal_metric == o.goal_metric &&
690
+ guardrail_metrics == o.guardrail_metrics
691
+ end
692
+
693
+ # @see the `==` method
694
+ # @param [Object] Object to be compared
695
+ def eql?(o)
696
+ self == o
697
+ end
698
+
699
+ # Calculates hash code according to all attributes.
700
+ # @return [Integer] Hash code
701
+ def hash
702
+ [name, description, hypothesis, tag, owner_email, audience, bucket_by, folder, targeting_gate, allocation_pct, allocation_percent, salt, universe, params, groups, significance_threshold, min_runtime_days, min_sample_size, sequential_testing, goal_metric, guardrail_metrics].hash
703
+ end
704
+
705
+ # Builds the object from hash
706
+ # @param [Hash] attributes Model attributes in the form of hash
707
+ # @return [Object] Returns the model itself
708
+ def self.build_from_hash(attributes)
709
+ return nil unless attributes.is_a?(Hash)
710
+ attributes = attributes.transform_keys(&:to_sym)
711
+ transformed_hash = {}
712
+ openapi_types.each_pair do |key, type|
713
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
714
+ transformed_hash["#{key}"] = nil
715
+ elsif type =~ /\AArray<(.*)>/i
716
+ # check to ensure the input is an array given that the attribute
717
+ # is documented as an array but the input is not
718
+ if attributes[attribute_map[key]].is_a?(Array)
719
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
720
+ end
721
+ elsif !attributes[attribute_map[key]].nil?
722
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
723
+ end
724
+ end
725
+ new(transformed_hash)
726
+ end
727
+
728
+ # Returns the object in the form of hash
729
+ # @return [Hash] Returns the object in the form of hash
730
+ def to_hash
731
+ hash = {}
732
+ self.class.attribute_map.each_pair do |attr, param|
733
+ value = self.send(attr)
734
+ if value.nil?
735
+ is_nullable = self.class.openapi_nullable.include?(attr)
736
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
737
+ end
738
+
739
+ hash[param] = _to_hash(value)
740
+ end
741
+ hash
742
+ end
743
+
744
+ end
745
+
746
+ end