reCAPTCHA Enterprise 사이트 키 삭제
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
지정된 프로젝트 ID에 대해 지정된 reCAPTCHA 사이트 키를 삭제합니다.
코드 샘플
Java
reCAPTCHA에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
PHP
reCAPTCHA에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Python
reCAPTCHA에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Ruby
reCAPTCHA에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 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"]],[],[],[],null,["# Delete a reCAPTCHA Enterprise site key\n\nDelete the given reCAPTCHA site key for the given project ID.\n\nCode sample\n-----------\n\n### Java\n\n\nTo authenticate to reCAPTCHA, 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 import com.google.cloud.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.html;\n import com.google.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.DeleteKeyRequest.html;\n import com.google.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.KeyName.html;\n import java.io.IOException;\n import java.util.concurrent.ExecutionException;\n import java.util.concurrent.TimeUnit;\n import java.util.concurrent.TimeoutException;\n\n public class DeleteSiteKey {\n\n public static void main(String[] args)\n throws IOException, ExecutionException, InterruptedException, TimeoutException {\n // TODO(developer): Replace these variables before running the sample.\n String projectID = \"your-project-id\";\n String recaptchaSiteKey = \"recaptcha-site-key\";\n\n deleteSiteKey(projectID, recaptchaSiteKey);\n }\n\n /**\n * Delete the given reCAPTCHA site key present under the project ID.\n *\n * @param projectID: GCloud Project ID.\n * @param recaptchaSiteKey: Specify the site key to be deleted.\n */\n public static void deleteSiteKey(String projectID, String recaptchaSiteKey)\n throws IOException, ExecutionException, InterruptedException, TimeoutException {\n // Initialize client that will be used to send requests. This client only needs to be created\n // once, and can be reused for multiple requests. After completing all of your requests, call\n // the `client.close()` method on the client to safely\n // clean up any remaining background resources.\n try (https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.html client = https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.html.create()) {\n\n // Set the project ID and reCAPTCHA site key.\n https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.DeleteKeyRequest.html deleteKeyRequest =\n https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.DeleteKeyRequest.html.newBuilder()\n .setName(https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.KeyName.html.of(projectID, recaptchaSiteKey).toString())\n .build();\n\n client.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.html#com_google_cloud_recaptchaenterprise_v1_RecaptchaEnterpriseServiceClient_deleteKeyCallable__().futureCall(deleteKeyRequest).get(5, TimeUnit.SECONDS);\n System.out.println(\"reCAPTCHA Site key successfully deleted !\");\n }\n }\n }\n\n### PHP\n\n\nTo authenticate to reCAPTCHA, 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\\RecaptchaEnterprise\\V1\\Client\\RecaptchaEnterpriseServiceClient;\n use Google\\Cloud\\RecaptchaEnterprise\\V1\\DeleteKeyRequest;\n\n /**\n * Delete an existing reCAPTCHA key from your Google Cloud project\n *\n * @param string $projectId Your Google Cloud project ID\n * @param string $keyId The 40 char long key ID you wish to delete\n */\n function delete_key(string $projectId, string $keyId): void\n {\n $client = new RecaptchaEnterpriseServiceClient();\n $formattedKeyName = $client-\u003ekeyName($projectId, $keyId);\n\n try {\n $deleteKeyRequest = (new DeleteKeyRequest())\n -\u003esetName($formattedKeyName);\n $client-\u003edeleteKey($deleteKeyRequest);\n printf('The key: %s is deleted.' . PHP_EOL, $keyId);\n } catch (ApiException $e) {\n if ($e-\u003egetStatus() === 'NOT_FOUND') {\n printf('The key with Key ID: %s doesn\\'t exist.' . PHP_EOL, $keyId);\n } else {\n print('deleteKey() call failed with the following error: ');\n print($e-\u003egetBasicMessage() . PHP_EOL);\n }\n }\n }\n\n### Python\n\n\nTo authenticate to reCAPTCHA, 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 from google.cloud import https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/\n\n\n def delete_site_key(project_id: str, recaptcha_site_key: str) -\u003e None:\n \"\"\"Delete the given reCAPTCHA site key present under the project ID.\n\n Args:\n project_id : GCloud Project ID.\n recaptcha_site_key: Specify the key ID to be deleted.\n \"\"\"\n\n client = https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/.https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/google.cloud.recaptchaenterprise_v1.services.recaptcha_enterprise_service.RecaptchaEnterpriseServiceClient.html()\n\n # Construct the key details.\n key_name = f\"projects/{project_id}/keys/{recaptcha_site_key}\"\n\n # Set the project ID and reCAPTCHA site key.\n request = https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/.https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/google.cloud.recaptchaenterprise_v1.types.DeleteKeyRequest.html()\n request.name = key_name\n\n client.https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/google.cloud.recaptchaenterprise_v1.services.recaptcha_enterprise_service.RecaptchaEnterpriseServiceClient.html#google_cloud_recaptchaenterprise_v1_services_recaptcha_enterprise_service_RecaptchaEnterpriseServiceClient_delete_key(request)\n print(\"reCAPTCHA Site key deleted successfully ! \")\n\n### Ruby\n\n\nTo authenticate to reCAPTCHA, 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 require \"google/cloud/recaptcha_enterprise\"\n\n # Delete site key registered to use recaptcha services.\n #\n # @param project_id [String] GCloud Project ID.\n # @param site_key [String] Site key to be updated.\n # @return [void]\n def delete_site_key project_id:, site_key:\n # Create the reCAPTCHA client.\n client = ::Google::Cloud::RecaptchaEnterprise.recaptcha_enterprise_service\n\n client.delete_key name: \"projects/#{project_id}/keys/#{site_key}\"\n puts \"reCAPTCHA Site key deleted successfully !\"\n end\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=recaptcha_enterprise)."]]