diff --git a/moto/events/models.py b/moto/events/models.py index 0885d8d4b..2422e0b51 100644 --- a/moto/events/models.py +++ b/moto/events/models.py @@ -211,7 +211,7 @@ class EventsBackend(BaseBackend): raise NotImplementedError() def put_permission(self, action, principal, statement_id): - if action is None or action != 'PutEvents': + if action is None or action != 'events:PutEvents': raise JsonRESTError('InvalidParameterValue', 'Action must be PutEvents') if principal is None or self.ACCOUNT_ID.match(principal) is None: @@ -236,7 +236,7 @@ class EventsBackend(BaseBackend): 'Sid': statement_id, 'Effect': 'Allow', 'Principal': {'AWS': 'arn:aws:iam::{0}:root'.format(data['principal'])}, - 'Action': 'events:{0}'.format(data['action']), + 'Action': data['action'], 'Resource': arn }) policy = {'Version': '2012-10-17', 'Statement': statements} diff --git a/tests/test_events/test_events.py b/tests/test_events/test_events.py index 835b3b283..80630c5b8 100644 --- a/tests/test_events/test_events.py +++ b/tests/test_events/test_events.py @@ -178,8 +178,8 @@ def test_remove_targets(): def test_permissions(): client = boto3.client('events', 'eu-central-1') - client.put_permission(Action='PutEvents', Principal='111111111111', StatementId='Account1') - client.put_permission(Action='PutEvents', Principal='222222222222', StatementId='Account2') + client.put_permission(Action='events:PutEvents', Principal='111111111111', StatementId='Account1') + client.put_permission(Action='events:PutEvents', Principal='222222222222', StatementId='Account2') resp = client.describe_event_bus() resp_policy = json.loads(resp['Policy'])