Skip to content
v2.278.0

Logging Class ​

A class used to configure Logging during AwsCustomResource SDK calls.

Example ​

ts
const getParameter = new cr.AwsCustomResource(this, 'GetParameter', {
  onUpdate: {
    service: 'SSM',
    action: 'GetParameter',
    parameters: {
      Name: 'my-parameter',
      WithDecryption: true,
    },
    physicalResourceId: cr.PhysicalResourceId.of(Date.now().toString()),
    logging: cr.Logging.withDataHidden(),
  },
  policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
    resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE,
  }),
});
python
get_parameter = cr.AwsCustomResource(self, "GetParameter",
    on_update=cr.AwsSdkCall(
        service="SSM",
        action="GetParameter",
        parameters={
            "Name": "my-parameter",
            "WithDecryption": True
        },
        physical_resource_id=cr.PhysicalResourceId.of(Date.now().to_string()),
        logging=cr.Logging.with_data_hidden()
    ),
    policy=cr.AwsCustomResourcePolicy.from_sdk_calls(
        resources=cr.AwsCustomResourcePolicy.ANY_RESOURCE
    )
)
java
AwsCustomResource getParameter = AwsCustomResource.Builder.create(this, "GetParameter")
        .onUpdate(AwsSdkCall.builder()
                .service("SSM")
                .action("GetParameter")
                .parameters(Map.of(
                        "Name", "my-parameter",
                        "WithDecryption", true))
                .physicalResourceId(PhysicalResourceId.of(Date.now().toString()))
                .logging(Logging.withDataHidden())
                .build())
        .policy(AwsCustomResourcePolicy.fromSdkCalls(SdkCallsPolicyOptions.builder()
                .resources(AwsCustomResourcePolicy.ANY_RESOURCE)
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var getParameter = new AwsCustomResource(this, "GetParameter", new AwsCustomResourceProps {
    OnUpdate = new AwsSdkCall {
        Service = "SSM",
        Action = "GetParameter",
        Parameters = new Dictionary<string, object> {
            { "Name", "my-parameter" },
            { "WithDecryption", true }
        },
        PhysicalResourceId = PhysicalResourceId.Of(Date.Now().ToString()),
        Logging = Logging.WithDataHidden()
    },
    Policy = AwsCustomResourcePolicy.FromSdkCalls(new SdkCallsPolicyOptions {
        Resources = AwsCustomResourcePolicy.ANY_RESOURCE
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
getParameter := cr.NewAwsCustomResource(this, jsii.String("GetParameter"), &AwsCustomResourceProps{
	OnUpdate: &AwsSdkCall{
		Service: jsii.String("SSM"),
		Action: jsii.String("GetParameter"),
		Parameters: map[string]interface{}{
			"Name": jsii.String("my-parameter"),
			"WithDecryption": jsii.Boolean(true),
		},
		PhysicalResourceId: cr.PhysicalResourceId_Of(date.now().toString()),
		Logging: cr.Logging_WithDataHidden(),
	},
	Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
		Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
	}),
})

Methods ​

all(): Logging // chainable@staticmethod def all() -> Loggingpublic static Logging all()public static Logging All()func All() Logging static #
Enables logging of all logged data in the lambda handler.

This includes the event object, the API call response, all fields in the response object returned by the lambda, and any errors encountered.

withDataHidden(): Logging // chainable@staticmethod def with_data_hidden() -> Loggingpublic static Logging withDataHidden()public static Logging WithDataHidden()func WithDataHidden() Logging static #
Hides logging of data associated with the API call response.

This includes hiding the raw API call response and the Data field associated with the lambda handler response.