updateEnrollmentStatus method

Future<UpdateEnrollmentStatusResponse> updateEnrollmentStatus({
  1. required Status status,
  2. bool? includeMemberAccounts,
})

Updates the enrollment (opt in) status of an account to the AWS Compute Optimizer service.

If the account is a management account of an organization, this action can also be used to enroll member accounts within the organization.

May throw InternalServerException. May throw ServiceUnavailableException. May throw AccessDeniedException. May throw InvalidParameterValueException. May throw MissingAuthenticationToken. May throw ThrottlingException.

Parameter status : The new enrollment status of the account.

Accepted options are Active or Inactive. You will get an error if Pending or Failed are specified.

Parameter includeMemberAccounts : Indicates whether to enroll member accounts of the organization if the your account is the management account of an organization.

Implementation

Future<UpdateEnrollmentStatusResponse> updateEnrollmentStatus({
  required Status status,
  bool? includeMemberAccounts,
}) async {
  ArgumentError.checkNotNull(status, 'status');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'ComputeOptimizerService.UpdateEnrollmentStatus'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'status': status.toValue(),
      if (includeMemberAccounts != null)
        'includeMemberAccounts': includeMemberAccounts,
    },
  );

  return UpdateEnrollmentStatusResponse.fromJson(jsonResponse.body);
}