2020-11-05 16:03:49 +00:00
|
|
|
${ env('CONSUL_ACLS_LEGACY', false) ? `rpc error making call: rpc: can't find method ACL.Method` : `
|
|
|
|
[
|
|
|
|
${
|
|
|
|
range(
|
|
|
|
env(
|
|
|
|
'CONSUL_POLICY_COUNT',
|
|
|
|
Math.floor(
|
|
|
|
(
|
|
|
|
Math.random() * env('CONSUL_POLICY_MAX', 10)
|
|
|
|
) + parseInt(env('CONSUL_POLICY_MIN', 1))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
).map(
|
|
|
|
function(item, i) {
|
|
|
|
if(i === 1) {
|
|
|
|
return `
|
|
|
|
{
|
|
|
|
"ID": "00000000-0000-0000-0000-000000000001",
|
|
|
|
"Name": "global-management",
|
|
|
|
${typeof location.search.ns !== 'undefined' ? `
|
|
|
|
"Namespace": "${location.search.ns}",
|
2021-09-15 18:50:11 +00:00
|
|
|
` : ``}
|
|
|
|
${typeof location.search.partition !== 'undefined' ? `
|
|
|
|
"Partition": "${location.search.partition}",
|
2020-11-05 16:03:49 +00:00
|
|
|
` : ``}
|
|
|
|
"Description": "Built-In Management Policy",
|
|
|
|
"CreateIndex": 10,
|
|
|
|
"ModifyIndex": 10
|
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
2023-09-01 18:05:32 +00:00
|
|
|
if(i === 2) {
|
|
|
|
return `
|
|
|
|
{
|
|
|
|
"ID": "00000000-0000-0000-0000-000000000002",
|
|
|
|
"Name": "global-read-only",
|
|
|
|
${typeof location.search.ns !== 'undefined' ? `
|
|
|
|
"Namespace": "${location.search.ns}",
|
|
|
|
` : ``}
|
|
|
|
${typeof location.search.partition !== 'undefined' ? `
|
|
|
|
"Partition": "${location.search.partition}",
|
|
|
|
` : ``}
|
|
|
|
"Description": "Built-In Read-only Policy",
|
|
|
|
"CreateIndex": 10,
|
|
|
|
"ModifyIndex": 10
|
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
2020-11-05 16:03:49 +00:00
|
|
|
return `
|
|
|
|
{
|
|
|
|
"ID": "${fake.random.uuid()}",
|
|
|
|
"Name": "${fake.hacker.noun()}-${i}",
|
|
|
|
${typeof location.search.ns !== 'undefined' ? `
|
|
|
|
"Namespace": "${location.search.ns}",
|
2021-09-15 18:50:11 +00:00
|
|
|
` : ``}
|
|
|
|
${typeof location.search.partition !== 'undefined' ? `
|
|
|
|
"Partition": "${location.search.partition}",
|
|
|
|
` : ``}
|
2020-11-05 16:03:49 +00:00
|
|
|
"Description": "${fake.lorem.sentence()}",
|
|
|
|
"Datacenters": ${fake.helpers.randomize(['["aq west-5", "ch east-4"]'])},
|
|
|
|
"CreateIndex": 10,
|
|
|
|
"ModifyIndex": 10
|
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
`}
|