exportTrustedKeyWrappedCryptoKeyVersion method

Future<ExportTrustedKeyWrappedCryptoKeyVersionResponse> exportTrustedKeyWrappedCryptoKeyVersion(
  1. String name, {
  2. String? wrappingKey,
  3. String? $fields,
})

Exports a CryptoKeyVersion with a trusted key.

The CryptoKeyVersion must have trusted_wrapping_enabled set to true. The CryptoKeyVersion of the [wrapping_key] must have the AES_WRAPPING purpose. The [wrapping_key] must have the AES_256_KWP algorithm.

Request parameters:

name - Required. The name of the CryptoKeyVersion to export. The CryptoKeyVersion must have trusted_wrapping_enabled set to true. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/keyRings/\[^/\]+/cryptoKeys/\[^/\]+/cryptoKeyVersions/\[^/\]+$.

wrappingKey - Required. The name of the CryptoKeyVersion to use as a wrapping key. The CryptoKeyVersion must have hsm_trusted set to true.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ExportTrustedKeyWrappedCryptoKeyVersionResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ExportTrustedKeyWrappedCryptoKeyVersionResponse>
exportTrustedKeyWrappedCryptoKeyVersion(
  core.String name, {
  core.String? wrappingKey,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'wrappingKey': ?wrappingKey == null ? null : [wrappingKey],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'v1/' +
      core.Uri.encodeFull('$name') +
      ':exportTrustedKeyWrappedCryptoKeyVersion';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ExportTrustedKeyWrappedCryptoKeyVersionResponse.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}