vgs_api_client 0.0.1.alpha202205271209 → 0.0.1.alpha202205272111

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,409 @@
1
+ =begin
2
+ #Vault HTTP API
3
+
4
+ #The VGS Vault HTTP API is used for storing, retrieving, and managing sensitive data (aka Tokenization) within a VGS Vault. The VGS API is organized around REST. Our API is built with a predictable resource-oriented structure, uses JSON-encoded requests and responses, follows standard HTTP verbs/responses, and uses industry standard authentication. ## What is VGS Storing sensitive data on your company’s infrastructure often comes with a heavy compliance burden. For instance, storing payments data yourself greatly increases the amount of work needed to become PCI compliant. It also increases your security risk in general. To combat this, companies will minimize the amount of sensitive information they have to handle or store. VGS provides multiple methods for minimizing the sensitive information that needs to be stored which allows customers to secure any type of data for any use-case. **Tokenization** is a method that focuses on securing the storage of data. This is the quickest way to get started and is free. [Get started with Tokenization](https://www.verygoodsecurity.com/docs/tokenization/getting-started). **Zero Data** is a unique method invented by VGS in 2016 that securely stores data like Tokenization, however it also removes the customer’s environment from PCI scope completely providing maximum security, and minimum compliance scope. [Get started with Zero Data](https://www.verygoodsecurity.com/docs/getting-started/before-you-start). Additionally, for scenarios where neither technology is a complete solution, for instance with legacy systems, VGS provides a compliance product which guarantees customers are able to meet their compliance needs no matter what may happen. [Get started with Control](https://www.verygoodsecurity.com/docs/control). ## Learn about Tokenization - [Create an Account for Free Tokenization](https://dashboard.verygoodsecurity.com/tokenization) - [Try a Tokenization Demo](https://www.verygoodsecurity.com/docs/tokenization/getting-started) - [Install a Tokenization SDK](https://www.verygoodsecurity.com/docs/tokenization/client-libraries) ### 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) ## Resource Limits ### Data Limits This API allows storing data up to 32MB in size. ### 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.4.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module VgsApiClient
16
+ class FunctionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Creates a new function
23
+ # Creates a new function.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [CreateFunctionRequest] :create_function_request
26
+ # @return [InlineResponse2002]
27
+ def create_function(opts = {})
28
+ data, _status_code, _headers = create_function_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Creates a new function
33
+ # Creates a new function.
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [CreateFunctionRequest] :create_function_request
36
+ # @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers
37
+ def create_function_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: FunctionsApi.create_function ...'
40
+ end
41
+ # resource path
42
+ local_var_path = '/functions'
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_function_request'])
62
+
63
+ # return_type
64
+ return_type = opts[:debug_return_type] || 'InlineResponse2002'
65
+
66
+ # auth_names
67
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
68
+
69
+ new_options = opts.merge(
70
+ :operation => :"FunctionsApi.create_function",
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: FunctionsApi#create_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Deletes a function
87
+ # Removes a single alias.
88
+ # @param function_name [String] Name of function to operate on
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [nil]
91
+ def delete_function(function_name, opts = {})
92
+ delete_function_with_http_info(function_name, opts)
93
+ nil
94
+ end
95
+
96
+ # Deletes a function
97
+ # Removes a single alias.
98
+ # @param function_name [String] Name of function 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_function_with_http_info(function_name, opts = {})
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug 'Calling API: FunctionsApi.delete_function ...'
104
+ end
105
+ # verify the required parameter 'function_name' is set
106
+ if @api_client.config.client_side_validation && function_name.nil?
107
+ fail ArgumentError, "Missing the required parameter 'function_name' when calling FunctionsApi.delete_function"
108
+ end
109
+ # resource path
110
+ local_var_path = '/functions/{functionName}'.sub('{' + 'functionName' + '}', CGI.escape(function_name.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] || ['OAuth2']
131
+
132
+ new_options = opts.merge(
133
+ :operation => :"FunctionsApi.delete_function",
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: FunctionsApi#delete_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
145
+ end
146
+ return data, status_code, headers
147
+ end
148
+
149
+ # Retrieve a single function
150
+ # Retrieves a function
151
+ # @param function_name [String] Name of function to operate on
152
+ # @param [Hash] opts the optional parameters
153
+ # @return [InlineResponse2003]
154
+ def get_function(function_name, opts = {})
155
+ data, _status_code, _headers = get_function_with_http_info(function_name, opts)
156
+ data
157
+ end
158
+
159
+ # Retrieve a single function
160
+ # Retrieves a function
161
+ # @param function_name [String] Name of function to operate on
162
+ # @param [Hash] opts the optional parameters
163
+ # @return [Array<(InlineResponse2003, Integer, Hash)>] InlineResponse2003 data, response status code and response headers
164
+ def get_function_with_http_info(function_name, opts = {})
165
+ if @api_client.config.debugging
166
+ @api_client.config.logger.debug 'Calling API: FunctionsApi.get_function ...'
167
+ end
168
+ # verify the required parameter 'function_name' is set
169
+ if @api_client.config.client_side_validation && function_name.nil?
170
+ fail ArgumentError, "Missing the required parameter 'function_name' when calling FunctionsApi.get_function"
171
+ end
172
+ # resource path
173
+ local_var_path = '/functions/{functionName}'.sub('{' + 'functionName' + '}', CGI.escape(function_name.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] || 'InlineResponse2003'
191
+
192
+ # auth_names
193
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
194
+
195
+ new_options = opts.merge(
196
+ :operation => :"FunctionsApi.get_function",
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: FunctionsApi#get_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
208
+ end
209
+ return data, status_code, headers
210
+ end
211
+
212
+ # Invoke a function
213
+ # Invokes a function
214
+ # @param function_name [String] Name of function to operate on
215
+ # @param [Hash] opts the optional parameters
216
+ # @option opts [String] :body
217
+ # @return [File]
218
+ def invoke_function(function_name, opts = {})
219
+ data, _status_code, _headers = invoke_function_with_http_info(function_name, opts)
220
+ data
221
+ end
222
+
223
+ # Invoke a function
224
+ # Invokes a function
225
+ # @param function_name [String] Name of function to operate on
226
+ # @param [Hash] opts the optional parameters
227
+ # @option opts [String] :body
228
+ # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
229
+ def invoke_function_with_http_info(function_name, opts = {})
230
+ if @api_client.config.debugging
231
+ @api_client.config.logger.debug 'Calling API: FunctionsApi.invoke_function ...'
232
+ end
233
+ # verify the required parameter 'function_name' is set
234
+ if @api_client.config.client_side_validation && function_name.nil?
235
+ fail ArgumentError, "Missing the required parameter 'function_name' when calling FunctionsApi.invoke_function"
236
+ end
237
+ # resource path
238
+ local_var_path = '/functions/{functionName}/invocations'.sub('{' + 'functionName' + '}', CGI.escape(function_name.to_s))
239
+
240
+ # query parameters
241
+ query_params = opts[:query_params] || {}
242
+
243
+ # header parameters
244
+ header_params = opts[:header_params] || {}
245
+ # HTTP header 'Accept' (if needed)
246
+ header_params['Accept'] = @api_client.select_header_accept(['*', 'application/http', 'text/plain', 'application/json'])
247
+ # HTTP header 'Content-Type'
248
+ content_type = @api_client.select_header_content_type(['application/http', 'application/x-www-form-urlencoded', 'text/plain'])
249
+ if !content_type.nil?
250
+ header_params['Content-Type'] = content_type
251
+ end
252
+
253
+ # form parameters
254
+ form_params = opts[:form_params] || {}
255
+
256
+ # http body (model)
257
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
258
+
259
+ # return_type
260
+ return_type = opts[:debug_return_type] || 'File'
261
+
262
+ # auth_names
263
+ auth_names = opts[:debug_auth_names] || ['BasicAuth']
264
+
265
+ new_options = opts.merge(
266
+ :operation => :"FunctionsApi.invoke_function",
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(:POST, local_var_path, new_options)
276
+ if @api_client.config.debugging
277
+ @api_client.config.logger.debug "API called: FunctionsApi#invoke_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
278
+ end
279
+ return data, status_code, headers
280
+ end
281
+
282
+ # Lists all functions
283
+ # Lists all functions
284
+ # @param [Hash] opts the optional parameters
285
+ # @return [InlineResponse2002]
286
+ def list_functions(opts = {})
287
+ data, _status_code, _headers = list_functions_with_http_info(opts)
288
+ data
289
+ end
290
+
291
+ # Lists all functions
292
+ # Lists all functions
293
+ # @param [Hash] opts the optional parameters
294
+ # @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers
295
+ def list_functions_with_http_info(opts = {})
296
+ if @api_client.config.debugging
297
+ @api_client.config.logger.debug 'Calling API: FunctionsApi.list_functions ...'
298
+ end
299
+ # resource path
300
+ local_var_path = '/functions'
301
+
302
+ # query parameters
303
+ query_params = opts[:query_params] || {}
304
+
305
+ # header parameters
306
+ header_params = opts[:header_params] || {}
307
+ # HTTP header 'Accept' (if needed)
308
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
309
+
310
+ # form parameters
311
+ form_params = opts[:form_params] || {}
312
+
313
+ # http body (model)
314
+ post_body = opts[:debug_body]
315
+
316
+ # return_type
317
+ return_type = opts[:debug_return_type] || 'InlineResponse2002'
318
+
319
+ # auth_names
320
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
321
+
322
+ new_options = opts.merge(
323
+ :operation => :"FunctionsApi.list_functions",
324
+ :header_params => header_params,
325
+ :query_params => query_params,
326
+ :form_params => form_params,
327
+ :body => post_body,
328
+ :auth_names => auth_names,
329
+ :return_type => return_type
330
+ )
331
+
332
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
333
+ if @api_client.config.debugging
334
+ @api_client.config.logger.debug "API called: FunctionsApi#list_functions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
335
+ end
336
+ return data, status_code, headers
337
+ end
338
+
339
+ # Update function
340
+ # Update an existing function definition
341
+ # @param function_name [String] Name of function to operate on
342
+ # @param [Hash] opts the optional parameters
343
+ # @option opts [UpdateFunctionRequestPayload] :update_function_request_payload
344
+ # @return [nil]
345
+ def update_function(function_name, opts = {})
346
+ update_function_with_http_info(function_name, opts)
347
+ nil
348
+ end
349
+
350
+ # Update function
351
+ # Update an existing function definition
352
+ # @param function_name [String] Name of function to operate on
353
+ # @param [Hash] opts the optional parameters
354
+ # @option opts [UpdateFunctionRequestPayload] :update_function_request_payload
355
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
356
+ def update_function_with_http_info(function_name, opts = {})
357
+ if @api_client.config.debugging
358
+ @api_client.config.logger.debug 'Calling API: FunctionsApi.update_function ...'
359
+ end
360
+ # verify the required parameter 'function_name' is set
361
+ if @api_client.config.client_side_validation && function_name.nil?
362
+ fail ArgumentError, "Missing the required parameter 'function_name' when calling FunctionsApi.update_function"
363
+ end
364
+ # resource path
365
+ local_var_path = '/functions/{functionName}'.sub('{' + 'functionName' + '}', CGI.escape(function_name.to_s))
366
+
367
+ # query parameters
368
+ query_params = opts[:query_params] || {}
369
+
370
+ # header parameters
371
+ header_params = opts[:header_params] || {}
372
+ # HTTP header 'Accept' (if needed)
373
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
374
+ # HTTP header 'Content-Type'
375
+ content_type = @api_client.select_header_content_type(['application/json'])
376
+ if !content_type.nil?
377
+ header_params['Content-Type'] = content_type
378
+ end
379
+
380
+ # form parameters
381
+ form_params = opts[:form_params] || {}
382
+
383
+ # http body (model)
384
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_function_request_payload'])
385
+
386
+ # return_type
387
+ return_type = opts[:debug_return_type]
388
+
389
+ # auth_names
390
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
391
+
392
+ new_options = opts.merge(
393
+ :operation => :"FunctionsApi.update_function",
394
+ :header_params => header_params,
395
+ :query_params => query_params,
396
+ :form_params => form_params,
397
+ :body => post_body,
398
+ :auth_names => auth_names,
399
+ :return_type => return_type
400
+ )
401
+
402
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
403
+ if @api_client.config.debugging
404
+ @api_client.config.logger.debug "API called: FunctionsApi#update_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
405
+ end
406
+ return data, status_code, headers
407
+ end
408
+ end
409
+ end
@@ -31,7 +31,7 @@ module VgsApiClient
31
31
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
32
  def initialize(config = Configuration.default)
33
33
  @config = config
34
- @user_agent = "vgs-api-client/0.0.1.alpha202205271209/ruby"
34
+ @user_agent = "vgs-api-client/0.0.1.alpha202205272111/ruby"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -215,13 +215,20 @@ module VgsApiClient
215
215
  # Returns Auth Settings hash for api client.
216
216
  def auth_settings
217
217
  {
218
- 'basicAuth' =>
218
+ 'BasicAuth' =>
219
219
  {
220
220
  type: 'basic',
221
221
  in: 'header',
222
222
  key: 'Authorization',
223
223
  value: basic_auth_token
224
224
  },
225
+ 'OAuth2' =>
226
+ {
227
+ type: 'oauth2',
228
+ in: 'header',
229
+ key: 'Authorization',
230
+ value: "Bearer #{access_token}"
231
+ },
225
232
  }
226
233
  end
227
234