Skip to content

Commit

Permalink
Revert "chore(integ-tests): add waiterProvider to IApiCall (#27844)"
Browse files Browse the repository at this point in the history
This reverts commit 9ca7ba8.
  • Loading branch information
comcalvi committed Dec 21, 2023
1 parent 9ca7ba8 commit 93cb8e9
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 1,235 deletions.
29 changes: 0 additions & 29 deletions packages/@aws-cdk/integ-tests-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,32 +522,3 @@ const describe = testCase.assertions.awsApiCall('StepFunctions', 'describeExecut
});
```

When `waitForAssertions()` is used for the `awsApiCall`, the actual API call is executed
by the `waiterProvider` assertion provider.

By default, the `AwsApiCall` construct will automatically add the correct IAM policies
to allow the Lambda function to make the API call. It does this based on the `service`
and `api` that is provided. In the above example the service is `SQS` and the api is
`receiveMessage` so it will create a policy with `Action: 'sqs:ReceiveMessage`.

There are some cases where the permissions do not exactly match the service/api call, for
example the S3 `listObjectsV2` api. In these cases it is possible to add the correct policy
by accessing the `waiterProvider` object.

```ts
declare const integ: IntegTest;

const apiCall = integ.assertions.awsApiCall('S3', 'listObjectsV2', {
Bucket: 'mybucket',
}).waitForAssertions({
totalTimeout: Duration.minutes(5),
interval: Duration.seconds(15),
backoffRate: 3,
});

apiCall.waiterProvider?.addToRolePolicy({
Effect: 'Allow',
Action: ['s3:GetObject', 's3:ListBucket'],
Resource: ['*'],
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { WaiterStateMachineOptions } from './waiter-state-machine';
*/
export interface IApiCall extends IConstruct {
/**
* Access the AssertionsProvider. This can be used to add additional IAM policies
* to the provider role policy.
* access the AssertionsProvider. This can be used to add additional IAM policies
* the the provider role policy
*
* @example
* declare const apiCall: AwsApiCall;
Expand All @@ -22,21 +22,6 @@ export interface IApiCall extends IConstruct {
*/
readonly provider: AssertionsProvider;

/**
* Access the AssertionsProvider for the waiter state machine.
* This can be used to add additional IAM policies
* to the provider role policy.
*
* @example
* declare const apiCall: AwsApiCall;
* apiCall.waiterProvider?.addToRolePolicy({
* Effect: 'Allow',
* Action: ['s3:GetObject'],
* Resource: ['*'],
* });
*/
readonly waiterProvider?: AssertionsProvider;

/**
* Returns the value of an attribute of the custom resource of an arbitrary
* type. Attributes are returned from the custom resource provider through the
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 93cb8e9

Please sign in to comment.