Devuelve una lista de la base de datos y el combo de contenedor que existen en la cuenta en la marca de tiempo y la ubicación especificadas. Esto ayuda en escenarios a validar qué recursos existen en una marca de tiempo y una ubicación dadas. Esta API requiere el permiso "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read".
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources?api-version=2024-11-15
Con parámetros opcionales:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources?api-version=2024-11-15&restoreLocation={restoreLocation}&restoreTimestampInUtc={restoreTimestampInUtc}
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
instanceId
|
path |
True
|
string
|
Guid instanceId de una cuenta de base de datos restaurable.
|
location
|
path |
True
|
string
|
Región de Cosmos DB, con espacios entre palabras y cada palabra en mayúsculas.
|
subscriptionId
|
path |
True
|
string
|
Identificador de la suscripción de destino.
|
api-version
|
query |
True
|
string
|
Versión de la API que se va a usar para esta operación.
|
restoreLocation
|
query |
|
string
|
Ubicación donde se encuentran los recursos restaurables.
|
restoreTimestampInUtc
|
query |
|
string
|
Marca de tiempo cuando existían los recursos restaurables.
|
Respuestas
Nombre |
Tipo |
Description |
200 OK
|
RestorableSqlResourcesListResult
|
La operación se completó correctamente.
|
Other Status Codes
|
CloudError
|
Respuesta de error que describe por qué se produjo un error en la operación.
|
Seguridad
azure_auth
Flujo de OAuth2 de Azure Active Directory
Tipo:
oauth2
Flujo:
implicit
Dirección URL de autorización:
https://login.microsoftonline.com/common/oauth2/authorize
Ámbitos
Nombre |
Description |
user_impersonation
|
Suplantar la cuenta de usuario
|
Ejemplos
CosmosDBRestorableSqlResourceList
Solicitud de ejemplo
GET https://management.azure.com/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableSqlResources?api-version=2024-11-15&restoreLocation=WestUS&restoreTimestampInUtc=06/01/2022 4:56
/**
* Samples for RestorableSqlResources List.
*/
public final class Main {
/*
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/
* CosmosDBRestorableSqlResourceList.json
*/
/**
* Sample code: CosmosDBRestorableSqlResourceList.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void cosmosDBRestorableSqlResourceList(com.azure.resourcemanager.AzureResourceManager azure) {
azure.cosmosDBAccounts().manager().serviceClient().getRestorableSqlResources().list("WestUS",
"d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "06/01/2022 4:56", 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_sql_resource_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_sql_resources.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/CosmosDBRestorableSqlResourceList.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/CosmosDBRestorableSqlResourceList.json
func ExampleRestorableSQLResourcesClient_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.NewRestorableSQLResourcesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", &armcosmos.RestorableSQLResourcesClientListOptions{RestoreLocation: to.Ptr("WestUS"),
RestoreTimestampInUTC: to.Ptr("06/01/2022 4:56"),
})
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.RestorableSQLResourcesListResult = armcosmos.RestorableSQLResourcesListResult{
// Value: []*armcosmos.RestorableSQLResourcesGetResult{
// {
// Name: to.Ptr("Database1"),
// Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources"),
// CollectionNames: []*string{
// to.Ptr("Container1")},
// DatabaseName: to.Ptr("Database1"),
// ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database1"),
// },
// {
// Name: to.Ptr("Database2"),
// Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources"),
// CollectionNames: []*string{
// to.Ptr("Container1"),
// to.Ptr("Container2")},
// DatabaseName: to.Ptr("Database2"),
// ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database2"),
// },
// {
// Name: to.Ptr("Database3"),
// Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources"),
// CollectionNames: []*string{
// },
// DatabaseName: to.Ptr("Database3"),
// ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database3"),
// }},
// }
}
}
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 Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission.
*
* @summary Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. 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/CosmosDBRestorableSqlResourceList.json
*/
async function cosmosDbRestorableSqlResourceList() {
const subscriptionId =
process.env["COSMOSDB_SUBSCRIPTION_ID"] || "2296c272-5d55-40d9-bc05-4d56dc2d7588";
const location = "WestUS";
const instanceId = "d9b26648-2f53-4541-b3d8-3044f4f9810d";
const restoreLocation = "WestUS";
const restoreTimestampInUtc = "06/01/2022 4:56";
const options = {
restoreLocation,
restoreTimestampInUtc,
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.restorableSqlResources.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
Respuesta de muestra
{
"value": [
{
"id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database1",
"type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources",
"name": "Database1",
"databaseName": "Database1",
"collectionNames": [
"Container1"
]
},
{
"id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database2",
"type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources",
"name": "Database2",
"databaseName": "Database2",
"collectionNames": [
"Container1",
"Container2"
]
},
{
"id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database3",
"type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources",
"name": "Database3",
"databaseName": "Database3",
"collectionNames": []
}
]
}
Definiciones
CloudError
Respuesta de error del servicio.
ErrorResponse
Respuesta de error.
Nombre |
Tipo |
Description |
code
|
string
|
Código de error.
|
message
|
string
|
Mensaje de error que indica por qué se produjo un error en la operación.
|
RestorableSqlResourcesGetResult
Bases de datos específicas que se van a restaurar.
Nombre |
Tipo |
Description |
collectionNames
|
string[]
|
Nombres de las colecciones disponibles para la restauración.
|
databaseName
|
string
|
Nombre de la base de datos disponible para la restauración.
|
id
|
string
|
Identificador de recurso único del recurso de ARM.
|
name
|
string
|
Nombre del recurso de ARM.
|
type
|
string
|
Tipo de recurso de Azure.
|
RestorableSqlResourcesListResult
La respuesta de la operación List, que contiene los recursos DE SQL restaurables.
Nombre |
Tipo |
Description |
value
|
RestorableSqlResourcesGetResult[]
|
Lista de recursos SQL restaurables, incluidos los nombres de la base de datos y la colección.
|