Excluir uma verificação de tempo de atividade
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Demonstra como excluir uma configuração de verificação de tempo de atividade.
Mais informações
Para ver a documentação detalhada que inclui este exemplo de código, consulte:
Exemplo de código
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","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/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)."]]