vgs_api_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/README.md +237 -0
  5. data/Rakefile +10 -0
  6. data/docs/AliasFormat.md +15 -0
  7. data/docs/AliasesApi.md +366 -0
  8. data/docs/ApiError.md +24 -0
  9. data/docs/CreateAliasesRequest.md +18 -0
  10. data/docs/CreateAliasesRequestExisting.md +20 -0
  11. data/docs/CreateAliasesRequestNew.md +22 -0
  12. data/docs/InlineResponse200.md +18 -0
  13. data/docs/InlineResponse2001.md +18 -0
  14. data/docs/InlineResponse201.md +18 -0
  15. data/docs/InlineResponseDefault.md +18 -0
  16. data/docs/ModelAlias.md +20 -0
  17. data/docs/RevealedData.md +24 -0
  18. data/docs/UpdateAliasRequest.md +18 -0
  19. data/docs/UpdateAliasRequestData.md +18 -0
  20. data/git_push.sh +57 -0
  21. data/lib/vgs_api_client/api/aliases_api.rb +355 -0
  22. data/lib/vgs_api_client/api_client.rb +390 -0
  23. data/lib/vgs_api_client/api_error.rb +57 -0
  24. data/lib/vgs_api_client/configuration.rb +286 -0
  25. data/lib/vgs_api_client/models/alias_format.rb +44 -0
  26. data/lib/vgs_api_client/models/api_error.rb +249 -0
  27. data/lib/vgs_api_client/models/create_aliases_request.rb +225 -0
  28. data/lib/vgs_api_client/models/create_aliases_request_existing.rb +238 -0
  29. data/lib/vgs_api_client/models/create_aliases_request_new.rb +250 -0
  30. data/lib/vgs_api_client/models/inline_response200.rb +220 -0
  31. data/lib/vgs_api_client/models/inline_response2001.rb +221 -0
  32. data/lib/vgs_api_client/models/inline_response201.rb +221 -0
  33. data/lib/vgs_api_client/models/inline_response_default.rb +221 -0
  34. data/lib/vgs_api_client/models/model_alias.rb +228 -0
  35. data/lib/vgs_api_client/models/revealed_data.rb +253 -0
  36. data/lib/vgs_api_client/models/update_alias_request.rb +223 -0
  37. data/lib/vgs_api_client/models/update_alias_request_data.rb +226 -0
  38. data/lib/vgs_api_client/version.rb +15 -0
  39. data/lib/vgs_api_client.rb +53 -0
  40. data/spec/api/aliases_api_spec.rb +137 -0
  41. data/spec/api_client_spec.rb +226 -0
  42. data/spec/configuration_spec.rb +42 -0
  43. data/spec/models/alias_format_spec.rb +28 -0
  44. data/spec/models/api_error_spec.rb +52 -0
  45. data/spec/models/create_aliases_request_existing_spec.rb +40 -0
  46. data/spec/models/create_aliases_request_new_spec.rb +46 -0
  47. data/spec/models/create_aliases_request_spec.rb +34 -0
  48. data/spec/models/inline_response2001_spec.rb +34 -0
  49. data/spec/models/inline_response200_spec.rb +34 -0
  50. data/spec/models/inline_response201_spec.rb +34 -0
  51. data/spec/models/inline_response_default_spec.rb +34 -0
  52. data/spec/models/model_alias_spec.rb +40 -0
  53. data/spec/models/revealed_data_spec.rb +52 -0
  54. data/spec/models/update_alias_request_data_spec.rb +34 -0
  55. data/spec/models/update_alias_request_spec.rb +34 -0
  56. data/spec/spec_helper.rb +111 -0
  57. data/vgs_api_client.gemspec +38 -0
  58. metadata +156 -0
@@ -0,0 +1,355 @@
1
+ =begin
2
+ #Vault HTTP API
3
+
4
+ #Storing, retrieving, and managing sensitive data within a VGS organization. **NOTE:** _The Vault API is intended only for environments that are already PCI-compliant. If you want to use this API, but are not yet PCI-compliant, you can use [VGS Collect](https://www.verygoodsecurity.com/docs/vgs-collect/what-is-it) or VGS Proxy with [Inbound Routes](https://www.verygoodsecurity.com/docs/getting-started/quick-integration#securing-inbound-connection) to quickly and seamlessly achieve compliance._ Looking for the old version of the API? Find it [here](https://www.verygoodsecurity.com/docs/api/1/vault). # Introduction Each encrypted value stored in a VGS vault has one or multiple _aliases_ associated with it. These aliases are fully opaque and retain no information about the underlying data. The user may safely store aliases without compromising data security. **NOTE:** The API works with persistent storage only. Unlike volatile storage, this means that the data is stored permanently, without any implicit TTL. Aliases are not valuable on their own. However, they can be used to decrypt the associated value and pass it to another service via the [forward proxy](https://www.verygoodsecurity.com/docs/guides/outbound-connection). ## Alias Formats Each alias corresponds to a certain format. There are several alias formats suitable for different kinds of sensitive data. For example, `UUID` produces a random Base58-encoded UUID string with an environment-dependent prefix: ``` tok_sandbox_bhtsCwFUzoJMw9rWUfEV5e ``` This format is generic and suitable for any kind of data. The tables below contain descriptions of all alias formats recognized by the API. ### Generic Formats | Value | Description | |-------------------------|-------------------------------------------------------| | `NUM_LENGTH_PRESERVING` | Length-Preserving, Numeric | | `RAW_UUID` | UUID | | `UUID` | UUID (Prefixed, Base58-Encoded) | | `GENERIC_T_FOUR` | UUID (Prefixed, Base58-Encoded, Last four preserving) | ### Account Number Formats | Value | Description | |-----------------------------------|--------------------------------------| | `FPE_ACC_NUM_T_FOUR` | Length-Preserving, Numeric (A4) | | `FPE_ALPHANUMERIC_ACC_NUM_T_FOUR` | Length-Preserving, Alphanumeric (A4) | ### Payment Card Formats | Value | Description | |------------------|---------------------------------------------| | `FPE_SIX_T_FOUR` | Format-Preserving, Luhn Valid (6T4) | | `FPE_T_FOUR` | Format-Preserving, Luhn Valid (T4) | | `PFPT` | Prefixed, Luhn Valid, 19-Digit Fixed Length | ### SSN Formats | Value | Description | |------------------|------------------------| | `FPE_SSN_T_FOUR` | Format-Preserving (A4) | # Authentication This API uses `Basic` authentication. Credentials to access the API can be generated on the [dashboard](https://dashboard.verygoodsecurity.com) by going to the Settings section of the vault of your choosing. [Docs » Guides » Access credentials](https://www.verygoodsecurity.com/docs/settings/access-credentials) # Rate Limiting The API allows up to 3,000 requests per minute. Requests are associated with the vault, regardless of the access credentials used to authenticate the request. Your current rate limit is included as HTTP headers in every API response: | Header Name | Description | |-------------------------|----------------------------------------------------------| | `x-ratelimit-remaining` | The number of requests remaining in the 1-minute window. | If you exceed the rate limit, the API will reject the request with HTTP [429 Too Many Requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429). # Errors The API uses standard HTTP status codes to indicate whether the request succeeded or not. In case of failure, the response body will be JSON in a predefined format. For example, trying to create too many aliases at once results in the following response: ```json { \"errors\": [ { \"status\": 400, \"title\": \"Bad request\", \"detail\": \"Too many values (limit: 20)\", \"href\": \"https://api.sandbox.verygoodvault.com/aliases\" } ] } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@verygoodsecurity.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module VgsapiClient
16
+ class AliasesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create aliases
23
+ # Stores multiple values at once & returns their aliases. Alternatively, this endpoint may be used to associate additional (i.e. secondary) aliases with the same underlying data as the reference alias specified in the request body. **NOTE:** You cannot reference the same alias more than once in a single request.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [CreateAliasesRequest] :create_aliases_request
26
+ # @return [InlineResponse201]
27
+ def create_aliases(opts = {})
28
+ data, _status_code, _headers = create_aliases_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Create aliases
33
+ # Stores multiple values at once & returns their aliases. Alternatively, this endpoint may be used to associate additional (i.e. secondary) aliases with the same underlying data as the reference alias specified in the request body. **NOTE:** You cannot reference the same alias more than once in a single request.
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [CreateAliasesRequest] :create_aliases_request
36
+ # @return [Array<(InlineResponse201, Integer, Hash)>] InlineResponse201 data, response status code and response headers
37
+ def create_aliases_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AliasesApi.create_aliases ...'
40
+ end
41
+ # resource path
42
+ local_var_path = '/aliases'
43
+
44
+ # query parameters
45
+ query_params = opts[:query_params] || {}
46
+
47
+ # header parameters
48
+ header_params = opts[:header_params] || {}
49
+ # HTTP header 'Accept' (if needed)
50
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
51
+ # HTTP header 'Content-Type'
52
+ content_type = @api_client.select_header_content_type(['application/json'])
53
+ if !content_type.nil?
54
+ header_params['Content-Type'] = content_type
55
+ end
56
+
57
+ # form parameters
58
+ form_params = opts[:form_params] || {}
59
+
60
+ # http body (model)
61
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_aliases_request'])
62
+
63
+ # return_type
64
+ return_type = opts[:debug_return_type] || 'InlineResponse201'
65
+
66
+ # auth_names
67
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
68
+
69
+ new_options = opts.merge(
70
+ :operation => :"AliasesApi.create_aliases",
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => return_type
77
+ )
78
+
79
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug "API called: AliasesApi#create_aliases\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Delete alias
87
+ # Removes a single alias.
88
+ # @param _alias [String] Alias to operate on.
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [nil]
91
+ def delete_alias(_alias, opts = {})
92
+ delete_alias_with_http_info(_alias, opts)
93
+ nil
94
+ end
95
+
96
+ # Delete alias
97
+ # Removes a single alias.
98
+ # @param _alias [String] Alias to operate on.
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
101
+ def delete_alias_with_http_info(_alias, opts = {})
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug 'Calling API: AliasesApi.delete_alias ...'
104
+ end
105
+ # verify the required parameter '_alias' is set
106
+ if @api_client.config.client_side_validation && _alias.nil?
107
+ fail ArgumentError, "Missing the required parameter '_alias' when calling AliasesApi.delete_alias"
108
+ end
109
+ # resource path
110
+ local_var_path = '/aliases/{alias}'.sub('{' + 'alias' + '}', CGI.escape(_alias.to_s))
111
+
112
+ # query parameters
113
+ query_params = opts[:query_params] || {}
114
+
115
+ # header parameters
116
+ header_params = opts[:header_params] || {}
117
+ # HTTP header 'Accept' (if needed)
118
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
119
+
120
+ # form parameters
121
+ form_params = opts[:form_params] || {}
122
+
123
+ # http body (model)
124
+ post_body = opts[:debug_body]
125
+
126
+ # return_type
127
+ return_type = opts[:debug_return_type]
128
+
129
+ # auth_names
130
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
131
+
132
+ new_options = opts.merge(
133
+ :operation => :"AliasesApi.delete_alias",
134
+ :header_params => header_params,
135
+ :query_params => query_params,
136
+ :form_params => form_params,
137
+ :body => post_body,
138
+ :auth_names => auth_names,
139
+ :return_type => return_type
140
+ )
141
+
142
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
143
+ if @api_client.config.debugging
144
+ @api_client.config.logger.debug "API called: AliasesApi#delete_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
145
+ end
146
+ return data, status_code, headers
147
+ end
148
+
149
+ # Reveal single alias
150
+ # Retrieves a stored value along with its aliases. **NOTE:** This endpoint may expose sensitive data. Therefore, it is disabled by default. To enable it, please contact your VGS account manager or drop us a line at [support@verygoodsecurity.com](mailto:support@verygoodsecurity.com).
151
+ # @param _alias [String] Alias to operate on.
152
+ # @param [Hash] opts the optional parameters
153
+ # @return [InlineResponse2001]
154
+ def reveal_alias(_alias, opts = {})
155
+ data, _status_code, _headers = reveal_alias_with_http_info(_alias, opts)
156
+ data
157
+ end
158
+
159
+ # Reveal single alias
160
+ # Retrieves a stored value along with its aliases. **NOTE:** This endpoint may expose sensitive data. Therefore, it is disabled by default. To enable it, please contact your VGS account manager or drop us a line at [support@verygoodsecurity.com](mailto:support@verygoodsecurity.com).
161
+ # @param _alias [String] Alias to operate on.
162
+ # @param [Hash] opts the optional parameters
163
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
164
+ def reveal_alias_with_http_info(_alias, opts = {})
165
+ if @api_client.config.debugging
166
+ @api_client.config.logger.debug 'Calling API: AliasesApi.reveal_alias ...'
167
+ end
168
+ # verify the required parameter '_alias' is set
169
+ if @api_client.config.client_side_validation && _alias.nil?
170
+ fail ArgumentError, "Missing the required parameter '_alias' when calling AliasesApi.reveal_alias"
171
+ end
172
+ # resource path
173
+ local_var_path = '/aliases/{alias}'.sub('{' + 'alias' + '}', CGI.escape(_alias.to_s))
174
+
175
+ # query parameters
176
+ query_params = opts[:query_params] || {}
177
+
178
+ # header parameters
179
+ header_params = opts[:header_params] || {}
180
+ # HTTP header 'Accept' (if needed)
181
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
182
+
183
+ # form parameters
184
+ form_params = opts[:form_params] || {}
185
+
186
+ # http body (model)
187
+ post_body = opts[:debug_body]
188
+
189
+ # return_type
190
+ return_type = opts[:debug_return_type] || 'InlineResponse2001'
191
+
192
+ # auth_names
193
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
194
+
195
+ new_options = opts.merge(
196
+ :operation => :"AliasesApi.reveal_alias",
197
+ :header_params => header_params,
198
+ :query_params => query_params,
199
+ :form_params => form_params,
200
+ :body => post_body,
201
+ :auth_names => auth_names,
202
+ :return_type => return_type
203
+ )
204
+
205
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
206
+ if @api_client.config.debugging
207
+ @api_client.config.logger.debug "API called: AliasesApi#reveal_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
208
+ end
209
+ return data, status_code, headers
210
+ end
211
+
212
+ # Reveal multiple aliases
213
+ # Given a list of aliases, retrieves all associated values stored in the vault. **NOTE:** This endpoint may expose sensitive data. Therefore, it is disabled by default. To enable it, please contact your VGS account manager or drop us a line at [support@verygoodsecurity.com](mailto:support@verygoodsecurity.com).
214
+ # @param q [Array<String>] Comma-separated list of aliases to reveal.
215
+ # @param [Hash] opts the optional parameters
216
+ # @return [InlineResponse200]
217
+ def reveal_multiple_aliases(q, opts = {})
218
+ data, _status_code, _headers = reveal_multiple_aliases_with_http_info(q, opts)
219
+ data
220
+ end
221
+
222
+ # Reveal multiple aliases
223
+ # Given a list of aliases, retrieves all associated values stored in the vault. **NOTE:** This endpoint may expose sensitive data. Therefore, it is disabled by default. To enable it, please contact your VGS account manager or drop us a line at [support@verygoodsecurity.com](mailto:support@verygoodsecurity.com).
224
+ # @param q [Array<String>] Comma-separated list of aliases to reveal.
225
+ # @param [Hash] opts the optional parameters
226
+ # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers
227
+ def reveal_multiple_aliases_with_http_info(q, opts = {})
228
+ if @api_client.config.debugging
229
+ @api_client.config.logger.debug 'Calling API: AliasesApi.reveal_multiple_aliases ...'
230
+ end
231
+ # verify the required parameter 'q' is set
232
+ if @api_client.config.client_side_validation && q.nil?
233
+ fail ArgumentError, "Missing the required parameter 'q' when calling AliasesApi.reveal_multiple_aliases"
234
+ end
235
+ if @api_client.config.client_side_validation && q.length > 20
236
+ fail ArgumentError, 'invalid value for "q" when calling AliasesApi.reveal_multiple_aliases, number of items must be less than or equal to 20.'
237
+ end
238
+
239
+ if @api_client.config.client_side_validation && q.length < 1
240
+ fail ArgumentError, 'invalid value for "q" when calling AliasesApi.reveal_multiple_aliases, number of items must be greater than or equal to 1.'
241
+ end
242
+
243
+ # resource path
244
+ local_var_path = '/aliases'
245
+
246
+ # query parameters
247
+ query_params = opts[:query_params] || {}
248
+ # query_params[:'q'] = @api_client.build_collection_param(q, :multi)
249
+ query_params[:'q'] = q.join(',')
250
+
251
+ # header parameters
252
+ header_params = opts[:header_params] || {}
253
+ # HTTP header 'Accept' (if needed)
254
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
255
+
256
+ # form parameters
257
+ form_params = opts[:form_params] || {}
258
+
259
+ # http body (model)
260
+ post_body = opts[:debug_body]
261
+
262
+ # return_type
263
+ return_type = opts[:debug_return_type] || 'InlineResponse200'
264
+
265
+ # auth_names
266
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
267
+
268
+ new_options = opts.merge(
269
+ :operation => :"AliasesApi.reveal_multiple_aliases",
270
+ :header_params => header_params,
271
+ :query_params => query_params,
272
+ :form_params => form_params,
273
+ :body => post_body,
274
+ :auth_names => auth_names,
275
+ :return_type => return_type
276
+ )
277
+
278
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
279
+ if @api_client.config.debugging
280
+ @api_client.config.logger.debug "API called: AliasesApi#reveal_multiple_aliases\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
281
+ end
282
+ return data, status_code, headers
283
+ end
284
+
285
+ # Update data classifiers
286
+ # Apply new classifiers to the value that the specified alias is associated with.
287
+ # @param _alias [String] Alias to operate on.
288
+ # @param [Hash] opts the optional parameters
289
+ # @option opts [UpdateAliasRequest] :update_alias_request
290
+ # @return [nil]
291
+ def update_alias(_alias, opts = {})
292
+ data, status_code, headers = update_alias_with_http_info(_alias, opts)
293
+ status_code
294
+ end
295
+
296
+ # Update data classifiers
297
+ # Apply new classifiers to the value that the specified alias is associated with.
298
+ # @param _alias [String] Alias to operate on.
299
+ # @param [Hash] opts the optional parameters
300
+ # @option opts [UpdateAliasRequest] :update_alias_request
301
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
302
+ def update_alias_with_http_info(_alias, opts = {})
303
+ if @api_client.config.debugging
304
+ @api_client.config.logger.debug 'Calling API: AliasesApi.update_alias ...'
305
+ end
306
+ # verify the required parameter '_alias' is set
307
+ if @api_client.config.client_side_validation && _alias.nil?
308
+ fail ArgumentError, "Missing the required parameter '_alias' when calling AliasesApi.update_alias"
309
+ end
310
+ # resource path
311
+ local_var_path = '/aliases/{alias}'.sub('{' + 'alias' + '}', CGI.escape(_alias.to_s))
312
+
313
+ # query parameters
314
+ query_params = opts[:query_params] || {}
315
+
316
+ # header parameters
317
+ header_params = opts[:header_params] || {}
318
+ # HTTP header 'Accept' (if needed)
319
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
320
+ # HTTP header 'Content-Type'
321
+ content_type = @api_client.select_header_content_type(['application/json'])
322
+ if !content_type.nil?
323
+ header_params['Content-Type'] = content_type
324
+ end
325
+
326
+ # form parameters
327
+ form_params = opts[:form_params] || {}
328
+
329
+ # http body (model)
330
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_alias_request'])
331
+
332
+ # return_type
333
+ return_type = opts[:debug_return_type]
334
+
335
+ # auth_names
336
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
337
+
338
+ new_options = opts.merge(
339
+ :operation => :"AliasesApi.update_alias",
340
+ :header_params => header_params,
341
+ :query_params => query_params,
342
+ :form_params => form_params,
343
+ :body => post_body,
344
+ :auth_names => auth_names,
345
+ :return_type => return_type
346
+ )
347
+
348
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
349
+ if @api_client.config.debugging
350
+ @api_client.config.logger.debug "API called: AliasesApi#update_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
351
+ end
352
+ return data, status_code, headers
353
+ end
354
+ end
355
+ end