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\Storage\Resource;
19
20use Google\Service\Storage\HmacKey;
21use Google\Service\Storage\HmacKeyMetadata;
22use Google\Service\Storage\HmacKeysMetadata;
23
24/**
25 * The "hmacKeys" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $storageService = new Google\Service\Storage(...);
29 *   $hmacKeys = $storageService->hmacKeys;
30 *  </code>
31 */
32class ProjectsHmacKeys extends \Google\Service\Resource
33{
34  /**
35   * Creates a new HMAC key for the specified service account. (hmacKeys.create)
36   *
37   * @param string $projectId Project ID owning the service account.
38   * @param string $serviceAccountEmail Email address of the service account.
39   * @param array $optParams Optional parameters.
40   *
41   * @opt_param string userProject The project to be billed for this request.
42   * @return HmacKey
43   */
44  public function create($projectId, $serviceAccountEmail, $optParams = [])
45  {
46    $params = ['projectId' => $projectId, 'serviceAccountEmail' => $serviceAccountEmail];
47    $params = array_merge($params, $optParams);
48    return $this->call('create', [$params], HmacKey::class);
49  }
50  /**
51   * Deletes an HMAC key. (hmacKeys.delete)
52   *
53   * @param string $projectId Project ID owning the requested key
54   * @param string $accessId Name of the HMAC key to be deleted.
55   * @param array $optParams Optional parameters.
56   *
57   * @opt_param string userProject The project to be billed for this request.
58   */
59  public function delete($projectId, $accessId, $optParams = [])
60  {
61    $params = ['projectId' => $projectId, 'accessId' => $accessId];
62    $params = array_merge($params, $optParams);
63    return $this->call('delete', [$params]);
64  }
65  /**
66   * Retrieves an HMAC key's metadata (hmacKeys.get)
67   *
68   * @param string $projectId Project ID owning the service account of the
69   * requested key.
70   * @param string $accessId Name of the HMAC key.
71   * @param array $optParams Optional parameters.
72   *
73   * @opt_param string userProject The project to be billed for this request.
74   * @return HmacKeyMetadata
75   */
76  public function get($projectId, $accessId, $optParams = [])
77  {
78    $params = ['projectId' => $projectId, 'accessId' => $accessId];
79    $params = array_merge($params, $optParams);
80    return $this->call('get', [$params], HmacKeyMetadata::class);
81  }
82  /**
83   * Retrieves a list of HMAC keys matching the criteria.
84   * (hmacKeys.listProjectsHmacKeys)
85   *
86   * @param string $projectId Name of the project in which to look for HMAC keys.
87   * @param array $optParams Optional parameters.
88   *
89   * @opt_param string maxResults Maximum number of items to return in a single
90   * page of responses. The service uses this parameter or 250 items, whichever is
91   * smaller. The max number of items per page will also be limited by the number
92   * of distinct service accounts in the response. If the number of service
93   * accounts in a single response is too high, the page will truncated and a next
94   * page token will be returned.
95   * @opt_param string pageToken A previously-returned page token representing
96   * part of the larger set of results to view.
97   * @opt_param string serviceAccountEmail If present, only keys for the given
98   * service account are returned.
99   * @opt_param bool showDeletedKeys Whether or not to show keys in the DELETED
100   * state.
101   * @opt_param string userProject The project to be billed for this request.
102   * @return HmacKeysMetadata
103   */
104  public function listProjectsHmacKeys($projectId, $optParams = [])
105  {
106    $params = ['projectId' => $projectId];
107    $params = array_merge($params, $optParams);
108    return $this->call('list', [$params], HmacKeysMetadata::class);
109  }
110  /**
111   * Updates the state of an HMAC key. See the HMAC Key resource descriptor for
112   * valid states. (hmacKeys.update)
113   *
114   * @param string $projectId Project ID owning the service account of the updated
115   * key.
116   * @param string $accessId Name of the HMAC key being updated.
117   * @param HmacKeyMetadata $postBody
118   * @param array $optParams Optional parameters.
119   *
120   * @opt_param string userProject The project to be billed for this request.
121   * @return HmacKeyMetadata
122   */
123  public function update($projectId, $accessId, HmacKeyMetadata $postBody, $optParams = [])
124  {
125    $params = ['projectId' => $projectId, 'accessId' => $accessId, 'postBody' => $postBody];
126    $params = array_merge($params, $optParams);
127    return $this->call('update', [$params], HmacKeyMetadata::class);
128  }
129}
130
131// Adding a class alias for backwards compatibility with the previous class name.
132class_alias(ProjectsHmacKeys::class, 'Google_Service_Storage_Resource_ProjectsHmacKeys');
133