AssertionsProvider

class aws_cdk.integ_tests_alpha.AssertionsProvider(scope, id, *, uuid=None, handler=None, log_retention=None)

Bases: Construct

(experimental) 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

Stability:

experimental

ExampleMetadata:

fixture=_generated

Example:

# 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_logs as logs

assertions_provider = integ_tests_alpha.AssertionsProvider(self, "MyAssertionsProvider",
    handler="handler",
    log_retention=logs.RetentionDays.ONE_DAY,
    uuid="uuid"
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • uuid (Optional[str]) – (experimental) 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 Default: - the default uuid is used

  • handler (Optional[str]) – (experimental) The handler to use for the lambda function. Default: index.handler

  • log_retention (Optional[RetentionDays]) – (experimental) How long, in days, the log contents will be retained. Default: - no retention days specified

Stability:

experimental

Methods

add_policy_statement_from_sdk_call(service, api, resources=None)

(experimental) Create a policy statement from a specific api call.

Parameters:
  • service (str) –

  • api (str) –

  • resources (Optional[Sequence[str]]) –

Stability:

experimental

Return type:

None

add_to_role_policy(statement)

(experimental) 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.

Parameters:

statement (Any) –

Stability:

experimental

Return type:

None

Example:

# provider: AssertionsProvider

provider.add_to_role_policy({
    "Effect": "Allow",
    "Action": ["s3:GetObject"],
    "Resource": ["*"]
})
encode(obj)

(experimental) 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

Parameters:

obj (Any) –

Stability:

experimental

Return type:

Any

grant_invoke(principal_arn)

(experimental) Grant a principal access to invoke the assertion provider lambda function.

Parameters:

principal_arn (str) – the ARN of the principal that should be given permission to invoke the assertion provider.

Stability:

experimental

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

handler_role_arn

(experimental) A reference to the provider Lambda Function execution Role ARN.

Stability:

experimental

node

The tree node.

service_token

(experimental) The ARN of the lambda function which can be used as a serviceToken to a CustomResource.

Stability:

experimental

Static Methods

classmethod is_construct(x)

Checks if x is a construct.

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:

x (Any) – Any object.

Return type:

bool

Returns:

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