createCloudFrontOriginAccessIdentity2017_03_25 method

Future<CreateCloudFrontOriginAccessIdentityResult> createCloudFrontOriginAccessIdentity2017_03_25({
  1. required CloudFrontOriginAccessIdentityConfig cloudFrontOriginAccessIdentityConfig,
})

Creates a new origin access identity. If you're using Amazon S3 for your origin, you can use an origin access identity to require users to access your content using a CloudFront URL instead of the Amazon S3 URL. For more information about how to use origin access identities, see Serving Private Content through CloudFront in the Amazon CloudFront Developer Guide.

May throw CloudFrontOriginAccessIdentityAlreadyExists. May throw MissingBody. May throw TooManyCloudFrontOriginAccessIdentities. May throw InvalidArgument. May throw InconsistentQuantities.

Parameter cloudFrontOriginAccessIdentityConfig : The current configuration information for the identity.

Implementation

Future<CreateCloudFrontOriginAccessIdentityResult>
    createCloudFrontOriginAccessIdentity2017_03_25({
  required CloudFrontOriginAccessIdentityConfig
      cloudFrontOriginAccessIdentityConfig,
}) async {
  ArgumentError.checkNotNull(cloudFrontOriginAccessIdentityConfig,
      'cloudFrontOriginAccessIdentityConfig');
  final $result = await _protocol.sendRaw(
    method: 'POST',
    requestUri: '/2017-03-25/origin-access-identity/cloudfront',
    payload: cloudFrontOriginAccessIdentityConfig
        .toXml('CloudFrontOriginAccessIdentityConfig'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return CreateCloudFrontOriginAccessIdentityResult(
    cloudFrontOriginAccessIdentity:
        CloudFrontOriginAccessIdentity.fromXml($elem),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
    location: _s.extractHeaderStringValue($result.headers, 'Location'),
  );
}