Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated SNS Subscription handlers for resource migration. #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions aws-sns-subscription/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ out.java
out/
.settings
.project
inputs/

# auto-generated files
target/

# our logs
rpdk.log
/bin/

# contains credentials
sam-tests/
3 changes: 2 additions & 1 deletion aws-sns-subscription/.rpdk-config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"language": "java",
"runtime": "java8",
"entrypoint": "software.amazon.sns.subscription.HandlerWrapper::handleRequest",
"testEntrypoint": "software.amazon.sns.subscription.HandlerWrapper::testEntrypoint",
"testEntrypoint": "software.amazon.sns.subscription.HandlerWrapper::handleRequest",
"settings": {
"namespace": [
"software",
Expand All @@ -15,5 +15,6 @@
"codegen_template_path": "guided_aws",
"protocolVersion": "2.0.0"
},
"logProcessorEnabled": "true",
"executableEntrypoint": "software.amazon.sns.subscription.HandlerWrapperExecutable"
}
32 changes: 12 additions & 20 deletions aws-sns-subscription/aws-sns-subscription.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"description": "The filter policy JSON assigned to the subscription. Enables the subscriber to filter out unwanted messages. For more information, see [GetSubscriptionAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetSubscriptionAttributes.html) in the <i>Amazon Simple Notification Service API Reference</i> and [Message Filtering](https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html) in the <i>Amazon SNS Developer Guide</i>.",
"type": "object"
},
"FilterPolicyScope": {
"description": "This attribute lets you choose the filtering scope.",
"type": "string"
},
"RedrivePolicy": {
"description": "When specified, sends undeliverable messages to the specified Amazon SQS dead-letter queue. Messages that can't be delivered due to client errors (for example, when the subscribed endpoint is unreachable) or server errors (for example, when the service that powers the subscribed endpoint becomes unavailable) are held in the dead-letter queue for further analysis or reprocessing.",
"type": "object"
Expand Down Expand Up @@ -77,47 +81,35 @@
"readOnlyProperties": [
"/properties/SubscriptionArn"
],
"writeOnlyProperties": [
"/properties/Region"
],
"handlers": {
"create": {
"permissions": [
"sns:Subscribe",
"sns:GetSubscriptionAttributes",
"sns:GetTopicAttributes",
"iam:GetRole",
"iam:PassRole",
"iam:PutRolePolicy"
"sns:Subscribe"
]
},
"read": {
"permissions": [
"sns:GetSubscriptionAttributes",
"sns:GetTopicAttributes"
"sns:GetSubscriptionAttributes"
]
},
"update": {
"permissions": [
"sns:SetSubscriptionAttributes",
"sns:GetSubscriptionAttributes",
"sns:GetTopicAttributes",
"iam:GetRole",
"iam:PassRole",
"iam:PutRolePolicy",
"iam:UpdateRole"
"sns:GetSubscriptionAttributes"
]
},
"delete": {
"permissions": [
"sns:GetSubscriptionAttributes",
"sns:GetTopicAttributes",
"sns:Unsubscribe",
"iam:DeleteRolePolicy",
"iam:DetachRolePolicy"
"sns:GetSubscriptionAttributes"
]
},
"list": {
"permissions": [
"sns:GetTopicAttributes",
"sns:ListSubscriptionsByTopic"
"sns:ListSubscriptions"
]
}
}
Expand Down
13 changes: 13 additions & 0 deletions aws-sns-subscription/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy
"<a href="#subscriptionrolearn" title="SubscriptionRoleArn">SubscriptionRoleArn</a>" : <i>String</i>,
"<a href="#topicarn" title="TopicArn">TopicArn</a>" : <i>String</i>,
"<a href="#filterpolicy" title="FilterPolicy">FilterPolicy</a>" : <i>Map</i>,
"<a href="#filterpolicyscope" title="FilterPolicyScope">FilterPolicyScope</a>" : <i>String</i>,
"<a href="#redrivepolicy" title="RedrivePolicy">RedrivePolicy</a>" : <i>Map</i>
}
}
Expand All @@ -38,6 +39,7 @@ Properties:
<a href="#subscriptionrolearn" title="SubscriptionRoleArn">SubscriptionRoleArn</a>: <i>String</i>
<a href="#topicarn" title="TopicArn">TopicArn</a>: <i>String</i>
<a href="#filterpolicy" title="FilterPolicy">FilterPolicy</a>: <i>Map</i>
<a href="#filterpolicyscope" title="FilterPolicyScope">FilterPolicyScope</a>: <i>String</i>
<a href="#redrivepolicy" title="RedrivePolicy">RedrivePolicy</a>: <i>Map</i>
</pre>

Expand Down Expand Up @@ -134,6 +136,16 @@ _Type_: Map

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### FilterPolicyScope

This attribute lets you choose the filtering scope.

_Required_: No

_Type_: String

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### RedrivePolicy

When specified, sends undeliverable messages to the specified Amazon SQS dead-letter queue. Messages that can't be delivered due to client errors (for example, when the subscribed endpoint is unreachable) or server errors (for example, when the service that powers the subscribed endpoint becomes unavailable) are held in the dead-letter queue for further analysis or reprocessing.
Expand All @@ -159,3 +171,4 @@ For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::G
#### SubscriptionArn

This is the subscription amazon resource name generated at creation time.

9 changes: 1 addition & 8 deletions aws-sns-subscription/resource-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@ Resources:
Statement:
- Effect: Allow
Action:
- "iam:DeleteRolePolicy"
- "iam:DetachRolePolicy"
- "iam:GetRole"
- "iam:PassRole"
- "iam:PutRolePolicy"
- "iam:UpdateRole"
- "sns:GetSubscriptionAttributes"
- "sns:GetTopicAttributes"
- "sns:ListSubscriptionsByTopic"
- "sns:ListSubscriptions"
- "sns:SetSubscriptionAttributes"
- "sns:Subscribe"
- "sns:Unsubscribe"
Expand Down
Loading