Skip to content

Commit

Permalink
add support for hosted cloud provider (#4370)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feroze Mohideen authored Mar 5, 2024
1 parent 7ac0983 commit 0573f1d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
28 changes: 28 additions & 0 deletions dashboard/src/lib/clusters/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1639,9 +1639,37 @@ export const CloudProviderLocal: ClientCloudProvider = {
kind: "Local",
},
};
export const CloudProviderHosted: ClientCloudProvider = {
name: "Hosted",
displayName: "Hosted",
icon: infra,
regions: [],
machineTypes: [],
baseCost: 0,
newClusterDefaultContract: new Contract({}),
preflightChecks: [],
config: {
kind: "Hosted",
},
};
export const CloudProviderUnknown: ClientCloudProvider = {
name: "UNKNOWN",
displayName: "Unknown",
icon: infra,
regions: [],
machineTypes: [],
baseCost: 0,
newClusterDefaultContract: new Contract({}),
preflightChecks: [],
config: {
kind: "UNKNOWN",
},
};
export const SUPPORTED_CLOUD_PROVIDERS = [
CloudProviderAWS,
CloudProviderGCP,
CloudProviderAzure,
CloudProviderLocal,
CloudProviderHosted,
CloudProviderUnknown,
];
17 changes: 15 additions & 2 deletions dashboard/src/lib/clusters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import { checkGroupValidator } from "main/home/compliance-dashboard/types";
import { CloudProviderAWS } from "./constants";

// Cloud
export const cloudProviderValidator = z.enum(["AWS", "GCP", "Azure", "Local"]);
export const cloudProviderValidator = z.enum([
"AWS",
"GCP",
"Azure",
"Local",
"Hosted",
"UNKNOWN",
]);
export type CloudProvider = z.infer<typeof cloudProviderValidator>;
export type ClientCloudProvider = {
name: CloudProvider;
Expand All @@ -31,6 +38,12 @@ export type ClientCloudProvider = {
}
| {
kind: "Local";
}
| {
kind: "Hosted";
}
| {
kind: "UNKNOWN";
};
};
const awsRegionValidator = z.enum([
Expand Down Expand Up @@ -271,7 +284,7 @@ export const clusterValidator = z.object({
id: z.number(),
name: z.string(),
vanity_name: z.string(),
cloud_provider: cloudProviderValidator,
cloud_provider: z.string().pipe(cloudProviderValidator.catch("UNKNOWN")),
cloud_provider_credential_identifier: z.string(),
status: z.string(),
ingress_ip: z.string().optional().default(""),
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/lib/databases/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const datastoreValidator = z.object({
"DELETING_RECORD",
"DELETED",
]),
cloud_provider: cloudProviderValidator,
cloud_provider: z.string().pipe(cloudProviderValidator.catch("UNKNOWN")),
cloud_provider_credential_identifier: z.string(),
});

Expand Down

0 comments on commit 0573f1d

Please sign in to comment.