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

[WIP/Request Review] New Resource: aws_ses_identity_notification_topic #946

Closed
wants to merge 3 commits into from

Conversation

benoj
Copy link

@benoj benoj commented Jun 22, 2017

Attempts to resolve #931

Would like some feedback on general style and testing?

@radeksimko radeksimko added the new-resource Introduces a new resource. label Jul 3, 2017
Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @benoj

Sorry for the long silence, we failed terribly here!

Just made a first review of the work! there are a few things to address, but this is getting into shape :)

Also, it would be nice to add acceptance testing (you can have a look at other *_test.go files in the aws package, as in resource_aws_cloudwatch_dashboard_test.go) and the related documentation! 🚀

Do you need more help on testing?

Keep going!

SnsTopic: aws.String(topic),
}

_, err := conn.SetIdentityNotificationTopicRequest(setOpts).Send()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should always call the non-request method (e.g. SetIdentityNotificationTopic), because it handles some logic for us


notificationAttributes := response.NotificationAttributes[identity]
switch notification {
case "Bounce":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be nice to rely on the constants provided by the SDK in places where we can used them, so that we avoid any typo.
For instance, using ses.NotificationTypeBounce, ses.NotificationTypeComplain, etc.

Schema: map[string]*schema.Schema{
"topic_arn": &schema.Schema{
Type: schema.TypeString,
Required: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to set Optional: true rather than Required: true: even though the logic is somehow the same, it's easier to read the code 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we need to add a ValidateFunc: validateArn, attribute, so that it uses a function to validate the value passed in the configuration. validateArn is an existing function that validates the format using a given RegExp, so you don't nee much more here :)

For other attributes, it can be nice to also validate the value passed, using custom functions!

},

"identity": &schema.Schema{
Type: schema.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be of type TypeString rather than TypeSet. A set is a composition of fields, which can be uniquely identified based on its hash. Moreover, you would have issues when compiling as you try to get the string pointer value line 44

},

"notification_type": &schema.Schema{
Type: schema.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be of type TypeString rather than TypeSet. A set is a composition of fields, which can be uniquely identified based on its hash. Moreover, you would have issues when compiling as you try to get the string pointer value line 45

NotificationType: aws.String(notification),
SnsTopic: aws.String(topic),
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really nice to add some debug here, using something in the idea:

log.Printf("[DEBUG] Setting SES Identity Notification: %#v", setOpts)

getOpts := &ses.GetIdentityNotificationAttributesInput{
Identities: []*string{aws.String(identity)},
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really nice to add some debug here, using something in the idea:

log.Printf("[DEBUG] Reading SES Identity Notification Attributes: %#v", getOpts)

}

func resourceAwsSesNotificationDelete(d *schema.ResourceData, meta interface{}) error {
d.Set("topic_arn", nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To delete it, I think we should call the SetIdentityNotificationTopic method, passing nil / empty for the SNS Topic. Thoughts? :)

notificationAttributes := response.NotificationAttributes[identity]
switch notification {
case "Bounce":
if err := d.Set("topic", notificationAttributes.BounceTopic); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this topic field does not exist in the schema. Did you think of something or is it a typo?

Also, it could be really interesting to add a attributes field, which would contain everything retrieved/sent back by the AWS API when reading the field. Thoughts? :)

@Ninir Ninir added the waiting-response Maintainers are waiting on response from community or contributor. label Nov 7, 2017
@radeksimko radeksimko added the size/M Managed by automation to categorize the size of a PR. label Nov 15, 2017
@radeksimko radeksimko added the service/ses Issues and PRs that pertain to the ses service. label Jan 12, 2018
@radeksimko radeksimko changed the title [WIP/Request Review]adds ses identity notification resource [WIP/Request Review] New Resource: aws_ses_identity_notification_topic Jan 16, 2018
@bflad
Copy link
Contributor

bflad commented Apr 4, 2018

This PR has been superseded by #2640 and merged into master! The new aws_ses_identity_notification_topic resource will release with v1.14.0 of the AWS provider, likely by the end of the week. Thanks!

@bflad bflad closed this Apr 4, 2018
@ghost
Copy link

ghost commented Apr 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
@breathingdust breathingdust removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/ses Issues and PRs that pertain to the ses service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SES Noification Settings
5 participants