createHomeRegionControl method

Future<CreateHomeRegionControlResult> createHomeRegionControl({
  1. required String homeRegion,
  2. required Target target,
  3. bool? dryRun,
})

This API sets up the home region for the calling account only.

May throw InternalServerError. May throw ServiceUnavailableException. May throw AccessDeniedException. May throw ThrottlingException. May throw DryRunOperation. May throw InvalidInputException.

Parameter homeRegion : The name of the home region of the calling account.

Parameter target : The account for which this command sets up a home region control. The Target is always of type ACCOUNT.

Parameter dryRun : Optional Boolean flag to indicate whether any effect should take place. It tests whether the caller has permission to make the call.

Implementation

Future<CreateHomeRegionControlResult> createHomeRegionControl({
  required String homeRegion,
  required Target target,
  bool? dryRun,
}) async {
  ArgumentError.checkNotNull(homeRegion, 'homeRegion');
  _s.validateStringLength(
    'homeRegion',
    homeRegion,
    1,
    50,
    isRequired: true,
  );
  ArgumentError.checkNotNull(target, 'target');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSMigrationHubMultiAccountService.CreateHomeRegionControl'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'HomeRegion': homeRegion,
      'Target': target,
      if (dryRun != null) 'DryRun': dryRun,
    },
  );

  return CreateHomeRegionControlResult.fromJson(jsonResponse.body);
}