putDeliveryDestination method
Creates or updates a logical delivery destination. A delivery destination is an Amazon Web Services resource that represents an Amazon Web Services service that logs can be sent to. CloudWatch Logs, Amazon S3, and Firehose are supported as logs delivery destinations and X-Ray as the trace delivery destination.
To configure logs delivery between a supported Amazon Web Services service and a destination, you must do the following:
- Create a delivery source, which is a logical object that represents the resource that is actually sending the logs. For more information, see PutDeliverySource.
-
Use
PutDeliveryDestinationto create a delivery destination in the same account of the actual delivery destination. The delivery destination that you create is a logical object that represents the actual delivery destination. - If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy in the destination account to assign an IAM policy to the destination. This policy allows delivery to that destination.
-
Use
CreateDeliveryto create a delivery by pairing exactly one delivery source and one delivery destination. For more information, see CreateDelivery.
Only some Amazon Web Services services support being configured as a delivery source. These services are listed as Supported [V2 Permissions] in the table at Enabling logging from Amazon Web Services services.
If you use this operation to update an existing delivery destination, all the current delivery destination parameters are overwritten with the new parameter values that you specify.
May throw ConflictException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw ValidationException.
Parameter name :
A name for this delivery destination. This name must be unique for all
delivery destinations in your account.
Parameter deliveryDestinationConfiguration :
A structure that contains the ARN of the Amazon Web Services resource that
will receive the logs.
Parameter deliveryDestinationType :
The type of delivery destination. This parameter specifies the target
service where log data will be delivered. Valid values include:
-
S3- Amazon S3 for long-term storage and analytics -
CWL- CloudWatch Logs for centralized log management -
FH- Amazon Kinesis Data Firehose for real-time data streaming -
XRAY- Amazon Web Services X-Ray for distributed tracing and application monitoring
Parameter outputFormat :
The format for the logs that this delivery destination will receive.
Parameter tags :
An optional list of key-value pairs to associate with the resource.
For more information about tagging, see Tagging Amazon Web Services resources
Implementation
Future<PutDeliveryDestinationResponse> putDeliveryDestination({
required String name,
DeliveryDestinationConfiguration? deliveryDestinationConfiguration,
DeliveryDestinationType? deliveryDestinationType,
OutputFormat? outputFormat,
Map<String, String>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Logs_20140328.PutDeliveryDestination'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'name': name,
if (deliveryDestinationConfiguration != null)
'deliveryDestinationConfiguration': deliveryDestinationConfiguration,
if (deliveryDestinationType != null)
'deliveryDestinationType': deliveryDestinationType.value,
if (outputFormat != null) 'outputFormat': outputFormat.value,
if (tags != null) 'tags': tags,
},
);
return PutDeliveryDestinationResponse.fromJson(jsonResponse.body);
}