From f1812077e99ed42de046f3df30791772b93c755a Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Thu, 23 Jul 2020 16:35:05 -0500 Subject: [PATCH] Split up generators --- models.ts | 2817 ------------------- package-lock.json | 146 +- package.json | 4 +- src/Utils/arm/CassandraResources.ts | 167 ++ src/Utils/arm/Collection.ts | 49 + src/Utils/arm/CollectionPartition.ts | 35 + src/Utils/arm/CollectionPartitionRegion.ts | 22 + src/Utils/arm/CollectionRegion.ts | 22 + src/Utils/arm/Database.ts | 52 + src/Utils/arm/DatabaseAccountRegion.ts | 22 + src/Utils/arm/DatabaseAccounts.ts | 218 ++ src/Utils/arm/GremlinResources.ts | 167 ++ src/Utils/arm/MongoDBResources.ts | 167 ++ src/Utils/arm/Operations.ts | 17 + src/Utils/arm/PartitionKeyRangeId.ts | 22 + src/Utils/arm/PartitionKeyRangeIdRegion.ts | 23 + src/Utils/arm/Percentile.ts | 19 + src/Utils/arm/PercentileSourceTarget.ts | 21 + src/Utils/arm/PercentileTarget.ts | 20 + src/Utils/arm/RestorableDatabaseAccounts.ts | 40 + src/Utils/arm/SqlResources.ts | 344 +++ src/Utils/arm/TableResources.ts | 84 + src/Utils/arm/types.ts | 1261 +++++++++ tsconfig.strict.json | 19 + utils/armClientGenerator/generator.ts | 84 +- 25 files changed, 2983 insertions(+), 2859 deletions(-) delete mode 100644 models.ts create mode 100644 src/Utils/arm/CassandraResources.ts create mode 100644 src/Utils/arm/Collection.ts create mode 100644 src/Utils/arm/CollectionPartition.ts create mode 100644 src/Utils/arm/CollectionPartitionRegion.ts create mode 100644 src/Utils/arm/CollectionRegion.ts create mode 100644 src/Utils/arm/Database.ts create mode 100644 src/Utils/arm/DatabaseAccountRegion.ts create mode 100644 src/Utils/arm/DatabaseAccounts.ts create mode 100644 src/Utils/arm/GremlinResources.ts create mode 100644 src/Utils/arm/MongoDBResources.ts create mode 100644 src/Utils/arm/Operations.ts create mode 100644 src/Utils/arm/PartitionKeyRangeId.ts create mode 100644 src/Utils/arm/PartitionKeyRangeIdRegion.ts create mode 100644 src/Utils/arm/Percentile.ts create mode 100644 src/Utils/arm/PercentileSourceTarget.ts create mode 100644 src/Utils/arm/PercentileTarget.ts create mode 100644 src/Utils/arm/RestorableDatabaseAccounts.ts create mode 100644 src/Utils/arm/SqlResources.ts create mode 100644 src/Utils/arm/TableResources.ts create mode 100644 src/Utils/arm/types.ts diff --git a/models.ts b/models.ts deleted file mode 100644 index 1cc137632..000000000 --- a/models.ts +++ /dev/null @@ -1,2817 +0,0 @@ -interface DatabaseAccountsListResult { - /* List of database account and their properties. */ - readonly value: DatabaseAccountGetResults[]; -} - -interface SqlDatabaseListResult { - /* List of SQL databases and their properties. */ - readonly value: SqlDatabaseGetResults[]; -} - -interface SqlContainerListResult { - /* List of containers and their properties. */ - readonly value: SqlContainerGetResults[]; -} - -interface SqlStoredProcedureListResult { - /* List of storedProcedures and their properties. */ - readonly value: SqlStoredProcedureGetResults[]; -} - -interface SqlUserDefinedFunctionListResult { - /* List of userDefinedFunctions and their properties. */ - readonly value: SqlUserDefinedFunctionGetResults[]; -} - -interface SqlTriggerListResult { - /* List of triggers and their properties. */ - readonly value: SqlTriggerGetResults[]; -} - -interface MongoDBDatabaseListResult { - /* List of MongoDB databases and their properties. */ - readonly value: MongoDBDatabaseGetResults[]; -} - -interface MongoDBCollectionListResult { - /* List of MongoDB collections and their properties. */ - readonly value: MongoDBCollectionGetResults[]; -} - -interface TableListResult { - /* List of Table and their properties. */ - readonly value: TableGetResults[]; -} - -interface CassandraKeyspaceListResult { - /* List of Cassandra keyspaces and their properties. */ - readonly value: CassandraKeyspaceGetResults[]; -} - -interface CassandraTableListResult { - /* List of Cassandra tables and their properties. */ - readonly value: CassandraTableGetResults[]; -} - -interface GremlinDatabaseListResult { - /* List of Gremlin databases and their properties. */ - readonly value: GremlinDatabaseGetResults[]; -} - -interface GremlinGraphListResult { - /* List of graphs and their properties. */ - readonly value: GremlinGraphGetResults[]; -} - -interface ErrorResponse { - /* Error code. */ - code: string; - /* Error message indicating why the operation failed. */ - message: string; -} - -interface ErrorResponseUpdatedFormat { - /* undefined */ - error: unknown; -} - -interface FailoverPolicies { - /* List of failover policies. */ - failoverPolicies: FailoverPolicy[]; -} - -interface FailoverPolicy { - /* The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. */ - readonly id: string; - /* The name of the region in which the database account exists. */ - locationName: string; - /* The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */ - failoverPriority: number; -} - -interface RegionForOnlineOffline { - /* Cosmos DB region, with spaces between words and each word capitalized. */ - region: string; -} - -interface Location { - /* The unique identifier of the region within the database account. Example: <accountName>-<locationName>. */ - readonly id: string; - /* The name of the region. */ - locationName: string; - /* The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ */ - readonly documentEndpoint: string; - /* undefined */ - provisioningState: ProvisioningState; - - /* The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */ - failoverPriority: number; - /* Flag to indicate whether or not this region is an AvailabilityZone region */ - isZoneRedundant: boolean; -} - -interface ARMResourceProperties { - /* The unique resource identifier of the ARM resource. */ - readonly id: string; - /* The name of the ARM resource. */ - readonly name: string; - /* The type of Azure resource. */ - readonly type: string; - /* The location of the resource group to which the resource belongs. */ - location: string; - /* undefined */ - tags: Tags; - - /* undefined */ - identity: ManagedServiceIdentity; -} - -interface ARMProxyResource { - /* The unique resource identifier of the database account. */ - readonly id: string; - /* The name of the database account. */ - readonly name: string; - /* The type of Azure resource. */ - readonly type: string; -} - -type DatabaseAccountGetResults = ARMResourceProperties & { - /* Indicates the type of database account. This can only be set at database account creation. */ - kind: string; - /* undefined */ - properties: DatabaseAccountGetProperties; - - /* The system meta data relating to this resource. */ - readonly systemData: unknown; -}; - -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: undefined; - /* A system generated property representing the resource etag required for optimistic concurrency control. */ - readonly _etag: string; -} - -type ThroughputSettingsGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB resource throughput */ - properties: ThroughputSettingsGetProperties; -}; - -interface ThroughputSettingsGetProperties { - /* undefined */ - resource: undefined; -} - -type SqlDatabaseGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB SQL database */ - properties: SqlDatabaseGetProperties; -}; - -interface SqlDatabaseGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -type SqlContainerGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB container */ - properties: SqlContainerGetProperties; -}; - -interface SqlContainerGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -type SqlStoredProcedureGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB storedProcedure */ - properties: SqlStoredProcedureGetProperties; -}; - -interface SqlStoredProcedureGetProperties { - /* undefined */ - resource: undefined; -} - -type SqlUserDefinedFunctionGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB userDefinedFunction */ - properties: SqlUserDefinedFunctionGetProperties; -}; - -interface SqlUserDefinedFunctionGetProperties { - /* undefined */ - resource: undefined; -} - -type SqlTriggerGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB trigger */ - properties: SqlTriggerGetProperties; -}; - -interface SqlTriggerGetProperties { - /* undefined */ - resource: undefined; -} - -type MongoDBDatabaseGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB MongoDB database */ - properties: MongoDBDatabaseGetProperties; -}; - -interface MongoDBDatabaseGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -type MongoDBCollectionGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB MongoDB collection */ - properties: MongoDBCollectionGetProperties; -}; - -interface MongoDBCollectionGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -type TableGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB Table */ - properties: TableGetProperties; -}; - -interface TableGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -type CassandraKeyspaceGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB Cassandra keyspace */ - properties: CassandraKeyspaceGetProperties; -}; - -interface CassandraKeyspaceGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -type CassandraTableGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB Cassandra table */ - properties: CassandraTableGetProperties; -}; - -interface CassandraTableGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -type GremlinDatabaseGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB SQL database */ - properties: GremlinDatabaseGetProperties; -}; - -interface GremlinDatabaseGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -type GremlinGraphGetResults = ARMResourceProperties & { - /* The properties of an Azure Cosmos DB Gremlin graph */ - properties: GremlinGraphGetProperties; -}; - -interface GremlinGraphGetProperties { - /* undefined */ - resource: undefined; - /* undefined */ - options: undefined; -} - -interface ConsistencyPolicy { - /* The default consistency level and configuration settings of the Cosmos DB account. */ - defaultConsistencyLevel: string; - /* 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'. */ - maxIntervalInSeconds: number; -} - -interface DatabaseAccountGetProperties { - /* undefined */ - provisioningState: ProvisioningState; - - /* The connection endpoint for the Cosmos DB database account. */ - readonly documentEndpoint: string; - /* The offer type for the Cosmos DB database account. Default value: Standard. */ - readonly databaseAccountOfferType: DatabaseAccountOfferType; - - /* List of IpRules. */ - ipRules: IPRules; - - /* Flag to indicate whether to enable/disable Virtual Network ACL rules. */ - isVirtualNetworkFilterEnabled: boolean; - /* Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. */ - enableAutomaticFailover: boolean; - /* The consistency policy for the Cosmos DB database account. */ - consistencyPolicy: ConsistencyPolicy; - - /* List of Cosmos DB capabilities for the account */ - capabilities: Capability[]; - - /* An array that contains the write location for the Cosmos DB account. */ - readonly writeLocations: Location[]; - - /* An array that contains of the read locations enabled for the Cosmos DB account. */ - readonly readLocations: Location[]; - - /* An array that contains all of the locations enabled for the Cosmos DB account. */ - readonly locations: Location[]; - - /* An array that contains the regions ordered by their failover priorities. */ - readonly failoverPolicies: FailoverPolicy[]; - - /* List of Virtual Network ACL rules configured for the Cosmos DB account. */ - virtualNetworkRules: VirtualNetworkRule[]; - - /* List of Private Endpoint Connections configured for the Cosmos DB account. */ - readonly privateEndpointConnections: PrivateEndpointConnection[]; - - /* Enables the account to write in multiple locations */ - enableMultipleWriteLocations: boolean; - /* Enables the cassandra connector on the Cosmos DB C* account */ - enableCassandraConnector: boolean; - /* The cassandra connector offer type for the Cosmos DB database C* account. */ - connectorOffer: ConnectorOffer; - - /* Disable write operations on metadata resources (databases, containers, throughput) via account keys */ - disableKeyBasedMetadataWriteAccess: boolean; - /* The URI of the key vault */ - keyVaultKeyUri: string; - /* Whether requests from Public Network are allowed */ - publicNetworkAccess: PublicNetworkAccess; - - /* Flag to indicate whether Free Tier is enabled. */ - enableFreeTier: boolean; - /* API specific properties. */ - apiProperties: ApiProperties; - - /* Flag to indicate whether to enable storage analytics. */ - enableAnalyticalStorage: boolean; - /* A unique identifier assigned to the database account */ - readonly instanceId: string; - /* Enum to indicate the mode of account creation. */ - createMode: CreateMode; - - /* Parameters to indicate the information about the restore. */ - restoreParameters: RestoreParameters; - - /* The object representing the policy for taking backups on an account. */ - backupPolicy: BackupPolicy; -} - -interface DatabaseAccountCreateUpdateProperties { - /* The consistency policy for the Cosmos DB account. */ - consistencyPolicy: ConsistencyPolicy; - - /* An array that contains the georeplication locations enabled for the Cosmos DB account. */ - locations: Location[]; - - /* The offer type for the database */ - databaseAccountOfferType: DatabaseAccountOfferType; - - /* List of IpRules. */ - ipRules: IPRules; - - /* Flag to indicate whether to enable/disable Virtual Network ACL rules. */ - isVirtualNetworkFilterEnabled: boolean; - /* Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. */ - enableAutomaticFailover: boolean; - /* List of Cosmos DB capabilities for the account */ - capabilities: Capability[]; - - /* List of Virtual Network ACL rules configured for the Cosmos DB account. */ - virtualNetworkRules: VirtualNetworkRule[]; - - /* Enables the account to write in multiple locations */ - enableMultipleWriteLocations: boolean; - /* Enables the cassandra connector on the Cosmos DB C* account */ - enableCassandraConnector: boolean; - /* The cassandra connector offer type for the Cosmos DB database C* account. */ - connectorOffer: ConnectorOffer; - - /* Disable write operations on metadata resources (databases, containers, throughput) via account keys */ - disableKeyBasedMetadataWriteAccess: boolean; - /* The URI of the key vault */ - keyVaultKeyUri: string; - /* Whether requests from Public Network are allowed */ - publicNetworkAccess: PublicNetworkAccess; - - /* Flag to indicate whether Free Tier is enabled. */ - enableFreeTier: boolean; - /* API specific properties. Currently, supported only for MongoDB API. */ - apiProperties: ApiProperties; - - /* Flag to indicate whether to enable storage analytics. */ - enableAnalyticalStorage: boolean; - /* Enum to indicate the mode of account creation. */ - createMode: CreateMode; - - /* The object representing the policy for taking backups on an account. */ - backupPolicy: BackupPolicy; -} - -type RestoreReqeustDatabaseAccountCreateUpdateProperties = DatabaseAccountCreateUpdateProperties & { - /* Parameters to indicate the information about the restore. */ - restoreParameters: RestoreParameters; -}; - -type DatabaseAccountCreateUpdateParameters = ARMResourceProperties & { - /* Indicates the type of database account. This can only be set at database account creation. */ - kind: string; - /* undefined */ - properties: DatabaseAccountCreateUpdateProperties; -}; - -interface DatabaseAccountUpdateProperties { - /* The consistency policy for the Cosmos DB account. */ - consistencyPolicy: ConsistencyPolicy; - - /* An array that contains the georeplication locations enabled for the Cosmos DB account. */ - locations: Location[]; - - /* List of IpRules. */ - ipRules: IPRules; - - /* Flag to indicate whether to enable/disable Virtual Network ACL rules. */ - isVirtualNetworkFilterEnabled: boolean; - /* Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. */ - enableAutomaticFailover: boolean; - /* List of Cosmos DB capabilities for the account */ - capabilities: Capability[]; - - /* List of Virtual Network ACL rules configured for the Cosmos DB account. */ - virtualNetworkRules: VirtualNetworkRule[]; - - /* Enables the account to write in multiple locations */ - enableMultipleWriteLocations: boolean; - /* Enables the cassandra connector on the Cosmos DB C* account */ - enableCassandraConnector: boolean; - /* The cassandra connector offer type for the Cosmos DB database C* account. */ - connectorOffer: ConnectorOffer; - - /* Disable write operations on metadata resources (databases, containers, throughput) via account keys */ - disableKeyBasedMetadataWriteAccess: boolean; - /* The URI of the key vault */ - keyVaultKeyUri: string; - /* Whether requests from Public Network are allowed */ - publicNetworkAccess: PublicNetworkAccess; - - /* Flag to indicate whether Free Tier is enabled. */ - enableFreeTier: boolean; - /* API specific properties. Currently, supported only for MongoDB API. */ - apiProperties: ApiProperties; - - /* Flag to indicate whether to enable storage analytics. */ - enableAnalyticalStorage: boolean; - /* The object representing the policy for taking backups on an account. */ - backupPolicy: BackupPolicy; -} - -interface DatabaseAccountUpdateParameters { - /* undefined */ - tags: Tags; - - /* The location of the resource group to which the resource belongs. */ - location: string; - /* undefined */ - properties: DatabaseAccountUpdateProperties; -} - -interface DatabaseAccountListReadOnlyKeysResult { - /* Base 64 encoded value of the primary read-only key. */ - readonly primaryReadonlyMasterKey: string; - /* Base 64 encoded value of the secondary read-only key. */ - readonly secondaryReadonlyMasterKey: string; -} - -type DatabaseAccountListKeysResult = DatabaseAccountListReadOnlyKeysResult & { - /* Base 64 encoded value of the primary read-write key. */ - readonly primaryMasterKey: string; - /* Base 64 encoded value of the secondary read-write key. */ - readonly secondaryMasterKey: string; -}; - -interface DatabaseAccountConnectionString { - /* Value of the connection string */ - readonly connectionString: string; - /* Description of the connection string */ - readonly description: string; -} - -interface DatabaseAccountListConnectionStringsResult { - /* An array that contains the connection strings for the Cosmos DB account. */ - connectionStrings: DatabaseAccountConnectionString[]; -} - -interface DatabaseAccountRegenerateKeyParameters { - /* The access key to regenerate. */ - keyKind: string; -} - -/* The offer type for the Cosmos DB database account. */ -type DatabaseAccountOfferType = "Standard"; -type ThroughputSettingsUpdateParameters = ARMResourceProperties & { - /* Properties to update Azure Cosmos DB resource throughput. */ - properties: ThroughputSettingsUpdateProperties; -}; - -interface ThroughputSettingsUpdateProperties { - /* The standard JSON format of a resource throughput */ - resource: ThroughputSettingsResource; -} - -type SqlDatabaseCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB SQL database. */ - properties: SqlDatabaseCreateUpdateProperties; -}; - -interface SqlDatabaseCreateUpdateProperties { - /* The standard JSON format of a SQL database */ - 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; -} - -type SqlContainerCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB container. */ - properties: SqlContainerCreateUpdateProperties; -}; - -interface SqlContainerCreateUpdateProperties { - /* The standard JSON format of a container */ - 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; -} - -type SqlStoredProcedureCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB storedProcedure. */ - properties: SqlStoredProcedureCreateUpdateProperties; -}; - -interface SqlStoredProcedureCreateUpdateProperties { - /* The standard JSON format of a storedProcedure */ - 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; -} - -type SqlUserDefinedFunctionCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB userDefinedFunction. */ - properties: SqlUserDefinedFunctionCreateUpdateProperties; -}; - -interface SqlUserDefinedFunctionCreateUpdateProperties { - /* The standard JSON format of a userDefinedFunction */ - 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; -} - -type SqlTriggerCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB trigger. */ - properties: SqlTriggerCreateUpdateProperties; -}; - -interface SqlTriggerCreateUpdateProperties { - /* The standard JSON format of a trigger */ - 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; -} - -type MongoDBDatabaseCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB MongoDB database. */ - properties: MongoDBDatabaseCreateUpdateProperties; -}; - -interface MongoDBDatabaseCreateUpdateProperties { - /* The standard JSON format of a MongoDB database */ - 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; -} - -type MongoDBCollectionCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB MongoDB collection. */ - properties: MongoDBCollectionCreateUpdateProperties; -}; - -interface MongoDBCollectionCreateUpdateProperties { - /* The standard JSON format of a MongoDB collection */ - 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; -} - -type TableCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB Table. */ - properties: TableCreateUpdateProperties; -}; - -interface TableCreateUpdateProperties { - /* The standard JSON format of a Table */ - 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; -} - -type CassandraKeyspaceCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB Cassandra keyspace. */ - properties: CassandraKeyspaceCreateUpdateProperties; -}; - -interface CassandraKeyspaceCreateUpdateProperties { - /* The standard JSON format of a Cassandra keyspace */ - 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; -} - -type CassandraTableCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB Cassandra table. */ - properties: CassandraTableCreateUpdateProperties; -}; - -interface CassandraTableCreateUpdateProperties { - /* The standard JSON format of a Cassandra table */ - 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; -} - -type GremlinDatabaseCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB Gremlin database. */ - properties: GremlinDatabaseCreateUpdateProperties; -}; - -interface GremlinDatabaseCreateUpdateProperties { - /* The standard JSON format of a Gremlin database */ - 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; -} - -type GremlinGraphCreateUpdateParameters = ARMResourceProperties & { - /* Properties to create and update Azure Cosmos DB Gremlin graph. */ - properties: GremlinGraphCreateUpdateProperties; -}; - -interface GremlinGraphCreateUpdateProperties { - /* The standard JSON format of a Gremlin graph */ - 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; -} - -interface ThroughputSettingsResource { - /* Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. */ - throughput: number; - /* Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. */ - autoscaleSettings: AutoscaleSettingsResource; - - /* The minimum throughput of the resource */ - readonly minimumThroughput: string; - /* The throughput replace is pending */ - readonly offerReplacePending: string; -} - -interface AutoscaleSettingsResource { - /* Represents maximum throughput container can scale up to. */ - maxThroughput: number; - /* Cosmos DB resource auto-upgrade policy */ - autoUpgradePolicy: AutoUpgradePolicyResource; - - /* Represents target maximum throughput container can scale up to once offer is no longer in pending state. */ - readonly targetMaxThroughput: number; -} - -interface AutoUpgradePolicyResource { - /* Represents throughput policy which service must adhere to for auto-upgrade */ - throughputPolicy: ThroughputPolicyResource; -} - -interface ThroughputPolicyResource { - /* Determines whether the ThroughputPolicy is active or not */ - isEnabled: boolean; - /* Represents the percentage by which throughput can increase every time throughput policy kicks in. */ - incrementPercent: number; -} - -interface OptionsResource { - /* Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. */ - throughput: number; - /* Specifies the Autoscale settings. */ - autoscaleSettings: AutoscaleSettings; -} - -interface SqlDatabaseResource { - /* Name of the Cosmos DB SQL database */ - id: string; -} - -interface SqlContainerResource { - /* Name of the Cosmos DB SQL container */ - id: string; - /* The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container */ - indexingPolicy: IndexingPolicy; - - /* The configuration of the partition key to be used for partitioning data into multiple partitions */ - partitionKey: ContainerPartitionKey; - - /* Default time to live */ - defaultTtl: number; - /* The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. */ - uniqueKeyPolicy: UniqueKeyPolicy; - - /* The conflict resolution policy for the container. */ - conflictResolutionPolicy: ConflictResolutionPolicy; -} - -interface IndexingPolicy { - /* Indicates if the indexing policy is automatic */ - automatic: boolean; - /* Indicates the indexing mode. */ - indexingMode: string; - /* List of paths to include in the indexing */ - includedPaths: IncludedPath[]; - - /* List of paths to exclude from indexing */ - excludedPaths: ExcludedPath[]; - - /* List of composite path list */ - compositeIndexes: CompositePathList[]; - - /* List of spatial specifics */ - spatialIndexes: SpatialSpec[]; -} - -interface ExcludedPath { - /* The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) */ - path: string; -} - -interface IncludedPath { - /* The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) */ - path: string; - /* List of indexes for this path */ - indexes: Indexes[]; -} - -interface Indexes { - /* The datatype for which the indexing behavior is applied to. */ - dataType: string; - /* The precision of the index. -1 is maximum precision. */ - precision: number; - /* Indicates the type of index. */ - kind: string; -} - -/* List of composite path */ -type CompositePathList = CompositePath[]; -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; -} - -interface SpatialSpec { - /* The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) */ - path: string; - /* List of path's spatial type */ - types: SpatialType[]; -} - -/* Indicates the spatial type of index. */ -type SpatialType = "Point" | "LineString" | "Polygon" | "MultiPolygon"; -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 version of the partition key definition */ - version: number; -} - -/* A path. These typically start with root (/path) */ -type Path = string; -interface UniqueKeyPolicy { - /* List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. */ - uniqueKeys: UniqueKey[]; -} - -interface UniqueKey { - /* List of paths must be unique for each document in the Azure Cosmos DB service */ - paths: Path[]; -} - -interface ConflictResolutionPolicy { - /* Indicates the conflict resolution mode. */ - mode: string; - /* The conflict resolution path in the case of LastWriterWins mode. */ - conflictResolutionPath: string; - /* The procedure to resolve conflicts in the case of custom mode. */ - conflictResolutionProcedure: string; -} - -interface SqlStoredProcedureResource { - /* Name of the Cosmos DB SQL storedProcedure */ - id: string; - /* Body of the Stored Procedure */ - body: string; -} - -interface SqlUserDefinedFunctionResource { - /* Name of the Cosmos DB SQL userDefinedFunction */ - id: string; - /* Body of the User Defined Function */ - body: string; -} - -interface SqlTriggerResource { - /* Name of the Cosmos DB SQL trigger */ - id: string; - /* Body of the Trigger */ - body: string; - /* Type of the Trigger */ - triggerType: string; - /* The operation the trigger is associated with */ - triggerOperation: string; -} - -interface MongoDBDatabaseResource { - /* Name of the Cosmos DB MongoDB database */ - id: string; -} - -interface MongoDBCollectionResource { - /* Name of the Cosmos DB MongoDB collection */ - id: string; - /* A key-value pair of shard keys to be applied for the request. */ - shardKey: ShardKeys; - - /* List of index keys */ - indexes: MongoIndex[]; - - /* Analytical TTL. */ - analyticalStorageTtl: number; -} - -/* The shard key and partition kind pair, only support "Hash" partition kind */ -type ShardKeys = { [key: string]: string }; -interface MongoIndex { - /* Cosmos DB MongoDB collection index keys */ - key: MongoIndexKeys; - - /* Cosmos DB MongoDB collection index key options */ - options: MongoIndexOptions; -} - -interface MongoIndexKeys { - /* List of keys for each MongoDB collection in the Azure Cosmos DB service */ - keys: Key[]; -} - -/* A Key. */ -type Key = string; -interface MongoIndexOptions { - /* Expire after seconds */ - expireAfterSeconds: number; - /* Is unique or not */ - unique: boolean; -} - -interface TableResource { - /* Name of the Cosmos DB table */ - id: string; -} - -interface CassandraKeyspaceResource { - /* Name of the Cosmos DB Cassandra keyspace */ - id: string; -} - -interface CassandraTableResource { - /* Name of the Cosmos DB Cassandra table */ - id: string; - /* Time to live of the Cosmos DB Cassandra table */ - defaultTtl: number; - /* Schema of the Cosmos DB Cassandra table */ - schema: CassandraSchema; - - /* Analytical TTL. */ - analyticalStorageTtl: number; -} - -interface CassandraSchema { - /* List of Cassandra table columns. */ - columns: Column[]; - - /* List of partition key. */ - partitionKeys: CassandraPartitionKey[]; - - /* List of cluster key. */ - clusterKeys: ClusterKey[]; -} - -interface Column { - /* Name of the Cosmos DB Cassandra table column */ - name: string; - /* Type of the Cosmos DB Cassandra table column */ - type: string; -} - -interface CassandraPartitionKey { - /* Name of the Cosmos DB Cassandra table partition key */ - name: string; -} - -interface ClusterKey { - /* Name of the Cosmos DB Cassandra table cluster key */ - name: string; - /* Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" */ - orderBy: string; -} - -interface GremlinDatabaseResource { - /* Name of the Cosmos DB Gremlin database */ - id: string; -} - -interface GremlinGraphResource { - /* Name of the Cosmos DB Gremlin graph */ - id: string; - /* The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph */ - indexingPolicy: IndexingPolicy; - - /* The configuration of the partition key to be used for partitioning data into multiple partitions */ - partitionKey: ContainerPartitionKey; - - /* Default time to live */ - defaultTtl: number; - /* The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. */ - uniqueKeyPolicy: UniqueKeyPolicy; - - /* The conflict resolution policy for the graph. */ - conflictResolutionPolicy: ConflictResolutionPolicy; -} - -interface CreateUpdateOptions { - /* Request Units per second. For example, "throughput": 10000. */ - throughput: number; - /* Specifies the Autoscale settings. */ - autoscaleSettings: AutoscaleSettings; -} - -interface AutoscaleSettings { - /* Represents maximum throughput, the resource can scale up to. */ - maxThroughput: number; -} - -interface Capability { - /* Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". */ - name: string; -} - -/* 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". */ -type Tags = { [key: string]: string }; -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: string; -} - -/* 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. */ -type ProvisioningState = string; - -/* Array of IpAddressOrRange objects. */ -type IPRules = IpAddressOrRange[]; -interface IpAddressOrRange { - /* A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. */ - ipAddressOrRange: string; -} - -interface VirtualNetworkRule { - /* Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. */ - id: string; - /* Create firewall rule before the virtual network has vnet service endpoint enabled. */ - ignoreMissingVNetServiceEndpoint: boolean; -} - -type PrivateEndpointConnection = unknown & { - /* Resource properties. */ - properties: PrivateEndpointConnectionProperties; -}; - -interface PrivateEndpointConnectionProperties { - /* Private endpoint which the connection belongs to. */ - privateEndpoint: PrivateEndpointProperty; - - /* Connection State of the Private Endpoint Connection. */ - privateLinkServiceConnectionState: PrivateLinkServiceConnectionStateProperty; -} - -interface PrivateEndpointProperty { - /* Resource id of the private endpoint. */ - id: string; -} - -interface PrivateLinkServiceConnectionStateProperty { - /* The private link service connection status. */ - status: string; - /* Any action that is required beyond basic workflow (approve/ reject/ disconnect) */ - readonly actionsRequired: string; -} - -interface Operation { - /* Operation name: {provider}/{resource}/{operation} */ - name: string; - /* The object that represents the operation. */ - display: undefined; -} - -interface OperationListResult { - /* List of operations supported by the Resource Provider. */ - value: Operation[]; - - /* URL to get the next set of operation list results if there are any. */ - nextLink: string; -} - -interface UsagesResult { - /* The list of usages for the database. A usage is a point in time metric */ - readonly value: Usage[]; -} - -interface Usage { - /* The unit of the metric. */ - unit: UnitType; - - /* The name information for the metric. */ - readonly name: MetricName; - - /* The quota period used to summarize the usage values. */ - readonly quotaPeriod: string; - /* Maximum value for this metric */ - readonly limit: number; - /* Current value for this metric */ - readonly currentValue: number; -} - -interface PartitionUsagesResult { - /* The list of partition-level usages for the database. A usage is a point in time metric */ - readonly value: PartitionUsage[]; -} - -type PartitionUsage = Usage & { - /* The partition id (GUID identifier) of the usages. */ - readonly partitionId: string; - /* The partition key range id (integer identifier) of the usages. */ - readonly partitionKeyRangeId: string; -}; - -interface MetricDefinitionsListResult { - /* The list of metric definitions for the account. */ - readonly value: MetricDefinition[]; -} - -interface MetricDefinition { - /* The list of metric availabilities for the account. */ - readonly metricAvailabilities: MetricAvailability[]; - - /* The primary aggregation type of the metric. */ - readonly primaryAggregationType: string; - /* The unit of the metric. */ - unit: UnitType; - - /* The resource uri of the database. */ - readonly resourceUri: string; - /* The name information for the metric. */ - readonly name: MetricName; -} - -interface MetricAvailability { - /* The time grain to be used to summarize the metric values. */ - readonly timeGrain: string; - /* The retention for the metric values. */ - readonly retention: string; -} - -interface MetricListResult { - /* The list of metrics for the account. */ - readonly value: Metric[]; -} - -interface Metric { - /* The start time for the metric (ISO-8601 format). */ - readonly startTime: string; - /* The end time for the metric (ISO-8601 format). */ - readonly endTime: string; - /* The time grain to be used to summarize the metric values. */ - readonly timeGrain: string; - /* The unit of the metric. */ - unit: UnitType; - - /* The name information for the metric. */ - readonly name: MetricName; - - /* The metric values for the specified time window and timestep. */ - readonly metricValues: MetricValue[]; -} - -interface MetricName { - /* The name of the metric. */ - readonly value: string; - /* The friendly name of the metric. */ - readonly localizedValue: string; -} - -interface MetricValue { - /* The number of values for the metric. */ - readonly _count: number; - /* The average value of the metric. */ - readonly average: number; - /* The max value of the metric. */ - readonly maximum: number; - /* The min value of the metric. */ - readonly minimum: number; - /* The metric timestamp (ISO-8601 format). */ - readonly timestamp: string; - /* The total value of the metric. */ - readonly total: number; -} - -interface PercentileMetricListResult { - /* The list of percentile metrics for the account. */ - readonly value: PercentileMetric[]; -} - -interface PercentileMetric { - /* The start time for the metric (ISO-8601 format). */ - readonly startTime: string; - /* The end time for the metric (ISO-8601 format). */ - readonly endTime: string; - /* The time grain to be used to summarize the metric values. */ - readonly timeGrain: string; - /* The unit of the metric. */ - unit: UnitType; - - /* The name information for the metric. */ - readonly name: MetricName; - - /* The percentile metric values for the specified time window and timestep. */ - readonly metricValues: PercentileMetricValue[]; -} - -type PercentileMetricValue = MetricValue & { - /* The 10th percentile value for the metric. */ - readonly P10: number; - /* The 25th percentile value for the metric. */ - readonly P25: number; - /* The 50th percentile value for the metric. */ - readonly P50: number; - /* The 75th percentile value for the metric. */ - readonly P75: number; - /* The 90th percentile value for the metric. */ - readonly P90: number; - /* The 95th percentile value for the metric. */ - readonly P95: number; - /* The 99th percentile value for the metric. */ - readonly P99: number; -}; - -interface PartitionMetricListResult { - /* The list of partition-level metrics for the account. */ - readonly value: PartitionMetric[]; -} - -type PartitionMetric = Metric & { - /* The partition id (GUID identifier) of the metric values. */ - readonly partitionId: string; - /* The partition key range id (integer identifier) of the metric values. */ - readonly partitionKeyRangeId: string; -}; - -/* The unit of the metric. */ -type UnitType = "Count" | "Bytes" | "Seconds" | "Percent" | "CountPerSecond" | "BytesPerSecond" | "Milliseconds"; - -/* The cassandra connector offer type for the Cosmos DB C* database account. */ -type ConnectorOffer = "Small"; - -/* Whether requests from Public Network are allowed */ -type PublicNetworkAccess = "Enabled" | "Disabled"; -interface ApiProperties { - /* Describes the ServerVersion of an a MongoDB account. */ - serverVersion: string; -} - -/* Enum to indicate the mode of account creation. */ -type CreateMode = "Default" | "Restore"; -interface RestoreParameters { - /* Describes the mode of the restore. */ - restoreMode: string; - /* Path of the source account from which the restore has to be initiated */ - restoreSource: string; - /* Time to which the account has to be restored (ISO-8601 format). */ - restoreTimestampInUtc: string; - /* List of specific databases to restore. */ - databasesToRestore: DatabaseRestoreResource[]; -} - -interface DatabaseRestoreResource { - /* The name of the database to restore. */ - databaseName: string; - /* The names of the collections to restore. */ - collectionNames: CollectionName[]; -} - -/* The name of the collection. */ -type CollectionName = string; -interface BackupPolicy { - /* Describes the mode of backups. */ - type: string; -} - -type PeriodicModeBackupPolicy = BackupPolicy & { - /* Configuration values for periodic mode backup */ - periodicModeProperties: PeriodicModeProperties; -}; - -/* The object representing continuous mode backup policy. */ -type ContinuousModeBackupPolicy = BackupPolicy; -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; -} - -interface RestorableDatabaseAccountsListResult { - /* List of restorable database accounts and their properties. */ - readonly value: RestorableDatabaseAccountGetResult[]; -} - -type RestorableDatabaseAccountGetResult = ARMResourceProperties & { - /* The properties of a restorable database account. */ - properties: RestorableDatabaseAccountProperties; -}; - -interface RestorableDatabaseAccountProperties { - /* The name of the global database account */ - accountName: string; - /* The creation time of the restorable database account (ISO-8601 format). */ - creationTime: string; - /* The time at which the restorable database account has been deleted (ISO-8601 format). */ - deletionTime: string; -} - -export const DatabaseAccounts = { - /* Retrieves the properties of an existing Azure Cosmos DB database account. */ - async get( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Updates the properties of an existing Azure Cosmos DB database account. */ - async update( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - body: DatabaseAccountUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, - { method: "patch", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */ - async createOrUpdate( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - body: DatabaseAccountCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB database account. */ - async delete(subscriptionId: string, resourceGroupName: string, accountName: string): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */ - async failoverPriorityChange( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - body: FailoverPolicies - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/failoverPriorityChange`, - { method: "post", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Lists all the Azure Cosmos DB database accounts available under the subscription. */ - async list(subscriptionId: string): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Lists all the Azure Cosmos DB database accounts available under the given resource group. */ - async listByResourceGroup(subscriptionId: string, resourceGroupName: string): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Lists the access keys for the specified Azure Cosmos DB database account. */ - async listKeys( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listKeys`, - { method: "post" } - ) - .then(response => response.json()); - }, - /* Lists the connection strings for the specified Azure Cosmos DB database account. */ - async listConnectionStrings( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listConnectionStrings`, - { method: "post" } - ) - .then(response => response.json()); - }, - /* Offline the specified region for the specified Azure Cosmos DB database account. */ - async offlineRegion( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - body: RegionForOnlineOffline - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/offlineRegion`, - { method: "post", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Online the specified region for the specified Azure Cosmos DB database account. */ - async onlineRegion( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - body: RegionForOnlineOffline - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/onlineRegion`, - { method: "post", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Lists the read-only access keys for the specified Azure Cosmos DB database account. */ - async getReadOnlyKeys( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Lists the read-only access keys for the specified Azure Cosmos DB database account. */ - async listReadOnlyKeys( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`, - { method: "post" } - ) - .then(response => response.json()); - }, - /* Regenerates an access key for the specified Azure Cosmos DB database account. */ - async regenerateKey( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - body: DatabaseAccountRegenerateKeyParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/regenerateKey`, - { method: "post", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. */ - async checkNameExists(accountName: string): Promise { - return window - .fetch(`https://management.azure.com/providers/Microsoft.DocumentDB/databaseAccountNames/${accountName}`, { - method: "head" - }) - .then(response => response.json()); - }, - /* Retrieves the metrics determined by the given filter for the given database account. */ - async listMetrics(subscriptionId: string, resourceGroupName: string, accountName: string): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metrics`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Retrieves the usages (most recent data) for the given database account. */ - async listUsages(subscriptionId: string, resourceGroupName: string, accountName: string): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/usages`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Retrieves metric definitions for the given database account. */ - async listMetricDefinitions( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metricDefinitions`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const Operations = { - /* Lists all of the available Cosmos DB Resource Provider operations. */ - async list(): Promise { - return window - .fetch(`https://management.azure.com/providers/Microsoft.DocumentDB/operations`, { method: "get" }) - .then(response => response.json()); - } -}; -export const Database = { - /* Retrieves the metrics determined by the given filter for the given database account and database. */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metrics`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Retrieves the usages (most recent data) for the given database. */ - async listUsages( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/usages`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Retrieves metric definitions for the given database. */ - async listMetricDefinitions( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metricDefinitions`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const Collection = { - /* Retrieves the metrics determined by the given filter for the given database account and collection. */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string, - collectionRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metrics`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Retrieves the usages (most recent storage data) for the given collection. */ - async listUsages( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string, - collectionRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/usages`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Retrieves metric definitions for the given collection. */ - async listMetricDefinitions( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string, - collectionRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metricDefinitions`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const CollectionRegion = { - /* Retrieves the metrics determined by the given filter for the given database account, collection and region. */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - region: string, - databaseRid: string, - collectionRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/metrics`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const DatabaseAccountRegion = { - /* Retrieves the metrics determined by the given filter for the given database account and region. */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - region: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/metrics`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const PercentileSourceTarget = { - /* 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 */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - sourceRegion: string, - targetRegion: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sourceRegion/${sourceRegion}/targetRegion/${targetRegion}/percentile/metrics`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const PercentileTarget = { - /* Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - targetRegion: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/targetRegion/${targetRegion}/percentile/metrics`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const Percentile = { - /* Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/percentile/metrics`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const CollectionPartitionRegion = { - /* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - region: string, - databaseRid: string, - collectionRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const CollectionPartition = { - /* Retrieves the metrics determined by the given filter for the given collection, split by partition. */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string, - collectionRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Retrieves the usages (most recent storage data) for the given collection, split by partition. */ - async listUsages( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string, - collectionRid: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/usages`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const PartitionKeyRangeId = { - /* Retrieves the metrics determined by the given filter for the given partition key range id. */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseRid: string, - collectionRid: string, - partitionKeyRangeId: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const PartitionKeyRangeIdRegion = { - /* Retrieves the metrics determined by the given filter for the given partition key range id and region. */ - async listMetrics( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - region: string, - databaseRid: string, - collectionRid: string, - partitionKeyRangeId: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`, - { method: "get" } - ) - .then(response => response.json()); - } -}; -export const SqlResources = { - /* Lists the SQL databases under an existing Azure Cosmos DB database account. */ - async listSqlDatabases( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */ - async getSqlDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB SQL database */ - async createUpdateSqlDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - body: SqlDatabaseCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB SQL database. */ - async deleteSqlDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. */ - async getSqlDatabaseThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update RUs per second of an Azure Cosmos DB SQL database */ - async updateSqlDatabaseThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Lists the SQL container under an existing Azure Cosmos DB database account. */ - async listSqlContainers( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the SQL container under an existing Azure Cosmos DB database account. */ - async getSqlContainer( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB SQL container */ - async createUpdateSqlContainer( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - body: SqlContainerCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB SQL container. */ - async deleteSqlContainer( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. */ - async getSqlContainerThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update RUs per second of an Azure Cosmos DB SQL container */ - async updateSqlContainerThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */ - async listSqlStoredProcedures( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. */ - async getSqlStoredProcedure( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - storedProcedureName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB SQL storedProcedure */ - async createUpdateSqlStoredProcedure( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - storedProcedureName: string, - body: SqlStoredProcedureCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB SQL storedProcedure. */ - async deleteSqlStoredProcedure( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - storedProcedureName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */ - async listSqlUserDefinedFunctions( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */ - async getSqlUserDefinedFunction( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - userDefinedFunctionName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB SQL userDefinedFunction */ - async createUpdateSqlUserDefinedFunction( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - userDefinedFunctionName: string, - body: SqlUserDefinedFunctionCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB SQL userDefinedFunction. */ - async deleteSqlUserDefinedFunction( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - userDefinedFunctionName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Lists the SQL trigger under an existing Azure Cosmos DB database account. */ - async listSqlTriggers( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the SQL trigger under an existing Azure Cosmos DB database account. */ - async getSqlTrigger( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - triggerName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB SQL trigger */ - async createUpdateSqlTrigger( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - triggerName: string, - body: SqlTriggerCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB SQL trigger. */ - async deleteSqlTrigger( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - containerName: string, - triggerName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, - { method: "delete" } - ) - .then(response => response.json()); - } -}; -export const MongoDBResources = { - /* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */ - async listMongoDBDatabases( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. */ - async getMongoDBDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or updates Azure Cosmos DB MongoDB database */ - async createUpdateMongoDBDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - body: MongoDBDatabaseCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB MongoDB database. */ - async deleteMongoDBDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. */ - async getMongoDBDatabaseThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update RUs per second of the an Azure Cosmos DB MongoDB database */ - async updateMongoDBDatabaseThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Lists the MongoDB collection under an existing Azure Cosmos DB database account. */ - async listMongoDBCollections( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the MongoDB collection under an existing Azure Cosmos DB database account. */ - async getMongoDBCollection( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - collectionName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB MongoDB Collection */ - async createUpdateMongoDBCollection( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - collectionName: string, - body: MongoDBCollectionCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB MongoDB Collection. */ - async deleteMongoDBCollection( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - collectionName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. */ - async getMongoDBCollectionThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - collectionName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update the RUs per second of an Azure Cosmos DB MongoDB collection */ - async updateMongoDBCollectionThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - collectionName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - } -}; -export const TableResources = { - /* Lists the Tables under an existing Azure Cosmos DB database account. */ - async listTables(subscriptionId: string, resourceGroupName: string, accountName: string): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */ - async getTable( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - tableName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB Table */ - async createUpdateTable( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - tableName: string, - body: TableCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB Table. */ - async deleteTable( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - tableName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */ - async getTableThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - tableName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update RUs per second of an Azure Cosmos DB Table */ - async updateTableThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - tableName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - } -}; -export const CassandraResources = { - /* Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. */ - async listCassandraKeyspaces( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. */ - async getCassandraKeyspace( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB Cassandra keyspace */ - async createUpdateCassandraKeyspace( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string, - body: CassandraKeyspaceCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB Cassandra keyspace. */ - async deleteCassandraKeyspace( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. */ - async getCassandraKeyspaceThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update RUs per second of an Azure Cosmos DB Cassandra Keyspace */ - async updateCassandraKeyspaceThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Lists the Cassandra table under an existing Azure Cosmos DB database account. */ - async listCassandraTables( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the Cassandra table under an existing Azure Cosmos DB database account. */ - async getCassandraTable( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string, - tableName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB Cassandra Table */ - async createUpdateCassandraTable( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string, - tableName: string, - body: CassandraTableCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB Cassandra table. */ - async deleteCassandraTable( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string, - tableName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. */ - async getCassandraTableThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string, - tableName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update RUs per second of an Azure Cosmos DB Cassandra table */ - async updateCassandraTableThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - keyspaceName: string, - tableName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - } -}; -export const GremlinResources = { - /* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */ - async listGremlinDatabases( - subscriptionId: string, - resourceGroupName: string, - accountName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. */ - async getGremlinDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB Gremlin database */ - async createUpdateGremlinDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - body: GremlinDatabaseCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB Gremlin database. */ - async deleteGremlinDatabase( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. */ - async getGremlinDatabaseThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update RUs per second of an Azure Cosmos DB Gremlin database */ - async updateGremlinDatabaseThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Lists the Gremlin graph under an existing Azure Cosmos DB database account. */ - async listGremlinGraphs( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Gets the Gremlin graph under an existing Azure Cosmos DB database account. */ - async getGremlinGraph( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - graphName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Create or update an Azure Cosmos DB Gremlin graph */ - async createUpdateGremlinGraph( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - graphName: string, - body: GremlinGraphCreateUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - }, - /* Deletes an existing Azure Cosmos DB Gremlin graph. */ - async deleteGremlinGraph( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - graphName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, - { method: "delete" } - ) - .then(response => response.json()); - }, - /* Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. */ - async getGremlinGraphThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - graphName: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Update RUs per second of an Azure Cosmos DB Gremlin graph */ - async updateGremlinGraphThroughput( - subscriptionId: string, - resourceGroupName: string, - accountName: string, - databaseName: string, - graphName: string, - body: ThroughputSettingsUpdateParameters - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`, - { method: "put", body: JSON.stringify(body) } - ) - .then(response => response.json()); - } -}; -export const RestorableDatabaseAccounts = { - /* Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. */ - async listByLocation( - subscriptionId: string, - location: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Lists all the restorable Azure Cosmos DB database accounts available under the subscription. */ - async list(subscriptionId: string): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts`, - { method: "get" } - ) - .then(response => response.json()); - }, - /* Retrieves the properties of an existing Azure Cosmos DB restorable database account. */ - async getByLocation( - subscriptionId: string, - location: string, - instanceId: string - ): Promise { - return window - .fetch( - `https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts/${instanceId}`, - { method: "get" } - ) - .then(response => response.json()); - } -}; diff --git a/package-lock.json b/package-lock.json index f93c5ebb5..3a7f1dee1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6024,6 +6024,16 @@ "natural-compare": "^1.4.0", "pretty-format": "^24.9.0", "semver": "^6.2.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + } } }, "jest-validate": { @@ -7577,6 +7587,14 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", "dev": true }, + "@types/mkdirp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz", + "integrity": "sha512-HkGSK7CGAXncr8Qn/0VqNtExEE+PHMWb+qlR1faHMao7ng6P3tAaoWWBMdva0gL5h4zprjIO89GJOLXsMcDm1Q==", + "requires": { + "@types/node": "*" + } + }, "@types/node": { "version": "12.11.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.11.1.tgz", @@ -8424,7 +8442,6 @@ "graceful-fs": "^4.1.11", "lru-cache": "^4.1.1", "mississippi": "^2.0.0", - "mkdirp": "^0.5.1", "move-concurrently": "^1.0.1", "promise-inflight": "^1.0.1", "rimraf": "^2.6.2", @@ -9363,6 +9380,15 @@ "pkg-dir": "^3.0.0" } }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -10677,6 +10703,14 @@ "run-queue": "^1.0.0" }, "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -19775,6 +19809,16 @@ "mkdirp": "^0.5.1", "slash": "^2.0.0", "source-map": "^0.6.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + } } }, "jest-validate": { @@ -20358,6 +20402,16 @@ "dev": true, "optional": true }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "optional": true, + "requires": { + "minimist": "^1.2.5" + } + }, "promise": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", @@ -21308,12 +21362,9 @@ } }, "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "requires": { - "minimist": "^1.2.5" - } + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" }, "mkdirp-classic": { "version": "0.5.3", @@ -21359,6 +21410,14 @@ "run-queue": "^1.0.3" }, "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -21698,6 +21757,14 @@ "tar": "^4" }, "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -22597,6 +22664,15 @@ "requires": { "ms": "^2.1.1" } + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } } } }, @@ -25497,6 +25573,16 @@ "mkdirp": "^0.5.0", "safe-buffer": "^5.1.2", "yallist": "^3.0.3" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + } } }, "tar-fs": { @@ -25854,6 +25940,14 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + }, "yargs-parser": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", @@ -26922,6 +27016,15 @@ "readable-stream": "^2.0.1" } }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -27033,6 +27136,15 @@ "integrity": "sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==", "dev": true }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "ws": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", @@ -27245,6 +27357,15 @@ "readable-stream": "^2.0.1" } }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -27552,6 +27673,17 @@ "dev": true, "requires": { "mkdirp": "^0.5.1" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } } }, "write-file-atomic": { diff --git a/package.json b/package.json index ae6587230..eb466bd0c 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@nteract/transform-vega": "7.0.6", "@octokit/rest": "17.9.2", "@phosphor/widgets": "1.9.3", + "@types/mkdirp": "1.0.1", "@types/node-fetch": "2.5.7", "@uifabric/react-cards": "0.109.110", "@uifabric/styling": "7.13.7", @@ -61,6 +62,7 @@ "jquery-typeahead": "2.10.6", "jquery-ui-dist": "1.12.1", "knockout": "3.5.1", + "mkdirp": "1.0.4", "monaco-editor": "0.15.6", "object.entries": "1.1.0", "office-ui-fabric-react": "7.121.10", @@ -190,7 +192,7 @@ "strictEligibleFiles": "node ./strict-migration-tools/index.js", "autoAddStrictEligibleFiles": "node ./strict-migration-tools/autoAdd.js", "compile:fullStrict": "tsc -p ./tsconfig.json --strictNullChecks", - "generateARMClient": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts" + "generateARMClients": "ts-node --compiler-options '{\"module\":\"commonjs\"}' utils/armClientGenerator/generator.ts" }, "repository": { "type": "git", diff --git a/src/Utils/arm/CassandraResources.ts b/src/Utils/arm/CassandraResources.ts new file mode 100644 index 000000000..118cafe0f --- /dev/null +++ b/src/Utils/arm/CassandraResources.ts @@ -0,0 +1,167 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. */ + export async function listCassandraKeyspaces ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. */ + export async function getCassandraKeyspace ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB Cassandra keyspace */ + export async function createUpdateCassandraKeyspace ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string + ,body: Types.CassandraKeyspaceCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB Cassandra keyspace. */ + export async function deleteCassandraKeyspace ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. */ + export async function getCassandraKeyspaceThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update RUs per second of an Azure Cosmos DB Cassandra Keyspace */ + export async function updateCassandraKeyspaceThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Lists the Cassandra table under an existing Azure Cosmos DB database account. */ + export async function listCassandraTables ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the Cassandra table under an existing Azure Cosmos DB database account. */ + export async function getCassandraTable ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string, +tableName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB Cassandra Table */ + export async function createUpdateCassandraTable ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string, +tableName: string + ,body: Types.CassandraTableCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB Cassandra table. */ + export async function deleteCassandraTable ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string, +tableName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. */ + export async function getCassandraTableThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string, +tableName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update RUs per second of an Azure Cosmos DB Cassandra table */ + export async function updateCassandraTableThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +keyspaceName: string, +tableName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/cassandraKeyspaces/${keyspaceName}/tables/${tableName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/Collection.ts b/src/Utils/arm/Collection.ts new file mode 100644 index 000000000..56b732b5e --- /dev/null +++ b/src/Utils/arm/Collection.ts @@ -0,0 +1,49 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Retrieves the metrics determined by the given filter for the given database account and collection. */ + export async function listMetrics ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseRid: string, +collectionRid: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metrics`, { method: "get", }).then((response) => response.json()) + } + + + + /* Retrieves the usages (most recent storage data) for the given collection. */ + export async function listUsages ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseRid: string, +collectionRid: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/usages`, { method: "get", }).then((response) => response.json()) + } + + + + /* Retrieves metric definitions for the given collection. */ + export async function listMetricDefinitions ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseRid: string, +collectionRid: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/metricDefinitions`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/CollectionPartition.ts b/src/Utils/arm/CollectionPartition.ts new file mode 100644 index 000000000..1da21132b --- /dev/null +++ b/src/Utils/arm/CollectionPartition.ts @@ -0,0 +1,35 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Retrieves the metrics determined by the given filter for the given collection, split by partition. */ + export async function listMetrics ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseRid: string, +collectionRid: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`, { method: "get", }).then((response) => response.json()) + } + + + + /* Retrieves the usages (most recent storage data) for the given collection, split by partition. */ + export async function listUsages ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseRid: string, +collectionRid: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitions/usages`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/CollectionPartitionRegion.ts b/src/Utils/arm/CollectionPartitionRegion.ts new file mode 100644 index 000000000..4e77f8002 --- /dev/null +++ b/src/Utils/arm/CollectionPartitionRegion.ts @@ -0,0 +1,22 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Retrieves the metrics determined by the given filter for the given collection and region, split by partition. */ + export async function listMetrics ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +region: string, +databaseRid: string, +collectionRid: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitions/metrics`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/CollectionRegion.ts b/src/Utils/arm/CollectionRegion.ts new file mode 100644 index 000000000..e8a84317b --- /dev/null +++ b/src/Utils/arm/CollectionRegion.ts @@ -0,0 +1,22 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Retrieves the metrics determined by the given filter for the given database account, collection and region. */ + export async function listMetrics ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +region: string, +databaseRid: string, +collectionRid: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/metrics`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/Database.ts b/src/Utils/arm/Database.ts new file mode 100644 index 000000000..94b4a8a2b --- /dev/null +++ b/src/Utils/arm/Database.ts @@ -0,0 +1,52 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types"; + +/* Retrieves the metrics determined by the given filter for the given database account and database. */ +export async function listMetrics( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + databaseRid: string +): Promise { + return window + .fetch( + `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metrics`, + { method: "get" } + ) + .then(response => response.json()); +} + +/* Retrieves the usages (most recent data) for the given database. */ +export async function listUsages( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + databaseRid: string +): Promise { + return window + .fetch( + `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/usages`, + { method: "get" } + ) + .then(response => response.json()); +} + +/* Retrieves metric definitions for the given database. */ +export async function listMetricDefinitions( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + databaseRid: string +): Promise { + return window + .fetch( + `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/metricDefinitions`, + { method: "get" } + ) + .then(response => response.json()); +} diff --git a/src/Utils/arm/DatabaseAccountRegion.ts b/src/Utils/arm/DatabaseAccountRegion.ts new file mode 100644 index 000000000..31b087b86 --- /dev/null +++ b/src/Utils/arm/DatabaseAccountRegion.ts @@ -0,0 +1,22 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types"; + +/* Retrieves the metrics determined by the given filter for the given database account and region. */ +export async function listMetrics( + subscriptionId: string, + resourceGroupName: string, + accountName: string, + region: string +): Promise { + return window + .fetch( + `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/metrics`, + { method: "get" } + ) + .then(response => response.json()); +} diff --git a/src/Utils/arm/DatabaseAccounts.ts b/src/Utils/arm/DatabaseAccounts.ts new file mode 100644 index 000000000..f8100a998 --- /dev/null +++ b/src/Utils/arm/DatabaseAccounts.ts @@ -0,0 +1,218 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Retrieves the properties of an existing Azure Cosmos DB database account. */ + export async function get ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Updates the properties of an existing Azure Cosmos DB database account. */ + export async function update ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + ,body: Types.DatabaseAccountUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "patch", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */ + export async function createOrUpdate ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + ,body: Types.DatabaseAccountCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB database account. */ + export async function delete ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */ + export async function failoverPriorityChange ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + ,body: Types.FailoverPolicies + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/failoverPriorityChange`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Lists all the Azure Cosmos DB database accounts available under the subscription. */ + export async function list ( + subscriptionId: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts`, { method: "get", }).then((response) => response.json()) + } + + + + /* Lists all the Azure Cosmos DB database accounts available under the given resource group. */ + export async function listByResourceGroup ( + subscriptionId: string, +resourceGroupName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts`, { method: "get", }).then((response) => response.json()) + } + + + + /* Lists the access keys for the specified Azure Cosmos DB database account. */ + export async function listKeys ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listKeys`, { method: "post", }).then((response) => response.json()) + } + + + + /* Lists the connection strings for the specified Azure Cosmos DB database account. */ + export async function listConnectionStrings ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/listConnectionStrings`, { method: "post", }).then((response) => response.json()) + } + + + + /* Offline the specified region for the specified Azure Cosmos DB database account. */ + export async function offlineRegion ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + ,body: Types.RegionForOnlineOffline + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/offlineRegion`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Online the specified region for the specified Azure Cosmos DB database account. */ + export async function onlineRegion ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + ,body: Types.RegionForOnlineOffline + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/onlineRegion`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Lists the read-only access keys for the specified Azure Cosmos DB database account. */ + export async function getReadOnlyKeys ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`, { method: "get", }).then((response) => response.json()) + } + + + + /* Lists the read-only access keys for the specified Azure Cosmos DB database account. */ + export async function listReadOnlyKeys ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/readonlykeys`, { method: "post", }).then((response) => response.json()) + } + + + + /* Regenerates an access key for the specified Azure Cosmos DB database account. */ + export async function regenerateKey ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + ,body: Types.DatabaseAccountRegenerateKeyParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/regenerateKey`, { method: "post", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. */ + export async function checkNameExists ( + accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/providers/Microsoft.DocumentDB/databaseAccountNames/${accountName}`, { method: "head", }).then((response) => response.json()) + } + + + + /* Retrieves the metrics determined by the given filter for the given database account. */ + export async function listMetrics ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metrics`, { method: "get", }).then((response) => response.json()) + } + + + + /* Retrieves the usages (most recent data) for the given database account. */ + export async function listUsages ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/usages`, { method: "get", }).then((response) => response.json()) + } + + + + /* Retrieves metric definitions for the given database account. */ + export async function listMetricDefinitions ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/metricDefinitions`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/GremlinResources.ts b/src/Utils/arm/GremlinResources.ts new file mode 100644 index 000000000..9a408e67b --- /dev/null +++ b/src/Utils/arm/GremlinResources.ts @@ -0,0 +1,167 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Lists the Gremlin databases under an existing Azure Cosmos DB database account. */ + export async function listGremlinDatabases ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. */ + export async function getGremlinDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB Gremlin database */ + export async function createUpdateGremlinDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + ,body: Types.GremlinDatabaseCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB Gremlin database. */ + export async function deleteGremlinDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. */ + export async function getGremlinDatabaseThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update RUs per second of an Azure Cosmos DB Gremlin database */ + export async function updateGremlinDatabaseThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Lists the Gremlin graph under an existing Azure Cosmos DB database account. */ + export async function listGremlinGraphs ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the Gremlin graph under an existing Azure Cosmos DB database account. */ + export async function getGremlinGraph ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +graphName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB Gremlin graph */ + export async function createUpdateGremlinGraph ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +graphName: string + ,body: Types.GremlinGraphCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB Gremlin graph. */ + export async function deleteGremlinGraph ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +graphName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. */ + export async function getGremlinGraphThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +graphName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update RUs per second of an Azure Cosmos DB Gremlin graph */ + export async function updateGremlinGraphThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +graphName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/gremlinDatabases/${databaseName}/graphs/${graphName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/MongoDBResources.ts b/src/Utils/arm/MongoDBResources.ts new file mode 100644 index 000000000..8528fca97 --- /dev/null +++ b/src/Utils/arm/MongoDBResources.ts @@ -0,0 +1,167 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Lists the MongoDB databases under an existing Azure Cosmos DB database account. */ + export async function listMongoDBDatabases ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. */ + export async function getMongoDBDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or updates Azure Cosmos DB MongoDB database */ + export async function createUpdateMongoDBDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + ,body: Types.MongoDBDatabaseCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB MongoDB database. */ + export async function deleteMongoDBDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. */ + export async function getMongoDBDatabaseThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update RUs per second of the an Azure Cosmos DB MongoDB database */ + export async function updateMongoDBDatabaseThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Lists the MongoDB collection under an existing Azure Cosmos DB database account. */ + export async function listMongoDBCollections ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the MongoDB collection under an existing Azure Cosmos DB database account. */ + export async function getMongoDBCollection ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +collectionName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB MongoDB Collection */ + export async function createUpdateMongoDBCollection ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +collectionName: string + ,body: Types.MongoDBCollectionCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB MongoDB Collection. */ + export async function deleteMongoDBCollection ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +collectionName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. */ + export async function getMongoDBCollectionThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +collectionName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update the RUs per second of an Azure Cosmos DB MongoDB collection */ + export async function updateMongoDBCollectionThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +collectionName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/mongodbDatabases/${databaseName}/collections/${collectionName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/Operations.ts b/src/Utils/arm/Operations.ts new file mode 100644 index 000000000..02c63d2d0 --- /dev/null +++ b/src/Utils/arm/Operations.ts @@ -0,0 +1,17 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Lists all of the available Cosmos DB Resource Provider operations. */ + export async function list ( + + + ) : Promise { + return window.fetch(`https://management.azure.com/providers/Microsoft.DocumentDB/operations`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/PartitionKeyRangeId.ts b/src/Utils/arm/PartitionKeyRangeId.ts new file mode 100644 index 000000000..3249dd2b9 --- /dev/null +++ b/src/Utils/arm/PartitionKeyRangeId.ts @@ -0,0 +1,22 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Retrieves the metrics determined by the given filter for the given partition key range id. */ + export async function listMetrics ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseRid: string, +collectionRid: string, +partitionKeyRangeId: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/PartitionKeyRangeIdRegion.ts b/src/Utils/arm/PartitionKeyRangeIdRegion.ts new file mode 100644 index 000000000..cf1035349 --- /dev/null +++ b/src/Utils/arm/PartitionKeyRangeIdRegion.ts @@ -0,0 +1,23 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Retrieves the metrics determined by the given filter for the given partition key range id and region. */ + export async function listMetrics ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +region: string, +databaseRid: string, +collectionRid: string, +partitionKeyRangeId: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/region/${region}/databases/${databaseRid}/collections/${collectionRid}/partitionKeyRangeId/${partitionKeyRangeId}/metrics`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/Percentile.ts b/src/Utils/arm/Percentile.ts new file mode 100644 index 000000000..edce71e34 --- /dev/null +++ b/src/Utils/arm/Percentile.ts @@ -0,0 +1,19 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* 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 ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/percentile/metrics`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/PercentileSourceTarget.ts b/src/Utils/arm/PercentileSourceTarget.ts new file mode 100644 index 000000000..dc5d6e60c --- /dev/null +++ b/src/Utils/arm/PercentileSourceTarget.ts @@ -0,0 +1,21 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* 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 ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +sourceRegion: string, +targetRegion: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sourceRegion/${sourceRegion}/targetRegion/${targetRegion}/percentile/metrics`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/PercentileTarget.ts b/src/Utils/arm/PercentileTarget.ts new file mode 100644 index 000000000..cb4107e14 --- /dev/null +++ b/src/Utils/arm/PercentileTarget.ts @@ -0,0 +1,20 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* 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 ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +targetRegion: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/targetRegion/${targetRegion}/percentile/metrics`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/RestorableDatabaseAccounts.ts b/src/Utils/arm/RestorableDatabaseAccounts.ts new file mode 100644 index 000000000..b865a4f23 --- /dev/null +++ b/src/Utils/arm/RestorableDatabaseAccounts.ts @@ -0,0 +1,40 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. */ + export async function listByLocation ( + subscriptionId: string, +location: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts`, { method: "get", }).then((response) => response.json()) + } + + + + /* Lists all the restorable Azure Cosmos DB database accounts available under the subscription. */ + export async function list ( + subscriptionId: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts`, { method: "get", }).then((response) => response.json()) + } + + + + /* Retrieves the properties of an existing Azure Cosmos DB restorable database account. */ + export async function getByLocation ( + subscriptionId: string, +location: string, +instanceId: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.DocumentDB/locations/${location}/restorableDatabaseAccounts/${instanceId}`, { method: "get", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/SqlResources.ts b/src/Utils/arm/SqlResources.ts new file mode 100644 index 000000000..b426b349f --- /dev/null +++ b/src/Utils/arm/SqlResources.ts @@ -0,0 +1,344 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Lists the SQL databases under an existing Azure Cosmos DB database account. */ + export async function listSqlDatabases ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */ + export async function getSqlDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB SQL database */ + export async function createUpdateSqlDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + ,body: Types.SqlDatabaseCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB SQL database. */ + export async function deleteSqlDatabase ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. */ + export async function getSqlDatabaseThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update RUs per second of an Azure Cosmos DB SQL database */ + export async function updateSqlDatabaseThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Lists the SQL container under an existing Azure Cosmos DB database account. */ + export async function listSqlContainers ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the SQL container under an existing Azure Cosmos DB database account. */ + export async function getSqlContainer ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB SQL container */ + export async function createUpdateSqlContainer ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string + ,body: Types.SqlContainerCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB SQL container. */ + export async function deleteSqlContainer ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. */ + export async function getSqlContainerThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update RUs per second of an Azure Cosmos DB SQL container */ + export async function updateSqlContainerThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. */ + export async function listSqlStoredProcedures ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. */ + export async function getSqlStoredProcedure ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +storedProcedureName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB SQL storedProcedure */ + export async function createUpdateSqlStoredProcedure ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +storedProcedureName: string + ,body: Types.SqlStoredProcedureCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB SQL storedProcedure. */ + export async function deleteSqlStoredProcedure ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +storedProcedureName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/storedProcedures/${storedProcedureName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */ + export async function listSqlUserDefinedFunctions ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. */ + export async function getSqlUserDefinedFunction ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +userDefinedFunctionName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB SQL userDefinedFunction */ + export async function createUpdateSqlUserDefinedFunction ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +userDefinedFunctionName: string + ,body: Types.SqlUserDefinedFunctionCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB SQL userDefinedFunction. */ + export async function deleteSqlUserDefinedFunction ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +userDefinedFunctionName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/userDefinedFunctions/${userDefinedFunctionName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Lists the SQL trigger under an existing Azure Cosmos DB database account. */ + export async function listSqlTriggers ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the SQL trigger under an existing Azure Cosmos DB database account. */ + export async function getSqlTrigger ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +triggerName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB SQL trigger */ + export async function createUpdateSqlTrigger ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +triggerName: string + ,body: Types.SqlTriggerCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB SQL trigger. */ + export async function deleteSqlTrigger ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +databaseName: string, +containerName: string, +triggerName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases/${databaseName}/containers/${containerName}/triggers/${triggerName}`, { method: "delete", }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/TableResources.ts b/src/Utils/arm/TableResources.ts new file mode 100644 index 000000000..feaff8c12 --- /dev/null +++ b/src/Utils/arm/TableResources.ts @@ -0,0 +1,84 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +import * as Types from "./types" + + + /* Lists the Tables under an existing Azure Cosmos DB database account. */ + export async function listTables ( + subscriptionId: string, +resourceGroupName: string, +accountName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables`, { method: "get", }).then((response) => response.json()) + } + + + + /* Gets the Tables under an existing Azure Cosmos DB database account with the provided name. */ + export async function getTable ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +tableName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "get", }).then((response) => response.json()) + } + + + + /* Create or update an Azure Cosmos DB Table */ + export async function createUpdateTable ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +tableName: string + ,body: Types.TableCreateUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + + + + /* Deletes an existing Azure Cosmos DB Table. */ + export async function deleteTable ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +tableName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}`, { method: "delete", }).then((response) => response.json()) + } + + + + /* Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. */ + export async function getTableThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +tableName: string + + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`, { method: "get", }).then((response) => response.json()) + } + + + + /* Update RUs per second of an Azure Cosmos DB Table */ + export async function updateTableThroughput ( + subscriptionId: string, +resourceGroupName: string, +accountName: string, +tableName: string + ,body: Types.ThroughputSettingsUpdateParameters + ) : Promise { + return window.fetch(`https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/tables/${tableName}/throughputSettings/default`, { method: "put", body: JSON.stringify(body) }).then((response) => response.json()) + } + \ No newline at end of file diff --git a/src/Utils/arm/types.ts b/src/Utils/arm/types.ts new file mode 100644 index 000000000..eef8aba32 --- /dev/null +++ b/src/Utils/arm/types.ts @@ -0,0 +1,1261 @@ +/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/ + +export interface DatabaseAccountsListResult { + /* List of database account and their properties. */ + readonly value: DatabaseAccountGetResults[] + } + +export interface SqlDatabaseListResult { + /* List of SQL databases and their properties. */ + readonly value: SqlDatabaseGetResults[] + } + +export interface SqlContainerListResult { + /* List of containers and their properties. */ + readonly value: SqlContainerGetResults[] + } + +export interface SqlStoredProcedureListResult { + /* List of storedProcedures and their properties. */ + readonly value: SqlStoredProcedureGetResults[] + } + +export interface SqlUserDefinedFunctionListResult { + /* List of userDefinedFunctions and their properties. */ + readonly value: SqlUserDefinedFunctionGetResults[] + } + +export interface SqlTriggerListResult { + /* List of triggers and their properties. */ + readonly value: SqlTriggerGetResults[] + } + +export interface MongoDBDatabaseListResult { + /* List of MongoDB databases and their properties. */ + readonly value: MongoDBDatabaseGetResults[] + } + +export interface MongoDBCollectionListResult { + /* List of MongoDB collections and their properties. */ + readonly value: MongoDBCollectionGetResults[] + } + +export interface TableListResult { + /* List of Table and their properties. */ + readonly value: TableGetResults[] + } + +export interface CassandraKeyspaceListResult { + /* List of Cassandra keyspaces and their properties. */ + readonly value: CassandraKeyspaceGetResults[] + } + +export interface CassandraTableListResult { + /* List of Cassandra tables and their properties. */ + readonly value: CassandraTableGetResults[] + } + +export interface GremlinDatabaseListResult { + /* List of Gremlin databases and their properties. */ + readonly value: GremlinDatabaseGetResults[] + } + +export interface GremlinGraphListResult { + /* List of graphs and their properties. */ + readonly value: GremlinGraphGetResults[] + } + +export interface ErrorResponse { + /* Error code. */ + code: string + /* Error message indicating why the operation failed. */ + message: string} + +export interface ErrorResponseUpdatedFormat { + /* undefined */ + error: unknown + } + +export interface FailoverPolicies { + /* List of failover policies. */ + failoverPolicies: FailoverPolicy[] + } + +export interface FailoverPolicy { + /* The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. */ + readonly id: string + /* The name of the region in which the database account exists. */ + locationName: string + /* The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */ + failoverPriority: number} + +export interface RegionForOnlineOffline { + /* Cosmos DB region, with spaces between words and each word capitalized. */ + region: string} + +export interface Location { + /* The unique identifier of the region within the database account. Example: <accountName>-<locationName>. */ + readonly id: string + /* The name of the region. */ + locationName: string + /* The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ */ + readonly documentEndpoint: string + /* undefined */ + provisioningState: ProvisioningState + + /* The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. */ + failoverPriority: number + /* Flag to indicate whether or not this region is an AvailabilityZone region */ + isZoneRedundant: boolean} + +export interface ARMResourceProperties { + /* The unique resource identifier of the ARM resource. */ + readonly id: string + /* The name of the ARM resource. */ + readonly name: string + /* The type of Azure resource. */ + readonly type: string + /* The location of the resource group to which the resource belongs. */ + location: string + /* undefined */ + tags: Tags + + /* undefined */ + identity: ManagedServiceIdentity + } + +export interface ARMProxyResource { + /* The unique resource identifier of the database account. */ + readonly id: string + /* The name of the database account. */ + readonly name: string + /* The type of Azure resource. */ + readonly type: string} + +export type DatabaseAccountGetResults = ARMResourceProperties & { + /* Indicates the type of database account. This can only be set at database account creation. */ + kind: string + /* undefined */ + properties: DatabaseAccountGetProperties + + /* The system meta data relating to this resource. */ + readonly systemData: unknown + } + +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: undefined + /* A system generated property representing the resource etag required for optimistic concurrency control. */ + readonly _etag: string} + +export type ThroughputSettingsGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB resource throughput */ + properties: ThroughputSettingsGetProperties + } + +export interface ThroughputSettingsGetProperties { + /* undefined */ + resource: undefined} + +export type SqlDatabaseGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB SQL database */ + properties: SqlDatabaseGetProperties + } + +export interface SqlDatabaseGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export type SqlContainerGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB container */ + properties: SqlContainerGetProperties + } + +export interface SqlContainerGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export type SqlStoredProcedureGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB storedProcedure */ + properties: SqlStoredProcedureGetProperties + } + +export interface SqlStoredProcedureGetProperties { + /* undefined */ + resource: undefined} + +export type SqlUserDefinedFunctionGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB userDefinedFunction */ + properties: SqlUserDefinedFunctionGetProperties + } + +export interface SqlUserDefinedFunctionGetProperties { + /* undefined */ + resource: undefined} + +export type SqlTriggerGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB trigger */ + properties: SqlTriggerGetProperties + } + +export interface SqlTriggerGetProperties { + /* undefined */ + resource: undefined} + +export type MongoDBDatabaseGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB MongoDB database */ + properties: MongoDBDatabaseGetProperties + } + +export interface MongoDBDatabaseGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export type MongoDBCollectionGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB MongoDB collection */ + properties: MongoDBCollectionGetProperties + } + +export interface MongoDBCollectionGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export type TableGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB Table */ + properties: TableGetProperties + } + +export interface TableGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export type CassandraKeyspaceGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB Cassandra keyspace */ + properties: CassandraKeyspaceGetProperties + } + +export interface CassandraKeyspaceGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export type CassandraTableGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB Cassandra table */ + properties: CassandraTableGetProperties + } + +export interface CassandraTableGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export type GremlinDatabaseGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB SQL database */ + properties: GremlinDatabaseGetProperties + } + +export interface GremlinDatabaseGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export type GremlinGraphGetResults = ARMResourceProperties & { + /* The properties of an Azure Cosmos DB Gremlin graph */ + properties: GremlinGraphGetProperties + } + +export interface GremlinGraphGetProperties { + /* undefined */ + resource: undefined + /* undefined */ + options: undefined} + +export interface ConsistencyPolicy { + /* The default consistency level and configuration settings of the Cosmos DB account. */ + defaultConsistencyLevel: string + /* 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'. */ + maxIntervalInSeconds: number} + +export interface DatabaseAccountGetProperties { + /* undefined */ + provisioningState: ProvisioningState + + /* The connection endpoint for the Cosmos DB database account. */ + readonly documentEndpoint: string + /* The offer type for the Cosmos DB database account. Default value: Standard. */ + readonly databaseAccountOfferType: DatabaseAccountOfferType + + /* List of IpRules. */ + ipRules: IPRules + + /* Flag to indicate whether to enable/disable Virtual Network ACL rules. */ + isVirtualNetworkFilterEnabled: boolean + /* Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. */ + enableAutomaticFailover: boolean + /* The consistency policy for the Cosmos DB database account. */ + consistencyPolicy: ConsistencyPolicy + + /* List of Cosmos DB capabilities for the account */ + capabilities: Capability[] + + /* An array that contains the write location for the Cosmos DB account. */ + readonly writeLocations: Location[] + + /* An array that contains of the read locations enabled for the Cosmos DB account. */ + readonly readLocations: Location[] + + /* An array that contains all of the locations enabled for the Cosmos DB account. */ + readonly locations: Location[] + + /* An array that contains the regions ordered by their failover priorities. */ + readonly failoverPolicies: FailoverPolicy[] + + /* List of Virtual Network ACL rules configured for the Cosmos DB account. */ + virtualNetworkRules: VirtualNetworkRule[] + + /* List of Private Endpoint Connections configured for the Cosmos DB account. */ + readonly privateEndpointConnections: PrivateEndpointConnection[] + + /* Enables the account to write in multiple locations */ + enableMultipleWriteLocations: boolean + /* Enables the cassandra connector on the Cosmos DB C* account */ + enableCassandraConnector: boolean + /* The cassandra connector offer type for the Cosmos DB database C* account. */ + connectorOffer: ConnectorOffer + + /* Disable write operations on metadata resources (databases, containers, throughput) via account keys */ + disableKeyBasedMetadataWriteAccess: boolean + /* The URI of the key vault */ + keyVaultKeyUri: string + /* Whether requests from Public Network are allowed */ + publicNetworkAccess: PublicNetworkAccess + + /* Flag to indicate whether Free Tier is enabled. */ + enableFreeTier: boolean + /* API specific properties. */ + apiProperties: ApiProperties + + /* Flag to indicate whether to enable storage analytics. */ + enableAnalyticalStorage: boolean + /* A unique identifier assigned to the database account */ + readonly instanceId: string + /* Enum to indicate the mode of account creation. */ + createMode: CreateMode + + /* Parameters to indicate the information about the restore. */ + restoreParameters: RestoreParameters + + /* The object representing the policy for taking backups on an account. */ + backupPolicy: BackupPolicy + } + +export interface DatabaseAccountCreateUpdateProperties { + /* The consistency policy for the Cosmos DB account. */ + consistencyPolicy: ConsistencyPolicy + + /* An array that contains the georeplication locations enabled for the Cosmos DB account. */ + locations: Location[] + + /* The offer type for the database */ + databaseAccountOfferType: DatabaseAccountOfferType + + /* List of IpRules. */ + ipRules: IPRules + + /* Flag to indicate whether to enable/disable Virtual Network ACL rules. */ + isVirtualNetworkFilterEnabled: boolean + /* Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. */ + enableAutomaticFailover: boolean + /* List of Cosmos DB capabilities for the account */ + capabilities: Capability[] + + /* List of Virtual Network ACL rules configured for the Cosmos DB account. */ + virtualNetworkRules: VirtualNetworkRule[] + + /* Enables the account to write in multiple locations */ + enableMultipleWriteLocations: boolean + /* Enables the cassandra connector on the Cosmos DB C* account */ + enableCassandraConnector: boolean + /* The cassandra connector offer type for the Cosmos DB database C* account. */ + connectorOffer: ConnectorOffer + + /* Disable write operations on metadata resources (databases, containers, throughput) via account keys */ + disableKeyBasedMetadataWriteAccess: boolean + /* The URI of the key vault */ + keyVaultKeyUri: string + /* Whether requests from Public Network are allowed */ + publicNetworkAccess: PublicNetworkAccess + + /* Flag to indicate whether Free Tier is enabled. */ + enableFreeTier: boolean + /* API specific properties. Currently, supported only for MongoDB API. */ + apiProperties: ApiProperties + + /* Flag to indicate whether to enable storage analytics. */ + enableAnalyticalStorage: boolean + /* Enum to indicate the mode of account creation. */ + createMode: CreateMode + + /* The object representing the policy for taking backups on an account. */ + backupPolicy: BackupPolicy + } + +export type RestoreReqeustDatabaseAccountCreateUpdateProperties = DatabaseAccountCreateUpdateProperties & { + /* Parameters to indicate the information about the restore. */ + restoreParameters: RestoreParameters + } + +export type DatabaseAccountCreateUpdateParameters = ARMResourceProperties & { + /* Indicates the type of database account. This can only be set at database account creation. */ + kind: string + /* undefined */ + properties: DatabaseAccountCreateUpdateProperties + } + +export interface DatabaseAccountUpdateProperties { + /* The consistency policy for the Cosmos DB account. */ + consistencyPolicy: ConsistencyPolicy + + /* An array that contains the georeplication locations enabled for the Cosmos DB account. */ + locations: Location[] + + /* List of IpRules. */ + ipRules: IPRules + + /* Flag to indicate whether to enable/disable Virtual Network ACL rules. */ + isVirtualNetworkFilterEnabled: boolean + /* Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. */ + enableAutomaticFailover: boolean + /* List of Cosmos DB capabilities for the account */ + capabilities: Capability[] + + /* List of Virtual Network ACL rules configured for the Cosmos DB account. */ + virtualNetworkRules: VirtualNetworkRule[] + + /* Enables the account to write in multiple locations */ + enableMultipleWriteLocations: boolean + /* Enables the cassandra connector on the Cosmos DB C* account */ + enableCassandraConnector: boolean + /* The cassandra connector offer type for the Cosmos DB database C* account. */ + connectorOffer: ConnectorOffer + + /* Disable write operations on metadata resources (databases, containers, throughput) via account keys */ + disableKeyBasedMetadataWriteAccess: boolean + /* The URI of the key vault */ + keyVaultKeyUri: string + /* Whether requests from Public Network are allowed */ + publicNetworkAccess: PublicNetworkAccess + + /* Flag to indicate whether Free Tier is enabled. */ + enableFreeTier: boolean + /* API specific properties. Currently, supported only for MongoDB API. */ + apiProperties: ApiProperties + + /* Flag to indicate whether to enable storage analytics. */ + enableAnalyticalStorage: boolean + /* The object representing the policy for taking backups on an account. */ + backupPolicy: BackupPolicy + } + +export interface DatabaseAccountUpdateParameters { + /* undefined */ + tags: Tags + + /* The location of the resource group to which the resource belongs. */ + location: string + /* undefined */ + properties: DatabaseAccountUpdateProperties + } + +export interface DatabaseAccountListReadOnlyKeysResult { + /* Base 64 encoded value of the primary read-only key. */ + readonly primaryReadonlyMasterKey: string + /* Base 64 encoded value of the secondary read-only key. */ + readonly secondaryReadonlyMasterKey: string} + +export type DatabaseAccountListKeysResult = DatabaseAccountListReadOnlyKeysResult & { + /* Base 64 encoded value of the primary read-write key. */ + readonly primaryMasterKey: string + /* Base 64 encoded value of the secondary read-write key. */ + readonly secondaryMasterKey: string} + +export interface DatabaseAccountConnectionString { + /* Value of the connection string */ + readonly connectionString: string + /* Description of the connection string */ + readonly description: string} + +export interface DatabaseAccountListConnectionStringsResult { + /* An array that contains the connection strings for the Cosmos DB account. */ + connectionStrings: DatabaseAccountConnectionString[] + } + +export interface DatabaseAccountRegenerateKeyParameters { + /* The access key to regenerate. */ + keyKind: string} + + + /* The offer type for the Cosmos DB database account. */ + export type DatabaseAccountOfferType = "Standard" +export type ThroughputSettingsUpdateParameters = ARMResourceProperties & { + /* Properties to update Azure Cosmos DB resource throughput. */ + properties: ThroughputSettingsUpdateProperties + } + +export interface ThroughputSettingsUpdateProperties { + /* The standard JSON format of a resource throughput */ + resource: ThroughputSettingsResource + } + +export type SqlDatabaseCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB SQL database. */ + properties: SqlDatabaseCreateUpdateProperties + } + +export interface SqlDatabaseCreateUpdateProperties { + /* The standard JSON format of a SQL database */ + 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 + } + +export type SqlContainerCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB container. */ + properties: SqlContainerCreateUpdateProperties + } + +export interface SqlContainerCreateUpdateProperties { + /* The standard JSON format of a container */ + 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 + } + +export type SqlStoredProcedureCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB storedProcedure. */ + properties: SqlStoredProcedureCreateUpdateProperties + } + +export interface SqlStoredProcedureCreateUpdateProperties { + /* The standard JSON format of a storedProcedure */ + 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 + } + +export type SqlUserDefinedFunctionCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB userDefinedFunction. */ + properties: SqlUserDefinedFunctionCreateUpdateProperties + } + +export interface SqlUserDefinedFunctionCreateUpdateProperties { + /* The standard JSON format of a userDefinedFunction */ + 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 + } + +export type SqlTriggerCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB trigger. */ + properties: SqlTriggerCreateUpdateProperties + } + +export interface SqlTriggerCreateUpdateProperties { + /* The standard JSON format of a trigger */ + 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 + } + +export type MongoDBDatabaseCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB MongoDB database. */ + properties: MongoDBDatabaseCreateUpdateProperties + } + +export interface MongoDBDatabaseCreateUpdateProperties { + /* The standard JSON format of a MongoDB database */ + 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 + } + +export type MongoDBCollectionCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB MongoDB collection. */ + properties: MongoDBCollectionCreateUpdateProperties + } + +export interface MongoDBCollectionCreateUpdateProperties { + /* The standard JSON format of a MongoDB collection */ + 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 + } + +export type TableCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB Table. */ + properties: TableCreateUpdateProperties + } + +export interface TableCreateUpdateProperties { + /* The standard JSON format of a Table */ + 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 + } + +export type CassandraKeyspaceCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB Cassandra keyspace. */ + properties: CassandraKeyspaceCreateUpdateProperties + } + +export interface CassandraKeyspaceCreateUpdateProperties { + /* The standard JSON format of a Cassandra keyspace */ + 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 + } + +export type CassandraTableCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB Cassandra table. */ + properties: CassandraTableCreateUpdateProperties + } + +export interface CassandraTableCreateUpdateProperties { + /* The standard JSON format of a Cassandra table */ + 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 + } + +export type GremlinDatabaseCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB Gremlin database. */ + properties: GremlinDatabaseCreateUpdateProperties + } + +export interface GremlinDatabaseCreateUpdateProperties { + /* The standard JSON format of a Gremlin database */ + 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 + } + +export type GremlinGraphCreateUpdateParameters = ARMResourceProperties & { + /* Properties to create and update Azure Cosmos DB Gremlin graph. */ + properties: GremlinGraphCreateUpdateProperties + } + +export interface GremlinGraphCreateUpdateProperties { + /* The standard JSON format of a Gremlin graph */ + 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 + } + +export interface ThroughputSettingsResource { + /* Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. */ + throughput: number + /* Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. */ + autoscaleSettings: AutoscaleSettingsResource + + /* The minimum throughput of the resource */ + readonly minimumThroughput: string + /* The throughput replace is pending */ + readonly offerReplacePending: string} + +export interface AutoscaleSettingsResource { + /* Represents maximum throughput container can scale up to. */ + maxThroughput: number + /* Cosmos DB resource auto-upgrade policy */ + autoUpgradePolicy: AutoUpgradePolicyResource + + /* Represents target maximum throughput container can scale up to once offer is no longer in pending state. */ + readonly targetMaxThroughput: number} + +export interface AutoUpgradePolicyResource { + /* Represents throughput policy which service must adhere to for auto-upgrade */ + throughputPolicy: ThroughputPolicyResource + } + +export interface ThroughputPolicyResource { + /* Determines whether the ThroughputPolicy is active or not */ + isEnabled: boolean + /* Represents the percentage by which throughput can increase every time throughput policy kicks in. */ + incrementPercent: number} + +export interface OptionsResource { + /* Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. */ + throughput: number + /* Specifies the Autoscale settings. */ + autoscaleSettings: AutoscaleSettings + } + +export interface SqlDatabaseResource { + /* Name of the Cosmos DB SQL database */ + id: string} + +export interface SqlContainerResource { + /* Name of the Cosmos DB SQL container */ + id: string + /* The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container */ + indexingPolicy: IndexingPolicy + + /* The configuration of the partition key to be used for partitioning data into multiple partitions */ + partitionKey: ContainerPartitionKey + + /* Default time to live */ + defaultTtl: number + /* The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. */ + uniqueKeyPolicy: UniqueKeyPolicy + + /* The conflict resolution policy for the container. */ + conflictResolutionPolicy: ConflictResolutionPolicy + } + +export interface IndexingPolicy { + /* Indicates if the indexing policy is automatic */ + automatic: boolean + /* Indicates the indexing mode. */ + indexingMode: string + /* List of paths to include in the indexing */ + includedPaths: IncludedPath[] + + /* List of paths to exclude from indexing */ + excludedPaths: ExcludedPath[] + + /* List of composite path list */ + compositeIndexes: CompositePathList[] + + /* List of spatial specifics */ + spatialIndexes: SpatialSpec[] + } + +export interface ExcludedPath { + /* The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) */ + path: string} + +export interface IncludedPath { + /* The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) */ + path: string + /* List of indexes for this path */ + indexes: Indexes[] + } + +export interface Indexes { + /* The datatype for which the indexing behavior is applied to. */ + dataType: string + /* The precision of the index. -1 is maximum precision. */ + precision: number + /* Indicates the type of index. */ + kind: string} + + + /* List of composite path */ + export type CompositePathList = CompositePath[] + 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} + +export interface SpatialSpec { + /* The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) */ + path: string + /* List of path's spatial type */ + types: SpatialType[] + } + + + /* Indicates the spatial type of index. */ + export type SpatialType = "Point" | "LineString" | "Polygon" | "MultiPolygon" +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 version of the partition key definition */ + version: number} + + + /* A path. These typically start with root (/path) */ + export type Path = string + export interface UniqueKeyPolicy { + /* List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. */ + uniqueKeys: UniqueKey[] + } + +export interface UniqueKey { + /* List of paths must be unique for each document in the Azure Cosmos DB service */ + paths: Path[] + } + +export interface ConflictResolutionPolicy { + /* Indicates the conflict resolution mode. */ + mode: string + /* The conflict resolution path in the case of LastWriterWins mode. */ + conflictResolutionPath: string + /* The procedure to resolve conflicts in the case of custom mode. */ + conflictResolutionProcedure: string} + +export interface SqlStoredProcedureResource { + /* Name of the Cosmos DB SQL storedProcedure */ + id: string + /* Body of the Stored Procedure */ + body: string} + +export interface SqlUserDefinedFunctionResource { + /* Name of the Cosmos DB SQL userDefinedFunction */ + id: string + /* Body of the User Defined Function */ + body: string} + +export interface SqlTriggerResource { + /* Name of the Cosmos DB SQL trigger */ + id: string + /* Body of the Trigger */ + body: string + /* Type of the Trigger */ + triggerType: string + /* The operation the trigger is associated with */ + triggerOperation: string} + +export interface MongoDBDatabaseResource { + /* Name of the Cosmos DB MongoDB database */ + id: string} + +export interface MongoDBCollectionResource { + /* Name of the Cosmos DB MongoDB collection */ + id: string + /* A key-value pair of shard keys to be applied for the request. */ + shardKey: ShardKeys + + /* List of index keys */ + indexes: MongoIndex[] + + /* Analytical TTL. */ + analyticalStorageTtl: number} + + + /* The shard key and partition kind pair, only support "Hash" partition kind */ + export type ShardKeys = { [key: string]: string} + export interface MongoIndex { + /* Cosmos DB MongoDB collection index keys */ + key: MongoIndexKeys + + /* Cosmos DB MongoDB collection index key options */ + options: MongoIndexOptions + } + +export interface MongoIndexKeys { + /* List of keys for each MongoDB collection in the Azure Cosmos DB service */ + keys: Key[] + } + + + /* A Key. */ + export type Key = string + export interface MongoIndexOptions { + /* Expire after seconds */ + expireAfterSeconds: number + /* Is unique or not */ + unique: boolean} + +export interface TableResource { + /* Name of the Cosmos DB table */ + id: string} + +export interface CassandraKeyspaceResource { + /* Name of the Cosmos DB Cassandra keyspace */ + id: string} + +export interface CassandraTableResource { + /* Name of the Cosmos DB Cassandra table */ + id: string + /* Time to live of the Cosmos DB Cassandra table */ + defaultTtl: number + /* Schema of the Cosmos DB Cassandra table */ + schema: CassandraSchema + + /* Analytical TTL. */ + analyticalStorageTtl: number} + +export interface CassandraSchema { + /* List of Cassandra table columns. */ + columns: Column[] + + /* List of partition key. */ + partitionKeys: CassandraPartitionKey[] + + /* List of cluster key. */ + clusterKeys: ClusterKey[] + } + +export interface Column { + /* Name of the Cosmos DB Cassandra table column */ + name: string + /* Type of the Cosmos DB Cassandra table column */ + type: string} + +export interface CassandraPartitionKey { + /* Name of the Cosmos DB Cassandra table partition key */ + name: string} + +export interface ClusterKey { + /* Name of the Cosmos DB Cassandra table cluster key */ + name: string + /* Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" */ + orderBy: string} + +export interface GremlinDatabaseResource { + /* Name of the Cosmos DB Gremlin database */ + id: string} + +export interface GremlinGraphResource { + /* Name of the Cosmos DB Gremlin graph */ + id: string + /* The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph */ + indexingPolicy: IndexingPolicy + + /* The configuration of the partition key to be used for partitioning data into multiple partitions */ + partitionKey: ContainerPartitionKey + + /* Default time to live */ + defaultTtl: number + /* The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. */ + uniqueKeyPolicy: UniqueKeyPolicy + + /* The conflict resolution policy for the graph. */ + conflictResolutionPolicy: ConflictResolutionPolicy + } + +export interface CreateUpdateOptions { + /* Request Units per second. For example, "throughput": 10000. */ + throughput: number + /* Specifies the Autoscale settings. */ + autoscaleSettings: AutoscaleSettings + } + +export interface AutoscaleSettings { + /* Represents maximum throughput, the resource can scale up to. */ + maxThroughput: number} + +export interface Capability { + /* Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". */ + name: string} + + + /* Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". */ + export type Tags = { [key: string]: string} + export 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: string} + + + /* 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 + + /* Array of IpAddressOrRange objects. */ + export type IPRules = IpAddressOrRange[] + export interface IpAddressOrRange { + /* A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. */ + ipAddressOrRange: string} + +export interface VirtualNetworkRule { + /* Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. */ + id: string + /* Create firewall rule before the virtual network has vnet service endpoint enabled. */ + ignoreMissingVNetServiceEndpoint: boolean} + +export type PrivateEndpointConnection = unknown & { + /* Resource properties. */ + properties: PrivateEndpointConnectionProperties + } + +export interface PrivateEndpointConnectionProperties { + /* Private endpoint which the connection belongs to. */ + privateEndpoint: PrivateEndpointProperty + + /* Connection State of the Private Endpoint Connection. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionStateProperty + } + +export interface PrivateEndpointProperty { + /* Resource id of the private endpoint. */ + id: string} + +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} + +export interface Operation { + /* Operation name: {provider}/{resource}/{operation} */ + name: string + /* The object that represents the operation. */ + display: undefined} + +export interface OperationListResult { + /* List of operations supported by the Resource Provider. */ + value: Operation[] + + /* URL to get the next set of operation list results if there are any. */ + nextLink: string} + +export interface UsagesResult { + /* The list of usages for the database. A usage is a point in time metric */ + readonly value: Usage[] + } + +export interface Usage { + /* The unit of the metric. */ + unit: UnitType + + /* The name information for the metric. */ + readonly name: MetricName + + /* The quota period used to summarize the usage values. */ + readonly quotaPeriod: string + /* Maximum value for this metric */ + readonly limit: number + /* Current value for this metric */ + readonly currentValue: number} + +export interface PartitionUsagesResult { + /* The list of partition-level usages for the database. A usage is a point in time metric */ + readonly value: PartitionUsage[] + } + +export type PartitionUsage = Usage & { + /* The partition id (GUID identifier) of the usages. */ + readonly partitionId: string + /* The partition key range id (integer identifier) of the usages. */ + readonly partitionKeyRangeId: string} + +export interface MetricDefinitionsListResult { + /* The list of metric definitions for the account. */ + readonly value: MetricDefinition[] + } + +export interface MetricDefinition { + /* The list of metric availabilities for the account. */ + readonly metricAvailabilities: MetricAvailability[] + + /* The primary aggregation type of the metric. */ + readonly primaryAggregationType: string + /* The unit of the metric. */ + unit: UnitType + + /* The resource uri of the database. */ + readonly resourceUri: string + /* The name information for the metric. */ + readonly name: MetricName + } + +export interface MetricAvailability { + /* The time grain to be used to summarize the metric values. */ + readonly timeGrain: string + /* The retention for the metric values. */ + readonly retention: string} + +export interface MetricListResult { + /* The list of metrics for the account. */ + readonly value: Metric[] + } + +export interface Metric { + /* The start time for the metric (ISO-8601 format). */ + readonly startTime: string + /* The end time for the metric (ISO-8601 format). */ + readonly endTime: string + /* The time grain to be used to summarize the metric values. */ + readonly timeGrain: string + /* The unit of the metric. */ + unit: UnitType + + /* The name information for the metric. */ + readonly name: MetricName + + /* The metric values for the specified time window and timestep. */ + readonly metricValues: MetricValue[] + } + +export interface MetricName { + /* The name of the metric. */ + readonly value: string + /* The friendly name of the metric. */ + readonly localizedValue: string} + +export interface MetricValue { + /* The number of values for the metric. */ + readonly _count: number + /* The average value of the metric. */ + readonly average: number + /* The max value of the metric. */ + readonly maximum: number + /* The min value of the metric. */ + readonly minimum: number + /* The metric timestamp (ISO-8601 format). */ + readonly timestamp: string + /* The total value of the metric. */ + readonly total: number} + +export interface PercentileMetricListResult { + /* The list of percentile metrics for the account. */ + readonly value: PercentileMetric[] + } + +export interface PercentileMetric { + /* The start time for the metric (ISO-8601 format). */ + readonly startTime: string + /* The end time for the metric (ISO-8601 format). */ + readonly endTime: string + /* The time grain to be used to summarize the metric values. */ + readonly timeGrain: string + /* The unit of the metric. */ + unit: UnitType + + /* The name information for the metric. */ + readonly name: MetricName + + /* The percentile metric values for the specified time window and timestep. */ + readonly metricValues: PercentileMetricValue[] + } + +export type PercentileMetricValue = MetricValue & { + /* The 10th percentile value for the metric. */ + readonly P10: number + /* The 25th percentile value for the metric. */ + readonly P25: number + /* The 50th percentile value for the metric. */ + readonly P50: number + /* The 75th percentile value for the metric. */ + readonly P75: number + /* The 90th percentile value for the metric. */ + readonly P90: number + /* The 95th percentile value for the metric. */ + readonly P95: number + /* The 99th percentile value for the metric. */ + readonly P99: number} + +export interface PartitionMetricListResult { + /* The list of partition-level metrics for the account. */ + readonly value: PartitionMetric[] + } + +export type PartitionMetric = Metric & { + /* The partition id (GUID identifier) of the metric values. */ + readonly partitionId: string + /* The partition key range id (integer identifier) of the metric values. */ + readonly partitionKeyRangeId: string} + + + /* The unit of the metric. */ + export type UnitType = "Count" | "Bytes" | "Seconds" | "Percent" | "CountPerSecond" | "BytesPerSecond" | "Milliseconds" + + /* The cassandra connector offer type for the Cosmos DB C* database account. */ + export type ConnectorOffer = "Small" + + /* Whether requests from Public Network are allowed */ + export type PublicNetworkAccess = "Enabled" | "Disabled" +export interface ApiProperties { + /* Describes the ServerVersion of an a MongoDB account. */ + serverVersion: string} + + + /* Enum to indicate the mode of account creation. */ + export type CreateMode = "Default" | "Restore" +export interface RestoreParameters { + /* Describes the mode of the restore. */ + restoreMode: string + /* Path of the source account from which the restore has to be initiated */ + restoreSource: string + /* Time to which the account has to be restored (ISO-8601 format). */ + restoreTimestampInUtc: string + /* List of specific databases to restore. */ + databasesToRestore: DatabaseRestoreResource[] + } + +export interface DatabaseRestoreResource { + /* The name of the database to restore. */ + databaseName: string + /* The names of the collections to restore. */ + collectionNames: CollectionName[] + } + + + /* The name of the collection. */ + export type CollectionName = string + export interface BackupPolicy { + /* Describes the mode of backups. */ + type: string} + +export type PeriodicModeBackupPolicy = BackupPolicy & { + /* Configuration values for periodic mode backup */ + periodicModeProperties: PeriodicModeProperties + } + + + /* The object representing continuous mode backup policy. */ + export type ContinuousModeBackupPolicy = BackupPolicy + 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} + +export interface RestorableDatabaseAccountsListResult { + /* List of restorable database accounts and their properties. */ + readonly value: RestorableDatabaseAccountGetResult[] + } + +export type RestorableDatabaseAccountGetResult = ARMResourceProperties & { + /* The properties of a restorable database account. */ + properties: RestorableDatabaseAccountProperties + } + +export interface RestorableDatabaseAccountProperties { + /* The name of the global database account */ + accountName: string + /* The creation time of the restorable database account (ISO-8601 format). */ + creationTime: string + /* The time at which the restorable database account has been deleted (ISO-8601 format). */ + deletionTime: string} + diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 2ac148266..73ef2aa79 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -75,6 +75,25 @@ "./src/Utils/MessageValidation.ts", "./src/Utils/OfferUtils.ts", "./src/Utils/StringUtils.ts", + "./src/Utils/arm/CassandraResources.ts", + "./src/Utils/arm/Collection.ts", + "./src/Utils/arm/CollectionPartition.ts", + "./src/Utils/arm/CollectionPartitionRegion.ts", + "./src/Utils/arm/CollectionRegion.ts", + "./src/Utils/arm/Database.ts", + "./src/Utils/arm/DatabaseAccountRegion.ts", + "./src/Utils/arm/GremlinResources.ts", + "./src/Utils/arm/MongoDBResources.ts", + "./src/Utils/arm/Operations.ts", + "./src/Utils/arm/PartitionKeyRangeId.ts", + "./src/Utils/arm/PartitionKeyRangeIdRegion.ts", + "./src/Utils/arm/Percentile.ts", + "./src/Utils/arm/PercentileSourceTarget.ts", + "./src/Utils/arm/PercentileTarget.ts", + "./src/Utils/arm/RestorableDatabaseAccounts.ts", + "./src/Utils/arm/SqlResources.ts", + "./src/Utils/arm/TableResources.ts", + "./src/Utils/arm/types.ts", "./src/quickstart.ts", "./src/setupTests.ts", "./src/workers/upload/definitions.ts" diff --git a/utils/armClientGenerator/generator.ts b/utils/armClientGenerator/generator.ts index 9bc39f781..e22e1eb4a 100644 --- a/utils/armClientGenerator/generator.ts +++ b/utils/armClientGenerator/generator.ts @@ -1,11 +1,13 @@ /// import { writeFileSync } from "fs"; +import * as path from "path"; import fetch from "node-fetch"; +import mkdirp from "mkdirp"; /* Open API TypeScript Client Generator -This is a quickly made bespoke Open API client generator. +This is a bespoke Open API client generator not intended for general public use. It is not designed to handle the full OpenAPI spec. Many other more general purpose generators exist, but their output is very verbose and overly complex for our use case. But it does work well enough to generate a fully typed tree-shakeable client for the Cosmos resource provider. @@ -13,11 +15,14 @@ Results of this file should be checked into the repo. */ // Array of strings to use for eventual output -const output: string[] = [""]; +const outputTypes: string[] = [""]; const schemaURL = "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/cosmos-db.json"; +const outputDir = path.join(__dirname, "../../src/Utils/arm/"); +mkdirp.sync(outputDir); + // Buckets for grouping operations based on their name const namespaces: { [key: string]: string[] } = {}; @@ -27,10 +32,11 @@ const propertyMap: { [key: string]: string } = { }; // Converts a Open API reference: "#/definitions/Foo" to a type name: Foo -function refToType(path: string | undefined) { +function refToType(path: string | undefined, namespace?: string) { // References must be in the same file. Bail to `unknown` types for remote references if (path && path.startsWith("#")) { - return path.split("/").pop(); + const type = path.split("/").pop(); + return namespace ? `${namespace}.${type}` : type; } return "unknown"; } @@ -45,11 +51,11 @@ function camelize(str: string) { } // Converts a body paramter to the equivalent typescript function parameter type -function bodyParam(parameter: { schema: { $ref: string } }) { +function bodyParam(parameter: { schema: { $ref: string } }, namespace: string) { if (!parameter) { return ""; } - return `,body: ${refToType(parameter.schema.$ref)}`; + return `,body: ${refToType(parameter.schema.$ref, namespace)}`; } // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -65,14 +71,14 @@ function parametersFromPath(path: string) { type Operation = { responses: { [key: string]: { schema: { $ref: string } } } }; // Converts OpenAPI response definition to TypeScript return type. Uses unions if possible. Bails to unknown -function responseType(operation: Operation) { +function responseType(operation: Operation, namespace: string) { if (operation.responses) { return Object.keys(operation.responses) .map((responseCode: string) => { if (!operation.responses[responseCode].schema) { return "void"; } - return refToType(operation.responses[responseCode].schema.$ref); + return refToType(operation.responses[responseCode].schema.$ref, namespace); }) .join(" | "); } @@ -91,33 +97,33 @@ async function main() { const baseTypes = schema.definitions[definition].allOf .map((allof: { $ref: string }) => refToType(allof.$ref)) .join(" & "); - output.push(`type ${definition} = ${baseTypes} & {`); + outputTypes.push(`export type ${definition} = ${baseTypes} & {`); } else { - output.push(`interface ${definition} {`); + outputTypes.push(`export interface ${definition} {`); } for (const prop in schema.definitions[definition].properties) { const property = schema.definitions[definition].properties[prop]; if (property) { if (property.$ref) { const type = refToType(property.$ref); - output.push(` + outputTypes.push(` /* ${property.description} */ ${property.readOnly ? "readonly " : ""}${prop}: ${type} `); } else if (property.type === "array") { const type = refToType(property.items.$ref); - output.push(` + outputTypes.push(` /* ${property.description} */ ${property.readOnly ? "readonly " : ""}${prop}: ${type}[] `); } else if (property.type === "object") { const type = refToType(property.$ref); - output.push(` + outputTypes.push(` /* ${property.description} */ ${property.readOnly ? "readonly " : ""}${prop}: ${type} `); } else { - output.push(` + outputTypes.push(` /* ${property.description} */ ${property.readOnly ? "readonly " : ""}${prop}: ${ propertyMap[property.type] ? propertyMap[property.type] : property.type @@ -125,36 +131,36 @@ async function main() { } } } - output.push(`}`); - output.push("\n\n"); + outputTypes.push(`}`); + outputTypes.push("\n\n"); } else { const def = schema.definitions[definition]; if (def.enum) { - output.push(` + outputTypes.push(` /* ${def.description} */ - type ${definition} = ${def.enum.map((v: string) => `"${v}"`).join(" | ")}`); - output.push("\n"); + export type ${definition} = ${def.enum.map((v: string) => `"${v}"`).join(" | ")}`); + outputTypes.push("\n"); } else if (def.type === "string") { - output.push(` + outputTypes.push(` /* ${def.description} */ - type ${definition} = string + export type ${definition} = string `); } else if (def.type === "array") { const type = refToType(def.items.$ref); - output.push(` + outputTypes.push(` /* ${def.description} */ - type ${definition} = ${type}[] + export type ${definition} = ${type}[] `); } else if (def.type === "object" && def.additionalProperties) { - output.push(` + outputTypes.push(` /* ${def.description} */ - type ${definition} = { [key: string]: ${def.additionalProperties.type}} + export type ${definition} = { [key: string]: ${def.additionalProperties.type}} `); } else if (def.type === "object" && def.allOf) { const type = refToType(def.allOf[0].$ref); - output.push(` + outputTypes.push(` /* ${def.description} */ - type ${definition} = ${type} + export type ${definition} = ${type} `); } else { console.log("UNHANDLED MODEL:", def, schema.definitions[def]); @@ -176,10 +182,10 @@ async function main() { } namespaces[namespace].push(` /* ${operation.description} */ - async ${camelize(operationName)} ( + export async function ${camelize(operationName)} ( ${parametersFromPath(path)} - ${bodyParam(bodyParameter)} - ) : Promise<${responseType(operation)}> { + ${bodyParam(bodyParameter, "Types")} + ) : Promise<${responseType(operation, "Types")}> { return window.fetch(\`https://management.azure.com${path.replace(/{/g, "${")}\`, { method: "${method}", ${ bodyParameter ? "body: JSON.stringify(body)" : "" } }).then((response) => response.json()) @@ -190,12 +196,22 @@ async function main() { // Write all grouped fetch functions to objects for (const namespace in namespaces) { - output.push(`export const ${namespace} = {`); - output.push(namespaces[namespace].join(",\n")); - output.push(`}\n`); + const outputClient: string[] = [""]; + outputClient.push(`import * as Types from "./types"\n\n`); + outputClient.push(namespaces[namespace].join("\n\n")); + writeOutputFile(`./${namespace}.ts`, outputClient); } - writeFileSync("./client.ts", output.join("")); + writeOutputFile("./types.ts", outputTypes); +} + +function writeOutputFile(outputPath: string, components: string[]) { + components.unshift(`/* + AUTOGENERATED FILE + Do not manually edit + Run "npm run generateARMClients" to regenerate +*/\n\n`); + writeFileSync(path.join(outputDir, outputPath), components.join("")); } main().catch(e => {