add capacityMode (#1826)

* add capacityMode

* add check for capacityMode for serverless
This commit is contained in:
sunghyunkang1111 2024-05-17 12:19:23 -05:00 committed by GitHub
parent ff4bc78d6c
commit 4da3363cf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View File

@ -90,6 +90,11 @@ export class CapabilityNames {
public static readonly EnableServerless: string = "EnableServerless";
}
export enum CapacityMode {
Provisioned = "Provisioned",
Serverless = "Serverless",
}
// flight names returned from the portal are always lowercase
export class Flights {
public static readonly SettingsV2 = "settingsv2";

View File

@ -1,4 +1,4 @@
import { ConnectionStatusType, ContainerStatusType } from "../Common/Constants";
import { CapacityMode, ConnectionStatusType, ContainerStatusType } from "../Common/Constants";
export interface ArmEntity {
id: string;
@ -35,6 +35,7 @@ export interface DatabaseAccountExtendedProperties {
ipRules?: IpRule[];
privateEndpointConnections?: unknown[];
capacity?: { totalThroughputLimit: number };
capacityMode?: CapacityMode;
locations?: DatabaseAccountResponseLocation[];
postgresqlEndpoint?: string;
publicNetworkAccess?: string;

View File

@ -9,4 +9,10 @@ export const isCapabilityEnabled = (capabilityName: string): boolean => {
return false;
};
export const isServerlessAccount = (): boolean => isCapabilityEnabled(Constants.CapabilityNames.EnableServerless);
export const isServerlessAccount = (): boolean => {
const { databaseAccount } = userContext;
return (
databaseAccount?.properties?.capacityMode === Constants.CapacityMode.Serverless ||
isCapabilityEnabled(Constants.CapabilityNames.EnableServerless)
);
};