Creates a delivery. A delivery is a connection between a logical delivery source and a logical delivery destination that you have already created.
Only some Amazon Web Services services support being configured as a delivery source using this operation. These services are listed as Supported [V2 Permissions] in the table at Enabling logging from Amazon Web Services services.
A delivery destination can represent a log group in CloudWatch Logs, an Amazon S3 bucket, a delivery stream in Firehose, or X-Ray.
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.
-
Create a delivery destination, which is a logical object that represents the actual delivery destination. For more information, see PutDeliveryDestination.
-
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.
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.
To update an existing delivery configuration, use UpdateDeliveryConfiguration.
Parameters:
-
delivery_source_name
(DeliverySourceName)
–
The name of the delivery source to use for this delivery.
-
delivery_destination_arn
(Arn)
–
The ARN of the delivery destination to use for this delivery.
-
record_fields
(Optional[RecordFields], default:
None
)
–
The list of record fields to be delivered to the destination, in order. If the delivery's log source has mandatory fields, they must be included in this list.
-
field_delimiter
(Optional[FieldDelimiter], default:
None
)
–
The field delimiter to use between record fields when the final output format of a delivery is in Plain, W3C, or Raw format.
-
s3_delivery_configuration
(Optional[S3DeliveryConfiguration], default:
None
)
–
This structure contains parameters that are valid only when the delivery's delivery destination is an S3 bucket.
-
tags
(Optional[Tags], default:
None
)
–
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/async_cloud_watch_logs.py
| async def create_delivery(
self,
delivery_source_name: "capo_cloudwatch_logs.types.delivery_source_name.DeliverySourceName",
delivery_destination_arn: "capo_cloudwatch_logs.types.arn.Arn",
*,
config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
record_fields: Optional[
"capo_cloudwatch_logs.types.record_fields.RecordFields"
] = None,
field_delimiter: Optional[
"capo_cloudwatch_logs.types.field_delimiter.FieldDelimiter"
] = None,
s3_delivery_configuration: Optional[
"capo_cloudwatch_logs.types.s3_delivery_configuration.S3DeliveryConfiguration"
] = None,
tags: Optional["capo_cloudwatch_logs.types.tags.Tags"] = None,
) -> "capo_cloudwatch_logs.types.create_delivery_response.CreateDeliveryResponse":
"""<p>Creates a <i>delivery</i>. A delivery is a connection between a logical <i>delivery source</i> and a logical <i>delivery destination</i> that you have already created.</p> <p>Only some Amazon Web Services services support being configured as a delivery source using this operation. 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>A delivery destination can represent a log group in CloudWatch Logs, an Amazon S3 bucket, a delivery stream in Firehose, or X-Ray.</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>Create a <i>delivery destination</i>, which is a logical object that represents the actual delivery destination. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html">PutDeliveryDestination</a>.</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. </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>To update an existing delivery configuration, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UpdateDeliveryConfiguration.html">UpdateDeliveryConfiguration</a>.</p>
Args:
delivery_source_name: <p>The name of the delivery source to use for this delivery.</p>
delivery_destination_arn: <p>The ARN of the delivery destination to use for this delivery.</p>
record_fields: <p>The list of record fields to be delivered to the destination, in order. If the delivery's log source has mandatory fields, they must be included in this list.</p>
field_delimiter: <p>The field delimiter to use between record fields when the final output format of a delivery is in <code>Plain</code>, <code>W3C</code>, or <code>Raw</code> format.</p>
s3_delivery_configuration: <p>This structure contains parameters that are valid only when the delivery's delivery destination is an S3 bucket.</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.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permissions to perform this action.</p>
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.create_delivery_request.CreateDeliveryRequest]",
) -> AsyncOperationResponse[
"capo_cloudwatch_logs.types.create_delivery_response.CreateDeliveryResponse"
]:
import capo_cloudwatch_logs._operations.logs_20140328.create_delivery
(
output,
http_response,
) = await capo_cloudwatch_logs._operations.logs_20140328.create_delivery.async_create_delivery(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateDelivery")
)
input_: capo_cloudwatch_logs.types.create_delivery_request.CreateDeliveryRequest = {
"delivery_source_name": delivery_source_name,
"delivery_destination_arn": delivery_destination_arn,
}
if record_fields is not None:
input_["record_fields"] = record_fields
if field_delimiter is not None:
input_["field_delimiter"] = field_delimiter
if s3_delivery_configuration is not None:
input_["s3_delivery_configuration"] = s3_delivery_configuration
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
|