mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 04:16:31 +02:00
UI/update license serializer (#11794)
* Update serializer for license and example response * Wrap mirage license/status in data
This commit is contained in:
parent
3baf0fd41b
commit
9fce74fcda
@ -3,15 +3,29 @@ import Model, { attr } from '@ember-data/model';
|
||||
/* sample response
|
||||
{
|
||||
"data": {
|
||||
"expiration_time": "2017-11-14T16:34:36.546753-05:00",
|
||||
"features": [
|
||||
"UI",
|
||||
"HSM",
|
||||
"Performance Replication",
|
||||
"DR Replication"
|
||||
],
|
||||
"license_id": "temporary",
|
||||
"start_time": "2017-11-14T16:04:36.546753-05:00"
|
||||
"autoloading_used": true,
|
||||
"autoloaded": {
|
||||
"expiration_time": "2017-11-14T16:34:36.546753-05:00",
|
||||
"license_id": "some-id",
|
||||
"start_time": "2017-11-14T16:04:36.546753-05:00"
|
||||
"features": [
|
||||
"UI",
|
||||
"HSM",
|
||||
"Performance Replication",
|
||||
"DR Replication"
|
||||
],
|
||||
},
|
||||
"stored": {
|
||||
"expiration_time": "2017-11-14T16:34:36.546753-05:00",
|
||||
"license_id": "some-id",
|
||||
"start_time": "2017-11-14T16:04:36.546753-05:00"
|
||||
"features": [
|
||||
"UI",
|
||||
"HSM",
|
||||
"Performance Replication",
|
||||
"DR Replication"
|
||||
],
|
||||
}
|
||||
},
|
||||
"warnings": [
|
||||
"time left on license is 29m33s"
|
||||
|
||||
@ -2,16 +2,16 @@ import ApplicationSerializer from './application';
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
|
||||
let transformedPayload = { autoloaded: payload.autoloading_used, license_id: 'no-license' };
|
||||
if (payload.autoloaded) {
|
||||
let transformedPayload = { autoloaded: payload.data.autoloading_used, license_id: 'no-license' };
|
||||
if (payload.data.autoloaded) {
|
||||
transformedPayload = {
|
||||
...transformedPayload,
|
||||
...payload.autoloaded,
|
||||
...payload.data.autoloaded,
|
||||
};
|
||||
} else if (payload.stored) {
|
||||
} else if (payload.data.stored) {
|
||||
transformedPayload = {
|
||||
...transformedPayload,
|
||||
...payload.stored,
|
||||
...payload.data.stored,
|
||||
};
|
||||
}
|
||||
transformedPayload.id = transformedPayload.license_id;
|
||||
|
||||
@ -33,27 +33,29 @@ export default function() {
|
||||
|
||||
this.get('/sys/license/status', function() {
|
||||
return {
|
||||
autoloading_used: false,
|
||||
stored: {
|
||||
expiration_time: EXPIRY_DATE,
|
||||
features: ['DR Replication', 'Namespaces', 'Lease Count Quotas', 'Automated Snapshots'],
|
||||
license_id: '0eca7ef8-ebc0-f875-315e-3cc94a7870cf',
|
||||
performance_standby_count: 0,
|
||||
start_time: '2020-04-28T00:00:00Z',
|
||||
},
|
||||
persisted_autoload: {
|
||||
expiration_time: EXPIRY_DATE,
|
||||
features: ['DR Replication', 'Namespaces', 'Lease Count Quotas', 'Automated Snapshots'],
|
||||
license_id: '0eca7ef8-ebc0-f875-315e-3cc94a7870cf',
|
||||
performance_standby_count: 0,
|
||||
start_time: '2020-04-28T00:00:00Z',
|
||||
},
|
||||
autoloaded: {
|
||||
expiration_time: EXPIRY_DATE,
|
||||
features: ['DR Replication', 'Namespaces', 'Lease Count Quotas', 'Automated Snapshots'],
|
||||
license_id: '0eca7ef8-ebc0-f875-315e-3cc94a7870cf',
|
||||
performance_standby_count: 0,
|
||||
start_time: '2020-04-28T00:00:00Z',
|
||||
data: {
|
||||
autoloading_used: false,
|
||||
stored: {
|
||||
expiration_time: EXPIRY_DATE,
|
||||
features: ['DR Replication', 'Namespaces', 'Lease Count Quotas', 'Automated Snapshots'],
|
||||
license_id: '0eca7ef8-ebc0-f875-315e-3cc94a7870cf',
|
||||
performance_standby_count: 0,
|
||||
start_time: '2020-04-28T00:00:00Z',
|
||||
},
|
||||
persisted_autoload: {
|
||||
expiration_time: EXPIRY_DATE,
|
||||
features: ['DR Replication', 'Namespaces', 'Lease Count Quotas', 'Automated Snapshots'],
|
||||
license_id: '0eca7ef8-ebc0-f875-315e-3cc94a7870cf',
|
||||
performance_standby_count: 0,
|
||||
start_time: '2020-04-28T00:00:00Z',
|
||||
},
|
||||
autoloaded: {
|
||||
expiration_time: EXPIRY_DATE,
|
||||
features: ['DR Replication', 'Namespaces', 'Lease Count Quotas', 'Automated Snapshots'],
|
||||
license_id: '0eca7ef8-ebc0-f875-315e-3cc94a7870cf',
|
||||
performance_standby_count: 0,
|
||||
start_time: '2020-04-28T00:00:00Z',
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user