mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 15:28:25 +00:00
secret sync + tweaks
This commit is contained in:
@@ -2084,7 +2084,7 @@ export const SecretSyncs = {
|
|||||||
OCI_VAULT: {
|
OCI_VAULT: {
|
||||||
compartmentOcid: "The OCID (Oracle Cloud Identifier) of the compartment where the vault is located.",
|
compartmentOcid: "The OCID (Oracle Cloud Identifier) of the compartment where the vault is located.",
|
||||||
vaultOcid: "The OCID (Oracle Cloud Identifier) of the vault to sync secrets to.",
|
vaultOcid: "The OCID (Oracle Cloud Identifier) of the vault to sync secrets to.",
|
||||||
keyOcid: "The OCID (Oracle Cloud Identifier) of the encryption key to use when creating secrets in the vault." // TODO(andrey): May or may not be needed. This refers to encryption key.
|
keyOcid: "The OCID (Oracle Cloud Identifier) of the encryption key to use when creating secrets in the vault."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,6 +22,34 @@ export const registerOCIConnectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
// The following endpoints are for internal Infisical App use only and not part of the public API
|
// The following endpoints are for internal Infisical App use only and not part of the public API
|
||||||
|
server.route({
|
||||||
|
method: "GET",
|
||||||
|
url: `/:connectionId/compartments`,
|
||||||
|
config: {
|
||||||
|
rateLimit: readLimit
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
params: z.object({
|
||||||
|
connectionId: z.string().uuid()
|
||||||
|
}),
|
||||||
|
response: {
|
||||||
|
200: z
|
||||||
|
.object({
|
||||||
|
id: z.string(),
|
||||||
|
name: z.string()
|
||||||
|
})
|
||||||
|
.array()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onRequest: verifyAuth([AuthMode.JWT]),
|
||||||
|
handler: async (req) => {
|
||||||
|
const { connectionId } = req.params;
|
||||||
|
|
||||||
|
const compartments = await server.services.appConnection.oci.listCompartments(connectionId, req.permission);
|
||||||
|
return compartments;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
server.route({
|
server.route({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: `/:connectionId/vaults`,
|
url: `/:connectionId/vaults`,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { registerGcpSyncRouter } from "./gcp-sync-router";
|
|||||||
import { registerGitHubSyncRouter } from "./github-sync-router";
|
import { registerGitHubSyncRouter } from "./github-sync-router";
|
||||||
import { registerHCVaultSyncRouter } from "./hc-vault-sync-router";
|
import { registerHCVaultSyncRouter } from "./hc-vault-sync-router";
|
||||||
import { registerHumanitecSyncRouter } from "./humanitec-sync-router";
|
import { registerHumanitecSyncRouter } from "./humanitec-sync-router";
|
||||||
|
import { registerOCIVaultSyncRouter } from "./oci-vault-sync-router";
|
||||||
import { registerTeamCitySyncRouter } from "./teamcity-sync-router";
|
import { registerTeamCitySyncRouter } from "./teamcity-sync-router";
|
||||||
import { registerTerraformCloudSyncRouter } from "./terraform-cloud-sync-router";
|
import { registerTerraformCloudSyncRouter } from "./terraform-cloud-sync-router";
|
||||||
import { registerVercelSyncRouter } from "./vercel-sync-router";
|
import { registerVercelSyncRouter } from "./vercel-sync-router";
|
||||||
@@ -31,5 +32,6 @@ export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: Fastif
|
|||||||
[SecretSync.Vercel]: registerVercelSyncRouter,
|
[SecretSync.Vercel]: registerVercelSyncRouter,
|
||||||
[SecretSync.Windmill]: registerWindmillSyncRouter,
|
[SecretSync.Windmill]: registerWindmillSyncRouter,
|
||||||
[SecretSync.HCVault]: registerHCVaultSyncRouter,
|
[SecretSync.HCVault]: registerHCVaultSyncRouter,
|
||||||
[SecretSync.TeamCity]: registerTeamCitySyncRouter
|
[SecretSync.TeamCity]: registerTeamCitySyncRouter,
|
||||||
|
[SecretSync.OCIVault]: registerOCIVaultSyncRouter
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import {
|
||||||
|
CreateOCIVaultSyncSchema,
|
||||||
|
OCIVaultSyncSchema,
|
||||||
|
UpdateOCIVaultSyncSchema
|
||||||
|
} from "@app/services/secret-sync/oci-vault";
|
||||||
|
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||||
|
|
||||||
|
import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
|
||||||
|
|
||||||
|
export const registerOCIVaultSyncRouter = async (server: FastifyZodProvider) =>
|
||||||
|
registerSyncSecretsEndpoints({
|
||||||
|
destination: SecretSync.OCIVault,
|
||||||
|
server,
|
||||||
|
responseSchema: OCIVaultSyncSchema,
|
||||||
|
createSchema: CreateOCIVaultSyncSchema,
|
||||||
|
updateSchema: UpdateOCIVaultSyncSchema
|
||||||
|
});
|
||||||
@@ -24,6 +24,7 @@ import { GcpSyncListItemSchema, GcpSyncSchema } from "@app/services/secret-sync/
|
|||||||
import { GitHubSyncListItemSchema, GitHubSyncSchema } from "@app/services/secret-sync/github";
|
import { GitHubSyncListItemSchema, GitHubSyncSchema } from "@app/services/secret-sync/github";
|
||||||
import { HCVaultSyncListItemSchema, HCVaultSyncSchema } from "@app/services/secret-sync/hc-vault";
|
import { HCVaultSyncListItemSchema, HCVaultSyncSchema } from "@app/services/secret-sync/hc-vault";
|
||||||
import { HumanitecSyncListItemSchema, HumanitecSyncSchema } from "@app/services/secret-sync/humanitec";
|
import { HumanitecSyncListItemSchema, HumanitecSyncSchema } from "@app/services/secret-sync/humanitec";
|
||||||
|
import { OCIVaultSyncListItemSchema, OCIVaultSyncSchema } from "@app/services/secret-sync/oci-vault";
|
||||||
import { TeamCitySyncListItemSchema, TeamCitySyncSchema } from "@app/services/secret-sync/teamcity";
|
import { TeamCitySyncListItemSchema, TeamCitySyncSchema } from "@app/services/secret-sync/teamcity";
|
||||||
import { TerraformCloudSyncListItemSchema, TerraformCloudSyncSchema } from "@app/services/secret-sync/terraform-cloud";
|
import { TerraformCloudSyncListItemSchema, TerraformCloudSyncSchema } from "@app/services/secret-sync/terraform-cloud";
|
||||||
import { VercelSyncListItemSchema, VercelSyncSchema } from "@app/services/secret-sync/vercel";
|
import { VercelSyncListItemSchema, VercelSyncSchema } from "@app/services/secret-sync/vercel";
|
||||||
@@ -43,7 +44,8 @@ const SecretSyncSchema = z.discriminatedUnion("destination", [
|
|||||||
VercelSyncSchema,
|
VercelSyncSchema,
|
||||||
WindmillSyncSchema,
|
WindmillSyncSchema,
|
||||||
HCVaultSyncSchema,
|
HCVaultSyncSchema,
|
||||||
TeamCitySyncSchema
|
TeamCitySyncSchema,
|
||||||
|
OCIVaultSyncSchema
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
|
const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
|
||||||
@@ -60,7 +62,8 @@ const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
|
|||||||
VercelSyncListItemSchema,
|
VercelSyncListItemSchema,
|
||||||
WindmillSyncListItemSchema,
|
WindmillSyncListItemSchema,
|
||||||
HCVaultSyncListItemSchema,
|
HCVaultSyncListItemSchema,
|
||||||
TeamCitySyncListItemSchema
|
TeamCitySyncListItemSchema,
|
||||||
|
OCIVaultSyncListItemSchema
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const registerSecretSyncRouter = async (server: FastifyZodProvider) => {
|
export const registerSecretSyncRouter = async (server: FastifyZodProvider) => {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { common, identity, keymanagement, vault } from "oci-sdk";
|
import { common, identity, keymanagement } from "oci-sdk";
|
||||||
|
|
||||||
import { request } from "@app/lib/config/request";
|
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
|
||||||
@@ -56,6 +55,30 @@ export const validateOCIConnectionCredentials = async (config: TOCIConnectionCon
|
|||||||
return config.credentials;
|
return config.credentials;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const listOCICompartments = async (appConnection: TOCIConnection) => {
|
||||||
|
const provider = await getOCIProvider(appConnection);
|
||||||
|
|
||||||
|
const identityClient = new identity.IdentityClient({ authenticationDetailsProvider: provider });
|
||||||
|
|
||||||
|
const rootCompartment = await identityClient
|
||||||
|
.getTenancy({
|
||||||
|
tenancyId: appConnection.credentials.tenancyOcid
|
||||||
|
})
|
||||||
|
.then((response) => ({
|
||||||
|
...response.tenancy,
|
||||||
|
id: appConnection.credentials.tenancyOcid,
|
||||||
|
name: response.tenancy.name ? `${response.tenancy.name} (root)` : "root"
|
||||||
|
}));
|
||||||
|
|
||||||
|
const compartments = await identityClient.listCompartments({
|
||||||
|
compartmentId: appConnection.credentials.tenancyOcid,
|
||||||
|
compartmentIdInSubtree: true,
|
||||||
|
accessLevel: identity.requests.ListCompartmentsRequest.AccessLevel.Any
|
||||||
|
});
|
||||||
|
|
||||||
|
return [rootCompartment, ...compartments.items];
|
||||||
|
};
|
||||||
|
|
||||||
export const listOCIVaults = async (appConnection: TOCIConnection, compartmentOcid: string) => {
|
export const listOCIVaults = async (appConnection: TOCIConnection, compartmentOcid: string) => {
|
||||||
const provider = await getOCIProvider(appConnection);
|
const provider = await getOCIProvider(appConnection);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { OrgServiceActor } from "@app/lib/types";
|
import { OrgServiceActor } from "@app/lib/types";
|
||||||
|
|
||||||
import { AppConnection } from "../app-connection-enums";
|
import { AppConnection } from "../app-connection-enums";
|
||||||
import { listOCIVaultKeys, listOCIVaults } from "./oci-connection-fns";
|
import { listOCICompartments, listOCIVaultKeys, listOCIVaults } from "./oci-connection-fns";
|
||||||
import { TOCIConnection } from "./oci-connection-types";
|
import { TOCIConnection } from "./oci-connection-types";
|
||||||
|
|
||||||
type TGetAppConnectionFunc = (
|
type TGetAppConnectionFunc = (
|
||||||
@@ -22,6 +22,17 @@ type TListOCIVaultKeysDTO = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ociConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
|
export const ociConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
|
||||||
|
const listCompartments = async (connectionId: string, actor: OrgServiceActor) => {
|
||||||
|
const appConnection = await getAppConnection(AppConnection.OCI, connectionId, actor);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const compartments = await listOCICompartments(appConnection);
|
||||||
|
return compartments;
|
||||||
|
} catch (error) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const listVaults = async ({ connectionId, compartmentOcid }: TListOCIVaultsDTO, actor: OrgServiceActor) => {
|
const listVaults = async ({ connectionId, compartmentOcid }: TListOCIVaultsDTO, actor: OrgServiceActor) => {
|
||||||
const appConnection = await getAppConnection(AppConnection.OCI, connectionId, actor);
|
const appConnection = await getAppConnection(AppConnection.OCI, connectionId, actor);
|
||||||
|
|
||||||
@@ -48,6 +59,7 @@ export const ociConnectionService = (getAppConnection: TGetAppConnectionFunc) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
listCompartments,
|
||||||
listVaults,
|
listVaults,
|
||||||
listVaultKeys
|
listVaultKeys
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export * from "./oci-vault-sync-constants";
|
||||||
|
export * from "./oci-vault-sync-fns";
|
||||||
|
export * from "./oci-vault-sync-schemas";
|
||||||
|
export * from "./oci-vault-sync-types";
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||||
|
import { TSecretSyncListItem } from "@app/services/secret-sync/secret-sync-types";
|
||||||
|
|
||||||
|
export const OCI_VAULT_SYNC_LIST_OPTION: TSecretSyncListItem = {
|
||||||
|
name: "OCI Vault",
|
||||||
|
destination: SecretSync.OCIVault,
|
||||||
|
connection: AppConnection.OCI,
|
||||||
|
canImportSecrets: true
|
||||||
|
};
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
import { secrets, vault } from "oci-sdk";
|
||||||
|
|
||||||
|
import { getOCIProvider } from "@app/services/app-connection/oci";
|
||||||
|
import {
|
||||||
|
TCreateOCIVaultVariable,
|
||||||
|
TDeleteOCIVaultVariable,
|
||||||
|
TOCIVaultListVariables,
|
||||||
|
TOCIVaultSyncWithCredentials,
|
||||||
|
TUpdateOCIVaultVariable
|
||||||
|
} from "@app/services/secret-sync/oci-vault/oci-vault-sync-types";
|
||||||
|
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
|
||||||
|
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
|
||||||
|
|
||||||
|
const listOCIVaultVariables = async ({ provider, compartmentId, vaultId, onlyActive }: TOCIVaultListVariables) => {
|
||||||
|
const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
|
||||||
|
const secretsClient = new secrets.SecretsClient({ authenticationDetailsProvider: provider });
|
||||||
|
|
||||||
|
const secretsRes = await vaultsClient.listSecrets({
|
||||||
|
compartmentId,
|
||||||
|
vaultId,
|
||||||
|
lifecycleState: onlyActive ? vault.models.SecretSummary.LifecycleState.Active : undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const result: Record<string, vault.models.SecretSummary & { name: string; value: string }> = {};
|
||||||
|
|
||||||
|
for await (const s of secretsRes.items) {
|
||||||
|
let secretValue = "";
|
||||||
|
|
||||||
|
if (s.lifecycleState === vault.models.SecretSummary.LifecycleState.Active) {
|
||||||
|
const secretBundle = await secretsClient.getSecretBundle({
|
||||||
|
secretId: s.id
|
||||||
|
});
|
||||||
|
|
||||||
|
secretValue = Buffer.from(secretBundle.secretBundle.secretBundleContent?.content || "", "base64").toString(
|
||||||
|
"utf-8"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
result[s.secretName] = {
|
||||||
|
...s,
|
||||||
|
name: s.secretName,
|
||||||
|
value: secretValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
const createOCIVaultVariable = async ({
|
||||||
|
provider,
|
||||||
|
compartmentId,
|
||||||
|
vaultId,
|
||||||
|
keyId,
|
||||||
|
name,
|
||||||
|
value
|
||||||
|
}: TCreateOCIVaultVariable) => {
|
||||||
|
if (!value) return;
|
||||||
|
|
||||||
|
const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
|
||||||
|
|
||||||
|
return vaultsClient.createSecret({
|
||||||
|
createSecretDetails: {
|
||||||
|
compartmentId,
|
||||||
|
vaultId,
|
||||||
|
keyId,
|
||||||
|
secretName: name,
|
||||||
|
enableAutoGeneration: false,
|
||||||
|
secretContent: {
|
||||||
|
content: Buffer.from(value).toString("base64"),
|
||||||
|
contentType: "BASE64"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateOCIVaultVariable = async ({ provider, secretId, value }: TUpdateOCIVaultVariable) => {
|
||||||
|
if (!value) return;
|
||||||
|
|
||||||
|
const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
|
||||||
|
|
||||||
|
return vaultsClient.updateSecret({
|
||||||
|
secretId,
|
||||||
|
updateSecretDetails: {
|
||||||
|
enableAutoGeneration: false,
|
||||||
|
secretContent: {
|
||||||
|
content: Buffer.from(value).toString("base64"),
|
||||||
|
contentType: "BASE64"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteOCIVaultVariable = async ({ provider, secretId }: TDeleteOCIVaultVariable) => {
|
||||||
|
const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
|
||||||
|
|
||||||
|
// Schedule a secret deletion 7 days from now. OCI Vault requires a MINIMUM buffer period of 7 days
|
||||||
|
return vaultsClient.scheduleSecretDeletion({
|
||||||
|
secretId,
|
||||||
|
scheduleSecretDeletionDetails: {
|
||||||
|
timeOfDeletion: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const OCIVaultSyncFns = {
|
||||||
|
syncSecrets: async (secretSync: TOCIVaultSyncWithCredentials, secretMap: TSecretMap) => {
|
||||||
|
const {
|
||||||
|
connection,
|
||||||
|
destinationConfig: { compartmentOcid, vaultOcid, keyOcid }
|
||||||
|
} = secretSync;
|
||||||
|
|
||||||
|
const provider = await getOCIProvider(connection);
|
||||||
|
const variables = await listOCIVaultVariables({ provider, compartmentId: compartmentOcid, vaultId: vaultOcid });
|
||||||
|
|
||||||
|
// Create secrets
|
||||||
|
for await (const entry of Object.entries(secretMap)) {
|
||||||
|
const [key, { value }] = entry;
|
||||||
|
|
||||||
|
if (!Object.values(variables).some((v) => v.secretName === key)) {
|
||||||
|
try {
|
||||||
|
await createOCIVaultVariable({
|
||||||
|
compartmentId: compartmentOcid,
|
||||||
|
vaultId: vaultOcid,
|
||||||
|
provider,
|
||||||
|
keyId: keyOcid,
|
||||||
|
name: key,
|
||||||
|
value
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
throw new SecretSyncError({
|
||||||
|
error,
|
||||||
|
secretKey: key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update and delete secrets
|
||||||
|
for await (const [key, variable] of Object.entries(variables)) {
|
||||||
|
// Only update / delete active secrets
|
||||||
|
if (variable.lifecycleState === vault.models.SecretSummary.LifecycleState.Active) {
|
||||||
|
if (key in secretMap) {
|
||||||
|
if (variable.value !== secretMap[key].value) {
|
||||||
|
try {
|
||||||
|
await updateOCIVaultVariable({
|
||||||
|
compartmentId: compartmentOcid,
|
||||||
|
vaultId: vaultOcid,
|
||||||
|
provider,
|
||||||
|
secretId: variable.id,
|
||||||
|
value: secretMap[key].value
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
throw new SecretSyncError({
|
||||||
|
error,
|
||||||
|
secretKey: key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!secretSync.syncOptions.disableSecretDeletion) {
|
||||||
|
try {
|
||||||
|
await deleteOCIVaultVariable({
|
||||||
|
compartmentId: compartmentOcid,
|
||||||
|
vaultId: vaultOcid,
|
||||||
|
provider,
|
||||||
|
secretId: variable.id
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
throw new SecretSyncError({
|
||||||
|
error,
|
||||||
|
secretKey: key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeSecrets: async (secretSync: TOCIVaultSyncWithCredentials, secretMap: TSecretMap) => {
|
||||||
|
const {
|
||||||
|
connection,
|
||||||
|
destinationConfig: { compartmentOcid, vaultOcid }
|
||||||
|
} = secretSync;
|
||||||
|
|
||||||
|
const provider = await getOCIProvider(connection);
|
||||||
|
const variables = await listOCIVaultVariables({
|
||||||
|
provider,
|
||||||
|
compartmentId: compartmentOcid,
|
||||||
|
vaultId: vaultOcid,
|
||||||
|
onlyActive: true
|
||||||
|
});
|
||||||
|
|
||||||
|
for await (const [key, variable] of Object.entries(variables)) {
|
||||||
|
if (key in secretMap) {
|
||||||
|
try {
|
||||||
|
await deleteOCIVaultVariable({
|
||||||
|
compartmentId: compartmentOcid,
|
||||||
|
vaultId: vaultOcid,
|
||||||
|
provider,
|
||||||
|
secretId: variable.id
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
throw new SecretSyncError({
|
||||||
|
error,
|
||||||
|
secretKey: key
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getSecrets: async (secretSync: TOCIVaultSyncWithCredentials) => {
|
||||||
|
const {
|
||||||
|
connection,
|
||||||
|
destinationConfig: { compartmentOcid, vaultOcid }
|
||||||
|
} = secretSync;
|
||||||
|
|
||||||
|
const provider = await getOCIProvider(connection);
|
||||||
|
return listOCIVaultVariables({ provider, compartmentId: compartmentOcid, vaultId: vaultOcid, onlyActive: true });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { SecretSyncs } from "@app/lib/api-docs";
|
||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||||
|
import {
|
||||||
|
BaseSecretSyncSchema,
|
||||||
|
GenericCreateSecretSyncFieldsSchema,
|
||||||
|
GenericUpdateSecretSyncFieldsSchema
|
||||||
|
} from "@app/services/secret-sync/secret-sync-schemas";
|
||||||
|
import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
|
||||||
|
|
||||||
|
const OCIVaultSyncDestinationConfigSchema = z.object({
|
||||||
|
compartmentOcid: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, "Compartment OCID required")
|
||||||
|
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.compartmentOcid),
|
||||||
|
vaultOcid: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, "Vault OCID required")
|
||||||
|
.describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.vaultOcid),
|
||||||
|
keyOcid: z.string().trim().min(1, "Key OCID required").describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.keyOcid)
|
||||||
|
});
|
||||||
|
|
||||||
|
const OCIVaultSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: true };
|
||||||
|
|
||||||
|
export const OCIVaultSyncSchema = BaseSecretSyncSchema(SecretSync.OCIVault, OCIVaultSyncOptionsConfig).extend({
|
||||||
|
destination: z.literal(SecretSync.OCIVault),
|
||||||
|
destinationConfig: OCIVaultSyncDestinationConfigSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
export const CreateOCIVaultSyncSchema = GenericCreateSecretSyncFieldsSchema(
|
||||||
|
SecretSync.OCIVault,
|
||||||
|
OCIVaultSyncOptionsConfig
|
||||||
|
).extend({
|
||||||
|
destinationConfig: OCIVaultSyncDestinationConfigSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
export const UpdateOCIVaultSyncSchema = GenericUpdateSecretSyncFieldsSchema(
|
||||||
|
SecretSync.OCIVault,
|
||||||
|
OCIVaultSyncOptionsConfig
|
||||||
|
).extend({
|
||||||
|
destinationConfig: OCIVaultSyncDestinationConfigSchema.optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
export const OCIVaultSyncListItemSchema = z.object({
|
||||||
|
name: z.literal("OCI Vault"),
|
||||||
|
connection: z.literal(AppConnection.OCI),
|
||||||
|
destination: z.literal(SecretSync.OCIVault),
|
||||||
|
canImportSecrets: z.literal(true)
|
||||||
|
});
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { SimpleAuthenticationDetailsProvider } from "oci-sdk";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { TOCIConnection } from "@app/services/app-connection/oci";
|
||||||
|
|
||||||
|
import { CreateOCIVaultSyncSchema, OCIVaultSyncListItemSchema, OCIVaultSyncSchema } from "./oci-vault-sync-schemas";
|
||||||
|
|
||||||
|
export type TOCIVaultSync = z.infer<typeof OCIVaultSyncSchema>;
|
||||||
|
|
||||||
|
export type TOCIVaultSyncInput = z.infer<typeof CreateOCIVaultSyncSchema>;
|
||||||
|
|
||||||
|
export type TOCIVaultSyncListItem = z.infer<typeof OCIVaultSyncListItemSchema>;
|
||||||
|
|
||||||
|
export type TOCIVaultSyncWithCredentials = TOCIVaultSync & {
|
||||||
|
connection: TOCIConnection;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TOCIVaultVariable = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TOCIVaultListVariables = {
|
||||||
|
provider: SimpleAuthenticationDetailsProvider;
|
||||||
|
compartmentId: string;
|
||||||
|
vaultId: string;
|
||||||
|
onlyActive?: boolean; // Whether to filter for only active secrets. Removes deleted / scheduled for deletion secrets
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TCreateOCIVaultVariable = TOCIVaultListVariables & {
|
||||||
|
keyId: string;
|
||||||
|
name: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TUpdateOCIVaultVariable = TOCIVaultListVariables & {
|
||||||
|
secretId: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TDeleteOCIVaultVariable = TOCIVaultListVariables & {
|
||||||
|
secretId: string;
|
||||||
|
};
|
||||||
@@ -12,7 +12,8 @@ export enum SecretSync {
|
|||||||
Vercel = "vercel",
|
Vercel = "vercel",
|
||||||
Windmill = "windmill",
|
Windmill = "windmill",
|
||||||
HCVault = "hashicorp-vault",
|
HCVault = "hashicorp-vault",
|
||||||
TeamCity = "teamcity"
|
TeamCity = "teamcity",
|
||||||
|
OCIVault = "oci-vault"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SecretSyncInitialSyncBehavior {
|
export enum SecretSyncInitialSyncBehavior {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { GcpSyncFns } from "./gcp/gcp-sync-fns";
|
|||||||
import { HC_VAULT_SYNC_LIST_OPTION, HCVaultSyncFns } from "./hc-vault";
|
import { HC_VAULT_SYNC_LIST_OPTION, HCVaultSyncFns } from "./hc-vault";
|
||||||
import { HUMANITEC_SYNC_LIST_OPTION } from "./humanitec";
|
import { HUMANITEC_SYNC_LIST_OPTION } from "./humanitec";
|
||||||
import { HumanitecSyncFns } from "./humanitec/humanitec-sync-fns";
|
import { HumanitecSyncFns } from "./humanitec/humanitec-sync-fns";
|
||||||
|
import { OCI_VAULT_SYNC_LIST_OPTION, OCIVaultSyncFns } from "./oci-vault";
|
||||||
import { TEAMCITY_SYNC_LIST_OPTION, TeamCitySyncFns } from "./teamcity";
|
import { TEAMCITY_SYNC_LIST_OPTION, TeamCitySyncFns } from "./teamcity";
|
||||||
import { TERRAFORM_CLOUD_SYNC_LIST_OPTION, TerraformCloudSyncFns } from "./terraform-cloud";
|
import { TERRAFORM_CLOUD_SYNC_LIST_OPTION, TerraformCloudSyncFns } from "./terraform-cloud";
|
||||||
import { VERCEL_SYNC_LIST_OPTION, VercelSyncFns } from "./vercel";
|
import { VERCEL_SYNC_LIST_OPTION, VercelSyncFns } from "./vercel";
|
||||||
@@ -47,7 +48,8 @@ const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
|
|||||||
[SecretSync.Vercel]: VERCEL_SYNC_LIST_OPTION,
|
[SecretSync.Vercel]: VERCEL_SYNC_LIST_OPTION,
|
||||||
[SecretSync.Windmill]: WINDMILL_SYNC_LIST_OPTION,
|
[SecretSync.Windmill]: WINDMILL_SYNC_LIST_OPTION,
|
||||||
[SecretSync.HCVault]: HC_VAULT_SYNC_LIST_OPTION,
|
[SecretSync.HCVault]: HC_VAULT_SYNC_LIST_OPTION,
|
||||||
[SecretSync.TeamCity]: TEAMCITY_SYNC_LIST_OPTION
|
[SecretSync.TeamCity]: TEAMCITY_SYNC_LIST_OPTION,
|
||||||
|
[SecretSync.OCIVault]: OCI_VAULT_SYNC_LIST_OPTION
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listSecretSyncOptions = () => {
|
export const listSecretSyncOptions = () => {
|
||||||
@@ -148,6 +150,8 @@ export const SecretSyncFns = {
|
|||||||
return HCVaultSyncFns.syncSecrets(secretSync, secretMap);
|
return HCVaultSyncFns.syncSecrets(secretSync, secretMap);
|
||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
return TeamCitySyncFns.syncSecrets(secretSync, secretMap);
|
return TeamCitySyncFns.syncSecrets(secretSync, secretMap);
|
||||||
|
case SecretSync.OCIVault:
|
||||||
|
return OCIVaultSyncFns.syncSecrets(secretSync, secretMap);
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
`Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
||||||
@@ -213,6 +217,9 @@ export const SecretSyncFns = {
|
|||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
secretMap = await TeamCitySyncFns.getSecrets(secretSync);
|
secretMap = await TeamCitySyncFns.getSecrets(secretSync);
|
||||||
break;
|
break;
|
||||||
|
case SecretSync.OCIVault:
|
||||||
|
secretMap = await OCIVaultSyncFns.getSecrets(secretSync);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
`Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
||||||
@@ -270,6 +277,8 @@ export const SecretSyncFns = {
|
|||||||
return HCVaultSyncFns.removeSecrets(secretSync, secretMap);
|
return HCVaultSyncFns.removeSecrets(secretSync, secretMap);
|
||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
return TeamCitySyncFns.removeSecrets(secretSync, secretMap);
|
return TeamCitySyncFns.removeSecrets(secretSync, secretMap);
|
||||||
|
case SecretSync.OCIVault:
|
||||||
|
return OCIVaultSyncFns.removeSecrets(secretSync, secretMap);
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
`Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
|
|||||||
[SecretSync.Vercel]: "Vercel",
|
[SecretSync.Vercel]: "Vercel",
|
||||||
[SecretSync.Windmill]: "Windmill",
|
[SecretSync.Windmill]: "Windmill",
|
||||||
[SecretSync.HCVault]: "Hashicorp Vault",
|
[SecretSync.HCVault]: "Hashicorp Vault",
|
||||||
[SecretSync.TeamCity]: "TeamCity"
|
[SecretSync.TeamCity]: "TeamCity",
|
||||||
|
[SecretSync.OCIVault]: "OCI Vault"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
||||||
@@ -32,5 +33,6 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
|||||||
[SecretSync.Vercel]: AppConnection.Vercel,
|
[SecretSync.Vercel]: AppConnection.Vercel,
|
||||||
[SecretSync.Windmill]: AppConnection.Windmill,
|
[SecretSync.Windmill]: AppConnection.Windmill,
|
||||||
[SecretSync.HCVault]: AppConnection.HCVault,
|
[SecretSync.HCVault]: AppConnection.HCVault,
|
||||||
[SecretSync.TeamCity]: AppConnection.TeamCity
|
[SecretSync.TeamCity]: AppConnection.TeamCity,
|
||||||
|
[SecretSync.OCIVault]: AppConnection.OCI
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import {
|
|||||||
THumanitecSyncListItem,
|
THumanitecSyncListItem,
|
||||||
THumanitecSyncWithCredentials
|
THumanitecSyncWithCredentials
|
||||||
} from "./humanitec";
|
} from "./humanitec";
|
||||||
|
import { TOCIVaultSync, TOCIVaultSyncInput, TOCIVaultSyncListItem, TOCIVaultSyncWithCredentials } from "./oci-vault";
|
||||||
import {
|
import {
|
||||||
TTeamCitySync,
|
TTeamCitySync,
|
||||||
TTeamCitySyncInput,
|
TTeamCitySyncInput,
|
||||||
@@ -95,7 +96,8 @@ export type TSecretSync =
|
|||||||
| TVercelSync
|
| TVercelSync
|
||||||
| TWindmillSync
|
| TWindmillSync
|
||||||
| THCVaultSync
|
| THCVaultSync
|
||||||
| TTeamCitySync;
|
| TTeamCitySync
|
||||||
|
| TOCIVaultSync;
|
||||||
|
|
||||||
export type TSecretSyncWithCredentials =
|
export type TSecretSyncWithCredentials =
|
||||||
| TAwsParameterStoreSyncWithCredentials
|
| TAwsParameterStoreSyncWithCredentials
|
||||||
@@ -111,7 +113,8 @@ export type TSecretSyncWithCredentials =
|
|||||||
| TVercelSyncWithCredentials
|
| TVercelSyncWithCredentials
|
||||||
| TWindmillSyncWithCredentials
|
| TWindmillSyncWithCredentials
|
||||||
| THCVaultSyncWithCredentials
|
| THCVaultSyncWithCredentials
|
||||||
| TTeamCitySyncWithCredentials;
|
| TTeamCitySyncWithCredentials
|
||||||
|
| TOCIVaultSyncWithCredentials;
|
||||||
|
|
||||||
export type TSecretSyncInput =
|
export type TSecretSyncInput =
|
||||||
| TAwsParameterStoreSyncInput
|
| TAwsParameterStoreSyncInput
|
||||||
@@ -127,7 +130,8 @@ export type TSecretSyncInput =
|
|||||||
| TVercelSyncInput
|
| TVercelSyncInput
|
||||||
| TWindmillSyncInput
|
| TWindmillSyncInput
|
||||||
| THCVaultSyncInput
|
| THCVaultSyncInput
|
||||||
| TTeamCitySyncInput;
|
| TTeamCitySyncInput
|
||||||
|
| TOCIVaultSyncInput;
|
||||||
|
|
||||||
export type TSecretSyncListItem =
|
export type TSecretSyncListItem =
|
||||||
| TAwsParameterStoreSyncListItem
|
| TAwsParameterStoreSyncListItem
|
||||||
@@ -143,7 +147,8 @@ export type TSecretSyncListItem =
|
|||||||
| TVercelSyncListItem
|
| TVercelSyncListItem
|
||||||
| TWindmillSyncListItem
|
| TWindmillSyncListItem
|
||||||
| THCVaultSyncListItem
|
| THCVaultSyncListItem
|
||||||
| TTeamCitySyncListItem;
|
| TTeamCitySyncListItem
|
||||||
|
| TOCIVaultSyncListItem;
|
||||||
|
|
||||||
export type TSyncOptionsConfig = {
|
export type TSyncOptionsConfig = {
|
||||||
canImportSecrets: boolean;
|
canImportSecrets: boolean;
|
||||||
|
|||||||
@@ -40,7 +40,14 @@ export const SecretSyncStatusBadge = ({ status }: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Badge className="flex h-5 w-min items-center gap-1.5 whitespace-nowrap" variant={variant}>
|
<Badge className="flex h-5 w-min items-center gap-1.5 whitespace-nowrap" variant={variant}>
|
||||||
<FontAwesomeIcon icon={icon} />
|
<FontAwesomeIcon
|
||||||
|
icon={icon}
|
||||||
|
className={
|
||||||
|
[SecretSyncStatus.Pending, SecretSyncStatus.Running].includes(status)
|
||||||
|
? "animate-spin"
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
/>
|
||||||
<span>{text}</span>
|
<span>{text}</span>
|
||||||
</Badge>
|
</Badge>
|
||||||
);
|
);
|
||||||
|
|||||||
+179
@@ -0,0 +1,179 @@
|
|||||||
|
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
||||||
|
import { SingleValue } from "react-select";
|
||||||
|
import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
|
||||||
|
import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
|
||||||
|
import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
|
||||||
|
import {
|
||||||
|
useOCIConnectionListCompartments,
|
||||||
|
useOCIConnectionListVaultKeys,
|
||||||
|
useOCIConnectionListVaults
|
||||||
|
} from "@app/hooks/api/appConnections/oci";
|
||||||
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
|
||||||
|
import { TSecretSyncForm } from "../schemas";
|
||||||
|
|
||||||
|
export const OCIVaultSyncFields = () => {
|
||||||
|
const { control, setValue } = useFormContext<
|
||||||
|
TSecretSyncForm & { destination: SecretSync.OCIVault }
|
||||||
|
>();
|
||||||
|
|
||||||
|
const connectionId = useWatch({ name: "connection.id", control });
|
||||||
|
|
||||||
|
// Compartments
|
||||||
|
const { data: compartments, isLoading: isCompartmentsLoading } = useOCIConnectionListCompartments(
|
||||||
|
connectionId,
|
||||||
|
{
|
||||||
|
enabled: Boolean(connectionId)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Vaults
|
||||||
|
const selectedCompartment = useWatch({ name: "destinationConfig.compartmentOcid", control });
|
||||||
|
const { data: vaults, isLoading: isVaultsLoading } = useOCIConnectionListVaults(
|
||||||
|
{ connectionId, compartmentOcid: selectedCompartment },
|
||||||
|
{
|
||||||
|
enabled: Boolean(connectionId)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Keys
|
||||||
|
const selectedVault = useWatch({ name: "destinationConfig.vaultOcid", control });
|
||||||
|
const { data: keys, isLoading: isKeysLoading } = useOCIConnectionListVaultKeys(
|
||||||
|
{ connectionId, compartmentOcid: selectedCompartment, vaultOcid: selectedVault },
|
||||||
|
{
|
||||||
|
enabled: Boolean(connectionId)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SecretSyncConnectionField
|
||||||
|
onChange={() => {
|
||||||
|
setValue("destinationConfig.compartmentOcid", "");
|
||||||
|
setValue("destinationConfig.vaultOcid", "");
|
||||||
|
setValue("destinationConfig.keyOcid", "");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="destinationConfig.compartmentOcid"
|
||||||
|
control={control}
|
||||||
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
label="Compartment"
|
||||||
|
helperText={
|
||||||
|
<Tooltip
|
||||||
|
className="max-w-md"
|
||||||
|
content="Ensure the compartment exists and that the connection has permission to view it."
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<span>Don't see the compartment you're looking for?</span>{" "}
|
||||||
|
<FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FilterableSelect
|
||||||
|
menuPlacement="top"
|
||||||
|
isLoading={isCompartmentsLoading && Boolean(connectionId)}
|
||||||
|
isDisabled={!connectionId}
|
||||||
|
value={compartments?.find((c) => c.id === value) ?? null}
|
||||||
|
onChange={(option) => {
|
||||||
|
onChange((option as SingleValue<{ id: string }>)?.id ?? null);
|
||||||
|
setValue("destinationConfig.vaultOcid", "");
|
||||||
|
setValue("destinationConfig.keyOcid", "");
|
||||||
|
}}
|
||||||
|
options={compartments}
|
||||||
|
placeholder="Select a compartment..."
|
||||||
|
getOptionLabel={(option) => option.name}
|
||||||
|
getOptionValue={(option) => option.id}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="destinationConfig.vaultOcid"
|
||||||
|
control={control}
|
||||||
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
label="Vault"
|
||||||
|
helperText={
|
||||||
|
<Tooltip
|
||||||
|
className="max-w-md"
|
||||||
|
content="Ensure the vault exists in the selected compartment and that the connection has permission to view it."
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<span>Don't see the vault you're looking for?</span>{" "}
|
||||||
|
<FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FilterableSelect
|
||||||
|
menuPlacement="top"
|
||||||
|
isLoading={isVaultsLoading && Boolean(connectionId)}
|
||||||
|
isDisabled={!connectionId || !selectedCompartment || !vaults}
|
||||||
|
value={vaults?.find((v) => v.id === value) ?? null}
|
||||||
|
onChange={(option) => {
|
||||||
|
onChange((option as SingleValue<{ id: string }>)?.id ?? null);
|
||||||
|
setValue("destinationConfig.keyOcid", "");
|
||||||
|
}}
|
||||||
|
options={vaults}
|
||||||
|
isClearable
|
||||||
|
placeholder="Select a vault..."
|
||||||
|
getOptionLabel={(option) => option.displayName}
|
||||||
|
getOptionValue={(option) => option.id}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="destinationConfig.keyOcid"
|
||||||
|
control={control}
|
||||||
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
label="Encryption Key"
|
||||||
|
helperText={
|
||||||
|
<Tooltip
|
||||||
|
className="max-w-md"
|
||||||
|
content="Ensure the key exists in the selected vault and that the connection has permission to view it."
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<span>Don't see the key you're looking for?</span>{" "}
|
||||||
|
<FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<FilterableSelect
|
||||||
|
menuPlacement="top"
|
||||||
|
isLoading={isKeysLoading && Boolean(connectionId)}
|
||||||
|
isDisabled={
|
||||||
|
!connectionId || !selectedCompartment || !selectedVault || !vaults || !keys
|
||||||
|
}
|
||||||
|
value={keys?.find((v) => v.id === value) ?? null}
|
||||||
|
onChange={(option) => {
|
||||||
|
onChange((option as SingleValue<{ id: string }>)?.id ?? null);
|
||||||
|
}}
|
||||||
|
options={keys}
|
||||||
|
isClearable
|
||||||
|
placeholder="Select a key..."
|
||||||
|
getOptionLabel={(option) => option.displayName}
|
||||||
|
getOptionValue={(option) => option.id}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
+3
@@ -13,6 +13,7 @@ import { GcpSyncFields } from "./GcpSyncFields";
|
|||||||
import { GitHubSyncFields } from "./GitHubSyncFields";
|
import { GitHubSyncFields } from "./GitHubSyncFields";
|
||||||
import { HCVaultSyncFields } from "./HCVaultSyncFields";
|
import { HCVaultSyncFields } from "./HCVaultSyncFields";
|
||||||
import { HumanitecSyncFields } from "./HumanitecSyncFields";
|
import { HumanitecSyncFields } from "./HumanitecSyncFields";
|
||||||
|
import { OCIVaultSyncFields } from "./OCIVaultSyncFields";
|
||||||
import { TeamCitySyncFields } from "./TeamCitySyncFields";
|
import { TeamCitySyncFields } from "./TeamCitySyncFields";
|
||||||
import { TerraformCloudSyncFields } from "./TerraformCloudSyncFields";
|
import { TerraformCloudSyncFields } from "./TerraformCloudSyncFields";
|
||||||
import { VercelSyncFields } from "./VercelSyncFields";
|
import { VercelSyncFields } from "./VercelSyncFields";
|
||||||
@@ -52,6 +53,8 @@ export const SecretSyncDestinationFields = () => {
|
|||||||
return <HCVaultSyncFields />;
|
return <HCVaultSyncFields />;
|
||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
return <TeamCitySyncFields />;
|
return <TeamCitySyncFields />;
|
||||||
|
case SecretSync.OCIVault:
|
||||||
|
return <OCIVaultSyncFields />;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Config Field: ${destination}`);
|
throw new Error(`Unhandled Destination Config Field: ${destination}`);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -45,6 +45,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
|
|||||||
case SecretSync.Windmill:
|
case SecretSync.Windmill:
|
||||||
case SecretSync.HCVault:
|
case SecretSync.HCVault:
|
||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
|
case SecretSync.OCIVault:
|
||||||
AdditionalSyncOptionsFieldsComponent = null;
|
AdditionalSyncOptionsFieldsComponent = null;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
import { useFormContext } from "react-hook-form";
|
||||||
|
|
||||||
|
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
|
||||||
|
import { GenericFieldLabel } from "@app/components/v2";
|
||||||
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
|
||||||
|
export const OCIVaultSyncReviewFields = () => {
|
||||||
|
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.OCIVault }>();
|
||||||
|
const compartmentOcid = watch("destinationConfig.compartmentOcid");
|
||||||
|
const vaultOcid = watch("destinationConfig.vaultOcid");
|
||||||
|
const keyOcid = watch("destinationConfig.keyOcid");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<GenericFieldLabel label="Compartment OCID">{compartmentOcid}</GenericFieldLabel>
|
||||||
|
<GenericFieldLabel label="Vault OCID">{vaultOcid}</GenericFieldLabel>
|
||||||
|
<GenericFieldLabel label="Key OCID">{keyOcid}</GenericFieldLabel>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
+4
@@ -23,6 +23,7 @@ import { GcpSyncReviewFields } from "./GcpSyncReviewFields";
|
|||||||
import { GitHubSyncReviewFields } from "./GitHubSyncReviewFields";
|
import { GitHubSyncReviewFields } from "./GitHubSyncReviewFields";
|
||||||
import { HCVaultSyncReviewFields } from "./HCVaultSyncReviewFields";
|
import { HCVaultSyncReviewFields } from "./HCVaultSyncReviewFields";
|
||||||
import { HumanitecSyncReviewFields } from "./HumanitecSyncReviewFields";
|
import { HumanitecSyncReviewFields } from "./HumanitecSyncReviewFields";
|
||||||
|
import { OCIVaultSyncReviewFields } from "./OCIVaultSyncReviewFields";
|
||||||
import { TeamCitySyncReviewFields } from "./TeamCitySyncReviewFields";
|
import { TeamCitySyncReviewFields } from "./TeamCitySyncReviewFields";
|
||||||
import { TerraformCloudSyncReviewFields } from "./TerraformCloudSyncReviewFields";
|
import { TerraformCloudSyncReviewFields } from "./TerraformCloudSyncReviewFields";
|
||||||
import { VercelSyncReviewFields } from "./VercelSyncReviewFields";
|
import { VercelSyncReviewFields } from "./VercelSyncReviewFields";
|
||||||
@@ -96,6 +97,9 @@ export const SecretSyncReviewFields = () => {
|
|||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
DestinationFieldsComponent = <TeamCitySyncReviewFields />;
|
DestinationFieldsComponent = <TeamCitySyncReviewFields />;
|
||||||
break;
|
break;
|
||||||
|
case SecretSync.OCIVault:
|
||||||
|
DestinationFieldsComponent = <OCIVaultSyncReviewFields />;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Review Fields: ${destination}`);
|
throw new Error(`Unhandled Destination Review Fields: ${destination}`);
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
|
||||||
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
|
||||||
|
export const OCIVaultSyncDestinationSchema = BaseSecretSyncSchema().merge(
|
||||||
|
z.object({
|
||||||
|
destination: z.literal(SecretSync.OCIVault),
|
||||||
|
destinationConfig: z.object({
|
||||||
|
compartmentOcid: z.string().trim().min(1, "Compartment OCID required"),
|
||||||
|
vaultOcid: z.string().trim().min(1, "Vault OCID required"),
|
||||||
|
keyOcid: z.string().trim().min(1, "Key OCID required")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
);
|
||||||
@@ -10,6 +10,7 @@ import { GcpSyncDestinationSchema } from "./gcp-sync-destination-schema";
|
|||||||
import { GitHubSyncDestinationSchema } from "./github-sync-destination-schema";
|
import { GitHubSyncDestinationSchema } from "./github-sync-destination-schema";
|
||||||
import { HCVaultSyncDestinationSchema } from "./hc-vault-sync-destination-schema";
|
import { HCVaultSyncDestinationSchema } from "./hc-vault-sync-destination-schema";
|
||||||
import { HumanitecSyncDestinationSchema } from "./humanitec-sync-destination-schema";
|
import { HumanitecSyncDestinationSchema } from "./humanitec-sync-destination-schema";
|
||||||
|
import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
|
||||||
import { TeamCitySyncDestinationSchema } from "./teamcity-sync-destination-schema";
|
import { TeamCitySyncDestinationSchema } from "./teamcity-sync-destination-schema";
|
||||||
import { TerraformCloudSyncDestinationSchema } from "./terraform-cloud-destination-schema";
|
import { TerraformCloudSyncDestinationSchema } from "./terraform-cloud-destination-schema";
|
||||||
import { VercelSyncDestinationSchema } from "./vercel-sync-destination-schema";
|
import { VercelSyncDestinationSchema } from "./vercel-sync-destination-schema";
|
||||||
@@ -29,7 +30,8 @@ const SecretSyncUnionSchema = z.discriminatedUnion("destination", [
|
|||||||
VercelSyncDestinationSchema,
|
VercelSyncDestinationSchema,
|
||||||
WindmillSyncDestinationSchema,
|
WindmillSyncDestinationSchema,
|
||||||
HCVaultSyncDestinationSchema,
|
HCVaultSyncDestinationSchema,
|
||||||
TeamCitySyncDestinationSchema
|
TeamCitySyncDestinationSchema,
|
||||||
|
OCIVaultSyncDestinationSchema
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const SecretSyncFormSchema = SecretSyncUnionSchema;
|
export const SecretSyncFormSchema = SecretSyncUnionSchema;
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }
|
|||||||
[SecretSync.TeamCity]: {
|
[SecretSync.TeamCity]: {
|
||||||
name: "TeamCity",
|
name: "TeamCity",
|
||||||
image: "TeamCity.png"
|
image: "TeamCity.png"
|
||||||
|
},
|
||||||
|
[SecretSync.OCIVault]: {
|
||||||
|
name: "OCI Vault",
|
||||||
|
image: "Oracle.png"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,7 +68,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
|||||||
[SecretSync.Vercel]: AppConnection.Vercel,
|
[SecretSync.Vercel]: AppConnection.Vercel,
|
||||||
[SecretSync.Windmill]: AppConnection.Windmill,
|
[SecretSync.Windmill]: AppConnection.Windmill,
|
||||||
[SecretSync.HCVault]: AppConnection.HCVault,
|
[SecretSync.HCVault]: AppConnection.HCVault,
|
||||||
[SecretSync.TeamCity]: AppConnection.TeamCity
|
[SecretSync.TeamCity]: AppConnection.TeamCity,
|
||||||
|
[SecretSync.OCIVault]: AppConnection.OCI
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
|
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
|
||||||
|
|||||||
@@ -3,12 +3,47 @@ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
|||||||
import { apiRequest } from "@app/config/request";
|
import { apiRequest } from "@app/config/request";
|
||||||
|
|
||||||
import { appConnectionKeys } from "../queries";
|
import { appConnectionKeys } from "../queries";
|
||||||
import { TListOCIVaultKeys, TListOCIVaults, TOCIVault, TOCIVaultKey } from "./types";
|
import {
|
||||||
|
TListOCIVaultKeys,
|
||||||
|
TListOCIVaults,
|
||||||
|
TOCICompartment,
|
||||||
|
TOCIVault,
|
||||||
|
TOCIVaultKey
|
||||||
|
} from "./types";
|
||||||
|
|
||||||
const ociConnectionKeys = {
|
const ociConnectionKeys = {
|
||||||
all: [...appConnectionKeys.all, "oci"] as const,
|
all: [...appConnectionKeys.all, "oci"] as const,
|
||||||
listVaults: (connectionId: string) => [...ociConnectionKeys.all, "vaults", connectionId] as const,
|
listCompartments: (connectionId: string) =>
|
||||||
listVaultKeys: (connectionId: string) => [...ociConnectionKeys.all, "keys", connectionId] as const
|
[...ociConnectionKeys.all, "compartments", connectionId] as const,
|
||||||
|
listVaults: (connectionId: string, compartmentOcid: string) =>
|
||||||
|
[...ociConnectionKeys.all, "vaults", connectionId, compartmentOcid] as const,
|
||||||
|
listVaultKeys: (connectionId: string, compartmentOcid: string, vaultOcid: string) =>
|
||||||
|
[...ociConnectionKeys.all, "keys", connectionId, compartmentOcid, vaultOcid] as const
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useOCIConnectionListCompartments = (
|
||||||
|
connectionId: string,
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<
|
||||||
|
TOCICompartment[],
|
||||||
|
unknown,
|
||||||
|
TOCICompartment[],
|
||||||
|
ReturnType<typeof ociConnectionKeys.listCompartments>
|
||||||
|
>,
|
||||||
|
"queryKey" | "queryFn"
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ociConnectionKeys.listCompartments(connectionId),
|
||||||
|
queryFn: async () => {
|
||||||
|
const { data } = await apiRequest.get<TOCICompartment[]>(
|
||||||
|
`/api/v1/app-connections/oci/${connectionId}/compartments`
|
||||||
|
);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
...options
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useOCIConnectionListVaults = (
|
export const useOCIConnectionListVaults = (
|
||||||
@@ -24,7 +59,7 @@ export const useOCIConnectionListVaults = (
|
|||||||
>
|
>
|
||||||
) => {
|
) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ociConnectionKeys.listVaults(connectionId),
|
queryKey: ociConnectionKeys.listVaults(connectionId, compartmentOcid),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await apiRequest.get<TOCIVault[]>(
|
const { data } = await apiRequest.get<TOCIVault[]>(
|
||||||
`/api/v1/app-connections/oci/${connectionId}/vaults`,
|
`/api/v1/app-connections/oci/${connectionId}/vaults`,
|
||||||
@@ -54,7 +89,7 @@ export const useOCIConnectionListVaultKeys = (
|
|||||||
>
|
>
|
||||||
) => {
|
) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ociConnectionKeys.listVaultKeys(connectionId),
|
queryKey: ociConnectionKeys.listVaultKeys(connectionId, compartmentOcid, vaultOcid),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await apiRequest.get<TOCIVaultKey[]>(
|
const { data } = await apiRequest.get<TOCIVaultKey[]>(
|
||||||
`/api/v1/app-connections/oci/${connectionId}/vault-keys`,
|
`/api/v1/app-connections/oci/${connectionId}/vault-keys`,
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
// Response types
|
// Response types
|
||||||
|
export type TOCICompartment = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type TOCIVault = {
|
export type TOCIVault = {
|
||||||
id: string;
|
id: string;
|
||||||
displayName: string;
|
displayName: string;
|
||||||
compartmentId: string;
|
|
||||||
timeCreated: string;
|
|
||||||
lifecycleState: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TOCIVaultKey = {
|
export type TOCIVaultKey = {
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ export enum SecretSync {
|
|||||||
Vercel = "vercel",
|
Vercel = "vercel",
|
||||||
Windmill = "windmill",
|
Windmill = "windmill",
|
||||||
HCVault = "hashicorp-vault",
|
HCVault = "hashicorp-vault",
|
||||||
TeamCity = "teamcity"
|
TeamCity = "teamcity",
|
||||||
|
OCIVault = "oci-vault"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SecretSyncStatus {
|
export enum SecretSyncStatus {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { TGcpSync } from "./gcp-sync";
|
|||||||
import { TGitHubSync } from "./github-sync";
|
import { TGitHubSync } from "./github-sync";
|
||||||
import { THCVaultSync } from "./hc-vault-sync";
|
import { THCVaultSync } from "./hc-vault-sync";
|
||||||
import { THumanitecSync } from "./humanitec-sync";
|
import { THumanitecSync } from "./humanitec-sync";
|
||||||
|
import { TOCIVaultSync } from "./oci-vault-sync";
|
||||||
import { TTeamCitySync } from "./teamcity-sync";
|
import { TTeamCitySync } from "./teamcity-sync";
|
||||||
import { TTerraformCloudSync } from "./terraform-cloud-sync";
|
import { TTerraformCloudSync } from "./terraform-cloud-sync";
|
||||||
import { TVercelSync } from "./vercel-sync";
|
import { TVercelSync } from "./vercel-sync";
|
||||||
@@ -36,7 +37,8 @@ export type TSecretSync =
|
|||||||
| TVercelSync
|
| TVercelSync
|
||||||
| TWindmillSync
|
| TWindmillSync
|
||||||
| THCVaultSync
|
| THCVaultSync
|
||||||
| TTeamCitySync;
|
| TTeamCitySync
|
||||||
|
| TOCIVaultSync;
|
||||||
|
|
||||||
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
|
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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 TOCIVaultSync = TRootSecretSync & {
|
||||||
|
destination: SecretSync.OCIVault;
|
||||||
|
destinationConfig: {
|
||||||
|
compartmentOcid: string;
|
||||||
|
vaultOcid: string;
|
||||||
|
keyOcid: string;
|
||||||
|
};
|
||||||
|
connection: {
|
||||||
|
app: AppConnection.OCI;
|
||||||
|
name: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
import { TOCIVaultSync } from "@app/hooks/api/secretSyncs/types/oci-vault-sync";
|
||||||
|
|
||||||
|
import { getSecretSyncDestinationColValues } from "../helpers";
|
||||||
|
import { SecretSyncTableCell } from "../SecretSyncTableCell";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
secretSync: TOCIVaultSync;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const OCIVaultSyncDestinationCol = ({ secretSync }: Props) => {
|
||||||
|
const { primaryText, secondaryText } = getSecretSyncDestinationColValues(secretSync);
|
||||||
|
|
||||||
|
return <SecretSyncTableCell primaryText={primaryText} secondaryText={secondaryText} />;
|
||||||
|
};
|
||||||
+3
@@ -10,6 +10,7 @@ import { GcpSyncDestinationCol } from "./GcpSyncDestinationCol";
|
|||||||
import { GitHubSyncDestinationCol } from "./GitHubSyncDestinationCol";
|
import { GitHubSyncDestinationCol } from "./GitHubSyncDestinationCol";
|
||||||
import { HCVaultSyncDestinationCol } from "./HCVaultSyncDestinationCol";
|
import { HCVaultSyncDestinationCol } from "./HCVaultSyncDestinationCol";
|
||||||
import { HumanitecSyncDestinationCol } from "./HumanitecSyncDestinationCol";
|
import { HumanitecSyncDestinationCol } from "./HumanitecSyncDestinationCol";
|
||||||
|
import { OCIVaultSyncDestinationCol } from "./OCIVaultSyncDestinationCol";
|
||||||
import { TeamCitySyncDestinationCol } from "./TeamCitySyncDestinationCol";
|
import { TeamCitySyncDestinationCol } from "./TeamCitySyncDestinationCol";
|
||||||
import { TerraformCloudSyncDestinationCol } from "./TerraformCloudSyncDestinationCol";
|
import { TerraformCloudSyncDestinationCol } from "./TerraformCloudSyncDestinationCol";
|
||||||
import { VercelSyncDestinationCol } from "./VercelSyncDestinationCol";
|
import { VercelSyncDestinationCol } from "./VercelSyncDestinationCol";
|
||||||
@@ -49,6 +50,8 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
|
|||||||
return <HCVaultSyncDestinationCol secretSync={secretSync} />;
|
return <HCVaultSyncDestinationCol secretSync={secretSync} />;
|
||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
return <TeamCitySyncDestinationCol secretSync={secretSync} />;
|
return <TeamCitySyncDestinationCol secretSync={secretSync} />;
|
||||||
|
case SecretSync.OCIVault:
|
||||||
|
return <OCIVaultSyncDestinationCol secretSync={secretSync} />;
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unhandled Secret Sync Destination Col: ${(secretSync as TSecretSync).destination}`
|
`Unhandled Secret Sync Destination Col: ${(secretSync as TSecretSync).destination}`
|
||||||
|
|||||||
+5
@@ -102,6 +102,11 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
|
|||||||
primaryText = destinationConfig.project;
|
primaryText = destinationConfig.project;
|
||||||
secondaryText = destinationConfig.buildConfig;
|
secondaryText = destinationConfig.buildConfig;
|
||||||
break;
|
break;
|
||||||
|
case SecretSync.OCIVault:
|
||||||
|
// TODO(andrey): Truncating these may make them look better
|
||||||
|
primaryText = destinationConfig.compartmentOcid;
|
||||||
|
secondaryText = destinationConfig.vaultOcid;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Col Values ${destination}`);
|
throw new Error(`Unhandled Destination Col Values ${destination}`);
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
import { GenericFieldLabel } from "@app/components/secret-syncs";
|
||||||
|
import { TOCIVaultSync } from "@app/hooks/api/secretSyncs/types/oci-vault-sync";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
secretSync: TOCIVaultSync;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const OCIVaultSyncDestinationSection = ({ secretSync }: Props) => {
|
||||||
|
const {
|
||||||
|
destinationConfig: { compartmentOcid, keyOcid, vaultOcid }
|
||||||
|
} = secretSync;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<GenericFieldLabel label="Compartment OCID">{compartmentOcid}</GenericFieldLabel>
|
||||||
|
<GenericFieldLabel label="Vault OCID">{vaultOcid}</GenericFieldLabel>
|
||||||
|
<GenericFieldLabel label="Key OCID">{keyOcid}</GenericFieldLabel>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
+4
@@ -20,6 +20,7 @@ import { GcpSyncDestinationSection } from "./GcpSyncDestinationSection";
|
|||||||
import { GitHubSyncDestinationSection } from "./GitHubSyncDestinationSection";
|
import { GitHubSyncDestinationSection } from "./GitHubSyncDestinationSection";
|
||||||
import { HCVaultSyncDestinationSection } from "./HCVaultSyncDestinationSection";
|
import { HCVaultSyncDestinationSection } from "./HCVaultSyncDestinationSection";
|
||||||
import { HumanitecSyncDestinationSection } from "./HumanitecSyncDestinationSection";
|
import { HumanitecSyncDestinationSection } from "./HumanitecSyncDestinationSection";
|
||||||
|
import { OCIVaultSyncDestinationSection } from "./OCIVaultSyncDestinationSection";
|
||||||
import { TeamCitySyncDestinationSection } from "./TeamCitySyncDestinationSection";
|
import { TeamCitySyncDestinationSection } from "./TeamCitySyncDestinationSection";
|
||||||
import { TerraformCloudSyncDestinationSection } from "./TerraformCloudSyncDestinationSection";
|
import { TerraformCloudSyncDestinationSection } from "./TerraformCloudSyncDestinationSection";
|
||||||
import { VercelSyncDestinationSection } from "./VercelSyncDestinationSection";
|
import { VercelSyncDestinationSection } from "./VercelSyncDestinationSection";
|
||||||
@@ -81,6 +82,9 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
|
|||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
DestinationComponents = <TeamCitySyncDestinationSection secretSync={secretSync} />;
|
DestinationComponents = <TeamCitySyncDestinationSection secretSync={secretSync} />;
|
||||||
break;
|
break;
|
||||||
|
case SecretSync.OCIVault:
|
||||||
|
DestinationComponents = <OCIVaultSyncDestinationSection secretSync={secretSync} />;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Section components: ${destination}`);
|
throw new Error(`Unhandled Destination Section components: ${destination}`);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -54,6 +54,7 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
|
|||||||
case SecretSync.Windmill:
|
case SecretSync.Windmill:
|
||||||
case SecretSync.HCVault:
|
case SecretSync.HCVault:
|
||||||
case SecretSync.TeamCity:
|
case SecretSync.TeamCity:
|
||||||
|
case SecretSync.OCIVault:
|
||||||
AdditionalSyncOptionsComponent = null;
|
AdditionalSyncOptionsComponent = null;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user