createPublicKey2020_05_31 method

Future<CreatePublicKeyResult> createPublicKey2020_05_31({
  1. required PublicKeyConfig publicKeyConfig,
})

Uploads a public key to CloudFront that you can use with signed URLs and signed cookies, or with field-level encryption.

May throw PublicKeyAlreadyExists. May throw InvalidArgument. May throw TooManyPublicKeys.

Parameter publicKeyConfig : A CloudFront public key configuration.

Implementation

Future<CreatePublicKeyResult> createPublicKey2020_05_31({
  required PublicKeyConfig publicKeyConfig,
}) async {
  ArgumentError.checkNotNull(publicKeyConfig, 'publicKeyConfig');
  final $result = await _protocol.sendRaw(
    method: 'POST',
    requestUri: '/2020-05-31/public-key',
    payload: publicKeyConfig.toXml('PublicKeyConfig'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return CreatePublicKeyResult(
    publicKey: PublicKey.fromXml($elem),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
    location: _s.extractHeaderStringValue($result.headers, 'Location'),
  );
}