mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 07:27:43 +00:00
misc: renamed enum
This commit is contained in:
@@ -5,7 +5,7 @@ import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
|
|||||||
|
|
||||||
export const registerGcpSyncRouter = async (server: FastifyZodProvider) =>
|
export const registerGcpSyncRouter = async (server: FastifyZodProvider) =>
|
||||||
registerSyncSecretsEndpoints({
|
registerSyncSecretsEndpoints({
|
||||||
destination: SecretSync.GCP,
|
destination: SecretSync.GCPSecretManager,
|
||||||
server,
|
server,
|
||||||
responseSchema: GcpSyncSchema,
|
responseSchema: GcpSyncSchema,
|
||||||
createSchema: CreateGcpSyncSchema,
|
createSchema: CreateGcpSyncSchema,
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ export * from "./secret-sync-router";
|
|||||||
export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: FastifyZodProvider) => Promise<void>> = {
|
export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: FastifyZodProvider) => Promise<void>> = {
|
||||||
[SecretSync.AWSParameterStore]: registerAwsParameterStoreSyncRouter,
|
[SecretSync.AWSParameterStore]: registerAwsParameterStoreSyncRouter,
|
||||||
[SecretSync.GitHub]: registerGitHubSyncRouter,
|
[SecretSync.GitHub]: registerGitHubSyncRouter,
|
||||||
[SecretSync.GCP]: registerGcpSyncRouter
|
[SecretSync.GCPSecretManager]: registerGcpSyncRouter
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { TSecretSyncListItem } from "@app/services/secret-sync/secret-sync-types
|
|||||||
|
|
||||||
export const GCP_SYNC_LIST_OPTION: TSecretSyncListItem = {
|
export const GCP_SYNC_LIST_OPTION: TSecretSyncListItem = {
|
||||||
name: "GCP Secret Manager",
|
name: "GCP Secret Manager",
|
||||||
destination: SecretSync.GCP,
|
destination: SecretSync.GCPSecretManager,
|
||||||
connection: AppConnection.GCP,
|
connection: AppConnection.GCP,
|
||||||
canImportSecrets: false
|
canImportSecrets: false
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,22 +16,28 @@ const GcpSyncDestinationConfigSchema = z.object({
|
|||||||
projectId: z.string().min(1, "Project ID is required")
|
projectId: z.string().min(1, "Project ID is required")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GcpSyncSchema = BaseSecretSyncSchema(SecretSync.GCP, GcpSyncOptionsConfig).extend({
|
export const GcpSyncSchema = BaseSecretSyncSchema(SecretSync.GCPSecretManager, GcpSyncOptionsConfig).extend({
|
||||||
destination: z.literal(SecretSync.GCP),
|
destination: z.literal(SecretSync.GCPSecretManager),
|
||||||
destinationConfig: GcpSyncDestinationConfigSchema
|
destinationConfig: GcpSyncDestinationConfigSchema
|
||||||
});
|
});
|
||||||
|
|
||||||
export const CreateGcpSyncSchema = GenericCreateSecretSyncFieldsSchema(SecretSync.GCP, GcpSyncOptionsConfig).extend({
|
export const CreateGcpSyncSchema = GenericCreateSecretSyncFieldsSchema(
|
||||||
|
SecretSync.GCPSecretManager,
|
||||||
|
GcpSyncOptionsConfig
|
||||||
|
).extend({
|
||||||
destinationConfig: GcpSyncDestinationConfigSchema
|
destinationConfig: GcpSyncDestinationConfigSchema
|
||||||
});
|
});
|
||||||
|
|
||||||
export const UpdateGcpSyncSchema = GenericUpdateSecretSyncFieldsSchema(SecretSync.GCP, GcpSyncOptionsConfig).extend({
|
export const UpdateGcpSyncSchema = GenericUpdateSecretSyncFieldsSchema(
|
||||||
|
SecretSync.GCPSecretManager,
|
||||||
|
GcpSyncOptionsConfig
|
||||||
|
).extend({
|
||||||
destinationConfig: GcpSyncDestinationConfigSchema.optional()
|
destinationConfig: GcpSyncDestinationConfigSchema.optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GcpSyncListItemSchema = z.object({
|
export const GcpSyncListItemSchema = z.object({
|
||||||
name: z.literal("GCP Secret Manager"),
|
name: z.literal("GCP Secret Manager"),
|
||||||
connection: z.literal(AppConnection.GCP),
|
connection: z.literal(AppConnection.GCP),
|
||||||
destination: z.literal(SecretSync.GCP),
|
destination: z.literal(SecretSync.GCPSecretManager),
|
||||||
canImportSecrets: z.literal(false)
|
canImportSecrets: z.literal(false)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export enum SecretSync {
|
export enum SecretSync {
|
||||||
AWSParameterStore = "aws-parameter-store",
|
AWSParameterStore = "aws-parameter-store",
|
||||||
GitHub = "github",
|
GitHub = "github",
|
||||||
GCP = "gcp-secret-manager"
|
GCPSecretManager = "gcp-secret-manager"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SecretSyncInitialSyncBehavior {
|
export enum SecretSyncInitialSyncBehavior {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { GcpSyncFns } from "./gcp/gcp-sync-fns";
|
|||||||
const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
|
const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
|
||||||
[SecretSync.AWSParameterStore]: AWS_PARAMETER_STORE_SYNC_LIST_OPTION,
|
[SecretSync.AWSParameterStore]: AWS_PARAMETER_STORE_SYNC_LIST_OPTION,
|
||||||
[SecretSync.GitHub]: GITHUB_SYNC_LIST_OPTION,
|
[SecretSync.GitHub]: GITHUB_SYNC_LIST_OPTION,
|
||||||
[SecretSync.GCP]: GCP_SYNC_LIST_OPTION
|
[SecretSync.GCPSecretManager]: GCP_SYNC_LIST_OPTION
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listSecretSyncOptions = () => {
|
export const listSecretSyncOptions = () => {
|
||||||
@@ -75,7 +75,7 @@ export const SecretSyncFns = {
|
|||||||
return AwsParameterStoreSyncFns.syncSecrets(secretSync, secretMap);
|
return AwsParameterStoreSyncFns.syncSecrets(secretSync, secretMap);
|
||||||
case SecretSync.GitHub:
|
case SecretSync.GitHub:
|
||||||
return GithubSyncFns.syncSecrets(secretSync, secretMap);
|
return GithubSyncFns.syncSecrets(secretSync, secretMap);
|
||||||
case SecretSync.GCP:
|
case SecretSync.GCPSecretManager:
|
||||||
return GcpSyncFns.syncSecrets(secretSync, secretMap);
|
return GcpSyncFns.syncSecrets(secretSync, secretMap);
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -92,7 +92,7 @@ export const SecretSyncFns = {
|
|||||||
case SecretSync.GitHub:
|
case SecretSync.GitHub:
|
||||||
secretMap = await GithubSyncFns.getSecrets(secretSync);
|
secretMap = await GithubSyncFns.getSecrets(secretSync);
|
||||||
break;
|
break;
|
||||||
case SecretSync.GCP:
|
case SecretSync.GCPSecretManager:
|
||||||
secretMap = await GcpSyncFns.getSecrets(secretSync);
|
secretMap = await GcpSyncFns.getSecrets(secretSync);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -112,7 +112,7 @@ export const SecretSyncFns = {
|
|||||||
return AwsParameterStoreSyncFns.removeSecrets(secretSync, secretMap);
|
return AwsParameterStoreSyncFns.removeSecrets(secretSync, secretMap);
|
||||||
case SecretSync.GitHub:
|
case SecretSync.GitHub:
|
||||||
return GithubSyncFns.removeSecrets(secretSync, secretMap);
|
return GithubSyncFns.removeSecrets(secretSync, secretMap);
|
||||||
case SecretSync.GCP:
|
case SecretSync.GCPSecretManager:
|
||||||
return GcpSyncFns.removeSecrets(secretSync, secretMap);
|
return GcpSyncFns.removeSecrets(secretSync, secretMap);
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
|||||||
export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
|
export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
|
||||||
[SecretSync.AWSParameterStore]: "AWS Parameter Store",
|
[SecretSync.AWSParameterStore]: "AWS Parameter Store",
|
||||||
[SecretSync.GitHub]: "GitHub",
|
[SecretSync.GitHub]: "GitHub",
|
||||||
[SecretSync.GCP]: "GCP Secret Manager"
|
[SecretSync.GCPSecretManager]: "GCP Secret Manager"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
||||||
[SecretSync.AWSParameterStore]: AppConnection.AWS,
|
[SecretSync.AWSParameterStore]: AppConnection.AWS,
|
||||||
[SecretSync.GitHub]: AppConnection.GitHub,
|
[SecretSync.GitHub]: AppConnection.GitHub,
|
||||||
[SecretSync.GCP]: AppConnection.GCP
|
[SecretSync.GCPSecretManager]: AppConnection.GCP
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -823,6 +823,18 @@
|
|||||||
"api-reference/endpoints/app-connections/github/update",
|
"api-reference/endpoints/app-connections/github/update",
|
||||||
"api-reference/endpoints/app-connections/github/delete"
|
"api-reference/endpoints/app-connections/github/delete"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"group": "GCP",
|
||||||
|
"pages": [
|
||||||
|
"api-reference/endpoints/app-connections/gcp/list",
|
||||||
|
"api-reference/endpoints/app-connections/gcp/available",
|
||||||
|
"api-reference/endpoints/app-connections/gcp/get-by-id",
|
||||||
|
"api-reference/endpoints/app-connections/gcp/get-by-name",
|
||||||
|
"api-reference/endpoints/app-connections/gcp/create",
|
||||||
|
"api-reference/endpoints/app-connections/gcp/update",
|
||||||
|
"api-reference/endpoints/app-connections/gcp/delete"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -857,6 +869,19 @@
|
|||||||
"api-reference/endpoints/secret-syncs/github/sync-secrets",
|
"api-reference/endpoints/secret-syncs/github/sync-secrets",
|
||||||
"api-reference/endpoints/secret-syncs/github/remove-secrets"
|
"api-reference/endpoints/secret-syncs/github/remove-secrets"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"group": "GCP Secret Manager",
|
||||||
|
"pages": [
|
||||||
|
"api-reference/endpoints/secret-syncs/gcp-secret-manager/list",
|
||||||
|
"api-reference/endpoints/secret-syncs/gcp-secret-manager/get-by-id",
|
||||||
|
"api-reference/endpoints/secret-syncs/gcp-secret-manager/get-by-name",
|
||||||
|
"api-reference/endpoints/secret-syncs/gcp-secret-manager/create",
|
||||||
|
"api-reference/endpoints/secret-syncs/gcp-secret-manager/update",
|
||||||
|
"api-reference/endpoints/secret-syncs/gcp-secret-manager/delete",
|
||||||
|
"api-reference/endpoints/secret-syncs/gcp-secret-manager/sync-secrets",
|
||||||
|
"api-reference/endpoints/secret-syncs/gcp-secret-manager/remove-secrets"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
+3
-1
@@ -10,7 +10,9 @@ import { SecretSync } from "@app/hooks/api/secretSyncs";
|
|||||||
import { TSecretSyncForm } from "../schemas";
|
import { TSecretSyncForm } from "../schemas";
|
||||||
|
|
||||||
export const GcpSyncFields = () => {
|
export const GcpSyncFields = () => {
|
||||||
const { control, setValue } = useFormContext<TSecretSyncForm & { destination: SecretSync.GCP }>();
|
const { control, setValue } = useFormContext<
|
||||||
|
TSecretSyncForm & { destination: SecretSync.GCPSecretManager }
|
||||||
|
>();
|
||||||
|
|
||||||
const connectionId = useWatch({ name: "connection.id", control });
|
const connectionId = useWatch({ name: "connection.id", control });
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ export const SecretSyncDestinationFields = () => {
|
|||||||
return <AwsParameterStoreSyncFields />;
|
return <AwsParameterStoreSyncFields />;
|
||||||
case SecretSync.GitHub:
|
case SecretSync.GitHub:
|
||||||
return <GitHubSyncFields />;
|
return <GitHubSyncFields />;
|
||||||
case SecretSync.GCP:
|
case SecretSync.GCPSecretManager:
|
||||||
return <GcpSyncFields />;
|
return <GcpSyncFields />;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Config Field: ${destination}`);
|
throw new Error(`Unhandled Destination Config Field: ${destination}`);
|
||||||
|
|||||||
+3
-1
@@ -5,7 +5,9 @@ import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
|
|||||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
|
||||||
export const GcpSyncReviewFields = () => {
|
export const GcpSyncReviewFields = () => {
|
||||||
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.GCP }>();
|
const { watch } = useFormContext<
|
||||||
|
TSecretSyncForm & { destination: SecretSync.GCPSecretManager }
|
||||||
|
>();
|
||||||
const projectId = watch("destinationConfig.projectId");
|
const projectId = watch("destinationConfig.projectId");
|
||||||
|
|
||||||
return <SecretSyncLabel label="Project ID">{projectId}</SecretSyncLabel>;
|
return <SecretSyncLabel label="Project ID">{projectId}</SecretSyncLabel>;
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ export const SecretSyncReviewFields = () => {
|
|||||||
case SecretSync.GitHub:
|
case SecretSync.GitHub:
|
||||||
DestinationFieldsComponent = <GitHubSyncReviewFields />;
|
DestinationFieldsComponent = <GitHubSyncReviewFields />;
|
||||||
break;
|
break;
|
||||||
case SecretSync.GCP:
|
case SecretSync.GCPSecretManager:
|
||||||
DestinationFieldsComponent = <GcpSyncReviewFields />;
|
DestinationFieldsComponent = <GcpSyncReviewFields />;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|||||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
|
||||||
export const GcpSyncDestinationSchema = z.object({
|
export const GcpSyncDestinationSchema = z.object({
|
||||||
destination: z.literal(SecretSync.GCP),
|
destination: z.literal(SecretSync.GCPSecretManager),
|
||||||
destinationConfig: z.object({
|
destinationConfig: z.object({
|
||||||
projectId: z.string().min(1, "Project ID required")
|
projectId: z.string().min(1, "Project ID required")
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import {
|
|||||||
export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }> = {
|
export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }> = {
|
||||||
[SecretSync.AWSParameterStore]: { name: "Parameter Store", image: "Amazon Web Services.png" },
|
[SecretSync.AWSParameterStore]: { name: "Parameter Store", image: "Amazon Web Services.png" },
|
||||||
[SecretSync.GitHub]: { name: "GitHub", image: "GitHub.png" },
|
[SecretSync.GitHub]: { name: "GitHub", image: "GitHub.png" },
|
||||||
[SecretSync.GCP]: { name: "GCP Secret Manager", image: "Google Cloud Platform.png" }
|
[SecretSync.GCPSecretManager]: { name: "GCP Secret Manager", image: "Google Cloud Platform.png" }
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
||||||
[SecretSync.AWSParameterStore]: AppConnection.AWS,
|
[SecretSync.AWSParameterStore]: AppConnection.AWS,
|
||||||
[SecretSync.GitHub]: AppConnection.GitHub,
|
[SecretSync.GitHub]: AppConnection.GitHub,
|
||||||
[SecretSync.GCP]: AppConnection.GCP
|
[SecretSync.GCPSecretManager]: AppConnection.GCP
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
|
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export enum SecretSync {
|
export enum SecretSync {
|
||||||
AWSParameterStore = "aws-parameter-store",
|
AWSParameterStore = "aws-parameter-store",
|
||||||
GitHub = "github",
|
GitHub = "github",
|
||||||
GCP = "gcp-secret-manager"
|
GCPSecretManager = "gcp-secret-manager"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SecretSyncStatus {
|
export enum SecretSyncStatus {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { SecretSync } from "@app/hooks/api/secretSyncs";
|
|||||||
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
|
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
|
||||||
|
|
||||||
export type TGcpSync = TRootSecretSync & {
|
export type TGcpSync = TRootSecretSync & {
|
||||||
destination: SecretSync.GCP;
|
destination: SecretSync.GCPSecretManager;
|
||||||
destinationConfig: {
|
destinationConfig: {
|
||||||
projectId: string;
|
projectId: string;
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
|
|||||||
return <AwsParameterStoreSyncDestinationCol secretSync={secretSync} />;
|
return <AwsParameterStoreSyncDestinationCol secretSync={secretSync} />;
|
||||||
case SecretSync.GitHub:
|
case SecretSync.GitHub:
|
||||||
return <GitHubSyncDestinationCol secretSync={secretSync} />;
|
return <GitHubSyncDestinationCol secretSync={secretSync} />;
|
||||||
case SecretSync.GCP:
|
case SecretSync.GCPSecretManager:
|
||||||
return <GcpSyncDestinationCol secretSync={secretSync} />;
|
return <GcpSyncDestinationCol secretSync={secretSync} />;
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
|
|||||||
throw new Error(`Unhandled GitHub Scope Destination Col Values ${destination}`);
|
throw new Error(`Unhandled GitHub Scope Destination Col Values ${destination}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SecretSync.GCP:
|
case SecretSync.GCPSecretManager:
|
||||||
primaryText = destinationConfig.projectId;
|
primaryText = destinationConfig.projectId;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
|
|||||||
case SecretSync.GitHub:
|
case SecretSync.GitHub:
|
||||||
DestinationComponents = <GitHubSyncDestinationSection secretSync={secretSync} />;
|
DestinationComponents = <GitHubSyncDestinationSection secretSync={secretSync} />;
|
||||||
break;
|
break;
|
||||||
case SecretSync.GCP:
|
case SecretSync.GCPSecretManager:
|
||||||
DestinationComponents = <GcpSyncDestinationSection secretSync={secretSync} />;
|
DestinationComponents = <GcpSyncDestinationSection secretSync={secretSync} />;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user