Dettagli di AppProfile
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Recupera i dettagli di AppProfile.
Esempio di codice
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","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)."]]