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\Iam\Resource;
19
20use Google\Service\Iam\CreateServiceAccountKeyRequest;
21use Google\Service\Iam\DisableServiceAccountKeyRequest;
22use Google\Service\Iam\EnableServiceAccountKeyRequest;
23use Google\Service\Iam\IamEmpty;
24use Google\Service\Iam\ListServiceAccountKeysResponse;
25use Google\Service\Iam\ServiceAccountKey;
26use 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->keys;
34 *  </code>
35 */
36class 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 in the
42   * following format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. Using
43   * `-` as a wildcard for the `PROJECT_ID` will infer the project from the
44   * account. The `ACCOUNT` value can be the `email` address or the `unique_id` of
45   * the service account.
46   * @param CreateServiceAccountKeyRequest $postBody
47   * @param array $optParams Optional parameters.
48   * @return ServiceAccountKey
49   */
50  public function create($name, CreateServiceAccountKeyRequest $postBody, $optParams = [])
51  {
52    $params = ['name' => $name, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], ServiceAccountKey::class);
55  }
56  /**
57   * Deletes a ServiceAccountKey. Deleting a service account key does not revoke
58   * short-lived credentials that have been issued based on the service account
59   * key. (keys.delete)
60   *
61   * @param string $name Required. The resource name of the service account key in
62   * the following format:
63   * `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`. Using `-` as a
64   * wildcard for the `PROJECT_ID` will infer the project from the account. The
65   * `ACCOUNT` value can be the `email` address or the `unique_id` of the service
66   * account.
67   * @param array $optParams Optional parameters.
68   * @return IamEmpty
69   */
70  public function delete($name, $optParams = [])
71  {
72    $params = ['name' => $name];
73    $params = array_merge($params, $optParams);
74    return $this->call('delete', [$params], IamEmpty::class);
75  }
76  /**
77   * Disable a ServiceAccountKey. A disabled service account key can be enabled
78   * through EnableServiceAccountKey. (keys.disable)
79   *
80   * @param string $name Required. The resource name of the service account key in
81   * the following format:
82   * `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`. Using `-` as a
83   * wildcard for the `PROJECT_ID` will infer the project from the account. The
84   * `ACCOUNT` value can be the `email` address or the `unique_id` of the service
85   * account.
86   * @param DisableServiceAccountKeyRequest $postBody
87   * @param array $optParams Optional parameters.
88   * @return IamEmpty
89   */
90  public function disable($name, DisableServiceAccountKeyRequest $postBody, $optParams = [])
91  {
92    $params = ['name' => $name, 'postBody' => $postBody];
93    $params = array_merge($params, $optParams);
94    return $this->call('disable', [$params], IamEmpty::class);
95  }
96  /**
97   * Enable a ServiceAccountKey. (keys.enable)
98   *
99   * @param string $name Required. The resource name of the service account key in
100   * the following format:
101   * `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`. Using `-` as a
102   * wildcard for the `PROJECT_ID` will infer the project from the account. The
103   * `ACCOUNT` value can be the `email` address or the `unique_id` of the service
104   * account.
105   * @param EnableServiceAccountKeyRequest $postBody
106   * @param array $optParams Optional parameters.
107   * @return IamEmpty
108   */
109  public function enable($name, EnableServiceAccountKeyRequest $postBody, $optParams = [])
110  {
111    $params = ['name' => $name, 'postBody' => $postBody];
112    $params = array_merge($params, $optParams);
113    return $this->call('enable', [$params], IamEmpty::class);
114  }
115  /**
116   * Gets a ServiceAccountKey. (keys.get)
117   *
118   * @param string $name Required. The resource name of the service account key in
119   * the following format:
120   * `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`. Using `-` as a
121   * wildcard for the `PROJECT_ID` will infer the project from the account. The
122   * `ACCOUNT` value can be the `email` address or the `unique_id` of the service
123   * account.
124   * @param array $optParams Optional parameters.
125   *
126   * @opt_param string publicKeyType Optional. The output format of the public
127   * key. The default is `TYPE_NONE`, which means that the public key is not
128   * returned.
129   * @return ServiceAccountKey
130   */
131  public function get($name, $optParams = [])
132  {
133    $params = ['name' => $name];
134    $params = array_merge($params, $optParams);
135    return $this->call('get', [$params], ServiceAccountKey::class);
136  }
137  /**
138   * Lists every ServiceAccountKey for a service account.
139   * (keys.listProjectsServiceAccountsKeys)
140   *
141   * @param string $name Required. The resource name of the service account in the
142   * following format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. Using
143   * `-` as a wildcard for the `PROJECT_ID`, will infer the project from the
144   * account. The `ACCOUNT` value can be the `email` address or the `unique_id` of
145   * the service account.
146   * @param array $optParams Optional parameters.
147   *
148   * @opt_param string keyTypes Filters the types of keys the user wants to
149   * include in the list response. Duplicate key types are not allowed. If no key
150   * type is provided, all keys are returned.
151   * @return ListServiceAccountKeysResponse
152   */
153  public function listProjectsServiceAccountsKeys($name, $optParams = [])
154  {
155    $params = ['name' => $name];
156    $params = array_merge($params, $optParams);
157    return $this->call('list', [$params], ListServiceAccountKeysResponse::class);
158  }
159  /**
160   * Uploads the public key portion of a key pair that you manage, and associates
161   * the public key with a ServiceAccount. After you upload the public key, you
162   * can use the private key from the key pair as a service account key.
163   * (keys.upload)
164   *
165   * @param string $name The resource name of the service account in the following
166   * format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. Using `-` as a
167   * wildcard for the `PROJECT_ID` will infer the project from the account. The
168   * `ACCOUNT` value can be the `email` address or the `unique_id` of the service
169   * account.
170   * @param UploadServiceAccountKeyRequest $postBody
171   * @param array $optParams Optional parameters.
172   * @return ServiceAccountKey
173   */
174  public function upload($name, UploadServiceAccountKeyRequest $postBody, $optParams = [])
175  {
176    $params = ['name' => $name, 'postBody' => $postBody];
177    $params = array_merge($params, $optParams);
178    return $this->call('upload', [$params], ServiceAccountKey::class);
179  }
180}
181
182// Adding a class alias for backwards compatibility with the previous class name.
183class_alias(ProjectsServiceAccountsKeys::class, 'Google_Service_Iam_Resource_ProjectsServiceAccountsKeys');
184