UNPKG

@piiano/vault-client

Version:

Piiano Vault generated typescript client

396 lines 17.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SystemClient = void 0; class SystemClient { constructor(httpRequest) { this.httpRequest = httpRequest; } /** * Get data service health/status * Gets the status of the service. * * The status codes returned follow the IETF standard [Health Check Response Format for HTTP APIs](https://datatracker.ietf.org/doc/html/draft-inadarei-api-health-check-05). For example, `pass` is returned when the service is up. * * The role performing this operation must have the `CapDataReader` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities are used to control access to operations. * @returns Health The request is successful. * @throws ApiError */ dataHealth({ additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/data/info/health', headers: additionalHeaders, 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 requested resource 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.`, }, }); } /** * Get control service health/status * Gets the status of the service. * * The status codes returned follow the IETF standard [Health Check Response Format for HTTP APIs](https://datatracker.ietf.org/doc/html/draft-inadarei-api-health-check-05). For example, `pass` is returned when the service is up. * @returns Health The request is successful. * @throws ApiError */ controlHealth({ additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/ctl/info/health', headers: additionalHeaders, 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 requested resource 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.`, }, }); } /** * Get cluster information * Get Cluster Information. * * Returns the vault's generation and the generations of all the workers (Vault instances with a [Data component](/architecture/components)). * * Vault instances with only a Control component are not displayed in the response. * * The role that performs this operation must have the `CapClusterInfoReader` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities are used to control access to operations. * @returns AllGenerations The request is successful. * @throws ApiError */ getClusterInfo({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/ctl/info/cluster', 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 requested resource 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 objects and tokens * Deletes objects and tokens that have been archived for longer than the retention period and token transaction IDs with no associated tokens. * * :::note * This operation deletes a maximum of 10,000 items. To delete all items, repeat calls until the count of deleted items reaches zero. Using the [prune job](/guides/prune-archived-data#configuring-the-prune-job), rather than calling the API, is recommended. * * For ad-hoc deletion of archived records, use the [Delete objects and tokens](/cli/reference#delete-objects-and-tokens) CLI command, which deletes all relevant items. * ::: * * See [Object life cycle](/data-privacy/object-lifecycle) for more information on how objects and tokens are archived and how deletion is affected by the retention period. * * @returns DeletionCount The request is successful. * @throws ApiError */ garbageCollection({ filter, dryRun = false, adhocReason, reason, customAudit, reloadCache, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/system/admin/lifecycle/gc', headers: additionalHeaders, query: { 'filter': filter, 'dry_run': dryRun, 'adhoc_reason': adhocReason, 'reason': reason, 'custom_audit': customAudit, 'reload_cache': reloadCache, }, 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 requested resource 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.`, }, }); } /** * Trigger artificial error * Manually trigger an artificial error for testing purposes. * * The role that performs this operation must have the `CapErrorWriter` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities are used to control access to operations. * @returns void * @throws ApiError */ triggerError({ customAudit, requestBody, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/system/debug/error/trigger', headers: additionalHeaders, query: { 'custom_audit': customAudit, }, body: requestBody, mediaType: 'application/json', errors: { 400: `The request is invalid.`, 401: `An error occurs on the server.`, 403: `An error occurs on the server.`, 404: `The requested resource 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.`, }, }); } /** * Get system configuration * Get the current active system configuration. * * The role that performs this operation must have the `CapInfoReader` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities are used to control access to operations. * @returns Config The request is successful. * @throws ApiError */ getConfiguration({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/system/info/configuration', 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 requested resource 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.`, }, }); } /** * Get license * Gets information on the currently used license. * * The role that performs this operation must have the `CapInfoReader` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities are used to control access to operations. * @returns License The request is successful. * @throws ApiError */ getLicense({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/system/info/license', 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 requested resource 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.`, }, }); } /** * Set license * Sets the license key for the Vault. * * :::note * In the hosted version of Vault, Piiano manages and sets the license key. * ::: * @returns any The request is successful. * @throws ApiError */ setLicense({ requestBody, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/system/info/license', headers: additionalHeaders, query: { 'custom_audit': customAudit, }, 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 requested resource 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.`, }, }); } /** * Get Vault version * Gets the version of Vault. * @returns ProductVersion The request is successful. * @throws ApiError */ getVaultVersion({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/system/info/version', 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 requested resource 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.`, }, }); } /** * Rotate data encryption keys * Rotates all the KMS keys that Vault uses to encrypt properties, tokens, and more. * * :::note * Key rotation not managed in the hosted version of Vault. * ::: * * When the keys are rotated, new data is encrypted with the new key. All old keys are retained, so that content encrypted with previous keys can be decipherable. * * The role that performs this operation must have the `CapKMSWriter` capability. See [Access control](/data-security/identity-and-access-management#access-control) for more information about how capabilities are used to control access to operations. * @returns any The request is successful. * @throws ApiError */ rotateKeys({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/system/admin/keys/rotate', 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 requested resource 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.`, }, }); } /** * Get export key * Gets an encrypted copy of the key used to encrypt exported data. * The key is encrypted using the export KMS key defined by the [`PVAULT_KMS_EXPORT_URI` or `PVAULT_KMS_EXPORT_SEED` environment variables](/guides/configure/environment-variables#key-management-service). * When importing data, the key is provided to the Vault and decrypted by the KMS, then used to decrypt the data. * * The role that performs this operation must have the `CapExportKeyReader` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities are used to control access to operations. * @returns ExportKeyResponse The request is successful. * @throws ApiError */ getExportKey({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/system/admin/export_key', 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 requested resource 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.`, }, }); } /** * Get KMS status * Gets the status of the configured KMS. * * The role that performs this operation must have the `CapKMSReader` capability. * See [Access control](/data-security/identity-and-access-management#access-control) for more information about how * capabilities are used to control access to operations. * @returns KMSStatusResponse The request is successful. * @throws ApiError */ getKms({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/system/info/kms', 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 requested resource 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.SystemClient = SystemClient; //# sourceMappingURL=SystemClient.js.map