exportECSServiceRecommendations method

Future<ExportECSServiceRecommendationsResponse> exportECSServiceRecommendations({
  1. required S3DestinationConfig s3DestinationConfig,
  2. List<String>? accountIds,
  3. List<ExportableECSServiceField>? fieldsToExport,
  4. FileFormat? fileFormat,
  5. List<ECSServiceRecommendationFilter>? filters,
  6. bool? includeMemberAccounts,
})

Exports optimization recommendations for Amazon ECS services on Fargate.

Recommendations are exported in a CSV file, and its metadata in a JSON file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. For more information, see Exporting Recommendations in the Compute Optimizer User Guide.

You can only have one Amazon ECS service export job in progress per Amazon Web Services Region.

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

Parameter accountIds : The Amazon Web Services account IDs for the export Amazon ECS service recommendations.

If your account is the management account or the delegated administrator of an organization, use this parameter to specify the member account you want to export recommendations to.

This parameter can't be specified together with the include member accounts parameter. The parameters are mutually exclusive.

If this parameter or the include member accounts parameter is omitted, the recommendations for member accounts aren't included in the export.

You can specify multiple account IDs per request.

Parameter fieldsToExport : The recommendations data to include in the export file. For more information about the fields that can be exported, see Exported files in the Compute Optimizer User Guide.

Parameter fileFormat : The format of the export file.

The CSV file is the only export file format currently supported.

Parameter filters : An array of objects to specify a filter that exports a more specific set of Amazon ECS service recommendations.

Parameter includeMemberAccounts : If your account is the management account or the delegated administrator of an organization, this parameter indicates whether to include recommendations for resources in all member accounts of the organization.

The member accounts must also be opted in to Compute Optimizer, and trusted access for Compute Optimizer must be enabled in the organization account. For more information, see Compute Optimizer and Amazon Web Services Organizations trusted access in the Compute Optimizer User Guide.

If this parameter is omitted, recommendations for member accounts of the organization aren't included in the export file.

If this parameter or the account ID parameter is omitted, recommendations for member accounts aren't included in the export.

Implementation

Future<ExportECSServiceRecommendationsResponse>
    exportECSServiceRecommendations({
  required S3DestinationConfig s3DestinationConfig,
  List<String>? accountIds,
  List<ExportableECSServiceField>? fieldsToExport,
  FileFormat? fileFormat,
  List<ECSServiceRecommendationFilter>? filters,
  bool? includeMemberAccounts,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'ComputeOptimizerService.ExportECSServiceRecommendations'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      's3DestinationConfig': s3DestinationConfig,
      if (accountIds != null) 'accountIds': accountIds,
      if (fieldsToExport != null)
        'fieldsToExport': fieldsToExport.map((e) => e.value).toList(),
      if (fileFormat != null) 'fileFormat': fileFormat.value,
      if (filters != null) 'filters': filters,
      if (includeMemberAccounts != null)
        'includeMemberAccounts': includeMemberAccounts,
    },
  );

  return ExportECSServiceRecommendationsResponse.fromJson(jsonResponse.body);
}