ff-ruby-server-sdk 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
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,257 @@
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
+ # The rule used to determine what variation to serve to a target
18
+ class GroupServingRule
19
+ # The unique identifier for this rule
20
+ attr_accessor :rule_id
21
+
22
+ # The rules priority relative to other rules. The rules are evaluated in order with 1 being the highest
23
+ attr_accessor :priority
24
+
25
+ # A list of clauses to use in the rule
26
+ attr_accessor :clauses
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'rule_id' => :'ruleId',
32
+ :'priority' => :'priority',
33
+ :'clauses' => :'clauses'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'rule_id' => :'String',
46
+ :'priority' => :'Integer',
47
+ :'clauses' => :'Array<Clause>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::GroupServingRule` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::GroupServingRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'rule_id')
73
+ self.rule_id = attributes[:'rule_id']
74
+ end
75
+
76
+ if attributes.key?(:'priority')
77
+ self.priority = attributes[:'priority']
78
+ end
79
+
80
+ if attributes.key?(:'clauses')
81
+ if (value = attributes[:'clauses']).is_a?(Array)
82
+ self.clauses = value
83
+ end
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ if @rule_id.nil?
92
+ invalid_properties.push('invalid value for "rule_id", rule_id cannot be nil.')
93
+ end
94
+
95
+ if @priority.nil?
96
+ invalid_properties.push('invalid value for "priority", priority cannot be nil.')
97
+ end
98
+
99
+ if @clauses.nil?
100
+ invalid_properties.push('invalid value for "clauses", clauses cannot be nil.')
101
+ end
102
+
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ return false if @rule_id.nil?
110
+ return false if @priority.nil?
111
+ return false if @clauses.nil?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ rule_id == o.rule_id &&
121
+ priority == o.priority &&
122
+ clauses == o.clauses
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(o)
128
+ self == o
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Integer] Hash code
133
+ def hash
134
+ [rule_id, priority, clauses].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ new.build_from_hash(attributes)
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ self.class.openapi_types.each_pair do |key, type|
150
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
151
+ self.send("#{key}=", nil)
152
+ elsif type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
156
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
+ end
161
+ end
162
+
163
+ self
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def _deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = OpenapiClient.const_get(type)
205
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end
@@ -0,0 +1,223 @@
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 InlineObject
18
+ attr_accessor :proxy_key
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'proxy_key' => :'proxyKey'
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
+ :'proxy_key' => :'String'
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::InlineObject` 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::InlineObject`. 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?(:'proxy_key')
61
+ self.proxy_key = attributes[:'proxy_key']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @proxy_key.nil?
70
+ invalid_properties.push('invalid value for "proxy_key", proxy_key cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @proxy_key.nil?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ proxy_key == o.proxy_key
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [proxy_key].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
117
+ self.send("#{key}=", nil)
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ end
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = OpenapiClient.const_get(type)
171
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -15,14 +15,19 @@ require 'time'
15
15
 
16
16
  module OpenapiClient
17
17
  class Pagination
18
+ # The version of this object. The version will be incremented each time the object is modified
18
19
  attr_accessor :version
19
20
 
21
+ # The total number of pages
20
22
  attr_accessor :page_count
21
23
 
24
+ # The total number of items
22
25
  attr_accessor :item_count
23
26
 
27
+ # The number of items per page
24
28
  attr_accessor :page_size
25
29
 
30
+ # The current page
26
31
  attr_accessor :page_index
27
32
 
28
33
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -14,9 +14,12 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
+ # Feature Flag pre-requisites
17
18
  class Prerequisite
19
+ # The feature identifier that is the prerequisite
18
20
  attr_accessor :feature
19
21
 
22
+ # A list of variations that must be met
20
23
  attr_accessor :variations
21
24
 
22
25
  # Attribute mapping from ruby-style variable name to JSON key.