Creates or updates a destination. This operation is used only to create destinations for cross-account subscriptions.
A destination encapsulates a physical resource (such as an Amazon Kinesis stream). With a destination, you can subscribe to a real-time stream of log events for a different account, ingested using PutLogEvents.
Through an access policy, a destination controls what is written to it. By default, PutDestination does not set any access policy with the destination, which means a cross-account user cannot call PutSubscriptionFilter against this destination. To enable this, the destination owner must call PutDestinationPolicy after PutDestination.
To perform a PutDestination operation, you must also have the iam:PassRole permission.
Parameters:
-
destination_name
(DestinationName)
–
A name for the destination.
-
target_arn
(TargetArn)
–
The ARN of an Amazon Kinesis stream to which to deliver matching log events.
-
role_arn
(RoleArn)
–
The ARN of an IAM role that grants CloudWatch Logs permissions to call the Amazon Kinesis PutRecord operation on the destination stream.
-
tags
(Optional[Tags], default:
None
)
–
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/async_cloud_watch_logs.py
| async def put_destination(
self,
destination_name: "capo_cloudwatch_logs.types.destination_name.DestinationName",
target_arn: "capo_cloudwatch_logs.types.target_arn.TargetArn",
role_arn: "capo_cloudwatch_logs.types.role_arn.RoleArn",
*,
config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
tags: Optional["capo_cloudwatch_logs.types.tags.Tags"] = None,
) -> "capo_cloudwatch_logs.types.put_destination_response.PutDestinationResponse":
"""<p>Creates or updates a destination. This operation is used only to create destinations for cross-account subscriptions.</p> <p>A destination encapsulates a physical resource (such as an Amazon Kinesis stream). With a destination, you can subscribe to a real-time stream of log events for a different account, ingested using <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html">PutLogEvents</a>.</p> <p>Through an access policy, a destination controls what is written to it. By default, <code>PutDestination</code> does not set any access policy with the destination, which means a cross-account user cannot call <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutSubscriptionFilter.html">PutSubscriptionFilter</a> against this destination. To enable this, the destination owner must call <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestinationPolicy.html">PutDestinationPolicy</a> after <code>PutDestination</code>.</p> <p>To perform a <code>PutDestination</code> operation, you must also have the <code>iam:PassRole</code> permission.</p>
Args:
destination_name: <p>A name for the destination.</p>
target_arn: <p>The ARN of an Amazon Kinesis stream to which to deliver matching log events.</p>
role_arn: <p>The ARN of an IAM role that grants CloudWatch Logs permissions to call the Amazon Kinesis <code>PutRecord</code> operation on the destination stream.</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.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
capo_cloudwatch_logs.errors.operation_aborted_exception.OperationAbortedException: <p>Multiple concurrent requests to update the same resource were in conflict.</p>
capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</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_destination_request.PutDestinationRequest]",
) -> AsyncOperationResponse[
"capo_cloudwatch_logs.types.put_destination_response.PutDestinationResponse"
]:
import capo_cloudwatch_logs._operations.logs_20140328.put_destination
(
output,
http_response,
) = await capo_cloudwatch_logs._operations.logs_20140328.put_destination.async_put_destination(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutDestination")
)
input_: capo_cloudwatch_logs.types.put_destination_request.PutDestinationRequest = {
"destination_name": destination_name,
"target_arn": target_arn,
"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
|