[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\CloudKMS\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\CloudKMS\AsymmetricDecryptRequest;
|
---|
| 21 | use Google\Service\CloudKMS\AsymmetricDecryptResponse;
|
---|
| 22 | use Google\Service\CloudKMS\AsymmetricSignRequest;
|
---|
| 23 | use Google\Service\CloudKMS\AsymmetricSignResponse;
|
---|
| 24 | use Google\Service\CloudKMS\CryptoKeyVersion;
|
---|
| 25 | use Google\Service\CloudKMS\DestroyCryptoKeyVersionRequest;
|
---|
| 26 | use Google\Service\CloudKMS\ImportCryptoKeyVersionRequest;
|
---|
| 27 | use Google\Service\CloudKMS\ListCryptoKeyVersionsResponse;
|
---|
| 28 | use Google\Service\CloudKMS\MacSignRequest;
|
---|
| 29 | use Google\Service\CloudKMS\MacSignResponse;
|
---|
| 30 | use Google\Service\CloudKMS\MacVerifyRequest;
|
---|
| 31 | use Google\Service\CloudKMS\MacVerifyResponse;
|
---|
| 32 | use Google\Service\CloudKMS\PublicKey;
|
---|
| 33 | use Google\Service\CloudKMS\RawDecryptRequest;
|
---|
| 34 | use Google\Service\CloudKMS\RawDecryptResponse;
|
---|
| 35 | use Google\Service\CloudKMS\RawEncryptRequest;
|
---|
| 36 | use Google\Service\CloudKMS\RawEncryptResponse;
|
---|
| 37 | use Google\Service\CloudKMS\RestoreCryptoKeyVersionRequest;
|
---|
| 38 |
|
---|
| 39 | /**
|
---|
| 40 | * The "cryptoKeyVersions" collection of methods.
|
---|
| 41 | * Typical usage is:
|
---|
| 42 | * <code>
|
---|
| 43 | * $cloudkmsService = new Google\Service\CloudKMS(...);
|
---|
| 44 | * $cryptoKeyVersions = $cloudkmsService->projects_locations_keyRings_cryptoKeys_cryptoKeyVersions;
|
---|
| 45 | * </code>
|
---|
| 46 | */
|
---|
| 47 | class ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersions extends \Google\Service\Resource
|
---|
| 48 | {
|
---|
| 49 | /**
|
---|
| 50 | * Decrypts data that was encrypted with a public key retrieved from
|
---|
| 51 | * GetPublicKey corresponding to a CryptoKeyVersion with CryptoKey.purpose
|
---|
| 52 | * ASYMMETRIC_DECRYPT. (cryptoKeyVersions.asymmetricDecrypt)
|
---|
| 53 | *
|
---|
| 54 | * @param string $name Required. The resource name of the CryptoKeyVersion to
|
---|
| 55 | * use for decryption.
|
---|
| 56 | * @param AsymmetricDecryptRequest $postBody
|
---|
| 57 | * @param array $optParams Optional parameters.
|
---|
| 58 | * @return AsymmetricDecryptResponse
|
---|
| 59 | * @throws \Google\Service\Exception
|
---|
| 60 | */
|
---|
| 61 | public function asymmetricDecrypt($name, AsymmetricDecryptRequest $postBody, $optParams = [])
|
---|
| 62 | {
|
---|
| 63 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 64 | $params = array_merge($params, $optParams);
|
---|
| 65 | return $this->call('asymmetricDecrypt', [$params], AsymmetricDecryptResponse::class);
|
---|
| 66 | }
|
---|
| 67 | /**
|
---|
| 68 | * Signs data using a CryptoKeyVersion with CryptoKey.purpose ASYMMETRIC_SIGN,
|
---|
| 69 | * producing a signature that can be verified with the public key retrieved from
|
---|
| 70 | * GetPublicKey. (cryptoKeyVersions.asymmetricSign)
|
---|
| 71 | *
|
---|
| 72 | * @param string $name Required. The resource name of the CryptoKeyVersion to
|
---|
| 73 | * use for signing.
|
---|
| 74 | * @param AsymmetricSignRequest $postBody
|
---|
| 75 | * @param array $optParams Optional parameters.
|
---|
| 76 | * @return AsymmetricSignResponse
|
---|
| 77 | * @throws \Google\Service\Exception
|
---|
| 78 | */
|
---|
| 79 | public function asymmetricSign($name, AsymmetricSignRequest $postBody, $optParams = [])
|
---|
| 80 | {
|
---|
| 81 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 82 | $params = array_merge($params, $optParams);
|
---|
| 83 | return $this->call('asymmetricSign', [$params], AsymmetricSignResponse::class);
|
---|
| 84 | }
|
---|
| 85 | /**
|
---|
| 86 | * Create a new CryptoKeyVersion in a CryptoKey. The server will assign the next
|
---|
| 87 | * sequential id. If unset, state will be set to ENABLED.
|
---|
| 88 | * (cryptoKeyVersions.create)
|
---|
| 89 | *
|
---|
| 90 | * @param string $parent Required. The name of the CryptoKey associated with the
|
---|
| 91 | * CryptoKeyVersions.
|
---|
| 92 | * @param CryptoKeyVersion $postBody
|
---|
| 93 | * @param array $optParams Optional parameters.
|
---|
| 94 | * @return CryptoKeyVersion
|
---|
| 95 | * @throws \Google\Service\Exception
|
---|
| 96 | */
|
---|
| 97 | public function create($parent, CryptoKeyVersion $postBody, $optParams = [])
|
---|
| 98 | {
|
---|
| 99 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 100 | $params = array_merge($params, $optParams);
|
---|
| 101 | return $this->call('create', [$params], CryptoKeyVersion::class);
|
---|
| 102 | }
|
---|
| 103 | /**
|
---|
| 104 | * Schedule a CryptoKeyVersion for destruction. Upon calling this method,
|
---|
| 105 | * CryptoKeyVersion.state will be set to DESTROY_SCHEDULED, and destroy_time
|
---|
| 106 | * will be set to the time destroy_scheduled_duration in the future. At that
|
---|
| 107 | * time, the state will automatically change to DESTROYED, and the key material
|
---|
| 108 | * will be irrevocably destroyed. Before the destroy_time is reached,
|
---|
| 109 | * RestoreCryptoKeyVersion may be called to reverse the process.
|
---|
| 110 | * (cryptoKeyVersions.destroy)
|
---|
| 111 | *
|
---|
| 112 | * @param string $name Required. The resource name of the CryptoKeyVersion to
|
---|
| 113 | * destroy.
|
---|
| 114 | * @param DestroyCryptoKeyVersionRequest $postBody
|
---|
| 115 | * @param array $optParams Optional parameters.
|
---|
| 116 | * @return CryptoKeyVersion
|
---|
| 117 | * @throws \Google\Service\Exception
|
---|
| 118 | */
|
---|
| 119 | public function destroy($name, DestroyCryptoKeyVersionRequest $postBody, $optParams = [])
|
---|
| 120 | {
|
---|
| 121 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 122 | $params = array_merge($params, $optParams);
|
---|
| 123 | return $this->call('destroy', [$params], CryptoKeyVersion::class);
|
---|
| 124 | }
|
---|
| 125 | /**
|
---|
| 126 | * Returns metadata for a given CryptoKeyVersion. (cryptoKeyVersions.get)
|
---|
| 127 | *
|
---|
| 128 | * @param string $name Required. The name of the CryptoKeyVersion to get.
|
---|
| 129 | * @param array $optParams Optional parameters.
|
---|
| 130 | * @return CryptoKeyVersion
|
---|
| 131 | * @throws \Google\Service\Exception
|
---|
| 132 | */
|
---|
| 133 | public function get($name, $optParams = [])
|
---|
| 134 | {
|
---|
| 135 | $params = ['name' => $name];
|
---|
| 136 | $params = array_merge($params, $optParams);
|
---|
| 137 | return $this->call('get', [$params], CryptoKeyVersion::class);
|
---|
| 138 | }
|
---|
| 139 | /**
|
---|
| 140 | * Returns the public key for the given CryptoKeyVersion. The CryptoKey.purpose
|
---|
| 141 | * must be ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT.
|
---|
| 142 | * (cryptoKeyVersions.getPublicKey)
|
---|
| 143 | *
|
---|
| 144 | * @param string $name Required. The name of the CryptoKeyVersion public key to
|
---|
| 145 | * get.
|
---|
| 146 | * @param array $optParams Optional parameters.
|
---|
| 147 | * @return PublicKey
|
---|
| 148 | * @throws \Google\Service\Exception
|
---|
| 149 | */
|
---|
| 150 | public function getPublicKey($name, $optParams = [])
|
---|
| 151 | {
|
---|
| 152 | $params = ['name' => $name];
|
---|
| 153 | $params = array_merge($params, $optParams);
|
---|
| 154 | return $this->call('getPublicKey', [$params], PublicKey::class);
|
---|
| 155 | }
|
---|
| 156 | /**
|
---|
| 157 | * Import wrapped key material into a CryptoKeyVersion. All requests must
|
---|
| 158 | * specify a CryptoKey. If a CryptoKeyVersion is additionally specified in the
|
---|
| 159 | * request, key material will be reimported into that version. Otherwise, a new
|
---|
| 160 | * version will be created, and will be assigned the next sequential id within
|
---|
| 161 | * the CryptoKey. (cryptoKeyVersions.import)
|
---|
| 162 | *
|
---|
| 163 | * @param string $parent Required. The name of the CryptoKey to be imported
|
---|
| 164 | * into. The create permission is only required on this key when creating a new
|
---|
| 165 | * CryptoKeyVersion.
|
---|
| 166 | * @param ImportCryptoKeyVersionRequest $postBody
|
---|
| 167 | * @param array $optParams Optional parameters.
|
---|
| 168 | * @return CryptoKeyVersion
|
---|
| 169 | * @throws \Google\Service\Exception
|
---|
| 170 | */
|
---|
| 171 | public function import($parent, ImportCryptoKeyVersionRequest $postBody, $optParams = [])
|
---|
| 172 | {
|
---|
| 173 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 174 | $params = array_merge($params, $optParams);
|
---|
| 175 | return $this->call('import', [$params], CryptoKeyVersion::class);
|
---|
| 176 | }
|
---|
| 177 | /**
|
---|
| 178 | * Lists CryptoKeyVersions.
|
---|
| 179 | * (cryptoKeyVersions.listProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersions)
|
---|
| 180 | *
|
---|
| 181 | * @param string $parent Required. The resource name of the CryptoKey to list,
|
---|
| 182 | * in the format `projects/locations/keyRings/cryptoKeys`.
|
---|
| 183 | * @param array $optParams Optional parameters.
|
---|
| 184 | *
|
---|
| 185 | * @opt_param string filter Optional. Only include resources that match the
|
---|
| 186 | * filter in the response. For more information, see [Sorting and filtering list
|
---|
| 187 | * results](https://cloud.google.com/kms/docs/sorting-and-filtering).
|
---|
| 188 | * @opt_param string orderBy Optional. Specify how the results should be sorted.
|
---|
| 189 | * If not specified, the results will be sorted in the default order. For more
|
---|
| 190 | * information, see [Sorting and filtering list
|
---|
| 191 | * results](https://cloud.google.com/kms/docs/sorting-and-filtering).
|
---|
| 192 | * @opt_param int pageSize Optional. Optional limit on the number of
|
---|
| 193 | * CryptoKeyVersions to include in the response. Further CryptoKeyVersions can
|
---|
| 194 | * subsequently be obtained by including the
|
---|
| 195 | * ListCryptoKeyVersionsResponse.next_page_token in a subsequent request. If
|
---|
| 196 | * unspecified, the server will pick an appropriate default.
|
---|
| 197 | * @opt_param string pageToken Optional. Optional pagination token, returned
|
---|
| 198 | * earlier via ListCryptoKeyVersionsResponse.next_page_token.
|
---|
| 199 | * @opt_param string view The fields to include in the response.
|
---|
| 200 | * @return ListCryptoKeyVersionsResponse
|
---|
| 201 | * @throws \Google\Service\Exception
|
---|
| 202 | */
|
---|
| 203 | public function listProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersions($parent, $optParams = [])
|
---|
| 204 | {
|
---|
| 205 | $params = ['parent' => $parent];
|
---|
| 206 | $params = array_merge($params, $optParams);
|
---|
| 207 | return $this->call('list', [$params], ListCryptoKeyVersionsResponse::class);
|
---|
| 208 | }
|
---|
| 209 | /**
|
---|
| 210 | * Signs data using a CryptoKeyVersion with CryptoKey.purpose MAC, producing a
|
---|
| 211 | * tag that can be verified by another source with the same key.
|
---|
| 212 | * (cryptoKeyVersions.macSign)
|
---|
| 213 | *
|
---|
| 214 | * @param string $name Required. The resource name of the CryptoKeyVersion to
|
---|
| 215 | * use for signing.
|
---|
| 216 | * @param MacSignRequest $postBody
|
---|
| 217 | * @param array $optParams Optional parameters.
|
---|
| 218 | * @return MacSignResponse
|
---|
| 219 | * @throws \Google\Service\Exception
|
---|
| 220 | */
|
---|
| 221 | public function macSign($name, MacSignRequest $postBody, $optParams = [])
|
---|
| 222 | {
|
---|
| 223 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 224 | $params = array_merge($params, $optParams);
|
---|
| 225 | return $this->call('macSign', [$params], MacSignResponse::class);
|
---|
| 226 | }
|
---|
| 227 | /**
|
---|
| 228 | * Verifies MAC tag using a CryptoKeyVersion with CryptoKey.purpose MAC, and
|
---|
| 229 | * returns a response that indicates whether or not the verification was
|
---|
| 230 | * successful. (cryptoKeyVersions.macVerify)
|
---|
| 231 | *
|
---|
| 232 | * @param string $name Required. The resource name of the CryptoKeyVersion to
|
---|
| 233 | * use for verification.
|
---|
| 234 | * @param MacVerifyRequest $postBody
|
---|
| 235 | * @param array $optParams Optional parameters.
|
---|
| 236 | * @return MacVerifyResponse
|
---|
| 237 | * @throws \Google\Service\Exception
|
---|
| 238 | */
|
---|
| 239 | public function macVerify($name, MacVerifyRequest $postBody, $optParams = [])
|
---|
| 240 | {
|
---|
| 241 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 242 | $params = array_merge($params, $optParams);
|
---|
| 243 | return $this->call('macVerify', [$params], MacVerifyResponse::class);
|
---|
| 244 | }
|
---|
| 245 | /**
|
---|
| 246 | * Update a CryptoKeyVersion's metadata. state may be changed between ENABLED
|
---|
| 247 | * and DISABLED using this method. See DestroyCryptoKeyVersion and
|
---|
| 248 | * RestoreCryptoKeyVersion to move between other states.
|
---|
| 249 | * (cryptoKeyVersions.patch)
|
---|
| 250 | *
|
---|
| 251 | * @param string $name Output only. The resource name for this CryptoKeyVersion
|
---|
| 252 | * in the format `projects/locations/keyRings/cryptoKeys/cryptoKeyVersions`.
|
---|
| 253 | * @param CryptoKeyVersion $postBody
|
---|
| 254 | * @param array $optParams Optional parameters.
|
---|
| 255 | *
|
---|
| 256 | * @opt_param string updateMask Required. List of fields to be updated in this
|
---|
| 257 | * request.
|
---|
| 258 | * @return CryptoKeyVersion
|
---|
| 259 | * @throws \Google\Service\Exception
|
---|
| 260 | */
|
---|
| 261 | public function patch($name, CryptoKeyVersion $postBody, $optParams = [])
|
---|
| 262 | {
|
---|
| 263 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 264 | $params = array_merge($params, $optParams);
|
---|
| 265 | return $this->call('patch', [$params], CryptoKeyVersion::class);
|
---|
| 266 | }
|
---|
| 267 | /**
|
---|
| 268 | * Decrypts data that was originally encrypted using a raw cryptographic
|
---|
| 269 | * mechanism. The CryptoKey.purpose must be RAW_ENCRYPT_DECRYPT.
|
---|
| 270 | * (cryptoKeyVersions.rawDecrypt)
|
---|
| 271 | *
|
---|
| 272 | * @param string $name Required. The resource name of the CryptoKeyVersion to
|
---|
| 273 | * use for decryption.
|
---|
| 274 | * @param RawDecryptRequest $postBody
|
---|
| 275 | * @param array $optParams Optional parameters.
|
---|
| 276 | * @return RawDecryptResponse
|
---|
| 277 | * @throws \Google\Service\Exception
|
---|
| 278 | */
|
---|
| 279 | public function rawDecrypt($name, RawDecryptRequest $postBody, $optParams = [])
|
---|
| 280 | {
|
---|
| 281 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 282 | $params = array_merge($params, $optParams);
|
---|
| 283 | return $this->call('rawDecrypt', [$params], RawDecryptResponse::class);
|
---|
| 284 | }
|
---|
| 285 | /**
|
---|
| 286 | * Encrypts data using portable cryptographic primitives. Most users should
|
---|
| 287 | * choose Encrypt and Decrypt rather than their raw counterparts. The
|
---|
| 288 | * CryptoKey.purpose must be RAW_ENCRYPT_DECRYPT. (cryptoKeyVersions.rawEncrypt)
|
---|
| 289 | *
|
---|
| 290 | * @param string $name Required. The resource name of the CryptoKeyVersion to
|
---|
| 291 | * use for encryption.
|
---|
| 292 | * @param RawEncryptRequest $postBody
|
---|
| 293 | * @param array $optParams Optional parameters.
|
---|
| 294 | * @return RawEncryptResponse
|
---|
| 295 | * @throws \Google\Service\Exception
|
---|
| 296 | */
|
---|
| 297 | public function rawEncrypt($name, RawEncryptRequest $postBody, $optParams = [])
|
---|
| 298 | {
|
---|
| 299 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 300 | $params = array_merge($params, $optParams);
|
---|
| 301 | return $this->call('rawEncrypt', [$params], RawEncryptResponse::class);
|
---|
| 302 | }
|
---|
| 303 | /**
|
---|
| 304 | * Restore a CryptoKeyVersion in the DESTROY_SCHEDULED state. Upon restoration
|
---|
| 305 | * of the CryptoKeyVersion, state will be set to DISABLED, and destroy_time will
|
---|
| 306 | * be cleared. (cryptoKeyVersions.restore)
|
---|
| 307 | *
|
---|
| 308 | * @param string $name Required. The resource name of the CryptoKeyVersion to
|
---|
| 309 | * restore.
|
---|
| 310 | * @param RestoreCryptoKeyVersionRequest $postBody
|
---|
| 311 | * @param array $optParams Optional parameters.
|
---|
| 312 | * @return CryptoKeyVersion
|
---|
| 313 | * @throws \Google\Service\Exception
|
---|
| 314 | */
|
---|
| 315 | public function restore($name, RestoreCryptoKeyVersionRequest $postBody, $optParams = [])
|
---|
| 316 | {
|
---|
| 317 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 318 | $params = array_merge($params, $optParams);
|
---|
| 319 | return $this->call('restore', [$params], CryptoKeyVersion::class);
|
---|
| 320 | }
|
---|
| 321 | }
|
---|
| 322 |
|
---|
| 323 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 324 | class_alias(ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersions::class, 'Google_Service_CloudKMS_Resource_ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersions');
|
---|