Add more missing redis stuff

This commit is contained in:
Fang-Pen Lin
2025-12-22 15:50:15 -08:00
parent 95e56a4055
commit 4e5288b8af
6 changed files with 51 additions and 4 deletions

View File

@@ -18,6 +18,10 @@ import {
PostgresResourceListItemSchema,
SanitizedPostgresResourceSchema
} from "@app/ee/services/pam-resource/postgres/postgres-resource-schemas";
import {
RedisResourceListItemSchema,
SanitizedRedisResourceSchema
} from "@app/ee/services/pam-resource/redis/redis-resource-schemas";
import {
SanitizedSSHResourceSchema,
SSHResourceListItemSchema
@@ -32,7 +36,8 @@ const SanitizedResourceSchema = z.union([
SanitizedMySQLResourceSchema,
SanitizedSSHResourceSchema,
SanitizedKubernetesResourceSchema,
SanitizedAwsIamResourceSchema
SanitizedAwsIamResourceSchema,
SanitizedRedisResourceSchema
]);
const ResourceOptionsSchema = z.discriminatedUnion("resource", [
@@ -40,7 +45,8 @@ const ResourceOptionsSchema = z.discriminatedUnion("resource", [
MySQLResourceListItemSchema,
SSHResourceListItemSchema,
KubernetesResourceListItemSchema,
AwsIamResourceListItemSchema
AwsIamResourceListItemSchema,
RedisResourceListItemSchema
]);
export const registerPamResourceRouter = async (server: FastifyZodProvider) => {

View File

@@ -8,13 +8,15 @@ import { getKubernetesResourceListItem } from "./kubernetes/kubernetes-resource-
import { getMySQLResourceListItem } from "./mysql/mysql-resource-fns";
import { TPamResource, TPamResourceConnectionDetails, TPamResourceMetadata } from "./pam-resource-types";
import { getPostgresResourceListItem } from "./postgres/postgres-resource-fns";
import { getRedisResourceListItem } from "./redis/redis-resource-fns";
export const listResourceOptions = () => {
return [
getPostgresResourceListItem(),
getMySQLResourceListItem(),
getAwsIamResourceListItem(),
getKubernetesResourceListItem()
getKubernetesResourceListItem(),
getRedisResourceListItem()
].sort((a, b) => a.name.localeCompare(b.name));
};

View File

@@ -0,0 +1,8 @@
import { RedisResourceListItemSchema } from "./redis-resource-schemas";
export const getRedisResourceListItem = () => {
return {
name: RedisResourceListItemSchema.shape.name.value,
resource: RedisResourceListItemSchema.shape.resource.value
};
};

View File

@@ -10,17 +10,20 @@ import { TAwsIamAccount, TAwsIamResource } from "./aws-iam-resource";
import { TKubernetesAccount, TKubernetesResource } from "./kubernetes-resource";
import { TMySQLAccount, TMySQLResource } from "./mysql-resource";
import { TPostgresAccount, TPostgresResource } from "./postgres-resource";
import { TRedisAccount, TRedisResource } from "./redis-resource";
import { TSSHAccount, TSSHResource } from "./ssh-resource";
export * from "./aws-iam-resource";
export * from "./kubernetes-resource";
export * from "./mysql-resource";
export * from "./postgres-resource";
export * from "./redis-resource";
export * from "./ssh-resource";
export type TPamResource =
| TPostgresResource
| TMySQLResource
| TRedisResource
| TSSHResource
| TAwsIamResource
| TKubernetesResource;
@@ -28,6 +31,7 @@ export type TPamResource =
export type TPamAccount =
| TPostgresAccount
| TMySQLAccount
| TRedisAccount
| TSSHAccount
| TAwsIamAccount
| TKubernetesAccount;

View File

@@ -0,0 +1,28 @@
import { PamResourceType } from "../enums";
import { TBasePamAccount } from "./base-account";
import { TBasePamResource } from "./base-resource";
export type TRedisConnectionDetails = {
host: string;
port: number;
username?: string;
password?: string;
sslEnabled: boolean;
sslRejectUnauthorized: boolean;
sslCertificate?: string;
};
export type TRedisCredentials = {
username: string;
password: string;
};
// Resources
export type TRedisResource = TBasePamResource & { resourceType: PamResourceType.Redis } & {
connectionDetails: TRedisConnectionDetails;
};
// Accounts
export type TRedisAccount = TBasePamAccount & {
credentials: TRedisCredentials;
};

View File

@@ -35,7 +35,6 @@ export const ResourceTypeSelect = ({ onSelect }: Props) => {
{ name: "DynamoDB", resource: PamResourceType.DynamoDB },
{ name: "Snowflake", resource: PamResourceType.Snowflake },
{ name: "Elasticsearch", resource: PamResourceType.Elasticsearch },
{ name: "Redis", resource: PamResourceType.Redis },
{ name: "RDP", resource: PamResourceType.RDP },
{ name: "SSH", resource: PamResourceType.SSH },
{ name: "MCP", resource: PamResourceType.MCP },