feat(secret-syncs): azure app config & key vault support

This commit is contained in:
Daniel Hougaard
2025-02-08 04:27:17 +04:00
parent 4e41e84491
commit 5cd6a66989
70 changed files with 2065 additions and 204 deletions
@@ -1,5 +1,6 @@
export enum AppConnection {
AWS = "aws",
GitHub = "github",
GCP = "gcp"
GCP = "gcp",
Azure = "azure"
}
@@ -20,10 +20,16 @@ export type TGcpConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.GCP;
};
export type TAzureConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.Azure;
oauthClientId?: string;
};
export type TAppConnectionOption = TAwsConnectionOption | TGitHubConnectionOption;
export type TAppConnectionOptionMap = {
[AppConnection.AWS]: TAwsConnectionOption;
[AppConnection.GitHub]: TGitHubConnectionOption;
[AppConnection.GCP]: TGcpConnectionOption;
[AppConnection.Azure]: TAzureConnectionOption;
};
@@ -0,0 +1,26 @@
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
export enum AzureConnectionMethod {
OAuth = "oauth"
}
export enum AzureResources {
KeyVault = "key-vault",
AppConfiguration = "app-configuration"
}
export const azureResourcesMap: Record<AzureResources, string> = {
[AzureResources.AppConfiguration]: "App Configuration",
[AzureResources.KeyVault]: "Key Vault"
};
export type TAzureConnection = TRootAppConnection & { app: AppConnection.Azure } & {
method: AzureConnectionMethod.OAuth;
resource: AzureResources;
credentials: {
code: string;
tenantId?: string;
resource: AzureResources;
};
};
@@ -3,15 +3,22 @@ import { TAppConnectionOption } from "@app/hooks/api/appConnections/types/app-op
import { TAwsConnection } from "@app/hooks/api/appConnections/types/aws-connection";
import { TGitHubConnection } from "@app/hooks/api/appConnections/types/github-connection";
import { AzureResources, TAzureConnection } from "./azure-connection";
import { TGcpConnection } from "./gcp-connection";
export * from "./aws-connection";
export * from "./azure-connection";
export * from "./gcp-connection";
export * from "./github-connection";
export type TAppConnection = TAwsConnection | TGitHubConnection | TGcpConnection;
export type TAppConnection = TAwsConnection | TGitHubConnection | TGcpConnection | TAzureConnection;
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "app" | "id">;
export type TAvailableAppConnection =
| (Pick<TAppConnection, "name" | "id"> & { app: Exclude<AppConnection, AppConnection.Azure> })
| (Pick<TAppConnection, "name" | "id"> & {
app: AppConnection.Azure;
azureResource?: AzureResources;
});
export type TListAppConnections<T extends TAppConnection> = { appConnections: T[] };
export type TGetAppConnection<T extends TAppConnection> = { appConnection: T };
@@ -40,4 +47,5 @@ export type TAppConnectionMap = {
[AppConnection.AWS]: TAwsConnection;
[AppConnection.GitHub]: TGitHubConnection;
[AppConnection.GCP]: TGcpConnection;
[AppConnection.Azure]: TAzureConnection;
};
+3 -1
View File
@@ -2,7 +2,9 @@ export enum SecretSync {
AWSParameterStore = "aws-parameter-store",
AWSSecretsManager = "aws-secrets-manager",
GitHub = "github",
GCPSecretManager = "gcp-secret-manager"
GCPSecretManager = "gcp-secret-manager",
AzureKeyVault = "azure-key-vault",
AzureAppConfiguration = "azure-app-configuration"
}
export enum SecretSyncStatus {
@@ -0,0 +1,16 @@
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { SecretSync } from "@app/hooks/api/secretSyncs";
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
export type TAzureAppConfigurationSync = TRootSecretSync & {
destination: SecretSync.AzureAppConfiguration;
destinationConfig: {
configurationUrl: string;
label?: string;
};
connection: {
app: AppConnection.Azure;
name: string;
id: string;
};
};
@@ -0,0 +1,15 @@
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { SecretSync } from "@app/hooks/api/secretSyncs";
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
export type TAzureKeyVaultSync = TRootSecretSync & {
destination: SecretSync.AzureKeyVault;
destinationConfig: {
vaultBaseUrl: string;
};
connection: {
app: AppConnection.Azure;
name: string;
id: string;
};
};
@@ -4,6 +4,8 @@ import { TGitHubSync } from "@app/hooks/api/secretSyncs/types/github-sync";
import { DiscriminativePick } from "@app/types";
import { TAwsSecretsManagerSync } from "./aws-secrets-manager-sync";
import { TAzureAppConfigurationSync } from "./azure-app-configuration-sync";
import { TAzureKeyVaultSync } from "./azure-key-vault-sync";
import { TGcpSync } from "./gcp-sync";
export type TSecretSyncOption = {
@@ -12,7 +14,13 @@ export type TSecretSyncOption = {
canImportSecrets: boolean;
};
export type TSecretSync = TAwsParameterStoreSync | TAwsSecretsManagerSync | TGitHubSync | TGcpSync;
export type TSecretSync =
| TAwsParameterStoreSync
| TAwsSecretsManagerSync
| TGitHubSync
| TGcpSync
| TAzureKeyVaultSync
| TAzureAppConfigurationSync;
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };