復元可能なアカウントのすべての Azure Cosmos DB MongoDB データベースで行われたすべての変更のイベント フィードを表示します。 これは、削除時刻を取得するためにデータベースが誤って削除されたシナリオで役立ちます。 この API には、'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' アクセス許可が必要です
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases?api-version=2024-11-15
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
instanceId
|
path |
True
|
string
|
復元可能なデータベース アカウントの instanceId GUID。
|
location
|
path |
True
|
string
|
Cosmos DB リージョン。単語と各単語の間にスペースが大文字で表示されます。
|
subscriptionId
|
path |
True
|
string
|
ターゲット サブスクリプションの ID。
|
api-version
|
query |
True
|
string
|
この操作に使用する API バージョン。
|
応答
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
名前 |
説明 |
user_impersonation
|
ユーザー アカウントを偽装する
|
例
CosmosDBRestorableMongodbDatabaseList
要求のサンプル
GET https://management.azure.com/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableMongodbDatabases?api-version=2024-11-15
/**
* Samples for RestorableMongodbDatabases List.
*/
public final class Main {
/*
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/
* CosmosDBRestorableMongodbDatabaseList.json
*/
/**
* Sample code: CosmosDBRestorableMongodbDatabaseList.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void cosmosDBRestorableMongodbDatabaseList(com.azure.resourcemanager.AzureResourceManager azure) {
azure.cosmosDBAccounts().manager().serviceClient().getRestorableMongodbDatabases().list("WestUS",
"d9b26648-2f53-4541-b3d8-3044f4f9810d", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.cosmosdb import CosmosDBManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-cosmosdb
# USAGE
python cosmos_db_restorable_mongodb_database_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CosmosDBManagementClient(
credential=DefaultAzureCredential(),
subscription_id="2296c272-5d55-40d9-bc05-4d56dc2d7588",
)
response = client.restorable_mongodb_databases.list(
location="WestUS",
instance_id="d9b26648-2f53-4541-b3d8-3044f4f9810d",
)
for item in response:
print(item)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableMongodbDatabaseList.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcosmos_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ded6306d00ae294c24211e5069c1f56b15ba8ef5/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableMongodbDatabaseList.json
func ExampleRestorableMongodbDatabasesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcosmos.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewRestorableMongodbDatabasesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.RestorableMongodbDatabasesListResult = armcosmos.RestorableMongodbDatabasesListResult{
// Value: []*armcosmos.RestorableMongodbDatabaseGetResult{
// {
// Name: to.Ptr("59c21367-b98b-4a8e-abb7-b6f46600decc"),
// Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbDatabases"),
// ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/36f09704-6be3-4f33-aa05-17b73e504c75/restorableMongodbDatabases/59c21367-b98b-4a8e-abb7-b6f46600decc"),
// Properties: &armcosmos.RestorableMongodbDatabaseProperties{
// Resource: &armcosmos.RestorableMongodbDatabasePropertiesResource{
// Rid: to.Ptr("DLB14gAAAA=="),
// CanUndelete: to.Ptr("invalid"),
// EventTimestamp: to.Ptr("2020-09-02T19:45:03Z"),
// OperationType: to.Ptr(armcosmos.OperationTypeCreate),
// OwnerID: to.Ptr("Database1"),
// OwnerResourceID: to.Ptr("PD5DALigDgw="),
// },
// },
// },
// {
// Name: to.Ptr("8456cb17-cdb0-4c6a-8db8-d0ff3f886257"),
// Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbDatabases"),
// ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableMongodbDatabases/8456cb17-cdb0-4c6a-8db8-d0ff3f886257"),
// Properties: &armcosmos.RestorableMongodbDatabaseProperties{
// Resource: &armcosmos.RestorableMongodbDatabasePropertiesResource{
// Rid: to.Ptr("ESXNLAAAAA=="),
// CanUndelete: to.Ptr("notRestorable"),
// CanUndeleteReason: to.Ptr("Database already exists. Only deleted resources can be restored within same account."),
// EventTimestamp: to.Ptr("2020-09-02T19:53:42Z"),
// OperationType: to.Ptr(armcosmos.OperationTypeDelete),
// OwnerID: to.Ptr("Database1"),
// OwnerResourceID: to.Ptr("PD5DALigDgw="),
// },
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission
*
* @summary Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableMongodbDatabaseList.json
*/
async function cosmosDbRestorableMongodbDatabaseList() {
const subscriptionId =
process.env["COSMOSDB_SUBSCRIPTION_ID"] || "2296c272-5d55-40d9-bc05-4d56dc2d7588";
const location = "WestUS";
const instanceId = "d9b26648-2f53-4541-b3d8-3044f4f9810d";
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.restorableMongodbDatabases.list(location, instanceId)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"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",
"canUndelete": "invalid"
}
}
},
{
"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",
"canUndelete": "notRestorable",
"canUndeleteReason": "Database already exists. Only deleted resources can be restored within same account."
}
}
}
]
}
定義
CloudError
サービスからのエラー応答。
ErrorResponse
エラー応答。
名前 |
型 |
説明 |
code
|
string
|
エラー コード。
|
message
|
string
|
操作が失敗した理由を示すエラー メッセージ。
|
OperationType
イベントの操作の種類を示す列挙型。
名前 |
型 |
説明 |
Create
|
string
|
|
Delete
|
string
|
|
Recreate
|
string
|
|
Replace
|
string
|
|
SystemOperation
|
string
|
|
Resource
Azure Cosmos DB MongoDB データベース イベントのリソース
名前 |
型 |
説明 |
_rid
|
string
|
システムによって生成されたプロパティ。 一意の識別子。
|
canUndelete
|
string
|
このデータベースが同じアカウントで復元可能かどうかを識別する、このデータベースの状態。
|
canUndeleteReason
|
string
|
このデータベースを同じアカウントで復元できない理由。
|
eventTimestamp
|
string
|
このデータベース イベントが発生した時刻。
|
operationType
|
OperationType
|
このデータベース イベントの操作の種類。
|
ownerId
|
string
|
この MongoDB データベースの名前。
|
ownerResourceId
|
string
|
この MongoDB データベースのリソース ID。
|
RestorableMongodbDatabaseGetResult
Azure Cosmos DB MongoDB データベース イベント
名前 |
型 |
説明 |
id
|
string
|
ARM リソースの一意のリソース識別子。
|
name
|
string
|
ARM リソースの名前。
|
properties.resource
|
Resource
|
Azure Cosmos DB MongoDB データベース イベントのリソース
|
type
|
string
|
Azure リソースの種類。
|
RestorableMongodbDatabasesListResult
MongoDB データベース イベントとそのプロパティを含む List 操作の応答。