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