in aws/iot.go [101:127]
func CreateIotThing(client IotClient, iotThingType *string, iotThingName *string) *CreateIotThingOutput {
describeThingOutput := GetIotThing(client, iotThingName)
if describeThingOutput != nil {
return &CreateIotThingOutput{
ThingName: describeThingOutput.ThingName,
ThingId: describeThingOutput.ThingId,
ThingArn: describeThingOutput.ThingArn,
}
}
ret, err := client.CreateThing(context.TODO(), &iot.CreateThingInput{
ThingName: iotThingName,
ThingTypeName: iotThingType,
})
if err != nil {
log.Fatalf("Failed to create thing %s. Encountered error %s\n", *iotThingName, err)
}
return &CreateIotThingOutput{
ThingName: ret.ThingName,
ThingId: ret.ThingId,
ThingArn: ret.ThingArn,
}
}