Verfügbarkeitsdiagnose löschen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Demonstriert, wie die Konfiguration einer Verfügbarkeitsdiagnose gelöscht wird.
Weitere Informationen
Eine ausführliche Dokumentation, die dieses Codebeispiel enthält, finden Sie hier:
Codebeispiel
Nächste Schritte
Wenn Sie nach Codebeispielen für andere Google Cloud -Produkte suchen und filtern möchten, können Sie den Google Cloud -Beispielbrowser verwenden.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],[],[],[],null,["Demonstrates how to delete an uptime check config.\n\nExplore further\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Manage uptime checks](/monitoring/uptime-checks/manage)\n\nCode sample \n\nC#\n\n\nTo authenticate to Monitoring, 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 public static object DeleteUptimeCheckConfig(string configName)\n {\n var client = UptimeCheckServiceClient.Create();\n client.DeleteUptimeCheckConfig(configName);\n Console.WriteLine($\"Deleted {configName}\");\n return 0;\n }\n\nGo\n\n\nTo authenticate to Monitoring, 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\n // delete is an example of deleting an uptime check. resourceName should be\n // of the form `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`.\n func delete(w io.Writer, resourceName string) error {\n \tctx := context.Background()\n \tclient, err := monitoring.NewUptimeCheckClient(ctx)\n \tif err != nil {\n \t\treturn fmt.Errorf(\"NewUptimeCheckClient: %w\", err)\n \t}\n \tdefer client.Close()\n \treq := &monitoringpb.DeleteUptimeCheckConfigRequest{\n \t\tName: resourceName,\n \t}\n \tif err := client.DeleteUptimeCheckConfig(ctx, req); err != nil {\n \t\treturn fmt.Errorf(\"DeleteUptimeCheckConfig: %w\", err)\n \t}\n \tfmt.Fprintf(w, \"Successfully deleted %q\", resourceName)\n \treturn nil\n }\n\nJava\n\n\nTo authenticate to Monitoring, 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 private static void deleteUptimeCheckConfig(String checkName) throws IOException {\n try (UptimeCheckServiceClient client = UptimeCheckServiceClient.create()) {\n client.deleteUptimeCheckConfig(checkName);\n } catch (Exception e) {\n usage(\"Exception deleting uptime check: \" + e.toString());\n throw e;\n }\n }\n\nNode.js\n\n\nTo authenticate to Monitoring, 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 // Imports the Google Cloud client library\n const monitoring = require('https://cloud.google.com/nodejs/docs/reference/monitoring/latest/overview.html');\n\n // Creates a client\n const client = new monitoring.https://cloud.google.com/nodejs/docs/reference/monitoring/latest/overview.html();\n\n /**\n * TODO(developer): Uncomment and edit the following lines of code.\n */\n // const projectId = 'YOUR_PROJECT_ID';\n // const uptimeCheckConfigId = 'YOUR_UPTIME_CHECK_CONFIG_ID';\n\n const request = {\n // i.e. name: 'projects/my-project-id/uptimeCheckConfigs/My-Uptime-Check\n name: client.projectUptimeCheckConfigPath(projectId, uptimeCheckConfigId),\n };\n\n console.log(`Deleting ${request.name}`);\n\n // Delete an uptime check config\n await client.deleteUptimeCheckConfig(request);\n console.log(`${request.name} deleted.`);\n\nPHP\n\n\nTo authenticate to Monitoring, 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\\Cloud\\Monitoring\\V3\\Client\\UptimeCheckServiceClient;\n use Google\\Cloud\\Monitoring\\V3\\DeleteUptimeCheckConfigRequest;\n\n /**\n * Example:\n * ```\n * delete_uptime_check($projectId, $configName);\n * ```\n *\n * @param string $projectId Your project ID\n * @param string $configName\n */\n function delete_uptime_check($projectId, $configName)\n {\n $uptimeCheckClient = new UptimeCheckServiceClient([\n 'projectId' =\u003e $projectId,\n ]);\n $deleteUptimeCheckConfigRequest = (new DeleteUptimeCheckConfigRequest())\n -\u003esetName($configName);\n\n $uptimeCheckClient-\u003edeleteUptimeCheckConfig($deleteUptimeCheckConfigRequest);\n\n printf('Deleted an uptime check: ' . $configName . PHP_EOL);\n }\n\nPython\n\n\nTo authenticate to Monitoring, 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 # `config_name` is the `name` field of an UptimeCheckConfig.\n # See https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.uptimeCheckConfigs#UptimeCheckConfig.\n def delete_uptime_check_config(config_name: str) -\u003e None:\n \"\"\"Deletes the uptime check configuration\n\n Args:\n config_name: Uptime check configuration identity\n \"\"\"\n client = monitoring_v3.UptimeCheckServiceClient()\n client.delete_uptime_check_config(request={\"name\": config_name})\n print(\"Deleted \", config_name)\n\nRuby\n\n\nTo authenticate to Monitoring, 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 gem \"google-cloud-monitoring\"\n require \"google/cloud/monitoring\"\n\n def delete_uptime_check_config config_name\n client = Google::Cloud::https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest/Google-Cloud-Monitoring.html.https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring/latest/Google-Cloud-Monitoring.html\n client.delete_uptime_check_config name: config_name\n puts \"Deleted #{config_name}\"\n end\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=monitoring)."]]