mirror of
https://github.com/hashicorp/vault.git
synced 2025-09-19 21:01:09 +02:00
* initial changes with no test coverage * test coverage and fixes * additional edit config test coverage * clean up * clean up * Address pr feedback * welp missed an await * missed * take back * Update configure-ssh-test.js
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import ApplicationAdapter from '../application';
|
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
|
|
|
export default class AwsLeaseConfig extends ApplicationAdapter {
|
|
namespace = 'v1';
|
|
|
|
queryRecord(store, type, query) {
|
|
const { backend } = query;
|
|
return this.ajax(`${this.buildURL()}/${encodePath(backend)}/config/lease`, 'GET').then((resp) => {
|
|
return {
|
|
...resp,
|
|
id: backend,
|
|
backend,
|
|
};
|
|
});
|
|
}
|
|
|
|
createOrUpdate(store, type, snapshot) {
|
|
const serializer = store.serializerFor(type.modelName);
|
|
const data = serializer.serialize(snapshot);
|
|
const backend = snapshot.record.backend;
|
|
return this.ajax(`${this.buildURL()}/${backend}/config/lease`, 'POST', { data }).then((resp) => {
|
|
// ember data requires an id on the response
|
|
return {
|
|
...resp,
|
|
id: backend,
|
|
};
|
|
});
|
|
}
|
|
|
|
createRecord() {
|
|
return this.createOrUpdate(...arguments);
|
|
}
|
|
|
|
updateRecord() {
|
|
return this.createOrUpdate(...arguments);
|
|
}
|
|
}
|