updateCloudFrontOriginAccessIdentity2017_03_25 method

Future<UpdateCloudFrontOriginAccessIdentityResult> updateCloudFrontOriginAccessIdentity2017_03_25({
  1. required CloudFrontOriginAccessIdentityConfig cloudFrontOriginAccessIdentityConfig,
  2. required String id,
  3. String? ifMatch,
})

Update an origin access identity.

May throw AccessDenied. May throw IllegalUpdate. May throw InvalidIfMatchVersion. May throw MissingBody. May throw NoSuchCloudFrontOriginAccessIdentity. May throw PreconditionFailed. May throw InvalidArgument. May throw InconsistentQuantities.

Parameter cloudFrontOriginAccessIdentityConfig : The identity's configuration information.

Parameter id : The identity's id.

Parameter ifMatch : The value of the ETag header that you received when retrieving the identity's configuration. For example: E2QWRUHAPOMQZL.

Implementation

Future<UpdateCloudFrontOriginAccessIdentityResult>
    updateCloudFrontOriginAccessIdentity2017_03_25({
  required CloudFrontOriginAccessIdentityConfig
      cloudFrontOriginAccessIdentityConfig,
  required String id,
  String? ifMatch,
}) async {
  ArgumentError.checkNotNull(cloudFrontOriginAccessIdentityConfig,
      'cloudFrontOriginAccessIdentityConfig');
  ArgumentError.checkNotNull(id, 'id');
  final headers = <String, String>{
    if (ifMatch != null) 'If-Match': ifMatch.toString(),
  };
  final $result = await _protocol.sendRaw(
    method: 'PUT',
    requestUri:
        '/2017-03-25/origin-access-identity/cloudfront/${Uri.encodeComponent(id)}/config',
    headers: headers,
    payload: cloudFrontOriginAccessIdentityConfig
        .toXml('CloudFrontOriginAccessIdentityConfig'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return UpdateCloudFrontOriginAccessIdentityResult(
    cloudFrontOriginAccessIdentity:
        CloudFrontOriginAccessIdentity.fromXml($elem),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
  );
}