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\CreateServiceAccountRequest;
|
---|
21 | use Google\Service\Iam\DisableServiceAccountRequest;
|
---|
22 | use Google\Service\Iam\EnableServiceAccountRequest;
|
---|
23 | use Google\Service\Iam\IamEmpty;
|
---|
24 | use Google\Service\Iam\ListServiceAccountsResponse;
|
---|
25 | use Google\Service\Iam\PatchServiceAccountRequest;
|
---|
26 | use Google\Service\Iam\Policy;
|
---|
27 | use Google\Service\Iam\ServiceAccount;
|
---|
28 | use Google\Service\Iam\SetIamPolicyRequest;
|
---|
29 | use Google\Service\Iam\SignBlobRequest;
|
---|
30 | use Google\Service\Iam\SignBlobResponse;
|
---|
31 | use Google\Service\Iam\SignJwtRequest;
|
---|
32 | use Google\Service\Iam\SignJwtResponse;
|
---|
33 | use Google\Service\Iam\TestIamPermissionsRequest;
|
---|
34 | use Google\Service\Iam\TestIamPermissionsResponse;
|
---|
35 | use Google\Service\Iam\UndeleteServiceAccountRequest;
|
---|
36 | use Google\Service\Iam\UndeleteServiceAccountResponse;
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * The "serviceAccounts" collection of methods.
|
---|
40 | * Typical usage is:
|
---|
41 | * <code>
|
---|
42 | * $iamService = new Google\Service\Iam(...);
|
---|
43 | * $serviceAccounts = $iamService->projects_serviceAccounts;
|
---|
44 | * </code>
|
---|
45 | */
|
---|
46 | class ProjectsServiceAccounts extends \Google\Service\Resource
|
---|
47 | {
|
---|
48 | /**
|
---|
49 | * Creates a ServiceAccount. (serviceAccounts.create)
|
---|
50 | *
|
---|
51 | * @param string $name Required. The resource name of the project associated
|
---|
52 | * with the service accounts, such as `projects/my-project-123`.
|
---|
53 | * @param CreateServiceAccountRequest $postBody
|
---|
54 | * @param array $optParams Optional parameters.
|
---|
55 | * @return ServiceAccount
|
---|
56 | */
|
---|
57 | public function create($name, CreateServiceAccountRequest $postBody, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('create', [$params], ServiceAccount::class);
|
---|
62 | }
|
---|
63 | /**
|
---|
64 | * Deletes a ServiceAccount. **Warning:** After you delete a service account,
|
---|
65 | * you might not be able to undelete it. If you know that you need to re-enable
|
---|
66 | * the service account in the future, use DisableServiceAccount instead. If you
|
---|
67 | * delete a service account, IAM permanently removes the service account 30 days
|
---|
68 | * later. Google Cloud cannot recover the service account after it is
|
---|
69 | * permanently removed, even if you file a support request. To help avoid
|
---|
70 | * unplanned outages, we recommend that you disable the service account before
|
---|
71 | * you delete it. Use DisableServiceAccount to disable the service account, then
|
---|
72 | * wait at least 24 hours and watch for unintended consequences. If there are no
|
---|
73 | * unintended consequences, you can delete the service account.
|
---|
74 | * (serviceAccounts.delete)
|
---|
75 | *
|
---|
76 | * @param string $name Required. The resource name of the service account. Use
|
---|
77 | * one of the following formats: *
|
---|
78 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
79 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
80 | * can use the `-` wildcard character instead of the project ID: *
|
---|
81 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
82 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
83 | * wildcard character, because it can cause response messages to contain
|
---|
84 | * misleading error codes. For example, if you try to access the service account
|
---|
85 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
86 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
87 | * error.
|
---|
88 | * @param array $optParams Optional parameters.
|
---|
89 | * @return IamEmpty
|
---|
90 | */
|
---|
91 | public function delete($name, $optParams = [])
|
---|
92 | {
|
---|
93 | $params = ['name' => $name];
|
---|
94 | $params = array_merge($params, $optParams);
|
---|
95 | return $this->call('delete', [$params], IamEmpty::class);
|
---|
96 | }
|
---|
97 | /**
|
---|
98 | * Disables a ServiceAccount immediately. If an application uses the service
|
---|
99 | * account to authenticate, that application can no longer call Google APIs or
|
---|
100 | * access Google Cloud resources. Existing access tokens for the service account
|
---|
101 | * are rejected, and requests for new access tokens will fail. To re-enable the
|
---|
102 | * service account, use EnableServiceAccount. After you re-enable the service
|
---|
103 | * account, its existing access tokens will be accepted, and you can request new
|
---|
104 | * access tokens. To help avoid unplanned outages, we recommend that you disable
|
---|
105 | * the service account before you delete it. Use this method to disable the
|
---|
106 | * service account, then wait at least 24 hours and watch for unintended
|
---|
107 | * consequences. If there are no unintended consequences, you can delete the
|
---|
108 | * service account with DeleteServiceAccount. (serviceAccounts.disable)
|
---|
109 | *
|
---|
110 | * @param string $name The resource name of the service account. Use one of the
|
---|
111 | * following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}`
|
---|
112 | * * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
113 | * can use the `-` wildcard character instead of the project ID: *
|
---|
114 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
115 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
116 | * wildcard character, because it can cause response messages to contain
|
---|
117 | * misleading error codes. For example, if you try to access the service account
|
---|
118 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
119 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
120 | * error.
|
---|
121 | * @param DisableServiceAccountRequest $postBody
|
---|
122 | * @param array $optParams Optional parameters.
|
---|
123 | * @return IamEmpty
|
---|
124 | */
|
---|
125 | public function disable($name, DisableServiceAccountRequest $postBody, $optParams = [])
|
---|
126 | {
|
---|
127 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
128 | $params = array_merge($params, $optParams);
|
---|
129 | return $this->call('disable', [$params], IamEmpty::class);
|
---|
130 | }
|
---|
131 | /**
|
---|
132 | * Enables a ServiceAccount that was disabled by DisableServiceAccount. If the
|
---|
133 | * service account is already enabled, then this method has no effect. If the
|
---|
134 | * service account was disabled by other means—for example, if Google disabled
|
---|
135 | * the service account because it was compromised—you cannot use this method to
|
---|
136 | * enable the service account. (serviceAccounts.enable)
|
---|
137 | *
|
---|
138 | * @param string $name The resource name of the service account. Use one of the
|
---|
139 | * following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}`
|
---|
140 | * * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
141 | * can use the `-` wildcard character instead of the project ID: *
|
---|
142 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
143 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
144 | * wildcard character, because it can cause response messages to contain
|
---|
145 | * misleading error codes. For example, if you try to access the service account
|
---|
146 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
147 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
148 | * error.
|
---|
149 | * @param EnableServiceAccountRequest $postBody
|
---|
150 | * @param array $optParams Optional parameters.
|
---|
151 | * @return IamEmpty
|
---|
152 | */
|
---|
153 | public function enable($name, EnableServiceAccountRequest $postBody, $optParams = [])
|
---|
154 | {
|
---|
155 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
156 | $params = array_merge($params, $optParams);
|
---|
157 | return $this->call('enable', [$params], IamEmpty::class);
|
---|
158 | }
|
---|
159 | /**
|
---|
160 | * Gets a ServiceAccount. (serviceAccounts.get)
|
---|
161 | *
|
---|
162 | * @param string $name Required. The resource name of the service account. Use
|
---|
163 | * one of the following formats: *
|
---|
164 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
165 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
166 | * can use the `-` wildcard character instead of the project ID: *
|
---|
167 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
168 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
169 | * wildcard character, because it can cause response messages to contain
|
---|
170 | * misleading error codes. For example, if you try to access the service account
|
---|
171 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
172 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
173 | * error.
|
---|
174 | * @param array $optParams Optional parameters.
|
---|
175 | * @return ServiceAccount
|
---|
176 | */
|
---|
177 | public function get($name, $optParams = [])
|
---|
178 | {
|
---|
179 | $params = ['name' => $name];
|
---|
180 | $params = array_merge($params, $optParams);
|
---|
181 | return $this->call('get', [$params], ServiceAccount::class);
|
---|
182 | }
|
---|
183 | /**
|
---|
184 | * Gets the IAM policy that is attached to a ServiceAccount. This IAM policy
|
---|
185 | * specifies which principals have access to the service account. This method
|
---|
186 | * does not tell you whether the service account has been granted any roles on
|
---|
187 | * other resources. To check whether a service account has role grants on a
|
---|
188 | * resource, use the `getIamPolicy` method for that resource. For example, to
|
---|
189 | * view the role grants for a project, call the Resource Manager API's
|
---|
190 | * [`projects.getIamPolicy`](https://cloud.google.com/resource-
|
---|
191 | * manager/reference/rest/v1/projects/getIamPolicy) method.
|
---|
192 | * (serviceAccounts.getIamPolicy)
|
---|
193 | *
|
---|
194 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
195 | * requested. See [Resource
|
---|
196 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
197 | * appropriate value for this field.
|
---|
198 | * @param array $optParams Optional parameters.
|
---|
199 | *
|
---|
200 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
201 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
202 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
203 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
204 | * conditional role bindings may specify any valid value or leave the field
|
---|
205 | * unset. The policy in the response might use the policy version that you
|
---|
206 | * specified, or it might use a lower policy version. For example, if you
|
---|
207 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
208 | * response uses version 1. To learn which resources support conditions in their
|
---|
209 | * IAM policies, see the [IAM
|
---|
210 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
211 | * policies).
|
---|
212 | * @return Policy
|
---|
213 | */
|
---|
214 | public function getIamPolicy($resource, $optParams = [])
|
---|
215 | {
|
---|
216 | $params = ['resource' => $resource];
|
---|
217 | $params = array_merge($params, $optParams);
|
---|
218 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
219 | }
|
---|
220 | /**
|
---|
221 | * Lists every ServiceAccount that belongs to a specific project.
|
---|
222 | * (serviceAccounts.listProjectsServiceAccounts)
|
---|
223 | *
|
---|
224 | * @param string $name Required. The resource name of the project associated
|
---|
225 | * with the service accounts, such as `projects/my-project-123`.
|
---|
226 | * @param array $optParams Optional parameters.
|
---|
227 | *
|
---|
228 | * @opt_param int pageSize Optional limit on the number of service accounts to
|
---|
229 | * include in the response. Further accounts can subsequently be obtained by
|
---|
230 | * including the ListServiceAccountsResponse.next_page_token in a subsequent
|
---|
231 | * request. The default is 20, and the maximum is 100.
|
---|
232 | * @opt_param string pageToken Optional pagination token returned in an earlier
|
---|
233 | * ListServiceAccountsResponse.next_page_token.
|
---|
234 | * @return ListServiceAccountsResponse
|
---|
235 | */
|
---|
236 | public function listProjectsServiceAccounts($name, $optParams = [])
|
---|
237 | {
|
---|
238 | $params = ['name' => $name];
|
---|
239 | $params = array_merge($params, $optParams);
|
---|
240 | return $this->call('list', [$params], ListServiceAccountsResponse::class);
|
---|
241 | }
|
---|
242 | /**
|
---|
243 | * Patches a ServiceAccount. (serviceAccounts.patch)
|
---|
244 | *
|
---|
245 | * @param string $name The resource name of the service account. Use one of the
|
---|
246 | * following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}`
|
---|
247 | * * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
248 | * can use the `-` wildcard character instead of the project ID: *
|
---|
249 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
250 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
251 | * wildcard character, because it can cause response messages to contain
|
---|
252 | * misleading error codes. For example, if you try to access the service account
|
---|
253 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
254 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
255 | * error.
|
---|
256 | * @param PatchServiceAccountRequest $postBody
|
---|
257 | * @param array $optParams Optional parameters.
|
---|
258 | * @return ServiceAccount
|
---|
259 | */
|
---|
260 | public function patch($name, PatchServiceAccountRequest $postBody, $optParams = [])
|
---|
261 | {
|
---|
262 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
263 | $params = array_merge($params, $optParams);
|
---|
264 | return $this->call('patch', [$params], ServiceAccount::class);
|
---|
265 | }
|
---|
266 | /**
|
---|
267 | * Sets the IAM policy that is attached to a ServiceAccount. Use this method to
|
---|
268 | * grant or revoke access to the service account. For example, you could grant a
|
---|
269 | * principal the ability to impersonate the service account. This method does
|
---|
270 | * not enable the service account to access other resources. To grant roles to a
|
---|
271 | * service account on a resource, follow these steps: 1. Call the resource's
|
---|
272 | * `getIamPolicy` method to get its current IAM policy. 2. Edit the policy so
|
---|
273 | * that it binds the service account to an IAM role for the resource. 3. Call
|
---|
274 | * the resource's `setIamPolicy` method to update its IAM policy. For detailed
|
---|
275 | * instructions, see [Manage access to project, folders, and
|
---|
276 | * organizations](https://cloud.google.com/iam/help/service-accounts/granting-
|
---|
277 | * access-to-service-accounts) or [Manage access to other
|
---|
278 | * resources](https://cloud.google.com/iam/help/access/manage-other-resources).
|
---|
279 | * (serviceAccounts.setIamPolicy)
|
---|
280 | *
|
---|
281 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
282 | * specified. See [Resource
|
---|
283 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
284 | * appropriate value for this field.
|
---|
285 | * @param SetIamPolicyRequest $postBody
|
---|
286 | * @param array $optParams Optional parameters.
|
---|
287 | * @return Policy
|
---|
288 | */
|
---|
289 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
290 | {
|
---|
291 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
292 | $params = array_merge($params, $optParams);
|
---|
293 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
294 | }
|
---|
295 | /**
|
---|
296 | * **Note:** This method is deprecated. Use the
|
---|
297 | * [`signBlob`](https://cloud.google.com/iam/help/rest-
|
---|
298 | * credentials/v1/projects.serviceAccounts/signBlob) method in the IAM Service
|
---|
299 | * Account Credentials API instead. If you currently use this method, see the
|
---|
300 | * [migration guide](https://cloud.google.com/iam/help/credentials/migrate-api)
|
---|
301 | * for instructions. Signs a blob using the system-managed private key for a
|
---|
302 | * ServiceAccount. (serviceAccounts.signBlob)
|
---|
303 | *
|
---|
304 | * @param string $name Required. Deprecated. [Migrate to Service Account
|
---|
305 | * Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api).
|
---|
306 | * The resource name of the service account. Use one of the following formats: *
|
---|
307 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
308 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
309 | * can use the `-` wildcard character instead of the project ID: *
|
---|
310 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
311 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
312 | * wildcard character, because it can cause response messages to contain
|
---|
313 | * misleading error codes. For example, if you try to access the service account
|
---|
314 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
315 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
316 | * error.
|
---|
317 | * @param SignBlobRequest $postBody
|
---|
318 | * @param array $optParams Optional parameters.
|
---|
319 | * @return SignBlobResponse
|
---|
320 | */
|
---|
321 | public function signBlob($name, SignBlobRequest $postBody, $optParams = [])
|
---|
322 | {
|
---|
323 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
324 | $params = array_merge($params, $optParams);
|
---|
325 | return $this->call('signBlob', [$params], SignBlobResponse::class);
|
---|
326 | }
|
---|
327 | /**
|
---|
328 | * **Note:** This method is deprecated. Use the
|
---|
329 | * [`signJwt`](https://cloud.google.com/iam/help/rest-
|
---|
330 | * credentials/v1/projects.serviceAccounts/signJwt) method in the IAM Service
|
---|
331 | * Account Credentials API instead. If you currently use this method, see the
|
---|
332 | * [migration guide](https://cloud.google.com/iam/help/credentials/migrate-api)
|
---|
333 | * for instructions. Signs a JSON Web Token (JWT) using the system-managed
|
---|
334 | * private key for a ServiceAccount. (serviceAccounts.signJwt)
|
---|
335 | *
|
---|
336 | * @param string $name Required. Deprecated. [Migrate to Service Account
|
---|
337 | * Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api).
|
---|
338 | * The resource name of the service account. Use one of the following formats: *
|
---|
339 | * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
340 | * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
341 | * can use the `-` wildcard character instead of the project ID: *
|
---|
342 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
343 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
344 | * wildcard character, because it can cause response messages to contain
|
---|
345 | * misleading error codes. For example, if you try to access the service account
|
---|
346 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
347 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
348 | * error.
|
---|
349 | * @param SignJwtRequest $postBody
|
---|
350 | * @param array $optParams Optional parameters.
|
---|
351 | * @return SignJwtResponse
|
---|
352 | */
|
---|
353 | public function signJwt($name, SignJwtRequest $postBody, $optParams = [])
|
---|
354 | {
|
---|
355 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
356 | $params = array_merge($params, $optParams);
|
---|
357 | return $this->call('signJwt', [$params], SignJwtResponse::class);
|
---|
358 | }
|
---|
359 | /**
|
---|
360 | * Tests whether the caller has the specified permissions on a ServiceAccount.
|
---|
361 | * (serviceAccounts.testIamPermissions)
|
---|
362 | *
|
---|
363 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
364 | * being requested. See [Resource
|
---|
365 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
366 | * appropriate value for this field.
|
---|
367 | * @param TestIamPermissionsRequest $postBody
|
---|
368 | * @param array $optParams Optional parameters.
|
---|
369 | * @return TestIamPermissionsResponse
|
---|
370 | */
|
---|
371 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
372 | {
|
---|
373 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
374 | $params = array_merge($params, $optParams);
|
---|
375 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
376 | }
|
---|
377 | /**
|
---|
378 | * Restores a deleted ServiceAccount. **Important:** It is not always possible
|
---|
379 | * to restore a deleted service account. Use this method only as a last resort.
|
---|
380 | * After you delete a service account, IAM permanently removes the service
|
---|
381 | * account 30 days later. There is no way to restore a deleted service account
|
---|
382 | * that has been permanently removed. (serviceAccounts.undelete)
|
---|
383 | *
|
---|
384 | * @param string $name The resource name of the service account. Use one of the
|
---|
385 | * following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}`
|
---|
386 | * * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
387 | * can use the `-` wildcard character instead of the project ID: *
|
---|
388 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
389 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
390 | * wildcard character, because it can cause response messages to contain
|
---|
391 | * misleading error codes. For example, if you try to access the service account
|
---|
392 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
393 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
394 | * error.
|
---|
395 | * @param UndeleteServiceAccountRequest $postBody
|
---|
396 | * @param array $optParams Optional parameters.
|
---|
397 | * @return UndeleteServiceAccountResponse
|
---|
398 | */
|
---|
399 | public function undelete($name, UndeleteServiceAccountRequest $postBody, $optParams = [])
|
---|
400 | {
|
---|
401 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
402 | $params = array_merge($params, $optParams);
|
---|
403 | return $this->call('undelete', [$params], UndeleteServiceAccountResponse::class);
|
---|
404 | }
|
---|
405 | /**
|
---|
406 | * **Note:** We are in the process of deprecating this method. Use
|
---|
407 | * PatchServiceAccount instead. Updates a ServiceAccount. You can update only
|
---|
408 | * the `display_name` field. (serviceAccounts.update)
|
---|
409 | *
|
---|
410 | * @param string $name The resource name of the service account. Use one of the
|
---|
411 | * following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}`
|
---|
412 | * * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you
|
---|
413 | * can use the `-` wildcard character instead of the project ID: *
|
---|
414 | * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` *
|
---|
415 | * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-`
|
---|
416 | * wildcard character, because it can cause response messages to contain
|
---|
417 | * misleading error codes. For example, if you try to access the service account
|
---|
418 | * `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
|
---|
419 | * response contains an HTTP `403 Forbidden` error instead of a `404 Not Found`
|
---|
420 | * error.
|
---|
421 | * @param ServiceAccount $postBody
|
---|
422 | * @param array $optParams Optional parameters.
|
---|
423 | * @return ServiceAccount
|
---|
424 | */
|
---|
425 | public function update($name, ServiceAccount $postBody, $optParams = [])
|
---|
426 | {
|
---|
427 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
428 | $params = array_merge($params, $optParams);
|
---|
429 | return $this->call('update', [$params], ServiceAccount::class);
|
---|
430 | }
|
---|
431 | }
|
---|
432 |
|
---|
433 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
434 | class_alias(ProjectsServiceAccounts::class, 'Google_Service_Iam_Resource_ProjectsServiceAccounts');
|
---|