mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-18 01:01:12 +01:00
* make cross-sign component * remove type from obj-list-input * finish skeleton of component * handle change on init * finish cross-sign form * add cancel transition * update pki/issuer adapter to accept backend passed from adapterOptions * first draft of cross-signing issuers component * refactor to accommodate listing signed certs * changes to config adapter and model, likely will need to revert and manually add to pki/action * add args to infotooltip, move header to cross-sign route * use pki/action model * move header to route file * finish displaying signed certificates * finish styling * add issuer id to cross-sign breadcrumbs * add parsed cert data to requests * add status count * add error banner back
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
import ApplicationAdapter from '../application';
|
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
|
|
|
export default class PkiIssuerAdapter extends ApplicationAdapter {
|
|
namespace = 'v1';
|
|
|
|
_getBackend(snapshot) {
|
|
const { record, adapterOptions } = snapshot;
|
|
return adapterOptions?.mount || record.backend;
|
|
}
|
|
|
|
optionsForQuery(id) {
|
|
const data = {};
|
|
if (!id) {
|
|
data['list'] = true;
|
|
}
|
|
return { data };
|
|
}
|
|
|
|
urlForQuery(backend, id) {
|
|
const baseUrl = `${this.buildURL()}/${encodePath(backend)}`;
|
|
if (id) {
|
|
return `${baseUrl}/issuer/${encodePath(id)}`;
|
|
} else {
|
|
return `${baseUrl}/issuers`;
|
|
}
|
|
}
|
|
|
|
createRecord(store, type, snapshot) {
|
|
let url = this.urlForQuery(this._getBackend(snapshot));
|
|
if (snapshot.adapterOptions.import) {
|
|
url = `${url}/import/bundle`;
|
|
}
|
|
return this.ajax(url, 'POST', { data: this.serialize(snapshot) }).then((resp) => {
|
|
return resp;
|
|
});
|
|
}
|
|
|
|
updateRecord(store, type, snapshot) {
|
|
const { issuerId } = snapshot.record;
|
|
const backend = this._getBackend(snapshot);
|
|
const data = this.serialize(snapshot);
|
|
const url = this.urlForQuery(backend, issuerId);
|
|
return this.ajax(url, 'POST', { data });
|
|
}
|
|
|
|
query(store, type, query) {
|
|
return this.ajax(this.urlForQuery(query.backend), 'GET', this.optionsForQuery());
|
|
}
|
|
|
|
queryRecord(store, type, query) {
|
|
const { backend, id } = query;
|
|
return this.ajax(this.urlForQuery(backend, id), 'GET', this.optionsForQuery(id));
|
|
}
|
|
}
|