Skip to content

Commit

Permalink
renaming method
Browse files Browse the repository at this point in the history
  • Loading branch information
DaWyz committed Mar 6, 2021
1 parent 2a06e42 commit 8709cb9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,5 @@ Then, you can use the `grantPut` method to grant `event:PutEvents` to the eventB
const eventBus = EventBus.fromEventBusArn(this, 'ImportedEventBus', 'arn:aws:events:us-east-1:111111111:event-bus/my-event-bus');

// now you can just call methods on the eventbus
eventBus.grantPut(lambdaFunction);
```
eventBus.grantPutEventsTo(lambdaFunction);
```
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-events/lib/event-bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface IEventBus extends IResource {
*
* @param grantee The principal (no-op if undefined)
*/
grantPut(grantee: iam.IGrantable): iam.Grant;
grantPutEventsTo(grantee: iam.IGrantable): iam.Grant;
}

/**
Expand Down Expand Up @@ -146,7 +146,7 @@ abstract class EventBusBase extends Resource implements IEventBus {
});
}

public grantPut(grantee: iam.IGrantable): iam.Grant {
public grantPutEventsTo(grantee: iam.IGrantable): iam.Grant {
return iam.Grant.addToPrincipal({
grantee,
actions: ['events:PutEvents'],
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events/test/test.event-bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export = {
const eventBus = new EventBus(stack, 'EventBus');

// WHEN
eventBus.grantPut(role);
eventBus.grantPutEventsTo(role);

// THEN
expect(stack).to(haveResource('AWS::IAM::Policy', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class EventBridgeDestination implements lambda.IDestination {
* Returns a destination configuration
*/
public bind(_scope: Construct, fn: lambda.IFunction, _options?: lambda.DestinationOptions): lambda.DestinationConfig {
this.eventBus.grantPut(fn);
this.eventBus.grantPutEventsTo(fn);

return {
destination: this.eventBus && this.eventBus.eventBusArn || Stack.of(fn).formatArn({
Expand Down

0 comments on commit 8709cb9

Please sign in to comment.