api.yaml in vgs_api_client-0.0.1.alpha202205200950 vs api.yaml in vgs_api_client-0.0.1.alpha202205202337

- old
+ new

@@ -78,17 +78,18 @@ ``` version: '1.0.0' contact: email: support@verygoodsecurity.com x-logo: - url: images/vgs-logo.png + url: https://www.verygoodsecurity.com/img/press-and-assets/vgs-logo-color.png href: https://www.verygoodsecurity.com altText: VGS Logo + termsOfService: https://www.verygoodsecurity.com/terms-and-conditions externalDocs: - description: Find out more about VGS - url: https://www.verygoodsecurity.com/ + description: Visit the VGS documentation homepage + url: https://www.verygoodsecurity.com/docs/ servers: - url: https://api.sandbox.verygoodvault.com description: Sandbox @@ -109,13 +110,141 @@ - name: Data Management tags: - aliases security: - - basicAuth: [] + - BasicAuth: [] paths: + /functions: + post: + operationId: createFunction + summary: Creates a new function + tags: + - functions + description: | + Creates a new function. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFunctionRequest' + examples: + A: + summary: Create a new function + value: + data: + - src: | + def process(input, ctx): + return input + lang: larky + name: my-function + responses: + '201': + description: Created + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Function' + description: A retrieved function. + minItems: 1 + maxItems: 20 + default: + $ref: '#/components/responses/ApiErrorsResponse' + get: + operationId: listFunctions + summary: Lists all functions + tags: + - functions + description: | + Lists all functions + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Function' + description: A retrieved function. + minItems: 1 + maxItems: 20 + default: + $ref: '#/components/responses/ApiErrorsResponse' + + /functions/{functionName}: + parameters: + - $ref: '#/components/parameters/functionName' + get: + operationId: getFunction + tags: + - functions + summary: Retrieve a single function + description: | + Retrieves a function + parameters: + - $ref: '#/components/parameters/functionName' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Function' + description: The retrieved function. + minItems: 1 + maxItems: 1 + default: + $ref: '#/components/responses/ApiErrorsResponse' + + put: + operationId: updateFunction + tags: + - aliases + summary: Update function + description: | + Update an existing function definition + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateFunctionRequestPayload' + responses: + '200': + description: No Content + default: + $ref: '#/components/responses/ApiErrorsResponse' + + delete: + operationId: deleteFunction + tags: + - functions + summary: Deletes a function + description: | + Removes a single alias. + parameters: + - $ref: '#/components/parameters/functionName' + responses: + '204': + description: No Content + default: + $ref: '#/components/responses/ApiErrorsResponse' + /aliases: post: operationId: createAliases tags: - aliases @@ -343,30 +472,64 @@ source: | curl https://api.sandbox.verygoodvault.com/aliases/{{alias}} \ -X DELETE \ -u "$USERNAME:$PASSWORD" - components: # See the following links for details: # - https://swagger.io/docs/specification/authentication/basic-authentication/ + # https://swagger.io/docs/specification/authentication/ securitySchemes: - basicAuth: + BasicAuth: type: http scheme: basic - description: The default authentication schema. + description: | + The default authentication scheme for [Data API](#data-apis) based requests + is [Basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). + OAuth2: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://auth.verygoodsecurity.com/auth/realms/vgs/protocol/openid-connect/auth + tokenUrl: https://auth.verygoodsecurity.io/auth/realms/vgs/protocol/openid-connect/token + scopes: + credentials:read: Read vault credentials without reading secrets + credentials:write: Add, delete and manage credentials of vault + routes:read: Read your vault routes + routes:write: Create, read, update, delete your vault routes + vaults:read: Read details of your vaults + vaults:write: Read, create, update and delete your vaults + upstreams:read: Read your upstreams for SFTP routes + upstreams:write: Create and update upstreams for SFTP routes + certificates:read: Read certificates setup for your routes + certificates:write: Upload and delete certificates for routes + hostnames:read: Read/List Custom Hostnames of your vault routes + hostnames:write: Create/Delete Custom Hostname of your vault routes + functions:read: Read/List Functions + functions:write: Create/Delete Functions + description: | + The default authentication schema for [Management API](#management-apis) based requests. parameters: alias: name: alias in: path required: true description: Alias to operate on. schema: type: string example: tok_sandbox_bhtsCwFUzoJMw9rWUfEV5e + + functionName: + name: functionName + in: path + required: true + description: Name of function to operate on + schema: + type: string + example: my-function-46Juzcyx responses: ApiErrorsResponse: description: Something went wrong content: @@ -530,5 +693,71 @@ description: List of tags to classify the value with. required: - classifiers required: - data + + CreateFunctionRequest: + type: object + properties: + data: + type: array + items: + oneOf: + - $ref: '#/components/schemas/CreateFunctionRequestPayload' + minItems: 1 + maxItems: 20 + required: + - data + + CreateFunctionRequestPayload: + type: object + properties: + name: + type: string + description: Prefix to name your function + pattern: "[a-zA-Z]+([A-Za-z0-9\\-_]){5,28}[a-zA-Z0-9]" + example: my-function + src: + type: string + description: Definition of function body + example: | + def process(input, ctx): + return input + lang: + type: string + enum: + - larky + default: larky + description: | + Language to write your function in. + required: + - name + - src + + Function: + type: object + properties: + name: + type: string + example: my-function-46Juzcyx + src: + type: string + description: Definition of function body + example: | + def process(input, ctx): + return input + lang: + type: string + enum: + - larky + default: larky + description: | + Language to write your function in. + hash: + type: string + description: SHA256 representation of the function definition + example: bc1f0c3322091740cead407000af9acc692e7fefd0d96446e07900dcd0f8e308 + required: + - value + - format +