Merge pull request #1012 from hashicorp/ICU-3484-missing-sync-interval-seconds-attribute-in-plugin-host-sets
feat: 🎸 add sync_interval_seconds to plugin host-sets
This commit is contained in:
4 files changed
+18
-2
No files matched your search
@@ -57,6 +57,12 @@ export default class GeneratedHostSetModel extends BaseModel {
|
||||
})
|
||||
plugin;
|
||||
|
||||
@attr('number', {
|
||||
description:
|
||||
"The number of seconds between the time boundary syncs the hosts in this set using this host set's plugin. If not provided a system determined default is used",
|
||||
})
|
||||
sync_interval_seconds;
|
||||
|
||||
// Azure specific
|
||||
@attr('string', {
|
||||
description: '',
|
||||
|
||||
@@ -2,8 +2,8 @@ import ApplicationSerializer from './application';
|
||||
import { copy } from 'ember-copy';
|
||||
|
||||
const fieldByType = {
|
||||
aws: ['preferred_endpoints', 'filters'],
|
||||
azure: ['preferred_endpoints', 'filter'],
|
||||
aws: ['preferred_endpoints', 'filters', 'sync_interval_seconds'],
|
||||
azure: ['preferred_endpoints', 'filter', 'sync_interval_seconds'],
|
||||
};
|
||||
export default class HostSetSerializer extends ApplicationSerializer {
|
||||
// =properties
|
||||
@@ -55,6 +55,7 @@ export default class HostSetSerializer extends ApplicationSerializer {
|
||||
// Delete unnecessary fields for static type
|
||||
delete serialized.attributes;
|
||||
delete serialized.preferred_endpoints;
|
||||
delete serialized.sync_interval_seconds;
|
||||
return serialized;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ export default factory.extend({
|
||||
return result;
|
||||
}
|
||||
},
|
||||
sync_interval_seconds() {
|
||||
if (this.type === 'plugin') {
|
||||
return datatype.number();
|
||||
}
|
||||
},
|
||||
// AWS specific
|
||||
filters() {
|
||||
if (this.plugin?.name === 'aws') {
|
||||
|
||||
@@ -53,6 +53,7 @@ module('Unit | Serializer | host set', function (hooks) {
|
||||
host_catalog_id: '123',
|
||||
version: 1,
|
||||
preferred_endpoints: [{ value: 'option 1' }, { value: 'option 2' }],
|
||||
sync_interval_seconds: 1,
|
||||
filters: [{ value: 'filter 1' }, { value: 'filter 2' }],
|
||||
});
|
||||
assert.deepEqual(record.serialize(), {
|
||||
@@ -61,6 +62,7 @@ module('Unit | Serializer | host set', function (hooks) {
|
||||
host_catalog_id: '123',
|
||||
version: 1,
|
||||
preferred_endpoints: ['option 1', 'option 2'],
|
||||
sync_interval_seconds: 1,
|
||||
attributes: {
|
||||
filters: ['filter 1', 'filter 2'],
|
||||
},
|
||||
@@ -77,6 +79,7 @@ module('Unit | Serializer | host set', function (hooks) {
|
||||
host_catalog_id: '123',
|
||||
version: 1,
|
||||
preferred_endpoints: [{ value: 'option 1' }, { value: 'option 2' }],
|
||||
sync_interval_seconds: 1,
|
||||
filter: 'filter 1 && filter 2',
|
||||
});
|
||||
assert.deepEqual(record.serialize(), {
|
||||
@@ -85,6 +88,7 @@ module('Unit | Serializer | host set', function (hooks) {
|
||||
host_catalog_id: '123',
|
||||
version: 1,
|
||||
preferred_endpoints: ['option 1', 'option 2'],
|
||||
sync_interval_seconds: 1,
|
||||
attributes: {
|
||||
filter: 'filter 1 && filter 2',
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user