putAggregationAuthorization method

Future<PutAggregationAuthorizationResponse> putAggregationAuthorization({
  1. required String authorizedAccountId,
  2. required String authorizedAwsRegion,
  3. List<Tag>? tags,
})

Authorizes the aggregator account and region to collect data from the source account and region.

May throw InvalidParameterValueException.

Parameter authorizedAccountId : The 12-digit account ID of the account authorized to aggregate data.

Parameter authorizedAwsRegion : The region authorized to collect aggregated data.

Parameter tags : An array of tag object.

Implementation

Future<PutAggregationAuthorizationResponse> putAggregationAuthorization({
  required String authorizedAccountId,
  required String authorizedAwsRegion,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(authorizedAccountId, 'authorizedAccountId');
  ArgumentError.checkNotNull(authorizedAwsRegion, 'authorizedAwsRegion');
  _s.validateStringLength(
    'authorizedAwsRegion',
    authorizedAwsRegion,
    1,
    64,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.PutAggregationAuthorization'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AuthorizedAccountId': authorizedAccountId,
      'AuthorizedAwsRegion': authorizedAwsRegion,
      if (tags != null) 'Tags': tags,
    },
  );

  return PutAggregationAuthorizationResponse.fromJson(jsonResponse.body);
}