-
Notifications
You must be signed in to change notification settings - Fork 311
/
ProjectsServiceAccounts.php
118 lines (114 loc) · 4.95 KB
/
ProjectsServiceAccounts.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\IAMCredentials\Resource;
use Google\Service\IAMCredentials\GenerateAccessTokenRequest;
use Google\Service\IAMCredentials\GenerateAccessTokenResponse;
use Google\Service\IAMCredentials\GenerateIdTokenRequest;
use Google\Service\IAMCredentials\GenerateIdTokenResponse;
use Google\Service\IAMCredentials\SignBlobRequest;
use Google\Service\IAMCredentials\SignBlobResponse;
use Google\Service\IAMCredentials\SignJwtRequest;
use Google\Service\IAMCredentials\SignJwtResponse;
/**
* The "serviceAccounts" collection of methods.
* Typical usage is:
* <code>
* $iamcredentialsService = new Google\Service\IAMCredentials(...);
* $serviceAccounts = $iamcredentialsService->projects_serviceAccounts;
* </code>
*/
class ProjectsServiceAccounts extends \Google\Service\Resource
{
/**
* Generates an OAuth 2.0 access token for a service account.
* (serviceAccounts.generateAccessToken)
*
* @param string $name Required. The resource name of the service account for
* which the credentials are requested, in the following format:
* `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
* character is required; replacing it with a project ID is invalid.
* @param GenerateAccessTokenRequest $postBody
* @param array $optParams Optional parameters.
* @return GenerateAccessTokenResponse
* @throws \Google\Service\Exception
*/
public function generateAccessToken($name, GenerateAccessTokenRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('generateAccessToken', [$params], GenerateAccessTokenResponse::class);
}
/**
* Generates an OpenID Connect ID token for a service account.
* (serviceAccounts.generateIdToken)
*
* @param string $name Required. The resource name of the service account for
* which the credentials are requested, in the following format:
* `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
* character is required; replacing it with a project ID is invalid.
* @param GenerateIdTokenRequest $postBody
* @param array $optParams Optional parameters.
* @return GenerateIdTokenResponse
* @throws \Google\Service\Exception
*/
public function generateIdToken($name, GenerateIdTokenRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('generateIdToken', [$params], GenerateIdTokenResponse::class);
}
/**
* Signs a blob using a service account's system-managed private key.
* (serviceAccounts.signBlob)
*
* @param string $name Required. The resource name of the service account for
* which the credentials are requested, in the following format:
* `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
* character is required; replacing it with a project ID is invalid.
* @param SignBlobRequest $postBody
* @param array $optParams Optional parameters.
* @return SignBlobResponse
* @throws \Google\Service\Exception
*/
public function signBlob($name, SignBlobRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('signBlob', [$params], SignBlobResponse::class);
}
/**
* Signs a JWT using a service account's system-managed private key.
* (serviceAccounts.signJwt)
*
* @param string $name Required. The resource name of the service account for
* which the credentials are requested, in the following format:
* `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard
* character is required; replacing it with a project ID is invalid.
* @param SignJwtRequest $postBody
* @param array $optParams Optional parameters.
* @return SignJwtResponse
* @throws \Google\Service\Exception
*/
public function signJwt($name, SignJwtRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('signJwt', [$params], SignJwtResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsServiceAccounts::class, 'Google_Service_IAMCredentials_Resource_ProjectsServiceAccounts');