UNPKG

@piiano/vault-client

Version:

Piiano Vault generated typescript client

241 lines 11.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CollectionsClient = void 0; class CollectionsClient { constructor(httpRequest) { this.httpRequest = httpRequest; } /** * List collections * Lists all collections. * * The collections can be returned in JSON or PVSchema format using the `format` query parameter or by setting the `Accept` header to `application/json` or `application/pvschema`, respectively. The default is to return JSON. * * See [PVSchema](/guides/reference/pvschema) for more details on the structure and content of PVSchema. * * The PVSchema format for multiple collections is the PVSchema for each collection string concatenated with a newline. * * See the [List collections](/guides/manage-collections-and-schemas/list-all-collections) guide for more information on using this operation. * * The role that performs this operation must have the `CapCollectionsReader` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities control access to operations. * * @returns Collection The request is successful. * @throws ApiError */ listCollections({ format = 'json', customAudit, options, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/ctl/collections', headers: additionalHeaders, query: { 'format': format, 'custom_audit': customAudit, 'options': options, }, errors: { 400: `The request is invalid.`, 401: `Authentication credentials are incorrect or missing.`, 403: `The caller doesn't have the required access rights.`, 404: `Reserved for future use.`, 405: `The operation is not allowed.`, 409: `A conflict occurs.`, 410: `Access to a resource that is no longer available occurs.`, 500: `An error occurs on the server.`, 503: `The service is unavailable.`, }, }); } /** * Add collection * Adds a collection. * * The collection request can be provided in JSON or PVSchema format by setting the `Content-Type` header to `application/json` or `application/pvschema`, respectively. The collection can be returned in JSON or PVSchema format using the `format` query parameter or by setting the `Accept` header to `application/json` or `application/pvschema`, respectively. The default is to return JSON. * * See [PVSchema](/guides/reference/pvschema) for more details on the structure and content of PVSchema. * * Invalid optional `properties` attributes in a JSON request are ignored. * * :::note * The combined length of the collection name and the longest property name can not exceed 40 characters. * ::: * * See the [Create a collection](/guides/manage-collections-and-schemas/create-a-collection) guide for more information on using this operation. * * The role performing this operation must have the `CapCollectionsWriter` capability. See [Access control](/data-security/identity-and-access-management#access-control) for more information about how capabilities control access to operations. * @returns Collection The request is successful. * @throws ApiError */ addCollection({ requestBody, format = 'json', customAudit, options, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/ctl/collections', headers: additionalHeaders, query: { 'format': format, 'custom_audit': customAudit, 'options': options, }, body: requestBody, mediaType: 'application/json', errors: { 400: `The request is invalid.`, 401: `Authentication credentials are incorrect or missing.`, 403: `The caller doesn't have the required access rights.`, 404: `Reserved for future use.`, 405: `The operation is not allowed.`, 409: `A conflict occurs.`, 410: `Access to a resource that is no longer available occurs.`, 500: `An error occurs on the server.`, 503: `The service is unavailable.`, }, }); } /** * Get collection * Gets a collection and its properties. * * The collection details can be returned in JSON or PVSchema format using the `format` query parameter or by setting the `Accept` header to `application/json` or `application/pvschema`, respectively. The default is to return JSON. * * See [PVSchema](/guides/reference/pvschema) for more details on the structure and content of PVSchema. * * See the [Retrieve a collection](/guides/manage-collections-and-schemas/retrieve-a-collection) guide for more information on using this operation. * * The role that performs this operation must have the `CapCollectionsReader` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities control access to operations. * * @returns Collection The request is successful. * @throws ApiError */ getCollection({ collection, customAudit, format = 'json', options, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/ctl/collections/{collection}', path: { 'collection': collection, }, headers: additionalHeaders, query: { 'custom_audit': customAudit, 'format': format, 'options': options, }, errors: { 400: `The request is invalid.`, 401: `Authentication credentials are incorrect or missing.`, 403: `The caller doesn't have the required access rights.`, 404: `The collection is not found.`, 405: `The operation is not allowed.`, 409: `A conflict occurs.`, 410: `Access to a resource that is no longer available occurs.`, 500: `An error occurs on the server.`, 503: `The service is unavailable.`, }, }); } /** * Update collection * Updates properties of a collection. * * The update: * - Adds any properties in the request that are not in the collection. * - Amends the `description`, `is_unique`, `is_index`, `is_substring_index`, and `is_nullable` attributes, where they have changed, for any properties in the request that are in the collection. * - `is_nullable` can only be changed from `false` to `true`. * - `is_unique` can only be changed from `true` to `false`. * - `is_substring_index` can only be changed from `true` to `false`. * - All other property attributes are ignored. * * :::note * The combined length of the collection name and the longest property name can not exceed 40 characters. * ::: * * The collection request can be provided in JSON or PVSchema format by setting the `Content-Type` header to `application/json` or `application/pvschema`, respectively. The collection can be returned in JSON or PVSchema format using the `format` query parameter or by setting the `Accept` header to `application/json` or `application/pvschema`, respectively. The default is to return JSON. * * See [PVSchema](/guides/reference/pvschema) for more details on the structure and content of PVSchema. * * The collection name provided in the path parameter must match the collection name in the JSON or PVSchema. * * The response contains the collection with all the properties. * * :::info * This command may take a while to complete (e.g., when adding an index) and is excluded from Vault's standard call timeout. * ::: * * See the [Update a collection](/guides/manage-collections-and-schemas/update-a-collection) guide for more information on using this operation. * * The role that performs this operation must have the `CapCollectionsWriter` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities control access to operations. * * @returns Collection The request is successful. * @throws ApiError */ updateCollection({ collection, requestBody, format = 'json', customAudit, options, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'PATCH', url: '/api/pvlt/1.0/ctl/collections/{collection}', path: { 'collection': collection, }, headers: additionalHeaders, query: { 'format': format, 'custom_audit': customAudit, 'options': options, }, body: requestBody, mediaType: 'application/json', errors: { 400: `The request is invalid.`, 401: `Authentication credentials are incorrect or missing.`, 403: `The caller doesn't have the required access rights.`, 404: `The collection is not found.`, 405: `The operation is not allowed.`, 409: `A conflict occurs.`, 410: `Access to a resource that is no longer available occurs.`, 500: `An error occurs on the server.`, 503: `The service is unavailable.`, }, }); } /** * Delete collection * Deletes a collection. * * See the [Delete a collection](/guides/manage-collections-and-schemas/delete-a-collection) guide for more information on using this operation. * * The role that performs this operation must have the `CapCollectionsWriter` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities control access to operations. * @returns any The request is successful. * @throws ApiError */ deleteCollection({ collection, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'DELETE', url: '/api/pvlt/1.0/ctl/collections/{collection}', path: { 'collection': collection, }, headers: additionalHeaders, query: { 'custom_audit': customAudit, }, errors: { 400: `The request is invalid.`, 401: `Authentication credentials are incorrect or missing.`, 403: `The caller doesn't have the required access rights.`, 404: `The collection is not found.`, 405: `The operation is not allowed.`, 409: `A conflict occurs.`, 410: `Access to a resource that is no longer available occurs.`, 500: `An error occurs on the server.`, 503: `The service is unavailable.`, }, }); } } exports.CollectionsClient = CollectionsClient; //# sourceMappingURL=CollectionsClient.js.map