Azure / Azure/azure-libraries-for-java

[BUG] CosmosDBAccountsImpl.list() and CosmosDBAccountsImpl.listAsync() methods do not call List Database Accounts REST API

Aperta
#716 1 commento 1 reazione 0 assegnatari Vedi su GitHub
Cosmos customer-reported Mgmt
Lingua principale
Java
Stelle
97
Fork
102
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**
The list() and listAsync() APIs for CosmosDB do not call the List all in subscription REST API: https://docs.microsoft.com/en-us/rest/api/cosmos-db-resource-provider/databaseaccounts/list

Instead these methods first call the List all Resource Groups in subscription REST API, then for each Resource Group, it calls List Database Accounts by Resource Group:

https://docs.microsoft.com/en-us/rest/api/resources/resourcegroups/list

https://docs.microsoft.com/en-us/rest/api/cosmos-db-resource-provider/databaseaccounts/listbyresourcegroup

This results in a lot of API calls for subscriptions with many resource groups. It is also confusing behavior considering that most other list() and listAsync() APIs in the SDK call the List all in subscription API for the given resource, as opposed to this two-pronged approach where the List all Resource Groups API, then List all in Resource Group APIs are called.

***Exception or Stack Trace***
N/A

**To Reproduce**
Call the CosmosDBAccountsImpl.list() or the CosmosDBAccountsImpl.listAsync() method.

***Code Snippet***
`azure.cosmosDBAccounts().list()`
`azure.cosmosDBAccounts().listAsync()`

**Expected behavior**
The list() and listAsync() SDK methods should call the corresponding List REST API. The typical convention across Azure Resource Manager providers in the SDK is that the list() and listAsync() methods call the corresponding List REST API, which fetches all instances of that resource in a subscription.

**Screenshots**
N/A

**Setup (please complete the following information):**
- OS: macOS 10.14.3
- IDE : IntelliJ IDEA 2018.3.5
- Version of the Library used: 1.20.1

**Additional context**
N/A

**Information Checklist**
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [X] Bug Description Added
- [X] Repro Steps Added
- [X] Setup information Added

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Ispeziona CosmosDBAccountsImpl.list() e listAsync(), quindi confronta le chiamate correnti ai gruppi di risorse con la List Database Accounts REST API collegata. Riproduci il problema con azure.cosmosDBAccounts().list() e listAsync(); il lavoro è completato quando entrambi i metodi usano la List API a livello di sottoscrizione invece di enumerare i gruppi di risorse.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
azure, java
Ambito
api, cloud, databases
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.