Detalles del AppProfile
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Recupera los detalles del AppProfile.
Muestra de código
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","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)."]]