Skip to content

Can't get values from jobDocument  #346

@YannickRiou

Description

@YannickRiou

Description

I am struggling to use the job feature provided. The job document is returned as "interface{}", I didn't find any good way to unmarshall the json job file to a struct.
What I planned to do was to cast the interface to a string so that I can parse the json. But everytime I do that, I end up having map mention in the string.

If I have an example job like this, what is the good way to have each of the fields (Type, Properties, etc.) in a variable (or struct) ?

{
  "Type" : "AWS::IoT::JobTemplate",
  "Properties" : {
      "AbortConfig" : String,
      "Description" : String,
      "Document" : String,
    }
}

When using the DescribeJob function, I will get a jobDocument like this (for the above job file) which a pain to work with because it's nested map :

map[
  Type : AWS::IoT::JobTemplate,
  Properties :[map[
      AbortConfig : String,
      Description : String,
      Document : String,
      ]
    ]
]

The example available only show the whole raw data and I was wondering how to get values from the job document easily, if you had any good workflow to get the job in json.

Thanks in advance for the help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions