Add new fields to mirage

This commit is contained in:
Carlos Alcaide Corvo committed 2022-02-03 14:31:21 -08:00
1 parent 5e12566a65
commit 4f14891c84
1 file changed
+28
+28
View File
@@ -1,5 +1,6 @@
import factory from '../generated/factories/host-set';
import permissions from '../helpers/permissions';
import { datatype, internet, database } from 'faker';
export default factory.extend({
id: (i) => `host-set-id-${i}`,
@@ -18,4 +19,31 @@ export default factory.extend({
return this.hostCatalog.plugin;
}
},
preferred_endpoints() {
if (this.type === 'plugin') {
const enpointsAmount = datatype.number({ min: 1, max: 5 });
let result = [];
for (let i = 0; i < enpointsAmount; ++i) {
result.push(internet.ip());
}
return result;
}
},
// AWS specific
filters() {
if (this.type === 'plugin' && this.plugin?.name === 'aws') {
const filtersAmount = datatype.number({ min: 1, max: 5 });
let result = [];
for (let i = 0; i < filtersAmount; ++i) {
result.push(`${datatype.string(3)}=${datatype.string(8)}`);
}
return result;
}
},
// Azure specific
filter() {
if (this.type === 'plugin' && this.plugin?.name === 'azure') {
return `${database.column}=${database.collation}`;
}
},
});