startImport method

Future<StartImportResponse> startImport({
  1. List<String>? destinations,
  2. DateTime? endEventTime,
  3. String? importId,
  4. ImportSource? importSource,
  5. DateTime? startEventTime,
})

Starts an import of logged trail events from a source S3 bucket to a destination event data store. By default, CloudTrail only imports events contained in the S3 bucket's CloudTrail prefix and the prefixes inside the CloudTrail prefix, and does not check prefixes for other Amazon Web Services services. If you want to import CloudTrail events contained in another prefix, you must include the prefix in the S3LocationUri. For more considerations about importing trail events, see Considerations for copying trail events in the CloudTrail User Guide.

When you start a new import, the Destinations and ImportSource parameters are required. Before starting a new import, disable any access control lists (ACLs) attached to the source S3 bucket. For more information about disabling ACLs, see Controlling ownership of objects and disabling ACLs for your bucket.

When you retry an import, the ImportID parameter is required.

May throw AccountHasOngoingImportException. May throw EventDataStoreARNInvalidException. May throw EventDataStoreNotFoundException. May throw ImportNotFoundException. May throw InactiveEventDataStoreException. May throw InsufficientEncryptionPolicyException. May throw InvalidEventDataStoreCategoryException. May throw InvalidEventDataStoreStatusException. May throw InvalidImportSourceException. May throw InvalidParameterException. May throw OperationNotPermittedException. May throw UnsupportedOperationException.

Parameter destinations : The ARN of the destination event data store. Use this parameter for a new import.

Parameter endEventTime : Use with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified StartEventTime and EndEventTime before attempting to import events.

Parameter importId : The ID of the import. Use this parameter when you are retrying an import.

Parameter importSource : The source S3 bucket for the import. Use this parameter for a new import.

Parameter startEventTime : Use with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified StartEventTime and EndEventTime before attempting to import events.

Implementation

Future<StartImportResponse> startImport({
  List<String>? destinations,
  DateTime? endEventTime,
  String? importId,
  ImportSource? importSource,
  DateTime? startEventTime,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CloudTrail_20131101.StartImport'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (destinations != null) 'Destinations': destinations,
      if (endEventTime != null)
        'EndEventTime': unixTimestampToJson(endEventTime),
      if (importId != null) 'ImportId': importId,
      if (importSource != null) 'ImportSource': importSource,
      if (startEventTime != null)
        'StartEventTime': unixTimestampToJson(startEventTime),
    },
  );

  return StartImportResponse.fromJson(jsonResponse.body);
}