diff --git a/package.json b/package.json index 9c2ef314b..811475c19 100644 --- a/package.json +++ b/package.json @@ -205,7 +205,7 @@ "strict:find": "node ./strict-null-checks/find.js", "strict:add": "node ./strict-null-checks/auto-add.js", "compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks", - "generateARMClients": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts" + "generateARMClients": "npx ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts" }, "repository": { "type": "git", diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index 31f537d8a..79edd0234 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -44,7 +44,7 @@ export class ArmResourceTypes { } export class BackendDefaults { - public static partitionKeyKind: string = "Hash"; + public static partitionKeyKind = "Hash"; public static singlePartitionStorageInGb: string = "10"; public static multiPartitionStorageInGb: string = "100"; public static maxChangeFeedRetentionDuration: number = 10; diff --git a/src/Common/QueriesClient.ts b/src/Common/QueriesClient.ts index adc47bdf7..23e1ee9e1 100644 --- a/src/Common/QueriesClient.ts +++ b/src/Common/QueriesClient.ts @@ -19,7 +19,7 @@ import { handleError } from "./ErrorHandlingUtils"; export class QueriesClient { private static readonly PartitionKey: DataModels.PartitionKey = { paths: [`/${SavedQueries.PartitionKeyProperty}`], - kind: BackendDefaults.partitionKeyKind, + kind: "Hash", version: BackendDefaults.partitionKeyVersion, }; private static readonly FetchQuery: string = "SELECT * FROM c"; diff --git a/src/Common/dataAccess/createCollection.ts b/src/Common/dataAccess/createCollection.ts index 2aecaeebc..6d7798dd8 100644 --- a/src/Common/dataAccess/createCollection.ts +++ b/src/Common/dataAccess/createCollection.ts @@ -10,18 +10,15 @@ import { userContext } from "../../UserContext"; import { createUpdateCassandraTable, getCassandraTable, -} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; -import { - createUpdateGremlinGraph, - getGremlinGraph, -} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; +} from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; +import { createUpdateGremlinGraph, getGremlinGraph } from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; import { createUpdateMongoDBCollection, getMongoDBCollection, -} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; -import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/2020-04-01/tableResources"; -import * as ARMTypes from "../../Utils/arm/generatedClients/2020-04-01/types"; +} from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; +import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/cosmos/tableResources"; +import * as ARMTypes from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/createDatabase.ts b/src/Common/dataAccess/createDatabase.ts index fc4172ce5..7d13871f6 100644 --- a/src/Common/dataAccess/createDatabase.ts +++ b/src/Common/dataAccess/createDatabase.ts @@ -6,23 +6,23 @@ import { userContext } from "../../UserContext"; import { createUpdateCassandraKeyspace, getCassandraKeyspace, -} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; +} from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; import { createUpdateGremlinDatabase, getGremlinDatabase, -} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; +} from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; import { createUpdateMongoDBDatabase, getMongoDBDatabase, -} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { createUpdateSqlDatabase, getSqlDatabase } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +} from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { createUpdateSqlDatabase, getSqlDatabase } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { CassandraKeyspaceCreateUpdateParameters, CreateUpdateOptions, GremlinDatabaseCreateUpdateParameters, MongoDBDatabaseCreateUpdateParameters, SqlDatabaseCreateUpdateParameters, -} from "../../Utils/arm/generatedClients/2020-04-01/types"; +} from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/createStoredProcedure.ts b/src/Common/dataAccess/createStoredProcedure.ts index 471ea0f97..579835277 100644 --- a/src/Common/dataAccess/createStoredProcedure.ts +++ b/src/Common/dataAccess/createStoredProcedure.ts @@ -4,11 +4,11 @@ import { userContext } from "../../UserContext"; import { createUpdateSqlStoredProcedure, getSqlStoredProcedure, -} from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +} from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { SqlStoredProcedureCreateUpdateParameters, SqlStoredProcedureResource, -} from "../../Utils/arm/generatedClients/2020-04-01/types"; +} from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/createTrigger.ts b/src/Common/dataAccess/createTrigger.ts index d9771b095..ad825820f 100644 --- a/src/Common/dataAccess/createTrigger.ts +++ b/src/Common/dataAccess/createTrigger.ts @@ -1,11 +1,8 @@ -import { Resource, TriggerDefinition } from "@azure/cosmos"; +import { TriggerDefinition } from "@azure/cosmos"; import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { createUpdateSqlTrigger, getSqlTrigger } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; -import { - SqlTriggerCreateUpdateParameters, - SqlTriggerResource, -} from "../../Utils/arm/generatedClients/2020-04-01/types"; +import { createUpdateSqlTrigger, getSqlTrigger } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; +import { SqlTriggerCreateUpdateParameters, SqlTriggerResource } from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; @@ -13,8 +10,8 @@ import { handleError } from "../ErrorHandlingUtils"; export async function createTrigger( databaseId: string, collectionId: string, - trigger: TriggerDefinition -): Promise { + trigger: SqlTriggerResource +): Promise { const clearMessage = logConsoleProgress(`Creating trigger ${trigger.id}`); try { if (userContext.authType === AuthType.AAD && !userContext.useSDKOperations && userContext.apiType === "SQL") { @@ -38,7 +35,7 @@ export async function createTrigger( const createTriggerParams: SqlTriggerCreateUpdateParameters = { properties: { - resource: trigger as SqlTriggerResource, + resource: trigger, options: {}, }, }; @@ -51,10 +48,13 @@ export async function createTrigger( trigger.id, createTriggerParams ); - return rpResponse && (rpResponse.properties?.resource as TriggerDefinition & Resource); + return rpResponse && rpResponse.properties?.resource; } - const response = await client().database(databaseId).container(collectionId).scripts.triggers.create(trigger); + const response = await client() + .database(databaseId) + .container(collectionId) + .scripts.triggers.create((trigger as unknown) as TriggerDefinition); // TODO: TypeScript does not like the SQL SDK trigger type return response.resource; } catch (error) { handleError(error, "CreateTrigger", `Error while creating trigger ${trigger.id}`); diff --git a/src/Common/dataAccess/createUserDefinedFunction.ts b/src/Common/dataAccess/createUserDefinedFunction.ts index 8608c25da..3b7dd4a12 100644 --- a/src/Common/dataAccess/createUserDefinedFunction.ts +++ b/src/Common/dataAccess/createUserDefinedFunction.ts @@ -4,11 +4,11 @@ import { userContext } from "../../UserContext"; import { createUpdateSqlUserDefinedFunction, getSqlUserDefinedFunction, -} from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +} from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { SqlUserDefinedFunctionCreateUpdateParameters, SqlUserDefinedFunctionResource, -} from "../../Utils/arm/generatedClients/2020-04-01/types"; +} from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/deleteCollection.ts b/src/Common/dataAccess/deleteCollection.ts index ec3dd7453..63e58b8c8 100644 --- a/src/Common/dataAccess/deleteCollection.ts +++ b/src/Common/dataAccess/deleteCollection.ts @@ -1,10 +1,10 @@ import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { deleteCassandraTable } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; -import { deleteGremlinGraph } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; -import { deleteMongoDBCollection } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { deleteSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; -import { deleteTable } from "../../Utils/arm/generatedClients/2020-04-01/tableResources"; +import { deleteCassandraTable } from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; +import { deleteGremlinGraph } from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; +import { deleteMongoDBCollection } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { deleteSqlContainer } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; +import { deleteTable } from "../../Utils/arm/generatedClients/cosmos/tableResources"; import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/deleteDatabase.ts b/src/Common/dataAccess/deleteDatabase.ts index 4e7d3523c..c6c744e35 100644 --- a/src/Common/dataAccess/deleteDatabase.ts +++ b/src/Common/dataAccess/deleteDatabase.ts @@ -1,9 +1,9 @@ import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { deleteCassandraKeyspace } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; -import { deleteGremlinDatabase } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; -import { deleteMongoDBDatabase } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { deleteSqlDatabase } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { deleteCassandraKeyspace } from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; +import { deleteGremlinDatabase } from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; +import { deleteMongoDBDatabase } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { deleteSqlDatabase } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/deleteStoredProcedure.ts b/src/Common/dataAccess/deleteStoredProcedure.ts index d1cd534ac..daaf8315a 100644 --- a/src/Common/dataAccess/deleteStoredProcedure.ts +++ b/src/Common/dataAccess/deleteStoredProcedure.ts @@ -1,6 +1,6 @@ import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { deleteSqlStoredProcedure } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { deleteSqlStoredProcedure } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/deleteTrigger.ts b/src/Common/dataAccess/deleteTrigger.ts index 3309bc2a9..b4a7aa7ad 100644 --- a/src/Common/dataAccess/deleteTrigger.ts +++ b/src/Common/dataAccess/deleteTrigger.ts @@ -1,6 +1,6 @@ import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { deleteSqlTrigger } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { deleteSqlTrigger } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/deleteUserDefinedFunction.ts b/src/Common/dataAccess/deleteUserDefinedFunction.ts index b502c1a98..c9683c1ab 100644 --- a/src/Common/dataAccess/deleteUserDefinedFunction.ts +++ b/src/Common/dataAccess/deleteUserDefinedFunction.ts @@ -1,6 +1,6 @@ import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { deleteSqlUserDefinedFunction } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { deleteSqlUserDefinedFunction } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/readCollectionOffer.ts b/src/Common/dataAccess/readCollectionOffer.ts index 4b1e0a9e8..c307242d8 100644 --- a/src/Common/dataAccess/readCollectionOffer.ts +++ b/src/Common/dataAccess/readCollectionOffer.ts @@ -1,11 +1,11 @@ import { AuthType } from "../../AuthType"; import { Offer, ReadCollectionOfferParams } from "../../Contracts/DataModels"; import { userContext } from "../../UserContext"; -import { getCassandraTableThroughput } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; -import { getGremlinGraphThroughput } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; -import { getMongoDBCollectionThroughput } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { getSqlContainerThroughput } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; -import { getTableThroughput } from "../../Utils/arm/generatedClients/2020-04-01/tableResources"; +import { getCassandraTableThroughput } from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; +import { getGremlinGraphThroughput } from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; +import { getMongoDBCollectionThroughput } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { getSqlContainerThroughput } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; +import { getTableThroughput } from "../../Utils/arm/generatedClients/cosmos/tableResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { handleError } from "../ErrorHandlingUtils"; import { readOfferWithSDK } from "./readOfferWithSDK"; diff --git a/src/Common/dataAccess/readCollections.ts b/src/Common/dataAccess/readCollections.ts index 7161f598c..92be4f57e 100644 --- a/src/Common/dataAccess/readCollections.ts +++ b/src/Common/dataAccess/readCollections.ts @@ -1,11 +1,11 @@ import { AuthType } from "../../AuthType"; import * as DataModels from "../../Contracts/DataModels"; import { userContext } from "../../UserContext"; -import { listCassandraTables } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; -import { listGremlinGraphs } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; -import { listMongoDBCollections } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { listSqlContainers } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; -import { listTables } from "../../Utils/arm/generatedClients/2020-04-01/tableResources"; +import { listCassandraTables } from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; +import { listGremlinGraphs } from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; +import { listMongoDBCollections } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { listSqlContainers } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; +import { listTables } from "../../Utils/arm/generatedClients/cosmos/tableResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/readDatabaseOffer.ts b/src/Common/dataAccess/readDatabaseOffer.ts index b26976a64..d27d68078 100644 --- a/src/Common/dataAccess/readDatabaseOffer.ts +++ b/src/Common/dataAccess/readDatabaseOffer.ts @@ -1,10 +1,10 @@ import { AuthType } from "../../AuthType"; import { Offer, ReadDatabaseOfferParams } from "../../Contracts/DataModels"; import { userContext } from "../../UserContext"; -import { getCassandraKeyspaceThroughput } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; -import { getGremlinDatabaseThroughput } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; -import { getMongoDBDatabaseThroughput } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { getSqlDatabaseThroughput } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { getCassandraKeyspaceThroughput } from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; +import { getGremlinDatabaseThroughput } from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; +import { getMongoDBDatabaseThroughput } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { getSqlDatabaseThroughput } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { handleError } from "../ErrorHandlingUtils"; import { readOfferWithSDK } from "./readOfferWithSDK"; diff --git a/src/Common/dataAccess/readDatabases.ts b/src/Common/dataAccess/readDatabases.ts index 079c92269..e5136676e 100644 --- a/src/Common/dataAccess/readDatabases.ts +++ b/src/Common/dataAccess/readDatabases.ts @@ -1,10 +1,10 @@ import { AuthType } from "../../AuthType"; import * as DataModels from "../../Contracts/DataModels"; import { userContext } from "../../UserContext"; -import { listCassandraKeyspaces } from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; -import { listGremlinDatabases } from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; -import { listMongoDBDatabases } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { listSqlDatabases } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { listCassandraKeyspaces } from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; +import { listGremlinDatabases } from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; +import { listMongoDBDatabases } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { listSqlDatabases } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/readMongoDBCollection.tsx b/src/Common/dataAccess/readMongoDBCollection.tsx index e7ae32c79..cdc4a0845 100644 --- a/src/Common/dataAccess/readMongoDBCollection.tsx +++ b/src/Common/dataAccess/readMongoDBCollection.tsx @@ -1,7 +1,7 @@ import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { getMongoDBCollection } from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { MongoDBCollectionResource } from "../../Utils/arm/generatedClients/2020-04-01/types"; +import { getMongoDBCollection } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { MongoDBCollectionResource } from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/readStoredProcedures.ts b/src/Common/dataAccess/readStoredProcedures.ts index b7955ffd7..65edb54c2 100644 --- a/src/Common/dataAccess/readStoredProcedures.ts +++ b/src/Common/dataAccess/readStoredProcedures.ts @@ -1,7 +1,7 @@ import { Resource, StoredProcedureDefinition } from "@azure/cosmos"; import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { listSqlStoredProcedures } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { listSqlStoredProcedures } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/readTriggers.ts b/src/Common/dataAccess/readTriggers.ts index 7f87d3ae9..764f3ace1 100644 --- a/src/Common/dataAccess/readTriggers.ts +++ b/src/Common/dataAccess/readTriggers.ts @@ -1,7 +1,8 @@ -import { Resource, TriggerDefinition } from "@azure/cosmos"; +import { TriggerDefinition } from "@azure/cosmos"; import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { listSqlTriggers } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { listSqlTriggers } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; +import { SqlTriggerResource } from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; @@ -9,7 +10,7 @@ import { handleError } from "../ErrorHandlingUtils"; export async function readTriggers( databaseId: string, collectionId: string -): Promise<(TriggerDefinition & Resource)[]> { +): Promise { const clearMessage = logConsoleProgress(`Querying triggers for container ${collectionId}`); try { if (userContext.authType === AuthType.AAD && !userContext.useSDKOperations && userContext.apiType === "SQL") { @@ -20,7 +21,7 @@ export async function readTriggers( databaseId, collectionId ); - return rpResponse?.value?.map((trigger) => trigger.properties?.resource as TriggerDefinition & Resource); + return rpResponse?.value?.map((trigger) => trigger.properties?.resource); } const response = await client().database(databaseId).container(collectionId).scripts.triggers.readAll().fetchAll(); diff --git a/src/Common/dataAccess/readUserDefinedFunctions.ts b/src/Common/dataAccess/readUserDefinedFunctions.ts index 813ff95c5..a55ad0ca6 100644 --- a/src/Common/dataAccess/readUserDefinedFunctions.ts +++ b/src/Common/dataAccess/readUserDefinedFunctions.ts @@ -1,7 +1,7 @@ import { Resource, UserDefinedFunctionDefinition } from "@azure/cosmos"; import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { listSqlUserDefinedFunctions } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +import { listSqlUserDefinedFunctions } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/updateCollection.ts b/src/Common/dataAccess/updateCollection.ts index 2d022bbe9..cb553b77f 100644 --- a/src/Common/dataAccess/updateCollection.ts +++ b/src/Common/dataAccess/updateCollection.ts @@ -6,23 +6,20 @@ import { userContext } from "../../UserContext"; import { createUpdateCassandraTable, getCassandraTable, -} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; -import { - createUpdateGremlinGraph, - getGremlinGraph, -} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; +} from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; +import { createUpdateGremlinGraph, getGremlinGraph } from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; import { createUpdateMongoDBCollection, getMongoDBCollection, -} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; -import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; -import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/2020-04-01/tableResources"; +} from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; +import { createUpdateSqlContainer, getSqlContainer } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; +import { createUpdateTable, getTable } from "../../Utils/arm/generatedClients/cosmos/tableResources"; import { ExtendedResourceProperties, MongoDBCollectionCreateUpdateParameters, SqlContainerCreateUpdateParameters, SqlContainerResource, -} from "../../Utils/arm/generatedClients/2020-04-01/types"; +} from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/updateOffer.ts b/src/Common/dataAccess/updateOffer.ts index 7f132d729..380de430d 100644 --- a/src/Common/dataAccess/updateOffer.ts +++ b/src/Common/dataAccess/updateOffer.ts @@ -10,7 +10,7 @@ import { migrateCassandraTableToManualThroughput, updateCassandraKeyspaceThroughput, updateCassandraTableThroughput, -} from "../../Utils/arm/generatedClients/2020-04-01/cassandraResources"; +} from "../../Utils/arm/generatedClients/cosmos/cassandraResources"; import { migrateGremlinDatabaseToAutoscale, migrateGremlinDatabaseToManualThroughput, @@ -18,7 +18,7 @@ import { migrateGremlinGraphToManualThroughput, updateGremlinDatabaseThroughput, updateGremlinGraphThroughput, -} from "../../Utils/arm/generatedClients/2020-04-01/gremlinResources"; +} from "../../Utils/arm/generatedClients/cosmos/gremlinResources"; import { migrateMongoDBCollectionToAutoscale, migrateMongoDBCollectionToManualThroughput, @@ -26,7 +26,7 @@ import { migrateMongoDBDatabaseToManualThroughput, updateMongoDBCollectionThroughput, updateMongoDBDatabaseThroughput, -} from "../../Utils/arm/generatedClients/2020-04-01/mongoDBResources"; +} from "../../Utils/arm/generatedClients/cosmos/mongoDBResources"; import { migrateSqlContainerToAutoscale, migrateSqlContainerToManualThroughput, @@ -34,13 +34,13 @@ import { migrateSqlDatabaseToManualThroughput, updateSqlContainerThroughput, updateSqlDatabaseThroughput, -} from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +} from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { migrateTableToAutoscale, migrateTableToManualThroughput, updateTableThroughput, -} from "../../Utils/arm/generatedClients/2020-04-01/tableResources"; -import { ThroughputSettingsUpdateParameters } from "../../Utils/arm/generatedClients/2020-04-01/types"; +} from "../../Utils/arm/generatedClients/cosmos/tableResources"; +import { ThroughputSettingsUpdateParameters } from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { HttpHeaders } from "../Constants"; import { client } from "../CosmosClient"; diff --git a/src/Common/dataAccess/updateStoredProcedure.ts b/src/Common/dataAccess/updateStoredProcedure.ts index dd6d86f66..b3cf875a0 100644 --- a/src/Common/dataAccess/updateStoredProcedure.ts +++ b/src/Common/dataAccess/updateStoredProcedure.ts @@ -4,11 +4,11 @@ import { userContext } from "../../UserContext"; import { createUpdateSqlStoredProcedure, getSqlStoredProcedure, -} from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +} from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { SqlStoredProcedureCreateUpdateParameters, SqlStoredProcedureResource, -} from "../../Utils/arm/generatedClients/2020-04-01/types"; +} from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Common/dataAccess/updateTrigger.ts b/src/Common/dataAccess/updateTrigger.ts index d43463738..6d5afb4be 100644 --- a/src/Common/dataAccess/updateTrigger.ts +++ b/src/Common/dataAccess/updateTrigger.ts @@ -1,11 +1,8 @@ import { TriggerDefinition } from "@azure/cosmos"; import { AuthType } from "../../AuthType"; import { userContext } from "../../UserContext"; -import { createUpdateSqlTrigger, getSqlTrigger } from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; -import { - SqlTriggerCreateUpdateParameters, - SqlTriggerResource, -} from "../../Utils/arm/generatedClients/2020-04-01/types"; +import { createUpdateSqlTrigger, getSqlTrigger } from "../../Utils/arm/generatedClients/cosmos/sqlResources"; +import { SqlTriggerCreateUpdateParameters, SqlTriggerResource } from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; @@ -13,8 +10,8 @@ import { handleError } from "../ErrorHandlingUtils"; export async function updateTrigger( databaseId: string, collectionId: string, - trigger: TriggerDefinition -): Promise { + trigger: SqlTriggerResource +): Promise { const clearMessage = logConsoleProgress(`Updating trigger ${trigger.id}`); const { authType, useSDKOperations, apiType, subscriptionId, resourceGroup, databaseAccount } = userContext; try { @@ -31,7 +28,7 @@ export async function updateTrigger( if (getResponse?.properties?.resource) { const createTriggerParams: SqlTriggerCreateUpdateParameters = { properties: { - resource: trigger as SqlTriggerResource, + resource: trigger, options: {}, }, }; @@ -44,7 +41,7 @@ export async function updateTrigger( trigger.id, createTriggerParams ); - return rpResponse && (rpResponse.properties?.resource as TriggerDefinition); + return rpResponse && rpResponse.properties?.resource; } throw new Error(`Failed to update trigger: ${trigger.id} does not exist.`); @@ -54,7 +51,7 @@ export async function updateTrigger( .database(databaseId) .container(collectionId) .scripts.trigger(trigger.id) - .replace(trigger); + .replace((trigger as unknown) as TriggerDefinition); // TODO: TypeScript does not like the SQL SDK trigger type return response?.resource; } catch (error) { handleError(error, "UpdateTrigger", `Error while updating trigger ${trigger.id}`); diff --git a/src/Common/dataAccess/updateUserDefinedFunction.ts b/src/Common/dataAccess/updateUserDefinedFunction.ts index 3b9449915..f3b28bf51 100644 --- a/src/Common/dataAccess/updateUserDefinedFunction.ts +++ b/src/Common/dataAccess/updateUserDefinedFunction.ts @@ -4,11 +4,11 @@ import { userContext } from "../../UserContext"; import { createUpdateSqlUserDefinedFunction, getSqlUserDefinedFunction, -} from "../../Utils/arm/generatedClients/2020-04-01/sqlResources"; +} from "../../Utils/arm/generatedClients/cosmos/sqlResources"; import { SqlUserDefinedFunctionCreateUpdateParameters, SqlUserDefinedFunctionResource, -} from "../../Utils/arm/generatedClients/2020-04-01/types"; +} from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; import { client } from "../CosmosClient"; import { handleError } from "../ErrorHandlingUtils"; diff --git a/src/Contracts/DataModels.ts b/src/Contracts/DataModels.ts index c017ec412..7ea39c4c7 100644 --- a/src/Contracts/DataModels.ts +++ b/src/Contracts/DataModels.ts @@ -167,7 +167,7 @@ export interface KeyResource { export interface IndexingPolicy { automatic: boolean; - indexingMode: string; + indexingMode: "consistent" | "lazy" | "none"; includedPaths: any; excludedPaths: any; compositeIndexes?: any; @@ -176,7 +176,7 @@ export interface IndexingPolicy { export interface PartitionKey { paths: string[]; - kind: string; + kind: "Hash" | "Range" | "MultiHash"; version: number; systemKey?: boolean; } diff --git a/src/Contracts/ViewModels.ts b/src/Contracts/ViewModels.ts index 9fb242f79..b74862008 100644 --- a/src/Contracts/ViewModels.ts +++ b/src/Contracts/ViewModels.ts @@ -15,6 +15,7 @@ import StoredProcedure from "../Explorer/Tree/StoredProcedure"; import Trigger from "../Explorer/Tree/Trigger"; import UserDefinedFunction from "../Explorer/Tree/UserDefinedFunction"; import { SelfServeType } from "../SelfServe/SelfServeUtils"; +import { SqlTriggerResource } from "../Utils/arm/generatedClients/cosmos/types"; import * as DataModels from "./DataModels"; import { SubscriptionType } from "./SubscriptionType"; @@ -175,7 +176,7 @@ export interface Collection extends CollectionBase { createStoredProcedureNode(data: StoredProcedureDefinition & Resource): StoredProcedure; createUserDefinedFunctionNode(data: UserDefinedFunctionDefinition & Resource): UserDefinedFunction; - createTriggerNode(data: TriggerDefinition & Resource): Trigger; + createTriggerNode(data: TriggerDefinition | SqlTriggerResource): Trigger; findStoredProcedureWithId(sprocRid: string): StoredProcedure; findTriggerWithId(triggerRid: string): Trigger; findUserDefinedFunctionWithId(udfRid: string): UserDefinedFunction; diff --git a/src/Explorer/Controls/Settings/SettingsComponent.tsx b/src/Explorer/Controls/Settings/SettingsComponent.tsx index 9e8a93ffe..2559c17a6 100644 --- a/src/Explorer/Controls/Settings/SettingsComponent.tsx +++ b/src/Explorer/Controls/Settings/SettingsComponent.tsx @@ -14,7 +14,7 @@ import * as ViewModels from "../../../Contracts/ViewModels"; import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants"; import { trace, traceFailure, traceStart, traceSuccess } from "../../../Shared/Telemetry/TelemetryProcessor"; import { userContext } from "../../../UserContext"; -import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/2020-04-01/types"; +import { MongoDBCollectionResource, MongoIndex } from "../../../Utils/arm/generatedClients/cosmos/types"; import * as AutoPilotUtils from "../../../Utils/AutoPilotUtils"; import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent"; import Explorer from "../../Explorer"; diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/IndexingPolicyComponent.test.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/IndexingPolicyComponent.test.tsx index f179c95e1..ca76e1387 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/IndexingPolicyComponent.test.tsx +++ b/src/Explorer/Controls/Settings/SettingsSubComponents/IndexingPolicyComponent.test.tsx @@ -1,12 +1,12 @@ import { shallow } from "enzyme"; import React from "react"; -import { IndexingPolicyComponent, IndexingPolicyComponentProps } from "./IndexingPolicyComponent"; import * as DataModels from "../../../../Contracts/DataModels"; +import { IndexingPolicyComponent, IndexingPolicyComponentProps } from "./IndexingPolicyComponent"; describe("IndexingPolicyComponent", () => { const initialIndexingPolicyContent: DataModels.IndexingPolicy = { automatic: false, - indexingMode: "", + indexingMode: "consistent", includedPaths: [], excludedPaths: [], }; diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.tsx index 7fdc5ca94..87ff37d75 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.tsx +++ b/src/Explorer/Controls/Settings/SettingsSubComponents/MongoIndexingPolicy/MongoIndexingPolicyComponent.tsx @@ -1,44 +1,44 @@ -import * as React from "react"; import { DetailsList, DetailsListLayoutMode, - Stack, - IconButton, - Text, - SelectionMode, IColumn, + IconButton, MessageBar, MessageBarType, + SelectionMode, + Separator, Spinner, SpinnerSize, - Separator, + Stack, + Text, } from "@fluentui/react"; +import * as React from "react"; +import { MongoIndex } from "../../../../../Utils/arm/generatedClients/cosmos/types"; +import { CollapsibleSectionComponent } from "../../../CollapsiblePanel/CollapsibleSectionComponent"; import { addMongoIndexStackProps, - customDetailsListStyles, - mongoIndexingPolicyDisclaimer, - mediumWidthStackStyles, - subComponentStackProps, createAndAddMongoIndexStackProps, - separatorStyles, + customDetailsListStyles, indexingPolicynUnsavedWarningMessage, infoAndToolTipTextStyle, - onRenderRow, + mediumWidthStackStyles, mongoCompoundIndexNotSupportedMessage, + mongoIndexingPolicyDisclaimer, + onRenderRow, + separatorStyles, + subComponentStackProps, } from "../../SettingsRenderUtils"; -import { MongoIndex } from "../../../../../Utils/arm/generatedClients/2020-04-01/types"; import { - MongoIndexTypes, AddMongoIndexProps, - MongoIndexIdField, - MongoNotificationType, getMongoIndexType, getMongoIndexTypeText, isIndexTransforming, + MongoIndexIdField, + MongoIndexTypes, + MongoNotificationType, } from "../../SettingsUtils"; -import { AddMongoIndexComponent } from "./AddMongoIndexComponent"; -import { CollapsibleSectionComponent } from "../../../CollapsiblePanel/CollapsibleSectionComponent"; import { IndexingPolicyRefreshComponent } from "../IndexingPolicyRefresh/IndexingPolicyRefreshComponent"; +import { AddMongoIndexComponent } from "./AddMongoIndexComponent"; export interface MongoIndexingPolicyComponentProps { mongoIndexes: MongoIndex[]; diff --git a/src/Explorer/Controls/Settings/SettingsUtils.tsx b/src/Explorer/Controls/Settings/SettingsUtils.tsx index 6deee03b1..a533b6446 100644 --- a/src/Explorer/Controls/Settings/SettingsUtils.tsx +++ b/src/Explorer/Controls/Settings/SettingsUtils.tsx @@ -1,7 +1,7 @@ -import * as ViewModels from "../../../Contracts/ViewModels"; -import * as DataModels from "../../../Contracts/DataModels"; import * as Constants from "../../../Common/Constants"; -import { MongoIndex } from "../../../Utils/arm/generatedClients/2020-04-01/types"; +import * as DataModels from "../../../Contracts/DataModels"; +import * as ViewModels from "../../../Contracts/ViewModels"; +import { MongoIndex } from "../../../Utils/arm/generatedClients/cosmos/types"; const zeroValue = 0; export type isDirtyTypes = boolean | string | number | DataModels.IndexingPolicy; diff --git a/src/Explorer/Controls/Settings/TestUtils.tsx b/src/Explorer/Controls/Settings/TestUtils.tsx index 486a5259f..f388dffd7 100644 --- a/src/Explorer/Controls/Settings/TestUtils.tsx +++ b/src/Explorer/Controls/Settings/TestUtils.tsx @@ -1,7 +1,7 @@ +import ko from "knockout"; import * as DataModels from "../../../Contracts/DataModels"; import * as ViewModels from "../../../Contracts/ViewModels"; import Explorer from "../../Explorer"; -import ko from "knockout"; export const container = new Explorer(); @@ -13,7 +13,7 @@ export const collection = ({ analyticalStorageTtl: ko.observable(undefined), indexingPolicy: ko.observable({ automatic: true, - indexingMode: "default", + indexingMode: "consistent", includedPaths: [], excludedPaths: [], }), diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap index 2e9aaa7eb..dc217ed3f 100644 --- a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap +++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap @@ -3619,7 +3619,7 @@ exports[`SettingsComponent renders 1`] = ` "automatic": true, "excludedPaths": Array [], "includedPaths": Array [], - "indexingMode": "default", + "indexingMode": "consistent", } } indexingPolicyContentBaseline={ @@ -3627,7 +3627,7 @@ exports[`SettingsComponent renders 1`] = ` "automatic": true, "excludedPaths": Array [], "includedPaths": Array [], - "indexingMode": "default", + "indexingMode": "consistent", } } logIndexingPolicySuccessMessage={[Function]} diff --git a/src/Explorer/Panes/AddCollectionPanel.tsx b/src/Explorer/Panes/AddCollectionPanel.tsx index 0af7c3225..c7438591c 100644 --- a/src/Explorer/Panes/AddCollectionPanel.tsx +++ b/src/Explorer/Panes/AddCollectionPanel.tsx @@ -20,7 +20,7 @@ import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils" import { configContext, Platform } from "../../ConfigContext"; import * as DataModels from "../../Contracts/DataModels"; import { SubscriptionType } from "../../Contracts/SubscriptionType"; -import { CollectionCreation, IndexingPolicies } from "../../Shared/Constants"; +import { CollectionCreation } from "../../Shared/Constants"; import { Action } from "../../Shared/Telemetry/TelemetryConstants"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; import { userContext } from "../../UserContext"; @@ -41,6 +41,40 @@ export interface AddCollectionPanelProps { databaseId?: string; } +const SharedDatabaseDefault: DataModels.IndexingPolicy = { + indexingMode: "consistent", + automatic: true, + includedPaths: [], + excludedPaths: [ + { + path: "/*", + }, + ], +}; + +const AllPropertiesIndexed: DataModels.IndexingPolicy = { + indexingMode: "consistent", + automatic: true, + includedPaths: [ + { + path: "/*", + indexes: [ + { + kind: "Range", + dataType: "Number", + precision: -1, + }, + { + kind: "Range", + dataType: "String", + precision: -1, + }, + ], + }, + ], + excludedPaths: [], +}; + export interface AddCollectionPanelState { createNewDatabase: boolean; newDatabaseId: string; @@ -955,14 +989,14 @@ export class AddCollectionPanel extends React.Component Promise; + public abstract onSaveClick: () => void; public abstract onUpdateClick: () => Promise; public onDiscard = (): Q.Promise => { @@ -205,16 +205,6 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode return Q(); }; - public onSaveOrUpdateClick(): Promise { - if (this.saveButton.visible()) { - return this.onSaveClick(); - } else if (this.updateButton.visible()) { - return this.onUpdateClick(); - } - - return undefined; - } - protected getTabsButtons(): CommandButtonComponentProps[] { const buttons: CommandButtonComponentProps[] = []; const label = "Save"; diff --git a/src/Explorer/Tabs/TriggerTab.ts b/src/Explorer/Tabs/TriggerTab.ts index 54cd47c3f..c74fc67ab 100644 --- a/src/Explorer/Tabs/TriggerTab.ts +++ b/src/Explorer/Tabs/TriggerTab.ts @@ -1,4 +1,3 @@ -import { Resource, TriggerDefinition, TriggerOperation, TriggerType } from "@azure/cosmos"; import * as Constants from "../../Common/Constants"; import { createTrigger } from "../../Common/dataAccess/createTrigger"; import { updateTrigger } from "../../Common/dataAccess/updateTrigger"; @@ -7,6 +6,7 @@ import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils" import * as ViewModels from "../../Contracts/ViewModels"; import { Action } from "../../Shared/Telemetry/TelemetryConstants"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; +import { SqlTriggerResource } from "../../Utils/arm/generatedClients/cosmos/types"; import Trigger from "../Tree/Trigger"; import ScriptTabBase from "./ScriptTabBase"; import template from "./TriggerTab.html"; @@ -30,12 +30,12 @@ export default class TriggerTab extends ScriptTabBase { super.buildCommandBarOptions(); } - public onSaveClick = (): Promise => { - return this._createTrigger({ + public onSaveClick = (): void => { + this._createTrigger({ id: this.id(), body: this.editorContent(), - triggerOperation: this.triggerOperation() as TriggerOperation, - triggerType: this.triggerType() as TriggerType, + triggerOperation: this.triggerOperation() as SqlTriggerResource["triggerOperation"], + triggerType: this.triggerType() as SqlTriggerResource["triggerType"], }); }; @@ -50,8 +50,8 @@ export default class TriggerTab extends ScriptTabBase { return updateTrigger(this.collection.databaseId, this.collection.id(), { id: this.id(), body: this.editorContent(), - triggerOperation: this.triggerOperation() as TriggerOperation, - triggerType: this.triggerType() as TriggerType, + triggerOperation: this.triggerOperation() as SqlTriggerResource["triggerOperation"], + triggerType: this.triggerType() as SqlTriggerResource["triggerType"], }) .then( (createdResource) => { @@ -117,7 +117,7 @@ export default class TriggerTab extends ScriptTabBase { } } - private _createTrigger(resource: TriggerDefinition): Promise { + private _createTrigger(resource: SqlTriggerResource): void { this.isExecutionError(false); this.isExecuting(true); const startKey: number = TelemetryProcessor.traceStart(Action.CreateTrigger, { @@ -125,7 +125,8 @@ export default class TriggerTab extends ScriptTabBase { tabTitle: this.tabTitle(), }); - return createTrigger(this.collection.databaseId, this.collection.id(), resource) + resource.body = String(resource.body); // Ensure trigger body is converted to string + createTrigger(this.collection.databaseId, this.collection.id(), resource) .then( (createdResource) => { this.tabTitle(createdResource.id); diff --git a/src/Explorer/Tree/Collection.ts b/src/Explorer/Tree/Collection.ts index 1239b1257..5ec6c2803 100644 --- a/src/Explorer/Tree/Collection.ts +++ b/src/Explorer/Tree/Collection.ts @@ -18,6 +18,7 @@ import { UploadDetailsRecord } from "../../Contracts/ViewModels"; import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; import { userContext } from "../../UserContext"; +import { SqlTriggerResource } from "../../Utils/arm/generatedClients/cosmos/types"; import { logConsoleInfo } from "../../Utils/NotificationConsoleUtils"; import Explorer from "../Explorer"; import { CassandraAPIDataClient, CassandraTableKey, CassandraTableKeys } from "../Tables/TableDataClient"; @@ -962,7 +963,9 @@ export default class Collection implements ViewModels.Collection { public loadTriggers(): Promise { return readTriggers(this.databaseId, this.id()).then((triggers) => { - const triggerNodes: ViewModels.TreeNode[] = triggers.map((trigger) => new Trigger(this.container, this, trigger)); + const triggerNodes: ViewModels.TreeNode[] = triggers.map( + (trigger: SqlTriggerResource | TriggerDefinition) => new Trigger(this.container, this, trigger) + ); const otherNodes = this.children().filter((node) => node.nodeKind !== "Trigger"); const allNodes = otherNodes.concat(triggerNodes); this.children(allNodes); diff --git a/src/SelfServe/Example/SelfServeExample.rp.ts b/src/SelfServe/Example/SelfServeExample.rp.ts index 360a8717a..8762c1862 100644 --- a/src/SelfServe/Example/SelfServeExample.rp.ts +++ b/src/SelfServe/Example/SelfServeExample.rp.ts @@ -1,6 +1,6 @@ import { SessionStorageUtility } from "../../Shared/StorageUtility"; import { userContext } from "../../UserContext"; -import { get } from "../../Utils/arm/generatedClients/2020-04-01/databaseAccounts"; +import { get } from "../../Utils/arm/generatedClients/cosmos/databaseAccounts"; import { RefreshResult } from "../SelfServeTypes"; import { AccountProps, Regions } from "./SelfServeExample.types"; diff --git a/src/Shared/Constants.ts b/src/Shared/Constants.ts index b242cb67f..a316b4c77 100644 --- a/src/Shared/Constants.ts +++ b/src/Shared/Constants.ts @@ -187,42 +187,6 @@ export const CollectionCreationDefaults = { }, } as const; -export class IndexingPolicies { - public static SharedDatabaseDefault = { - indexingMode: "consistent", - automatic: true, - includedPaths: [], - excludedPaths: [ - { - path: "/*", - }, - ], - }; - - public static AllPropertiesIndexed = { - indexingMode: "consistent", - automatic: true, - includedPaths: [ - { - path: "/*", - indexes: [ - { - kind: "Range", - dataType: "Number", - precision: -1, - }, - { - kind: "Range", - dataType: "String", - precision: -1, - }, - ], - }, - ], - excludedPaths: [], - }; -} - export class SubscriptionUtilMappings { public static FreeTierSubscriptionIds: string[] = [ "b8f2ff04-0a81-4cf9-95ef-5828d16981d2", diff --git a/src/Utils/QueryUtils.test.ts b/src/Utils/QueryUtils.test.ts index 76e525a06..820a64e49 100644 --- a/src/Utils/QueryUtils.test.ts +++ b/src/Utils/QueryUtils.test.ts @@ -1,6 +1,6 @@ -import * as DataModels from "../Contracts/DataModels"; import * as Q from "q"; import * as sinon from "sinon"; +import * as DataModels from "../Contracts/DataModels"; import * as ViewModels from "../Contracts/ViewModels"; import * as QueryUtils from "./QueryUtils"; @@ -8,7 +8,7 @@ describe("Query Utils", () => { function generatePartitionKeyForPath(path: string): DataModels.PartitionKey { return { paths: [path], - kind: "hash", + kind: "Hash", version: 2, }; } diff --git a/src/Utils/arm/generatedClients/2020-04-01/cassandraResources.ts b/src/Utils/arm/generatedClients/cosmos/cassandraResources.ts similarity index 94% rename from src/Utils/arm/generatedClients/2020-04-01/cassandraResources.ts rename to src/Utils/arm/generatedClients/cosmos/cassandraResources.ts index 924f30bb6..d843d4c15 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/cassandraResources.ts +++ b/src/Utils/arm/generatedClients/cosmos/cassandraResources.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. */ export async function listCassandraKeyspaces( @@ -82,7 +84,7 @@ export async function migrateCassandraKeyspaceToAutoscale( resourceGroupName: string, accountName: string, keyspaceName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -93,7 +95,7 @@ export async function migrateCassandraKeyspaceToManualThroughput( resourceGroupName: string, accountName: string, keyspaceName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -178,7 +180,7 @@ export async function migrateCassandraTableToAutoscale( accountName: string, keyspaceName: string, tableName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -190,7 +192,7 @@ export async function migrateCassandraTableToManualThroughput( accountName: string, keyspaceName: string, tableName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } diff --git a/src/Utils/arm/generatedClients/2020-04-01/collection.ts b/src/Utils/arm/generatedClients/cosmos/collection.ts similarity index 86% rename from src/Utils/arm/generatedClients/2020-04-01/collection.ts rename to src/Utils/arm/generatedClients/cosmos/collection.ts index 307cd91f6..ab92b2219 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/collection.ts +++ b/src/Utils/arm/generatedClients/cosmos/collection.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the metrics determined by the given filter for the given database account and collection. */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/collectionPartition.ts b/src/Utils/arm/generatedClients/cosmos/collectionPartition.ts similarity index 82% rename from src/Utils/arm/generatedClients/2020-04-01/collectionPartition.ts rename to src/Utils/arm/generatedClients/cosmos/collectionPartition.ts index d0dad687c..400502e7a 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/collectionPartition.ts +++ b/src/Utils/arm/generatedClients/cosmos/collectionPartition.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the metrics determined by the given filter for the given collection, split by partition. */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/collectionPartitionRegion.ts b/src/Utils/arm/generatedClients/cosmos/collectionPartitionRegion.ts similarity index 73% rename from src/Utils/arm/generatedClients/2020-04-01/collectionPartitionRegion.ts rename to src/Utils/arm/generatedClients/cosmos/collectionPartitionRegion.ts index 8b49edc80..4ef525b35 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/collectionPartitionRegion.ts +++ b/src/Utils/arm/generatedClients/cosmos/collectionPartitionRegion.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/collectionRegion.ts b/src/Utils/arm/generatedClients/cosmos/collectionRegion.ts similarity index 73% rename from src/Utils/arm/generatedClients/2020-04-01/collectionRegion.ts rename to src/Utils/arm/generatedClients/cosmos/collectionRegion.ts index 2c149656e..9669d8b1f 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/collectionRegion.ts +++ b/src/Utils/arm/generatedClients/cosmos/collectionRegion.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the metrics determined by the given filter for the given database account, collection and region. */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/database.ts b/src/Utils/arm/generatedClients/cosmos/database.ts similarity index 85% rename from src/Utils/arm/generatedClients/2020-04-01/database.ts rename to src/Utils/arm/generatedClients/cosmos/database.ts index eeec5ce07..1bf4cf8c5 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/database.ts +++ b/src/Utils/arm/generatedClients/cosmos/database.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the metrics determined by the given filter for the given database account and database. */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/databaseAccountRegion.ts b/src/Utils/arm/generatedClients/cosmos/databaseAccountRegion.ts similarity index 70% rename from src/Utils/arm/generatedClients/2020-04-01/databaseAccountRegion.ts rename to src/Utils/arm/generatedClients/cosmos/databaseAccountRegion.ts index 1dbb7159b..ca69022b0 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/databaseAccountRegion.ts +++ b/src/Utils/arm/generatedClients/cosmos/databaseAccountRegion.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the metrics determined by the given filter for the given database account and region. */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/databaseAccounts.ts b/src/Utils/arm/generatedClients/cosmos/databaseAccounts.ts similarity index 96% rename from src/Utils/arm/generatedClients/2020-04-01/databaseAccounts.ts rename to src/Utils/arm/generatedClients/cosmos/databaseAccounts.ts index 499213664..87b00b24b 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/databaseAccounts.ts +++ b/src/Utils/arm/generatedClients/cosmos/databaseAccounts.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the properties of an existing Azure Cosmos DB database account. */ export async function get( diff --git a/src/Utils/arm/generatedClients/2020-04-01/gremlinResources.ts b/src/Utils/arm/generatedClients/cosmos/gremlinResources.ts similarity index 94% rename from src/Utils/arm/generatedClients/2020-04-01/gremlinResources.ts rename to src/Utils/arm/generatedClients/cosmos/gremlinResources.ts index 26a1fa5b2..572ef4859 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/gremlinResources.ts +++ b/src/Utils/arm/generatedClients/cosmos/gremlinResources.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */ export async function listGremlinDatabases( @@ -82,7 +84,7 @@ export async function migrateGremlinDatabaseToAutoscale( resourceGroupName: string, accountName: string, databaseName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -93,7 +95,7 @@ export async function migrateGremlinDatabaseToManualThroughput( resourceGroupName: string, accountName: string, databaseName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -178,7 +180,7 @@ export async function migrateGremlinGraphToAutoscale( accountName: string, databaseName: string, graphName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -190,7 +192,7 @@ export async function migrateGremlinGraphToManualThroughput( accountName: string, databaseName: string, graphName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } diff --git a/src/Utils/arm/generatedClients/2020-04-01/mongoDBResources.ts b/src/Utils/arm/generatedClients/cosmos/mongoDBResources.ts similarity index 93% rename from src/Utils/arm/generatedClients/2020-04-01/mongoDBResources.ts rename to src/Utils/arm/generatedClients/cosmos/mongoDBResources.ts index e3a3e9439..61f2ee5ae 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/mongoDBResources.ts +++ b/src/Utils/arm/generatedClients/cosmos/mongoDBResources.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */ export async function listMongoDBDatabases( @@ -71,7 +73,7 @@ export async function updateMongoDBDatabaseThroughput( accountName: string, databaseName: string, body: Types.ThroughputSettingsUpdateParameters -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body }); } @@ -82,7 +84,7 @@ export async function migrateMongoDBDatabaseToAutoscale( resourceGroupName: string, accountName: string, databaseName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -93,7 +95,7 @@ export async function migrateMongoDBDatabaseToManualThroughput( resourceGroupName: string, accountName: string, databaseName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -178,7 +180,7 @@ export async function migrateMongoDBCollectionToAutoscale( accountName: string, databaseName: string, collectionName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -190,7 +192,7 @@ export async function migrateMongoDBCollectionToManualThroughput( accountName: string, databaseName: string, collectionName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } diff --git a/src/Utils/arm/generatedClients/2020-04-01/operations.ts b/src/Utils/arm/generatedClients/cosmos/operations.ts similarity index 61% rename from src/Utils/arm/generatedClients/2020-04-01/operations.ts rename to src/Utils/arm/generatedClients/cosmos/operations.ts index 31de2d66e..db16f7bfc 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/operations.ts +++ b/src/Utils/arm/generatedClients/cosmos/operations.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Lists all of the available Cosmos DB Resource Provider operations. */ export async function list(): Promise { diff --git a/src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeId.ts b/src/Utils/arm/generatedClients/cosmos/partitionKeyRangeId.ts similarity index 73% rename from src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeId.ts rename to src/Utils/arm/generatedClients/cosmos/partitionKeyRangeId.ts index 4b6a64d64..20c85cdd2 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeId.ts +++ b/src/Utils/arm/generatedClients/cosmos/partitionKeyRangeId.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the metrics determined by the given filter for the given partition key range id. */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeIdRegion.ts b/src/Utils/arm/generatedClients/cosmos/partitionKeyRangeIdRegion.ts similarity index 74% rename from src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeIdRegion.ts rename to src/Utils/arm/generatedClients/cosmos/partitionKeyRangeIdRegion.ts index 7655610ef..eb8a00b9b 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeIdRegion.ts +++ b/src/Utils/arm/generatedClients/cosmos/partitionKeyRangeIdRegion.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Retrieves the metrics determined by the given filter for the given partition key range id and region. */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/percentile.ts b/src/Utils/arm/generatedClients/cosmos/percentile.ts similarity index 71% rename from src/Utils/arm/generatedClients/2020-04-01/percentile.ts rename to src/Utils/arm/generatedClients/cosmos/percentile.ts index 946b35219..f30a503fd 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/percentile.ts +++ b/src/Utils/arm/generatedClients/cosmos/percentile.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-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 */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/percentileSourceTarget.ts b/src/Utils/arm/generatedClients/cosmos/percentileSourceTarget.ts similarity index 74% rename from src/Utils/arm/generatedClients/2020-04-01/percentileSourceTarget.ts rename to src/Utils/arm/generatedClients/cosmos/percentileSourceTarget.ts index df90f5ac7..37a3f841c 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/percentileSourceTarget.ts +++ b/src/Utils/arm/generatedClients/cosmos/percentileSourceTarget.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-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 */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/percentileTarget.ts b/src/Utils/arm/generatedClients/cosmos/percentileTarget.ts similarity index 72% rename from src/Utils/arm/generatedClients/2020-04-01/percentileTarget.ts rename to src/Utils/arm/generatedClients/cosmos/percentileTarget.ts index f729c4a92..a318d5dd1 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/percentileTarget.ts +++ b/src/Utils/arm/generatedClients/cosmos/percentileTarget.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-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 */ export async function listMetrics( diff --git a/src/Utils/arm/generatedClients/2020-04-01/sqlResources.ts b/src/Utils/arm/generatedClients/cosmos/sqlResources.ts similarity index 96% rename from src/Utils/arm/generatedClients/2020-04-01/sqlResources.ts rename to src/Utils/arm/generatedClients/cosmos/sqlResources.ts index 7755731c2..40c68fb86 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/sqlResources.ts +++ b/src/Utils/arm/generatedClients/cosmos/sqlResources.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Lists the SQL databases under an existing Azure Cosmos DB database account. */ export async function listSqlDatabases( @@ -82,7 +84,7 @@ export async function migrateSqlDatabaseToAutoscale( resourceGroupName: string, accountName: string, databaseName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -93,7 +95,7 @@ export async function migrateSqlDatabaseToManualThroughput( resourceGroupName: string, accountName: string, databaseName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -178,7 +180,7 @@ export async function migrateSqlContainerToAutoscale( accountName: string, databaseName: string, containerName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -190,7 +192,7 @@ export async function migrateSqlContainerToManualThroughput( accountName: string, databaseName: string, containerName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } diff --git a/src/Utils/arm/generatedClients/2020-04-01/tableResources.ts b/src/Utils/arm/generatedClients/cosmos/tableResources.ts similarity index 90% rename from src/Utils/arm/generatedClients/2020-04-01/tableResources.ts rename to src/Utils/arm/generatedClients/cosmos/tableResources.ts index ede7fbcb4..b68c20b08 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/tableResources.ts +++ b/src/Utils/arm/generatedClients/cosmos/tableResources.ts @@ -1,13 +1,15 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ +import { configContext } from "../../../../ConfigContext"; import { armRequest } from "../../request"; import * as Types from "./types"; -import { configContext } from "../../../../ConfigContext"; -const apiVersion = "2020-04-01"; +const apiVersion = "2021-04-15"; /* Lists the Tables under an existing Azure Cosmos DB database account. */ export async function listTables( @@ -82,7 +84,7 @@ export async function migrateTableToAutoscale( resourceGroupName: string, accountName: string, tableName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default/migrateToAutoscale`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } @@ -93,7 +95,7 @@ export async function migrateTableToManualThroughput( resourceGroupName: string, accountName: string, tableName: string -): Promise { +): Promise { const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default/migrateToManualThroughput`; return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); } diff --git a/src/Utils/arm/generatedClients/2020-04-01/types.ts b/src/Utils/arm/generatedClients/cosmos/types.ts similarity index 89% rename from src/Utils/arm/generatedClients/2020-04-01/types.ts rename to src/Utils/arm/generatedClients/cosmos/types.ts index 97eebbf13..9efc80d20 100644 --- a/src/Utils/arm/generatedClients/2020-04-01/types.ts +++ b/src/Utils/arm/generatedClients/cosmos/types.ts @@ -1,7 +1,9 @@ /* AUTOGENERATED FILE - Do not manually edit 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/cosmos-db.json */ /* The List operation response, that contains the database accounts and their properties. */ @@ -90,6 +92,12 @@ export interface ErrorResponse { message?: string; } +/* An error response from the service. */ +export interface CloudError { + /* undocumented */ + error?: ErrorResponse; +} + /* The list of new failover policies for the failover priority change. */ export interface FailoverPolicies { /* List of failover policies. */ @@ -156,22 +164,23 @@ export interface ARMProxyResource { /* An Azure Cosmos DB database account. */ export type DatabaseAccountGetResults = ARMResourceProperties & { /* Indicates the type of database account. This can only be set at database account creation. */ - kind?: string; + kind?: "GlobalDocumentDB" | "MongoDB" | "Parse"; + + /* undocumented */ + identity?: ManagedServiceIdentity; + /* undocumented */ properties?: DatabaseAccountGetProperties; }; /* The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin graphs. */ -// TODO: ExtendedResourceProperties was missing some properties such as _self which was manually added. Need to fix this in the RP spec. export interface ExtendedResourceProperties { /* A system generated property. A unique identifier. */ readonly _rid?: string; /* A system generated property that denotes the last updated timestamp of the resource. */ - readonly _ts?: unknown; + readonly _ts?: number; /* A system generated property representing the resource etag required for optimistic concurrency control. */ - readonly _etag: string; - // TODO: This property was manually added. It should be auto-generated like the other properties. - readonly _self: string; + readonly _etag?: string; } /* An Azure Cosmos DB resource throughput. */ @@ -351,7 +360,8 @@ export interface GremlinGraphGetProperties { /* The consistency policy for the Cosmos DB database account. */ export interface ConsistencyPolicy { /* The default consistency level and configuration settings of the Cosmos DB account. */ - defaultConsistencyLevel: string; + defaultConsistencyLevel: "Eventual" | "Session" | "BoundedStaleness" | "Strong" | "ConsistentPrefix"; + /* When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. */ maxStalenessPrefix?: number; /* When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. */ @@ -411,7 +421,7 @@ export interface DatabaseAccountGetProperties { virtualNetworkRules?: VirtualNetworkRule[]; /* List of Private Endpoint Connections configured for the Cosmos DB account. */ - readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly privateEndpointConnections?: unknown[]; /* Enables the account to write in multiple locations */ enableMultipleWriteLocations?: boolean; @@ -424,6 +434,8 @@ export interface DatabaseAccountGetProperties { disableKeyBasedMetadataWriteAccess?: boolean; /* The URI of the key vault */ keyVaultKeyUri?: string; + /* The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. */ + defaultIdentity?: string; /* Whether requests from Public Network are allowed */ publicNetworkAccess?: PublicNetworkAccess; @@ -434,8 +446,17 @@ export interface DatabaseAccountGetProperties { /* Flag to indicate whether to enable storage analytics. */ enableAnalyticalStorage?: boolean; + /* The object representing the policy for taking backups on an account. */ + backupPolicy?: BackupPolicy; + /* The CORS policy for the Cosmos DB database account. */ cors?: CorsPolicy[]; + + /* Indicates what services are allowed to bypass firewall checks. */ + networkAclBypass?: NetworkAclBypass; + + /* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */ + networkAclBypassResourceIds?: unknown[]; } /* Properties to create and update Azure Cosmos DB database accounts. */ @@ -473,6 +494,8 @@ export interface DatabaseAccountCreateUpdateProperties { disableKeyBasedMetadataWriteAccess?: boolean; /* The URI of the key vault */ keyVaultKeyUri?: string; + /* The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. */ + defaultIdentity?: string; /* Whether requests from Public Network are allowed */ publicNetworkAccess?: PublicNetworkAccess; @@ -483,14 +506,27 @@ export interface DatabaseAccountCreateUpdateProperties { /* Flag to indicate whether to enable storage analytics. */ enableAnalyticalStorage?: boolean; + /* The object representing the policy for taking backups on an account. */ + backupPolicy?: BackupPolicy; + /* The CORS policy for the Cosmos DB database account. */ cors?: CorsPolicy[]; + + /* Indicates what services are allowed to bypass firewall checks. */ + networkAclBypass?: NetworkAclBypass; + + /* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */ + networkAclBypassResourceIds?: unknown[]; } /* Parameters to create and update Cosmos DB database accounts. */ export type DatabaseAccountCreateUpdateParameters = ARMResourceProperties & { /* Indicates the type of database account. This can only be set at database account creation. */ - kind?: string; + kind?: "GlobalDocumentDB" | "MongoDB" | "Parse"; + + /* undocumented */ + identity?: ManagedServiceIdentity; + /* undocumented */ properties: DatabaseAccountCreateUpdateProperties; }; @@ -527,6 +563,8 @@ export interface DatabaseAccountUpdateProperties { disableKeyBasedMetadataWriteAccess?: boolean; /* The URI of the key vault */ keyVaultKeyUri?: string; + /* The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. */ + defaultIdentity?: string; /* Whether requests from Public Network are allowed */ publicNetworkAccess?: PublicNetworkAccess; @@ -537,8 +575,17 @@ export interface DatabaseAccountUpdateProperties { /* Flag to indicate whether to enable storage analytics. */ enableAnalyticalStorage?: boolean; + /* The object representing the policy for taking backups on an account. */ + backupPolicy?: BackupPolicy; + /* The CORS policy for the Cosmos DB database account. */ cors?: CorsPolicy[]; + + /* Indicates what services are allowed to bypass firewall checks. */ + networkAclBypass?: NetworkAclBypass; + + /* An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. */ + networkAclBypassResourceIds?: unknown[]; } /* Parameters for patching Azure Cosmos DB database account properties. */ @@ -548,6 +595,9 @@ export interface DatabaseAccountUpdateParameters { /* The location of the resource group to which the resource belongs. */ location?: string; + /* undocumented */ + identity?: ManagedServiceIdentity; + /* undocumented */ properties?: DatabaseAccountUpdateProperties; } @@ -585,7 +635,7 @@ export interface DatabaseAccountListConnectionStringsResult { /* Parameters to regenerate the keys within the database account. */ export interface DatabaseAccountRegenerateKeyParameters { /* The access key to regenerate. */ - keyKind: string; + keyKind: "primary" | "secondary" | "primaryReadonly" | "secondaryReadonly"; } /* The offer type for the Cosmos DB database account. */ @@ -615,7 +665,7 @@ export interface SqlDatabaseCreateUpdateProperties { resource: SqlDatabaseResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB container. */ @@ -630,7 +680,7 @@ export interface SqlContainerCreateUpdateProperties { resource: SqlContainerResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB storedProcedure. */ @@ -645,7 +695,7 @@ export interface SqlStoredProcedureCreateUpdateProperties { resource: SqlStoredProcedureResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB userDefinedFunction. */ @@ -660,7 +710,7 @@ export interface SqlUserDefinedFunctionCreateUpdateProperties { resource: SqlUserDefinedFunctionResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB trigger. */ @@ -675,7 +725,7 @@ export interface SqlTriggerCreateUpdateProperties { resource: SqlTriggerResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB MongoDB database. */ @@ -690,7 +740,7 @@ export interface MongoDBDatabaseCreateUpdateProperties { resource: MongoDBDatabaseResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB MongoDB collection. */ @@ -705,7 +755,7 @@ export interface MongoDBCollectionCreateUpdateProperties { resource: MongoDBCollectionResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB Table. */ @@ -720,7 +770,7 @@ export interface TableCreateUpdateProperties { resource: TableResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB Cassandra keyspace. */ @@ -735,7 +785,7 @@ export interface CassandraKeyspaceCreateUpdateProperties { resource: CassandraKeyspaceResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB Cassandra table. */ @@ -750,7 +800,7 @@ export interface CassandraTableCreateUpdateProperties { resource: CassandraTableResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB Gremlin database. */ @@ -765,7 +815,7 @@ export interface GremlinDatabaseCreateUpdateProperties { resource: GremlinDatabaseResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Parameters to create and update Cosmos DB Gremlin graph. */ @@ -780,7 +830,7 @@ export interface GremlinGraphCreateUpdateProperties { resource: GremlinGraphResource; /* A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. */ - options: CreateUpdateOptions; + options?: CreateUpdateOptions; } /* Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. */ @@ -853,8 +903,7 @@ export interface SqlContainerResource { /* The conflict resolution policy for the container. */ conflictResolutionPolicy?: ConflictResolutionPolicy; - //TODO: this property is manually added. It should be auto-generated instead. Need to be fixed in the API spec. - /* Analytical storage time to live */ + /* Analytical TTL. */ analyticalStorageTtl?: number; } @@ -863,7 +912,8 @@ export interface IndexingPolicy { /* Indicates if the indexing policy is automatic */ automatic?: boolean; /* Indicates the indexing mode. */ - indexingMode?: string; + indexingMode?: "consistent" | "lazy" | "none"; + /* List of paths to include in the indexing */ includedPaths?: IncludedPath[]; @@ -894,11 +944,12 @@ export interface IncludedPath { /* The indexes for the path. */ export interface Indexes { /* The datatype for which the indexing behavior is applied to. */ - dataType?: string; + dataType?: "String" | "Number" | "Point" | "Polygon" | "LineString" | "MultiPolygon"; + /* The precision of the index. -1 is maximum precision. */ precision?: number; /* Indicates the type of index. */ - kind?: string; + kind?: "Hash" | "Range" | "Spatial"; } /* List of composite path */ @@ -909,7 +960,7 @@ export interface CompositePath { /* The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) */ path?: string; /* Sort order for composite paths. */ - order?: string; + order?: "ascending" | "descending"; } /* undocumented */ @@ -928,10 +979,13 @@ export interface ContainerPartitionKey { /* List of paths using which data within the container can be partitioned */ paths?: Path[]; - /* Indicates the kind of algorithm used for partitioning */ - kind?: string; + /* Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create */ + kind?: "Hash" | "Range" | "MultiHash"; + /* Indicates the version of the partition key definition */ version?: number; + /* Indicates if the container is using a system generated partition key */ + readonly systemKey?: boolean; } /* A path. These typically start with root (/path) */ @@ -952,7 +1006,8 @@ export interface UniqueKey { /* The conflict resolution policy for the container. */ export interface ConflictResolutionPolicy { /* Indicates the conflict resolution mode. */ - mode?: string; + mode?: "LastWriterWins" | "Custom"; + /* The conflict resolution path in the case of LastWriterWins mode. */ conflictResolutionPath?: string; /* The procedure to resolve conflicts in the case of custom mode. */ @@ -980,11 +1035,12 @@ export interface SqlTriggerResource { /* Name of the Cosmos DB SQL trigger */ id: string; /* Body of the Trigger */ - body?: string; + body: string; /* Type of the Trigger */ - triggerType?: string; + triggerType?: "Pre" | "Post"; + /* The operation the trigger is associated with */ - triggerOperation?: string; + triggerOperation?: "All" | "Create" | "Update" | "Delete" | "Replace"; } /* Cosmos DB MongoDB database resource object */ @@ -1143,6 +1199,19 @@ export interface Capability { /* 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 }; +/* Identity for the resource. */ +export interface ManagedServiceIdentity { + /* The principal id of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly principalId?: string; + /* The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly tenantId?: string; + /* The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. */ + type?: "SystemAssigned" | "UserAssigned" | "SystemAssigned,UserAssigned" | "None"; + + /* The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ + userAssignedIdentities?: unknown; +} + /* The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. */ export type ProvisioningState = string; @@ -1163,34 +1232,8 @@ export interface VirtualNetworkRule { ignoreMissingVNetServiceEndpoint?: boolean; } -/* A private endpoint connection */ -export type PrivateEndpointConnection = unknown & { - /* Resource properties. */ - properties?: PrivateEndpointConnectionProperties; -}; - -/* Properties of a private endpoint connection. */ -export interface PrivateEndpointConnectionProperties { - /* Private endpoint which the connection belongs to. */ - privateEndpoint?: PrivateEndpointProperty; - - /* Connection State of the Private Endpoint Connection. */ - privateLinkServiceConnectionState?: PrivateLinkServiceConnectionStateProperty; -} - -/* Private endpoint which the connection belongs to. */ -export interface PrivateEndpointProperty { - /* Resource id of the private endpoint. */ - id?: string; -} - -/* Connection State of the Private Endpoint Connection. */ -export interface PrivateLinkServiceConnectionStateProperty { - /* The private link service connection status. */ - status?: string; - /* Any action that is required beyond basic workflow (approve/ reject/ disconnect) */ - readonly actionsRequired?: string; -} +/* Indicates what services are allowed to bypass firewall checks. */ +export type NetworkAclBypass = "None" | "AzureServices"; /* REST API operation */ export interface Operation { @@ -1257,7 +1300,8 @@ export interface MetricDefinition { readonly metricAvailabilities?: MetricAvailability[]; /* The primary aggregation type of the metric. */ - readonly primaryAggregationType?: string; + readonly primaryAggregationType?: "None" | "Average" | "Total" | "Minimum" | "Maximum" | "Last"; + /* The unit of the metric. */ unit?: UnitType; @@ -1391,5 +1435,31 @@ export type PublicNetworkAccess = "Enabled" | "Disabled"; /* undocumented */ export interface ApiProperties { /* Describes the ServerVersion of an a MongoDB account. */ - serverVersion?: string; + serverVersion?: "3.2" | "3.6" | "4.0"; +} + +/* The object representing the policy for taking backups on an account. */ +export interface BackupPolicy { + /* undocumented */ + type: BackupPolicyType; +} + +/* Describes the mode of backups. */ +export type BackupPolicyType = "Periodic" | "Continuous"; + +/* The object representing periodic mode backup policy. */ +export type PeriodicModeBackupPolicy = BackupPolicy & { + /* Configuration values for periodic mode backup */ + periodicModeProperties?: PeriodicModeProperties; +}; + +/* The object representing continuous mode backup policy. */ +export type ContinuousModeBackupPolicy = BackupPolicy; + +/* Configuration values for periodic mode backup */ +export interface PeriodicModeProperties { + /* An integer representing the interval in minutes between two backups */ + backupIntervalInMinutes?: number; + /* An integer representing the time (in hours) that each backup is retained */ + backupRetentionIntervalInHours?: number; } diff --git a/src/Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces.ts b/src/Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces.ts new file mode 100644 index 000000000..c08e79855 --- /dev/null +++ b/src/Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces.ts @@ -0,0 +1,89 @@ +/* + 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/notebook.json +*/ + +import { configContext } from "../../../../ConfigContext"; +import { armRequest } from "../../request"; +import * as Types from "./types"; +const apiVersion = "2021-04-15"; + +/* Gets the notebook workspace resources of an existing Cosmos DB account. */ +export async function listByDatabaseAccount( + subscriptionId: string, + resourceGroupName: string, + accountName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/notebookWorkspaces`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* Gets the notebook workspace for a Cosmos DB account. */ +export async function get( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + notebookWorkspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/notebookWorkspaces/${notebookWorkspaceName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* Creates the notebook workspace for a Cosmos DB account. */ +export async function createOrUpdate( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + notebookWorkspaceName: string, + body: Types.NotebookWorkspaceCreateUpdateParameters +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/notebookWorkspaces/${notebookWorkspaceName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body }); +} + +/* Deletes the notebook workspace for a Cosmos DB account. */ +export async function destroy( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + notebookWorkspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/notebookWorkspaces/${notebookWorkspaceName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion }); +} + +/* Retrieves the connection info for the notebook workspace */ +export async function listConnectionInfo( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + notebookWorkspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/notebookWorkspaces/${notebookWorkspaceName}/listConnectionInfo`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); +} + +/* Regenerates the auth token for the notebook workspace */ +export async function regenerateAuthToken( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + notebookWorkspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/notebookWorkspaces/${notebookWorkspaceName}/regenerateAuthToken`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); +} + +/* Starts the notebook workspace */ +export async function start( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + notebookWorkspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/notebookWorkspaces/${notebookWorkspaceName}/start`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "POST", apiVersion }); +} diff --git a/src/Utils/arm/generatedClients/cosmosNotebooks/types.ts b/src/Utils/arm/generatedClients/cosmosNotebooks/types.ts new file mode 100644 index 000000000..ecc745703 --- /dev/null +++ b/src/Utils/arm/generatedClients/cosmosNotebooks/types.ts @@ -0,0 +1,38 @@ +/* + 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/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-04-15/notebook.json +*/ + +/* Parameters to create a notebook workspace resource */ +export type NotebookWorkspaceCreateUpdateParameters = unknown; + +/* A list of notebook workspace resources */ +export interface NotebookWorkspaceListResult { + /* Array of notebook workspace resources */ + value?: NotebookWorkspace[]; +} + +/* A notebook workspace resource */ +export type NotebookWorkspace = unknown & { + /* Resource properties. */ + properties?: NotebookWorkspaceProperties; +}; + +/* Properties of a notebook workspace resource. */ +export interface NotebookWorkspaceProperties { + /* Specifies the endpoint of Notebook server. */ + readonly notebookServerEndpoint?: string; + /* Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. */ + readonly status?: string; +} + +/* The connection info for the given notebook workspace */ +export interface NotebookWorkspaceConnectionInfoResult { + /* Specifies auth token used for connecting to Notebook server (uses token-based auth). */ + readonly authToken?: string; + /* Specifies the endpoint of Notebook server. */ + readonly notebookServerEndpoint?: string; +} diff --git a/src/Utils/arm/generatedClients/synapseSparkPools/bigDataPools.ts b/src/Utils/arm/generatedClients/synapseSparkPools/bigDataPools.ts new file mode 100644 index 000000000..db5ff876e --- /dev/null +++ b/src/Utils/arm/generatedClients/synapseSparkPools/bigDataPools.ts @@ -0,0 +1,68 @@ +/* + 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/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/bigDataPool.json +*/ + +import { configContext } from "../../../../ConfigContext"; +import { armRequest } from "../../request"; +import * as Types from "./types"; +const apiVersion = "2021-03-01"; + +/* Get a Big Data pool. */ +export async function get( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + bigDataPoolName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools/${bigDataPoolName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* Patch a Big Data pool. */ +export async function update( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + bigDataPoolName: string, + body: Types.BigDataPoolPatchInfo +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools/${bigDataPoolName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PATCH", apiVersion, body }); +} + +/* Create a new Big Data pool. */ +export async function createOrUpdate( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + bigDataPoolName: string, + body: Types.BigDataPoolResourceInfo +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools/${bigDataPoolName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body }); +} + +/* Delete a Big Data pool from the workspace. */ +export async function destroy( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + bigDataPoolName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools/${bigDataPoolName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion }); +} + +/* List Big Data pools in a workspace. */ +export async function listByWorkspace( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} diff --git a/src/Utils/arm/generatedClients/synapseSparkPools/types.ts b/src/Utils/arm/generatedClients/synapseSparkPools/types.ts new file mode 100644 index 000000000..700dcadd7 --- /dev/null +++ b/src/Utils/arm/generatedClients/synapseSparkPools/types.ts @@ -0,0 +1,127 @@ +/* + 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/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/bigDataPool.json +*/ + +/* Collection of Big Data pool information */ +export interface BigDataPoolResourceInfoListResult { + /* Link to the next page of results */ + nextLink?: string; + /* List of Big Data pools */ + value?: BigDataPoolResourceInfo[]; +} + +/* Properties patch for a Big Data pool */ +export interface BigDataPoolPatchInfo { + /* Updated tags for the Big Data pool */ + tags?: unknown; +} + +/* A Big Data pool */ +export type BigDataPoolResourceInfo = unknown & { + /* Big Data pool properties */ + properties?: BigDataPoolResourceProperties; +}; + +/* Properties of a Big Data pool powered by Apache Spark */ +export interface BigDataPoolResourceProperties { + /* The state of the Big Data pool. */ + provisioningState?: string; + /* Auto-scaling properties */ + autoScale?: AutoScaleProperties; + + /* The time when the Big Data pool was created. */ + creationDate?: string; + /* Auto-pausing properties */ + autoPause?: AutoPauseProperties; + + /* Whether compute isolation is required or not. */ + isComputeIsolationEnabled?: boolean; + /* Whether session level packages enabled. */ + sessionLevelPackagesEnabled?: boolean; + /* The cache size */ + cacheSize?: number; + /* Dynamic Executor Allocation */ + dynamicExecutorAllocation?: DynamicExecutorAllocation; + + /* The Spark events folder */ + sparkEventsFolder?: string; + /* The number of nodes in the Big Data pool. */ + nodeCount?: number; + /* Library version requirements */ + libraryRequirements?: LibraryRequirements; + + /* List of custom libraries/packages associated with the spark pool. */ + customLibraries?: LibraryInfo[]; + + /* Spark configuration file to specify additional properties */ + sparkConfigProperties?: LibraryRequirements; + + /* The Apache Spark version. */ + sparkVersion?: string; + /* The default folder where Spark logs will be written. */ + defaultSparkLogFolder?: string; + /* The level of compute power that each node in the Big Data pool has. */ + nodeSize?: "None" | "Small" | "Medium" | "Large" | "XLarge" | "XXLarge" | "XXXLarge"; + + /* The kind of nodes that the Big Data pool provides. */ + nodeSizeFamily?: "None" | "MemoryOptimized"; + + /* The time when the Big Data pool was updated successfully. */ + readonly lastSucceededTimestamp?: string; +} + +/* Auto-scaling properties of a Big Data pool powered by Apache Spark */ +export interface AutoScaleProperties { + /* The minimum number of nodes the Big Data pool can support. */ + minNodeCount?: number; + /* Whether automatic scaling is enabled for the Big Data pool. */ + enabled?: boolean; + /* The maximum number of nodes the Big Data pool can support. */ + maxNodeCount?: number; +} + +/* Auto-pausing properties of a Big Data pool powered by Apache Spark */ +export interface AutoPauseProperties { + /* Number of minutes of idle time before the Big Data pool is automatically paused. */ + delayInMinutes?: number; + /* Whether auto-pausing is enabled for the Big Data pool. */ + enabled?: boolean; +} + +/* Dynamic Executor Allocation Properties */ +export interface DynamicExecutorAllocation { + /* Indicates whether Dynamic Executor Allocation is enabled or not. */ + enabled?: boolean; +} + +/* Library/package information of a Big Data pool powered by Apache Spark */ +export interface LibraryInfo { + /* Name of the library. */ + name?: string; + /* Storage blob path of library. */ + path?: string; + /* Storage blob container name. */ + containerName?: string; + /* The last update time of the library. */ + readonly uploadedTimestamp?: string; + /* Type of the library. */ + type?: string; + /* Provisioning status of the library/package. */ + readonly provisioningStatus?: string; + /* Creator Id of the library/package. */ + readonly creatorId?: string; +} + +/* Library requirements for a Big Data pool powered by Apache Spark */ +export interface LibraryRequirements { + /* The last update time of the library requirements file. */ + readonly time?: string; + /* The library requirements. */ + content?: string; + /* The filename of the library requirements file. */ + filename?: string; +} diff --git a/src/Utils/arm/generatedClients/synapseWorkspaces/restorableDroppedSqlPools.ts b/src/Utils/arm/generatedClients/synapseWorkspaces/restorableDroppedSqlPools.ts new file mode 100644 index 000000000..a782ae809 --- /dev/null +++ b/src/Utils/arm/generatedClients/synapseWorkspaces/restorableDroppedSqlPools.ts @@ -0,0 +1,33 @@ +/* + 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/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/workspace.json +*/ + +import { configContext } from "../../../../ConfigContext"; +import { armRequest } from "../../request"; +import * as Types from "./types"; +const apiVersion = "2021-03-01"; + +/* Gets a deleted sql pool that can be restored */ +export async function get( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + restorableDroppedSqlPoolId: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/restorableDroppedSqlPools/${restorableDroppedSqlPoolId}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* Gets a list of deleted Sql pools that can be restored */ +export async function listByWorkspace( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/restorableDroppedSqlPools`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} diff --git a/src/Utils/arm/generatedClients/synapseWorkspaces/types.ts b/src/Utils/arm/generatedClients/synapseWorkspaces/types.ts new file mode 100644 index 000000000..aaf9cacfb --- /dev/null +++ b/src/Utils/arm/generatedClients/synapseWorkspaces/types.ts @@ -0,0 +1,249 @@ +/* + 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/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/workspace.json +*/ + +/* Workspace active directory administrator properties */ +export interface AadAdminProperties { + /* Tenant ID of the workspace active directory administrator */ + tenantId?: string; + /* Login of the workspace active directory administrator */ + login?: string; + /* Workspace active directory administrator type */ + administratorType?: string; + /* Object ID of the workspace active directory administrator */ + sid?: string; +} + +/* List of workspaces */ +export interface WorkspaceInfoListResult { + /* Link to the next page of results */ + nextLink?: string; + /* List of workspaces */ + value?: Workspace[]; +} + +/* Details of the data lake storage account associated with the workspace */ +export interface DataLakeStorageAccountDetails { + /* Account URL */ + accountUrl?: string; + /* Filesystem name */ + filesystem?: string; +} + +/* Details of the encryption associated with the workspace */ +export interface EncryptionDetails { + /* Double Encryption enabled */ + readonly doubleEncryptionEnabled?: boolean; + /* Customer Managed Key Details */ + cmk?: CustomerManagedKeyDetails; +} + +/* Details of the customer managed key associated with the workspace */ +export interface CustomerManagedKeyDetails { + /* The customer managed key status on the workspace */ + readonly status?: string; + /* The key object of the workspace */ + key?: WorkspaceKeyDetails; +} + +/* Details of the customer managed key associated with the workspace */ +export interface WorkspaceKeyDetails { + /* Workspace Key sub-resource name */ + name?: string; + /* Workspace Key sub-resource key vault url */ + keyVaultUrl?: string; +} + +/* The workspace managed identity */ +export interface ManagedIdentity { + /* The principal ID of the workspace managed identity */ + readonly principalId?: string; + /* The tenant ID of the workspace managed identity */ + readonly tenantId?: string; + /* The type of managed identity for the workspace */ + type?: "None" | "SystemAssigned"; +} + +/* Virtual Network Profile */ +export interface VirtualNetworkProfile { + /* Subnet ID used for computes in workspace */ + computeSubnetId?: string; +} + +/* Managed Virtual Network Settings */ +export interface ManagedVirtualNetworkSettings { + /* Prevent Data Exfiltration */ + preventDataExfiltration?: boolean; + /* Linked Access Check On Target Resource */ + linkedAccessCheckOnTargetResource?: boolean; + /* Allowed Aad Tenant Ids For Linking */ + allowedAadTenantIdsForLinking?: unknown[]; +} + +/* Git integration settings */ +export interface WorkspaceRepositoryConfiguration { + /* Type of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, WorkspaceGitHubConfiguration */ + type?: string; + /* GitHub Enterprise host name. For example: https://github.mydomain.com */ + hostName?: string; + /* Account name */ + accountName?: string; + /* VSTS project name */ + projectName?: string; + /* Repository name */ + repositoryName?: string; + /* Collaboration branch */ + collaborationBranch?: string; + /* Root folder to use in the repository */ + rootFolder?: string; + /* The last commit ID */ + lastCommitId?: string; + /* The VSTS tenant ID */ + tenantId?: string; +} + +/* Purview Configuration */ +export interface PurviewConfiguration { + /* Purview Resource ID */ + purviewResourceId?: string; +} + +/* Workspace active directory administrator */ +export type WorkspaceAadAdminInfo = unknown & { + /* Workspace active directory administrator properties */ + properties?: AadAdminProperties; +}; + +/* A workspace */ +export type Workspace = unknown & { + /* Workspace resource properties */ + properties?: WorkspaceProperties; + + /* Identity of the workspace */ + identity?: ManagedIdentity; +}; + +/* Workspace properties */ +export interface WorkspaceProperties { + /* Workspace default data lake storage account details */ + defaultDataLakeStorage?: DataLakeStorageAccountDetails; + + /* SQL administrator login password */ + sqlAdministratorLoginPassword?: string; + /* Workspace managed resource group. The resource group name uniquely identifies the resource group within the user subscriptionId. The resource group name must be no longer than 90 characters long, and must be alphanumeric characters (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note that the name cannot end with '.' */ + managedResourceGroupName?: string; + /* Resource provisioning state */ + readonly provisioningState?: string; + /* Login for workspace SQL active directory administrator */ + sqlAdministratorLogin?: string; + /* Virtual Network profile */ + virtualNetworkProfile?: VirtualNetworkProfile; + + /* Connectivity endpoints */ + connectivityEndpoints?: unknown; + + /* Setting this to 'default' will ensure that all compute for this workspace is in a virtual network managed on behalf of the user. */ + managedVirtualNetwork?: string; + /* Private endpoint connections to the workspace */ + privateEndpointConnections?: unknown[]; + + /* The encryption details of the workspace */ + encryption?: EncryptionDetails; + + /* The workspace unique identifier */ + readonly workspaceUID?: string; + /* Workspace level configs and feature flags */ + readonly extraProperties?: unknown; + + /* Managed Virtual Network Settings */ + managedVirtualNetworkSettings?: ManagedVirtualNetworkSettings; + + /* Git integration settings */ + workspaceRepositoryConfiguration?: WorkspaceRepositoryConfiguration; + + /* Purview Configuration */ + purviewConfiguration?: PurviewConfiguration; + + /* The ADLA resource ID. */ + readonly adlaResourceId?: string; + /* Enable or Disable public network access to workspace */ + publicNetworkAccess?: "Enabled" | "Disabled"; +} + +/* Workspace patch details */ +export interface WorkspacePatchInfo { + /* Resource tags */ + tags?: unknown; + + /* The identity of the workspace */ + identity?: ManagedIdentity; + + /* Workspace patch properties */ + properties?: WorkspacePatchProperties; +} + +/* Workspace patch properties */ +export interface WorkspacePatchProperties { + /* SQL administrator login password */ + sqlAdministratorLoginPassword?: string; + /* Managed Virtual Network Settings */ + managedVirtualNetworkSettings?: ManagedVirtualNetworkSettings; + + /* Git integration settings */ + workspaceRepositoryConfiguration?: WorkspaceRepositoryConfiguration; + + /* Purview Configuration */ + purviewConfiguration?: PurviewConfiguration; + + /* Resource provisioning state */ + readonly provisioningState?: string; + /* The encryption details of the workspace */ + encryption?: EncryptionDetails; + + /* Enable or Disable public network access to workspace */ + publicNetworkAccess?: "Enabled" | "Disabled"; +} + +/* Sql Control Settings for workspace managed identity */ +export type ManagedIdentitySqlControlSettingsModel = unknown & { + /* Sql Control Settings for workspace managed identity */ + properties?: unknown; +}; + +/* The properties of a restorable dropped Sql pool */ +export interface RestorableDroppedSqlPoolProperties { + /* The name of the database */ + readonly databaseName?: string; + /* The edition of the database */ + readonly edition?: string; + /* The max size in bytes of the database */ + readonly maxSizeBytes?: string; + /* The service level objective name of the database */ + readonly serviceLevelObjective?: string; + /* The elastic pool name of the database */ + readonly elasticPoolName?: string; + /* The creation date of the database (ISO8601 format) */ + readonly creationDate?: string; + /* The deletion date of the database (ISO8601 format) */ + readonly deletionDate?: string; + /* The earliest restore date of the database (ISO8601 format) */ + readonly earliestRestoreDate?: string; +} + +/* A restorable dropped Sql pool */ +export type RestorableDroppedSqlPool = unknown & { + /* The geo-location where the resource lives */ + readonly location?: string; + /* The properties of a restorable dropped Sql pool */ + properties?: RestorableDroppedSqlPoolProperties; +}; + +/* The response to a list restorable dropped Sql pools request */ +export interface RestorableDroppedSqlPoolListResult { + /* A list of restorable dropped Sql pools */ + value: RestorableDroppedSqlPool[]; +} diff --git a/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceAadAdmins.ts b/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceAadAdmins.ts new file mode 100644 index 000000000..882bcd355 --- /dev/null +++ b/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceAadAdmins.ts @@ -0,0 +1,39 @@ +/* + 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/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/workspace.json +*/ + +import { configContext } from "../../../../ConfigContext"; +import { armRequest } from "../../request"; +import * as Types from "./types"; +const apiVersion = "2021-03-01"; + +/* Gets a workspace active directory admin */ +export async function get( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/administrators/activeDirectory`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* Creates or updates a workspace active directory admin */ +export async function createOrUpdate( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + body: Types.WorkspaceAadAdminInfo +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/administrators/activeDirectory`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body }); +} + +/* Deletes a workspace active directory admin */ +export async function destroy(subscriptionId: string, resourceGroupName: string, workspaceName: string): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/administrators/activeDirectory`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion }); +} diff --git a/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceManagedIdentitySqlControlSettings.ts b/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceManagedIdentitySqlControlSettings.ts new file mode 100644 index 000000000..c587de88f --- /dev/null +++ b/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceManagedIdentitySqlControlSettings.ts @@ -0,0 +1,33 @@ +/* + 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/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/workspace.json +*/ + +import { configContext } from "../../../../ConfigContext"; +import { armRequest } from "../../request"; +import * as Types from "./types"; +const apiVersion = "2021-03-01"; + +/* undocumented */ +export async function get( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/managedIdentitySqlControlSettings/default`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* undocumented */ +export async function createOrUpdate( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + body: Types.ManagedIdentitySqlControlSettingsModel +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/managedIdentitySqlControlSettings/default`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body }); +} diff --git a/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceSqlAadAdmins.ts b/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceSqlAadAdmins.ts new file mode 100644 index 000000000..f5f1cd4c8 --- /dev/null +++ b/src/Utils/arm/generatedClients/synapseWorkspaces/workspaceSqlAadAdmins.ts @@ -0,0 +1,39 @@ +/* + 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/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/workspace.json +*/ + +import { configContext } from "../../../../ConfigContext"; +import { armRequest } from "../../request"; +import * as Types from "./types"; +const apiVersion = "2021-03-01"; + +/* Gets a workspace SQL active directory admin */ +export async function get( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/sqlAdministrators/activeDirectory`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* Creates or updates a workspace SQL active directory admin */ +export async function createOrUpdate( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + body: Types.WorkspaceAadAdminInfo +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/sqlAdministrators/activeDirectory`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body }); +} + +/* Deletes a workspace SQL active directory admin */ +export async function destroy(subscriptionId: string, resourceGroupName: string, workspaceName: string): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/sqlAdministrators/activeDirectory`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion }); +} diff --git a/src/Utils/arm/generatedClients/synapseWorkspaces/workspaces.ts b/src/Utils/arm/generatedClients/synapseWorkspaces/workspaces.ts new file mode 100644 index 000000000..545264146 --- /dev/null +++ b/src/Utils/arm/generatedClients/synapseWorkspaces/workspaces.ts @@ -0,0 +1,65 @@ +/* + 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/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/workspace.json +*/ + +import { configContext } from "../../../../ConfigContext"; +import { armRequest } from "../../request"; +import * as Types from "./types"; +const apiVersion = "2021-03-01"; + +/* Returns a list of workspaces in a resource group */ +export async function listByResourceGroup( + subscriptionId: string, + resourceGroupName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* Gets a workspace */ +export async function get( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} + +/* Updates a workspace */ +export async function update( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + body: Types.WorkspacePatchInfo +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PATCH", apiVersion, body }); +} + +/* Creates or updates a workspace */ +export async function createOrUpdate( + subscriptionId: string, + resourceGroupName: string, + workspaceName: string, + body: Types.Workspace +): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body }); +} + +/* Deletes a workspace */ +export async function destroy(subscriptionId: string, resourceGroupName: string, workspaceName: string): Promise { + const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion }); +} + +/* Returns a list of workspaces in a subscription */ +export async function list(subscriptionId: string): Promise { + const path = `/subscriptions/${subscriptionId}/providers/Microsoft.Synapse/workspaces`; + return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion }); +} diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index bea73afc5..1f197ed13 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -27,7 +27,7 @@ import { import { CollectionCreation } from "../Shared/Constants"; import { DefaultExperienceUtility } from "../Shared/DefaultExperienceUtility"; import { PortalEnv, updateUserContext, userContext } from "../UserContext"; -import { listKeys } from "../Utils/arm/generatedClients/2020-04-01/databaseAccounts"; +import { listKeys } from "../Utils/arm/generatedClients/cosmos/databaseAccounts"; import { isInvalidParentFrameOrigin } from "../Utils/MessageValidation"; // This hook will create a new instance of Explorer.ts and bind it to the DOM diff --git a/test/testExplorer/TestExplorer.ts b/test/testExplorer/TestExplorer.ts index 397d46aa5..a83484ebb 100644 --- a/test/testExplorer/TestExplorer.ts +++ b/test/testExplorer/TestExplorer.ts @@ -3,7 +3,7 @@ import { ClientSecretCredential } from "@azure/identity"; import "../../less/hostedexplorer.less"; import { DataExplorerInputsFrame } from "../../src/Contracts/ViewModels"; import { updateUserContext } from "../../src/UserContext"; -import { get, listKeys } from "../../src/Utils/arm/generatedClients/2020-04-01/databaseAccounts"; +import { get, listKeys } from "../../src/Utils/arm/generatedClients/cosmos/databaseAccounts"; const resourceGroup = process.env.RESOURCE_GROUP || ""; const subscriptionId = process.env.SUBSCRIPTION_ID || ""; diff --git a/utils/armClientGenerator/generator.ts b/utils/armClientGenerator/generator.ts index 7a1d70c0b..dd3da3db0 100644 --- a/utils/armClientGenerator/generator.ts +++ b/utils/armClientGenerator/generator.ts @@ -15,12 +15,14 @@ But it does work well enough to generate a fully typed tree-shakeable client for Results of this file should be checked into the repo. */ +// CHANGE THESE VALUES TO GENERATE NEW CLIENTS +const version = "2021-04-15"; +const resourceName = "cosmosNotebooks"; +const schemaURL = `https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/${version}/notebook.json`; +const outputDir = path.join(__dirname, `../../src/Utils/arm/generatedClients/${resourceName}/${version}`); + // Array of strings to use for eventual output const outputTypes: string[] = [""]; -const version = "2020-04-01"; -const schemaURL = `https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/${version}/cosmos-db.json`; - -const outputDir = path.join(__dirname, `../../src/Utils/arm/generatedClients/${version}`); mkdirp.sync(outputDir); // Buckets for grouping operations based on their name @@ -33,7 +35,7 @@ const clients: { [key: string]: Client } = {}; // Mapping for OpenAPI types to TypeScript types const propertyMap: { [key: string]: string } = { - integer: "number" + integer: "number", }; // Converts a Open API reference: "#/definitions/Foo" to a type name: Foo @@ -84,6 +86,7 @@ function responseType(operation: Operation, namespace: string) { return refToType(operation.responses[responseCode].schema.$ref, namespace); }) .filter((value, index, array) => array.indexOf(value) === index) + .filter((value) => value !== "unknown") .join(" | "); } return "unknown"; @@ -98,6 +101,7 @@ interface Property { items?: { $ref: string; }; + enum?: string[]; allOf?: { $ref: string; }[]; @@ -129,6 +133,13 @@ const propertyToType = (property: Property, prop: string, required: boolean) => /* ${property.description || "undocumented"} */ ${property.readOnly ? "readonly " : ""}${prop}${required ? "" : "?"}: ${type} `); + } else if (property.enum) { + outputTypes.push(` + /* ${property.description || "undocumented"} */ + ${property.readOnly ? "readonly " : ""}${prop}${required ? "" : "?"}: ${property.enum + .map((v: string) => `"${v}"`) + .join(" | ")} + `); } else { if (property.type === undefined) { console.log(`UHANDLED TYPE: ${prop}. Falling back to unknown`); @@ -162,9 +173,6 @@ async function main() { } else { outputTypes.push(`export interface ${definition} {`); } - if (definition === "SqlDatabaseGetProperties") { - console.log(schema.definitions[definition]); - } for (const prop in schema.definitions[definition].properties) { const property = schema.definitions[definition].properties[prop]; propertyToType(property, prop, schema.definitions[definition].required?.includes(prop)); @@ -225,9 +233,9 @@ async function main() { // Write all grouped fetch functions to objects for (const clientName in clients) { 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 { configContext } from "../../../../ConfigContext";\n`); + outputClient.push(`import { configContext } from "../../../../../ConfigContext";\n`); outputClient.push(`const apiVersion = "${version}"\n\n`); for (const path of clients[clientName].paths) { for (const method in schema.paths[path]) { @@ -240,7 +248,7 @@ async function main() { /* ${operation.description || "undocumented"} */ export async function ${sanitize(camelize(methodName))} ( ${parametersFromPath(path) - .map(p => `${p}: string`) + .map((p) => `${p}: string`) .join(",\n")} ${bodyParam(bodyParameter, "Types")} ) : Promise<${responseType(operation, "Types")}> { @@ -268,13 +276,15 @@ function sanitize(name: string) { function writeOutputFile(outputPath: string, components: string[]) { components.unshift(`/* AUTOGENERATED FILE - Do not manually edit 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: ${schemaURL} */\n\n`); writeFileSync(path.join(outputDir, outputPath), components.join("")); } -main().catch(e => { +main().catch((e) => { console.error(e); process.exit(1); });