createAccessLogSubscription method

Future<CreateAccessLogSubscriptionResponse> createAccessLogSubscription({
  1. required String destinationArn,
  2. required String resourceIdentifier,
  3. String? clientToken,
  4. ServiceNetworkLogType? serviceNetworkLogType,
  5. Map<String, String>? tags,
})

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.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter destinationArn : 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.

Parameter resourceIdentifier : The ID or ARN of the service network or service.

Parameter clientToken : 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.

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

Parameter tags : The tags for the access log subscription.

Implementation

Future<CreateAccessLogSubscriptionResponse> createAccessLogSubscription({
  required String destinationArn,
  required String resourceIdentifier,
  String? clientToken,
  ServiceNetworkLogType? serviceNetworkLogType,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'destinationArn': destinationArn,
    'resourceIdentifier': resourceIdentifier,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (serviceNetworkLogType != null)
      'serviceNetworkLogType': serviceNetworkLogType.value,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/accesslogsubscriptions',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAccessLogSubscriptionResponse.fromJson(response);
}