既存の Cosmos DB の場所のプロパティを取得する
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}?api-version=2023-11-15
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
location
|
path |
True
|
string
|
単語と各単語の間のスペースが大文字の Cosmos DB リージョン。
|
subscriptionId
|
path |
True
|
string
|
ターゲット サブスクリプションの ID。
|
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
|
ユーザー アカウントの借用
|
例
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
バックアップ ストレージの冗長性の種類を示す列挙型。
名前 |
型 |
説明 |
Geo
|
string
|
|
Local
|
string
|
|
Zone
|
string
|
|
CloudError
サービスからのエラー応答。
ErrorResponse
エラー応答。
名前 |
型 |
説明 |
code
|
string
|
エラー コード。
|
message
|
string
|
操作が失敗した理由を示すエラー メッセージ。
|
LocationGetResult
Cosmos DB の場所の取得結果
名前 |
型 |
説明 |
id
|
string
|
データベース アカウントの一意のリソース識別子。
|
name
|
string
|
データベース アカウントの名前。
|
properties
|
LocationProperties
|
Cosmos DB の場所のメタデータ
|
type
|
string
|
Azure リソースの種類。
|
LocationProperties
Cosmos DB の場所のメタデータ
名前 |
型 |
説明 |
backupStorageRedundancies
|
BackupStorageRedundancy[]
|
使用可能なバックアップ ストレージの冗長性のプロパティ。
|
isResidencyRestricted
|
boolean
|
場所が所在地に依存するかどうかを示すフラグ。
|
isSubscriptionRegionAccessAllowedForAz
|
boolean
|
サブスクリプションが Availability Zones(Az) のリージョンでアクセスできるかどうかを示すフラグ。
|
isSubscriptionRegionAccessAllowedForRegular
|
boolean
|
サブスクリプションが非Availability Zonesのリージョンでアクセスできるかどうかを示すフラグ。
|
status
|
Status
|
リージョンの現在のビルドアウト状態を示す列挙型。
|
supportsAvailabilityZone
|
boolean
|
場所が可用性ゾーンをサポートしているかどうかを示すフラグ。
|
Status
リージョンの現在のビルドアウト状態を示す列挙型。
名前 |
型 |
説明 |
Deleting
|
string
|
|
Initializing
|
string
|
|
InternallyReady
|
string
|
|
Online
|
string
|
|
Uninitialized
|
string
|
|