Files
threshold-ui/addons/api/mirage/factories/worker.js
T
hashicorp-copywrite[bot]andCameron Perera 3d610427d0 [COMPLIANCE] Add Copyright and License Headers (#1617)
* [COMPLIANCE] Add Copyright and License Headers

* chore: 🤖 update Copyright headers to satisfy our lint rules

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
2023-03-01 09:39:41 -06:00

50 lines
1.1 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import factory from '../generated/factories/worker';
import permissions from '../helpers/permissions';
import generateId from '../helpers/id';
import { faker } from '@faker-js/faker';
const types = ['pki', 'kms'];
export default factory.extend({
id: () => generateId('w_'),
authorized_actions: () =>
permissions.authorizedActionsFor('worker') || [
'no-op',
'read',
'update',
'delete',
],
type: (i) => types[i % types.length],
canonical_tags: (i) => {
if (i % 3 === 0) {
return { os: ['ubuntu'] };
}
if (i % 2 === 0) {
return {
type: [faker.random.word(), faker.random.word()],
os: ['ubuntu'],
env: ['dev', 'local'],
};
}
return undefined;
},
config_tags: (i) => {
if (i % 3 === 0) {
return { os: ['ubuntu'] };
}
if (i % 2 === 0) {
return {
type: [faker.random.word(), faker.random.word()],
os: ['ubuntu'],
env: ['dev', 'local'],
};
}
return undefined;
},
});