Class AccessLogFormat

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.apigateway.AccessLogFormat
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-17T05:10:04.964Z") @Stability(Stable) public class AccessLogFormat extends software.amazon.jsii.JsiiObject
factory methods for access log format.

Example:

 Bucket destinationBucket = new Bucket(this, "Bucket");
 Role deliveryStreamRole = Role.Builder.create(this, "Role")
         .assumedBy(new ServicePrincipal("firehose.amazonaws.com"))
         .build();
 CfnDeliveryStream stream = CfnDeliveryStream.Builder.create(this, "MyStream")
         .deliveryStreamName("amazon-apigateway-delivery-stream")
         .s3DestinationConfiguration(S3DestinationConfigurationProperty.builder()
                 .bucketArn(destinationBucket.getBucketArn())
                 .roleArn(deliveryStreamRole.getRoleArn())
                 .build())
         .build();
 RestApi api = RestApi.Builder.create(this, "books")
         .deployOptions(StageOptions.builder()
                 .accessLogDestination(new FirehoseLogDestination(stream))
                 .accessLogFormat(AccessLogFormat.jsonWithStandardFields())
                 .build())
         .build();
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AccessLogFormat(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    AccessLogFormat(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    clf()
    Generate Common Log Format.
    custom(String format)
    Custom log format.
    Access log will be produced in the JSON format with a set of fields most useful in the access log.
    Access log will be produced in the JSON format with a set of fields most useful in the access log.
    Output a format string to be used with CloudFormation.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • AccessLogFormat

      protected AccessLogFormat(software.amazon.jsii.JsiiObjectRef objRef)
    • AccessLogFormat

      protected AccessLogFormat(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • clf

      @Stability(Stable) @NotNull public static AccessLogFormat clf()
      Generate Common Log Format.
    • custom

      @Stability(Stable) @NotNull public static AccessLogFormat custom(@NotNull String format)
      Custom log format.

      You can create any log format string. You can easily get the $ context variable by using the methods of AccessLogField.

      Example:

       AccessLogFormat.custom(JSON.stringify(Map.of(
               "requestId", AccessLogField.contextRequestId(),
               "sourceIp", AccessLogField.contextIdentitySourceIp(),
               "method", AccessLogField.contextHttpMethod(),
               "userContext", Map.of(
                       "sub", AccessLogField.contextAuthorizerClaims("sub"),
                       "email", AccessLogField.contextAuthorizerClaims("email")))));
       

      Parameters:
      format - This parameter is required.
    • jsonWithStandardFields

      @Stability(Stable) @NotNull public static AccessLogFormat jsonWithStandardFields(@Nullable JsonWithStandardFieldProps fields)
      Access log will be produced in the JSON format with a set of fields most useful in the access log.

      All fields are turned on by default with the option to turn off specific fields.

      Parameters:
      fields -
    • jsonWithStandardFields

      @Stability(Stable) @NotNull public static AccessLogFormat jsonWithStandardFields()
      Access log will be produced in the JSON format with a set of fields most useful in the access log.

      All fields are turned on by default with the option to turn off specific fields.

    • toString

      @Stability(Stable) @NotNull public String toString()
      Output a format string to be used with CloudFormation.
      Overrides:
      toString in class Object