UNPKG

@piiano/vault-client

Version:

Piiano Vault generated typescript client

239 lines 10.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ActionsClient = void 0; class ActionsClient { constructor(httpRequest) { this.httpRequest = httpRequest; } /** * List all actions * Lists built-in and custom actions. * * The role performing this operation must have: * * - The `CapActionReader` capability. * - At least one allowing policy and no denying policies for the `read` operation for all actions. * * See [identity and access management](/data-security/identity-and-access-management) for more information about how capabilities are used to control access to operations and policies are used to control access to data. * * @returns Action The request is successful. * @throws ApiError */ listActions({ customAudit, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/ctl/actions', 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.`, }, }); } /** * Add action * Adds an action. * * The role performing this operation must have the `CapActionWriter` 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 Action The request is successful. * @throws ApiError */ addAction({ customAudit, requestBody, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/ctl/actions', 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 action * Gets an action. * * The role performing this operation must have: * * - The `CapActionReader` capability. * - At least one allowing policy and no denying policies for the `read` operation for the action provided in the call. * * See [identity and access management](/data-security/identity-and-access-management) for more information about how capabilities are used to control access to operations and policies are used to control access to data. * * @returns Action The request is successful. * @throws ApiError */ getActionByName({ action, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'GET', url: '/api/pvlt/1.0/ctl/actions/{action}', path: { 'action': action, }, 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 action * Deletes an action. * * You cannot delete a built-in action. * * The role performing this operation must have the `CapActionWriter` 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 */ deleteAction({ action, customAudit, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'DELETE', url: '/api/pvlt/1.0/ctl/actions/{action}', path: { 'action': action, }, 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 bundle 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.`, }, }); } /** * Invoke HTTP call action * Invokes the built-in `http_call` action. * * The `http_call` action enables Vault to issue an HTTP call using a template that includes references to sensitive data. * * Read more about [using the `http_call` action](/guides/use-third-party-services/about-http-call-action). * * The role performing this operation must have: * * - The `CapActionInvoker` capability. * - At least one allowing policy and no denying policies for the `invoke` operation for the action provided in the call. * * See [identity and access management](/data-security/identity-and-access-management) for more information about how capabilities are used to control access to operations and policies are used to control access to data. * * @returns HTTPCallActionResult The request is successful. * @throws ApiError */ invokeHttpCallAction({ adhocReason, reason, customAudit, reloadCache, requestBody, additionalHeaders = {}, } = {}) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/data/actions/http_call', headers: additionalHeaders, query: { 'adhoc_reason': adhocReason, 'reason': reason, 'custom_audit': customAudit, 'reload_cache': reloadCache, }, 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.`, }, }); } /** * Invoke action * Invokes an action. * * The body of the request is passed to the action function parameters, and the result of the action function is returned in the response. * * The role performing this operation must have: * * - The `CapActionInvoker` capability. * - At least one allowing policy and no denying policies for the `invoke` operation for the action provided in the call. * * See [identity and access management](/data-security/identity-and-access-management) for more information about how capabilities are used to control access to operations and policies are used to control access to data. * * @returns ActionResult The request is successful. * @throws ApiError */ invokeAction({ action, adhocReason, reason, customAudit, reloadCache, requestBody, additionalHeaders = {}, }) { return this.httpRequest.request({ method: 'POST', url: '/api/pvlt/1.0/data/actions/{action}', path: { 'action': action, }, headers: additionalHeaders, query: { 'adhoc_reason': adhocReason, 'reason': reason, 'custom_audit': customAudit, 'reload_cache': reloadCache, }, 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.`, }, }); } } exports.ActionsClient = ActionsClient; //# sourceMappingURL=ActionsClient.js.map