Lists所有可用的 Cosmos DB 资源提供程序操作。
GET https://management.azure.com/providers/Microsoft.DocumentDB/operations?api-version=2023-11-15
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
api-version
|
query |
True
|
string
|
要用于此操作的 API 版本。
|
响应
安全性
azure_auth
Azure Active Directory OAuth2 流
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
CosmosDBOperationsList
Sample Request
GET https://management.azure.com/providers/Microsoft.DocumentDB/operations?api-version=2023-11-15
/**
* Samples for Operations List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBOperationsList.
* json
*/
/**
* Sample code: CosmosDBOperationsList.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void cosmosDBOperationsList(com.azure.resourcemanager.AzureResourceManager azure) {
azure.cosmosDBAccounts().manager().serviceClient().getOperations().list(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_operations_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="SUBSCRIPTION_ID",
)
response = client.operations.list()
for item in response:
print(item)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBOperationsList.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/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBOperationsList.json
func ExampleOperationsClient_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.NewOperationsClient().NewListPager(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.OperationListResult = armcosmos.OperationListResult{
// Value: []*armcosmos.Operation{
// {
// Name: to.Ptr("operationName"),
// Display: &armcosmos.OperationDisplay{
// Description: to.Ptr("description"),
// Operation: to.Ptr("operationName"),
// Provider: to.Ptr("providerName"),
// Resource: to.Ptr("resourceName"),
// },
// }},
// }
}
}
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 Lists all of the available Cosmos DB Resource Provider operations.
*
* @summary Lists all of the available Cosmos DB Resource Provider operations.
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBOperationsList.json
*/
async function cosmosDbOperationsList() {
const subscriptionId =
process.env["COSMOSDB_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
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
Sample Response
{
"value": [
{
"name": "operationName",
"display": {
"Provider": "providerName",
"Resource": "resourceName",
"Operation": "operationName",
"Description": "description"
}
}
]
}
定义
Display
表示操作的 对象。
名称 |
类型 |
说明 |
Description
|
string
|
操作说明
|
Operation
|
string
|
操作类型:读取、写入、删除等。
|
Provider
|
string
|
服务提供商:Microsoft.ResourceProvider
|
Resource
|
string
|
执行操作的资源:配置文件、终结点等。
|
Operation
REST API 操作
名称 |
类型 |
说明 |
display
|
Display
|
表示操作的 对象。
|
name
|
string
|
操作名称:{provider}/{resource}/{operation}
|
OperationListResult
列出资源提供程序操作的请求的结果。 它包含操作列表和用于获取下一组结果的 URL 链接。
名称 |
类型 |
说明 |
nextLink
|
string
|
用于获取下一组操作列表结果(如果有)的 URL。
|
value
|
Operation[]
|
资源提供程序支持的操作列表。
|