smplkit 2.0.11 → 2.0.13

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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/api/flag_sources_api.rb +4 -4
  3. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/api/flags_api.rb +28 -28
  4. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/api/functions_api.rb +2 -2
  5. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/api/usage_api.rb +2 -2
  6. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag.rb +40 -10
  7. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_bulk_item.rb +34 -9
  8. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_bulk_request.rb +2 -0
  9. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_bulk_response.rb +2 -0
  10. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_environment.rb +4 -0
  11. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_list_response.rb +1 -0
  12. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_request.rb +165 -0
  13. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_resource.rb +1 -0
  14. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_response.rb +1 -0
  15. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_rule.rb +3 -0
  16. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_source.rb +65 -13
  17. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_source_list_response.rb +1 -0
  18. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_source_resource.rb +1 -0
  19. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/flag_value.rb +2 -0
  20. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/manual_review_item.rb +5 -0
  21. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/remove_references_attributes.rb +4 -0
  22. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/remove_references_request.rb +3 -0
  23. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/remove_references_result_envelope.rb +1 -0
  24. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/remove_references_result_resource.rb +1 -0
  25. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/usage_attributes.rb +4 -0
  26. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/usage_list_response.rb +1 -0
  27. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client/models/usage_resource.rb +1 -0
  28. data/lib/smplkit/_generated/flags/lib/smplkit_flags_client.rb +1 -0
  29. data/lib/smplkit/_generated/flags/spec/api/flag_sources_api_spec.rb +2 -2
  30. data/lib/smplkit/_generated/flags/spec/api/flags_api_spec.rb +7 -7
  31. data/lib/smplkit/_generated/flags/spec/api/functions_api_spec.rb +1 -1
  32. data/lib/smplkit/_generated/flags/spec/api/usage_api_spec.rb +1 -1
  33. data/lib/smplkit/_generated/flags/spec/models/flag_bulk_item_spec.rb +4 -0
  34. data/lib/smplkit/_generated/flags/spec/models/flag_request_spec.rb +36 -0
  35. data/lib/smplkit/_generated/flags/spec/models/flag_source_spec.rb +13 -3
  36. data/lib/smplkit/_generated/flags/spec/models/flag_spec.rb +4 -0
  37. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/api/log_groups_api.rb +28 -28
  38. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/api/logger_sources_api.rb +4 -4
  39. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/api/loggers_api.rb +19 -19
  40. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/api/services_api.rb +2 -2
  41. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/api/usage_api.rb +2 -2
  42. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/log_group.rb +36 -10
  43. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/log_group_list_response.rb +1 -0
  44. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/log_group_request.rb +165 -0
  45. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/log_group_resource.rb +1 -0
  46. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/log_group_response.rb +1 -0
  47. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger.rb +39 -10
  48. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_bulk_item.rb +6 -5
  49. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_bulk_request.rb +2 -0
  50. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_bulk_response.rb +2 -0
  51. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_list_response.rb +1 -0
  52. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_request.rb +165 -0
  53. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_resource.rb +1 -0
  54. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_response.rb +1 -0
  55. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_source.rb +9 -0
  56. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_source_list_response.rb +1 -0
  57. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/logger_source_resource.rb +1 -0
  58. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/service_list_response.rb +1 -0
  59. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/service_resource.rb +2 -0
  60. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/usage_attributes.rb +4 -0
  61. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/usage_list_response.rb +1 -0
  62. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client/models/usage_resource.rb +1 -0
  63. data/lib/smplkit/_generated/logging/lib/smplkit_logging_client.rb +2 -0
  64. data/lib/smplkit/_generated/logging/spec/api/log_groups_api_spec.rb +7 -7
  65. data/lib/smplkit/_generated/logging/spec/api/logger_sources_api_spec.rb +2 -2
  66. data/lib/smplkit/_generated/logging/spec/api/loggers_api_spec.rb +6 -6
  67. data/lib/smplkit/_generated/logging/spec/api/services_api_spec.rb +1 -1
  68. data/lib/smplkit/_generated/logging/spec/api/usage_api_spec.rb +1 -1
  69. data/lib/smplkit/_generated/logging/spec/models/log_group_request_spec.rb +36 -0
  70. data/lib/smplkit/_generated/logging/spec/models/log_group_spec.rb +4 -0
  71. data/lib/smplkit/_generated/logging/spec/models/logger_request_spec.rb +36 -0
  72. data/lib/smplkit/_generated/logging/spec/models/logger_spec.rb +4 -0
  73. metadata +7 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11d1397bb7c77eeb63a28eb21bf9aab0688feffe5e8df6339c363511713ac843
4
- data.tar.gz: 8efcc6ad6061be18bbf48fb5993dffd693a9f2b1243a0b091fde72fbe46830c5
3
+ metadata.gz: a13c17482f6490edfe110ef2d8b196839e80a2cb51c1e5f2fbd9db1fa4dcc0c2
4
+ data.tar.gz: 30616e5d717587b16c3ba62bfc7ddf2ffe5ec36fa5517191bbad54c7d0645432
5
5
  SHA512:
6
- metadata.gz: 936f0a2efbad65c8a7904b18ed28e0508892bbd4d641e6ed7774eba0df22c1c64aabe7f24780e0f2f31e5303905b58c3464122bff83f7c18863e81a3fcfe3dca
7
- data.tar.gz: a0ec336127cd5a0d72bc943d0dda7e5df277cc010d4e6641699136b8d8eaecdad0b3eeab94f6c4ac54f5117109930b90f07e3e5df99f86724385a042b6a4099b
6
+ metadata.gz: ced9a4d2af5b33f5ac3bb2be41c204f1ba1a43dc99d3bcedeccedc9c80dbebc5c5dd072964211320c14032682a89178328405232b9f421bf232b548f50705803
7
+ data.tar.gz: 3f8c1dbb987307370be1b09db8e2c486217ecea0666cc9f7387bcf5cdac7d3b5fdf88218e4c0dfe74312094254acef38fcffc651f8c9df33811cef1aceb7888d
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Flags
20
20
  @api_client = api_client
21
21
  end
22
22
  # List All Flag Sources
23
- # List all flag sources across all flags. Optionally filter by environment or service.
23
+ # List service/environment observations across all flags for this account. Filter by `environment` or `service` (or both) to narrow the result.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [String] :filter_environment
26
26
  # @option opts [String] :filter_service
@@ -31,7 +31,7 @@ module SmplkitGeneratedClient::Flags
31
31
  end
32
32
 
33
33
  # List All Flag Sources
34
- # List all flag sources across all flags. Optionally filter by environment or service.
34
+ # List service/environment observations across all flags for this account. Filter by `environment` or `service` (or both) to narrow the result.
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @option opts [String] :filter_environment
37
37
  # @option opts [String] :filter_service
@@ -83,7 +83,7 @@ module SmplkitGeneratedClient::Flags
83
83
  end
84
84
 
85
85
  # List Flag Sources
86
- # List all sources (service/environment observations) for a specific flag.
86
+ # List the service/environment observations recorded for a single flag.
87
87
  # @param id [String]
88
88
  # @param [Hash] opts the optional parameters
89
89
  # @return [FlagSourceListResponse]
@@ -93,7 +93,7 @@ module SmplkitGeneratedClient::Flags
93
93
  end
94
94
 
95
95
  # List Flag Sources
96
- # List all sources (service/environment observations) for a specific flag.
96
+ # List the service/environment observations recorded for a single flag.
97
97
  # @param id [String]
98
98
  # @param [Hash] opts the optional parameters
99
99
  # @return [Array<(FlagSourceListResponse, Integer, Hash)>] FlagSourceListResponse data, response status code and response headers
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Flags
20
20
  @api_client = api_client
21
21
  end
22
22
  # Bulk Register Flags
23
- # Register flags discovered by an SDK. Creates new flags or updates source observations on existing ones.
23
+ # Register flags discovered by an SDK. Creates a new flag for each unreported key and refreshes the service/environment source observation on each already-known key.
24
24
  # @param flag_bulk_request [FlagBulkRequest]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [FlagBulkResponse]
@@ -30,7 +30,7 @@ module SmplkitGeneratedClient::Flags
30
30
  end
31
31
 
32
32
  # Bulk Register Flags
33
- # Register flags discovered by an SDK. Creates new flags or updates source observations on existing ones.
33
+ # Register flags discovered by an SDK. Creates a new flag for each unreported key and refreshes the service/environment source observation on each already-known key.
34
34
  # @param flag_bulk_request [FlagBulkRequest]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(FlagBulkResponse, Integer, Hash)>] FlagBulkResponse data, response status code and response headers
@@ -88,27 +88,27 @@ module SmplkitGeneratedClient::Flags
88
88
  end
89
89
 
90
90
  # Create Flag
91
- # Create a new feature flag. The caller provides the id (key) in the request body.
92
- # @param flag_response [FlagResponse]
91
+ # Create a new feature flag. The caller provides the id (the flag key) in the request body.
92
+ # @param flag_request [FlagRequest]
93
93
  # @param [Hash] opts the optional parameters
94
94
  # @return [FlagResponse]
95
- def create_flag(flag_response, opts = {})
96
- data, _status_code, _headers = create_flag_with_http_info(flag_response, opts)
95
+ def create_flag(flag_request, opts = {})
96
+ data, _status_code, _headers = create_flag_with_http_info(flag_request, opts)
97
97
  data
98
98
  end
99
99
 
100
100
  # Create Flag
101
- # Create a new feature flag. The caller provides the id (key) in the request body.
102
- # @param flag_response [FlagResponse]
101
+ # Create a new feature flag. The caller provides the id (the flag key) in the request body.
102
+ # @param flag_request [FlagRequest]
103
103
  # @param [Hash] opts the optional parameters
104
104
  # @return [Array<(FlagResponse, Integer, Hash)>] FlagResponse data, response status code and response headers
105
- def create_flag_with_http_info(flag_response, opts = {})
105
+ def create_flag_with_http_info(flag_request, opts = {})
106
106
  if @api_client.config.debugging
107
107
  @api_client.config.logger.debug 'Calling API: FlagsApi.create_flag ...'
108
108
  end
109
- # verify the required parameter 'flag_response' is set
110
- if @api_client.config.client_side_validation && flag_response.nil?
111
- fail ArgumentError, "Missing the required parameter 'flag_response' when calling FlagsApi.create_flag"
109
+ # verify the required parameter 'flag_request' is set
110
+ if @api_client.config.client_side_validation && flag_request.nil?
111
+ fail ArgumentError, "Missing the required parameter 'flag_request' when calling FlagsApi.create_flag"
112
112
  end
113
113
  # resource path
114
114
  local_var_path = '/api/v1/flags'
@@ -130,7 +130,7 @@ module SmplkitGeneratedClient::Flags
130
130
  form_params = opts[:form_params] || {}
131
131
 
132
132
  # http body (model)
133
- post_body = opts[:debug_body] || @api_client.object_to_http_body(flag_response)
133
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(flag_request)
134
134
 
135
135
  # return_type
136
136
  return_type = opts[:debug_return_type] || 'FlagResponse'
@@ -217,7 +217,7 @@ module SmplkitGeneratedClient::Flags
217
217
  end
218
218
 
219
219
  # Get Flag
220
- # Return a feature flag by its key.
220
+ # Retrieve a feature flag by its key.
221
221
  # @param id [String]
222
222
  # @param [Hash] opts the optional parameters
223
223
  # @return [FlagResponse]
@@ -227,7 +227,7 @@ module SmplkitGeneratedClient::Flags
227
227
  end
228
228
 
229
229
  # Get Flag
230
- # Return a feature flag by its key.
230
+ # Retrieve a feature flag by its key.
231
231
  # @param id [String]
232
232
  # @param [Hash] opts the optional parameters
233
233
  # @return [Array<(FlagResponse, Integer, Hash)>] FlagResponse data, response status code and response headers
@@ -280,7 +280,7 @@ module SmplkitGeneratedClient::Flags
280
280
  end
281
281
 
282
282
  # List Flags
283
- # List all feature flags for the authenticated account.
283
+ # List feature flags for this account.
284
284
  # @param [Hash] opts the optional parameters
285
285
  # @option opts [String] :filter_type
286
286
  # @option opts [Boolean] :filter_managed
@@ -293,7 +293,7 @@ module SmplkitGeneratedClient::Flags
293
293
  end
294
294
 
295
295
  # List Flags
296
- # List all feature flags for the authenticated account.
296
+ # List feature flags for this account.
297
297
  # @param [Hash] opts the optional parameters
298
298
  # @option opts [String] :filter_type
299
299
  # @option opts [Boolean] :filter_managed
@@ -349,23 +349,23 @@ module SmplkitGeneratedClient::Flags
349
349
  end
350
350
 
351
351
  # Update Flag
352
- # Replace a feature flag entirely.
352
+ # Replace a feature flag entirely. Every writable field is overwritten.
353
353
  # @param id [String]
354
- # @param flag_response [FlagResponse]
354
+ # @param flag_request [FlagRequest]
355
355
  # @param [Hash] opts the optional parameters
356
356
  # @return [FlagResponse]
357
- def update_flag(id, flag_response, opts = {})
358
- data, _status_code, _headers = update_flag_with_http_info(id, flag_response, opts)
357
+ def update_flag(id, flag_request, opts = {})
358
+ data, _status_code, _headers = update_flag_with_http_info(id, flag_request, opts)
359
359
  data
360
360
  end
361
361
 
362
362
  # Update Flag
363
- # Replace a feature flag entirely.
363
+ # Replace a feature flag entirely. Every writable field is overwritten.
364
364
  # @param id [String]
365
- # @param flag_response [FlagResponse]
365
+ # @param flag_request [FlagRequest]
366
366
  # @param [Hash] opts the optional parameters
367
367
  # @return [Array<(FlagResponse, Integer, Hash)>] FlagResponse data, response status code and response headers
368
- def update_flag_with_http_info(id, flag_response, opts = {})
368
+ def update_flag_with_http_info(id, flag_request, opts = {})
369
369
  if @api_client.config.debugging
370
370
  @api_client.config.logger.debug 'Calling API: FlagsApi.update_flag ...'
371
371
  end
@@ -373,9 +373,9 @@ module SmplkitGeneratedClient::Flags
373
373
  if @api_client.config.client_side_validation && id.nil?
374
374
  fail ArgumentError, "Missing the required parameter 'id' when calling FlagsApi.update_flag"
375
375
  end
376
- # verify the required parameter 'flag_response' is set
377
- if @api_client.config.client_side_validation && flag_response.nil?
378
- fail ArgumentError, "Missing the required parameter 'flag_response' when calling FlagsApi.update_flag"
376
+ # verify the required parameter 'flag_request' is set
377
+ if @api_client.config.client_side_validation && flag_request.nil?
378
+ fail ArgumentError, "Missing the required parameter 'flag_request' when calling FlagsApi.update_flag"
379
379
  end
380
380
  # resource path
381
381
  local_var_path = '/api/v1/flags/{id}'.sub('{id}', CGI.escape(id.to_s))
@@ -397,7 +397,7 @@ module SmplkitGeneratedClient::Flags
397
397
  form_params = opts[:form_params] || {}
398
398
 
399
399
  # http body (model)
400
- post_body = opts[:debug_body] || @api_client.object_to_http_body(flag_response)
400
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(flag_request)
401
401
 
402
402
  # return_type
403
403
  return_type = opts[:debug_return_type] || 'FlagResponse'
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Flags
20
20
  @api_client = api_client
21
21
  end
22
22
  # Execute Remove References
23
- # Bulk-remove context references from flag rules. Traverses every flag in the account, removes rules that reference the specified context, and emits a single flags_changed event when done.
23
+ # Remove every rule that references a specific context across every flag. Provide exactly one of `context` (matches a single instance, formatted as `{type}:{key}`) or `context_type` (matches any attribute of that context type). Rules whose reference sits inside an AND expression are not removed automatically; they are returned in `rules_needing_manual_review` for the caller to handle.
24
24
  # @param remove_references_request [RemoveReferencesRequest]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @return [RemoveReferencesResultEnvelope]
@@ -30,7 +30,7 @@ module SmplkitGeneratedClient::Flags
30
30
  end
31
31
 
32
32
  # Execute Remove References
33
- # Bulk-remove context references from flag rules. Traverses every flag in the account, removes rules that reference the specified context, and emits a single flags_changed event when done.
33
+ # Remove every rule that references a specific context across every flag. Provide exactly one of &#x60;context&#x60; (matches a single instance, formatted as &#x60;{type}:{key}&#x60;) or &#x60;context_type&#x60; (matches any attribute of that context type). Rules whose reference sits inside an AND expression are not removed automatically; they are returned in &#x60;rules_needing_manual_review&#x60; for the caller to handle.
34
34
  # @param remove_references_request [RemoveReferencesRequest]
35
35
  # @param [Hash] opts the optional parameters
36
36
  # @return [Array<(RemoveReferencesResultEnvelope, Integer, Hash)>] RemoveReferencesResultEnvelope data, response status code and response headers
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Flags
20
20
  @api_client = api_client
21
21
  end
22
22
  # List Flags Usage
23
- # Return current resource usage counts for the authenticated account.
23
+ # Report current-period usage counters for this account.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [String] :filter_period
26
26
  # @return [UsageListResponse]
@@ -30,7 +30,7 @@ module SmplkitGeneratedClient::Flags
30
30
  end
31
31
 
32
32
  # List Flags Usage
33
- # Return current resource usage counts for the authenticated account.
33
+ # Report current-period usage counters for this account.
34
34
  # @param [Hash] opts the optional parameters
35
35
  # @option opts [String] :filter_period
36
36
  # @return [Array<(UsageListResponse, Integer, Hash)>] UsageListResponse data, response status code and response headers
@@ -14,31 +14,59 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # A feature flag whose value is resolved at runtime from environment rules and a default. A flag has a value type (`BOOLEAN`, `STRING`, `NUMERIC`, or `JSON`) and either a fixed set of allowed values (constrained) or accepts any value matching the type (unconstrained). Each environment can enable or disable the flag, set its own default, and define targeting rules that override the default for specific evaluation contexts.
17
18
  class Flag < ApiModelBase
18
- # Human-readable display name
19
+ # Human-readable display name for the flag.
19
20
  attr_accessor :name
20
21
 
22
+ # Human-readable description of the flag's purpose.
21
23
  attr_accessor :description
22
24
 
23
- # Value type: STRING, BOOLEAN, NUMERIC, or JSON
25
+ # Value type of the flag. Accepted case-insensitively. Changing the type cascades to `values`, `default`, and every environment's rules and default.
24
26
  attr_accessor :type
25
27
 
26
28
  attr_accessor :default
27
29
 
28
- # Ordered set of allowed values (constrained), or null (unconstrained)
30
+ # Ordered set of allowed values for a constrained flag, or `null` for an unconstrained flag. `BOOLEAN` flags, if constrained, must declare exactly two values.
29
31
  attr_accessor :values
30
32
 
33
+ # Per-environment configuration keyed by environment name (`production`, `staging`, etc.). Environments not listed fall back to the flag's global `default`.
31
34
  attr_accessor :environments
32
35
 
33
- # True if admin-managed, false if auto-discovered
36
+ # `true` when the flag was created through the API, `false` when it was auto-discovered from a bulk-register call. Auto-discovered flags can be edited and converted to managed by setting this to `true`.
34
37
  attr_accessor :managed
35
38
 
39
+ # SDK-reported observations of this flag, grouped by service and environment. Populated automatically by the bulk-register endpoint.
36
40
  attr_accessor :sources
37
41
 
42
+ # When the flag was created.
38
43
  attr_accessor :created_at
39
44
 
45
+ # When the flag was last modified.
40
46
  attr_accessor :updated_at
41
47
 
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
42
70
  # Attribute mapping from ruby-style variable name to JSON key.
43
71
  def self.attribute_map
44
72
  {
@@ -75,7 +103,7 @@ module SmplkitGeneratedClient::Flags
75
103
  :'values' => :'Array<FlagValue>',
76
104
  :'environments' => :'Hash<String, FlagEnvironment>',
77
105
  :'managed' => :'Boolean',
78
- :'sources' => :'Array<Hash<String, Object>>',
106
+ :'sources' => :'Array<FlagSource>',
79
107
  :'created_at' => :'Time',
80
108
  :'updated_at' => :'Time'
81
109
  }
@@ -185,6 +213,8 @@ module SmplkitGeneratedClient::Flags
185
213
  warn '[DEPRECATED] the `valid?` method is obsolete'
186
214
  return false if @name.nil?
187
215
  return false if @type.nil?
216
+ type_validator = EnumAttributeValidator.new('String', ["BOOLEAN", "STRING", "NUMERIC", "JSON"])
217
+ return false unless type_validator.valid?(@type)
188
218
  true
189
219
  end
190
220
 
@@ -198,13 +228,13 @@ module SmplkitGeneratedClient::Flags
198
228
  @name = name
199
229
  end
200
230
 
201
- # Custom attribute writer method with validation
202
- # @param [Object] type Value to be assigned
231
+ # Custom attribute writer method checking allowed values (enum).
232
+ # @param [Object] type Object to be assigned
203
233
  def type=(type)
204
- if type.nil?
205
- fail ArgumentError, 'type cannot be nil'
234
+ validator = EnumAttributeValidator.new('String', ["BOOLEAN", "STRING", "NUMERIC", "JSON"])
235
+ unless validator.valid?(type)
236
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
206
237
  end
207
-
208
238
  @type = type
209
239
  end
210
240
 
@@ -14,21 +14,44 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # One flag declaration reported by an SDK during bulk registration.
17
18
  class FlagBulkItem < ApiModelBase
18
- # Flag key as declared in code
19
+ # Flag key as declared in code. URL-safe and stable for the lifetime of the flag.
19
20
  attr_accessor :id
20
21
 
21
- # Flag type: BOOLEAN, STRING, NUMERIC, or JSON
22
+ # Value type the SDK declared for the flag. Accepted case-insensitively.
22
23
  attr_accessor :type
23
24
 
24
25
  attr_accessor :default
25
26
 
26
- # Service that declared this flag
27
+ # Service reporting the declaration. Defaults to `unknown`.
27
28
  attr_accessor :service
28
29
 
29
- # Environment where observed
30
+ # Environment reporting the declaration. Defaults to `unknown`.
30
31
  attr_accessor :environment
31
32
 
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
32
55
  # Attribute mapping from ruby-style variable name to JSON key.
33
56
  def self.attribute_map
34
57
  {
@@ -135,6 +158,8 @@ module SmplkitGeneratedClient::Flags
135
158
  warn '[DEPRECATED] the `valid?` method is obsolete'
136
159
  return false if @id.nil?
137
160
  return false if @type.nil?
161
+ type_validator = EnumAttributeValidator.new('String', ["BOOLEAN", "STRING", "NUMERIC", "JSON"])
162
+ return false unless type_validator.valid?(@type)
138
163
  true
139
164
  end
140
165
 
@@ -148,13 +173,13 @@ module SmplkitGeneratedClient::Flags
148
173
  @id = id
149
174
  end
150
175
 
151
- # Custom attribute writer method with validation
152
- # @param [Object] type Value to be assigned
176
+ # Custom attribute writer method checking allowed values (enum).
177
+ # @param [Object] type Object to be assigned
153
178
  def type=(type)
154
- if type.nil?
155
- fail ArgumentError, 'type cannot be nil'
179
+ validator = EnumAttributeValidator.new('String', ["BOOLEAN", "STRING", "NUMERIC", "JSON"])
180
+ unless validator.valid?(type)
181
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
156
182
  end
157
-
158
183
  @type = type
159
184
  end
160
185
 
@@ -14,7 +14,9 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # Inputs to the bulk-register-flags action.
17
18
  class FlagBulkRequest < ApiModelBase
19
+ # Flags reported by the SDK in this batch.
18
20
  attr_accessor :flags
19
21
 
20
22
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -14,7 +14,9 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # Result of a bulk-register-flags action.
17
18
  class FlagBulkResponse < ApiModelBase
19
+ # Number of items in the batch that were registered or refreshed.
18
20
  attr_accessor :registered
19
21
 
20
22
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -14,11 +14,15 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # Per-environment evaluation configuration for a flag.
17
18
  class FlagEnvironment < ApiModelBase
19
+ # Whether the flag is active in this environment. When `false`, evaluation skips rules and returns the flag's global `default`.
18
20
  attr_accessor :enabled
19
21
 
22
+ # Environment-level default returned when no rule fires. If `null`, evaluation falls back to the flag's global `default`.
20
23
  attr_accessor :default
21
24
 
25
+ # Targeting rules evaluated top-down. The first rule whose logic returns truthy provides the result.
22
26
  attr_accessor :rules
23
27
 
24
28
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # JSON:API collection response envelope for flags.
17
18
  class FlagListResponse < ApiModelBase
18
19
  attr_accessor :data
19
20
 
@@ -0,0 +1,165 @@
1
+ =begin
2
+ #smplkit Flags API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
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::Flags
17
+ # JSON:API request envelope for creating or updating a flag.
18
+ class FlagRequest < 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' => :'FlagResource'
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::Flags::FlagRequest` 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::Flags::FlagRequest`. 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
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # JSON:API resource envelope for a flag. `id` is the flag key. For create requests, `id` is required and is chosen by the caller. For update requests, `id` may be omitted (the server reads the key from the URL) or supplied to rename the flag.
17
18
  class FlagResource < ApiModelBase
18
19
  attr_accessor :id
19
20
 
@@ -14,6 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # JSON:API single-resource response envelope for a flag.
17
18
  class FlagResponse < ApiModelBase
18
19
  attr_accessor :data
19
20
 
@@ -14,9 +14,12 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Flags
17
+ # A targeting rule that overrides the default within an environment.
17
18
  class FlagRule < ApiModelBase
19
+ # Human-readable description of the rule.
18
20
  attr_accessor :description
19
21
 
22
+ # JSON Logic expression evaluated against the evaluation context. The rule fires when the expression is truthy.
20
23
  attr_accessor :logic
21
24
 
22
25
  attr_accessor :value