インスタンスの詳細を取得する

このスニペットでは、特定のインスタンスの詳細を取得する方法を示します。これを使用して、インスタンスの構成、現在の状態、IP アドレスなどの情報を取得します。

コードサンプル

C#

AlloyDB に対する認証を行うには、アプリケーションのデフォルト認証情報を設定します。 詳細については、 ローカル開発環境の認証の設定をご覧ください。

using Google.Cloud.AlloyDb.V1;

public sealed partial class GeneratedAlloyDBAdminClientSnippets
{
    /// <summary>Snippet for GetInstance</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void GetInstance()
    {
        // Create client
        AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.Create();
        // Initialize request argument(s)
        string name = "projects/[PROJECT]/locations/[LOCATION]/clusters/[CLUSTER]/instances/[INSTANCE]";
        // Make the request
        Instance response = alloyDBAdminClient.GetInstance(name);
    }
}

次のステップ

他の Google Cloud プロダクトのコードサンプルを検索およびフィルタするには、Google Cloud サンプル ブラウザをご覧ください。