AppProfile details
Stay organized with collections
Save and categorize content based on your preferences.
Retrieve AppProfile details.
Code sample
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis content demonstrates how to retrieve and display details of a Bigtable AppProfile using both C++ and PHP code examples.\u003c/p\u003e\n"],["\u003cp\u003eThe code samples utilize the Bigtable client libraries, with instructions provided for installation and setup of these libraries.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication to Bigtable is required and should be set up using Application Default Credentials (ADC) as detailed in the documentation.\u003c/p\u003e\n"],["\u003cp\u003eThe PHP code sample specifically demonstrates how to handle potential \u003ccode\u003eNOT_FOUND\u003c/code\u003e errors, which can occur if the specified AppProfile does not exist.\u003c/p\u003e\n"],["\u003cp\u003eThe PHP code highlights various metadata within the App Profile, such as name, Etag, description and routing policies.\u003c/p\u003e\n"]]],[],null,["# AppProfile details\n\nRetrieve AppProfile details.\n\nCode sample\n-----------\n\n### C++\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n namespace cbt = ::google::cloud::bigtable;\n namespace cbta = ::google::cloud::bigtable_admin;\n using ::google::cloud::StatusOr;\n [](cbta::BigtableInstanceAdminClient instance_admin,\n std::string const& project_id, std::string const& instance_id,\n std::string const& profile_id) {\n std::string profile_name =\n cbt::AppProfileName(project_id, instance_id, profile_id);\n StatusOr\u003cgoogle::bigtable::admin::v2::AppProfile\u003e profile =\n instance_admin.GetAppProfile(profile_name);\n if (!profile) throw std::move(profile).status();\n std::cout \u003c\u003c \"Application Profile details=\" \u003c\u003c profile-\u003eDebugString()\n \u003c\u003c \"\\n\";\n }\n\n### PHP\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n use Google\\ApiCore\\ApiException;\n use Google\\Cloud\\Bigtable\\Admin\\V2\\Client\\BigtableInstanceAdminClient;\n use Google\\Cloud\\Bigtable\\Admin\\V2\\GetAppProfileRequest;\n\n /**\n * Get the App Profile\n *\n * @param string $projectId The Google Cloud project ID\n * @param string $instanceId The ID of the Bigtable instance\n * @param string $appProfileId The ID of the App Profile to fetch\n */\n function get_app_profile(\n string $projectId,\n string $instanceId,\n string $appProfileId\n ): void {\n $instanceAdminClient = new BigtableInstanceAdminClient();\n $appProfileName = $instanceAdminClient-\u003eappProfileName($projectId, $instanceId, $appProfileId);\n\n printf('Fetching the App Profile %s' . PHP_EOL, $appProfileId);\n try {\n $getAppProfileRequest = (new GetAppProfileRequest())\n -\u003esetName($appProfileName);\n $appProfile = $instanceAdminClient-\u003egetAppProfile($getAppProfileRequest);\n } catch (ApiException $e) {\n if ($e-\u003egetStatus() === 'NOT_FOUND') {\n printf('App profile %s does not exist.' . PHP_EOL, $appProfileId);\n return;\n }\n throw $e;\n }\n\n printf('Printing Details:' . PHP_EOL);\n\n // Fetch some commonly used metadata\n printf('Name: %s' . PHP_EOL, $appProfile-\u003egetName());\n printf('Etag: %s' . PHP_EOL, $appProfile-\u003egetEtag());\n printf('Description: %s' . PHP_EOL, $appProfile-\u003egetDescription());\n printf('Routing Policy: %s' . PHP_EOL, $appProfile-\u003egetRoutingPolicy());\n\n if ($appProfile-\u003ehasSingleClusterRouting()) {\n $clusterId = $appProfile-\u003egetSingleClusterRouting()-\u003egetClusterId();\n $singleRowTransactions = $appProfile-\u003egetSingleClusterRouting()-\u003egetAllowTransactionalWrites() ? 'Yes' : 'No';\n printf('Cluster: %s' . PHP_EOL, $clusterId);\n printf('Single-Row Transactions: %s' . PHP_EOL, $singleRowTransactions);\n }\n }\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=bigtable)."]]