기존 Cosmos DB 위치의 속성 가져오기
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}?api-version=2023-11-15
URI 매개 변수
Name |
In(다음 안에) |
필수 |
형식 |
Description |
location
|
path |
True
|
string
|
단어와 각 단어 사이에 공백이 대문자로 표시된 Cosmos DB 영역입니다.
|
subscriptionId
|
path |
True
|
string
|
대상 구독의 ID입니다.
|
api-version
|
query |
True
|
string
|
이 작업에 사용할 API 버전입니다.
|
응답
보안
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
사용자 계정 가장
|
예제
CosmosDBLocationGet
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/locations/westus?api-version=2023-11-15
/**
* Samples for Locations Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBLocationGet.json
*/
/**
* Sample code: CosmosDBLocationGet.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void cosmosDBLocationGet(com.azure.resourcemanager.AzureResourceManager azure) {
azure.cosmosDBAccounts().manager().serviceClient().getLocations().getWithResponse("westus",
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_location_get.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="00000000-0000-0000-0000-000000000000",
)
response = client.locations.get(
location="westus",
)
print(response)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBLocationGet.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/CosmosDBLocationGet.json
func ExampleLocationsClient_Get() {
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)
}
res, err := clientFactory.NewLocationsClient().Get(ctx, "westus", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LocationGetResult = armcosmos.LocationGetResult{
// Name: to.Ptr("westus"),
// Type: to.Ptr("Microsoft.DocumentDB/locations"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/locations/westus"),
// Properties: &armcosmos.LocationProperties{
// BackupStorageRedundancies: []*armcosmos.BackupStorageRedundancy{
// to.Ptr(armcosmos.BackupStorageRedundancyLocal),
// to.Ptr(armcosmos.BackupStorageRedundancyGeo)},
// IsResidencyRestricted: to.Ptr(true),
// IsSubscriptionRegionAccessAllowedForAz: to.Ptr(true),
// IsSubscriptionRegionAccessAllowedForRegular: to.Ptr(true),
// Status: to.Ptr(armcosmos.StatusOnline),
// SupportsAvailabilityZone: to.Ptr(true),
// },
// }
}
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 Get the properties of an existing Cosmos DB location
*
* @summary Get the properties of an existing Cosmos DB location
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBLocationGet.json
*/
async function cosmosDbLocationGet() {
const subscriptionId =
process.env["COSMOSDB_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const location = "westus";
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const result = await client.locations.get(location);
console.log(result);
}
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
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/locations/westus",
"type": "Microsoft.DocumentDB/locations",
"name": "westus",
"properties": {
"supportsAvailabilityZone": true,
"isResidencyRestricted": true,
"backupStorageRedundancies": [
"Local",
"Geo"
],
"isSubscriptionRegionAccessAllowedForRegular": true,
"isSubscriptionRegionAccessAllowedForAz": true,
"status": "Online"
}
}
정의
BackupStorageRedundancy
백업 스토리지 중복성 유형을 나타내는 열거형입니다.
Name |
형식 |
Description |
Geo
|
string
|
|
Local
|
string
|
|
Zone
|
string
|
|
CloudError
서비스의 오류 응답입니다.
ErrorResponse
오류 응답.
Name |
형식 |
Description |
code
|
string
|
오류 코드
|
message
|
string
|
작업이 실패한 이유를 나타내는 오류 메시지입니다.
|
LocationGetResult
Cosmos DB 위치 가져오기 결과
Name |
형식 |
Description |
id
|
string
|
데이터베이스 계정의 고유 리소스 식별자입니다.
|
name
|
string
|
데이터베이스 계정의 이름입니다.
|
properties
|
LocationProperties
|
Cosmos DB 위치 메타데이터
|
type
|
string
|
Azure 리소스의 유형입니다.
|
LocationProperties
Cosmos DB 위치 메타데이터
Name |
형식 |
Description |
backupStorageRedundancies
|
BackupStorageRedundancy[]
|
사용 가능한 백업 스토리지 중복의 속성입니다.
|
isResidencyRestricted
|
boolean
|
위치가 상주에 중요한지 여부를 나타내는 플래그입니다.
|
isSubscriptionRegionAccessAllowedForAz
|
boolean
|
구독이 가용성 영역(Az)에 대한 지역에서 액세스할 수 있는지 여부를 나타내는 플래그입니다.
|
isSubscriptionRegionAccessAllowedForRegular
|
boolean
|
비 가용성 영역 대한 지역에서 구독에 액세스할 수 있는지 여부를 나타내는 플래그입니다.
|
status
|
Status
|
지역의 현재 빌드 상태 나타내는 열거형입니다.
|
supportsAvailabilityZone
|
boolean
|
위치가 가용성 영역을 지원하는지 여부를 나타내는 플래그입니다.
|
Status
지역의 현재 빌드 상태 나타내는 열거형입니다.
Name |
형식 |
Description |
Deleting
|
string
|
|
Initializing
|
string
|
|
InternallyReady
|
string
|
|
Online
|
string
|
|
Uninitialized
|
string
|
|