Skip to content
v2.274.0

Experimental

@aws-cdk/integ-tests-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

AssertionsProvider ​

Represents an assertions provider.

The creates a singletone Lambda Function that will create a single function per stack that serves as the custom resource provider for the various assertion providers

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as integ_tests_alpha from '@aws-cdk/integ-tests-alpha';
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_logs as logs } from 'aws-cdk-lib';
const assertionsProvider = new integ_tests_alpha.AssertionsProvider(this, 'MyAssertionsProvider', /* all optional props */ {
  handler: 'handler',
  logRetention: logs.RetentionDays.ONE_DAY,
  providerLogLevel: lambda.ApplicationLogLevel.INFO,
  uuid: 'uuid',
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.integ_tests_alpha as integ_tests_alpha
from aws_cdk import aws_lambda as lambda_
from aws_cdk import aws_logs as logs

assertions_provider = integ_tests_alpha.AssertionsProvider(self, "MyAssertionsProvider",
    handler="handler",
    log_retention=logs.RetentionDays.ONE_DAY,
    provider_log_level=lambda_.ApplicationLogLevel.INFO,
    uuid="uuid"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.integtests.alpha.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.services.logs.*;

AssertionsProvider assertionsProvider = AssertionsProvider.Builder.create(this, "MyAssertionsProvider")
        .handler("handler")
        .logRetention(RetentionDays.ONE_DAY)
        .providerLogLevel(ApplicationLogLevel.INFO)
        .uuid("uuid")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.IntegTests.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.IntegTests.Alpha;
using Amazon.CDK.AWS.Lambda;
using Amazon.CDK.AWS.Logs;

var assertionsProvider = new AssertionsProvider(this, "MyAssertionsProvider", new AssertionsProviderProps {
    Handler = "handler",
    LogRetention = RetentionDays.ONE_DAY,
    ProviderLogLevel = ApplicationLogLevel.INFO,
    Uuid = "uuid"
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import integ_tests_alpha "github.com/aws/aws-cdk-go/awscdkintegtestsalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

assertionsProvider := integ_tests_alpha.NewAssertionsProvider(this, jsii.String("MyAssertionsProvider"), &AssertionsProviderProps{
	Handler: jsii.String("handler"),
	LogRetention: awscdk.Aws_logs.RetentionDays_ONE_DAY,
	ProviderLogLevel: awscdk.Aws_lambda.ApplicationLogLevel_INFO,
	Uuid: jsii.String("uuid"),
})

Initializer ​

ts
new AssertionsProvider(scope: Construct, id: string, props?: AssertionsProviderProps)
python
AssertionsProvider(scope: Construct, id: str, props: typing.Optional[AssertionsProviderProps] = None)
java
new AssertionsProvider(Construct scope, String id, AssertionsProviderProps props)
csharp
new AssertionsProvider(Construct scope, string id, AssertionsProviderProps? props = null)
go
NewAssertionsProvider(Scope Construct, Id *string, Props AssertionsProviderProps)

Construct Props ​

handlerstringhandlerstrhandlerStringHandlerstringHandler*string= index.handler#
The handler to use for the lambda function.
logRetentionRetentionDayslog_retentionRetentionDayslogRetentionRetentionDaysLogRetentionRetentionDaysLogRetentionRetentionDays= no retention days specified#
How long, in days, the log contents will be retained.
providerLogLevelApplicationLogLevelprovider_log_levelApplicationLogLevelproviderLogLevelApplicationLogLevelProviderLogLevelApplicationLogLevelProviderLogLevelApplicationLogLevel= ApplicationLogLevel.FATAL#
The log level of the provider lambda function.
uuidstringuuidstruuidStringUuidstringUuid*string= the default uuid is used#
This determines the uniqueness of each AssertionsProvider.

You should only need to provide something different here if you know that you need a separate provider

Properties ​

handlerRoleArnReferencehandler_role_arnReferencehandlerRoleArnReferenceHandlerRoleArnReferenceHandlerRoleArnReferencerequired#
A reference to the provider Lambda Function execution Role ARN.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
serviceTokenstringservice_tokenstrserviceTokenStringServiceTokenstringServiceToken*stringrequired#
The ARN of the lambda function which can be used as a serviceToken to a CustomResource.

Methods ​

addPolicyStatementFromSdkCall(service: string, api: string, resources?: string[]): voiddef add_policy_statement_from_sdk_call(self, service: str, api: str, resources: typing.Optional[typing.List[str]] = None) -> Nonepublic void addPolicyStatementFromSdkCall(String service, String api, List<String> resources)public void AddPolicyStatementFromSdkCall(string service, string api, string[]? resources = null)func AddPolicyStatementFromSdkCall(Service *string, Api *string, Resources *[]*string)#
Create a policy statement from a specific api call.
addToRolePolicy(statement: any): voiddef add_to_role_policy(self, statement: Any) -> Nonepublic void addToRolePolicy(Object statement)public void AddToRolePolicy(object statement)func AddToRolePolicy(Statement interface{})#
Add an IAM policy statement to the inline policy of the lambdas function's role.

Please note: this is a direct IAM JSON policy blob, not a iam.PolicyStatement object like you will see in the rest of the CDK.

example
ts
declare const provider: AssertionsProvider;
provider.addToRolePolicy({
  Effect: 'Allow',
  Action: ['s3:GetObject'],
  Resource: ['*'],
});
encode(obj: any): anydef encode(self, obj: Any) -> Anypublic Object encode(Object obj)public object Encode(object obj)func Encode(Obj interface{}) interface{}#
Encode an object so it can be passed as custom resource parameters.

Custom resources will convert all input parameters to strings so we encode non-strings here so we can then decode them correctly in the provider function

grantInvoke(principalArn: string): voiddef grant_invoke(self, principal_arn: str) -> Nonepublic void grantInvoke(String principalArn)public void GrantInvoke(string principalArn)func GrantInvoke(PrincipalArn *string)#
Grant a principal access to invoke the assertion provider lambda function [disable-awslint:no-grants].
1 parameter

Parameters

  • principalArnprincipal_arnprincipalArnprincipalArnPrincipalArn — the ARN of the principal that should be given permission to invoke the assertion provider.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining