createPublishingDestination method
Creates a publishing destination where you can export your GuardDuty findings. Before you start exporting the findings, the destination resource must exist.
May throw BadRequestException.
May throw InternalServerErrorException.
Parameter destinationProperties :
The properties of the publishing destination, including the ARNs for the
destination and the KMS key used for encryption.
Parameter destinationType :
The type of resource for the publishing destination. Currently only Amazon
S3 buckets are supported.
Parameter detectorId :
The ID of the GuardDuty detector associated with the publishing
destination.
To find the detectorId in the current Region, see the
Settings page in the GuardDuty console, or run the ListDetectors
API.
Parameter clientToken :
The idempotency token for the request.
Parameter tags :
The tags to be added to a new publishing destination resource.
Implementation
Future<CreatePublishingDestinationResponse> createPublishingDestination({
required DestinationProperties destinationProperties,
required DestinationType destinationType,
required String detectorId,
String? clientToken,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'destinationProperties': destinationProperties,
'destinationType': destinationType.value,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/detector/${Uri.encodeComponent(detectorId)}/publishingDestination',
exceptionFnMap: _exceptionFns,
);
return CreatePublishingDestinationResponse.fromJson(response);
}