1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service\RecaptchaEnterprise\Resource; 19 20use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1Key; 21use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1ListKeysResponse; 22use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1Metrics; 23use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1MigrateKeyRequest; 24use Google\Service\RecaptchaEnterprise\GoogleProtobufEmpty; 25 26/** 27 * The "keys" collection of methods. 28 * Typical usage is: 29 * <code> 30 * $recaptchaenterpriseService = new Google\Service\RecaptchaEnterprise(...); 31 * $keys = $recaptchaenterpriseService->keys; 32 * </code> 33 */ 34class ProjectsKeys extends \Google\Service\Resource 35{ 36 /** 37 * Creates a new reCAPTCHA Enterprise key. (keys.create) 38 * 39 * @param string $parent Required. The name of the project in which the key will 40 * be created, in the format "projects/{project}". 41 * @param GoogleCloudRecaptchaenterpriseV1Key $postBody 42 * @param array $optParams Optional parameters. 43 * @return GoogleCloudRecaptchaenterpriseV1Key 44 */ 45 public function create($parent, GoogleCloudRecaptchaenterpriseV1Key $postBody, $optParams = []) 46 { 47 $params = ['parent' => $parent, 'postBody' => $postBody]; 48 $params = array_merge($params, $optParams); 49 return $this->call('create', [$params], GoogleCloudRecaptchaenterpriseV1Key::class); 50 } 51 /** 52 * Deletes the specified key. (keys.delete) 53 * 54 * @param string $name Required. The name of the key to be deleted, in the 55 * format "projects/{project}/keys/{key}". 56 * @param array $optParams Optional parameters. 57 * @return GoogleProtobufEmpty 58 */ 59 public function delete($name, $optParams = []) 60 { 61 $params = ['name' => $name]; 62 $params = array_merge($params, $optParams); 63 return $this->call('delete', [$params], GoogleProtobufEmpty::class); 64 } 65 /** 66 * Returns the specified key. (keys.get) 67 * 68 * @param string $name Required. The name of the requested key, in the format 69 * "projects/{project}/keys/{key}". 70 * @param array $optParams Optional parameters. 71 * @return GoogleCloudRecaptchaenterpriseV1Key 72 */ 73 public function get($name, $optParams = []) 74 { 75 $params = ['name' => $name]; 76 $params = array_merge($params, $optParams); 77 return $this->call('get', [$params], GoogleCloudRecaptchaenterpriseV1Key::class); 78 } 79 /** 80 * Get some aggregated metrics for a Key. This data can be used to build 81 * dashboards. (keys.getMetrics) 82 * 83 * @param string $name Required. The name of the requested metrics, in the 84 * format "projects/{project}/keys/{key}/metrics". 85 * @param array $optParams Optional parameters. 86 * @return GoogleCloudRecaptchaenterpriseV1Metrics 87 */ 88 public function getMetrics($name, $optParams = []) 89 { 90 $params = ['name' => $name]; 91 $params = array_merge($params, $optParams); 92 return $this->call('getMetrics', [$params], GoogleCloudRecaptchaenterpriseV1Metrics::class); 93 } 94 /** 95 * Returns the list of all keys that belong to a project. 96 * (keys.listProjectsKeys) 97 * 98 * @param string $parent Required. The name of the project that contains the 99 * keys that will be listed, in the format "projects/{project}". 100 * @param array $optParams Optional parameters. 101 * 102 * @opt_param int pageSize Optional. The maximum number of keys to return. 103 * Default is 10. Max limit is 1000. 104 * @opt_param string pageToken Optional. The next_page_token value returned from 105 * a previous. ListKeysRequest, if any. 106 * @return GoogleCloudRecaptchaenterpriseV1ListKeysResponse 107 */ 108 public function listProjectsKeys($parent, $optParams = []) 109 { 110 $params = ['parent' => $parent]; 111 $params = array_merge($params, $optParams); 112 return $this->call('list', [$params], GoogleCloudRecaptchaenterpriseV1ListKeysResponse::class); 113 } 114 /** 115 * Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key 116 * is migrated, it can be used from either product. SiteVerify requests are 117 * billed as CreateAssessment calls. You must be authenticated as one of the 118 * current owners of the reCAPTCHA Site Key, and your user must have the 119 * reCAPTCHA Enterprise Admin IAM role in the destination project. 120 * (keys.migrate) 121 * 122 * @param string $name Required. The name of the key to be migrated, in the 123 * format "projects/{project}/keys/{key}". 124 * @param GoogleCloudRecaptchaenterpriseV1MigrateKeyRequest $postBody 125 * @param array $optParams Optional parameters. 126 * @return GoogleCloudRecaptchaenterpriseV1Key 127 */ 128 public function migrate($name, GoogleCloudRecaptchaenterpriseV1MigrateKeyRequest $postBody, $optParams = []) 129 { 130 $params = ['name' => $name, 'postBody' => $postBody]; 131 $params = array_merge($params, $optParams); 132 return $this->call('migrate', [$params], GoogleCloudRecaptchaenterpriseV1Key::class); 133 } 134 /** 135 * Updates the specified key. (keys.patch) 136 * 137 * @param string $name The resource name for the Key in the format 138 * "projects/{project}/keys/{key}". 139 * @param GoogleCloudRecaptchaenterpriseV1Key $postBody 140 * @param array $optParams Optional parameters. 141 * 142 * @opt_param string updateMask Optional. The mask to control which fields of 143 * the key get updated. If the mask is not present, all fields will be updated. 144 * @return GoogleCloudRecaptchaenterpriseV1Key 145 */ 146 public function patch($name, GoogleCloudRecaptchaenterpriseV1Key $postBody, $optParams = []) 147 { 148 $params = ['name' => $name, 'postBody' => $postBody]; 149 $params = array_merge($params, $optParams); 150 return $this->call('patch', [$params], GoogleCloudRecaptchaenterpriseV1Key::class); 151 } 152} 153 154// Adding a class alias for backwards compatibility with the previous class name. 155class_alias(ProjectsKeys::class, 'Google_Service_RecaptchaEnterprise_Resource_ProjectsKeys'); 156