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 |
|
---|
18 | namespace Google\Service\RecaptchaEnterprise\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1AddIpOverrideRequest;
|
---|
21 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1AddIpOverrideResponse;
|
---|
22 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1Key;
|
---|
23 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1ListIpOverridesResponse;
|
---|
24 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1ListKeysResponse;
|
---|
25 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1Metrics;
|
---|
26 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1MigrateKeyRequest;
|
---|
27 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideRequest;
|
---|
28 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideResponse;
|
---|
29 | use Google\Service\RecaptchaEnterprise\GoogleCloudRecaptchaenterpriseV1RetrieveLegacySecretKeyResponse;
|
---|
30 | use Google\Service\RecaptchaEnterprise\GoogleProtobufEmpty;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * The "keys" collection of methods.
|
---|
34 | * Typical usage is:
|
---|
35 | * <code>
|
---|
36 | * $recaptchaenterpriseService = new Google\Service\RecaptchaEnterprise(...);
|
---|
37 | * $keys = $recaptchaenterpriseService->projects_keys;
|
---|
38 | * </code>
|
---|
39 | */
|
---|
40 | class ProjectsKeys extends \Google\Service\Resource
|
---|
41 | {
|
---|
42 | /**
|
---|
43 | * Adds an IP override to a key. The following restrictions hold: * The maximum
|
---|
44 | * number of IP overrides per key is 100. * For any conflict (such as IP already
|
---|
45 | * exists or IP part of an existing IP range), an error is returned.
|
---|
46 | * (keys.addIpOverride)
|
---|
47 | *
|
---|
48 | * @param string $name Required. The name of the key to which the IP override is
|
---|
49 | * added, in the format `projects/{project}/keys/{key}`.
|
---|
50 | * @param GoogleCloudRecaptchaenterpriseV1AddIpOverrideRequest $postBody
|
---|
51 | * @param array $optParams Optional parameters.
|
---|
52 | * @return GoogleCloudRecaptchaenterpriseV1AddIpOverrideResponse
|
---|
53 | * @throws \Google\Service\Exception
|
---|
54 | */
|
---|
55 | public function addIpOverride($name, GoogleCloudRecaptchaenterpriseV1AddIpOverrideRequest $postBody, $optParams = [])
|
---|
56 | {
|
---|
57 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
58 | $params = array_merge($params, $optParams);
|
---|
59 | return $this->call('addIpOverride', [$params], GoogleCloudRecaptchaenterpriseV1AddIpOverrideResponse::class);
|
---|
60 | }
|
---|
61 | /**
|
---|
62 | * Creates a new reCAPTCHA Enterprise key. (keys.create)
|
---|
63 | *
|
---|
64 | * @param string $parent Required. The name of the project in which the key is
|
---|
65 | * created, in the format `projects/{project}`.
|
---|
66 | * @param GoogleCloudRecaptchaenterpriseV1Key $postBody
|
---|
67 | * @param array $optParams Optional parameters.
|
---|
68 | * @return GoogleCloudRecaptchaenterpriseV1Key
|
---|
69 | * @throws \Google\Service\Exception
|
---|
70 | */
|
---|
71 | public function create($parent, GoogleCloudRecaptchaenterpriseV1Key $postBody, $optParams = [])
|
---|
72 | {
|
---|
73 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
74 | $params = array_merge($params, $optParams);
|
---|
75 | return $this->call('create', [$params], GoogleCloudRecaptchaenterpriseV1Key::class);
|
---|
76 | }
|
---|
77 | /**
|
---|
78 | * Deletes the specified key. (keys.delete)
|
---|
79 | *
|
---|
80 | * @param string $name Required. The name of the key to be deleted, in the
|
---|
81 | * format `projects/{project}/keys/{key}`.
|
---|
82 | * @param array $optParams Optional parameters.
|
---|
83 | * @return GoogleProtobufEmpty
|
---|
84 | * @throws \Google\Service\Exception
|
---|
85 | */
|
---|
86 | public function delete($name, $optParams = [])
|
---|
87 | {
|
---|
88 | $params = ['name' => $name];
|
---|
89 | $params = array_merge($params, $optParams);
|
---|
90 | return $this->call('delete', [$params], GoogleProtobufEmpty::class);
|
---|
91 | }
|
---|
92 | /**
|
---|
93 | * Returns the specified key. (keys.get)
|
---|
94 | *
|
---|
95 | * @param string $name Required. The name of the requested key, in the format
|
---|
96 | * `projects/{project}/keys/{key}`.
|
---|
97 | * @param array $optParams Optional parameters.
|
---|
98 | * @return GoogleCloudRecaptchaenterpriseV1Key
|
---|
99 | * @throws \Google\Service\Exception
|
---|
100 | */
|
---|
101 | public function get($name, $optParams = [])
|
---|
102 | {
|
---|
103 | $params = ['name' => $name];
|
---|
104 | $params = array_merge($params, $optParams);
|
---|
105 | return $this->call('get', [$params], GoogleCloudRecaptchaenterpriseV1Key::class);
|
---|
106 | }
|
---|
107 | /**
|
---|
108 | * Get some aggregated metrics for a Key. This data can be used to build
|
---|
109 | * dashboards. (keys.getMetrics)
|
---|
110 | *
|
---|
111 | * @param string $name Required. The name of the requested metrics, in the
|
---|
112 | * format `projects/{project}/keys/{key}/metrics`.
|
---|
113 | * @param array $optParams Optional parameters.
|
---|
114 | * @return GoogleCloudRecaptchaenterpriseV1Metrics
|
---|
115 | * @throws \Google\Service\Exception
|
---|
116 | */
|
---|
117 | public function getMetrics($name, $optParams = [])
|
---|
118 | {
|
---|
119 | $params = ['name' => $name];
|
---|
120 | $params = array_merge($params, $optParams);
|
---|
121 | return $this->call('getMetrics', [$params], GoogleCloudRecaptchaenterpriseV1Metrics::class);
|
---|
122 | }
|
---|
123 | /**
|
---|
124 | * Returns the list of all keys that belong to a project.
|
---|
125 | * (keys.listProjectsKeys)
|
---|
126 | *
|
---|
127 | * @param string $parent Required. The name of the project that contains the
|
---|
128 | * keys that is listed, in the format `projects/{project}`.
|
---|
129 | * @param array $optParams Optional parameters.
|
---|
130 | *
|
---|
131 | * @opt_param int pageSize Optional. The maximum number of keys to return.
|
---|
132 | * Default is 10. Max limit is 1000.
|
---|
133 | * @opt_param string pageToken Optional. The next_page_token value returned from
|
---|
134 | * a previous. ListKeysRequest, if any.
|
---|
135 | * @return GoogleCloudRecaptchaenterpriseV1ListKeysResponse
|
---|
136 | * @throws \Google\Service\Exception
|
---|
137 | */
|
---|
138 | public function listProjectsKeys($parent, $optParams = [])
|
---|
139 | {
|
---|
140 | $params = ['parent' => $parent];
|
---|
141 | $params = array_merge($params, $optParams);
|
---|
142 | return $this->call('list', [$params], GoogleCloudRecaptchaenterpriseV1ListKeysResponse::class);
|
---|
143 | }
|
---|
144 | /**
|
---|
145 | * Lists all IP overrides for a key. (keys.listIpOverrides)
|
---|
146 | *
|
---|
147 | * @param string $parent Required. The parent key for which the IP overrides are
|
---|
148 | * listed, in the format `projects/{project}/keys/{key}`.
|
---|
149 | * @param array $optParams Optional parameters.
|
---|
150 | *
|
---|
151 | * @opt_param int pageSize Optional. The maximum number of overrides to return.
|
---|
152 | * Default is 10. Max limit is 100. If the number of overrides is less than the
|
---|
153 | * page_size, all overrides are returned. If the page size is more than 100, it
|
---|
154 | * is coerced to 100.
|
---|
155 | * @opt_param string pageToken Optional. The next_page_token value returned from
|
---|
156 | * a previous ListIpOverridesRequest, if any.
|
---|
157 | * @return GoogleCloudRecaptchaenterpriseV1ListIpOverridesResponse
|
---|
158 | * @throws \Google\Service\Exception
|
---|
159 | */
|
---|
160 | public function listIpOverrides($parent, $optParams = [])
|
---|
161 | {
|
---|
162 | $params = ['parent' => $parent];
|
---|
163 | $params = array_merge($params, $optParams);
|
---|
164 | return $this->call('listIpOverrides', [$params], GoogleCloudRecaptchaenterpriseV1ListIpOverridesResponse::class);
|
---|
165 | }
|
---|
166 | /**
|
---|
167 | * Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key
|
---|
168 | * is migrated, it can be used from either product. SiteVerify requests are
|
---|
169 | * billed as CreateAssessment calls. You must be authenticated as one of the
|
---|
170 | * current owners of the reCAPTCHA Key, and your user must have the reCAPTCHA
|
---|
171 | * Enterprise Admin IAM role in the destination project. (keys.migrate)
|
---|
172 | *
|
---|
173 | * @param string $name Required. The name of the key to be migrated, in the
|
---|
174 | * format `projects/{project}/keys/{key}`.
|
---|
175 | * @param GoogleCloudRecaptchaenterpriseV1MigrateKeyRequest $postBody
|
---|
176 | * @param array $optParams Optional parameters.
|
---|
177 | * @return GoogleCloudRecaptchaenterpriseV1Key
|
---|
178 | * @throws \Google\Service\Exception
|
---|
179 | */
|
---|
180 | public function migrate($name, GoogleCloudRecaptchaenterpriseV1MigrateKeyRequest $postBody, $optParams = [])
|
---|
181 | {
|
---|
182 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
183 | $params = array_merge($params, $optParams);
|
---|
184 | return $this->call('migrate', [$params], GoogleCloudRecaptchaenterpriseV1Key::class);
|
---|
185 | }
|
---|
186 | /**
|
---|
187 | * Updates the specified key. (keys.patch)
|
---|
188 | *
|
---|
189 | * @param string $name Identifier. The resource name for the Key in the format
|
---|
190 | * `projects/{project}/keys/{key}`.
|
---|
191 | * @param GoogleCloudRecaptchaenterpriseV1Key $postBody
|
---|
192 | * @param array $optParams Optional parameters.
|
---|
193 | *
|
---|
194 | * @opt_param string updateMask Optional. The mask to control which fields of
|
---|
195 | * the key get updated. If the mask is not present, all fields are updated.
|
---|
196 | * @return GoogleCloudRecaptchaenterpriseV1Key
|
---|
197 | * @throws \Google\Service\Exception
|
---|
198 | */
|
---|
199 | public function patch($name, GoogleCloudRecaptchaenterpriseV1Key $postBody, $optParams = [])
|
---|
200 | {
|
---|
201 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
202 | $params = array_merge($params, $optParams);
|
---|
203 | return $this->call('patch', [$params], GoogleCloudRecaptchaenterpriseV1Key::class);
|
---|
204 | }
|
---|
205 | /**
|
---|
206 | * Removes an IP override from a key. The following restrictions hold: * If the
|
---|
207 | * IP isn't found in an existing IP override, a `NOT_FOUND` error is returned. *
|
---|
208 | * If the IP is found in an existing IP override, but the override type does not
|
---|
209 | * match, a `NOT_FOUND` error is returned. (keys.removeIpOverride)
|
---|
210 | *
|
---|
211 | * @param string $name Required. The name of the key from which the IP override
|
---|
212 | * is removed, in the format `projects/{project}/keys/{key}`.
|
---|
213 | * @param GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideRequest $postBody
|
---|
214 | * @param array $optParams Optional parameters.
|
---|
215 | * @return GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideResponse
|
---|
216 | * @throws \Google\Service\Exception
|
---|
217 | */
|
---|
218 | public function removeIpOverride($name, GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideRequest $postBody, $optParams = [])
|
---|
219 | {
|
---|
220 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
221 | $params = array_merge($params, $optParams);
|
---|
222 | return $this->call('removeIpOverride', [$params], GoogleCloudRecaptchaenterpriseV1RemoveIpOverrideResponse::class);
|
---|
223 | }
|
---|
224 | /**
|
---|
225 | * Returns the secret key related to the specified public key. You must use the
|
---|
226 | * legacy secret key only in a 3rd party integration with legacy reCAPTCHA.
|
---|
227 | * (keys.retrieveLegacySecretKey)
|
---|
228 | *
|
---|
229 | * @param string $key Required. The public key name linked to the requested
|
---|
230 | * secret key in the format `projects/{project}/keys/{key}`.
|
---|
231 | * @param array $optParams Optional parameters.
|
---|
232 | * @return GoogleCloudRecaptchaenterpriseV1RetrieveLegacySecretKeyResponse
|
---|
233 | * @throws \Google\Service\Exception
|
---|
234 | */
|
---|
235 | public function retrieveLegacySecretKey($key, $optParams = [])
|
---|
236 | {
|
---|
237 | $params = ['key' => $key];
|
---|
238 | $params = array_merge($params, $optParams);
|
---|
239 | return $this->call('retrieveLegacySecretKey', [$params], GoogleCloudRecaptchaenterpriseV1RetrieveLegacySecretKeyResponse::class);
|
---|
240 | }
|
---|
241 | }
|
---|
242 |
|
---|
243 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
244 | class_alias(ProjectsKeys::class, 'Google_Service_RecaptchaEnterprise_Resource_ProjectsKeys');
|
---|