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\IAMCredentials\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\IAMCredentials\GenerateAccessTokenRequest;
|
---|
21 | use Google\Service\IAMCredentials\GenerateAccessTokenResponse;
|
---|
22 | use Google\Service\IAMCredentials\GenerateIdTokenRequest;
|
---|
23 | use Google\Service\IAMCredentials\GenerateIdTokenResponse;
|
---|
24 | use Google\Service\IAMCredentials\ServiceAccountAllowedLocations;
|
---|
25 | use Google\Service\IAMCredentials\SignBlobRequest;
|
---|
26 | use Google\Service\IAMCredentials\SignBlobResponse;
|
---|
27 | use Google\Service\IAMCredentials\SignJwtRequest;
|
---|
28 | use Google\Service\IAMCredentials\SignJwtResponse;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The "serviceAccounts" collection of methods.
|
---|
32 | * Typical usage is:
|
---|
33 | * <code>
|
---|
34 | * $iamcredentialsService = new Google\Service\IAMCredentials(...);
|
---|
35 | * $serviceAccounts = $iamcredentialsService->projects_serviceAccounts;
|
---|
36 | * </code>
|
---|
37 | */
|
---|
38 | class ProjectsServiceAccounts extends \Google\Service\Resource
|
---|
39 | {
|
---|
40 | /**
|
---|
41 | * Generates an OAuth 2.0 access token for a service account.
|
---|
42 | * (serviceAccounts.generateAccessToken)
|
---|
43 | *
|
---|
44 | * @param string $name Required. The resource name of the service account for
|
---|
45 | * which the credentials are requested, in the following format:
|
---|
46 | * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
|
---|
47 | * character is required; replacing it with a project ID is invalid.
|
---|
48 | * @param GenerateAccessTokenRequest $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return GenerateAccessTokenResponse
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function generateAccessToken($name, GenerateAccessTokenRequest $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('generateAccessToken', [$params], GenerateAccessTokenResponse::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Generates an OpenID Connect ID token for a service account.
|
---|
61 | * (serviceAccounts.generateIdToken)
|
---|
62 | *
|
---|
63 | * @param string $name Required. The resource name of the service account for
|
---|
64 | * which the credentials are requested, in the following format:
|
---|
65 | * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
|
---|
66 | * character is required; replacing it with a project ID is invalid.
|
---|
67 | * @param GenerateIdTokenRequest $postBody
|
---|
68 | * @param array $optParams Optional parameters.
|
---|
69 | * @return GenerateIdTokenResponse
|
---|
70 | * @throws \Google\Service\Exception
|
---|
71 | */
|
---|
72 | public function generateIdToken($name, GenerateIdTokenRequest $postBody, $optParams = [])
|
---|
73 | {
|
---|
74 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
75 | $params = array_merge($params, $optParams);
|
---|
76 | return $this->call('generateIdToken', [$params], GenerateIdTokenResponse::class);
|
---|
77 | }
|
---|
78 | /**
|
---|
79 | * Returns the trust boundary info for a given service account.
|
---|
80 | * (serviceAccounts.getAllowedLocations)
|
---|
81 | *
|
---|
82 | * @param string $name Required. Resource name of service account.
|
---|
83 | * @param array $optParams Optional parameters.
|
---|
84 | * @return ServiceAccountAllowedLocations
|
---|
85 | * @throws \Google\Service\Exception
|
---|
86 | */
|
---|
87 | public function getAllowedLocations($name, $optParams = [])
|
---|
88 | {
|
---|
89 | $params = ['name' => $name];
|
---|
90 | $params = array_merge($params, $optParams);
|
---|
91 | return $this->call('getAllowedLocations', [$params], ServiceAccountAllowedLocations::class);
|
---|
92 | }
|
---|
93 | /**
|
---|
94 | * Signs a blob using a service account's system-managed private key.
|
---|
95 | * (serviceAccounts.signBlob)
|
---|
96 | *
|
---|
97 | * @param string $name Required. The resource name of the service account for
|
---|
98 | * which the credentials are requested, in the following format:
|
---|
99 | * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
|
---|
100 | * character is required; replacing it with a project ID is invalid.
|
---|
101 | * @param SignBlobRequest $postBody
|
---|
102 | * @param array $optParams Optional parameters.
|
---|
103 | * @return SignBlobResponse
|
---|
104 | * @throws \Google\Service\Exception
|
---|
105 | */
|
---|
106 | public function signBlob($name, SignBlobRequest $postBody, $optParams = [])
|
---|
107 | {
|
---|
108 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
109 | $params = array_merge($params, $optParams);
|
---|
110 | return $this->call('signBlob', [$params], SignBlobResponse::class);
|
---|
111 | }
|
---|
112 | /**
|
---|
113 | * Signs a JWT using a service account's system-managed private key.
|
---|
114 | * (serviceAccounts.signJwt)
|
---|
115 | *
|
---|
116 | * @param string $name Required. The resource name of the service account for
|
---|
117 | * which the credentials are requested, in the following format:
|
---|
118 | * `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
|
---|
119 | * character is required; replacing it with a project ID is invalid.
|
---|
120 | * @param SignJwtRequest $postBody
|
---|
121 | * @param array $optParams Optional parameters.
|
---|
122 | * @return SignJwtResponse
|
---|
123 | * @throws \Google\Service\Exception
|
---|
124 | */
|
---|
125 | public function signJwt($name, SignJwtRequest $postBody, $optParams = [])
|
---|
126 | {
|
---|
127 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
128 | $params = array_merge($params, $optParams);
|
---|
129 | return $this->call('signJwt', [$params], SignJwtResponse::class);
|
---|
130 | }
|
---|
131 | }
|
---|
132 |
|
---|
133 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
134 | class_alias(ProjectsServiceAccounts::class, 'Google_Service_IAMCredentials_Resource_ProjectsServiceAccounts');
|
---|