createPerformanceAnalysisReport method

Future<CreatePerformanceAnalysisReportResponse> createPerformanceAnalysisReport({
  1. required String identifier,
  2. required ServiceType serviceType,
  3. required DateTime startTime,
  4. DateTime? endTime,
  5. List<Tag>? tags,
})

Creates a new performance analysis report for a specific time period for the DB instance.

May throw InternalServiceError. May throw InvalidArgumentException. May throw NotAuthorizedException.

Parameter identifier : An immutable, Amazon Web Services Region-unique identifier for a data source. Performance Insights gathers metrics from this data source.

To use an Amazon RDS instance as a data source, you specify its DbiResourceId value. For example, specify db-ADECBTYHKTSAUMUZQYPDS2GW4A.

Parameter serviceType : The Amazon Web Services service for which Performance Insights will return metrics. Valid value is RDS.

Parameter startTime : The start time defined for the analysis report.

Parameter endTime : The end time defined for the analysis report.

Parameter tags : The metadata assigned to the analysis report consisting of a key-value pair.

Implementation

Future<CreatePerformanceAnalysisReportResponse>
    createPerformanceAnalysisReport({
  required String identifier,
  required ServiceType serviceType,
  required DateTime startTime,
  DateTime? endTime,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'PerformanceInsightsv20180227.CreatePerformanceAnalysisReport'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Identifier': identifier,
      'ServiceType': serviceType.value,
      'StartTime': unixTimestampToJson(startTime),
      if (endTime != null) 'EndTime': unixTimestampToJson(endTime),
      if (tags != null) 'Tags': tags,
    },
  );

  return CreatePerformanceAnalysisReportResponse.fromJson(jsonResponse.body);
}