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\Iam\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Iam\CreateServiceAccountKeyRequest;
|
---|
21 | use Google\Service\Iam\DisableServiceAccountKeyRequest;
|
---|
22 | use Google\Service\Iam\EnableServiceAccountKeyRequest;
|
---|
23 | use Google\Service\Iam\IamEmpty;
|
---|
24 | use Google\Service\Iam\ListServiceAccountKeysResponse;
|
---|
25 | use Google\Service\Iam\ServiceAccountKey;
|
---|
26 | use Google\Service\Iam\UploadServiceAccountKeyRequest;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "keys" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $iamService = new Google\Service\Iam(...);
|
---|
33 | * $keys = $iamService->projects_serviceAccounts_keys;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class ProjectsServiceAccountsKeys extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Creates a ServiceAccountKey. (keys.create)
|
---|
40 | *
|
---|
41 | * @param string $name Required. The resource name of the service account. Use
|
---|
42 | * one of the following formats: *
|
---|
43 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
44 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
45 | * can use the `-` wildcard character instead of the project ID: *
|
---|
46 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
47 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
48 | * wildcard character, because it can cause response messages to contain
|
---|
49 | * misleading error codes. For example, if you try to access the service account
|
---|
50 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
51 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
52 | * error.
|
---|
53 | * @param CreateServiceAccountKeyRequest $postBody
|
---|
54 | * @param array $optParams Optional parameters.
|
---|
55 | * @return ServiceAccountKey
|
---|
56 | */
|
---|
57 | public function create($name, CreateServiceAccountKeyRequest $postBody, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('create', [$params], ServiceAccountKey::class);
|
---|
62 | }
|
---|
63 | /**
|
---|
64 | * Deletes a ServiceAccountKey. Deleting a service account key does not revoke
|
---|
65 | * short-lived credentials that have been issued based on the service account
|
---|
66 | * key. (keys.delete)
|
---|
67 | *
|
---|
68 | * @param string $name Required. The resource name of the service account key.
|
---|
69 | * Use one of the following formats: *
|
---|
70 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` *
|
---|
71 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an
|
---|
72 | * alternative, you can use the `-` wildcard character instead of the project
|
---|
73 | * ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` *
|
---|
74 | * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid
|
---|
75 | * using the `-` wildcard character, because it can cause response messages to
|
---|
76 | * contain misleading error codes. For example, if you try to access the service
|
---|
77 | * account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`,
|
---|
78 | * which does not exist, the response contains an HTTP `403 Forbidden` error
|
---|
79 | * instead of a `404 Not Found` error.
|
---|
80 | * @param array $optParams Optional parameters.
|
---|
81 | * @return IamEmpty
|
---|
82 | */
|
---|
83 | public function delete($name, $optParams = [])
|
---|
84 | {
|
---|
85 | $params = ['name' => $name];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('delete', [$params], IamEmpty::class);
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Disable a ServiceAccountKey. A disabled service account key can be re-enabled
|
---|
91 | * with EnableServiceAccountKey. (keys.disable)
|
---|
92 | *
|
---|
93 | * @param string $name Required. The resource name of the service account key.
|
---|
94 | * Use one of the following formats: *
|
---|
95 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` *
|
---|
96 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an
|
---|
97 | * alternative, you can use the `-` wildcard character instead of the project
|
---|
98 | * ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` *
|
---|
99 | * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid
|
---|
100 | * using the `-` wildcard character, because it can cause response messages to
|
---|
101 | * contain misleading error codes. For example, if you try to access the service
|
---|
102 | * account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`,
|
---|
103 | * which does not exist, the response contains an HTTP `403 Forbidden` error
|
---|
104 | * instead of a `404 Not Found` error.
|
---|
105 | * @param DisableServiceAccountKeyRequest $postBody
|
---|
106 | * @param array $optParams Optional parameters.
|
---|
107 | * @return IamEmpty
|
---|
108 | */
|
---|
109 | public function disable($name, DisableServiceAccountKeyRequest $postBody, $optParams = [])
|
---|
110 | {
|
---|
111 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
112 | $params = array_merge($params, $optParams);
|
---|
113 | return $this->call('disable', [$params], IamEmpty::class);
|
---|
114 | }
|
---|
115 | /**
|
---|
116 | * Enable a ServiceAccountKey. (keys.enable)
|
---|
117 | *
|
---|
118 | * @param string $name Required. The resource name of the service account key.
|
---|
119 | * Use one of the following formats: *
|
---|
120 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` *
|
---|
121 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an
|
---|
122 | * alternative, you can use the `-` wildcard character instead of the project
|
---|
123 | * ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` *
|
---|
124 | * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid
|
---|
125 | * using the `-` wildcard character, because it can cause response messages to
|
---|
126 | * contain misleading error codes. For example, if you try to access the service
|
---|
127 | * account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`,
|
---|
128 | * which does not exist, the response contains an HTTP `403 Forbidden` error
|
---|
129 | * instead of a `404 Not Found` error.
|
---|
130 | * @param EnableServiceAccountKeyRequest $postBody
|
---|
131 | * @param array $optParams Optional parameters.
|
---|
132 | * @return IamEmpty
|
---|
133 | */
|
---|
134 | public function enable($name, EnableServiceAccountKeyRequest $postBody, $optParams = [])
|
---|
135 | {
|
---|
136 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
137 | $params = array_merge($params, $optParams);
|
---|
138 | return $this->call('enable', [$params], IamEmpty::class);
|
---|
139 | }
|
---|
140 | /**
|
---|
141 | * Gets a ServiceAccountKey. (keys.get)
|
---|
142 | *
|
---|
143 | * @param string $name Required. The resource name of the service account key.
|
---|
144 | * Use one of the following formats: *
|
---|
145 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` *
|
---|
146 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an
|
---|
147 | * alternative, you can use the `-` wildcard character instead of the project
|
---|
148 | * ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` *
|
---|
149 | * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid
|
---|
150 | * using the `-` wildcard character, because it can cause response messages to
|
---|
151 | * contain misleading error codes. For example, if you try to access the service
|
---|
152 | * account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`,
|
---|
153 | * which does not exist, the response contains an HTTP `403 Forbidden` error
|
---|
154 | * instead of a `404 Not Found` error.
|
---|
155 | * @param array $optParams Optional parameters.
|
---|
156 | *
|
---|
157 | * @opt_param string publicKeyType Optional. The output format of the public
|
---|
158 | * key. The default is `TYPE_NONE`, which means that the public key is not
|
---|
159 | * returned.
|
---|
160 | * @return ServiceAccountKey
|
---|
161 | */
|
---|
162 | public function get($name, $optParams = [])
|
---|
163 | {
|
---|
164 | $params = ['name' => $name];
|
---|
165 | $params = array_merge($params, $optParams);
|
---|
166 | return $this->call('get', [$params], ServiceAccountKey::class);
|
---|
167 | }
|
---|
168 | /**
|
---|
169 | * Lists every ServiceAccountKey for a service account.
|
---|
170 | * (keys.listProjectsServiceAccountsKeys)
|
---|
171 | *
|
---|
172 | * @param string $name Required. The resource name of the service account. Use
|
---|
173 | * one of the following formats: *
|
---|
174 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
175 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
176 | * can use the `-` wildcard character instead of the project ID: *
|
---|
177 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
178 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
179 | * wildcard character, because it can cause response messages to contain
|
---|
180 | * misleading error codes. For example, if you try to access the service account
|
---|
181 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
182 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
183 | * error.
|
---|
184 | * @param array $optParams Optional parameters.
|
---|
185 | *
|
---|
186 | * @opt_param string keyTypes Filters the types of keys the user wants to
|
---|
187 | * include in the list response. Duplicate key types are not allowed. If no key
|
---|
188 | * type is provided, all keys are returned.
|
---|
189 | * @return ListServiceAccountKeysResponse
|
---|
190 | */
|
---|
191 | public function listProjectsServiceAccountsKeys($name, $optParams = [])
|
---|
192 | {
|
---|
193 | $params = ['name' => $name];
|
---|
194 | $params = array_merge($params, $optParams);
|
---|
195 | return $this->call('list', [$params], ListServiceAccountKeysResponse::class);
|
---|
196 | }
|
---|
197 | /**
|
---|
198 | * Uploads the public key portion of a key pair that you manage, and associates
|
---|
199 | * the public key with a ServiceAccount. After you upload the public key, you
|
---|
200 | * can use the private key from the key pair as a service account key.
|
---|
201 | * (keys.upload)
|
---|
202 | *
|
---|
203 | * @param string $name The resource name of the service account key. Use one of
|
---|
204 | * the following formats: *
|
---|
205 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
206 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
207 | * can use the `-` wildcard character instead of the project ID: *
|
---|
208 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
209 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
210 | * wildcard character, because it can cause response messages to contain
|
---|
211 | * misleading error codes. For example, if you try to access the service account
|
---|
212 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
213 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
214 | * error.
|
---|
215 | * @param UploadServiceAccountKeyRequest $postBody
|
---|
216 | * @param array $optParams Optional parameters.
|
---|
217 | * @return ServiceAccountKey
|
---|
218 | */
|
---|
219 | public function upload($name, UploadServiceAccountKeyRequest $postBody, $optParams = [])
|
---|
220 | {
|
---|
221 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
222 | $params = array_merge($params, $optParams);
|
---|
223 | return $this->call('upload', [$params], ServiceAccountKey::class);
|
---|
224 | }
|
---|
225 | }
|
---|
226 |
|
---|
227 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
228 | class_alias(ProjectsServiceAccountsKeys::class, 'Google_Service_Iam_Resource_ProjectsServiceAccountsKeys');
|
---|