From 4bb78b6b8079781d3ad43ffd64219a9cda85b64d Mon Sep 17 00:00:00 2001 From: vinhms Date: Thu, 10 Dec 2020 18:09:39 -0800 Subject: [PATCH] CosmosDB Restoreable APIs for SQL and MongoDB database account (#11428) * adding new restorable apis * fix some typos * fix validations * fix more validations * prettier * fix name and add apitype * fix casing * add custom word etcd * add mongodb * fix prameter name * fix validations * make read only * remove the word snapshot and make properties readonly * pretty * improved some descriptions * update description and removed mongodb content * fix container property name * fix documentcollection name * make query parameter optional * address Meha's comments * move restorable apis to separate file * move restorable database apis back to cosmos-db.json * remove point read apis * fix avocado --- .../preview/2020-06-01-preview/cosmos-db.json | 65 +- .../CosmosDBRestorableDatabaseAccountGet.json | 16 +- ...CosmosDBRestorableDatabaseAccountList.json | 32 +- ...storableDatabaseAccountNoLocationList.json | 32 +- ...smosDBRestorableMongodbCollectionList.json | 31 + ...CosmosDBRestorableMongodbDatabaseList.json | 44 ++ ...CosmosDBRestorableMongodbResourceList.json | 35 + .../CosmosDBRestorableSqlContainerList.json | 102 +++ .../CosmosDBRestorableSqlDatabaseList.json | 83 +++ .../CosmosDBRestorableSqlResourceList.json | 35 + .../2020-06-01-preview/restorable.json | 693 ++++++++++++++++++ .../cosmos-db/resource-manager/readme.md | 1 + 12 files changed, 1161 insertions(+), 8 deletions(-) create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbCollectionList.json create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbDatabaseList.json create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbResourceList.json create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlContainerList.json create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlDatabaseList.json create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlResourceList.json create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/restorable.json diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/cosmos-db.json index 918f269d90aa..5c326dbdf557 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/cosmos-db.json @@ -7695,7 +7695,7 @@ }, "databasesToRestore": { "type": "array", - "description": "List of specific databases to restore.", + "description": "List of specific databases available for restore.", "items": { "$ref": "#/definitions/DatabaseRestoreResource" } @@ -7708,11 +7708,11 @@ "properties": { "databaseName": { "type": "string", - "description": "The name of the database to restore." + "description": "The name of the database available for restore." }, "collectionNames": { "type": "array", - "description": "The names of the collections to restore.", + "description": "The names of the collections available for restore.", "items": { "$ref": "#/definitions/CollectionName" } @@ -7837,6 +7837,65 @@ "type": "string", "format": "date-time", "description": "The time at which the restorable database account has been deleted (ISO-8601 format)." + }, + "apiType": { + "type": "string", + "readOnly": true, + "description": "The API type of the restorable database account.", + "$ref": "#/definitions/ApiType" + }, + "restorableLocations": { + "type": "array", + "readOnly": true, + "description": "List of regions where the of the database account can be restored from.", + "items": { + "$ref": "#/definitions/RestorableLocationResource" + } + } + } + }, + "ApiType": { + "description": "Enum to indicate the API type of the restorable database account.", + "type": "string", + "readOnly": true, + "enum": [ + "MongoDB", + "Gremlin", + "Cassandra", + "Table", + "Sql", + "GremlinV2" + ], + "x-ms-enum": { + "name": "ApiType", + "modelAsString": true + } + }, + "RestorableLocationResource": { + "type": "object", + "description": "Properties of the regional restorable account.", + "properties": { + "locationName": { + "type": "string", + "readOnly": true, + "description": "The location of the regional restorable account." + }, + "regionalDatabaseAccountInstanceId": { + "type": "string", + "readOnly": true, + "description": "The instance id of the regional restorable account." + }, + "creationTime": { + "type": "string", + "readOnly": true, + "format": "date-time", + "description": "The creation time of the regional restorable database account (ISO-8601 format)." + }, + "deletionTime": { + "type": "string", + "readOnly": true, + "format": "date-time", + "description": "The time at which the regional restorable database account has been deleted (ISO-8601 format)." } } } diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountGet.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountGet.json index d5edee780392..be54c7a508d7 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountGet.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountGet.json @@ -15,7 +15,21 @@ "properties": { "accountName": "ddb1", "creationTime": "2020-04-11T21:56:15Z", - "deletionTime": "2020-06-12T22:05:09Z" + "deletionTime": "2020-06-12T22:05:09Z", + "apiType": "Sql", + "restorableLocations": [ + { + "locationName": "South Central US", + "regionalDatabaseAccountInstanceId": "d7a01f78-606f-45c6-9dac-0df32f433bb5", + "creationTime": "2020-10-30T21:13:10.7486417Z", + "deletionTime": "2020-10-30T21:13:35.4466333Z" + }, + { + "locationName": "West US", + "regionalDatabaseAccountInstanceId": "fdb43d84-1572-4697-b6e7-2bcda0c51b2c", + "creationTime": "2020-10-30T21:13:10.7486417Z" + } + ] } } } diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountList.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountList.json index aae7cbb69c37..6c2184f2f63e 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountList.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountList.json @@ -16,7 +16,21 @@ "properties": { "accountName": "ddb1", "creationTime": "2020-04-11T21:56:15Z", - "deletionTime": "2020-06-12T22:05:09Z" + "deletionTime": "2020-06-12T22:05:09Z", + "apiType": "Sql", + "restorableLocations": [ + { + "locationName": "South Central US", + "regionalDatabaseAccountInstanceId": "d7a01f78-606f-45c6-9dac-0df32f433bb5", + "creationTime": "2020-10-30T21:13:10.7486417Z", + "deletionTime": "2020-10-30T21:13:35.4466333Z" + }, + { + "locationName": "West US", + "regionalDatabaseAccountInstanceId": "fdb43d84-1572-4697-b6e7-2bcda0c51b2c", + "creationTime": "2020-10-30T21:13:10.7486417Z" + } + ] } }, { @@ -26,7 +40,21 @@ "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts", "properties": { "accountName": "ddb2", - "creationTime": "2020-05-01T08:05:18Z" + "creationTime": "2020-05-01T08:05:18Z", + "apiType": "Sql", + "restorableLocations": [ + { + "locationName": "South Central US", + "regionalDatabaseAccountInstanceId": "d7a01f78-606f-45c6-9dac-0df32f433bb5", + "creationTime": "2020-10-30T21:13:10.7486417Z", + "deletionTime": "2020-10-30T21:13:35.4466333Z" + }, + { + "locationName": "West US", + "regionalDatabaseAccountInstanceId": "fdb43d84-1572-4697-b6e7-2bcda0c51b2c", + "creationTime": "2020-10-30T21:13:10.7486417Z" + } + ] } } ] diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json index 5b983987c671..0c71af847561 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json @@ -15,7 +15,21 @@ "properties": { "accountName": "ddb1", "creationTime": "2020-04-11T21:56:15Z", - "deletionTime": "2020-06-12T22:05:09Z" + "deletionTime": "2020-06-12T22:05:09Z", + "apiType": "Sql", + "restorableLocations": [ + { + "locationName": "South Central US", + "regionalDatabaseAccountInstanceId": "d7a01f78-606f-45c6-9dac-0df32f433bb5", + "creationTime": "2020-10-30T21:13:10.7486417Z", + "deletionTime": "2020-10-30T21:13:35.4466333Z" + }, + { + "locationName": "West US", + "regionalDatabaseAccountInstanceId": "fdb43d84-1572-4697-b6e7-2bcda0c51b2c", + "creationTime": "2020-10-30T21:13:10.7486417Z" + } + ] } }, { @@ -25,7 +39,21 @@ "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts", "properties": { "accountName": "ddb2", - "creationTime": "2020-05-01T08:05:18Z" + "creationTime": "2020-05-01T08:05:18Z", + "apiType": "Sql", + "restorableLocations": [ + { + "locationName": "South Central US", + "regionalDatabaseAccountInstanceId": "d7a01f78-606f-45c6-9dac-0df32f433bb5", + "creationTime": "2020-10-30T21:13:10.7486417Z", + "deletionTime": "2020-10-30T21:13:35.4466333Z" + }, + { + "locationName": "West US", + "regionalDatabaseAccountInstanceId": "fdb43d84-1572-4697-b6e7-2bcda0c51b2c", + "creationTime": "2020-10-30T21:13:10.7486417Z" + } + ] } } ] diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbCollectionList.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbCollectionList.json new file mode 100644 index 000000000000..7ccb03a9c397 --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbCollectionList.json @@ -0,0 +1,31 @@ +{ + "parameters": { + "api-version": "2020-06-01-preview", + "subscriptionId": "subid", + "location": "WestUS", + "instanceId": "98a570f2-63db-4117-91f0-366327b7b353", + "restorableMongodbDatabaseRid": "PD5DALigDgw=" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableMongodbCollections/79609a98-3394-41f8-911f-cfab0c075c86", + "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbCollections", + "name": "79609a98-3394-41f8-911f-cfab0c075c86", + "properties": { + "resource": { + "_rid": "zAyAPQAAAA==", + "eventTimestamp": "2020-10-13T04:56:42Z", + "ownerId": "Collection1", + "ownerResourceId": "V18LoLrv-qA=", + "operationType": "Create" + } + } + } + ] + } + } + } +} diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbDatabaseList.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbDatabaseList.json new file mode 100644 index 000000000000..5638d0cafb39 --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbDatabaseList.json @@ -0,0 +1,44 @@ +{ + "parameters": { + "api-version": "2020-06-01-preview", + "subscriptionId": "2296c272-5d55-40d9-bc05-4d56dc2d7588", + "location": "WestUS", + "instanceId": "d9b26648-2f53-4541-b3d8-3044f4f9810d" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/36f09704-6be3-4f33-aa05-17b73e504c75/restorableMongodbDatabases/59c21367-b98b-4a8e-abb7-b6f46600decc", + "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbDatabases", + "name": "59c21367-b98b-4a8e-abb7-b6f46600decc", + "properties": { + "resource": { + "_rid": "DLB14gAAAA==", + "eventTimestamp": "2020-09-02T19:45:03Z", + "ownerId": "Database1", + "ownerResourceId": "PD5DALigDgw=", + "operationType": "Create" + } + } + }, + { + "id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableMongodbDatabases/8456cb17-cdb0-4c6a-8db8-d0ff3f886257", + "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbDatabases", + "name": "8456cb17-cdb0-4c6a-8db8-d0ff3f886257", + "properties": { + "resource": { + "_rid": "ESXNLAAAAA==", + "eventTimestamp": "2020-09-02T19:53:42Z", + "ownerId": "Database1", + "ownerResourceId": "PD5DALigDgw=", + "operationType": "Delete" + } + } + } + ] + } + } + } +} diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbResourceList.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbResourceList.json new file mode 100644 index 000000000000..c1144838ccaf --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableMongodbResourceList.json @@ -0,0 +1,35 @@ +{ + "parameters": { + "api-version": "2020-06-01-preview", + "subscriptionId": "2296c272-5d55-40d9-bc05-4d56dc2d7588", + "location": "WestUS", + "instanceId": "d9b26648-2f53-4541-b3d8-3044f4f9810d", + "restoreLocation": "WestUS", + "restoreTimestampInUtc": "10/13/2020 4:56" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "databaseName": "Database1", + "collectionNames": [ + "Collection1" + ] + }, + { + "databaseName": "Database2", + "collectionNames": [ + "Collection1", + "Collection2" + ] + }, + { + "databaseName": "Database3", + "collectionNames": [] + } + ] + } + } + } +} diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlContainerList.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlContainerList.json new file mode 100644 index 000000000000..1bfd3cede997 --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlContainerList.json @@ -0,0 +1,102 @@ +{ + "parameters": { + "api-version": "2020-06-01-preview", + "subscriptionId": "subid", + "location": "WestUS", + "instanceId": "98a570f2-63db-4117-91f0-366327b7b353", + "restorableSqlDatabaseRid": "3fu-hg==" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableSqlContainers/79609a98-3394-41f8-911f-cfab0c075c86", + "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlContainers", + "name": "79609a98-3394-41f8-911f-cfab0c075c86", + "properties": { + "resource": { + "_rid": "zAyAPQAAAA==", + "eventTimestamp": "2020-10-13T04:56:42Z", + "ownerId": "Container1", + "ownerResourceId": "V18LoLrv-qA=", + "operationType": "Create", + "container": { + "id": "Container1", + "indexingPolicy": { + "indexingMode": "Consistent", + "automatic": true, + "includedPaths": [ + { + "path": "/*" + }, + { + "path": "/\"_ts\"/?" + } + ], + "excludedPaths": [ + { + "path": "/\"_etag\"/?" + } + ] + }, + "conflictResolutionPolicy": { + "mode": "LastWriterWins", + "conflictResolutionPath": "/_ts", + "conflictResolutionProcedure": "" + }, + "_rid": "V18LoLrv-qA=", + "_self": "dbs/V18LoA==/colls/V18LoLrv-qA=/", + "_etag": "\"00003e00-0000-0700-0000-5f85338a0000\"" + } + } + } + }, + { + "id": "/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableSqlContainers/e85298a1-c631-4726-825e-a7ca092e9098", + "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlContainers", + "name": "e85298a1-c631-4726-825e-a7ca092e9098", + "properties": { + "resource": { + "_rid": "PrArcgAAAA==", + "eventTimestamp": "2020-10-13T05:03:27Z", + "ownerId": "Container1", + "ownerResourceId": "V18LoLrv-qA=", + "operationType": "Replace", + "container": { + "id": "Container1", + "indexingPolicy": { + "indexingMode": "Consistent", + "automatic": true, + "includedPaths": [ + { + "path": "/*" + }, + { + "path": "/\"_ts\"/?" + } + ], + "excludedPaths": [ + { + "path": "/\"_etag\"/?" + } + ] + }, + "defaultTtl": 12345, + "conflictResolutionPolicy": { + "mode": "LastWriterWins", + "conflictResolutionPath": "/_ts", + "conflictResolutionProcedure": "" + }, + "_rid": "V18LoLrv-qA=", + "_self": "dbs/V18LoA==/colls/V18LoLrv-qA=/", + "_etag": "\"00004400-0000-0700-0000-5f85351f0000\"" + } + } + } + } + ] + } + } + } +} diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlDatabaseList.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlDatabaseList.json new file mode 100644 index 000000000000..9c22669e1c8c --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlDatabaseList.json @@ -0,0 +1,83 @@ +{ + "parameters": { + "api-version": "2020-06-01-preview", + "subscriptionId": "2296c272-5d55-40d9-bc05-4d56dc2d7588", + "location": "WestUS", + "instanceId": "d9b26648-2f53-4541-b3d8-3044f4f9810d" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/36f09704-6be3-4f33-aa05-17b73e504c75/restorableSqlDatabases/59c21367-b98b-4a8e-abb7-b6f46600decc", + "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases", + "name": "59c21367-b98b-4a8e-abb7-b6f46600decc", + "properties": { + "resource": { + "_rid": "DLB14gAAAA==", + "eventTimestamp": "2020-09-02T19:45:03Z", + "ownerId": "Database1", + "ownerResourceId": "3fu-hg==", + "operationType": "Create", + "database": { + "id": "Database1", + "_rid": "3fu-hg==", + "_self": "dbs/3fu-hg==/", + "_etag": "\"0000c20a-0000-0700-0000-5f4ff63f0000\"", + "_colls": "colls/", + "_users": "users/" + } + } + } + }, + { + "id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableSqlDatabases/8456cb17-cdb0-4c6a-8db8-d0ff3f886257", + "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases", + "name": "8456cb17-cdb0-4c6a-8db8-d0ff3f886257", + "properties": { + "resource": { + "_rid": "ESXNLAAAAA==", + "eventTimestamp": "2020-09-02T19:53:42Z", + "ownerId": "Database1", + "ownerResourceId": "3fu-hg==", + "database": { + "id": "Database1", + "_rid": "3fu-hg==", + "_self": "dbs/3fu-hg==/", + "_etag": "\"0000c20a-0000-0700-0000-5f4ff63f0000\"", + "_colls": "colls/", + "_users": "users/", + "_ts": 1599075903 + }, + "operationType": "Delete" + } + } + }, + { + "id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableSqlDatabases/2c07991b-9c7c-4e85-be68-b18c1f2ff326", + "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases", + "name": "2c07991b-9c7c-4e85-be68-b18c1f2ff326", + "properties": { + "resource": { + "_rid": "aXFqUQAAAA==", + "eventTimestamp": "2020-09-02T19:53:15Z", + "ownerId": "Database2", + "ownerResourceId": "0SziSg==", + "database": { + "id": "Database2", + "_rid": "0SziSg==", + "_self": "dbs/0SziSg==/", + "_etag": "\"0000ca0a-0000-0700-0000-5f4ff82b0000\"", + "_colls": "colls/", + "_users": "users/" + }, + "operationType": "Create" + } + } + } + ] + } + } + } +} diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlResourceList.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlResourceList.json new file mode 100644 index 000000000000..48c753e9f968 --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/examples/CosmosDBRestorableSqlResourceList.json @@ -0,0 +1,35 @@ +{ + "parameters": { + "api-version": "2020-06-01-preview", + "subscriptionId": "2296c272-5d55-40d9-bc05-4d56dc2d7588", + "location": "WestUS", + "instanceId": "d9b26648-2f53-4541-b3d8-3044f4f9810d", + "restoreLocation": "WestUS", + "restoreTimestampInUtc": "10/13/2020 4:56" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "databaseName": "Database1", + "collectionNames": [ + "Container1" + ] + }, + { + "databaseName": "Database2", + "collectionNames": [ + "Container1", + "Container2" + ] + }, + { + "databaseName": "Database3", + "collectionNames": [] + } + ] + } + } + } +} diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/restorable.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/restorable.json new file mode 100644 index 000000000000..9a3d6b9b8a43 --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2020-06-01-preview/restorable.json @@ -0,0 +1,693 @@ +{ + "swagger": "2.0", + "info": { + "title": "Cosmos DB", + "description": "Azure Cosmos DB Database Service Resource Provider REST API", + "version": "2020-06-01-preview" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "Impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases": { + "get": { + "operationId": "RestorableSqlDatabases_List", + "x-ms-examples": { + "CosmosDBRestorableSqlDatabaseList": { + "$ref": "./examples/CosmosDBRestorableSqlDatabaseList.json" + } + }, + "description": "Lists all the restorable Azure Cosmos DB SQL databases available under the restorable account.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/locationParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/instanceIdParameter" + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "schema": { + "$ref": "#/definitions/RestorableSqlDatabasesListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/DefaultErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers": { + "get": { + "operationId": "RestorableSqlContainers_List", + "x-ms-examples": { + "CosmosDBRestorableSqlContainerList": { + "$ref": "./examples/CosmosDBRestorableSqlContainerList.json" + } + }, + "description": "Lists all the restorable Azure Cosmos DB SQL containers available for a specific database.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/locationParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/instanceIdParameter" + }, + { + "$ref": "#/parameters/restorableSqlDatabaseRidParameter" + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "schema": { + "$ref": "#/definitions/RestorableSqlContainersListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/DefaultErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources": { + "get": { + "operationId": "RestorableSqlResources_List", + "x-ms-examples": { + "CosmosDBRestorableSqlResourceList": { + "$ref": "./examples/CosmosDBRestorableSqlResourceList.json" + } + }, + "description": "Lists all the restorable Azure Cosmos DB SQL resources available for a specific database account at a given time and location.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/locationParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/instanceIdParameter" + }, + { + "$ref": "#/parameters/restoreLocationParameter" + }, + { + "$ref": "#/parameters/restoreTimestampInUtcParameter" + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "schema": { + "$ref": "#/definitions/RestorableSqlResourcesListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/DefaultErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases": { + "get": { + "operationId": "RestorableMongodbDatabases_List", + "x-ms-examples": { + "CosmosDBRestorableMongodbDatabaseList": { + "$ref": "./examples/CosmosDBRestorableMongodbDatabaseList.json" + } + }, + "description": "Lists all the restorable Azure Cosmos DB MongoDB databases available under the restorable account.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/locationParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/instanceIdParameter" + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "schema": { + "$ref": "#/definitions/RestorableMongodbDatabasesListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/DefaultErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections": { + "get": { + "operationId": "RestorableMongodbCollections_List", + "x-ms-examples": { + "CosmosDBRestorableMongodbCollectionList": { + "$ref": "./examples/CosmosDBRestorableMongodbCollectionList.json" + } + }, + "description": "Lists all the restorable Azure Cosmos DB MongoDB collection available for a specific database.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/locationParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/instanceIdParameter" + }, + { + "$ref": "#/parameters/restorableMongodbDatabaseRidParameter" + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "schema": { + "$ref": "#/definitions/RestorableMongodbCollectionsListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/DefaultErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources": { + "get": { + "operationId": "RestorableMongodbResources_List", + "x-ms-examples": { + "CosmosDBRestorableMongodbResourceList": { + "$ref": "./examples/CosmosDBRestorableMongodbResourceList.json" + } + }, + "description": "Lists all the restorable Azure Cosmos DB MongoDB resources available for a specific database account at a given time and location.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/locationParameter" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/parameters/instanceIdParameter" + }, + { + "$ref": "#/parameters/restoreLocationParameter" + }, + { + "$ref": "#/parameters/restoreTimestampInUtcParameter" + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "schema": { + "$ref": "#/definitions/RestorableMongodbResourcesListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/DefaultErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + } + }, + "definitions": { + "RestorableSqlDatabasesListResult": { + "properties": { + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/RestorableSqlDatabaseGetResult" + }, + "description": "List of restorable SQL databases and their properties." + } + }, + "description": "The List operation response, that contains the restorable SQL databases and their properties." + }, + "RestorableSqlDatabaseGetResult": { + "description": "An Azure Cosmos DB restorable SQL database", + "type": "object", + "properties": { + "properties": { + "type": "object", + "x-ms-client-flatten": true, + "description": "The properties of a restorable SQL database.", + "$ref": "#/definitions/RestorableSqlDatabaseProperties" + } + }, + "allOf": [ + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/ARMResourceProperties" + } + ] + }, + "RestorableSqlDatabaseProperties": { + "description": "The properties of an Azure Cosmos DB restorable SQL database", + "type": "object", + "properties": { + "resource": { + "properties": { + "_rid": { + "type": "string", + "readOnly": true, + "description": "A system generated property. A unique identifier." + }, + "operationType": { + "type": "string", + "readOnly": true, + "description": "The operation type of this database event.", + "$ref": "#/definitions/OperationType" + }, + "eventTimestamp": { + "type": "string", + "readOnly": true, + "description": "The timestamp of this database event." + }, + "ownerId": { + "type": "string", + "readOnly": true, + "description": "The name of this restorable SQL database." + }, + "ownerResourceId": { + "type": "string", + "readOnly": true, + "description": "The resource Id of this restorable SQL database." + }, + "database": { + "properties": { + "_colls": { + "type": "string", + "readOnly": true, + "description": "A system generated property that specified the addressable path of the collections resource." + }, + "_users": { + "type": "string", + "readOnly": true, + "description": "A system generated property that specifies the addressable path of the users resource." + }, + "_self": { + "type": "string", + "readOnly": true, + "description": "A system generated property that specifies the addressable path of the database resource." + } + }, + "allOf": [ + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/SqlDatabaseResource" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/ExtendedResourceProperties" + } + ] + } + } + } + } + }, + "RestorableSqlContainersListResult": { + "properties": { + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/RestorableSqlContainerGetResult" + }, + "description": "List of restorable SQL containers and their properties." + } + }, + "description": "The List operation response, that contains the restorable SQL containers and their properties." + }, + "RestorableSqlContainerGetResult": { + "description": "An Azure Cosmos DB restorable SQL container", + "type": "object", + "properties": { + "properties": { + "type": "object", + "x-ms-client-flatten": true, + "description": "The properties of a restorable SQL container.", + "$ref": "#/definitions/RestorableSqlContainerProperties" + } + }, + "allOf": [ + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/ARMResourceProperties" + } + ] + }, + "RestorableSqlContainerProperties": { + "description": "The properties of an Azure Cosmos DB restorable SQL container", + "type": "object", + "properties": { + "resource": { + "properties": { + "_rid": { + "type": "string", + "readOnly": true, + "description": "A system generated property. A unique identifier." + }, + "operationType": { + "type": "string", + "readOnly": true, + "description": "The operation type of this container event.", + "$ref": "#/definitions/OperationType" + }, + "eventTimestamp": { + "type": "string", + "readOnly": true, + "description": "The timestamp of this container event." + }, + "ownerId": { + "type": "string", + "readOnly": true, + "description": "The name of this restorable SQL container." + }, + "ownerResourceId": { + "type": "string", + "readOnly": true, + "description": "The resource Id of this restorable SQL container." + }, + "container": { + "properties": { + "_self": { + "type": "string", + "readOnly": true, + "description": "A system generated property that specifies the addressable path of the container resource." + } + }, + "allOf": [ + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/SqlContainerResource" + }, + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/ExtendedResourceProperties" + } + ] + } + } + } + } + }, + "RestorableSqlResourcesListResult": { + "properties": { + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/DatabaseRestoreResource" + }, + "description": "List of restorable SQL resources, including the database and collection names." + } + }, + "description": "The List operation response, that contains the restorable SQL resources." + }, + "RestorableMongodbDatabasesListResult": { + "properties": { + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/RestorableMongodbDatabaseGetResult" + }, + "description": "List of restorable MongoDB databases and their properties." + } + }, + "description": "The List operation response, that contains the restorable MongoDB databases and their properties." + }, + "RestorableMongodbDatabaseGetResult": { + "description": "An Azure Cosmos DB restorable MongoDB database", + "type": "object", + "properties": { + "properties": { + "type": "object", + "x-ms-client-flatten": true, + "description": "The properties of a restorable MongoDB database.", + "$ref": "#/definitions/RestorableMongodbDatabaseProperties" + } + }, + "allOf": [ + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/ARMResourceProperties" + } + ] + }, + "RestorableMongodbDatabaseProperties": { + "description": "The properties of an Azure Cosmos DB restorable MongoDB database", + "type": "object", + "properties": { + "resource": { + "properties": { + "_rid": { + "type": "string", + "readOnly": true, + "description": "A system generated property. A unique identifier." + }, + "operationType": { + "type": "string", + "readOnly": true, + "description": "The operation type of this database event.", + "$ref": "#/definitions/OperationType" + }, + "eventTimestamp": { + "type": "string", + "readOnly": true, + "description": "The timestamp of this database event." + }, + "ownerId": { + "type": "string", + "readOnly": true, + "description": "The name of this restorable MongoDB database." + }, + "ownerResourceId": { + "type": "string", + "readOnly": true, + "description": "The resource Id of this restorable MongoDB database." + } + } + } + } + }, + "RestorableMongodbCollectionsListResult": { + "properties": { + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/RestorableMongodbCollectionGetResult" + }, + "description": "List of restorable MongoDB collections and their properties." + } + }, + "description": "The List operation response, that contains the restorable MongoDB collections and their properties." + }, + "RestorableMongodbCollectionGetResult": { + "description": "An Azure Cosmos DB restorable MongoDB collection", + "type": "object", + "properties": { + "properties": { + "type": "object", + "x-ms-client-flatten": true, + "description": "The properties of a restorable MongoDB collection.", + "$ref": "#/definitions/RestorableMongodbCollectionProperties" + } + }, + "allOf": [ + { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/ARMResourceProperties" + } + ] + }, + "RestorableMongodbCollectionProperties": { + "description": "The properties of an Azure Cosmos DB restorable MongoDB collection", + "type": "object", + "properties": { + "resource": { + "properties": { + "_rid": { + "type": "string", + "readOnly": true, + "description": "A system generated property. A unique identifier." + }, + "operationType": { + "type": "string", + "readOnly": true, + "description": "The operation type of this collection event.", + "$ref": "#/definitions/OperationType" + }, + "eventTimestamp": { + "type": "string", + "readOnly": true, + "description": "The timestamp of this collection event." + }, + "ownerId": { + "type": "string", + "readOnly": true, + "description": "The name of this restorable MongoDB collection." + }, + "ownerResourceId": { + "type": "string", + "readOnly": true, + "description": "The resource Id of this restorable MongoDB collection." + } + } + } + } + }, + "RestorableMongodbResourcesListResult": { + "properties": { + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "../../preview/2020-06-01-preview/cosmos-db.json#/definitions/DatabaseRestoreResource" + }, + "description": "List of restorable MongoDB resources, including the database and collection names." + } + }, + "description": "The List operation response, that contains the restorable MongoDB resources." + }, + "OperationType": { + "description": "Enum to indicate the operation type of the event.", + "type": "string", + "readOnly": true, + "enum": [ + "Create", + "Replace", + "Delete", + "SystemOperation" + ], + "x-ms-enum": { + "name": "OperationType", + "modelAsString": true + } + } + }, + "parameters": { + "restorableSqlDatabaseRidParameter": { + "name": "restorableSqlDatabaseRid", + "in": "query", + "required": false, + "type": "string", + "x-ms-parameter-location": "method", + "description": "The resource id of the restorable SQL database." + }, + "restorableMongodbDatabaseRidParameter": { + "name": "restorableMongodbDatabaseRid", + "in": "query", + "required": false, + "type": "string", + "x-ms-parameter-location": "method", + "description": "The resource id of the restorable Mongo database." + }, + "restoreLocationParameter": { + "name": "restoreLocation", + "in": "query", + "required": false, + "type": "string", + "x-ms-parameter-location": "method", + "description": "The location where the restorable resources are located." + }, + "restoreTimestampInUtcParameter": { + "name": "restoreTimestampInUtc", + "in": "query", + "required": false, + "type": "string", + "x-ms-parameter-location": "method", + "description": "The timestamp when the restorable resources existed." + } + } +} diff --git a/specification/cosmos-db/resource-manager/readme.md b/specification/cosmos-db/resource-manager/readme.md index 7cf871f3c057..cb05de45e9c4 100644 --- a/specification/cosmos-db/resource-manager/readme.md +++ b/specification/cosmos-db/resource-manager/readme.md @@ -51,6 +51,7 @@ input-file: - Microsoft.DocumentDB/preview/2020-06-01-preview/cosmos-db.json - Microsoft.DocumentDB/preview/2020-06-01-preview/notebook.json - Microsoft.DocumentDB/preview/2020-06-01-preview/rbac.json +- Microsoft.DocumentDB/preview/2020-06-01-preview/restorable.json - Microsoft.DocumentDB/preview/2019-08-01-preview/privateLinkResources.json - Microsoft.DocumentDB/preview/2019-08-01-preview/privateEndpointConnection.json ```