allowed creating of multiple tags

This commit is contained in:
Vladyslav Matsiiako
2024-04-19 17:46:33 -07:00
parent a087deb1eb
commit 714a3186a9
9 changed files with 32 additions and 22 deletions
+6 -6
View File
@@ -585,12 +585,12 @@ export const INTEGRATION = {
region: "AWS region to sync secrets to.", region: "AWS region to sync secrets to.",
scope: "Scope of the provider. Used by Github, Qovery", scope: "Scope of the provider. Used by Github, Qovery",
metadata: { metadata: {
secretPrefix: "The prefix for the saved secret. Used by GCP", secretPrefix: "The prefix for the saved secret. Used by GCP.",
secretSuffix: "The suffix for the saved secret. Used by GCP", secretSuffix: "The suffix for the saved secret. Used by GCP.",
initialSyncBehavoir: "Type of syncing behavoir with the integration", initialSyncBehavoir: "Type of syncing behavoir with the integration.",
shouldAutoRedeploy: "Used by Render to trigger auto deploy", shouldAutoRedeploy: "Used by Render to trigger auto deploy.",
secretGCPLabel: "The label for the GCP secrets", secretGCPLabel: "The label for GCP secrets.",
secretAWSTag: "The tag for the AWS secrets" secretAWSTag: "The tags for AWS secrets."
} }
}, },
UPDATE: { UPDATE: {
@@ -58,10 +58,12 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
.optional() .optional()
.describe(INTEGRATION.CREATE.metadata.secretGCPLabel), .describe(INTEGRATION.CREATE.metadata.secretGCPLabel),
secretAWSTag: z secretAWSTag: z
.object({ .array(
key: z.string(), z.object({
value: z.string() key: z.string(),
}) value: z.string()
})
)
.optional() .optional()
.describe(INTEGRATION.CREATE.metadata.secretAWSTag) .describe(INTEGRATION.CREATE.metadata.secretAWSTag)
}) })
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-argument */
@@ -489,7 +490,9 @@ const syncSecretsAWSParameterStore = async ({
Type: "SecureString", Type: "SecureString",
Value: secrets[key].value, Value: secrets[key].value,
// Overwrite: true, // Overwrite: true,
Tags: metadata.secretAWSTag ? [{ Key: metadata.secretAWSTag.key, Value: metadata.secretAWSTag.value }] : [] Tags: metadata.secretAWSTag
? metadata.secretAWSTag.map((tag: { key: string; value: string }) => ({ Key: tag.key, Value: tag.value }))
: []
}) })
.promise(); .promise();
// case: secret exists in AWS parameter store // case: secret exists in AWS parameter store
@@ -579,7 +582,9 @@ const syncSecretsAWSSecretManager = async ({
new CreateSecretCommand({ new CreateSecretCommand({
Name: integration.app as string, Name: integration.app as string,
SecretString: JSON.stringify(secKeyVal), SecretString: JSON.stringify(secKeyVal),
Tags: metadata.secretAWSTag ? [{ Key: metadata.secretAWSTag.key, Value: metadata.secretAWSTag.value }] : [] Tags: metadata.secretAWSTag
? metadata.secretAWSTag.map((tag: { key: string; value: string }) => ({ Key: tag.key, Value: tag.value }))
: []
}) })
); );
} }
@@ -25,7 +25,7 @@ export type TCreateIntegrationDTO = {
secretAWSTag?: { secretAWSTag?: {
key: string; key: string;
value: string; value: string;
}; }[];
}; };
} & Omit<TProjectPermission, "projectId">; } & Omit<TProjectPermission, "projectId">;
@@ -66,7 +66,7 @@ export const useCreateIntegration = () => {
secretAWSTag?: { secretAWSTag?: {
key: string; key: string;
value: string; value: string;
}; }[];
}; };
}) => { }) => {
const { const {
@@ -128,10 +128,10 @@ export default function AWSParameterStoreCreateIntegrationPage() {
metadata: { metadata: {
...(shouldTag ...(shouldTag
? { ? {
secretAWSTag: { secretAWSTag: [{
key: tagKey, key: tagKey,
value: tagValue value: tagValue
} }]
} }
: {}) : {})
} }
@@ -279,7 +279,7 @@ export default function AWSParameterStoreCreateIntegrationPage() {
label="Tag Value" label="Tag Value"
> >
<Input <Input
placeholder="managed-by" placeholder="infisical"
value={tagValue} value={tagValue}
onChange={(e) => setTagValue(e.target.value)} onChange={(e) => setTagValue(e.target.value)}
/> />
@@ -127,10 +127,10 @@ export default function AWSSecretManagerCreateIntegrationPage() {
metadata: { metadata: {
...(shouldTag ...(shouldTag
? { ? {
secretAWSTag: { secretAWSTag: [{
key: tagKey, key: tagKey,
value: tagValue value: tagValue
} }]
} }
: {}) : {})
} }
@@ -278,7 +278,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
label="Tag Value" label="Tag Value"
> >
<Input <Input
placeholder="managed-by" placeholder="infisical"
value={tagValue} value={tagValue}
onChange={(e) => setTagValue(e.target.value)} onChange={(e) => setTagValue(e.target.value)}
/> />
@@ -74,7 +74,7 @@ export const IntegrationsSection = ({
</div> </div>
)} )}
{!isLoading && isBotActive && ( {!isLoading && isBotActive && (
<div className="flex flex-col space-y-4 p-6 pt-0"> <div className="flex flex-col min-w-max space-y-4 p-6 pt-0">
{integrations?.map((integration) => ( {integrations?.map((integration) => (
<div <div
className="max-w-8xl flex justify-between rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3" className="max-w-8xl flex justify-between rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3"
@@ -128,6 +128,8 @@ export const IntegrationsSection = ({
<FormLabel <FormLabel
label={ label={
(integration.integration === "qovery" && integration?.scope) || (integration.integration === "qovery" && integration?.scope) ||
(integration.integration === "aws-secret-manager" && "Secret") ||
(integration.integration === "aws-parameter-store" && "Path") ||
(integration?.scope === "github-org" && "Organization") || (integration?.scope === "github-org" && "Organization") ||
(["github-repo", "github-env"].includes(integration?.scope as string) && (["github-repo", "github-env"].includes(integration?.scope as string) &&
"Repository") || "Repository") ||
@@ -138,6 +140,7 @@ export const IntegrationsSection = ({
{(integration.integration === "hashicorp-vault" && {(integration.integration === "hashicorp-vault" &&
`${integration.app} - path: ${integration.path}`) || `${integration.app} - path: ${integration.path}`) ||
(integration.scope === "github-org" && `${integration.owner}`) || (integration.scope === "github-org" && `${integration.owner}`) ||
(integration.integration === "aws-parameter-store" && `${integration.path}`) ||
(integration.scope?.startsWith("github-") && (integration.scope?.startsWith("github-") &&
`${integration.owner}/${integration.app}`) || `${integration.owner}/${integration.app}`) ||
integration.app} integration.app}
+1 -1
View File
@@ -8,5 +8,5 @@ export type Metadata = {
secretAWSTag?: { secretAWSTag?: {
key: string; key: string;
value: string; value: string;
} }[]
} }