pds-metronome 0.1.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 (134) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +164 -0
  4. data/Rakefile +10 -0
  5. data/docs/AccessManagementApi.md +300 -0
  6. data/docs/AccessType.md +15 -0
  7. data/docs/AgingOffsetUnit.md +15 -0
  8. data/docs/AgingStrategy.md +15 -0
  9. data/docs/ApiKeyData.md +28 -0
  10. data/docs/ApiKeyDataListResponse.md +20 -0
  11. data/docs/ApiKeyListResponse.md +20 -0
  12. data/docs/CreateApiKeyRequest.md +22 -0
  13. data/docs/CreateOrModifyApiKeyResponse.md +22 -0
  14. data/docs/CreateOrModifyPolicyRequest.md +22 -0
  15. data/docs/CreateOrModifyPolicyResponse.md +20 -0
  16. data/docs/DataExpiryApi.md +79 -0
  17. data/docs/ExpireItemResponse.md +20 -0
  18. data/docs/ExpireSubItemResponse.md +22 -0
  19. data/docs/ExpiryResponse.md +22 -0
  20. data/docs/ExpiryResponsePendingInner.md +79 -0
  21. data/docs/GetManyApiKeys200Response.md +79 -0
  22. data/docs/GetManyPolicies200Response.md +79 -0
  23. data/docs/ItemAccessApi.md +605 -0
  24. data/docs/ItemExpiry.md +20 -0
  25. data/docs/ItemMetadataResponse.md +28 -0
  26. data/docs/ItemOrSubItemAccessLog.md +32 -0
  27. data/docs/ItemOrSubItemPolicyResponse.md +22 -0
  28. data/docs/ModifyApiKeyRequest.md +20 -0
  29. data/docs/Permission.md +15 -0
  30. data/docs/PermissionDeniedResponse.md +30 -0
  31. data/docs/PolicyData.md +26 -0
  32. data/docs/PolicyDataListResponse.md +28 -0
  33. data/docs/PolicyListResponse.md +28 -0
  34. data/docs/PolicyManagementApi.md +379 -0
  35. data/docs/PutApiKeyRequest.md +49 -0
  36. data/docs/SignupRequest.md +18 -0
  37. data/docs/SignupResponse.md +24 -0
  38. data/docs/SubItemMetadataResponse.md +22 -0
  39. data/docs/SubItemsExpiry.md +22 -0
  40. data/docs/TelemetryApi.md +80 -0
  41. data/docs/TelemetryObservation.md +20 -0
  42. data/docs/TelemetryRequest.md +22 -0
  43. data/docs/ValidationErrorResponseInner.md +22 -0
  44. data/docs/ValidationProblem.md +22 -0
  45. data/lib/metronome/api/access_management_api.rb +285 -0
  46. data/lib/metronome/api/data_expiry_api.rb +105 -0
  47. data/lib/metronome/api/item_access_api.rb +549 -0
  48. data/lib/metronome/api/policy_management_api.rb +348 -0
  49. data/lib/metronome/api/telemetry_api.rb +84 -0
  50. data/lib/metronome/api_client.rb +393 -0
  51. data/lib/metronome/api_error.rb +58 -0
  52. data/lib/metronome/configuration.rb +312 -0
  53. data/lib/metronome/models/access_type.rb +41 -0
  54. data/lib/metronome/models/aging_offset_unit.rb +41 -0
  55. data/lib/metronome/models/aging_strategy.rb +40 -0
  56. data/lib/metronome/models/api_key_data.rb +330 -0
  57. data/lib/metronome/models/api_key_data_list_response.rb +241 -0
  58. data/lib/metronome/models/api_key_list_response.rb +241 -0
  59. data/lib/metronome/models/create_api_key_request.rb +239 -0
  60. data/lib/metronome/models/create_or_modify_api_key_response.rb +255 -0
  61. data/lib/metronome/models/create_or_modify_policy_request.rb +293 -0
  62. data/lib/metronome/models/create_or_modify_policy_response.rb +240 -0
  63. data/lib/metronome/models/expire_item_response.rb +240 -0
  64. data/lib/metronome/models/expire_sub_item_response.rb +254 -0
  65. data/lib/metronome/models/expiry_response.rb +299 -0
  66. data/lib/metronome/models/expiry_response_pending_inner.rb +55 -0
  67. data/lib/metronome/models/get_many_api_keys200_response.rb +55 -0
  68. data/lib/metronome/models/get_many_policies200_response.rb +55 -0
  69. data/lib/metronome/models/item_expiry.rb +239 -0
  70. data/lib/metronome/models/item_metadata_response.rb +274 -0
  71. data/lib/metronome/models/item_or_sub_item_access_log.rb +337 -0
  72. data/lib/metronome/models/item_or_sub_item_policy_response.rb +245 -0
  73. data/lib/metronome/models/modify_api_key_request.rb +230 -0
  74. data/lib/metronome/models/permission.rb +45 -0
  75. data/lib/metronome/models/permission_denied_response.rb +338 -0
  76. data/lib/metronome/models/policy_data.rb +364 -0
  77. data/lib/metronome/models/policy_data_list_response.rb +286 -0
  78. data/lib/metronome/models/policy_list_response.rb +286 -0
  79. data/lib/metronome/models/put_api_key_request.rb +105 -0
  80. data/lib/metronome/models/signup_request.rb +225 -0
  81. data/lib/metronome/models/signup_response.rb +266 -0
  82. data/lib/metronome/models/sub_item_metadata_response.rb +245 -0
  83. data/lib/metronome/models/sub_items_expiry.rb +255 -0
  84. data/lib/metronome/models/telemetry_observation.rb +240 -0
  85. data/lib/metronome/models/telemetry_request.rb +259 -0
  86. data/lib/metronome/models/validation_error_response_inner.rb +254 -0
  87. data/lib/metronome/models/validation_problem.rb +254 -0
  88. data/lib/metronome/version.rb +15 -0
  89. data/lib/metronome.rb +80 -0
  90. data/shell.nix +6 -0
  91. data/spec/api/access_management_api_spec.rb +82 -0
  92. data/spec/api/data_expiry_api_spec.rb +46 -0
  93. data/spec/api/item_access_api_spec.rb +132 -0
  94. data/spec/api/policy_management_api_spec.rb +94 -0
  95. data/spec/api/telemetry_api_spec.rb +46 -0
  96. data/spec/api_client_spec.rb +228 -0
  97. data/spec/configuration_spec.rb +42 -0
  98. data/spec/models/access_type_spec.rb +28 -0
  99. data/spec/models/aging_offset_unit_spec.rb +28 -0
  100. data/spec/models/aging_strategy_spec.rb +28 -0
  101. data/spec/models/api_key_data_list_response_spec.rb +40 -0
  102. data/spec/models/api_key_data_spec.rb +68 -0
  103. data/spec/models/api_key_list_response_spec.rb +40 -0
  104. data/spec/models/create_api_key_request_spec.rb +46 -0
  105. data/spec/models/create_or_modify_api_key_response_spec.rb +46 -0
  106. data/spec/models/create_or_modify_policy_request_spec.rb +46 -0
  107. data/spec/models/create_or_modify_policy_response_spec.rb +40 -0
  108. data/spec/models/expire_item_response_spec.rb +40 -0
  109. data/spec/models/expire_sub_item_response_spec.rb +46 -0
  110. data/spec/models/expiry_response_pending_inner_spec.rb +43 -0
  111. data/spec/models/expiry_response_spec.rb +46 -0
  112. data/spec/models/get_many_api_keys200_response_spec.rb +43 -0
  113. data/spec/models/get_many_policies200_response_spec.rb +43 -0
  114. data/spec/models/item_expiry_spec.rb +40 -0
  115. data/spec/models/item_metadata_response_spec.rb +64 -0
  116. data/spec/models/item_or_sub_item_access_log_spec.rb +76 -0
  117. data/spec/models/item_or_sub_item_policy_response_spec.rb +46 -0
  118. data/spec/models/modify_api_key_request_spec.rb +40 -0
  119. data/spec/models/permission_denied_response_spec.rb +82 -0
  120. data/spec/models/permission_spec.rb +28 -0
  121. data/spec/models/policy_data_list_response_spec.rb +64 -0
  122. data/spec/models/policy_data_spec.rb +58 -0
  123. data/spec/models/policy_list_response_spec.rb +64 -0
  124. data/spec/models/put_api_key_request_spec.rb +31 -0
  125. data/spec/models/signup_request_spec.rb +34 -0
  126. data/spec/models/signup_response_spec.rb +52 -0
  127. data/spec/models/sub_item_metadata_response_spec.rb +46 -0
  128. data/spec/models/sub_items_expiry_spec.rb +46 -0
  129. data/spec/models/telemetry_observation_spec.rb +40 -0
  130. data/spec/models/telemetry_request_spec.rb +46 -0
  131. data/spec/models/validation_error_response_inner_spec.rb +46 -0
  132. data/spec/models/validation_problem_spec.rb +46 -0
  133. data/spec/spec_helper.rb +111 -0
  134. metadata +260 -0
@@ -0,0 +1,312 @@
1
+ =begin
2
+ #Metronome API
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: info@privatedataservices.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.4.0
10
+
11
+ =end
12
+
13
+ module Metronome
14
+ class Configuration
15
+ # Defines url scheme
16
+ attr_accessor :scheme
17
+
18
+ # Defines url host
19
+ attr_accessor :host
20
+
21
+ # Defines url base path
22
+ attr_accessor :base_path
23
+
24
+ # Define server configuration index
25
+ attr_accessor :server_index
26
+
27
+ # Define server operation configuration index
28
+ attr_accessor :server_operation_index
29
+
30
+ # Default server variables
31
+ attr_accessor :server_variables
32
+
33
+ # Default server operation variables
34
+ attr_accessor :server_operation_variables
35
+
36
+ # Defines API keys used with API Key authentications.
37
+ #
38
+ # @return [Hash] key: parameter name, value: parameter value (API key)
39
+ #
40
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
41
+ # config.api_key['api_key'] = 'xxx'
42
+ attr_accessor :api_key
43
+
44
+ # Defines API key prefixes used with API Key authentications.
45
+ #
46
+ # @return [Hash] key: parameter name, value: API key prefix
47
+ #
48
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
49
+ # config.api_key_prefix['api_key'] = 'Token'
50
+ attr_accessor :api_key_prefix
51
+
52
+ # Defines the username used with HTTP basic authentication.
53
+ #
54
+ # @return [String]
55
+ attr_accessor :username
56
+
57
+ # Defines the password used with HTTP basic authentication.
58
+ #
59
+ # @return [String]
60
+ attr_accessor :password
61
+
62
+ # Defines the access token (Bearer) used with OAuth2.
63
+ attr_accessor :access_token
64
+
65
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
66
+ # Overrides the access_token if set
67
+ # @return [Proc]
68
+ attr_accessor :access_token_getter
69
+
70
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
71
+ # details will be logged with `logger.debug` (see the `logger` attribute).
72
+ # Default to false.
73
+ #
74
+ # @return [true, false]
75
+ attr_accessor :debugging
76
+
77
+ # Defines the logger used for debugging.
78
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
79
+ #
80
+ # @return [#debug]
81
+ attr_accessor :logger
82
+
83
+ # Defines the temporary folder to store downloaded files
84
+ # (for API endpoints that have file response).
85
+ # Default to use `Tempfile`.
86
+ #
87
+ # @return [String]
88
+ attr_accessor :temp_folder_path
89
+
90
+ # The time limit for HTTP request in seconds.
91
+ # Default to 0 (never times out).
92
+ attr_accessor :timeout
93
+
94
+ # Set this to false to skip client side validation in the operation.
95
+ # Default to true.
96
+ # @return [true, false]
97
+ attr_accessor :client_side_validation
98
+
99
+ ### TLS/SSL setting
100
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
101
+ # Default to true.
102
+ #
103
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
104
+ #
105
+ # @return [true, false]
106
+ attr_accessor :verify_ssl
107
+
108
+ ### TLS/SSL setting
109
+ # Set this to false to skip verifying SSL host name
110
+ # Default to true.
111
+ #
112
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
113
+ #
114
+ # @return [true, false]
115
+ attr_accessor :verify_ssl_host
116
+
117
+ ### TLS/SSL setting
118
+ # Set this to customize the certificate file to verify the peer.
119
+ #
120
+ # @return [String] the path to the certificate file
121
+ #
122
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
123
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
124
+ attr_accessor :ssl_ca_cert
125
+
126
+ ### TLS/SSL setting
127
+ # Client certificate file (for client certificate)
128
+ attr_accessor :cert_file
129
+
130
+ ### TLS/SSL setting
131
+ # Client private key file (for client certificate)
132
+ attr_accessor :key_file
133
+
134
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
135
+ # Default to nil.
136
+ #
137
+ # @see The params_encoding option of Ethon. Related source code:
138
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
139
+ attr_accessor :params_encoding
140
+
141
+
142
+ attr_accessor :inject_format
143
+
144
+ attr_accessor :force_ending_format
145
+
146
+ # PDS patch: attributes for configurating the host
147
+ attr_accessor :customer_id
148
+ attr_accessor :region
149
+ attr_accessor :use_production_instance
150
+
151
+ def initialize
152
+ @scheme = 'https'
153
+ @host = nil
154
+ @customer_id = nil
155
+ @region = nil
156
+ @use_production_instance = true
157
+ @base_path = ''
158
+ @server_index = 0
159
+ @server_operation_index = {}
160
+ @server_variables = {}
161
+ @server_operation_variables = {}
162
+ @api_key = {}
163
+ @api_key_prefix = {}
164
+ @client_side_validation = true
165
+ @verify_ssl = true
166
+ @verify_ssl_host = true
167
+ @cert_file = nil
168
+ @key_file = nil
169
+ @timeout = 0
170
+ @params_encoding = nil
171
+ @debugging = false
172
+ @inject_format = false
173
+ @force_ending_format = false
174
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
175
+
176
+ yield(self) if block_given?
177
+ end
178
+
179
+ # PDS patch: construct the host from required attributes.
180
+ def check_required_attributes
181
+ raise RuntimeError, "You must specify a customer_id" if customer_id.nil?
182
+ raise RuntimeError, "You must specify a region" if region.nil?
183
+ raise RuntimeError, "customer_id may only contain characters [A-za-z0-9\-]" if customer_id !~ /^[A-Za-z0-9\-]+$/
184
+
185
+ available_regions = ["eu-north-1"]
186
+ raise RuntimeError, "Region #{region} must be one of the available regions #{available_regions}" if not available_regions.include?(region)
187
+ raise RuntimeError, "use_production_instance must be true or false" if not use_production_instance.instance_of?(TrueClass) || use_production_instance.instance_of?(FalseClass)
188
+
189
+ @host = use_production_instance ? "#{customer_id}.api.#{region}.privatedataservices.com" : "#{customer_id}.dev-api.#{region}.privatedataservices.com"
190
+ end
191
+
192
+ # The default Configuration object.
193
+ def self.default
194
+ @@default ||= Configuration.new
195
+ end
196
+
197
+ def configure
198
+ yield(self) if block_given?
199
+ check_required_attributes
200
+ end
201
+
202
+ def scheme=(scheme)
203
+ # remove :// from scheme
204
+ @scheme = scheme.sub(/:\/\//, '')
205
+ end
206
+
207
+ def host=(host)
208
+ # remove http(s):// and anything after a slash
209
+ @host = host.sub(/https?:\/\//, '').split('/').first
210
+ end
211
+
212
+ def base_path=(base_path)
213
+ # Add leading and trailing slashes to base_path
214
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
215
+ @base_path = '' if @base_path == '/'
216
+ end
217
+
218
+ # Returns base URL for specified operation based on server settings
219
+ def base_url(operation = nil)
220
+ index = server_operation_index.fetch(operation, server_index)
221
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
222
+
223
+ server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
224
+ end
225
+
226
+ # Gets API key (with prefix if set).
227
+ # @param [String] param_name the parameter name of API key auth
228
+ def api_key_with_prefix(param_name, param_alias = nil)
229
+ key = @api_key[param_name]
230
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
231
+ if @api_key_prefix[param_name]
232
+ "#{@api_key_prefix[param_name]} #{key}"
233
+ else
234
+ key
235
+ end
236
+ end
237
+
238
+ # Gets access_token using access_token_getter or uses the static access_token
239
+ def access_token_with_refresh
240
+ return access_token if access_token_getter.nil?
241
+ access_token_getter.call
242
+ end
243
+
244
+ # Gets Basic Auth token string
245
+ def basic_auth_token
246
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
247
+ end
248
+
249
+ # Returns Auth Settings hash for api client.
250
+ def auth_settings
251
+ {
252
+ 'ApiKeyAuth' =>
253
+ {
254
+ type: 'api_key',
255
+ in: 'header',
256
+ key: 'X-API-Key',
257
+ value: api_key_with_prefix('ApiKeyAuth')
258
+ },
259
+ }
260
+ end
261
+
262
+ # Returns an array of Server setting
263
+ def server_settings
264
+ [
265
+ {
266
+ url: "#{scheme}://#{host}", # PDS patch
267
+ description: "An example of your API url.",
268
+ }
269
+ ]
270
+ end
271
+
272
+ def operation_server_settings
273
+ {
274
+ }
275
+ end
276
+
277
+ # Returns URL based on server settings
278
+ #
279
+ # @param index array index of the server settings
280
+ # @param variables hash of variable and the corresponding value
281
+ def server_url(index, variables = {}, servers = nil)
282
+ servers = server_settings if servers == nil
283
+
284
+ # check array index out of bound
285
+ if (index < 0 || index >= servers.size)
286
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
287
+ end
288
+
289
+ server = servers[index]
290
+ url = server[:url]
291
+
292
+ return url unless server.key? :variables
293
+
294
+ # go through variable and assign a value
295
+ server[:variables].each do |name, variable|
296
+ if variables.key?(name)
297
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
298
+ url.gsub! "{" + name.to_s + "}", variables[name]
299
+ else
300
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
301
+ end
302
+ else
303
+ # use default value
304
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
305
+ end
306
+ end
307
+
308
+ url
309
+ end
310
+
311
+ end
312
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #Metronome API
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: info@privatedataservices.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Metronome
17
+ class AccessType
18
+ READ = "read".freeze
19
+ WRITE = "write".freeze
20
+ EXPIRE = "expire".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [READ, WRITE, EXPIRE].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if AccessType.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #AccessType"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #Metronome API
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: info@privatedataservices.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Metronome
17
+ class AgingOffsetUnit
18
+ YEAR = "year".freeze
19
+ MONTH = "month".freeze
20
+ DAY = "day".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [YEAR, MONTH, DAY].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if AgingOffsetUnit.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #AgingOffsetUnit"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #Metronome API
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: info@privatedataservices.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Metronome
17
+ class AgingStrategy
18
+ FIRST_READ_OR_WRITE = "since-first-read-or-write".freeze
19
+ LAST_READ_OR_WRITE = "since-last-read-or-write".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [FIRST_READ_OR_WRITE, LAST_READ_OR_WRITE].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if AgingStrategy.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #AgingStrategy"
38
+ end
39
+ end
40
+ end