Skip to content

Commit

Permalink
chore(integ-tests): revert add waiterProvider to IApiCall (#28457)
Browse files Browse the repository at this point in the history
Reverts #27844. This change broke the pipeline, pacmak fails with:

```
#STDOUT> /tmp/npm-packu6YRYj/Amazon.CDK.IntegTests.Alpha/Amazon/CDK/IntegTests/Alpha/ApiCallBase.cs(231,77): error CS0115: 'ApiCallBase._Proxy.WaiterProvider': no suitable method found to override [/tmp/npm-packu6YRYj/Amazon.CDK.IntegTests.Alpha/Amazon.CDK.IntegTests.Alpha.csproj]
```
  • Loading branch information
comcalvi authored Dec 21, 2023
1 parent 9ca7ba8 commit 16a1a62
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 16a1a62

Please sign in to comment.