I'm using the AWS SDK for Go to get parameters from SSM. In order to instantiate an SSM client, I have to pass a session struct with params such as region, credentials and endpoint.
&aws.Config{
Region: aws.String("us-east-1"),
Credentials: credentials.NewStaticCredentials("foo", "var", ""),
Endpoint: aws.String(os.Getenv("SSM_ENDPOINT")),
}
These credentials are optional, and have their standard values be overridden when user input is provided. I've been trying to create a flexible solution for receiving those inputs, such as:
- Mapping inputs through a variadic function: Inputs would have to follow a specified order, can't really tell what each value's key is.
- Instantiating specific values of a larger struct: Other values get instantiated on their zero values.
A possible solution would be Marshaling and Unmarshaling a JSON with json:",omitempty"
, but it doesn't really seem like the best way to do it.