Update throughput settings tab with new elasticity properties (#1461)

* Adding RU thermometer to settings throughput tab

* Finalizing RU thermometer on throughput settings

* Updated snapshot

* Fixing formatting

* Fixing lint errors

* Rerun prettier

* Fixing Offer properties

* Fixing Types

* Updating ARM clients, and enabling new elasticity properties

* Updating snapshots

* Updating an issue caused by updating ARM client

* Latest changes based on feedback

* Fixing lint and unit tests

* Minor fix

* Minor text change

* Changed some formatting
This commit is contained in:
vchske 2023-06-16 15:54:29 -07:00 committed by GitHub
parent a282ad9242
commit 4617fa9364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 2194 additions and 1091 deletions

View File

@ -212,7 +212,7 @@
"strict:find": "node ./strict-null-checks/find.js", "strict:find": "node ./strict-null-checks/find.js",
"strict:add": "node ./strict-null-checks/auto-add.js", "strict:add": "node ./strict-null-checks/auto-add.js",
"compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks", "compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks",
"generateARMClients": "npx ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts" "generateARMClients": "npx ts-node utils/armClientGenerator/generator.ts"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -96,6 +96,14 @@ const readCollectionOfferWithARM = async (databaseId: string, collectionId: stri
? parseInt(resource.minimumThroughput) ? parseInt(resource.minimumThroughput)
: resource.minimumThroughput; : resource.minimumThroughput;
const autoscaleSettings = resource.autoscaleSettings; const autoscaleSettings = resource.autoscaleSettings;
const instantMaximumThroughput: number =
typeof resource.instantMaximumThroughput === "string"
? parseInt(resource.instantMaximumThroughput)
: resource.instantMaximumThroughput;
const softAllowedMaximumThroughput: number =
typeof resource.softAllowedMaximumThroughput === "string"
? parseInt(resource.softAllowedMaximumThroughput)
: resource.softAllowedMaximumThroughput;
if (autoscaleSettings) { if (autoscaleSettings) {
return { return {
@ -104,6 +112,8 @@ const readCollectionOfferWithARM = async (databaseId: string, collectionId: stri
manualThroughput: undefined, manualThroughput: undefined,
minimumThroughput, minimumThroughput,
offerReplacePending: resource.offerReplacePending === "true", offerReplacePending: resource.offerReplacePending === "true",
instantMaximumThroughput,
softAllowedMaximumThroughput,
}; };
} }
@ -113,6 +123,8 @@ const readCollectionOfferWithARM = async (databaseId: string, collectionId: stri
manualThroughput: resource.throughput, manualThroughput: resource.throughput,
minimumThroughput, minimumThroughput,
offerReplacePending: resource.offerReplacePending === "true", offerReplacePending: resource.offerReplacePending === "true",
instantMaximumThroughput,
softAllowedMaximumThroughput,
}; };
} }

View File

@ -68,6 +68,14 @@ const readDatabaseOfferWithARM = async (databaseId: string): Promise<Offer> => {
? parseInt(resource.minimumThroughput) ? parseInt(resource.minimumThroughput)
: resource.minimumThroughput; : resource.minimumThroughput;
const autoscaleSettings = resource.autoscaleSettings; const autoscaleSettings = resource.autoscaleSettings;
const instantMaximumThroughput: number =
typeof resource.instantMaximumThroughput === "string"
? parseInt(resource.instantMaximumThroughput)
: resource.instantMaximumThroughput;
const softAllowedMaximumThroughput: number =
typeof resource.softAllowedMaximumThroughput === "string"
? parseInt(resource.softAllowedMaximumThroughput)
: resource.softAllowedMaximumThroughput;
if (autoscaleSettings) { if (autoscaleSettings) {
return { return {
@ -76,6 +84,8 @@ const readDatabaseOfferWithARM = async (databaseId: string): Promise<Offer> => {
manualThroughput: undefined, manualThroughput: undefined,
minimumThroughput, minimumThroughput,
offerReplacePending: resource.offerReplacePending === "true", offerReplacePending: resource.offerReplacePending === "true",
instantMaximumThroughput,
softAllowedMaximumThroughput,
}; };
} }
@ -85,6 +95,8 @@ const readDatabaseOfferWithARM = async (databaseId: string): Promise<Offer> => {
manualThroughput: resource.throughput, manualThroughput: resource.throughput,
minimumThroughput, minimumThroughput,
offerReplacePending: resource.offerReplacePending === "true", offerReplacePending: resource.offerReplacePending === "true",
instantMaximumThroughput,
softAllowedMaximumThroughput,
}; };
} }

View File

@ -1,8 +1,9 @@
import { Resource, StoredProcedureDefinition } from "@azure/cosmos"; import { Resource, StoredProcedureDefinition } from "@azure/cosmos";
import { CloudError, SqlStoredProcedureListResult } from "Utils/arm/generatedClients/cosmos/types";
import { AuthType } from "../../AuthType"; import { AuthType } from "../../AuthType";
import { userContext } from "../../UserContext"; import { userContext } from "../../UserContext";
import { listSqlStoredProcedures } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils";
import { listSqlStoredProcedures } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
import { client } from "../CosmosClient"; import { client } from "../CosmosClient";
import { handleError } from "../ErrorHandlingUtils"; import { handleError } from "../ErrorHandlingUtils";
@ -24,7 +25,13 @@ export async function readStoredProcedures(
databaseId, databaseId,
collectionId collectionId
); );
return rpResponse?.value?.map((sproc) => sproc.properties?.resource as StoredProcedureDefinition & Resource); const listResult = rpResponse as SqlStoredProcedureListResult;
if (listResult) {
return listResult?.value?.map((sproc) => sproc.properties?.resource as StoredProcedureDefinition & Resource);
}
const cloudError = rpResponse as CloudError;
throw new Error(cloudError?.error?.message);
} }
const response = await client() const response = await client()

View File

@ -242,6 +242,8 @@ export interface Offer {
minimumThroughput: number | undefined; minimumThroughput: number | undefined;
offerDefinition?: SDKOfferDefinition; offerDefinition?: SDKOfferDefinition;
offerReplacePending: boolean; offerReplacePending: boolean;
instantMaximumThroughput?: number;
softAllowedMaximumThroughput?: number;
} }
export interface SDKOfferDefinition extends Resource { export interface SDKOfferDefinition extends Resource {

View File

@ -1,46 +1,29 @@
import { shallow } from "enzyme"; import { shallow } from "enzyme";
import React from "react"; import React from "react";
import { IColumn, Text } from "@fluentui/react";
import { import {
getAutoPilotV3SpendElement,
getEstimatedSpendingElement,
manualToAutoscaleDisclaimerElement,
ttlWarning,
indexingPolicynUnsavedWarningMessage,
updateThroughputBeyondLimitWarningMessage,
updateThroughputDelayedApplyWarningMessage,
getThroughputApplyDelayedMessage,
getThroughputApplyShortDelayMessage,
getThroughputApplyLongDelayMessage,
getToolTipContainer,
conflictResolutionCustomToolTip,
changeFeedPolicyToolTip,
conflictResolutionLwwTooltip,
mongoIndexingPolicyDisclaimer,
mongoIndexingPolicyAADError,
mongoIndexTransformationRefreshingMessage,
renderMongoIndexTransformationRefreshMessage,
ManualEstimatedSpendingDisplayProps,
PriceBreakdown, PriceBreakdown,
changeFeedPolicyToolTip,
conflictResolutionCustomToolTip,
conflictResolutionLwwTooltip,
getEstimatedSpendingElement,
getRuPriceBreakdown, getRuPriceBreakdown,
getThroughputApplyDelayedMessage,
getThroughputApplyLongDelayMessage,
getThroughputApplyShortDelayMessage,
getToolTipContainer,
indexingPolicynUnsavedWarningMessage,
manualToAutoscaleDisclaimerElement,
mongoIndexTransformationRefreshingMessage,
mongoIndexingPolicyAADError,
mongoIndexingPolicyDisclaimer,
renderMongoIndexTransformationRefreshMessage,
ttlWarning,
updateThroughputDelayedApplyWarningMessage,
} from "./SettingsRenderUtils"; } from "./SettingsRenderUtils";
class SettingsRenderUtilsTestComponent extends React.Component { class SettingsRenderUtilsTestComponent extends React.Component {
public render(): JSX.Element { public render(): JSX.Element {
const estimatedSpendingColumns: IColumn[] = [ const costElement: JSX.Element = <></>;
{ key: "costType", name: "", fieldName: "costType", minWidth: 100, maxWidth: 200, isResizable: true },
{ key: "hourly", name: "Hourly", fieldName: "hourly", minWidth: 100, maxWidth: 200, isResizable: true },
{ key: "daily", name: "Daily", fieldName: "daily", minWidth: 100, maxWidth: 200, isResizable: true },
{ key: "monthly", name: "Monthly", fieldName: "monthly", minWidth: 100, maxWidth: 200, isResizable: true },
];
const estimatedSpendingItems: ManualEstimatedSpendingDisplayProps[] = [
{
costType: <Text>Current Cost</Text>,
hourly: <Text>$ 1.02</Text>,
daily: <Text>$ 24.48</Text>,
monthly: <Text>$ 744.6</Text>,
},
];
const priceBreakdown: PriceBreakdown = { const priceBreakdown: PriceBreakdown = {
hourlyPrice: 1.02, hourlyPrice: 1.02,
dailyPrice: 24.48, dailyPrice: 24.48,
@ -52,17 +35,11 @@ class SettingsRenderUtilsTestComponent extends React.Component {
return ( return (
<> <>
{getAutoPilotV3SpendElement(1000, false)} {getEstimatedSpendingElement(costElement, 1000, 2, priceBreakdown, false)}
{getAutoPilotV3SpendElement(undefined, false)}
{getAutoPilotV3SpendElement(1000, true)}
{getAutoPilotV3SpendElement(undefined, true)}
{getEstimatedSpendingElement(estimatedSpendingColumns, estimatedSpendingItems, 1000, 2, priceBreakdown, false)}
{manualToAutoscaleDisclaimerElement} {manualToAutoscaleDisclaimerElement}
{ttlWarning} {ttlWarning}
{indexingPolicynUnsavedWarningMessage} {indexingPolicynUnsavedWarningMessage}
{updateThroughputBeyondLimitWarningMessage}
{updateThroughputDelayedApplyWarningMessage} {updateThroughputDelayedApplyWarningMessage}
{getThroughputApplyDelayedMessage(false, 1000, "RU/s", "sampleDb", "sampleCollection", 2000)} {getThroughputApplyDelayedMessage(false, 1000, "RU/s", "sampleDb", "sampleCollection", 2000)}

View File

@ -1,10 +1,7 @@
import { import {
DetailsList,
DetailsListLayoutMode,
DetailsRow, DetailsRow,
ICheckboxStyles, ICheckboxStyles,
IChoiceGroupStyles, IChoiceGroupStyles,
IColumn,
IDetailsColumnStyles, IDetailsColumnStyles,
IDetailsListStyles, IDetailsListStyles,
IDetailsRowProps, IDetailsRowProps,
@ -20,7 +17,6 @@ import {
Link, Link,
MessageBar, MessageBar,
MessageBarType, MessageBarType,
SelectionMode,
Spinner, Spinner,
SpinnerSize, SpinnerSize,
Stack, Stack,
@ -28,8 +24,7 @@ import {
} from "@fluentui/react"; } from "@fluentui/react";
import * as React from "react"; import * as React from "react";
import { StyleConstants, Urls } from "../../../Common/Constants"; import { StyleConstants, Urls } from "../../../Common/Constants";
import { AutopilotDocumentation, hoursInAMonth } from "../../../Shared/Constants"; import { hoursInAMonth } from "../../../Shared/Constants";
import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils";
import { import {
computeRUUsagePriceHourly, computeRUUsagePriceHourly,
estimatedCostDisclaimer, estimatedCostDisclaimer,
@ -103,6 +98,10 @@ export const checkBoxAndInputStackProps: Partial<IStackProps> = {
tokens: { childrenGap: 10 }, tokens: { childrenGap: 10 },
}; };
export const relaxedSpacingStackProps: Partial<IStackProps> = {
tokens: { childrenGap: 20 },
};
export const toolTipLabelStackTokens: IStackTokens = { export const toolTipLabelStackTokens: IStackTokens = {
childrenGap: 6, childrenGap: 6,
}; };
@ -174,41 +173,6 @@ export function onRenderRow(props: IDetailsRowProps): JSX.Element {
return <DetailsRow {...props} styles={transparentDetailsRowStyles} />; return <DetailsRow {...props} styles={transparentDetailsRowStyles} />;
} }
export const getAutoPilotV3SpendElement = (
maxAutoPilotThroughputSet: number,
isDatabaseThroughput: boolean,
requestUnitsUsageCostElement?: JSX.Element
): JSX.Element => {
if (!maxAutoPilotThroughputSet) {
return <></>;
}
const resource: string = isDatabaseThroughput ? "database" : "container";
return (
<>
<Text>
Your {resource} throughput will automatically scale from{" "}
<b>
{AutoPilotUtils.getMinRUsBasedOnUserInput(maxAutoPilotThroughputSet)} RU/s (10% of max RU/s) -{" "}
{maxAutoPilotThroughputSet} RU/s
</b>{" "}
based on usage.
<br />
</Text>
{requestUnitsUsageCostElement}
<Text>
After the first {AutoPilotUtils.getStorageBasedOnUserInput(maxAutoPilotThroughputSet)} GB of data stored, the
max RU/s will be automatically upgraded based on the new storage value.
<Link href={AutopilotDocumentation.Url} target="_blank">
{" "}
Learn more
</Link>
.
</Text>
</>
);
};
export const getRuPriceBreakdown = ( export const getRuPriceBreakdown = (
throughput: number, throughput: number,
serverId: string, serverId: string,
@ -238,8 +202,7 @@ export const getRuPriceBreakdown = (
}; };
export const getEstimatedSpendingElement = ( export const getEstimatedSpendingElement = (
estimatedSpendingColumns: IColumn[], costElement: JSX.Element,
estimatedSpendingItems: EstimatedSpendingDisplayProps[],
throughput: number, throughput: number,
numberOfRegions: number, numberOfRegions: number,
priceBreakdown: PriceBreakdown, priceBreakdown: PriceBreakdown,
@ -247,22 +210,25 @@ export const getEstimatedSpendingElement = (
): JSX.Element => { ): JSX.Element => {
const ruRange: string = isAutoscale ? throughput / 10 + " RU/s - " : ""; const ruRange: string = isAutoscale ? throughput / 10 + " RU/s - " : "";
return ( return (
<Stack {...addMongoIndexStackProps} styles={mediumWidthStackStyles}> <Stack>
<DetailsList <Text style={{ fontWeight: 600 }}>Cost estimate*</Text>
disableSelectionZone {costElement}
items={estimatedSpendingItems} <Text style={{ fontWeight: 600, marginTop: 15 }}>How we calculate this</Text>
columns={estimatedSpendingColumns} <Stack id="throughputSpendElement" style={{ marginTop: 5 }}>
selectionMode={SelectionMode.none} <span>
layoutMode={DetailsListLayoutMode.justified} {numberOfRegions} region{numberOfRegions > 1 && <span>s</span>}
onRenderRow={onRenderRow} </span>
/> <span>
<Text id="throughputSpendElement"> {ruRange}
({"regions: "} {numberOfRegions}, {ruRange} {throughput} RU/s
{throughput} RU/s, {priceBreakdown.currencySign} </span>
{priceBreakdown.pricePerRu}/RU) <span>
</Text> {priceBreakdown.currencySign}
<Text> {priceBreakdown.pricePerRu}/RU
<em>{estimatedCostDisclaimer}</em> </span>
</Stack>
<Text style={{ marginTop: 15 }}>
<em>*{estimatedCostDisclaimer}</em>
</Text> </Text>
</Stack> </Stack>
); );
@ -293,14 +259,6 @@ export const indexingPolicynUnsavedWarningMessage: JSX.Element = (
</Text> </Text>
); );
export const updateThroughputBeyondLimitWarningMessage: JSX.Element = (
<Text styles={infoAndToolTipTextStyle} id="updateThroughputBeyondLimitWarningMessage">
You are about to request an increase in throughput beyond the pre-allocated capacity. The service will scale out and
increase throughput for the selected container. This operation will take 1-3 business days to complete. You can
track the status of this request in Notifications.
</Text>
);
export const updateThroughputDelayedApplyWarningMessage: JSX.Element = ( export const updateThroughputDelayedApplyWarningMessage: JSX.Element = (
<Text styles={infoAndToolTipTextStyle} id="updateThroughputDelayedApplyWarningMessage"> <Text styles={infoAndToolTipTextStyle} id="updateThroughputDelayedApplyWarningMessage">
You are about to request an increase in throughput beyond the pre-allocated capacity. This operation will take some You are about to request an increase in throughput beyond the pre-allocated capacity. This operation will take some
@ -308,6 +266,61 @@ export const updateThroughputDelayedApplyWarningMessage: JSX.Element = (
</Text> </Text>
); );
export const getUpdateThroughputBeyondInstantLimitMessage = (instantMaximumThroughput: number): JSX.Element => {
return (
<Text styles={infoAndToolTipTextStyle} id="updateThroughputDelayedApplyWarningMessage">
Scaling up will take 4-6 hours as it exceeds what Azure Cosmos DB can instantly support currently based on your
number of physical partitions. You can increase your throughput to {instantMaximumThroughput} instantly or proceed
with this value and wait until the scale-up is completed.
</Text>
);
};
export const getUpdateThroughputBeyondSupportLimitMessage = (
instantMaximumThroughput: number,
maximumThroughput: number
): JSX.Element => {
return (
<>
<Text styles={infoAndToolTipTextStyle} id="updateThroughputDelayedApplyWarningMessage">
Your request to increase throughput exceeds the pre-allocated capacity which may take longer than expected.
There are three options you can choose from to proceed:
</Text>
<ol style={{ fontSize: 14, color: "windowtext", marginTop: "5px" }}>
<li>You can instantly scale up to {instantMaximumThroughput} RU/s.</li>
{instantMaximumThroughput < maximumThroughput && (
<li>You can asynchronously scale up to any value under {maximumThroughput} RU/s in 4-6 hours.</li>
)}
<li>
Your current quota max is {maximumThroughput} RU/s. To go over this limit, you must request a quota increase
and the Azure Cosmos DB team will review.
<Link
href="https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/create-support-request-quota-increase"
target="_blank"
>
Learn more
</Link>
</li>
</ol>
</>
);
};
export const getUpdateThroughputBelowMinimumMessage = (minimum: number): JSX.Element => {
return (
<Text styles={infoAndToolTipTextStyle}>
You are not able to lower throughput below your current minimum of {minimum} RU/s. For more information on this
limit, please refer to our service quote documentation.
<Link
href="https://learn.microsoft.com/en-us/azure/cosmos-db/concepts-limits#minimum-throughput-limits"
target="_blank"
>
Learn more
</Link>
</Text>
);
};
export const saveThroughputWarningMessage: JSX.Element = ( export const saveThroughputWarningMessage: JSX.Element = (
<Text styles={infoAndToolTipTextStyle}> <Text styles={infoAndToolTipTextStyle}>
Your bill will be affected as you update your throughput settings. Please review the updated cost estimate below Your bill will be affected as you update your throughput settings. Please review the updated cost estimate below
@ -499,7 +512,11 @@ export const getTextFieldStyles = (current: isDirtyTypes, baseline: isDirtyTypes
}, },
}); });
export const getChoiceGroupStyles = (current: isDirtyTypes, baseline: isDirtyTypes): Partial<IChoiceGroupStyles> => ({ export const getChoiceGroupStyles = (
current: isDirtyTypes,
baseline: isDirtyTypes,
isHorizontal?: boolean
): Partial<IChoiceGroupStyles> => ({
flexContainer: [ flexContainer: [
{ {
selectors: { selectors: {
@ -516,6 +533,8 @@ export const getChoiceGroupStyles = (current: isDirtyTypes, baseline: isDirtyTyp
padding: "2px 5px", padding: "2px 5px",
}, },
}, },
display: isHorizontal ? "inline-flex" : "default",
columnGap: isHorizontal ? "30px" : "default",
}, },
], ],
}); });

View File

@ -3,7 +3,6 @@ import ko from "knockout";
import React from "react"; import React from "react";
import * as Constants from "../../../../Common/Constants"; import * as Constants from "../../../../Common/Constants";
import * as DataModels from "../../../../Contracts/DataModels"; import * as DataModels from "../../../../Contracts/DataModels";
import * as SharedConstants from "../../../../Shared/Constants";
import { updateUserContext } from "../../../../UserContext"; import { updateUserContext } from "../../../../UserContext";
import Explorer from "../../../Explorer"; import Explorer from "../../../Explorer";
import { throughputUnit } from "../SettingsRenderUtils"; import { throughputUnit } from "../SettingsRenderUtils";
@ -12,7 +11,6 @@ import { ScaleComponent, ScaleComponentProps } from "./ScaleComponent";
import { ThroughputInputAutoPilotV3Component } from "./ThroughputInputComponents/ThroughputInputAutoPilotV3Component"; import { ThroughputInputAutoPilotV3Component } from "./ThroughputInputComponents/ThroughputInputAutoPilotV3Component";
describe("ScaleComponent", () => { describe("ScaleComponent", () => {
const nonNationalCloudContainer = new Explorer();
const targetThroughput = 6000; const targetThroughput = 6000;
const baseProps: ScaleComponentProps = { const baseProps: ScaleComponentProps = {
@ -125,11 +123,4 @@ describe("ScaleComponent", () => {
scaleComponent = new ScaleComponent(newProps); scaleComponent = new ScaleComponent(newProps);
expect(scaleComponent.canThroughputExceedMaximumValue()).toEqual(true); expect(scaleComponent.canThroughputExceedMaximumValue()).toEqual(true);
}); });
it("getThroughputWarningMessage", () => {
const throughputBeyondLimit = SharedConstants.CollectionCreation.DefaultCollectionRUs1Million + 1000;
const newProps = { ...baseProps, container: nonNationalCloudContainer, throughput: throughputBeyondLimit };
const scaleComponent = new ScaleComponent(newProps);
expect(scaleComponent.getThroughputWarningMessage().props.id).toEqual("updateThroughputBeyondLimitWarningMessage");
});
}); });

View File

@ -1,7 +1,7 @@
import { Label, Link, MessageBar, MessageBarType, Stack, Text, TextField } from "@fluentui/react"; import { Link, MessageBar, MessageBarType, Stack, Text, TextField } from "@fluentui/react";
import * as React from "react"; import * as React from "react";
import * as Constants from "../../../../Common/Constants"; import * as Constants from "../../../../Common/Constants";
import { configContext, Platform } from "../../../../ConfigContext"; import { Platform, configContext } from "../../../../ConfigContext";
import * as DataModels from "../../../../Contracts/DataModels"; import * as DataModels from "../../../../Contracts/DataModels";
import * as ViewModels from "../../../../Contracts/ViewModels"; import * as ViewModels from "../../../../Contracts/ViewModels";
import * as SharedConstants from "../../../../Shared/Constants"; import * as SharedConstants from "../../../../Shared/Constants";
@ -15,7 +15,6 @@ import {
subComponentStackProps, subComponentStackProps,
throughputUnit, throughputUnit,
titleAndInputStackProps, titleAndInputStackProps,
updateThroughputBeyondLimitWarningMessage,
} from "../SettingsRenderUtils"; } from "../SettingsRenderUtils";
import { hasDatabaseSharedThroughput } from "../SettingsUtils"; import { hasDatabaseSharedThroughput } from "../SettingsUtils";
import { ThroughputInputAutoPilotV3Component } from "./ThroughputInputComponents/ThroughputInputAutoPilotV3Component"; import { ThroughputInputAutoPilotV3Component } from "./ThroughputInputComponents/ThroughputInputAutoPilotV3Component";
@ -68,16 +67,6 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
return !!enableAutoScaleCapability; return !!enableAutoScaleCapability;
}; };
private getStorageCapacityTitle = (): JSX.Element => {
const capacity: string = this.props.isFixedContainer ? "Fixed" : "Unlimited";
return (
<Stack {...titleAndInputStackProps}>
<Label>Storage capacity</Label>
<Text>{capacity}</Text>
</Stack>
);
};
public getMaxRUs = (): number => { public getMaxRUs = (): number => {
if (userContext.isTryCosmosDBSubscription) { if (userContext.isTryCosmosDBSubscription) {
return Constants.TryCosmosExperience.maxRU; return Constants.TryCosmosExperience.maxRU;
@ -131,18 +120,6 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
return undefined; return undefined;
}; };
public getThroughputWarningMessage = (): JSX.Element => {
const throughputExceedsBackendLimits: boolean =
this.canThroughputExceedMaximumValue() &&
this.props.throughput > SharedConstants.CollectionCreation.DefaultCollectionRUs1Million;
if (throughputExceedsBackendLimits && !this.props.isFixedContainer) {
return updateThroughputBeyondLimitWarningMessage;
}
return undefined;
};
public getLongDelayMessage = (): JSX.Element => { public getLongDelayMessage = (): JSX.Element => {
const matches: string[] = this.props.initialNotification?.description.match( const matches: string[] = this.props.initialNotification?.description.match(
`Throughput update for (.*) ${throughputUnit}` `Throughput update for (.*) ${throughputUnit}`
@ -188,9 +165,10 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
spendAckChecked={false} spendAckChecked={false}
onScaleSaveableChange={this.props.onScaleSaveableChange} onScaleSaveableChange={this.props.onScaleSaveableChange}
onScaleDiscardableChange={this.props.onScaleDiscardableChange} onScaleDiscardableChange={this.props.onScaleDiscardableChange}
getThroughputWarningMessage={this.getThroughputWarningMessage}
usageSizeInKB={this.props.collection?.usageSizeInKB()} usageSizeInKB={this.props.collection?.usageSizeInKB()}
throughputError={this.props.throughputError} throughputError={this.props.throughputError}
instantMaximumThroughput={this.offer?.instantMaximumThroughput}
softAllowedMaximumThroughput={this.offer?.softAllowedMaximumThroughput}
/> />
); );
@ -229,12 +207,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
{this.getInitialNotificationElement() && ( {this.getInitialNotificationElement() && (
<MessageBar messageBarType={MessageBarType.warning}>{this.getInitialNotificationElement()}</MessageBar> <MessageBar messageBarType={MessageBarType.warning}>{this.getInitialNotificationElement()}</MessageBar>
)} )}
{!this.isAutoScaleEnabled() && ( {!this.isAutoScaleEnabled() && <Stack {...subComponentStackProps}>{this.getThroughputInputComponent()}</Stack>}
<Stack {...subComponentStackProps}>
{this.getThroughputInputComponent()}
{!this.props.database && this.getStorageCapacityTitle()}
</Stack>
)}
{/* TODO: Replace link with call to the Azure Support blade */} {/* TODO: Replace link with call to the Azure Support blade */}
{this.isAutoScaleEnabled() && ( {this.isAutoScaleEnabled() && (

View File

@ -42,7 +42,8 @@ describe("ThroughputInputAutoPilotV3Component", () => {
onScaleDiscardableChange: () => { onScaleDiscardableChange: () => {
return; return;
}, },
getThroughputWarningMessage: () => undefined, instantMaximumThroughput: 5000,
softAllowedMaximumThroughput: 1000000,
}; };
it("throughput input visible", () => { it("throughput input visible", () => {

View File

@ -3,10 +3,14 @@ import {
ChoiceGroup, ChoiceGroup,
FontIcon, FontIcon,
IChoiceGroupOption, IChoiceGroupOption,
IColumn, IProgressIndicatorStyles,
ISeparatorStyles,
Label, Label,
Link, Link,
MessageBar, MessageBar,
MessageBarType,
ProgressIndicator,
Separator,
Stack, Stack,
Text, Text,
TextField, TextField,
@ -23,24 +27,24 @@ import { autoPilotThroughput1K } from "../../../../../Utils/AutoPilotUtils";
import { calculateEstimateNumber, usageInGB } from "../../../../../Utils/PricingUtils"; import { calculateEstimateNumber, usageInGB } from "../../../../../Utils/PricingUtils";
import { Int32 } from "../../../../Panes/Tables/Validators/EntityPropertyValidationCommon"; import { Int32 } from "../../../../Panes/Tables/Validators/EntityPropertyValidationCommon";
import { import {
AutoscaleEstimatedSpendingDisplayProps, PriceBreakdown,
checkBoxAndInputStackProps, checkBoxAndInputStackProps,
getAutoPilotV3SpendElement,
getChoiceGroupStyles, getChoiceGroupStyles,
getEstimatedSpendingElement, getEstimatedSpendingElement,
getRuPriceBreakdown, getRuPriceBreakdown,
getTextFieldStyles, getTextFieldStyles,
getToolTipContainer, getToolTipContainer,
ManualEstimatedSpendingDisplayProps, getUpdateThroughputBelowMinimumMessage,
getUpdateThroughputBeyondInstantLimitMessage,
getUpdateThroughputBeyondSupportLimitMessage,
manualToAutoscaleDisclaimerElement, manualToAutoscaleDisclaimerElement,
messageBarStyles, messageBarStyles,
noLeftPaddingCheckBoxStyle, noLeftPaddingCheckBoxStyle,
PriceBreakdown, relaxedSpacingStackProps,
saveThroughputWarningMessage, saveThroughputWarningMessage,
titleAndInputStackProps, titleAndInputStackProps,
transparentDetailsHeaderStyle,
} from "../../SettingsRenderUtils"; } from "../../SettingsRenderUtils";
import { getSanitizedInputValue, IsComponentDirtyResult, isDirty } from "../../SettingsUtils"; import { IsComponentDirtyResult, getSanitizedInputValue, isDirty } from "../../SettingsUtils";
import { ToolTipLabelComponent } from "../ToolTipLabelComponent"; import { ToolTipLabelComponent } from "../ToolTipLabelComponent";
export interface ThroughputInputAutoPilotV3Props { export interface ThroughputInputAutoPilotV3Props {
@ -73,9 +77,10 @@ export interface ThroughputInputAutoPilotV3Props {
onMaxAutoPilotThroughputChange: (newThroughput: number) => void; onMaxAutoPilotThroughputChange: (newThroughput: number) => void;
onScaleSaveableChange: (isScaleSaveable: boolean) => void; onScaleSaveableChange: (isScaleSaveable: boolean) => void;
onScaleDiscardableChange: (isScaleDiscardable: boolean) => void; onScaleDiscardableChange: (isScaleDiscardable: boolean) => void;
getThroughputWarningMessage: () => JSX.Element;
usageSizeInKB: number; usageSizeInKB: number;
throughputError?: string; throughputError?: string;
instantMaximumThroughput: number;
softAllowedMaximumThroughput: number;
} }
interface ThroughputInputAutoPilotV3State { interface ThroughputInputAutoPilotV3State {
@ -127,7 +132,10 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
} else if (this.props.isAutoPilotSelected) { } else if (this.props.isAutoPilotSelected) {
if (isDirty(this.props.maxAutoPilotThroughput, this.props.maxAutoPilotThroughputBaseline)) { if (isDirty(this.props.maxAutoPilotThroughput, this.props.maxAutoPilotThroughputBaseline)) {
isDiscardable = true; isDiscardable = true;
if (AutoPilotUtils.isValidAutoPilotThroughput(this.props.maxAutoPilotThroughput)) { if (
this.props.maxAutoPilotThroughput <= this.props.softAllowedMaximumThroughput &&
AutoPilotUtils.isValidAutoPilotThroughput(this.props.maxAutoPilotThroughput)
) {
isSaveable = true; isSaveable = true;
} }
} }
@ -186,7 +194,15 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
let estimatedSpend: JSX.Element; let estimatedSpend: JSX.Element;
if (!this.props.isAutoPilotSelected) { if (this.props.isAutoPilotSelected) {
estimatedSpend = this.getEstimatedAutoscaleSpendElement(
this.props.maxAutoPilotThroughputBaseline,
userContext.portalEnv,
regions,
multimaster,
isDirty ? this.props.maxAutoPilotThroughput : undefined
);
} else {
estimatedSpend = this.getEstimatedManualSpendElement( estimatedSpend = this.getEstimatedManualSpendElement(
// if migrating from autoscale to manual, we use the autoscale RUs value as that is what will be set... // if migrating from autoscale to manual, we use the autoscale RUs value as that is what will be set...
this.overrideWithAutoPilotSettings() ? this.props.maxAutoPilotThroughput : this.props.throughputBaseline, this.overrideWithAutoPilotSettings() ? this.props.maxAutoPilotThroughput : this.props.throughputBaseline,
@ -195,14 +211,6 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
multimaster, multimaster,
isDirty ? this.props.throughput : undefined isDirty ? this.props.throughput : undefined
); );
} else {
estimatedSpend = this.getEstimatedAutoscaleSpendElement(
this.props.maxAutoPilotThroughputBaseline,
userContext.portalEnv,
regions,
multimaster,
isDirty ? this.props.maxAutoPilotThroughput : undefined
);
} }
return estimatedSpend; return estimatedSpend;
}; };
@ -215,52 +223,8 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
newThroughput?: number newThroughput?: number
): JSX.Element => { ): JSX.Element => {
const prices: PriceBreakdown = getRuPriceBreakdown(throughput, serverId, numberOfRegions, isMultimaster, true); const prices: PriceBreakdown = getRuPriceBreakdown(throughput, serverId, numberOfRegions, isMultimaster, true);
const estimatedSpendingColumns: IColumn[] = [
{
key: "costType",
name: "",
fieldName: "costType",
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle,
},
{
key: "minPerMonth",
name: "Min Per Month",
fieldName: "minPerMonth",
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle,
},
{
key: "maxPerMonth",
name: "Max Per Month",
fieldName: "maxPerMonth",
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle,
},
];
const estimatedSpendingItems: AutoscaleEstimatedSpendingDisplayProps[] = [
{
costType: <Text>Current Cost</Text>,
minPerMonth: (
<Text>
{prices.currencySign} {calculateEstimateNumber(prices.monthlyPrice / 10)}
</Text>
),
maxPerMonth: (
<Text>
{prices.currencySign} {calculateEstimateNumber(prices.monthlyPrice)}
</Text>
),
},
];
if (newThroughput) { const newThroughputCostElement = (): JSX.Element => {
const newPrices: PriceBreakdown = getRuPriceBreakdown( const newPrices: PriceBreakdown = getRuPriceBreakdown(
newThroughput, newThroughput,
serverId, serverId,
@ -268,37 +232,40 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
isMultimaster, isMultimaster,
true true
); );
estimatedSpendingItems.unshift({ return (
costType: ( <div>
<Text> <Text style={{ fontWeight: 600 }}>Updated cost per month</Text>
<b>Updated Cost</b> <Stack horizontal style={{ marginTop: 5, marginBottom: 10 }}>
</Text> <Text style={{ width: "50%" }}>
), {newPrices.currencySign} {calculateEstimateNumber(newPrices.monthlyPrice / 10)} min
minPerMonth: ( </Text>
<Text> <Text style={{ width: "50%" }}>
<b> {newPrices.currencySign} {calculateEstimateNumber(newPrices.monthlyPrice)} max
{newPrices.currencySign} {calculateEstimateNumber(newPrices.monthlyPrice / 10)} </Text>
</b> </Stack>
</Text> </div>
), );
maxPerMonth: ( };
<Text>
<b>
{newPrices.currencySign} {calculateEstimateNumber(newPrices.monthlyPrice)}
</b>
</Text>
),
});
}
return getEstimatedSpendingElement( const costElement = (): JSX.Element => {
estimatedSpendingColumns, const prices: PriceBreakdown = getRuPriceBreakdown(throughput, serverId, numberOfRegions, isMultimaster, true);
estimatedSpendingItems, return (
newThroughput ?? throughput, <Stack {...checkBoxAndInputStackProps} style={{ marginTop: 15 }}>
numberOfRegions, {newThroughput && newThroughputCostElement()}
prices, <Text style={{ fontWeight: 600 }}>Current cost per month</Text>
true <Stack horizontal style={{ marginTop: 5 }}>
); <Text style={{ width: "50%" }}>
{prices.currencySign} {calculateEstimateNumber(prices.monthlyPrice / 10)} min
</Text>
<Text style={{ width: "50%" }}>
{prices.currencySign} {calculateEstimateNumber(prices.monthlyPrice)} max
</Text>
</Stack>
</Stack>
);
};
return getEstimatedSpendingElement(costElement(), newThroughput ?? throughput, numberOfRegions, prices, true);
}; };
private getEstimatedManualSpendElement = ( private getEstimatedManualSpendElement = (
@ -309,122 +276,55 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
newThroughput?: number newThroughput?: number
): JSX.Element => { ): JSX.Element => {
const prices: PriceBreakdown = getRuPriceBreakdown(throughput, serverId, numberOfRegions, isMultimaster, false); const prices: PriceBreakdown = getRuPriceBreakdown(throughput, serverId, numberOfRegions, isMultimaster, false);
const estimatedSpendingColumns: IColumn[] = [
{
key: "costType",
name: "",
fieldName: "costType",
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle,
},
{
key: "hourly",
name: "Hourly",
fieldName: "hourly",
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle,
},
{
key: "daily",
name: "Daily",
fieldName: "daily",
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle,
},
{
key: "monthly",
name: "Monthly",
fieldName: "monthly",
minWidth: 100,
maxWidth: 200,
isResizable: true,
styles: transparentDetailsHeaderStyle,
},
];
const estimatedSpendingItems: ManualEstimatedSpendingDisplayProps[] = [
{
costType: <Text>Current Cost</Text>,
hourly: (
<Text>
{prices.currencySign} {calculateEstimateNumber(prices.hourlyPrice)}
</Text>
),
daily: (
<Text>
{prices.currencySign} {calculateEstimateNumber(prices.dailyPrice)}
</Text>
),
monthly: (
<Text>
{prices.currencySign} {calculateEstimateNumber(prices.monthlyPrice)}
</Text>
),
},
];
if (newThroughput) { const newThroughputCostElement = (): JSX.Element => {
const newPrices: PriceBreakdown = getRuPriceBreakdown( const newPrices: PriceBreakdown = getRuPriceBreakdown(
newThroughput, newThroughput,
serverId, serverId,
numberOfRegions, numberOfRegions,
isMultimaster, isMultimaster,
false true
); );
estimatedSpendingItems.unshift({ return (
costType: ( <div>
<Text> <Text style={{ fontWeight: 600 }}>Updated cost per month</Text>
<b>Updated Cost</b> <Stack horizontal style={{ marginTop: 5, marginBottom: 10 }}>
</Text> <Text style={{ width: "33%" }}>
), {newPrices.currencySign} {calculateEstimateNumber(newPrices.hourlyPrice)}/hr
hourly: ( </Text>
<Text> <Text style={{ width: "33%" }}>
<b> {newPrices.currencySign} {calculateEstimateNumber(newPrices.dailyPrice)}/day
{newPrices.currencySign} {calculateEstimateNumber(newPrices.hourlyPrice)} </Text>
</b> <Text style={{ width: "33%" }}>
</Text> {newPrices.currencySign} {calculateEstimateNumber(newPrices.monthlyPrice)}/mo
), </Text>
daily: ( </Stack>
<Text> </div>
<b> );
{newPrices.currencySign} {calculateEstimateNumber(newPrices.dailyPrice)} };
</b>
</Text>
),
monthly: (
<Text>
<b>
{newPrices.currencySign} {calculateEstimateNumber(newPrices.monthlyPrice)}
</b>
</Text>
),
});
}
return getEstimatedSpendingElement( const costElement = (): JSX.Element => {
estimatedSpendingColumns, const prices: PriceBreakdown = getRuPriceBreakdown(throughput, serverId, numberOfRegions, isMultimaster, true);
estimatedSpendingItems, return (
newThroughput ?? throughput, <Stack {...checkBoxAndInputStackProps} style={{ marginTop: 15 }}>
numberOfRegions, {newThroughput && newThroughputCostElement()}
prices, <Text style={{ fontWeight: 600 }}>Current cost per month</Text>
false <Stack horizontal style={{ marginTop: 5 }}>
); <Text style={{ width: "33%" }}>
}; {prices.currencySign} {calculateEstimateNumber(prices.hourlyPrice)}/hr
</Text>
<Text style={{ width: "33%" }}>
{prices.currencySign} {calculateEstimateNumber(prices.dailyPrice)}/day
</Text>
<Text style={{ width: "33%" }}>
{prices.currencySign} {calculateEstimateNumber(prices.monthlyPrice)}/mo
</Text>
</Stack>
</Stack>
);
};
private getAutoPilotUsageCost = (): JSX.Element => { return getEstimatedSpendingElement(costElement(), newThroughput ?? throughput, numberOfRegions, prices, false);
if (!this.props.maxAutoPilotThroughput) {
return <></>;
}
return getAutoPilotV3SpendElement(
this.props.maxAutoPilotThroughput,
false /* isDatabaseThroughput */,
!this.props.isEmulator ? this.getRequestUnitsUsageCost() : <></>
);
}; };
private onAutoPilotThroughputChange = ( private onAutoPilotThroughputChange = (
@ -511,7 +411,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
onChange={this.onChoiceGroupChange} onChange={this.onChoiceGroupChange}
required={this.props.showAsMandatory} required={this.props.showAsMandatory}
ariaLabelledBy={labelId} ariaLabelledBy={labelId}
styles={getChoiceGroupStyles(this.props.wasAutopilotOriginallySet, this.props.isAutoPilotSelected)} styles={getChoiceGroupStyles(this.props.wasAutopilotOriginallySet, this.props.isAutoPilotSelected, true)}
/> />
</Stack> </Stack>
); );
@ -520,97 +420,266 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
private onSpendAckChecked = (ev?: React.FormEvent<HTMLElement | HTMLInputElement>, checked?: boolean): void => private onSpendAckChecked = (ev?: React.FormEvent<HTMLElement | HTMLInputElement>, checked?: boolean): void =>
this.setState({ spendAckChecked: checked }); this.setState({ spendAckChecked: checked });
private renderAutoPilotInput = (): JSX.Element => ( private getStorageCapacityTitle = (): JSX.Element => {
<> const capacity: string = this.props.isFixed ? "Fixed" : "Unlimited";
<Text> return (
Provision maximum RU/s required by this resource. Estimate your required RU/s with <Stack {...titleAndInputStackProps}>
<Link target="_blank" href="https://cosmos.azure.com/capacitycalculator/"> <Label>Storage capacity</Label>
{` capacity calculator`} <Text>{capacity}</Text>
</Link> </Stack>
</Text> );
<TextField };
label="Max RU/s"
required private thoughputRangeSeparatorStyles: Partial<ISeparatorStyles> = {
type="number" root: [
id="autopilotInput" {
key="auto pilot throughput input" selectors: {
styles={getTextFieldStyles(this.props.maxAutoPilotThroughput, this.props.maxAutoPilotThroughputBaseline)} "::before": {
disabled={this.overrideWithProvisionedThroughputSettings()} backgroundColor: "rgb(200, 200, 200)",
step={AutoPilotUtils.autoPilotIncrementStep} height: "3px",
value={this.overrideWithProvisionedThroughputSettings() ? "" : this.props.maxAutoPilotThroughput?.toString()} marginTop: "-1px",
onChange={this.onAutoPilotThroughputChange} },
min={autoPilotThroughput1K} },
errorMessage={this.props.throughputError} },
],
};
private currentThroughputValue = (): number => {
return this.props.isAutoPilotSelected
? this.props.maxAutoPilotThroughput
: this.overrideWithAutoPilotSettings()
? this.props.maxAutoPilotThroughputBaseline
: this.props.throughput;
};
private getCurrentRuRange = (): "below" | "instant" | "delayed" | "requireSupport" => {
if (this.currentThroughputValue() < this.props.minimum) {
return "below";
}
if (
this.currentThroughputValue() >= this.props.minimum &&
this.currentThroughputValue() <= this.props.instantMaximumThroughput
) {
return "instant";
}
if (this.currentThroughputValue() > this.props.softAllowedMaximumThroughput) {
return "requireSupport";
}
return "delayed";
};
private getRuThermometerStyles = (): Partial<IProgressIndicatorStyles> => ({
progressBar: [
{
backgroundColor:
this.getCurrentRuRange() === "instant"
? "rgb(0, 120, 212)"
: this.getCurrentRuRange() === "delayed"
? "rgb(255 216 109)"
: "rgb(251, 217, 203)",
},
],
});
private getRuThermometerPercentValue = (): number => {
let percentValue: number;
const currentRus = this.currentThroughputValue();
switch (this.getCurrentRuRange()) {
case "below":
percentValue = 0;
break;
case "instant": {
const percentOfInstantRange: number = currentRus / this.props.instantMaximumThroughput;
percentValue = percentOfInstantRange * 0.34;
break;
}
case "delayed": {
const adjustedMax = this.props.softAllowedMaximumThroughput - this.props.instantMaximumThroughput;
const adjustedRus = currentRus - this.props.instantMaximumThroughput;
const percentOfDelayedRange = adjustedRus / adjustedMax;
const adjustedPercent = percentOfDelayedRange * 0.66;
percentValue = adjustedPercent + 0.34;
break;
}
default:
// over maximum
percentValue = 1;
}
return percentValue;
};
private getRUThermometer = (): JSX.Element => (
<Stack>
<Stack horizontal>
<Stack.Item style={{ width: "34%" }}>
<span>{this.props.minimum.toLocaleString()}</span>
</Stack.Item>
<Stack.Item style={{ width: "66%" }}>
<span style={{ float: "left", transform: "translateX(-50%)" }}>
{this.props.instantMaximumThroughput.toLocaleString()}
</span>
<span style={{ float: "right" }}>{this.props.softAllowedMaximumThroughput.toLocaleString()}</span>
</Stack.Item>
</Stack>
<ProgressIndicator
barHeight={20}
percentComplete={this.getRuThermometerPercentValue()}
styles={this.getRuThermometerStyles()}
/> />
{!this.overrideWithProvisionedThroughputSettings() && this.getAutoPilotUsageCost()} <Stack horizontal>
{this.minRUperGBSurvey()} <Stack.Item style={{ width: "34%", paddingRight: "5px" }}>
{this.props.spendAckVisible && ( <Separator styles={this.thoughputRangeSeparatorStyles}>Instant</Separator>
<Checkbox </Stack.Item>
id="spendAckCheckBox" <Stack.Item style={{ width: "66%", paddingLeft: "5px" }}>
styles={noLeftPaddingCheckBoxStyle} <Separator styles={this.thoughputRangeSeparatorStyles}>4-6 hrs</Separator>
label={this.props.spendAckText} </Stack.Item>
checked={this.state.spendAckChecked} </Stack>
onChange={this.onSpendAckChecked} </Stack>
);
private showThroughputWarning = (): boolean => {
return (
this.currentThroughputValue() > this.props.instantMaximumThroughput ||
this.currentThroughputValue() < this.props.minimum
);
};
private getThroughputWarningMessageText = (): JSX.Element => {
switch (this.getCurrentRuRange()) {
case "below":
return getUpdateThroughputBelowMinimumMessage(this.props.minimum);
case "delayed":
return getUpdateThroughputBeyondInstantLimitMessage(this.props.instantMaximumThroughput);
case "requireSupport":
return getUpdateThroughputBeyondSupportLimitMessage(
this.props.instantMaximumThroughput,
this.props.softAllowedMaximumThroughput
);
default:
return <></>;
}
};
private getThroughputWarningMessageBar = (): JSX.Element => {
const isSevereWarning: boolean =
this.currentThroughputValue() > this.props.softAllowedMaximumThroughput ||
this.currentThroughputValue() < this.props.minimum;
return (
<MessageBar messageBarType={isSevereWarning ? MessageBarType.severeWarning : MessageBarType.warning}>
{this.getThroughputWarningMessageText()}
</MessageBar>
);
};
private getThroughputTextField = (): JSX.Element => (
<>
{this.props.isAutoPilotSelected ? (
<TextField
label="Maximum RU/s required by this resource"
required
type="number"
id="autopilotInput"
key="auto pilot throughput input"
styles={getTextFieldStyles(this.props.maxAutoPilotThroughput, this.props.maxAutoPilotThroughputBaseline)}
disabled={this.overrideWithProvisionedThroughputSettings()}
step={AutoPilotUtils.autoPilotIncrementStep}
value={this.overrideWithProvisionedThroughputSettings() ? "" : this.props.maxAutoPilotThroughput?.toString()}
onChange={this.onAutoPilotThroughputChange}
min={autoPilotThroughput1K}
onGetErrorMessage={(value: string) => {
const sanitizedValue = getSanitizedInputValue(value);
return sanitizedValue % 1000
? "Throughput value must be in increments of 1000"
: this.props.throughputError;
}}
validateOnLoad={false}
/>
) : (
<TextField
required
type="number"
id="throughputInput"
key="provisioned throughput input"
styles={getTextFieldStyles(this.props.throughput, this.props.throughputBaseline)}
disabled={this.overrideWithAutoPilotSettings()}
step={this.step}
value={
this.overrideWithAutoPilotSettings()
? this.props.maxAutoPilotThroughputBaseline?.toString()
: this.props.throughput?.toString()
}
onChange={this.onThroughputChange}
min={this.props.minimum}
errorMessage={this.props.throughputError}
/> />
)} )}
{this.props.isFixed && <p>When using a collection with fixed storage capacity, you can set up to 10,000 RU/s.</p>}
</> </>
); );
private renderThroughputInput = (): JSX.Element => ( private renderThroughputComponent = (): JSX.Element => (
<Stack {...titleAndInputStackProps}> <Stack horizontal>
<Text> <Stack.Item style={{ width: "70%", maxWidth: "700px" }}>
Estimate your required throughput with <Stack {...relaxedSpacingStackProps} style={{ paddingRight: "50px" }}>
<Link target="_blank" href="https://cosmos.azure.com/capacitycalculator/"> {this.getThroughputTextField()}
{` capacity calculator`} <FontIcon iconName="NavigateExternalInline" /> {this.props.instantMaximumThroughput && (
</Link> <Stack>
</Text> {this.getRUThermometer()}
<TextField {this.showThroughputWarning() && this.getThroughputWarningMessageBar()}
required </Stack>
type="number" )}
id="throughputInput" {this.props.isAutoPilotSelected ? (
key="provisioned throughput input" <Text style={{ marginTop: "40px" }}>
styles={getTextFieldStyles(this.props.throughput, this.props.throughputBaseline)} Based on usage, your {this.props.collectionName ? "container" : "database"} throughput will scale from{" "}
disabled={this.overrideWithAutoPilotSettings()} <b>
step={this.step} {AutoPilotUtils.getMinRUsBasedOnUserInput(this.props.maxAutoPilotThroughput)} RU/s (10% of max RU/s) -{" "}
value={ {this.props.maxAutoPilotThroughput} RU/s
this.overrideWithAutoPilotSettings() </b>
? this.props.maxAutoPilotThroughputBaseline?.toString() <br />
: this.props.throughput?.toString() </Text>
} ) : (
onChange={this.onThroughputChange} <>
min={this.props.minimum} {this.state.exceedFreeTierThroughput && (
errorMessage={this.props.throughputError} <MessageBar
/> messageBarIconProps={{ iconName: "WarningSolid", className: "messageBarWarningIcon" }}
{this.state.exceedFreeTierThroughput && ( styles={messageBarStyles}
<MessageBar style={{ marginTop: "40px" }}
messageBarIconProps={{ iconName: "WarningSolid", className: "messageBarWarningIcon" }} >
styles={messageBarStyles} {`Billing will apply if you provision more than ${SharedConstants.FreeTierLimits.RU} RU/s of manual throughput, or if the resource scales beyond ${SharedConstants.FreeTierLimits.RU} RU/s with autoscale.`}
> </MessageBar>
{`Billing will apply if you provision more than ${SharedConstants.FreeTierLimits.RU} RU/s of manual throughput, or if the resource scales beyond ${SharedConstants.FreeTierLimits.RU} RU/s with autoscale.`} )}
</MessageBar> </>
)} )}
{this.props.getThroughputWarningMessage() && ( {!this.overrideWithProvisionedThroughputSettings() && (
<MessageBar <Text>
messageBarIconProps={{ iconName: "InfoSolid", className: "messageBarInfoIcon" }} Estimate your required RU/s with
styles={messageBarStyles} <Link target="_blank" href="https://cosmos.azure.com/capacitycalculator/">
> {` capacity calculator`} <FontIcon iconName="NavigateExternalInline" />
{this.props.getThroughputWarningMessage()} </Link>
</MessageBar> </Text>
)} )}
{!this.props.isEmulator && this.getRequestUnitsUsageCost()} {this.minRUperGBSurvey()}
{this.minRUperGBSurvey()} {this.props.spendAckVisible && (
{this.props.spendAckVisible && ( <Checkbox
<Checkbox id="spendAckCheckBox"
id="spendAckCheckBox" styles={noLeftPaddingCheckBoxStyle}
styles={noLeftPaddingCheckBoxStyle} label={this.props.spendAckText}
label={this.props.spendAckText} checked={this.state.spendAckChecked}
checked={this.state.spendAckChecked} onChange={this.onSpendAckChecked}
onChange={this.onSpendAckChecked} />
/> )}
)} {this.props.isFixed && (
<br /> <p>When using a collection with fixed storage capacity, you can set up to 10,000 RU/s.</p>
{this.props.isFixed && <p>When using a collection with fixed storage capacity, you can set up to 10,000 RU/s.</p>} )}
{this.props.collectionName && (
<Stack.Item style={{ marginTop: "40px" }}>{this.getStorageCapacityTitle()}</Stack.Item>
)}
</Stack>
</Stack.Item>
<Stack.Item style={{ width: "30%", maxWidth: "300px" }}>
{!this.props.isEmulator ? this.getRequestUnitsUsageCost() : <></>}
</Stack.Item>
</Stack> </Stack>
); );
@ -640,7 +709,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
{this.renderWarningMessage()} {this.renderWarningMessage()}
{this.renderThroughputModeChoices()} {this.renderThroughputModeChoices()}
{this.props.isAutoPilotSelected ? this.renderAutoPilotInput() : this.renderThroughputInput()} {this.renderThroughputComponent()}
</Stack> </Stack>
); );
} }

View File

@ -28,6 +28,8 @@ exports[`ConflictResolutionComponent Path text field displayed 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": undefined, "borderColor": undefined,
@ -100,6 +102,8 @@ exports[`ConflictResolutionComponent Sproc text field displayed 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",

View File

@ -39,7 +39,6 @@ exports[`ScaleComponent renders with correct initial notification 1`] = `
canExceedMaximumValue={true} canExceedMaximumValue={true}
collectionName="test" collectionName="test"
databaseName="test" databaseName="test"
getThroughputWarningMessage={[Function]}
isAutoPilotSelected={false} isAutoPilotSelected={false}
isEmulator={false} isEmulator={false}
isEnabled={true} isEnabled={true}
@ -60,20 +59,6 @@ exports[`ScaleComponent renders with correct initial notification 1`] = `
usageSizeInKB={100} usageSizeInKB={100}
wasAutopilotOriginallySet={true} wasAutopilotOriginallySet={true}
/> />
<Stack
tokens={
Object {
"childrenGap": 5,
}
}
>
<StyledLabelBase>
Storage capacity
</StyledLabelBase>
<Text>
Unlimited
</Text>
</Stack>
</Stack> </Stack>
</Stack> </Stack>
`; `;

View File

@ -40,6 +40,8 @@ exports[`SubSettingsComponent analyticalTimeToLive hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -106,6 +108,8 @@ exports[`SubSettingsComponent analyticalTimeToLive hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -168,6 +172,8 @@ exports[`SubSettingsComponent analyticalTimeToLive hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -267,6 +273,8 @@ exports[`SubSettingsComponent analyticalTimeToLiveSeconds hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -333,6 +341,8 @@ exports[`SubSettingsComponent analyticalTimeToLiveSeconds hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -385,6 +395,8 @@ exports[`SubSettingsComponent analyticalTimeToLiveSeconds hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": undefined, "borderColor": undefined,
@ -448,6 +460,8 @@ exports[`SubSettingsComponent analyticalTimeToLiveSeconds hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -547,6 +561,8 @@ exports[`SubSettingsComponent changeFeedPolicy hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -613,6 +629,8 @@ exports[`SubSettingsComponent changeFeedPolicy hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -665,6 +683,8 @@ exports[`SubSettingsComponent changeFeedPolicy hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -789,6 +809,8 @@ exports[`SubSettingsComponent renders 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -855,6 +877,8 @@ exports[`SubSettingsComponent renders 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -907,6 +931,8 @@ exports[`SubSettingsComponent renders 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -995,6 +1021,8 @@ exports[`SubSettingsComponent renders 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -1094,6 +1122,8 @@ exports[`SubSettingsComponent timeToLiveSeconds hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": undefined, "borderColor": undefined,
@ -1135,6 +1165,8 @@ exports[`SubSettingsComponent timeToLiveSeconds hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -1187,6 +1219,8 @@ exports[`SubSettingsComponent timeToLiveSeconds hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",
@ -1275,6 +1309,8 @@ exports[`SubSettingsComponent timeToLiveSeconds hidden 1`] = `
Object { Object {
"flexContainer": Array [ "flexContainer": Array [
Object { Object {
"columnGap": "default",
"display": "default",
"selectors": Object { "selectors": Object {
".ms-ChoiceField-field.is-checked::after": Object { ".ms-ChoiceField-field.is-checked::after": Object {
"borderColor": "", "borderColor": "",

View File

@ -2,154 +2,60 @@
exports[`SettingsUtils functions render 1`] = ` exports[`SettingsUtils functions render 1`] = `
<Fragment> <Fragment>
<Text> <Stack>
Your
container
throughput will automatically scale from
<b>
100
RU/s (10% of max RU/s) -
1000
RU/s
</b>
based on usage.
<br />
</Text>
<Text>
After the first
10
GB of data stored, the max RU/s will be automatically upgraded based on the new storage value.
<StyledLinkBase
href="https://aka.ms/cosmos-autoscale-info"
target="_blank"
>
Learn more
</StyledLinkBase>
.
</Text>
<Text>
Your
database
throughput will automatically scale from
<b>
100
RU/s (10% of max RU/s) -
1000
RU/s
</b>
based on usage.
<br />
</Text>
<Text>
After the first
10
GB of data stored, the max RU/s will be automatically upgraded based on the new storage value.
<StyledLinkBase
href="https://aka.ms/cosmos-autoscale-info"
target="_blank"
>
Learn more
</StyledLinkBase>
.
</Text>
<Stack
styles={
Object {
"root": Object {
"width": 600,
},
}
}
tokens={
Object {
"childrenGap": 10,
}
}
>
<StyledWithViewportComponent
columns={
Array [
Object {
"fieldName": "costType",
"isResizable": true,
"key": "costType",
"maxWidth": 200,
"minWidth": 100,
"name": "",
},
Object {
"fieldName": "hourly",
"isResizable": true,
"key": "hourly",
"maxWidth": 200,
"minWidth": 100,
"name": "Hourly",
},
Object {
"fieldName": "daily",
"isResizable": true,
"key": "daily",
"maxWidth": 200,
"minWidth": 100,
"name": "Daily",
},
Object {
"fieldName": "monthly",
"isResizable": true,
"key": "monthly",
"maxWidth": 200,
"minWidth": 100,
"name": "Monthly",
},
]
}
disableSelectionZone={true}
items={
Array [
Object {
"costType": <Text>
Current Cost
</Text>,
"daily": <Text>
$ 24.48
</Text>,
"hourly": <Text>
$ 1.02
</Text>,
"monthly": <Text>
$ 744.6
</Text>,
},
]
}
layoutMode={1}
onRenderRow={[Function]}
selectionMode={0}
/>
<Text <Text
id="throughputSpendElement" style={
Object {
"fontWeight": 600,
}
}
> >
( Cost estimate*
regions:
2
,
1000
RU/s,
¥
0.00051
/RU)
</Text> </Text>
<Text> <Text
style={
Object {
"fontWeight": 600,
"marginTop": 15,
}
}
>
How we calculate this
</Text>
<Stack
id="throughputSpendElement"
style={
Object {
"marginTop": 5,
}
}
>
<span>
2
region
<span>
s
</span>
</span>
<span>
1000
RU/s
</span>
<span>
¥
0.00051
/RU
</span>
</Stack>
<Text
style={
Object {
"marginTop": 15,
}
}
>
<em> <em>
*
This cost is an estimate and may vary based on the regions where your account is deployed and potential discounts applied to your account This cost is an estimate and may vary based on the regions where your account is deployed and potential discounts applied to your account
</em> </em>
</Text> </Text>
@ -205,19 +111,6 @@ exports[`SettingsUtils functions render 1`] = `
> >
You have not saved the latest changes made to your indexing policy. Please click save to confirm the changes. You have not saved the latest changes made to your indexing policy. Please click save to confirm the changes.
</Text> </Text>
<Text
id="updateThroughputBeyondLimitWarningMessage"
styles={
Object {
"root": Object {
"color": "windowtext",
"fontSize": 14,
},
}
}
>
You are about to request an increase in throughput beyond the pre-allocated capacity. The service will scale out and increase throughput for the selected container. This operation will take 1-3 business days to complete. You can track the status of this request in Notifications.
</Text>
<Text <Text
id="updateThroughputDelayedApplyWarningMessage" id="updateThroughputDelayedApplyWarningMessage"
styles={ styles={

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. */ /* Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. */
export async function listCassandraKeyspaces( export async function listCassandraKeyspaces(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given database account and collection. */ /* Retrieves the metrics determined by the given filter for the given database account and collection. */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given collection, split by partition. */ /* Retrieves the metrics determined by the given filter for the given collection, split by partition. */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */ /* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given database account, collection and region. */ /* Retrieves the metrics determined by the given filter for the given database account, collection and region. */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given database account and database. */ /* Retrieves the metrics determined by the given filter for the given database account and database. */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given database account and region. */ /* Retrieves the metrics determined by the given filter for the given database account and region. */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the properties of an existing Azure Cosmos DB database account. */ /* Retrieves the properties of an existing Azure Cosmos DB database account. */
export async function get( export async function get(
@ -29,13 +29,7 @@ export async function update(
body: Types.DatabaseAccountUpdateParameters body: Types.DatabaseAccountUpdateParameters
): Promise<Types.DatabaseAccountGetResults> { ): Promise<Types.DatabaseAccountGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
return armRequest({ return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PATCH", apiVersion, body });
host: configContext.ARM_ENDPOINT,
path,
method: "PATCH",
apiVersion,
body,
});
} }
/* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */ /* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */ /* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */
export async function listGremlinDatabases( export async function listGremlinDatabases(

View File

@ -0,0 +1,27 @@
/*
AUTOGENERATED FILE
Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/
import { armRequest } from "../../request";
import * as Types from "./types";
import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* List Cosmos DB locations and their properties */
export async function list(subscriptionId: string): Promise<Types.LocationListResult | Types.CloudError> {
const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations`;
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}
/* Get the properties of an existing Cosmos DB location */
export async function get(
subscriptionId: string,
location: string
): Promise<Types.LocationGetResult | Types.CloudError> {
const path = `/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}`;
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */ /* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */
export async function listMongoDBDatabases( export async function listMongoDBDatabases(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Lists all of the available Cosmos DB Resource Provider operations. */ /* Lists all of the available Cosmos DB Resource Provider operations. */
export async function list(): Promise<Types.OperationListResult> { export async function list(): Promise<Types.OperationListResult> {

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given partition key range id. */ /* Retrieves the metrics determined by the given filter for the given partition key range id. */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given partition key range id and region. */ /* Retrieves the metrics determined by the given filter for the given partition key range id and region. */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data */ /* Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data */ /* Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data */ /* Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data */
export async function listMetrics( export async function listMetrics(

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Lists the SQL databases under an existing Azure Cosmos DB database account. */ /* Lists the SQL databases under an existing Azure Cosmos DB database account. */
export async function listSqlDatabases( export async function listSqlDatabases(
@ -197,6 +197,42 @@ export async function migrateSqlContainerToManualThroughput(
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion });
} }
/* Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. */
export async function listClientEncryptionKeys(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string
): Promise<Types.ClientEncryptionKeysListResult> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/clientEncryptionKeys`;
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}
/* Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. */
export async function getClientEncryptionKey(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
clientEncryptionKeyName: string
): Promise<Types.ClientEncryptionKeyGetResults> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/clientEncryptionKeys/${clientEncryptionKeyName}`;
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}
/* Create or update a ClientEncryptionKey. This API is meant to be invoked via tools such as the Azure Powershell (instead of directly). */
export async function createUpdateClientEncryptionKey(
subscriptionId: string,
resourceGroupName: string,
accountName: string,
databaseName: string,
clientEncryptionKeyName: string,
body: Types.ClientEncryptionKeyCreateUpdateParameters
): Promise<Types.ClientEncryptionKeyGetResults | void> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/clientEncryptionKeys/${clientEncryptionKeyName}`;
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
}
/* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */ /* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */
export async function listSqlStoredProcedures( export async function listSqlStoredProcedures(
subscriptionId: string, subscriptionId: string,
@ -204,7 +240,7 @@ export async function listSqlStoredProcedures(
accountName: string, accountName: string,
databaseName: string, databaseName: string,
containerName: string containerName: string
): Promise<Types.SqlStoredProcedureListResult> { ): Promise<Types.SqlStoredProcedureListResult | Types.CloudError> {
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures`; const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures`;
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
} }

View File

@ -3,13 +3,13 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request"; import { armRequest } from "../../request";
import * as Types from "./types"; import * as Types from "./types";
const apiVersion = "2021-04-15"; import { configContext } from "../../../../ConfigContext";
const apiVersion = "2023-04-15";
/* Lists the Tables under an existing Azure Cosmos DB database account. */ /* Lists the Tables under an existing Azure Cosmos DB database account. */
export async function listTables( export async function listTables(

View File

@ -3,9 +3,15 @@
Run "npm run generateARMClients" to regenerate Run "npm run generateARMClients" to regenerate
Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json
*/ */
/* The List operation response, that contains the client encryption keys and their properties. */
export interface ClientEncryptionKeysListResult {
/* List of client encryption keys and their properties. */
readonly value?: ClientEncryptionKeyGetResults[];
}
/* The List operation response, that contains the database accounts and their properties. */ /* The List operation response, that contains the database accounts and their properties. */
export interface DatabaseAccountsListResult { export interface DatabaseAccountsListResult {
/* List of database account and their properties. */ /* List of database account and their properties. */
@ -161,6 +167,30 @@ export interface ARMProxyResource {
readonly type?: string; readonly type?: string;
} }
/* Parameters to create and update ClientEncryptionKey. */
export interface ClientEncryptionKeyCreateUpdateParameters {
/* Properties to create and update ClientEncryptionKey. */
properties: ClientEncryptionKeyCreateUpdateProperties;
}
/* Properties to create and update ClientEncryptionKey. */
export interface ClientEncryptionKeyCreateUpdateProperties {
/* The standard JSON format of a ClientEncryptionKey */
resource: ClientEncryptionKeyResource;
}
/* Client Encryption Key. */
export type ClientEncryptionKeyGetResults = ARMProxyResource & {
/* The properties of a ClientEncryptionKey */
properties?: ClientEncryptionKeyGetProperties;
};
/* The properties of a ClientEncryptionKey resource */
export interface ClientEncryptionKeyGetProperties {
/* undocumented */
resource?: ClientEncryptionKeyResource & ExtendedResourceProperties;
}
/* An Azure Cosmos DB database account. */ /* An Azure Cosmos DB database account. */
export type DatabaseAccountGetResults = ARMResourceProperties & { export type DatabaseAccountGetResults = ARMResourceProperties & {
/* Indicates the type of database account. This can only be set at database account creation. */ /* Indicates the type of database account. This can only be set at database account creation. */
@ -171,6 +201,9 @@ export type DatabaseAccountGetResults = ARMResourceProperties & {
/* undocumented */ /* undocumented */
properties?: DatabaseAccountGetProperties; properties?: DatabaseAccountGetProperties;
/* The system meta data relating to this resource. */
readonly systemData?: unknown;
}; };
/* The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin graphs. */ /* The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin graphs. */
@ -446,6 +479,17 @@ export interface DatabaseAccountGetProperties {
/* Flag to indicate whether to enable storage analytics. */ /* Flag to indicate whether to enable storage analytics. */
enableAnalyticalStorage?: boolean; enableAnalyticalStorage?: boolean;
/* Analytical storage specific properties. */
analyticalStorageConfiguration?: AnalyticalStorageConfiguration;
/* A unique identifier assigned to the database account */
readonly instanceId?: string;
/* Enum to indicate the mode of account creation. */
createMode?: CreateMode;
/* Parameters to indicate the information about the restore. */
restoreParameters?: RestoreParameters;
/* The object representing the policy for taking backups on an account. */ /* The object representing the policy for taking backups on an account. */
backupPolicy?: BackupPolicy; backupPolicy?: BackupPolicy;
@ -457,6 +501,19 @@ export interface DatabaseAccountGetProperties {
/* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */ /* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */
networkAclBypassResourceIds?: unknown[]; networkAclBypassResourceIds?: unknown[];
/* Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. */
disableLocalAuth?: boolean;
/* The object that represents all properties related to capacity enforcement on an account. */
capacity?: Capacity;
/* The object that represents the metadata for the Account Keys of the Cosmos DB account. */
keysMetadata?: DatabaseAccountKeysMetadata;
/* Flag to indicate enabling/disabling of Partition Merge feature on the account */
enablePartitionMerge?: boolean;
/* Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. */
minimalTlsVersion?: MinimalTlsVersion;
} }
/* Properties to create and update Azure Cosmos DB database accounts. */ /* Properties to create and update Azure Cosmos DB database accounts. */
@ -506,6 +563,12 @@ export interface DatabaseAccountCreateUpdateProperties {
/* Flag to indicate whether to enable storage analytics. */ /* Flag to indicate whether to enable storage analytics. */
enableAnalyticalStorage?: boolean; enableAnalyticalStorage?: boolean;
/* Analytical storage specific properties. */
analyticalStorageConfiguration?: AnalyticalStorageConfiguration;
/* Enum to indicate the mode of account creation. */
createMode?: CreateMode;
/* The object representing the policy for taking backups on an account. */ /* The object representing the policy for taking backups on an account. */
backupPolicy?: BackupPolicy; backupPolicy?: BackupPolicy;
@ -517,6 +580,22 @@ export interface DatabaseAccountCreateUpdateProperties {
/* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */ /* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */
networkAclBypassResourceIds?: unknown[]; networkAclBypassResourceIds?: unknown[];
/* Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. */
disableLocalAuth?: boolean;
/* Parameters to indicate the information about the restore. */
restoreParameters?: RestoreParameters;
/* The object that represents all properties related to capacity enforcement on an account. */
capacity?: Capacity;
/* This property is ignored during the update/create operation, as the metadata is read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. */
keysMetadata?: DatabaseAccountKeysMetadata;
/* Flag to indicate enabling/disabling of Partition Merge feature on the account */
enablePartitionMerge?: boolean;
/* Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. */
minimalTlsVersion?: MinimalTlsVersion;
} }
/* Parameters to create and update Cosmos DB database accounts. */ /* Parameters to create and update Cosmos DB database accounts. */
@ -575,6 +654,9 @@ export interface DatabaseAccountUpdateProperties {
/* Flag to indicate whether to enable storage analytics. */ /* Flag to indicate whether to enable storage analytics. */
enableAnalyticalStorage?: boolean; enableAnalyticalStorage?: boolean;
/* Analytical storage specific properties. */
analyticalStorageConfiguration?: AnalyticalStorageConfiguration;
/* The object representing the policy for taking backups on an account. */ /* The object representing the policy for taking backups on an account. */
backupPolicy?: BackupPolicy; backupPolicy?: BackupPolicy;
@ -586,6 +668,19 @@ export interface DatabaseAccountUpdateProperties {
/* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */ /* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */
networkAclBypassResourceIds?: unknown[]; networkAclBypassResourceIds?: unknown[];
/* Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. */
disableLocalAuth?: boolean;
/* The object that represents all properties related to capacity enforcement on an account. */
capacity?: Capacity;
/* This property is ignored during the update operation, as the metadata is read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. */
keysMetadata?: DatabaseAccountKeysMetadata;
/* Flag to indicate enabling/disabling of Partition Merge feature on the account */
enablePartitionMerge?: boolean;
/* Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. */
minimalTlsVersion?: MinimalTlsVersion;
} }
/* Parameters for patching Azure Cosmos DB database account properties. */ /* Parameters for patching Azure Cosmos DB database account properties. */
@ -624,6 +719,20 @@ export interface DatabaseAccountConnectionString {
readonly connectionString?: string; readonly connectionString?: string;
/* Description of the connection string */ /* Description of the connection string */
readonly description?: string; readonly description?: string;
/* Kind of the connection string key */
readonly keyKind?: "Primary" | "Secondary" | "PrimaryReadonly" | "SecondaryReadonly";
/* Type of the connection string */
readonly type?:
| "Sql"
| "Table"
| "MongoDB"
| "Cassandra"
| "CassandraConnectorMetadata"
| "Gremlin"
| "SqlDedicatedGateway"
| "GremlinV2"
| "Undefined";
} }
/* The connection strings for the given database account. */ /* The connection strings for the given database account. */
@ -844,6 +953,10 @@ export interface ThroughputSettingsResource {
readonly minimumThroughput?: string; readonly minimumThroughput?: string;
/* The throughput replace is pending */ /* The throughput replace is pending */
readonly offerReplacePending?: string; readonly offerReplacePending?: string;
/* The offer throughput value to instantly scale up without triggering splits */
readonly instantMaximumThroughput?: string;
/* The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified */
readonly softAllowedMaximumThroughput?: string;
} }
/* Cosmos DB provisioned throughput settings object */ /* Cosmos DB provisioned throughput settings object */
@ -879,6 +992,30 @@ export interface OptionsResource {
autoscaleSettings?: AutoscaleSettings; autoscaleSettings?: AutoscaleSettings;
} }
/* Cosmos DB client encryption key resource object. */
export interface ClientEncryptionKeyResource {
/* Name of the ClientEncryptionKey */
id?: string;
/* Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt data. */
encryptionAlgorithm?: string;
/* Wrapped (encrypted) form of the key represented as a byte array. */
wrappedDataEncryptionKey?: string;
/* Metadata for the wrapping provider that can be used to unwrap the wrapped client encryption key. */
keyWrapMetadata?: KeyWrapMetadata;
}
/* Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key. */
export interface KeyWrapMetadata {
/* The name of associated KeyEncryptionKey (aka CustomerManagedKey). */
name?: string;
/* ProviderName of KeyStoreProvider. */
type?: string;
/* Reference / link to the KeyEncryptionKey. */
value?: string;
/* Algorithm used in wrapping and unwrapping of the data encryption key. */
algorithm?: string;
}
/* Cosmos DB SQL database resource object */ /* Cosmos DB SQL database resource object */
export interface SqlDatabaseResource { export interface SqlDatabaseResource {
/* Name of the Cosmos DB SQL database */ /* Name of the Cosmos DB SQL database */
@ -903,6 +1040,9 @@ export interface SqlContainerResource {
/* The conflict resolution policy for the container. */ /* The conflict resolution policy for the container. */
conflictResolutionPolicy?: ConflictResolutionPolicy; conflictResolutionPolicy?: ConflictResolutionPolicy;
/* The client encryption policy for the container. */
clientEncryptionPolicy?: ClientEncryptionPolicy;
/* Analytical TTL. */ /* Analytical TTL. */
analyticalStorageTtl?: number; analyticalStorageTtl?: number;
} }
@ -1014,6 +1154,27 @@ export interface ConflictResolutionPolicy {
conflictResolutionProcedure?: string; conflictResolutionProcedure?: string;
} }
/* Cosmos DB client encryption policy. */
export interface ClientEncryptionPolicy {
/* Paths of the item that need encryption along with path-specific settings. */
includedPaths: ClientEncryptionIncludedPath[];
/* Version of the client encryption policy definition. Supported versions are 1 and 2. Version 2 supports id and partition key path encryption. */
policyFormatVersion: number;
}
/* . */
export interface ClientEncryptionIncludedPath {
/* Path that needs to be encrypted. */
path: string;
/* The identifier of the Client Encryption Key to be used to encrypt the path. */
clientEncryptionKeyId: string;
/* The type of encryption to be performed. Eg - Deterministic, Randomized. */
encryptionType: string;
/* The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256. */
encryptionAlgorithm: string;
}
/* Cosmos DB SQL storedProcedure resource object */ /* Cosmos DB SQL storedProcedure resource object */
export interface SqlStoredProcedureResource { export interface SqlStoredProcedureResource {
/* Name of the Cosmos DB SQL storedProcedure */ /* Name of the Cosmos DB SQL storedProcedure */
@ -1035,7 +1196,7 @@ export interface SqlTriggerResource {
/* Name of the Cosmos DB SQL trigger */ /* Name of the Cosmos DB SQL trigger */
id: string; id: string;
/* Body of the Trigger */ /* Body of the Trigger */
body: string; body?: string;
/* Type of the Trigger */ /* Type of the Trigger */
triggerType?: "Pre" | "Post"; triggerType?: "Pre" | "Post";
@ -1174,6 +1335,9 @@ export interface GremlinGraphResource {
/* The conflict resolution policy for the graph. */ /* The conflict resolution policy for the graph. */
conflictResolutionPolicy?: ConflictResolutionPolicy; conflictResolutionPolicy?: ConflictResolutionPolicy;
/* Analytical TTL. */
analyticalStorageTtl?: number;
} }
/* CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" */ /* CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" */
@ -1196,6 +1360,12 @@ export interface Capability {
name?: string; name?: string;
} }
/* The object that represents all properties related to capacity enforcement on an account. */
export interface Capacity {
/* The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned on that account to be 2000. A totalThroughputLimit of -1 indicates no limits on provisioning of throughput. */
totalThroughputLimit?: number;
}
/* Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". */ /* Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". */
export type Tags = { [key: string]: string }; export type Tags = { [key: string]: string };
@ -1235,6 +1405,27 @@ export interface VirtualNetworkRule {
/* Indicates what services are allowed to bypass firewall checks. */ /* Indicates what services are allowed to bypass firewall checks. */
export type NetworkAclBypass = "None" | "AzureServices"; export type NetworkAclBypass = "None" | "AzureServices";
/* The metadata related to an access key for a given database account. */
export interface AccountKeyMetadata {
/* Generation time in UTC of the key in ISO-8601 format. If the value is missing from the object, it means that the last key regeneration was triggered before 2022-06-18. */
readonly generationTime?: string;
}
/* The metadata related to each access key for the given Cosmos DB database account. */
export interface DatabaseAccountKeysMetadata {
/* The metadata related to the Primary Read-Write Key for the given Cosmos DB database account. */
readonly primaryMasterKey?: AccountKeyMetadata;
/* The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account. */
readonly secondaryMasterKey?: AccountKeyMetadata;
/* The metadata related to the Primary Read-Only Key for the given Cosmos DB database account. */
readonly primaryReadonlyMasterKey?: AccountKeyMetadata;
/* The metadata related to the Secondary Read-Only Key for the given Cosmos DB database account. */
readonly secondaryReadonlyMasterKey?: AccountKeyMetadata;
}
/* REST API operation */ /* REST API operation */
export interface Operation { export interface Operation {
/* Operation name: {provider}/{resource}/{operation} */ /* Operation name: {provider}/{resource}/{operation} */
@ -1430,23 +1621,97 @@ export type UnitType = "Count" | "Bytes" | "Seconds" | "Percent" | "CountPerSeco
export type ConnectorOffer = "Small"; export type ConnectorOffer = "Small";
/* Whether requests from Public Network are allowed */ /* Whether requests from Public Network are allowed */
export type PublicNetworkAccess = "Enabled" | "Disabled"; export type PublicNetworkAccess = "Enabled" | "Disabled" | "SecuredByPerimeter";
/* undocumented */ /* undocumented */
export interface ApiProperties { export interface ApiProperties {
/* Describes the ServerVersion of an a MongoDB account. */ /* Describes the ServerVersion of an a MongoDB account. */
serverVersion?: "3.2" | "3.6" | "4.0"; serverVersion?: "3.2" | "3.6" | "4.0" | "4.2";
} }
/* Analytical storage specific properties. */
export interface AnalyticalStorageConfiguration {
/* undocumented */
schemaType?: AnalyticalStorageSchemaType;
}
/* Describes the types of schema for analytical storage. */
export type AnalyticalStorageSchemaType = "WellDefined" | "FullFidelity";
/* Enum to indicate the mode of account creation. */
export type CreateMode = "Default" | "Restore";
/* Parameters to indicate the information about the restore. */
export interface RestoreParameters {
/* Describes the mode of the restore. */
restoreMode?: "PointInTime";
/* The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} */
restoreSource?: string;
/* Time to which the account has to be restored (ISO-8601 format). */
restoreTimestampInUtc?: string;
/* List of specific databases available for restore. */
databasesToRestore?: DatabaseRestoreResource[];
/* List of specific gremlin databases available for restore. */
gremlinDatabasesToRestore?: GremlinDatabaseRestoreResource[];
/* List of specific tables available for restore. */
tablesToRestore?: TableName[];
}
/* Specific Databases to restore. */
export interface DatabaseRestoreResource {
/* The name of the database available for restore. */
databaseName?: string;
/* The names of the collections available for restore. */
collectionNames?: CollectionName[];
}
/* Specific Gremlin Databases to restore. */
export interface GremlinDatabaseRestoreResource {
/* The name of the gremlin database available for restore. */
databaseName?: string;
/* The names of the graphs available for restore. */
graphNames?: GraphName[];
}
/* The name of the collection. */
export type CollectionName = string;
/* The name of the graph. */
export type GraphName = string;
/* The name of the table. */
export type TableName = string;
/* The object representing the policy for taking backups on an account. */ /* The object representing the policy for taking backups on an account. */
export interface BackupPolicy { export interface BackupPolicy {
/* undocumented */ /* Describes the mode of backups. */
type: BackupPolicyType; type: BackupPolicyType;
/* The object representing the state of the migration between the backup policies. */
migrationState?: BackupPolicyMigrationState;
} }
/* Describes the mode of backups. */ /* Describes the mode of backups. */
export type BackupPolicyType = "Periodic" | "Continuous"; export type BackupPolicyType = "Periodic" | "Continuous";
/* The object representing the state of the migration between the backup policies. */
export interface BackupPolicyMigrationState {
/* Describes the status of migration between backup policy types. */
status?: BackupPolicyMigrationStatus;
/* Describes the target backup policy type of the backup policy migration. */
targetType?: BackupPolicyType;
/* Time at which the backup policy migration started (ISO-8601 format). */
startTime?: string;
}
/* Describes the status of migration between backup policy types. */
export type BackupPolicyMigrationStatus = "Invalid" | "InProgress" | "Completed" | "Failed";
/* The object representing periodic mode backup policy. */ /* The object representing periodic mode backup policy. */
export type PeriodicModeBackupPolicy = BackupPolicy & { export type PeriodicModeBackupPolicy = BackupPolicy & {
/* Configuration values for periodic mode backup */ /* Configuration values for periodic mode backup */
@ -1454,7 +1719,10 @@ export type PeriodicModeBackupPolicy = BackupPolicy & {
}; };
/* The object representing continuous mode backup policy. */ /* The object representing continuous mode backup policy. */
export type ContinuousModeBackupPolicy = BackupPolicy; export type ContinuousModeBackupPolicy = BackupPolicy & {
/* Configuration values for continuous mode backup */
continuousModeProperties?: ContinuousModeProperties;
};
/* Configuration values for periodic mode backup */ /* Configuration values for periodic mode backup */
export interface PeriodicModeProperties { export interface PeriodicModeProperties {
@ -1462,4 +1730,50 @@ export interface PeriodicModeProperties {
backupIntervalInMinutes?: number; backupIntervalInMinutes?: number;
/* An integer representing the time (in hours) that each backup is retained */ /* An integer representing the time (in hours) that each backup is retained */
backupRetentionIntervalInHours?: number; backupRetentionIntervalInHours?: number;
/* Enum to indicate type of backup residency */
backupStorageRedundancy?: BackupStorageRedundancy;
} }
/* Configuration values for periodic mode backup */
export interface ContinuousModeProperties {
/* Enum to indicate type of Continuous backup mode */
tier?: ContinuousTier;
}
/* The List operation response, that contains Cosmos DB locations and their properties. */
export interface LocationListResult {
/* List of Cosmos DB locations and their properties. */
readonly value?: LocationGetResult[];
}
/* Cosmos DB location get result */
export type LocationGetResult = ARMProxyResource & {
/* Cosmos DB location metadata */
properties?: LocationProperties;
};
/* Cosmos DB location metadata */
export interface LocationProperties {
/* Flag indicating whether the location supports availability zones or not. */
readonly supportsAvailabilityZone?: boolean;
/* Flag indicating whether the location is residency sensitive. */
readonly isResidencyRestricted?: boolean;
/* The properties of available backup storage redundancies. */
readonly backupStorageRedundancies?: BackupStorageRedundancy[];
/* Flag indicating whether the subscription have access in region for Non-Availability Zones. */
readonly isSubscriptionRegionAccessAllowedForRegular?: boolean;
/* Flag indicating whether the subscription have access in region for Availability Zones(Az). */
readonly isSubscriptionRegionAccessAllowedForAz?: boolean;
/* Enum to indicate current buildout status of the region. */
readonly status?: "Uninitialized" | "Initializing" | "InternallyReady" | "Online" | "Deleting";
}
/* Enum to indicate type of backup storage redundancy. */
export type BackupStorageRedundancy = "Geo" | "Local" | "Zone";
/* Enum to indicate type of Continuous backup tier. */
export type ContinuousTier = "Continuous7Days" | "Continuous30Days";
/* Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. */
export type MinimalTlsVersion = "Tls" | "Tls11" | "Tls12";

View File

@ -15,12 +15,18 @@
"target": "es2017", "target": "es2017",
"experimentalDecorators": true, "experimentalDecorators": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"lib": ["es5", "es6", "dom"], "lib": [
"es5",
"es6",
"dom"
],
"jsx": "react", "jsx": "react",
"moduleResolution": "node", "moduleResolution": "node",
"resolveJsonModule": true, "resolveJsonModule": true,
"noEmit": true, "noEmit": true,
"types": ["jest"], "types": [
"jest"
],
"baseUrl": "src" "baseUrl": "src"
}, },
"typedocOptions": { "typedocOptions": {
@ -37,6 +43,17 @@
"includes": "./src/SelfServe/Documentation", "includes": "./src/SelfServe/Documentation",
"disableSources": true "disableSources": true
}, },
"include": ["src", "./src/**/*", "./utils/**/*"], "include": [
"exclude": ["./src/**/__mocks__/**/*"] "src",
} "./src/**/*",
"./utils/**/*"
],
"exclude": [
"./src/**/__mocks__/**/*"
],
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
}
}

View File

@ -16,10 +16,15 @@ Results of this file should be checked into the repo.
*/ */
// CHANGE THESE VALUES TO GENERATE NEW CLIENTS // CHANGE THESE VALUES TO GENERATE NEW CLIENTS
const version = "2021-04-15"; const version = "2023-04-15";
const resourceName = "cosmosNotebooks"; /* The following are legal options for resourceName but you generally will only use cosmos-db:
const schemaURL = `https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/${version}/notebook.json`; "cosmos-db" | "managedCassandra" | "mongorbac" | "notebook" | "privateEndpointConnection" | "privateLinkResources" |
const outputDir = path.join(__dirname, `../../src/Utils/arm/generatedClients/${resourceName}/${version}`); "rbac" | "restorable" | "services"
*/
const githubResourceName = "cosmos-db";
const deResourceName = "cosmos";
const schemaURL = `https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/${version}/${githubResourceName}.json`;
const outputDir = path.join(__dirname, `../../src/Utils/arm/generatedClients/${deResourceName}`);
// Array of strings to use for eventual output // Array of strings to use for eventual output
const outputTypes: string[] = [""]; const outputTypes: string[] = [""];
@ -142,7 +147,7 @@ const propertyToType = (property: Property, prop: string, required: boolean) =>
`); `);
} else { } else {
if (property.type === undefined) { if (property.type === undefined) {
console.log(`UHANDLED TYPE: ${prop}. Falling back to unknown`); console.log(`generator.ts - UNHANDLED TYPE: ${prop}. Falling back to unknown`);
property.type = "unknown"; property.type = "unknown";
} }
outputTypes.push(` outputTypes.push(`
@ -209,7 +214,7 @@ async function main() {
export type ${definition} = ${type} export type ${definition} = ${type}
`); `);
} else { } else {
console.log("UNHANDLED MODEL:", def, schema.definitions[def]); console.log("generator.ts - UNHANDLED MODEL:", def, schema.definitions[def]);
} }
} }
} }
@ -233,9 +238,9 @@ async function main() {
// Write all grouped fetch functions to objects // Write all grouped fetch functions to objects
for (const clientName in clients) { for (const clientName in clients) {
const outputClient: string[] = [""]; const outputClient: string[] = [""];
outputClient.push(`import { armRequest } from "../../../request"\n`); outputClient.push(`import { armRequest } from "../../request"\n`);
outputClient.push(`import * as Types from "./types"\n`); outputClient.push(`import * as Types from "./types"\n`);
outputClient.push(`import { configContext } from "../../../../../ConfigContext";\n`); outputClient.push(`import { configContext } from "../../../../ConfigContext";\n`);
outputClient.push(`const apiVersion = "${version}"\n\n`); outputClient.push(`const apiVersion = "${version}"\n\n`);
for (const path of clients[clientName].paths) { for (const path of clients[clientName].paths) {
for (const method in schema.paths[path]) { for (const method in schema.paths[path]) {