ff-ruby-server-sdk 1.2.1 → 1.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/api.yaml +319 -30
  3. data/lib/ff/ruby/server/generated/lib/openapi_client/api/client_api.rb +27 -0
  4. data/lib/ff/ruby/server/generated/lib/openapi_client/api/metrics_api.rb +13 -10
  5. data/lib/ff/ruby/server/generated/lib/openapi_client/api/proxy_api.rb +159 -0
  6. data/lib/ff/ruby/server/generated/lib/openapi_client/configuration.rb +7 -0
  7. data/lib/ff/ruby/server/generated/lib/openapi_client/models/clause.rb +6 -5
  8. data/lib/ff/ruby/server/generated/lib/openapi_client/models/distribution.rb +3 -0
  9. data/lib/ff/ruby/server/generated/lib/openapi_client/models/error.rb +16 -4
  10. data/lib/ff/ruby/server/generated/lib/openapi_client/models/group_serving_rule.rb +257 -0
  11. data/lib/ff/ruby/server/generated/lib/openapi_client/models/inline_object.rb +223 -0
  12. data/lib/ff/ruby/server/generated/lib/openapi_client/models/pagination.rb +5 -0
  13. data/lib/ff/ruby/server/generated/lib/openapi_client/models/prerequisite.rb +3 -0
  14. data/lib/ff/ruby/server/generated/lib/openapi_client/models/proxy_config.rb +299 -0
  15. data/lib/ff/ruby/server/generated/lib/openapi_client/models/proxy_config_all_of.rb +220 -0
  16. data/lib/ff/ruby/server/generated/lib/openapi_client/models/proxy_config_all_of_environments.rb +251 -0
  17. data/lib/ff/ruby/server/generated/lib/openapi_client/models/segment.rb +23 -4
  18. data/lib/ff/ruby/server/generated/lib/openapi_client/models/serve.rb +1 -0
  19. data/lib/ff/ruby/server/generated/lib/openapi_client/models/serving_rule.rb +4 -5
  20. data/lib/ff/ruby/server/generated/lib/openapi_client/models/tag.rb +15 -8
  21. data/lib/ff/ruby/server/generated/lib/openapi_client/models/target.rb +11 -0
  22. data/lib/ff/ruby/server/generated/lib/openapi_client/models/target_map.rb +8 -0
  23. data/lib/ff/ruby/server/generated/lib/openapi_client/models/variation.rb +5 -0
  24. data/lib/ff/ruby/server/generated/lib/openapi_client/models/variation_map.rb +4 -0
  25. data/lib/ff/ruby/server/generated/lib/openapi_client/models/weighted_variation.rb +3 -0
  26. data/lib/ff/ruby/server/generated/lib/openapi_client.rb +6 -0
  27. data/lib/ff/ruby/server/sdk/api/config.rb +1 -1
  28. data/lib/ff/ruby/server/sdk/api/evaluator.rb +32 -73
  29. data/lib/ff/ruby/server/sdk/api/metrics_processor.rb +95 -50
  30. data/lib/ff/ruby/server/sdk/common/sdk_codes.rb +9 -0
  31. data/lib/ff/ruby/server/sdk/connector/harness_connector.rb +12 -3
  32. data/lib/ff/ruby/server/sdk/version.rb +1 -1
  33. data/scripts/sdk_specs.sh +1 -1
  34. metadata +9 -3
@@ -0,0 +1,299 @@
1
+ =begin
2
+ #Harness feature flag service client apis
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: cf@harness.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ # TBD
18
+ class ProxyConfig
19
+ # The version of this object. The version will be incremented each time the object is modified
20
+ attr_accessor :version
21
+
22
+ # The total number of pages
23
+ attr_accessor :page_count
24
+
25
+ # The total number of items
26
+ attr_accessor :item_count
27
+
28
+ # The number of items per page
29
+ attr_accessor :page_size
30
+
31
+ # The current page
32
+ attr_accessor :page_index
33
+
34
+ attr_accessor :environments
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'version' => :'version',
40
+ :'page_count' => :'pageCount',
41
+ :'item_count' => :'itemCount',
42
+ :'page_size' => :'pageSize',
43
+ :'page_index' => :'pageIndex',
44
+ :'environments' => :'environments'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'version' => :'Integer',
57
+ :'page_count' => :'Integer',
58
+ :'item_count' => :'Integer',
59
+ :'page_size' => :'Integer',
60
+ :'page_index' => :'Integer',
61
+ :'environments' => :'Array<ProxyConfigAllOfEnvironments>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # List of class defined in allOf (OpenAPI v3)
72
+ def self.openapi_all_of
73
+ [
74
+ :'Pagination',
75
+ :'ProxyConfigAllOf'
76
+ ]
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ProxyConfig` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::ProxyConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'version')
95
+ self.version = attributes[:'version']
96
+ end
97
+
98
+ if attributes.key?(:'page_count')
99
+ self.page_count = attributes[:'page_count']
100
+ end
101
+
102
+ if attributes.key?(:'item_count')
103
+ self.item_count = attributes[:'item_count']
104
+ end
105
+
106
+ if attributes.key?(:'page_size')
107
+ self.page_size = attributes[:'page_size']
108
+ end
109
+
110
+ if attributes.key?(:'page_index')
111
+ self.page_index = attributes[:'page_index']
112
+ end
113
+
114
+ if attributes.key?(:'environments')
115
+ if (value = attributes[:'environments']).is_a?(Array)
116
+ self.environments = value
117
+ end
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = Array.new
125
+ if @page_count.nil?
126
+ invalid_properties.push('invalid value for "page_count", page_count cannot be nil.')
127
+ end
128
+
129
+ if @item_count.nil?
130
+ invalid_properties.push('invalid value for "item_count", item_count cannot be nil.')
131
+ end
132
+
133
+ if @page_size.nil?
134
+ invalid_properties.push('invalid value for "page_size", page_size cannot be nil.')
135
+ end
136
+
137
+ if @page_index.nil?
138
+ invalid_properties.push('invalid value for "page_index", page_index cannot be nil.')
139
+ end
140
+
141
+ invalid_properties
142
+ end
143
+
144
+ # Check to see if the all the properties in the model are valid
145
+ # @return true if the model is valid
146
+ def valid?
147
+ return false if @page_count.nil?
148
+ return false if @item_count.nil?
149
+ return false if @page_size.nil?
150
+ return false if @page_index.nil?
151
+ true
152
+ end
153
+
154
+ # Checks equality by comparing each attribute.
155
+ # @param [Object] Object to be compared
156
+ def ==(o)
157
+ return true if self.equal?(o)
158
+ self.class == o.class &&
159
+ version == o.version &&
160
+ page_count == o.page_count &&
161
+ item_count == o.item_count &&
162
+ page_size == o.page_size &&
163
+ page_index == o.page_index &&
164
+ environments == o.environments
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [version, page_count, item_count, page_size, page_index, environments].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ new.build_from_hash(attributes)
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ self.class.openapi_types.each_pair do |key, type|
192
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
193
+ self.send("#{key}=", nil)
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
198
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
199
+ end
200
+ elsif !attributes[self.class.attribute_map[key]].nil?
201
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
202
+ end
203
+ end
204
+
205
+ self
206
+ end
207
+
208
+ # Deserializes the data based on type
209
+ # @param string type Data type
210
+ # @param string value Value to be deserialized
211
+ # @return [Object] Deserialized data
212
+ def _deserialize(type, value)
213
+ case type.to_sym
214
+ when :Time
215
+ Time.parse(value)
216
+ when :Date
217
+ Date.parse(value)
218
+ when :String
219
+ value.to_s
220
+ when :Integer
221
+ value.to_i
222
+ when :Float
223
+ value.to_f
224
+ when :Boolean
225
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
+ true
227
+ else
228
+ false
229
+ end
230
+ when :Object
231
+ # generic object (usually a Hash), return directly
232
+ value
233
+ when /\AArray<(?<inner_type>.+)>\z/
234
+ inner_type = Regexp.last_match[:inner_type]
235
+ value.map { |v| _deserialize(inner_type, v) }
236
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
+ k_type = Regexp.last_match[:k_type]
238
+ v_type = Regexp.last_match[:v_type]
239
+ {}.tap do |hash|
240
+ value.each do |k, v|
241
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
+ end
243
+ end
244
+ else # model
245
+ # models (e.g. Pet) or oneOf
246
+ klass = OpenapiClient.const_get(type)
247
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
+ end
249
+ end
250
+
251
+ # Returns the string representation of the object
252
+ # @return [String] String presentation of the object
253
+ def to_s
254
+ to_hash.to_s
255
+ end
256
+
257
+ # to_body is an alias to to_hash (backward compatibility)
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_body
260
+ to_hash
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = self.send(attr)
269
+ if value.nil?
270
+ is_nullable = self.class.openapi_nullable.include?(attr)
271
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
+ end
273
+
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+
299
+ end
@@ -0,0 +1,220 @@
1
+ =begin
2
+ #Harness feature flag service client apis
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: cf@harness.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class ProxyConfigAllOf
18
+ attr_accessor :environments
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'environments' => :'environments'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'environments' => :'Array<ProxyConfigAllOfEnvironments>'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ProxyConfigAllOf` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::ProxyConfigAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'environments')
61
+ if (value = attributes[:'environments']).is_a?(Array)
62
+ self.environments = value
63
+ end
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ environments == o.environments
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [environments].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
+ self.send("#{key}=", nil)
115
+ elsif type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = OpenapiClient.const_get(type)
168
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+
218
+ end
219
+
220
+ end