mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-19 05:31:10 +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
40 lines
1016 B
JavaScript
40 lines
1016 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Model, { attr } from '@ember-data/model';
|
|
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
|
|
import { withModelValidations } from 'vault/decorators/model-validations';
|
|
|
|
const validations = {
|
|
lease: [
|
|
{
|
|
validator(model) {
|
|
const { lease, leaseMax } = model;
|
|
return (lease && leaseMax) || (!lease && !leaseMax) ? true : false;
|
|
},
|
|
message: 'Lease TTL and Max Lease TTL are both required if one of them is set.',
|
|
},
|
|
],
|
|
};
|
|
@withModelValidations(validations)
|
|
export default class AwsLeaseConfig extends Model {
|
|
@attr('string') backend; // dynamic path of secret -- set on response from value passed to queryRecord
|
|
@attr({
|
|
label: 'Max Lease TTL',
|
|
editType: 'ttl',
|
|
})
|
|
leaseMax;
|
|
@attr({
|
|
label: 'Default Lease TTL',
|
|
editType: 'ttl',
|
|
})
|
|
lease;
|
|
|
|
get attrs() {
|
|
const keys = ['lease', 'leaseMax'];
|
|
return expandAttributeMeta(this, keys);
|
|
}
|
|
}
|