UNPKG

@piiano/vault-client

Version:

Piiano Vault generated typescript client

219 lines 9.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IamClient = void 0; class IamClient { constructor(httpRequest) { this.httpRequest = httpRequest; } /** * Get IAM configuration * Gets the identity and access management (IAM) configuration in TOML format. * * The role that performs this operation must have the `CapIAMReader` 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 IAMConfig The request is successful. * @throws ApiError */ getIamConf({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/ctl/iam/conf', 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 IAM configuration * Sets the identity and access management (IAM) configuration. * * The role that performs this operation must have the `CapIAMWriter` 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 */ setIamConf({ requestBody, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/ctl/iam/conf', headers: additionalHeaders, query: { 'custom_audit': customAudit, }, body: requestBody, mediaType: 'application/toml', 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 Admin API key * Set the Admin user's API key. * * Vault always has an administrative user account with the user name `Admin`. You use this account to update the configuration of Vault. * * The API key should meet the specified criteria: * * - It must be at least 15 characters long. * - It must contain a combination of digits, lowercase letters, and uppercase letters. * * This API is restricted to the Admin user. * * The Admin user API key can also be set using the [`PVAULT_SERVICE_ADMIN_API_KEY` environment variable](/guides/configure/environment-variables#pvault_service_admin_api_key). * * @returns any The request is successful. * @throws ApiError */ setAdminApiKey({ requestBody, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/ctl/iam/admin/set-api-key', 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 or attempts to set a password for the Admin user.`, 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.`, }, }); } /** * Update user API key expiration * Update a user's API key expiration. * * The role that performs this operation must have the `CapIAMWriter` 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 APIKeyExpiry The request is successful. * @throws ApiError */ updateApiKeyExpiration({ requestBody, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/ctl/iam/user/update-expiration', 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 user 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 a user details * Get a user's details. * * The role that performs this operation must have the `CapIAMReader` 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 UserDetails The request is successful. * @throws ApiError */ getUser({ user, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/ctl/iam/user/{user}', path: { 'user': user, }, 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 user 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.`, }, }); } /** * Regenerate user API key * Regenerates a user's API key. The existing API key is invalidated. This operation is irreversible. * * :::note * You cannot regenerate the key for the Admin user. See [Set the admin's API key](/guides/manage-users-and-policies/set-admin-api-key) for information on how to set a value for this key. * ::: * * The role that performs this operation must have the `CapIAMWriter` 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 APIKey The request is successful. * @throws ApiError */ regenerateUserApiKey({ requestBody, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/ctl/iam/user/regen', 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 or attempts to generate a key for the Admin user.`, 404: `The user 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.IamClient = IamClient; //# sourceMappingURL=IamClient.js.map