Skip to content

create_access_log_subscription

create_access_log_subscription(
    resource_identifier: ResourceIdentifier,
    destination_arn: AccessLogDestinationArn,
    *,
    config_overrides: Optional[VPCLatticeClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    service_network_log_type: Optional[ServiceNetworkLogType] = None,
    tags: Optional[TagMap] = None,
) -> CreateAccessLogSubscriptionResponse

Enables access logs to be sent to Amazon CloudWatch, Amazon S3, and Amazon Kinesis Data Firehose. The service network owner can use the access logs to audit the services in the network. The service network owner can only see access logs from clients and services that are associated with their service network. Access log entries represent traffic originated from VPCs associated with that network. For more information, see Access logs in the Amazon VPC Lattice User Guide.

Parameters:

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token and parameters, the retry succeeds without performing any actions. If the parameters aren't identical, the retry fails.

  • resource_identifier (ResourceIdentifier) –

    The ID or ARN of the service network or service.

  • destination_arn (AccessLogDestinationArn) –

    The Amazon Resource Name (ARN) of the destination. The supported destination types are CloudWatch Log groups, Kinesis Data Firehose delivery streams, and Amazon S3 buckets.

  • service_network_log_type (Optional[ServiceNetworkLogType], default: None ) –

    The type of log that monitors your Amazon VPC Lattice service networks.

  • tags (Optional[TagMap], default: None ) –

    The tags for the access log subscription.

Raises:

Source code in docs_src/capo_vpc_lattice/_services/vpc_lattice.py
def create_access_log_subscription(
    self,
    resource_identifier: "capo_vpc_lattice.types.resource_identifier.ResourceIdentifier",
    destination_arn: "capo_vpc_lattice.types.access_log_destination_arn.AccessLogDestinationArn",
    *,
    config_overrides: Optional[VPCLatticeClientConfig] = None,
    client_token: Optional[
        "capo_vpc_lattice.types.client_token.ClientToken"
    ] = None,
    service_network_log_type: Optional[
        "capo_vpc_lattice.types.service_network_log_type.ServiceNetworkLogType"
    ] = None,
    tags: Optional["capo_vpc_lattice.types.tag_map.TagMap"] = None,
) -> "capo_vpc_lattice.types.create_access_log_subscription_response.CreateAccessLogSubscriptionResponse":
    """<p>Enables access logs to be sent to Amazon CloudWatch, Amazon S3, and Amazon Kinesis Data Firehose. The service network owner can use the access logs to audit the services in the network. The service network owner can only see access logs from clients and services that are associated with their service network. Access log entries represent traffic originated from VPCs associated with that network. For more information, see <a href="https://docs.aws.amazon.com/vpc-lattice/latest/ug/monitoring-access-logs.html">Access logs</a> in the <i>Amazon VPC Lattice User Guide</i>.</p>

    Args:
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token and parameters, the retry succeeds without performing any actions. If the parameters aren't identical, the retry fails.</p>
        resource_identifier: <p>The ID or ARN of the service network or service.</p>
        destination_arn: <p>The Amazon Resource Name (ARN) of the destination. The supported destination types are CloudWatch Log groups, Kinesis Data Firehose delivery streams, and Amazon S3 buckets.</p>
        service_network_log_type: <p>The type of log that monitors your Amazon VPC Lattice service networks.</p>
        tags: <p>The tags for the access log subscription.</p>

    Raises:
        capo_vpc_lattice.errors.access_denied_exception.AccessDeniedException: <p>The user does not have sufficient access to perform this action.</p>
        capo_vpc_lattice.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. Updating or deleting a resource can cause an inconsistent state.</p>
        capo_vpc_lattice.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred while processing the request.</p>
        capo_vpc_lattice.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist.</p>
        capo_vpc_lattice.errors.throttling_exception.ThrottlingException: <p>The limit on the number of requests per second was exceeded.</p>
        capo_vpc_lattice.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_vpc_lattice.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_vpc_lattice.types.create_access_log_subscription_request.CreateAccessLogSubscriptionRequest]",
    ) -> OperationResponse[
        "capo_vpc_lattice.types.create_access_log_subscription_response.CreateAccessLogSubscriptionResponse"
    ]:
        import capo_vpc_lattice._operations.mercury_control_plane.create_access_log_subscription

        output, http_response = (
            capo_vpc_lattice._operations.mercury_control_plane.create_access_log_subscription.create_access_log_subscription(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAccessLogSubscription")
    )
    input_: capo_vpc_lattice.types.create_access_log_subscription_request.CreateAccessLogSubscriptionRequest = {
        "resource_identifier": resource_identifier,
        "destination_arn": destination_arn,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if service_network_log_type is not None:
        input_["service_network_log_type"] = service_network_log_type
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output