updateEnrollmentStatus method
- required EnrollmentStatus status,
- bool? includeMemberAccounts,
Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization Hub service.
If the account is a management account of an organization, this action can also be used to enroll member accounts of the organization.
You must have the appropriate permissions to opt in to Cost Optimization Hub and to view its recommendations. When you opt in, Cost Optimization Hub automatically creates a service-linked role in your account to access its data.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ThrottlingException.
May throw ValidationException.
Parameter status :
Sets the account status.
Parameter includeMemberAccounts :
Indicates whether to enroll member accounts of the organization if the
account is the management account or delegated administrator.
Implementation
Future<UpdateEnrollmentStatusResponse> updateEnrollmentStatus({
required EnrollmentStatus status,
bool? includeMemberAccounts,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'CostOptimizationHubService.UpdateEnrollmentStatus'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'status': status.value,
if (includeMemberAccounts != null)
'includeMemberAccounts': includeMemberAccounts,
},
);
return UpdateEnrollmentStatusResponse.fromJson(jsonResponse.body);
}