mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-24 08:01:07 +02:00
* initial things without helper changes
* adjust test for clean up of secret-engine-helper
* remove added line thats better in next pr
* remove extra check
* 🧹
* replace return with continue within loops
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
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;
|
|
|
|
configurableParams = ['lease', 'leaseMax'];
|
|
|
|
get displayAttrs() {
|
|
// while identical to formFields, keeping the same pattern as other configurable secret engines for consistency
|
|
// and to easily filter out displayAttributes in the future if needed
|
|
return this.formFields;
|
|
}
|
|
|
|
get formFields() {
|
|
return expandAttributeMeta(this, this.configurableParams);
|
|
}
|
|
}
|