Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

CLOUD-1332 adds dynamodb items nuking #60

Merged
merged 1 commit into from
Dec 5, 2017

Conversation

octopusx
Copy link
Contributor

@octopusx octopusx commented Dec 4, 2017

  • DynamoDB Tables are now removed
  • DynamoDB Table Items are now removed

@rebuy-de/prp-aws-nuke please review

@octopusx octopusx force-pushed the CLOUD-1332_nuke_dynamodb_items branch 2 times, most recently from 750259d to 24069f9 Compare December 4, 2017 16:33
bethge
bethge previously approved these changes Dec 4, 2017

func (i *DynamoDBTableItem) String() string {
table := i.table.String()
keyField := ""
Copy link
Contributor

Choose a reason for hiding this comment

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

afaik you could use: var keyField string, but it is purely aesthetics.

@bethge
Copy link
Contributor

bethge commented Dec 4, 2017

I wonder if we should add some kind of warning that blacklisting a DynamoDB table would still delete all its items. Though maybe the pre-nuke output is enough.

keyField := ""

for _, value := range i.id {
value := strings.Replace(value.String(), "\n", " ", -1)
Copy link
Member

Choose a reason for hiding this comment

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

You could just use strings.TrimSpace() here.

for _, value := range i.id {
value := strings.Replace(value.String(), "\n", " ", -1)
keyFieldChars := []rune(value)
keyField = string(keyFieldChars[8:(len(keyFieldChars) - 3)])
Copy link
Member

Choose a reason for hiding this comment

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

Slicing around with strings really looks hacky. Also it's hard to understand, since I have no idea how the contents look like.

So why do you need to do that?

Does this help? https://docs.aws.amazon.com/sdk-for-go/api/service/dynamodb/dynamodbattribute/#ConvertFrom

stephanlindauer
stephanlindauer previously approved these changes Dec 5, 2017
@octopusx octopusx dismissed stale reviews from stephanlindauer and bethge via fd03d8e December 5, 2017 10:17
@octopusx octopusx force-pushed the CLOUD-1332_nuke_dynamodb_items branch from 24069f9 to fd03d8e Compare December 5, 2017 10:17
@octopusx
Copy link
Contributor Author

octopusx commented Dec 5, 2017

Applied minor updates to address the pull request comments
@rebuy-de/prp-aws-nuke please review

svenwltr
svenwltr previously approved these changes Dec 5, 2017
}

func (n *DynamoDBNuke) ListTables() ([]Resource, error) {
params := &dynamodb.ListTablesInput{}
Copy link
Contributor

Choose a reason for hiding this comment

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

this could be

resp, err := n.Service.ListTables(&dynamodb.ListTablesInput{})

because params is not used in other places.

adds dynamodb-items nuking
adds dynamodb-table nuking
@octopusx octopusx merged commit ff080ce into master Dec 5, 2017
@octopusx octopusx deleted the CLOUD-1332_nuke_dynamodb_items branch December 5, 2017 13:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants