Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

add rotation

Matheus Nogueira73c5c3cefde1
diff --git a/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-constants.ts
index 150d1672e0..89482b1aa5 100644
--- a/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-constants.ts
+++ b/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-constants.ts
@@ -8,7 +8,7 @@ export const FIREWORKS_API_KEY_ROTATION_LIST_OPTION: TSecretRotationV2ListItem =
connection: AppConnection.Fireworks,
template: {
secretsMapping: {
- secretValue: "FIREWORKS_SECRET"
+ apiKey: "FIREWORKS_API_KEY"
}
}
};
diff --git a/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-fns.ts
index 6e1b2bb6a5..b98e483b23 100644
--- a/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-fns.ts
@@ -1,5 +1,3 @@
-import crypto from "node:crypto";
-
import { AxiosError } from "axios";
import {
@@ -19,17 +17,21 @@ import {
TFireworksApiKeyRotationWithConnection
} from "./fireworks-api-key-rotation-types";
-const $createSecret = async (
+type TFireworksCreateApiKeyResponse = {
+ keyId: string;
+ key: string;
+};
+
+const $createApiKey = async (
apiKey: string,
accountId: string,
- keyName: string
-): Promise<{ secretName: string; secretValue: string }> => {
- const secretValue = crypto.randomBytes(32).toString("base64url");
-
+ userId: string,
+ displayName: string
+): Promise<{ keyId: string; apiKey: string }> => {
try {
- const { data } = await request.post<{ name: string }>(
- `${FIREWORKS_API_BASE_URL}/v1/accounts/${accountId}/secrets`,
- { keyName, value: secretValue },
+ const { data } = await request.post<TFireworksCreateApiKeyResponse>(
+ `${FIREWORKS_API_BASE_URL}/v1/accounts/${accountId}/users/${userId}/apiKeys`,
+ { apiKey: { displayName } },
{
headers: {
Authorization: `Bearer ${apiKey}`,
@@ -38,36 +40,38 @@ const $createSecret = async (
}
);
- if (!data?.name) {
- throw new Error("Invalid response from Fireworks: missing 'name'.");
+ if (!data?.key) {
+ throw new Error("Invalid response from Fireworks: missing API key data.");
}
return {
- secretName: data.name,
- secretValue
+ keyId: data.keyId,
+ apiKey: data.key
};
} catch (error: unknown) {
if (error instanceof BadRequestError) throw error;
throw new BadRequestError({
- message: `Failed to create Fireworks secret: ${error instanceof AxiosError ? error.message : "Unknown error"}`
+ message: `Failed to create Fireworks API key: ${error instanceof AxiosError ? error.message : "Unknown error"}`
});
}
};
-const $deleteSecret = async (apiKey: string, accountId: string, secretName: string): Promise<void> => {
- const secretId = secretName.split("/").pop();
-
+const $deleteApiKey = async (authKey: string, accountId: string, userId: string, keyId: string): Promise<void> => {
try {
- await request.delete(`${FIREWORKS_API_BASE_URL}/v1/accounts/${accountId}/secrets/${secretId}`, {
- headers: {
- Authorization: `Bearer ${apiKey}`,
- "Content-Type": "application/json"
+ await request.post(
+ `${FIREWORKS_API_BASE_URL}/v1/accounts/${accountId}/users/${userId}/apiKeys:delete`,
+ { keyId },
+ {
+ headers: {
+ Authorization: `Bearer ${authKey}`,
+ "Content-Type": "application/json"
+ }
}
- });
+ );
} catch (error: unknown) {
if (error instanceof AxiosError && error.response?.status === 404) return;
throw new BadRequestError({
- message: `Failed to delete Fireworks secret: ${error instanceof AxiosError ? error.message : "Unknown error"}`
+ message: `Failed to delete Fireworks API key: ${error instanceof AxiosError ? error.message : "Unknown error"}`
});
}
};
@@ -79,16 +83,18 @@ export const fireworksApiKeyRotationFactory: TRotationFactory<
const {
id: rotationId,
connection,
- parameters: { keyName },
+ parameters: { serviceAccountUserId },
secretsMapping
} = secretRotation;
const { apiKey, accountId } = connection.credentials;
+ const generateDisplayName = () => `Infisical-rotation-${Date.now()}`;
+
const issueCredentials: TRotationFactoryIssueCredentials<TFireworksApiKeyRotationGeneratedCredentials> = async (
callback
) => {
- const credentials = await $createSecret(apiKey, accountId, keyName);
+ const credentials = await $createApiKey(apiKey, accountId, serviceAccountUserId, generateDisplayName());
return callback(credentials);
};
@@ -99,14 +105,14 @@ export const fireworksApiKeyRotationFactory: TRotationFactory<
if (!generatedCredentials?.length) return callback();
const results = await Promise.allSettled(
- generatedCredentials.map((credential) => $deleteSecret(apiKey, accountId, credential.secretName))
+ generatedCredentials.map((credential) => $deleteApiKey(apiKey, accountId, serviceAccountUserId, credential.keyId))
);
results.forEach((result, index) => {
if (result.status === "rejected") {
logger.error(
result.reason,
- `fireworksApiKeyRotation: failed to revoke secret during cleanup [rotationId=${rotationId}] [secretName=${generatedCredentials[index].secretName}]`
+ `fireworksApiKeyRotation: failed to revoke API key during cleanup [rotationId=${rotationId}] [keyId=${generatedCredentials[index].keyId}]`
);
}
});
@@ -118,15 +124,15 @@ export const fireworksApiKeyRotationFactory: TRotationFactory<
credentialsToRevoke,
callback
) => {
- const credentials = await $createSecret(apiKey, accountId, keyName);
+ const credentials = await $createApiKey(apiKey, accountId, serviceAccountUserId, generateDisplayName());
- if (credentialsToRevoke?.secretName) {
+ if (credentialsToRevoke?.keyId) {
try {
- await $deleteSecret(apiKey, accountId, credentialsToRevoke.secretName);
+ await $deleteApiKey(apiKey, accountId, serviceAccountUserId, credentialsToRevoke.keyId);
} catch (revokeError) {
logger.error(
revokeError,
- `fireworksApiKeyRotation: failed to revoke previous secret after rotation [rotationId=${rotationId}] [secretName=${credentialsToRevoke.secretName}]`
+ `fireworksApiKeyRotation: failed to revoke previous API key after rotation [rotationId=${rotationId}] [keyId=${credentialsToRevoke.keyId}]`
);
}
}
@@ -136,7 +142,7 @@ export const fireworksApiKeyRotationFactory: TRotationFactory<
const getSecretsPayload: TRotationFactoryGetSecretsPayload<TFireworksApiKeyRotationGeneratedCredentials> = (
generatedCredentials
- ) => [{ key: secretsMapping.secretValue, value: generatedCredentials.secretValue }];
+ ) => [{ key: secretsMapping.apiKey, value: generatedCredentials.apiKey }];
return {
issueCredentials,
diff --git a/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-schemas.ts
index f16e2ed8e6..ca89f5c4d4 100644
--- a/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-schemas.ts
+++ b/backend/src/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-schemas.ts
@@ -12,24 +12,28 @@ import { AppConnection } from "@app/services/app-connection/app-connection-enums
export const FireworksApiKeyRotationGeneratedCredentialsSchema = z
.object({
- secretName: z.string(),
- secretValue: z.string()
+ keyId: z.string(),
+ apiKey: z.string()
})
.array()
.min(1)
.max(2);
const FireworksApiKeyRotationParametersSchema = z.object({
- keyName: z.string().trim().min(1, "Key name required").describe(SecretRotations.PARAMETERS.FIREWORKS_API_KEY.keyName)
+ serviceAccountUserId: z
+ .string()
+ .trim()
+ .min(1, "Service account required")
+ .describe(SecretRotations.PARAMETERS.FIREWORKS_API_KEY.serviceAccountUserId)
});
const FireworksApiKeyRotationSecretsMappingSchema = z.object({
- secretValue: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.FIREWORKS_API_KEY.secretValue)
+ apiKey: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.FIREWORKS_API_KEY.apiKey)
});
export const FireworksApiKeyRotationTemplateSchema = z.object({
secretsMapping: z.object({
- secretValue: z.string()
+ apiKey: z.string()
})
});
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index af74f84963..293155cdbd 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -3473,7 +3473,7 @@ export const SecretRotations = {
namePrefix: "A prefix to use when naming the generated Convex access key."
},
FIREWORKS_API_KEY: {
- keyName: "The key name identifier for the secret on Fireworks."
+ serviceAccountUserId: "The user ID of the Fireworks service account to create the API key for."
}
},
SECRETS_MAPPING: {
@@ -3550,7 +3550,7 @@ export const SecretRotations = {
accessKey: "The name of the secret that the rotated Convex access key will be mapped to."
},
FIREWORKS_API_KEY: {
- secretValue: "The name of the secret that the rotated Fireworks secret value will be mapped to."
+ apiKey: "The name of the secret that the rotated Fireworks API key will be mapped to."
}
}
};
diff --git a/backend/src/server/routes/v1/app-connection-routers/fireworks-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/fireworks-connection-router.ts
index ec7be4826f..3cfa097546 100644
--- a/backend/src/server/routes/v1/app-connection-routers/fireworks-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/fireworks-connection-router.ts
@@ -1,9 +1,14 @@
+import { z } from "zod";
+
+import { readLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import {
CreateFireworksConnectionSchema,
SanitizedFireworksConnectionSchema,
UpdateFireworksConnectionSchema
} from "@app/services/app-connection/fireworks";
+import { AuthMode } from "@app/services/auth/auth-type";
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
@@ -15,4 +20,44 @@ export const registerFireworksConnectionRouter = async (server: FastifyZodProvid
createSchema: CreateFireworksConnectionSchema,
updateSchema: UpdateFireworksConnectionSchema
});
+
+ // The below endpoints are not exposed and for Infisical App use
+ server.route({
+ method: "GET",
+ url: `/:connectionId/service-accounts`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ operationId: "listFireworksServiceAccounts",
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ response: {
+ 200: z.object({
+ serviceAccounts: z
+ .object({
+ name: z.string(),
+ displayName: z.string(),
+ email: z.string().optional(),
+ role: z.string(),
+ serviceAccount: z.boolean(),
+ state: z.string()
+ })
+ .array()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+
+ const serviceAccounts = await server.services.appConnection.fireworks.listServiceAccounts(
+ connectionId,
+ req.permission
+ );
+
+ return { serviceAccounts };
+ }
+ });
};
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index 26a432059b..6a7efafd33 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -109,6 +109,7 @@ import { ValidateExternalInfisicalConnectionCredentialsSchema } from "./external
import { externalInfisicalConnectionService } from "./external-infisical/external-infisical-connection-service";
import { ValidateF5BigIpConnectionCredentialsSchema } from "./f5-big-ip";
import { ValidateFireworksConnectionCredentialsSchema } from "./fireworks";
+import { fireworksConnectionService } from "./fireworks/fireworks-connection-service";
import { ValidateFlyioConnectionCredentialsSchema } from "./flyio";
import { flyioConnectionService } from "./flyio/flyio-connection-service";
import { ValidateGcpConnectionCredentialsSchema } from "./gcp";
@@ -1374,6 +1375,7 @@ export const appConnectionServiceFactory = ({
doppler: dopplerConnectionService(connectAppConnectionById),
digicert: digicertConnectionService(connectAppConnectionById),
travisCI: travisCIConnectionService(connectAppConnectionById),
- snowflake: snowflakeConnectionService(connectAppConnectionById)
+ snowflake: snowflakeConnectionService(connectAppConnectionById),
+ fireworks: fireworksConnectionService(connectAppConnectionById)
};
};
diff --git a/backend/src/services/app-connection/fireworks/fireworks-connection-fns.ts b/backend/src/services/app-connection/fireworks/fireworks-connection-fns.ts
index d07f0cbc72..8c23753ba8 100644
--- a/backend/src/services/app-connection/fireworks/fireworks-connection-fns.ts
+++ b/backend/src/services/app-connection/fireworks/fireworks-connection-fns.ts
@@ -3,7 +3,7 @@ import { UnauthorizedError } from "@app/lib/errors";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { FireworksConnectionMethod } from "./fireworks-connection-enums";
-import { TFireworksConnectionConfig } from "./fireworks-connection-types";
+import { TFireworksConnection, TFireworksConnectionConfig } from "./fireworks-connection-types";
export const FIREWORKS_API_BASE_URL = "https://api.fireworks.ai";
@@ -33,3 +33,45 @@ export const validateFireworksConnectionCredentials = async (config: TFireworksC
return config.credentials;
};
+
+export type TFireworksUser = {
+ name: string;
+ displayName: string;
+ email: string;
+ role: string;
+ serviceAccount: boolean;
+ state: string;
+};
+
+export const listFireworksUsers = async (appConnection: TFireworksConnection) => {
+ const { apiKey, accountId } = appConnection.credentials;
+
+ const users: TFireworksUser[] = [];
+ let pageToken: string | undefined;
+
+ // eslint-disable-next-line no-constant-condition
+ while (true) {
+ // eslint-disable-next-line no-await-in-loop
+ const { data } = await request.get<{ users: TFireworksUser[]; nextPageToken?: string }>(
+ `${FIREWORKS_API_BASE_URL}/v1/accounts/${accountId}/users`,
+ {
+ headers: {
+ Authorization: `Bearer ${apiKey}`
+ },
+ params: {
+ pageSize: 200,
+ ...(pageToken ? { pageToken } : {})
+ }
+ }
+ );
+
+ if (data.users) {
+ users.push(...data.users.filter((u) => u.serviceAccount));
+ }
+
+ if (!data.nextPageToken) break;
+ pageToken = data.nextPageToken;
+ }
+
+ return users;
+};
diff --git a/backend/src/services/app-connection/fireworks/fireworks-connection-service.ts b/backend/src/services/app-connection/fireworks/fireworks-connection-service.ts
new file mode 100644
index 0000000000..565228b531
--- /dev/null
+++ b/backend/src/services/app-connection/fireworks/fireworks-connection-service.ts
@@ -0,0 +1,29 @@
+import { logger } from "@app/lib/logger";
+import { OrgServiceActor } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import { listFireworksUsers } from "./fireworks-connection-fns";
+import { TFireworksConnection } from "./fireworks-connection-types";
+
+type TGetAppConnectionFunc = (
+ app: AppConnection,
+ connectionId: string,
+ actor: OrgServiceActor
+) => Promise<TFireworksConnection>;
+
+export const fireworksConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
+ const listServiceAccounts = async (connectionId: string, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.Fireworks, connectionId, actor);
+ try {
+ const users = await listFireworksUsers(appConnection);
+ return users ?? [];
+ } catch (error) {
+ logger.error(error, "Failed to list Fireworks service accounts");
+ return [];
+ }
+ };
+
+ return {
+ listServiceAccounts
+ };
+};
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewFireworksApiKeyRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewFireworksApiKeyRotationGeneratedCredentials.tsx
index 72ec707e97..d6503f3580 100644
--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewFireworksApiKeyRotationGeneratedCredentials.tsx
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewFireworksApiKeyRotationGeneratedCredentials.tsx
@@ -17,13 +17,13 @@ export const ViewFireworksApiKeyRotationGeneratedCredentials = ({
return (
<ViewRotationGeneratedCredentialsDisplay
activeCredentials={
- <CredentialDisplay isSensitive label="Secret Value">
- {activeCredentials?.secretValue}
+ <CredentialDisplay isSensitive label="API Key">
+ {activeCredentials?.apiKey}
</CredentialDisplay>
}
inactiveCredentials={
- <CredentialDisplay isSensitive label="Secret Value">
- {inactiveCredentials?.secretValue}
+ <CredentialDisplay isSensitive label="API Key">
+ {inactiveCredentials?.apiKey}
</CredentialDisplay>
}
/>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/FireworksApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/FireworksApiKeyRotationParametersFields.tsx
index 6cc43255bc..2f9719fe59 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/FireworksApiKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/FireworksApiKeyRotationParametersFields.tsx
@@ -1,9 +1,22 @@
-import { Controller, useFormContext } from "react-hook-form";
+import { Controller, useFormContext, useWatch } from "react-hook-form";
+import { SingleValue } from "react-select";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { FilterableSelect, FormControl } from "@app/components/v2";
+import {
+ TFireworksServiceAccount,
+ useFireworksConnectionListServiceAccounts
+} from "@app/hooks/api/appConnections/fireworks";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+const getUserId = (name: string) => name.split("/").pop() ?? name;
+
+const formatServiceAccountLabel = (option: TFireworksServiceAccount) => (
+ <span>
+ {option.displayName} <span className="text-mineshaft-400">({getUserId(option.name)})</span>
+ </span>
+);
+
export const FireworksApiKeyRotationParametersFields = () => {
const { control } = useFormContext<
TSecretRotationV2Form & {
@@ -11,13 +24,38 @@ export const FireworksApiKeyRotationParametersFields = () => {
}
>();
+ const connectionId = useWatch({ name: "connection.id", control });
+
+ const { data: serviceAccounts = [], isPending: isServiceAccountsLoading } =
+ useFireworksConnectionListServiceAccounts(connectionId, {
+ enabled: Boolean(connectionId)
+ });
+
return (
<Controller
- name="parameters.keyName"
+ name="parameters.serviceAccountUserId"
control={control}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message} label="Key Name">
- <Input value={value} onChange={onChange} placeholder="e.g. MY_SECRET_KEY" />
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Service Account"
+ tooltipText="The Fireworks service account to create the API key for"
+ >
+ <FilterableSelect
+ isLoading={isServiceAccountsLoading && Boolean(connectionId)}
+ isDisabled={!connectionId}
+ value={serviceAccounts.find((sa) => getUserId(sa.name) === value) ?? null}
+ onChange={(option) => {
+ const selected = option as SingleValue<TFireworksServiceAccount>;
+ onChange(selected ? getUserId(selected.name) : null);
+ }}
+ options={serviceAccounts}
+ placeholder="Select a service account..."
+ getOptionLabel={(option) => `${option.displayName} (${getUserId(option.name)})`}
+ getOptionValue={(option) => getUserId(option.name)}
+ formatOptionLabel={formatServiceAccountLabel}
+ />
</FormControl>
)}
/>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/FireworksApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/FireworksApiKeyRotationReviewFields.tsx
index c13355084c..ec0eec66f8 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/FireworksApiKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/FireworksApiKeyRotationReviewFields.tsx
@@ -13,15 +13,17 @@ export const FireworksApiKeyRotationReviewFields = () => {
}
>();
- const [parameters, { secretValue }] = watch(["parameters", "secretsMapping"]);
+ const [parameters, { apiKey }] = watch(["parameters", "secretsMapping"]);
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Key Name">{parameters.keyName}</GenericFieldLabel>
+ <GenericFieldLabel label="Service Account">
+ {parameters.serviceAccountUserId}
+ </GenericFieldLabel>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Secret Value">{secretValue}</GenericFieldLabel>
+ <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/FireworksApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/FireworksApiKeyRotationSecretsMappingFields.tsx
index 3b26218725..8d1742b86d 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/FireworksApiKeyRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/FireworksApiKeyRotationSecretsMappingFields.tsx
@@ -17,7 +17,7 @@ export const FireworksApiKeyRotationSecretsMappingFields = () => {
const items = [
{
- name: "Secret Value",
+ name: "API Key",
input: (
<Controller
render={({ field: { value, onChange }, fieldState: { error } }) => (
@@ -25,12 +25,12 @@ export const FireworksApiKeyRotationSecretsMappingFields = () => {
<Input
value={value}
onChange={onChange}
- placeholder={rotationOption?.template.secretsMapping.secretValue}
+ placeholder={rotationOption?.template.secretsMapping.apiKey}
/>
</FormControl>
)}
control={control}
- name="secretsMapping.secretValue"
+ name="secretsMapping.apiKey"
/>
)
}
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/fireworks-api-key-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/fireworks-api-key-rotation-schema.ts
index 1f10b1c354..ee5411a91a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/fireworks-api-key-rotation-schema.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/fireworks-api-key-rotation-schema.ts
@@ -7,10 +7,10 @@ export const FireworksApiKeyRotationSchema = z
.object({
type: z.literal(SecretRotation.FireworksApiKey),
parameters: z.object({
- keyName: z.string().trim().min(1, "Key name required")
+ serviceAccountUserId: z.string().trim().min(1, "Service account required")
}),
secretsMapping: z.object({
- secretValue: z.string().trim().min(1, "Secret value name required")
+ apiKey: z.string().trim().min(1, "API key name required")
})
})
.merge(BaseSecretRotationSchema);
diff --git a/frontend/src/hooks/api/appConnections/fireworks/index.ts b/frontend/src/hooks/api/appConnections/fireworks/index.ts
new file mode 100644
index 0000000000..2c1906d369
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/fireworks/index.ts
@@ -0,0 +1,2 @@
+export * from "./queries";
+export * from "./types";
diff --git a/frontend/src/hooks/api/appConnections/fireworks/queries.tsx b/frontend/src/hooks/api/appConnections/fireworks/queries.tsx
new file mode 100644
index 0000000000..e9ca13a41f
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/fireworks/queries.tsx
@@ -0,0 +1,37 @@
+import { useQuery, UseQueryOptions } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+import { appConnectionKeys } from "@app/hooks/api/appConnections";
+
+import { TFireworksServiceAccount } from "./types";
+
+const fireworksConnectionKeys = {
+ all: [...appConnectionKeys.all, "fireworks"] as const,
+ listServiceAccounts: (connectionId: string) =>
+ [...fireworksConnectionKeys.all, "service-accounts", connectionId] as const
+};
+
+export const useFireworksConnectionListServiceAccounts = (
+ connectionId: string,
+ options?: Omit<
+ UseQueryOptions<
+ TFireworksServiceAccount[],
+ unknown,
+ TFireworksServiceAccount[],
+ ReturnType<typeof fireworksConnectionKeys.listServiceAccounts>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: fireworksConnectionKeys.listServiceAccounts(connectionId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{ serviceAccounts: TFireworksServiceAccount[] }>(
+ `/api/v1/app-connections/fireworks/${connectionId}/service-accounts`
+ );
+
+ return data.serviceAccounts;
+ },
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/appConnections/fireworks/types.ts b/frontend/src/hooks/api/appConnections/fireworks/types.ts
new file mode 100644
index 0000000000..69565dac85
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/fireworks/types.ts
@@ -0,0 +1,8 @@
+export type TFireworksServiceAccount = {
+ name: string;
+ displayName: string;
+ email?: string;
+ role: string;
+ serviceAccount: boolean;
+ state: string;
+};
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/fireworks-api-key-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/fireworks-api-key-rotation.ts
index baed953fd8..5228edab7e 100644
--- a/frontend/src/hooks/api/secretRotationsV2/types/fireworks-api-key-rotation.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/types/fireworks-api-key-rotation.ts
@@ -8,16 +8,16 @@ import {
export type TFireworksApiKeyRotation = TSecretRotationV2Base & {
type: SecretRotation.FireworksApiKey;
parameters: {
- keyName: string;
+ serviceAccountUserId: string;
};
secretsMapping: {
- secretValue: string;
+ apiKey: string;
};
};
export type TFireworksApiKeyRotationGeneratedCredentials = {
- secretName: string;
- secretValue: string;
+ keyId: string;
+ apiKey: string;
};
export type TFireworksApiKeyRotationGeneratedCredentialsResponse =