> **Experimental**
>
> `@aws-cdk/integ-tests-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (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](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html) › AssertionsProvider
Implements: [IConstruct](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.IConstruct.html), [IDependable](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.IDependable.html)

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

## Example

TypeScript:

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

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

```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();
```

C# / .NET:

```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"
});
```

Golang:

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

TypeScript:

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

Python:

```python
AssertionsProvider(scope: Construct, id: str, props: typing.Optional[AssertionsProviderProps] = None)
```

Java:

```java
new AssertionsProvider(Construct scope, String id, AssertionsProviderProps props)
```

C# / .NET:

```csharp
new AssertionsProvider(Construct scope, string id, AssertionsProviderProps? props = null)
```

Golang:

```go
NewAssertionsProvider(Scope Construct, Id *string, Props AssertionsProviderProps)
```

## Construct Props

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

- `logRetention`: [RetentionDays](https://docs.aws.amazon.com/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](https://docs.aws.amazon.com/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](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Reference.html) — A reference to the provider Lambda Function execution Role ARN.

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

- `serviceToken`: string — 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
