> **Experimental**
>
> `@aws-cdk/integ-tests-alpha` is an [**experimental**](/stability) (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

Extends: Construct › AssertionsProvider
Implements: IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/assertions/providers/provider.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0-alpha.0/packages/@aws-cdk/integ-tests-alpha/lib/assertions/providers/provider.ts#L242)

## 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',
});
```

## Initializer

```ts
new AssertionsProvider(scope: Construct, id: string, props?: AssertionsProviderProps)
```

## Construct Props

- `handler`: string = index.handler — The handler to use for the lambda function.

- `logRetention`: [RetentionDays](/cdk/api/v2/docs/aws-cdk-lib.aws_logs.RetentionDays.html) — How long, in days, the log contents will be retained.

  **Default:** no retention days specified

- `providerLogLevel`: [ApplicationLogLevel](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.ApplicationLogLevel.html) = ApplicationLogLevel.FATAL — The log level of the provider lambda function.

- `uuid`: string — This determines the uniqueness of each AssertionsProvider.

  **Default:** the default uuid is used

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

## Properties

- `handlerRoleArn`: [Reference](/cdk/api/v2/docs/aws-cdk-lib.Reference.html) (required) — A reference to the provider Lambda Function execution Role ARN.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) (required) — The tree node.

- `serviceToken`: string (required) — The ARN of the lambda function which can be used as a serviceToken to a CustomResource.

## Methods

- `addPolicyStatementFromSdkCall(service: string, api: string, resources?: string[]): void` — Create a policy statement from a specific api call.

- `addToRolePolicy(statement: any): void` — 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.

  ```ts
  declare const provider: AssertionsProvider;
  provider.addToRolePolicy({
    Effect: 'Allow',
    Action: ['s3:GetObject'],
    Resource: ['*'],
  });
  ```

- `encode(obj: any): 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: string): void` — Grant a principal access to invoke the assertion provider lambda function [disable-awslint:no-grants].

  **Parameters**

  - `principalArn` — the ARN of the principal that should be given permission to invoke the assertion provider.

- `isConstruct(x: any): boolean` (static) — 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 object.

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

- `toString(): string` — Returns a string representation of this construct.

- `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.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
