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