@piiano/vault-client
Version:
Piiano Vault generated typescript client
190 lines • 7.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomDataTypesClient = void 0;
class CustomDataTypesClient {
constructor(httpRequest) {
this.httpRequest = httpRequest;
}
/**
* List data types
* Lists the Vault data types.
*
* See Data types for more information.
*
* The role that performs this operation must have the `CapTypesReader` 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 DataType The request is successful.
* @throws ApiError
*/
listDataTypes({ customAudit, bundle, options, additionalHeaders = {}, } = {}) {
return this.httpRequest.request({
method: 'GET',
url: '/api/pvlt/1.0/ctl/types',
headers: additionalHeaders,
query: {
'custom_audit': customAudit,
'bundle': bundle,
'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 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 data type
* Adds a data type.
*
* The role performing this operation must have the `CapTypesWriter` 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 DataType The request is successful.
* @throws ApiError
*/
addDataType({ requestBody, customAudit, additionalHeaders = {}, }) {
return this.httpRequest.request({
method: 'POST',
url: '/api/pvlt/1.0/ctl/types',
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: `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 data type
* Gets a data type.
*
* The role performing this operation must have the `CapTypesReader` 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 DataType The request is successful.
* @throws ApiError
*/
getDataType({ type, customAudit, additionalHeaders = {}, }) {
return this.httpRequest.request({
method: 'GET',
url: '/api/pvlt/1.0/ctl/types/{type}',
path: {
'type': type,
},
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 data type 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 data type
* Updates a data type.
*
* The update includes:
* - For built-in and custom data types, adding or removing custom transformers.
* - For custom data types, updating the `description`, `default_transformer`, and `validator` attributes.
*
* :::note
* - The update of `validator` is allowed only if the custom data type does not have a `normalizer`.
* - Built-in transformers can not be added or removed.
* - Custom transformers may be added or removed but must be exported by a loaded bundle.
* :::
*
* @returns DataType The request is successful.
* @throws ApiError
*/
updateDataType({ type, requestBody, customAudit, additionalHeaders = {}, }) {
return this.httpRequest.request({
method: 'PATCH',
url: '/api/pvlt/1.0/ctl/types/{type}',
path: {
'type': type,
},
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.`,
},
});
}
/**
* Delete data type
* Deletes a data type.
*
* The role that performs this operation must have the `CapTypesWriter` 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
*/
deleteDataType({ type, customAudit, additionalHeaders = {}, }) {
return this.httpRequest.request({
method: 'DELETE',
url: '/api/pvlt/1.0/ctl/types/{type}',
path: {
'type': type,
},
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 data type 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.CustomDataTypesClient = CustomDataTypesClient;
//# sourceMappingURL=CustomDataTypesClient.js.map