Skip to content

Go version of parameters script#6

Merged
kompotkot merged 10 commits intomainfrom
parameters-go
Dec 20, 2021
Merged

Go version of parameters script#6
kompotkot merged 10 commits intomainfrom
parameters-go

Conversation

@kompotkot
Copy link
Copy Markdown
Contributor

@kompotkot kompotkot commented Dec 17, 2021

Changes

  • Fetch parameters in chunks (because aws does not let fetch more then 10 per request)
  • Write to file
  • Add verbose with additional logging

How to test these changes?

Tested locally

Related issues

@kompotkot kompotkot marked this pull request as draft December 17, 2021 20:31
Copy link
Copy Markdown
Member

@zomglings zomglings left a comment

Choose a reason for hiding this comment

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

@kompotkot : This should be written as a checkenv plugin (see env.go as an example).

Otherwise, I don't even see the point of putting it in this repo.

// Output:
// If success, a GetParametersOutput object containing the result of the service call and nil
// Otherwise, nil and an error from the call to GetParameters
func ExecGetParameters(c context.Context, api SSMGetParametersAPI, input *ssm.GetParametersInput) (*ssm.GetParametersOutput, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like too many layers of indirection. Why not just instantiate a struct with that interface and make the call. What do you gain by having this extra function in the middle?

// SSMGetParametersAPI and SSMDescribeParametersAPI defines the interface
// for the GetParameters and DescribeParameters function.
// We use this interface to test the function using a mocked service
type SSMGetParametersAPI interface {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to have two different interfaces? Are we going to use them separately? If not, having two interfaces makes the code unnecessarily complicated.

@@ -0,0 +1,58 @@
/*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why so much nesting: scripts/sources/parameters/cmd/aws_ssm.go. Can you just put in cmd/aws_ssm/main.go?

@kompotkot kompotkot marked this pull request as ready for review December 20, 2021 20:07
@kompotkot kompotkot merged commit e0690ed into main Dec 20, 2021
@kompotkot kompotkot deleted the parameters-go branch December 20, 2021 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants