Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
....
var criteria SearchCriteria
json.NewDecoder(in).Decode(&criteria)
cmpt := criteria.CompartmentIDFilter
instances := []Instance{}
resp, err := cc.ListInstances(context.Background(), core.ListInstancesRequest{CompartmentId: common.String(cmpt)})
for _, instance := range resp.Items {
ins := Instance{OCID: *instance.Id, DisplayName: *instance.DisplayName}
//log.Println("Added instance ", ins)
instances = append(instances, ins)
}
json.NewEncoder(out).Encode(instances)
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment