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 PutDeliveryDestination to 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 CreateDelivery to create a delivery by pairing exactly one delivery source and one delivery destination. For more information, see CreateDelivery.
You can configure a single delivery source to send logs to multiple destinations by creating multiple deliveries. You can also create multiple deliveries to configure multiple delivery sources to send logs to the same delivery destination.
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.
Parameters:
-
name
(DeliveryDestinationName)
–
A name for this delivery destination. This name must be unique for all delivery destinations in your account.
-
output_format
(Optional[OutputFormat], default:
None
)
–
The format for the logs that this delivery destination will receive.
-
delivery_destination_configuration
(Optional[DeliveryDestinationConfiguration], default:
None
)
–
A structure that contains the ARN of the Amazon Web Services resource that will receive the logs.
deliveryDestinationConfiguration is required for CloudWatch Logs, Amazon S3, Firehose log delivery destinations and not required for X-Ray trace delivery destinations. deliveryDestinationType is needed for X-Ray trace delivery destinations but not required for other logs delivery destinations.
-
delivery_destination_type
(Optional[DeliveryDestinationType], default:
None
)
–
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
The delivery destination type determines the format and configuration options available for log delivery.
-
role_arn
(Optional[Arn], default:
None
)
–
The ARN of an IAM role in your account that CloudWatch Logs assumes to deliver to this delivery destination. The trust policy of the role must allow CloudWatch Logs to assume it. This parameter is supported only for X-Ray trace delivery destinations.
-
tags
(Optional[Tags], default:
None
)
–
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/async_cloud_watch_logs.py
| async def put_delivery_destination(
self,
name: "capo_cloudwatch_logs.types.delivery_destination_name.DeliveryDestinationName",
*,
config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
output_format: Optional[
"capo_cloudwatch_logs.types.output_format.OutputFormat"
] = None,
delivery_destination_configuration: Optional[
"capo_cloudwatch_logs.types.delivery_destination_configuration.DeliveryDestinationConfiguration"
] = None,
delivery_destination_type: Optional[
"capo_cloudwatch_logs.types.delivery_destination_type.DeliveryDestinationType"
] = None,
role_arn: Optional["capo_cloudwatch_logs.types.arn.Arn"] = None,
tags: Optional["capo_cloudwatch_logs.types.tags.Tags"] = None,
) -> "capo_cloudwatch_logs.types.put_delivery_destination_response.PutDeliveryDestinationResponse":
"""<p>Creates or updates a logical <i>delivery destination</i>. 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.</p> <p>To configure logs delivery between a supported Amazon Web Services service and a destination, you must do the following:</p> <ul> <li> <p>Create a delivery source, which is a logical object that represents the resource that is actually sending the logs. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html">PutDeliverySource</a>.</p> </li> <li> <p>Use <code>PutDeliveryDestination</code> to create a <i>delivery destination</i> 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. </p> </li> <li> <p>If you are delivering logs cross-account, you must use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html">PutDeliveryDestinationPolicy</a> in the destination account to assign an IAM policy to the destination. This policy allows delivery to that destination. </p> </li> <li> <p>Use <code>CreateDelivery</code> to create a <i>delivery</i> by pairing exactly one delivery source and one delivery destination. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html">CreateDelivery</a>. </p> </li> </ul> <p>You can configure a single delivery source to send logs to multiple destinations by creating multiple deliveries. You can also create multiple deliveries to configure multiple delivery sources to send logs to the same delivery destination.</p> <p>Only some Amazon Web Services services support being configured as a delivery source. These services are listed as <b>Supported [V2 Permissions]</b> in the table at <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html">Enabling logging from Amazon Web Services services.</a> </p> <p>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.</p>
Args:
name: <p>A name for this delivery destination. This name must be unique for all delivery destinations in your account.</p>
output_format: <p>The format for the logs that this delivery destination will receive.</p>
delivery_destination_configuration: <p>A structure that contains the ARN of the Amazon Web Services resource that will receive the logs.</p> <note> <p> <code>deliveryDestinationConfiguration</code> is required for CloudWatch Logs, Amazon S3, Firehose log delivery destinations and not required for X-Ray trace delivery destinations. <code>deliveryDestinationType</code> is needed for X-Ray trace delivery destinations but not required for other logs delivery destinations.</p> </note>
delivery_destination_type: <p>The type of delivery destination. This parameter specifies the target service where log data will be delivered. Valid values include:</p> <ul> <li> <p> <code>S3</code> - Amazon S3 for long-term storage and analytics</p> </li> <li> <p> <code>CWL</code> - CloudWatch Logs for centralized log management</p> </li> <li> <p> <code>FH</code> - Amazon Kinesis Data Firehose for real-time data streaming</p> </li> <li> <p> <code>XRAY</code> - Amazon Web Services X-Ray for distributed tracing and application monitoring</p> </li> </ul> <p>The delivery destination type determines the format and configuration options available for log delivery.</p>
role_arn: <p>The ARN of an IAM role in your account that CloudWatch Logs assumes to deliver to this delivery destination. The trust policy of the role must allow CloudWatch Logs to assume it. This parameter is supported only for X-Ray trace delivery destinations.</p>
tags: <p>An optional list of key-value pairs to associate with the resource.</p> <p>For more information about tagging, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a> </p>
Raises:
capo_cloudwatch_logs.errors.conflict_exception.ConflictException: <p>This operation attempted to create a resource that already exists.</p>
capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
capo_cloudwatch_logs.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This request exceeds a service quota.</p>
capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
capo_cloudwatch_logs.errors.throttling_exception.ThrottlingException: <p>The request was throttled because of quota limits.</p>
capo_cloudwatch_logs.errors.validation_exception.ValidationException: <p>One of the parameters for the request is not valid.</p>
capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_cloudwatch_logs.types.put_delivery_destination_request.PutDeliveryDestinationRequest]",
) -> AsyncOperationResponse[
"capo_cloudwatch_logs.types.put_delivery_destination_response.PutDeliveryDestinationResponse"
]:
import capo_cloudwatch_logs._operations.logs_20140328.put_delivery_destination
(
output,
http_response,
) = await capo_cloudwatch_logs._operations.logs_20140328.put_delivery_destination.async_put_delivery_destination(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutDeliveryDestination")
)
input_: capo_cloudwatch_logs.types.put_delivery_destination_request.PutDeliveryDestinationRequest = {
"name": name
}
if output_format is not None:
input_["output_format"] = output_format
if delivery_destination_configuration is not None:
input_["delivery_destination_configuration"] = (
delivery_destination_configuration
)
if delivery_destination_type is not None:
input_["delivery_destination_type"] = delivery_destination_type
if role_arn is not None:
input_["role_arn"] = role_arn
if tags is not None:
input_["tags"] = tags
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|