Files
vault/ui/lib/core/addon/helpers/sync-destinations.ts
claire bontempo dc5070904b UI: add default granularity depending on type, add optional to secret_name_template (#25611)
* add default granularity depending on type

* move default setting to helper

* add test coverage for default granularity

* update mirage

* update secret name template

* remove has-text-black class which was making help tooltip black as well
2024-02-23 13:11:07 -08:00

81 lines
1.9 KiB
TypeScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { helper as buildHelper } from '@ember/component/helper';
import type { SyncDestination, SyncDestinationType } from 'vault/vault/helpers/sync-destinations';
/*
This helper is referenced in the base sync destination model and elsewhere to set attributes that rely on type
maskedParams: attributes for sensitive data, the API returns these values as '*****'
*/
const SYNC_DESTINATIONS: Array<SyncDestination> = [
{
name: 'AWS Secrets Manager',
type: 'aws-sm',
icon: 'aws-color',
category: 'cloud',
maskedParams: ['accessKeyId', 'secretAccessKey'],
defaultValues: {
granularity: 'secret-path',
},
},
{
name: 'Azure Key Vault',
type: 'azure-kv',
icon: 'azure-color',
category: 'cloud',
maskedParams: ['clientSecret'],
defaultValues: {
granularity: 'secret-path',
},
},
{
name: 'Google Secret Manager',
type: 'gcp-sm',
icon: 'gcp-color',
category: 'cloud',
maskedParams: ['credentials'],
defaultValues: {
granularity: 'secret-path',
},
},
{
name: 'Github Actions',
type: 'gh',
icon: 'github-color',
category: 'dev-tools',
maskedParams: ['accessToken'],
defaultValues: {
granularity: 'secret-key',
},
},
{
name: 'Vercel Project',
type: 'vercel-project',
icon: 'vercel-color',
category: 'dev-tools',
maskedParams: ['accessToken'],
defaultValues: {
granularity: 'secret-key',
},
},
];
export function syncDestinations(): Array<SyncDestination> {
return [...SYNC_DESTINATIONS];
}
export function destinationTypes(): Array<SyncDestinationType> {
return SYNC_DESTINATIONS.map((d) => d.type);
}
export function findDestination(type: SyncDestinationType | undefined): SyncDestination | undefined {
return SYNC_DESTINATIONS.find((d) => d.type === type);
}
export default buildHelper(syncDestinations);