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\ApiKeysService\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\ApiKeysService\Operation;
|
---|
21 | use Google\Service\ApiKeysService\V2GetKeyStringResponse;
|
---|
22 | use Google\Service\ApiKeysService\V2Key;
|
---|
23 | use Google\Service\ApiKeysService\V2ListKeysResponse;
|
---|
24 | use Google\Service\ApiKeysService\V2UndeleteKeyRequest;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * The "keys" collection of methods.
|
---|
28 | * Typical usage is:
|
---|
29 | * <code>
|
---|
30 | * $apikeysService = new Google\Service\ApiKeysService(...);
|
---|
31 | * $keys = $apikeysService->projects_locations_keys;
|
---|
32 | * </code>
|
---|
33 | */
|
---|
34 | class ProjectsLocationsKeys extends \Google\Service\Resource
|
---|
35 | {
|
---|
36 | /**
|
---|
37 | * Creates a new API key. NOTE: Key is a global resource; hence the only
|
---|
38 | * supported value for location is `global`. (keys.create)
|
---|
39 | *
|
---|
40 | * @param string $parent Required. The project in which the API key is created.
|
---|
41 | * @param V2Key $postBody
|
---|
42 | * @param array $optParams Optional parameters.
|
---|
43 | *
|
---|
44 | * @opt_param string keyId User specified key id (optional). If specified, it
|
---|
45 | * will become the final component of the key resource name. The id must be
|
---|
46 | * unique within the project, must conform with RFC-1034, is restricted to
|
---|
47 | * lower-cased letters, and has a maximum length of 63 characters. In another
|
---|
48 | * word, the id must match the regular expression:
|
---|
49 | * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. The id must NOT be a UUID-like string.
|
---|
50 | * @return Operation
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function create($parent, V2Key $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('create', [$params], Operation::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Deletes an API key. Deleted key can be retrieved within 30 days of deletion.
|
---|
61 | * Afterward, key will be purged from the project. NOTE: Key is a global
|
---|
62 | * resource; hence the only supported value for location is `global`.
|
---|
63 | * (keys.delete)
|
---|
64 | *
|
---|
65 | * @param string $name Required. The resource name of the API key to be deleted.
|
---|
66 | * @param array $optParams Optional parameters.
|
---|
67 | *
|
---|
68 | * @opt_param string etag Optional. The etag known to the client for the
|
---|
69 | * expected state of the key. This is to be used for optimistic concurrency.
|
---|
70 | * @return Operation
|
---|
71 | * @throws \Google\Service\Exception
|
---|
72 | */
|
---|
73 | public function delete($name, $optParams = [])
|
---|
74 | {
|
---|
75 | $params = ['name' => $name];
|
---|
76 | $params = array_merge($params, $optParams);
|
---|
77 | return $this->call('delete', [$params], Operation::class);
|
---|
78 | }
|
---|
79 | /**
|
---|
80 | * Gets the metadata for an API key. The key string of the API key isn't
|
---|
81 | * included in the response. NOTE: Key is a global resource; hence the only
|
---|
82 | * supported value for location is `global`. (keys.get)
|
---|
83 | *
|
---|
84 | * @param string $name Required. The resource name of the API key to get.
|
---|
85 | * @param array $optParams Optional parameters.
|
---|
86 | * @return V2Key
|
---|
87 | * @throws \Google\Service\Exception
|
---|
88 | */
|
---|
89 | public function get($name, $optParams = [])
|
---|
90 | {
|
---|
91 | $params = ['name' => $name];
|
---|
92 | $params = array_merge($params, $optParams);
|
---|
93 | return $this->call('get', [$params], V2Key::class);
|
---|
94 | }
|
---|
95 | /**
|
---|
96 | * Get the key string for an API key. NOTE: Key is a global resource; hence the
|
---|
97 | * only supported value for location is `global`. (keys.getKeyString)
|
---|
98 | *
|
---|
99 | * @param string $name Required. The resource name of the API key to be
|
---|
100 | * retrieved.
|
---|
101 | * @param array $optParams Optional parameters.
|
---|
102 | * @return V2GetKeyStringResponse
|
---|
103 | * @throws \Google\Service\Exception
|
---|
104 | */
|
---|
105 | public function getKeyString($name, $optParams = [])
|
---|
106 | {
|
---|
107 | $params = ['name' => $name];
|
---|
108 | $params = array_merge($params, $optParams);
|
---|
109 | return $this->call('getKeyString', [$params], V2GetKeyStringResponse::class);
|
---|
110 | }
|
---|
111 | /**
|
---|
112 | * Lists the API keys owned by a project. The key string of the API key isn't
|
---|
113 | * included in the response. NOTE: Key is a global resource; hence the only
|
---|
114 | * supported value for location is `global`. (keys.listProjectsLocationsKeys)
|
---|
115 | *
|
---|
116 | * @param string $parent Required. Lists all API keys associated with this
|
---|
117 | * project.
|
---|
118 | * @param array $optParams Optional parameters.
|
---|
119 | *
|
---|
120 | * @opt_param int pageSize Optional. Specifies the maximum number of results to
|
---|
121 | * be returned at a time.
|
---|
122 | * @opt_param string pageToken Optional. Requests a specific page of results.
|
---|
123 | * @opt_param bool showDeleted Optional. Indicate that keys deleted in the past
|
---|
124 | * 30 days should also be returned.
|
---|
125 | * @return V2ListKeysResponse
|
---|
126 | * @throws \Google\Service\Exception
|
---|
127 | */
|
---|
128 | public function listProjectsLocationsKeys($parent, $optParams = [])
|
---|
129 | {
|
---|
130 | $params = ['parent' => $parent];
|
---|
131 | $params = array_merge($params, $optParams);
|
---|
132 | return $this->call('list', [$params], V2ListKeysResponse::class);
|
---|
133 | }
|
---|
134 | /**
|
---|
135 | * Patches the modifiable fields of an API key. The key string of the API key
|
---|
136 | * isn't included in the response. NOTE: Key is a global resource; hence the
|
---|
137 | * only supported value for location is `global`. (keys.patch)
|
---|
138 | *
|
---|
139 | * @param string $name Output only. The resource name of the key. The `name` has
|
---|
140 | * the form: `projects//locations/global/keys/`. For example: `projects/12345686
|
---|
141 | * 7718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` NOTE: Key is
|
---|
142 | * a global resource; hence the only supported value for location is `global`.
|
---|
143 | * @param V2Key $postBody
|
---|
144 | * @param array $optParams Optional parameters.
|
---|
145 | *
|
---|
146 | * @opt_param string updateMask The field mask specifies which fields to be
|
---|
147 | * updated as part of this request. All other fields are ignored. Mutable fields
|
---|
148 | * are: `display_name`, `restrictions`, and `annotations`. If an update mask is
|
---|
149 | * not provided, the service treats it as an implied mask equivalent to all
|
---|
150 | * allowed fields that are set on the wire. If the field mask has a special
|
---|
151 | * value "*", the service treats it equivalent to replace all allowed mutable
|
---|
152 | * fields.
|
---|
153 | * @return Operation
|
---|
154 | * @throws \Google\Service\Exception
|
---|
155 | */
|
---|
156 | public function patch($name, V2Key $postBody, $optParams = [])
|
---|
157 | {
|
---|
158 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
159 | $params = array_merge($params, $optParams);
|
---|
160 | return $this->call('patch', [$params], Operation::class);
|
---|
161 | }
|
---|
162 | /**
|
---|
163 | * Undeletes an API key which was deleted within 30 days. NOTE: Key is a global
|
---|
164 | * resource; hence the only supported value for location is `global`.
|
---|
165 | * (keys.undelete)
|
---|
166 | *
|
---|
167 | * @param string $name Required. The resource name of the API key to be
|
---|
168 | * undeleted.
|
---|
169 | * @param V2UndeleteKeyRequest $postBody
|
---|
170 | * @param array $optParams Optional parameters.
|
---|
171 | * @return Operation
|
---|
172 | * @throws \Google\Service\Exception
|
---|
173 | */
|
---|
174 | public function undelete($name, V2UndeleteKeyRequest $postBody, $optParams = [])
|
---|
175 | {
|
---|
176 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
177 | $params = array_merge($params, $optParams);
|
---|
178 | return $this->call('undelete', [$params], Operation::class);
|
---|
179 | }
|
---|
180 | }
|
---|
181 |
|
---|
182 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
183 | class_alias(ProjectsLocationsKeys::class, 'Google_Service_ApiKeysService_Resource_ProjectsLocationsKeys');
|
---|