Skip to content

Instantly share code, notes, and snippets.

@ytkang
Created September 5, 2019 03:43
Show Gist options
  • Save ytkang/1589b575cb0335fd9eb6743c49acedef to your computer and use it in GitHub Desktop.
Save ytkang/1589b575cb0335fd9eb6743c49acedef to your computer and use it in GitHub Desktop.
[ECS TaskDefinition] convert json to golang sdk object
func makeTaskDefnInput(jsonPath string) *ecs.RegisterTaskDefinitionInput {
var defn ecs.RegisterTaskDefinitionInput
fileBytes, err := ioutil.ReadFile(jsonPath)
if err != nil {
log.Println("cannot read task file", err.Error())
return nil
}
err = json.Unmarshal(fileBytes, &defn)
if err != nil {
log.Println("cannot parse task file", err.Error())
return nil
}
return &defn
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment