mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 12:27:28 +00:00
feat(aws-iam-rotation): add view credentials component
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
|||||||
|
import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";
|
||||||
|
import { TAwsIamUserSecretRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/aws-iam-user-secret-rotation";
|
||||||
|
|
||||||
|
import { ViewRotationGeneratedCredentialsDisplay } from "./shared";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
generatedCredentialsResponse: TAwsIamUserSecretRotationGeneratedCredentialsResponse;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ViewAwsIamUserSecretRotationGeneratedCredentials = ({
|
||||||
|
generatedCredentialsResponse: { generatedCredentials, activeIndex }
|
||||||
|
}: Props) => {
|
||||||
|
const inactiveIndex = activeIndex === 0 ? 1 : 0;
|
||||||
|
|
||||||
|
const activeCredentials = generatedCredentials[activeIndex];
|
||||||
|
const inactiveCredentials = generatedCredentials[inactiveIndex];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ViewRotationGeneratedCredentialsDisplay
|
||||||
|
activeCredentials={
|
||||||
|
<>
|
||||||
|
<CredentialDisplay label="Access Key ID">
|
||||||
|
{activeCredentials?.accessKeyId}
|
||||||
|
</CredentialDisplay>
|
||||||
|
<CredentialDisplay isSensitive label="Secret Access Key">
|
||||||
|
{activeCredentials?.secretAccessKey}
|
||||||
|
</CredentialDisplay>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
inactiveCredentials={
|
||||||
|
<>
|
||||||
|
<CredentialDisplay label="Access Key ID">
|
||||||
|
{inactiveCredentials?.accessKeyId}
|
||||||
|
</CredentialDisplay>
|
||||||
|
<CredentialDisplay isSensitive label="Secret Access Key">
|
||||||
|
{inactiveCredentials?.secretAccessKey}
|
||||||
|
</CredentialDisplay>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
+8
@@ -13,6 +13,7 @@ import {
|
|||||||
} from "@app/hooks/api/secretRotationsV2";
|
} from "@app/hooks/api/secretRotationsV2";
|
||||||
|
|
||||||
import { ViewSqlCredentialsRotationGeneratedCredentials } from "./shared";
|
import { ViewSqlCredentialsRotationGeneratedCredentials } from "./shared";
|
||||||
|
import { ViewAwsIamUserSecretRotationGeneratedCredentials } from "./ViewAwsIamUserSecretRotationGeneratedCredentials";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
secretRotation?: TSecretRotationV2;
|
secretRotation?: TSecretRotationV2;
|
||||||
@@ -67,6 +68,13 @@ const Content = ({ secretRotation }: ContentProps) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case SecretRotation.AwsIamUserSecret:
|
||||||
|
Component = (
|
||||||
|
<ViewAwsIamUserSecretRotationGeneratedCredentials
|
||||||
|
generatedCredentialsResponse={generatedCredentialsResponse}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error("Unhandled View Generated Credential Rotation Type");
|
throw new Error("Unhandled View Generated Credential Rotation Type");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user