特定のサーバー内のすべてのデータベースを一覧表示します。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases?api-version=2022-12-01
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
resourceGroupName
|
path |
True
|
string
|
リソース グループの名前。 名前の大文字と小文字は区別されます。
|
serverName
|
path |
True
|
string
|
サーバーの名前。
Regex pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
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
|
ユーザー アカウントの借用
|
例
List databases in a server
Sample Request
GET https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/databases?api-version=2022-12-01
/** Samples for Databases ListByServer. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabasesListByServer.json
*/
/**
* Sample code: List databases in a server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void listDatabasesInAServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.databases().listByServer("TestGroup", "testserver", 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.rdbms import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python databases_list_by_server.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 = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.databases.list_by_server(
resource_group_name="TestGroup",
server_name="testserver",
)
for item in response:
print(item)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabasesListByServer.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 armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabasesListByServer.json
func ExampleDatabasesClient_NewListByServerPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewDatabasesClient().NewListByServerPager("TestGroup", "testserver", 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.DatabaseListResult = armpostgresqlflexibleservers.DatabaseListResult{
// Value: []*armpostgresqlflexibleservers.Database{
// {
// Name: to.Ptr("db1"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/databases"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/databases/db1"),
// Properties: &armpostgresqlflexibleservers.DatabaseProperties{
// Charset: to.Ptr("utf8"),
// Collation: to.Ptr("en_US.utf8"),
// },
// },
// {
// Name: to.Ptr("db2"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers/databases"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/databases/db2"),
// Properties: &armpostgresqlflexibleservers.DatabaseProperties{
// Charset: to.Ptr("utf8"),
// Collation: to.Ptr("en_US.utf8"),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to List all the databases in a given server.
*
* @summary List all the databases in a given server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabasesListByServer.json
*/
async function listDatabasesInAServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const serverName = "testserver";
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.databases.listByServer(resourceGroupName, serverName)) {
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": [
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/databases/db1",
"name": "db1",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/databases",
"properties": {
"charset": "utf8",
"collation": "en_US.utf8"
}
},
{
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/databases/db2",
"name": "db2",
"type": "Microsoft.DBforPostgreSQL/flexibleServers/databases",
"properties": {
"charset": "utf8",
"collation": "en_US.utf8"
}
}
]
}
定義
createdByType
リソースを作成した ID の種類。
名前 |
型 |
説明 |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
Database
データベースを表します。
名前 |
型 |
説明 |
id
|
string
|
リソースの完全修飾リソース ID。 例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
リソースの名前
|
properties.charset
|
string
|
データベースの文字セット。
|
properties.collation
|
string
|
データベースの照合順序。
|
systemData
|
systemData
|
createdBy および modifiedBy 情報を含む Azure Resource Manager メタデータ。
|
type
|
string
|
リソースの型。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts"
|
DatabaseListResult
データベースの一覧。
名前 |
型 |
説明 |
nextLink
|
string
|
データベースの次のページを取得するために使用されるリンク。
|
value
|
Database[]
|
サーバーに格納されているデータベースの一覧
|
ErrorAdditionalInfo
リソース管理エラーの追加情報。
名前 |
型 |
説明 |
info
|
object
|
追加情報。
|
type
|
string
|
追加情報の種類。
|
ErrorDetail
エラーの詳細。
名前 |
型 |
説明 |
additionalInfo
|
ErrorAdditionalInfo[]
|
エラーの追加情報。
|
code
|
string
|
エラー コード。
|
details
|
ErrorDetail[]
|
エラーの詳細です。
|
message
|
string
|
エラー メッセージ。
|
target
|
string
|
エラーのターゲット。
|
ErrorResponse
エラー応答
systemData
リソースの作成と最後の変更に関連するメタデータ。
名前 |
型 |
説明 |
createdAt
|
string
|
リソース作成のタイムスタンプ (UTC)。
|
createdBy
|
string
|
リソースを作成した ID。
|
createdByType
|
createdByType
|
リソースを作成した ID の種類。
|
lastModifiedAt
|
string
|
リソースの最終変更のタイムスタンプ (UTC)
|
lastModifiedBy
|
string
|
リソースを最後に変更した ID。
|
lastModifiedByType
|
createdByType
|
リソースを最後に変更した ID の種類。
|