smplkit 3.0.2 → 3.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2df7b56969ecc78af54eb3cdf4d97c4d8355ae239a39bfcf03c2eeff4f73de4
4
- data.tar.gz: 510d3be0930a5186f02b39bf108021fa00c18790a13131ecbe895d5a52837446
3
+ metadata.gz: 73faaf3780bcc84e53b73bf84d8b1d7b058a3a02ac1fbe9f083b3095bdb81c42
4
+ data.tar.gz: 8db8c9850d56f84bdf9766bc9add5be8e93d28904c04497315fe8017bf4912b3
5
5
  SHA512:
6
- metadata.gz: 6c551d8c463d348391ef053a16ec442c04849181fe35950592eed8a2aef44451e773f4e2fc540fc460084dd3712c478cd882439e905c358e52d9a330f25a81c3
7
- data.tar.gz: 7b9700aea42bdd53134dc9879f7156a1a2e1f3e4c93b269adf9c7de2dca187ebfa7669c3a9c1fb05f0524459a9607b0e5491f61a2154e328d67ca554ff89f7b5
6
+ metadata.gz: b6c058673647b18322b4a16ff0ea0305cafca542c20ac0c8e7d744239b078d83763ce591569f4ebd1ea35961f3a424d6680f0fc4baba643bf19a31653f9e5c8f
7
+ data.tar.gz: 68f29a422328643a0e18278e218761aa5ce66b76b2bd017f26a986e9cb824c3ea88d3e40d9645259324949611266427dd524a3bef69132c30e6c2fc0633b73b1
@@ -88,9 +88,10 @@ module SmplkitGeneratedClient::App
88
88
  end
89
89
 
90
90
  # Delete Environment
91
- # Delete an environment by id.
91
+ # Delete an environment by id. When `cascade=true` is set, also remove every per-environment reference held by flags, configs, and loggers in the corresponding services before deleting the environment row. The default `cascade=false` deletes only the environment row, leaving downstream references in place.
92
92
  # @param id [String]
93
93
  # @param [Hash] opts the optional parameters
94
+ # @option opts [Boolean] :cascade When `true`, remove every flag rule, env-level flag default, config override, and logger override scoped to this environment before deleting the environment row. (default to false)
94
95
  # @return [nil]
95
96
  def delete_environment(id, opts = {})
96
97
  delete_environment_with_http_info(id, opts)
@@ -98,9 +99,10 @@ module SmplkitGeneratedClient::App
98
99
  end
99
100
 
100
101
  # Delete Environment
101
- # Delete an environment by id.
102
+ # Delete an environment by id. When `cascade=true` is set, also remove every per-environment reference held by flags, configs, and loggers in the corresponding services before deleting the environment row. The default `cascade=false` deletes only the environment row, leaving downstream references in place.
102
103
  # @param id [String]
103
104
  # @param [Hash] opts the optional parameters
105
+ # @option opts [Boolean] :cascade When `true`, remove every flag rule, env-level flag default, config override, and logger override scoped to this environment before deleting the environment row. (default to false)
104
106
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
105
107
  def delete_environment_with_http_info(id, opts = {})
106
108
  if @api_client.config.debugging
@@ -115,6 +117,7 @@ module SmplkitGeneratedClient::App
115
117
 
116
118
  # query parameters
117
119
  query_params = opts[:query_params] || {}
120
+ query_params[:'cascade'] = opts[:'cascade'] if !opts[:'cascade'].nil?
118
121
 
119
122
  # header parameters
120
123
  header_params = opts[:header_params] || {}
@@ -213,6 +216,69 @@ module SmplkitGeneratedClient::App
213
216
  return data, status_code, headers
214
217
  end
215
218
 
219
+ # Report Environment Usage
220
+ # Report how many flag rules, env-level flag defaults, config overrides, and logger overrides reference this environment. Used by the console's delete dialog so the user can see what would survive a non-cascading delete.
221
+ # @param id [String]
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [EnvironmentUsageResponse]
224
+ def get_environment_usage(id, opts = {})
225
+ data, _status_code, _headers = get_environment_usage_with_http_info(id, opts)
226
+ data
227
+ end
228
+
229
+ # Report Environment Usage
230
+ # Report how many flag rules, env-level flag defaults, config overrides, and logger overrides reference this environment. Used by the console&#39;s delete dialog so the user can see what would survive a non-cascading delete.
231
+ # @param id [String]
232
+ # @param [Hash] opts the optional parameters
233
+ # @return [Array<(EnvironmentUsageResponse, Integer, Hash)>] EnvironmentUsageResponse data, response status code and response headers
234
+ def get_environment_usage_with_http_info(id, opts = {})
235
+ if @api_client.config.debugging
236
+ @api_client.config.logger.debug 'Calling API: EnvironmentsApi.get_environment_usage ...'
237
+ end
238
+ # verify the required parameter 'id' is set
239
+ if @api_client.config.client_side_validation && id.nil?
240
+ fail ArgumentError, "Missing the required parameter 'id' when calling EnvironmentsApi.get_environment_usage"
241
+ end
242
+ # resource path
243
+ local_var_path = '/api/v1/environments/{id}/usage'.sub('{id}', CGI.escape(id.to_s))
244
+
245
+ # query parameters
246
+ query_params = opts[:query_params] || {}
247
+
248
+ # header parameters
249
+ header_params = opts[:header_params] || {}
250
+ # HTTP header 'Accept' (if needed)
251
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
252
+
253
+ # form parameters
254
+ form_params = opts[:form_params] || {}
255
+
256
+ # http body (model)
257
+ post_body = opts[:debug_body]
258
+
259
+ # return_type
260
+ return_type = opts[:debug_return_type] || 'EnvironmentUsageResponse'
261
+
262
+ # auth_names
263
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
264
+
265
+ new_options = opts.merge(
266
+ :operation => :"EnvironmentsApi.get_environment_usage",
267
+ :header_params => header_params,
268
+ :query_params => query_params,
269
+ :form_params => form_params,
270
+ :body => post_body,
271
+ :auth_names => auth_names,
272
+ :return_type => return_type
273
+ )
274
+
275
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
276
+ if @api_client.config.debugging
277
+ @api_client.config.logger.debug "API called: EnvironmentsApi#get_environment_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
278
+ end
279
+ return data, status_code, headers
280
+ end
281
+
216
282
  # List Environments
217
283
  # List all environments for the authenticated account.
218
284
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,283 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::App
17
+ # Counts of references to an environment held by other resources. Returned by `GET /environments/{id}/usage` so the console can warn the user about per-environment configuration that would survive a bare environment-row deletion. Each count is the number of distinct referencing resources, not the number of rule entries within them.
18
+ class EnvironmentUsage < ApiModelBase
19
+ # Number of feature-flag targeting rules scoped to this environment. Each flag may contribute multiple rules.
20
+ attr_accessor :flag_rules
21
+
22
+ # Number of feature flags that declare an environment-level default value for this environment.
23
+ attr_accessor :flag_env_defaults
24
+
25
+ # Number of config-item overrides keyed to this environment, summed across all configs.
26
+ attr_accessor :config_overrides
27
+
28
+ # Number of loggers with an environment-level level override for this environment.
29
+ attr_accessor :logger_overrides
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'flag_rules' => :'flag_rules',
35
+ :'flag_env_defaults' => :'flag_env_defaults',
36
+ :'config_overrides' => :'config_overrides',
37
+ :'logger_overrides' => :'logger_overrides'
38
+ }
39
+ end
40
+
41
+ # Returns attribute mapping this model knows about
42
+ def self.acceptable_attribute_map
43
+ attribute_map
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ acceptable_attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'flag_rules' => :'Integer',
55
+ :'flag_env_defaults' => :'Integer',
56
+ :'config_overrides' => :'Integer',
57
+ :'logger_overrides' => :'Integer'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::EnvironmentUsage` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ acceptable_attribute_map = self.class.acceptable_attribute_map
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!acceptable_attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::EnvironmentUsage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'flag_rules')
84
+ self.flag_rules = attributes[:'flag_rules']
85
+ else
86
+ self.flag_rules = nil
87
+ end
88
+
89
+ if attributes.key?(:'flag_env_defaults')
90
+ self.flag_env_defaults = attributes[:'flag_env_defaults']
91
+ else
92
+ self.flag_env_defaults = nil
93
+ end
94
+
95
+ if attributes.key?(:'config_overrides')
96
+ self.config_overrides = attributes[:'config_overrides']
97
+ else
98
+ self.config_overrides = nil
99
+ end
100
+
101
+ if attributes.key?(:'logger_overrides')
102
+ self.logger_overrides = attributes[:'logger_overrides']
103
+ else
104
+ self.logger_overrides = nil
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ if @flag_rules.nil?
114
+ invalid_properties.push('invalid value for "flag_rules", flag_rules cannot be nil.')
115
+ end
116
+
117
+ if @flag_rules < 0
118
+ invalid_properties.push('invalid value for "flag_rules", must be greater than or equal to 0.')
119
+ end
120
+
121
+ if @flag_env_defaults.nil?
122
+ invalid_properties.push('invalid value for "flag_env_defaults", flag_env_defaults cannot be nil.')
123
+ end
124
+
125
+ if @flag_env_defaults < 0
126
+ invalid_properties.push('invalid value for "flag_env_defaults", must be greater than or equal to 0.')
127
+ end
128
+
129
+ if @config_overrides.nil?
130
+ invalid_properties.push('invalid value for "config_overrides", config_overrides cannot be nil.')
131
+ end
132
+
133
+ if @config_overrides < 0
134
+ invalid_properties.push('invalid value for "config_overrides", must be greater than or equal to 0.')
135
+ end
136
+
137
+ if @logger_overrides.nil?
138
+ invalid_properties.push('invalid value for "logger_overrides", logger_overrides cannot be nil.')
139
+ end
140
+
141
+ if @logger_overrides < 0
142
+ invalid_properties.push('invalid value for "logger_overrides", must be greater than or equal to 0.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ warn '[DEPRECATED] the `valid?` method is obsolete'
152
+ return false if @flag_rules.nil?
153
+ return false if @flag_rules < 0
154
+ return false if @flag_env_defaults.nil?
155
+ return false if @flag_env_defaults < 0
156
+ return false if @config_overrides.nil?
157
+ return false if @config_overrides < 0
158
+ return false if @logger_overrides.nil?
159
+ return false if @logger_overrides < 0
160
+ true
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] flag_rules Value to be assigned
165
+ def flag_rules=(flag_rules)
166
+ if flag_rules.nil?
167
+ fail ArgumentError, 'flag_rules cannot be nil'
168
+ end
169
+
170
+ if flag_rules < 0
171
+ fail ArgumentError, 'invalid value for "flag_rules", must be greater than or equal to 0.'
172
+ end
173
+
174
+ @flag_rules = flag_rules
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] flag_env_defaults Value to be assigned
179
+ def flag_env_defaults=(flag_env_defaults)
180
+ if flag_env_defaults.nil?
181
+ fail ArgumentError, 'flag_env_defaults cannot be nil'
182
+ end
183
+
184
+ if flag_env_defaults < 0
185
+ fail ArgumentError, 'invalid value for "flag_env_defaults", must be greater than or equal to 0.'
186
+ end
187
+
188
+ @flag_env_defaults = flag_env_defaults
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] config_overrides Value to be assigned
193
+ def config_overrides=(config_overrides)
194
+ if config_overrides.nil?
195
+ fail ArgumentError, 'config_overrides cannot be nil'
196
+ end
197
+
198
+ if config_overrides < 0
199
+ fail ArgumentError, 'invalid value for "config_overrides", must be greater than or equal to 0.'
200
+ end
201
+
202
+ @config_overrides = config_overrides
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] logger_overrides Value to be assigned
207
+ def logger_overrides=(logger_overrides)
208
+ if logger_overrides.nil?
209
+ fail ArgumentError, 'logger_overrides cannot be nil'
210
+ end
211
+
212
+ if logger_overrides < 0
213
+ fail ArgumentError, 'invalid value for "logger_overrides", must be greater than or equal to 0.'
214
+ end
215
+
216
+ @logger_overrides = logger_overrides
217
+ end
218
+
219
+ # Checks equality by comparing each attribute.
220
+ # @param [Object] Object to be compared
221
+ def ==(o)
222
+ return true if self.equal?(o)
223
+ self.class == o.class &&
224
+ flag_rules == o.flag_rules &&
225
+ flag_env_defaults == o.flag_env_defaults &&
226
+ config_overrides == o.config_overrides &&
227
+ logger_overrides == o.logger_overrides
228
+ end
229
+
230
+ # @see the `==` method
231
+ # @param [Object] Object to be compared
232
+ def eql?(o)
233
+ self == o
234
+ end
235
+
236
+ # Calculates hash code according to all attributes.
237
+ # @return [Integer] Hash code
238
+ def hash
239
+ [flag_rules, flag_env_defaults, config_overrides, logger_overrides].hash
240
+ end
241
+
242
+ # Builds the object from hash
243
+ # @param [Hash] attributes Model attributes in the form of hash
244
+ # @return [Object] Returns the model itself
245
+ def self.build_from_hash(attributes)
246
+ return nil unless attributes.is_a?(Hash)
247
+ attributes = attributes.transform_keys(&:to_sym)
248
+ transformed_hash = {}
249
+ openapi_types.each_pair do |key, type|
250
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
251
+ transformed_hash["#{key}"] = nil
252
+ elsif type =~ /\AArray<(.*)>/i
253
+ # check to ensure the input is an array given that the attribute
254
+ # is documented as an array but the input is not
255
+ if attributes[attribute_map[key]].is_a?(Array)
256
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
257
+ end
258
+ elsif !attributes[attribute_map[key]].nil?
259
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
260
+ end
261
+ end
262
+ new(transformed_hash)
263
+ end
264
+
265
+ # Returns the object in the form of hash
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_hash
268
+ hash = {}
269
+ self.class.attribute_map.each_pair do |attr, param|
270
+ value = self.send(attr)
271
+ if value.nil?
272
+ is_nullable = self.class.openapi_nullable.include?(attr)
273
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
274
+ end
275
+
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ end
282
+
283
+ end
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::App
17
+ # JSON:API resource envelope for an environment-usage report.
18
+ class EnvironmentUsageResource < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :type
22
+
23
+ attr_accessor :attributes
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'id' => :'id',
51
+ :'type' => :'type',
52
+ :'attributes' => :'attributes'
53
+ }
54
+ end
55
+
56
+ # Returns attribute mapping this model knows about
57
+ def self.acceptable_attribute_map
58
+ attribute_map
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ acceptable_attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'id' => :'String',
70
+ :'type' => :'String',
71
+ :'attributes' => :'EnvironmentUsage'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ :'id',
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::EnvironmentUsageResource` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::EnvironmentUsageResource`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'id')
99
+ self.id = attributes[:'id']
100
+ end
101
+
102
+ if attributes.key?(:'type')
103
+ self.type = attributes[:'type']
104
+ else
105
+ self.type = nil
106
+ end
107
+
108
+ if attributes.key?(:'attributes')
109
+ self.attributes = attributes[:'attributes']
110
+ else
111
+ self.attributes = nil
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @type.nil?
121
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
122
+ end
123
+
124
+ if @attributes.nil?
125
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ warn '[DEPRECATED] the `valid?` method is obsolete'
135
+ return false if @type.nil?
136
+ type_validator = EnumAttributeValidator.new('String', ["environment_usage"])
137
+ return false unless type_validator.valid?(@type)
138
+ return false if @attributes.nil?
139
+ true
140
+ end
141
+
142
+ # Custom attribute writer method checking allowed values (enum).
143
+ # @param [Object] type Object to be assigned
144
+ def type=(type)
145
+ validator = EnumAttributeValidator.new('String', ["environment_usage"])
146
+ unless validator.valid?(type)
147
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
148
+ end
149
+ @type = type
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] attributes Value to be assigned
154
+ def attributes=(attributes)
155
+ if attributes.nil?
156
+ fail ArgumentError, 'attributes cannot be nil'
157
+ end
158
+
159
+ @attributes = attributes
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ id == o.id &&
168
+ type == o.type &&
169
+ attributes == o.attributes
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [id, type, attributes].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ transformed_hash = {}
191
+ openapi_types.each_pair do |key, type|
192
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{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[attribute_map[key]].is_a?(Array)
198
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
199
+ end
200
+ elsif !attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
202
+ end
203
+ end
204
+ new(transformed_hash)
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -0,0 +1,165 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::App
17
+ # JSON:API single-resource response envelope for environment-usage counts.
18
+ class EnvironmentUsageResponse < ApiModelBase
19
+ attr_accessor :data
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'data' => :'data'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'data' => :'EnvironmentUsageResource'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::EnvironmentUsageResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::EnvironmentUsageResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'data')
68
+ self.data = attributes[:'data']
69
+ else
70
+ self.data = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @data.nil?
80
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @data.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] data Value to be assigned
96
+ def data=(data)
97
+ if data.nil?
98
+ fail ArgumentError, 'data cannot be nil'
99
+ end
100
+
101
+ @data = data
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ data == o.data
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [data].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ if value.nil?
154
+ is_nullable = self.class.openapi_nullable.include?(attr)
155
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
156
+ end
157
+
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ end
164
+
165
+ end
@@ -57,6 +57,9 @@ require 'smplkit_app_client/models/environment_list_response'
57
57
  require 'smplkit_app_client/models/environment_request'
58
58
  require 'smplkit_app_client/models/environment_resource'
59
59
  require 'smplkit_app_client/models/environment_response'
60
+ require 'smplkit_app_client/models/environment_usage'
61
+ require 'smplkit_app_client/models/environment_usage_resource'
62
+ require 'smplkit_app_client/models/environment_usage_response'
60
63
  require 'smplkit_app_client/models/error'
61
64
  require 'smplkit_app_client/models/error_response'
62
65
  require 'smplkit_app_client/models/invitation'
@@ -46,9 +46,10 @@ describe 'EnvironmentsApi' do
46
46
 
47
47
  # unit tests for delete_environment
48
48
  # Delete Environment
49
- # Delete an environment by id.
49
+ # Delete an environment by id. When &#x60;cascade&#x3D;true&#x60; is set, also remove every per-environment reference held by flags, configs, and loggers in the corresponding services before deleting the environment row. The default &#x60;cascade&#x3D;false&#x60; deletes only the environment row, leaving downstream references in place.
50
50
  # @param id
51
51
  # @param [Hash] opts the optional parameters
52
+ # @option opts [Boolean] :cascade When &#x60;true&#x60;, remove every flag rule, env-level flag default, config override, and logger override scoped to this environment before deleting the environment row.
52
53
  # @return [nil]
53
54
  describe 'delete_environment test' do
54
55
  it 'should work' do
@@ -68,6 +69,18 @@ describe 'EnvironmentsApi' do
68
69
  end
69
70
  end
70
71
 
72
+ # unit tests for get_environment_usage
73
+ # Report Environment Usage
74
+ # Report how many flag rules, env-level flag defaults, config overrides, and logger overrides reference this environment. Used by the console&#39;s delete dialog so the user can see what would survive a non-cascading delete.
75
+ # @param id
76
+ # @param [Hash] opts the optional parameters
77
+ # @return [EnvironmentUsageResponse]
78
+ describe 'get_environment_usage test' do
79
+ it 'should work' do
80
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
81
+ end
82
+ end
83
+
71
84
  # unit tests for list_environments
72
85
  # List Environments
73
86
  # List all environments for the authenticated account.
@@ -0,0 +1,52 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for SmplkitGeneratedClient::App::EnvironmentUsageResource
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe SmplkitGeneratedClient::App::EnvironmentUsageResource do
21
+ #let(:instance) { SmplkitGeneratedClient::App::EnvironmentUsageResource.new }
22
+
23
+ describe 'test an instance of EnvironmentUsageResource' do
24
+ it 'should create an instance of EnvironmentUsageResource' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::App::EnvironmentUsageResource)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "id"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "type"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["environment_usage"])
40
+ # validator.allowable_values.each do |value|
41
+ # expect { instance.type = value }.not_to raise_error
42
+ # end
43
+ end
44
+ end
45
+
46
+ describe 'test attribute "attributes"' do
47
+ it 'should work' do
48
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
49
+ end
50
+ end
51
+
52
+ end
@@ -0,0 +1,36 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for SmplkitGeneratedClient::App::EnvironmentUsageResponse
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe SmplkitGeneratedClient::App::EnvironmentUsageResponse do
21
+ #let(:instance) { SmplkitGeneratedClient::App::EnvironmentUsageResponse.new }
22
+
23
+ describe 'test an instance of EnvironmentUsageResponse' do
24
+ it 'should create an instance of EnvironmentUsageResponse' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::App::EnvironmentUsageResponse)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "data"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,54 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for SmplkitGeneratedClient::App::EnvironmentUsage
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe SmplkitGeneratedClient::App::EnvironmentUsage do
21
+ #let(:instance) { SmplkitGeneratedClient::App::EnvironmentUsage.new }
22
+
23
+ describe 'test an instance of EnvironmentUsage' do
24
+ it 'should create an instance of EnvironmentUsage' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(SmplkitGeneratedClient::App::EnvironmentUsage)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "flag_rules"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "flag_env_defaults"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ describe 'test attribute "config_overrides"' do
43
+ it 'should work' do
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
+ end
46
+ end
47
+
48
+ describe 'test attribute "logger_overrides"' do
49
+ it 'should work' do
50
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
51
+ end
52
+ end
53
+
54
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smplkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC
@@ -210,6 +210,9 @@ files:
210
210
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/environment_request.rb
211
211
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/environment_resource.rb
212
212
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/environment_response.rb
213
+ - lib/smplkit/_generated/app/lib/smplkit_app_client/models/environment_usage.rb
214
+ - lib/smplkit/_generated/app/lib/smplkit_app_client/models/environment_usage_resource.rb
215
+ - lib/smplkit/_generated/app/lib/smplkit_app_client/models/environment_usage_response.rb
213
216
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/error.rb
214
217
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/error_response.rb
215
218
  - lib/smplkit/_generated/app/lib/smplkit_app_client/models/invitation.rb
@@ -327,6 +330,9 @@ files:
327
330
  - lib/smplkit/_generated/app/spec/models/environment_resource_spec.rb
328
331
  - lib/smplkit/_generated/app/spec/models/environment_response_spec.rb
329
332
  - lib/smplkit/_generated/app/spec/models/environment_spec.rb
333
+ - lib/smplkit/_generated/app/spec/models/environment_usage_resource_spec.rb
334
+ - lib/smplkit/_generated/app/spec/models/environment_usage_response_spec.rb
335
+ - lib/smplkit/_generated/app/spec/models/environment_usage_spec.rb
330
336
  - lib/smplkit/_generated/app/spec/models/error_response_spec.rb
331
337
  - lib/smplkit/_generated/app/spec/models/error_spec.rb
332
338
  - lib/smplkit/_generated/app/spec/models/invitation_accept_request_spec.rb