顯示特定資料庫下所有 Azure Cosmos DB Gremlin 圖形上完成之所有突變的事件摘要。 這可協助在意外刪除容器的情況下。 此 API 需要 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' 許可權
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs?api-version=2024-11-15
含選擇性參數:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableGraphs?api-version=2024-11-15&restorableGremlinDatabaseRid={restorableGremlinDatabaseRid}&startTime={startTime}&endTime={endTime}
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
instanceId
|
path |
True
|
string
|
可還原資料庫帳戶的instanceId GUID。
|
location
|
path |
True
|
string
|
Cosmos DB 區域,單字與每個單字大寫之間的空格。
|
subscriptionId
|
path |
True
|
string
|
目標訂用帳戶的標識碼。
|
api-version
|
query |
True
|
string
|
要用於這項作業的 API 版本。
|
endTime
|
query |
|
string
|
可還原的 Gremlin 圖形事件摘要結束時間。
|
restorableGremlinDatabaseRid
|
query |
|
string
|
Gremlin 資料庫的資源標識碼。
|
startTime
|
query |
|
string
|
可還原的 Gremlin 圖形事件摘要開始時間。
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 Flow
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
CosmosDBRestorableGremlinGraphList
範例要求
GET https://management.azure.com/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableGraphs?api-version=2024-11-15&restorableGremlinDatabaseRid=PD5DALigDgw=
/**
* Samples for RestorableGremlinGraphs List.
*/
public final class Main {
/*
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/
* CosmosDBRestorableGremlinGraphList.json
*/
/**
* Sample code: CosmosDBRestorableGremlinGraphList.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void cosmosDBRestorableGremlinGraphList(com.azure.resourcemanager.AzureResourceManager azure) {
azure.cosmosDBAccounts().manager().serviceClient().getRestorableGremlinGraphs().list("WestUS",
"98a570f2-63db-4117-91f0-366327b7b353", "PD5DALigDgw=", null, null, 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_gremlin_graph_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="subid",
)
response = client.restorable_gremlin_graphs.list(
location="WestUS",
instance_id="98a570f2-63db-4117-91f0-366327b7b353",
)
for item in response:
print(item)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableGremlinGraphList.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/azcore/to"
"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/CosmosDBRestorableGremlinGraphList.json
func ExampleRestorableGremlinGraphsClient_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.NewRestorableGremlinGraphsClient().NewListPager("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", &armcosmos.RestorableGremlinGraphsClientListOptions{RestorableGremlinDatabaseRid: to.Ptr("PD5DALigDgw="),
StartTime: nil,
EndTime: 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.RestorableGremlinGraphsListResult = armcosmos.RestorableGremlinGraphsListResult{
// Value: []*armcosmos.RestorableGremlinGraphGetResult{
// {
// Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"),
// Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGraphs"),
// ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableGraphs/79609a98-3394-41f8-911f-cfab0c075c86"),
// Properties: &armcosmos.RestorableGremlinGraphProperties{
// Resource: &armcosmos.RestorableGremlinGraphPropertiesResource{
// Rid: to.Ptr("zAyAPQAAAA=="),
// CanUndelete: to.Ptr("invalid"),
// EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"),
// OperationType: to.Ptr(armcosmos.OperationTypeCreate),
// OwnerID: to.Ptr("Graph1"),
// OwnerResourceID: to.Ptr("V18LoLrv-qA="),
// },
// },
// },
// {
// Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"),
// Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGraphs"),
// ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableGraphs/79609a98-3394-41f8-911f-cfab0c075c86"),
// Properties: &armcosmos.RestorableGremlinGraphProperties{
// Resource: &armcosmos.RestorableGremlinGraphPropertiesResource{
// Rid: to.Ptr("zAyAPQAAAA=="),
// CanUndelete: to.Ptr("notRestorable"),
// CanUndeleteReason: to.Ptr("Individual shared database collections restore is not supported. Please restore shared database to restore its collections that share the throughput."),
// EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"),
// OperationType: to.Ptr(armcosmos.OperationTypeDelete),
// OwnerID: to.Ptr("Graph1"),
// OwnerResourceID: to.Ptr("V18LoLrv-qA="),
// },
// },
// }},
// }
}
}
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 Gremlin graphs under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission
*
* @summary Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs under a specific database. This helps in scenario where container was accidentally deleted. 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/CosmosDBRestorableGremlinGraphList.json
*/
async function cosmosDbRestorableGremlinGraphList() {
const subscriptionId = process.env["COSMOSDB_SUBSCRIPTION_ID"] || "subid";
const location = "WestUS";
const instanceId = "98a570f2-63db-4117-91f0-366327b7b353";
const restorableGremlinDatabaseRid = "PD5DALigDgw=";
const options = {
restorableGremlinDatabaseRid,
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.restorableGremlinGraphs.list(location, instanceId, options)) {
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/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableGraphs/79609a98-3394-41f8-911f-cfab0c075c86",
"type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGraphs",
"name": "79609a98-3394-41f8-911f-cfab0c075c86",
"properties": {
"resource": {
"_rid": "zAyAPQAAAA==",
"eventTimestamp": "2020-10-13T04:56:42Z",
"ownerId": "Graph1",
"ownerResourceId": "V18LoLrv-qA=",
"operationType": "Create",
"canUndelete": "invalid"
}
}
},
{
"id": "/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableGraphs/79609a98-3394-41f8-911f-cfab0c075c86",
"type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGraphs",
"name": "79609a98-3394-41f8-911f-cfab0c075c86",
"properties": {
"resource": {
"_rid": "zAyAPQAAAA==",
"eventTimestamp": "2020-10-13T04:56:42Z",
"ownerId": "Graph1",
"ownerResourceId": "V18LoLrv-qA=",
"operationType": "Delete",
"canUndelete": "notRestorable",
"canUndeleteReason": "Individual shared database collections restore is not supported. Please restore shared database to restore its collections that share the throughput."
}
}
}
]
}
定義
CloudError
來自服務的錯誤回應。
ErrorResponse
錯誤回應。
名稱 |
類型 |
Description |
code
|
string
|
錯誤碼。
|
message
|
string
|
錯誤訊息,指出作業失敗的原因。
|
OperationType
列舉,表示事件的作業類型。
名稱 |
類型 |
Description |
Create
|
string
|
|
Delete
|
string
|
|
Recreate
|
string
|
|
Replace
|
string
|
|
SystemOperation
|
string
|
|
Resource
Azure Cosmos DB Gremlin 圖形事件的資源
名稱 |
類型 |
Description |
_rid
|
string
|
系統產生的屬性。 唯一標識碼。
|
canUndelete
|
string
|
此圖表的狀態,用來識別此圖表是否可在相同帳戶中還原。
|
canUndeleteReason
|
string
|
無法在同一個帳戶中還原此圖表的原因。
|
eventTimestamp
|
string
|
發生此圖形事件的時間。
|
operationType
|
OperationType
|
此圖形事件的作業類型。
|
ownerId
|
string
|
此 Gremlin 圖形的名稱。
|
ownerResourceId
|
string
|
此 Gremlin 圖形的資源標識碼。
|
RestorableGremlinGraphGetResult
Azure Cosmos DB Gremlin 圖形事件
名稱 |
類型 |
Description |
id
|
string
|
ARM 資源的唯一資源標識碼。
|
name
|
string
|
ARM 資源的名稱。
|
properties.resource
|
Resource
|
Azure Cosmos DB Gremlin 圖形事件的資源
|
type
|
string
|
Azure 資源的類型。
|
RestorableGremlinGraphsListResult
清單作業回應,其中包含 Gremlin 圖形事件及其屬性。