刪除 AppProfile
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
刪除 AppProfile。
程式碼範例
C++
如要瞭解如何安裝及使用 Bigtable 的用戶端程式庫,請參閱這篇文章。
如要向 Bigtable 進行驗證,請設定應用程式預設憑證。
詳情請參閱「為本機開發環境設定驗證」。
PHP
如要瞭解如何安裝及使用 Bigtable 的用戶端程式庫,請參閱這篇文章。
如要向 Bigtable 進行驗證,請設定應用程式預設憑證。
詳情請參閱「為本機開發環境設定驗證」。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis page provides instructions and code samples for deleting an AppProfile in Google Cloud Bigtable using C++ and PHP.\u003c/p\u003e\n"],["\u003cp\u003eThe code examples demonstrate how to use the \u003ccode\u003eBigtableInstanceAdminClient\u003c/code\u003e to delete a specified AppProfile by its ID within a given project and instance.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves setting up authentication via Application Default Credentials and installing the appropriate Bigtable client libraries.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code snippets show how to construct and execute a \u003ccode\u003eDeleteAppProfileRequest\u003c/code\u003e, along with handling potential exceptions, such as a \u003ccode\u003eNOT_FOUND\u003c/code\u003e error, in PHP.\u003c/p\u003e\n"],["\u003cp\u003eUsers can refer to the Google Cloud sample browser for more code samples related to other Google Cloud products.\u003c/p\u003e\n"]]],[],null,["Delete an AppProfile.\n\nCode sample \n\nC++\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::Status;\n [](cbta::BigtableInstanceAdminClient instance_admin,\n std::string const& project_id, std::string const& instance_id,\n std::string const& profile_id, bool ignore_warnings) {\n std::string profile_name =\n cbt::AppProfileName(project_id, instance_id, profile_id);\n\n google::bigtable::admin::v2::DeleteAppProfileRequest req;\n req.set_name(profile_name);\n req.set_ignore_warnings(ignore_warnings);\n\n Status status = instance_admin.DeleteAppProfile(std::move(req));\n if (!status.ok()) throw std::runtime_error(status.message());\n std::cout \u003c\u003c \"Application Profile deleted\\n\";\n }\n\nPHP\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\\DeleteAppProfileRequest;\n\n /**\n * Delete an App Profile from a Bigtable instance.\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 be deleted\n */\n function delete_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 $ignoreWarnings = true;\n\n printf('Deleting the App Profile: %s' . PHP_EOL, $appProfileId);\n\n try {\n // If $ignoreWarnings is set to false, Bigtable will warn you that all future requests using the AppProfile will fail\n $deleteAppProfileRequest = (new DeleteAppProfileRequest())\n -\u003esetName($appProfileName)\n -\u003esetIgnoreWarnings($ignoreWarnings);\n $instanceAdminClient-\u003edeleteAppProfile($deleteAppProfileRequest);\n printf('App Profile %s deleted.' . PHP_EOL, $appProfileId);\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\nWhat's next\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=bigtable)."]]