class AssertionsProvider (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.IntegTests.Alpha.AssertionsProvider |
Go | github.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2#AssertionsProvider |
Java | software.amazon.awscdk.integtests.alpha.AssertionsProvider |
Python | aws_cdk.integ_tests_alpha.AssertionsProvider |
TypeScript (source) | @aws-cdk/integ-tests-alpha ยป AssertionsProvider |
Implements
IConstruct, IDependable
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
// 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_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,
uuid: 'uuid',
});
Initializer
new AssertionsProvider(scope: Construct, id: string, props?: AssertionsProviderProps)
Parameters
- scope
Construct - id
string - props
AssertionsProvider Props
Construct Props
| Name | Type | Description |
|---|---|---|
| handler? | string | The handler to use for the lambda function. |
| log | Retention | How long, in days, the log contents will be retained. |
| uuid? | string | This determines the uniqueness of each AssertionsProvider. |
handler?
Type:
string
(optional, default: index.handler)
The handler to use for the lambda function.
logRetention?
Type:
Retention
(optional, default: no retention days specified)
How long, in days, the log contents will be retained.
uuid?
Type:
string
(optional, default: 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
| Name | Type | Description |
|---|---|---|
| handler | Reference | A reference to the provider Lambda Function execution Role ARN. |
| node | Node | The tree node. |
| service | string | The ARN of the lambda function which can be used as a serviceToken to a CustomResource. |
handlerRoleArn
Type:
Reference
A reference to the provider Lambda Function execution Role ARN.
node
Type:
Node
The tree node.
serviceToken
Type:
string
The ARN of the lambda function which can be used as a serviceToken to a CustomResource.
Methods
| Name | Description |
|---|---|
| add | Create a policy statement from a specific api call. |
| add | Add an IAM policy statement to the inline policy of the lambdas function's role. |
| encode(obj) | Encode an object so it can be passed as custom resource parameters. |
| grant | Grant a principal access to invoke the assertion provider lambda function [disable-awslint:no-grants]. |
| to | Returns a string representation of this construct. |
| with(...mixins) | Applies one or more mixins to this construct. |
addPolicyStatementFromSdkCall(service, api, resources?)
public addPolicyStatementFromSdkCall(service: string, api: string, resources?: string[]): void
Parameters
- service
string - api
string - resources
string[]
Create a policy statement from a specific api call.
addToRolePolicy(statement)
public addToRolePolicy(statement: any): void
Parameters
- statement
any
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
declare const provider: AssertionsProvider;
provider.addToRolePolicy({
Effect: 'Allow',
Action: ['s3:GetObject'],
Resource: ['*'],
});
encode(obj)
public encode(obj: any): any
Parameters
- obj
any
Returns
any
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)
public grantInvoke(principalArn: string): void
Parameters
- principalArn
stringโ the ARN of the principal that should be given permission to invoke the assertion provider.
Grant a principal access to invoke the assertion provider lambda function [disable-awslint:no-grants].
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
with(...mixins)
public with(...mixins: IMixin[]): IConstruct
Parameters
- mixins
IMixinโ The mixins to apply.
Returns
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.

.NET
Go
Java
Python
TypeScript (