createKeyGroup2020_05_31 method

Future<CreateKeyGroupResult> createKeyGroup2020_05_31({
  1. required KeyGroupConfig keyGroupConfig,
})

Creates a key group that you can use with CloudFront signed URLs and signed cookies.

To create a key group, you must specify at least one public key for the key group. After you create a key group, you can reference it from one or more cache behaviors. When you reference a key group in a cache behavior, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide.

May throw InvalidArgument. May throw KeyGroupAlreadyExists. May throw TooManyKeyGroups. May throw TooManyPublicKeysInKeyGroup.

Parameter keyGroupConfig : A key group configuration.

Implementation

Future<CreateKeyGroupResult> createKeyGroup2020_05_31({
  required KeyGroupConfig keyGroupConfig,
}) async {
  ArgumentError.checkNotNull(keyGroupConfig, 'keyGroupConfig');
  final $result = await _protocol.sendRaw(
    method: 'POST',
    requestUri: '/2020-05-31/key-group',
    payload: keyGroupConfig.toXml('KeyGroupConfig'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return CreateKeyGroupResult(
    keyGroup: KeyGroup.fromXml($elem),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
    location: _s.extractHeaderStringValue($result.headers, 'Location'),
  );
}