@@ -18,16 +18,16 @@ type CreateParams struct {
1818 // Mandatory - contains the name of the thing
1919 Name string
2020 // Optional - contains the ID of the device to be bound to the thing
21- Device string
21+ DeviceID string
2222 // Mandatory if device is empty - contains the path of the template file
2323 Template string
2424 // Mandatory if template is empty- name of things to be cloned
25- Clone string
25+ CloneID string
2626}
2727
2828// Create allows to create a new thing
2929func Create (params * CreateParams ) (string , error ) {
30- if params .Template == "" && params .Clone == "" {
30+ if params .Template == "" && params .CloneID == "" {
3131 return "" , fmt .Errorf ("%s" , "provide either a thing(ID) to clone (--clone) or a thing template file (--template)\n " )
3232 }
3333
@@ -42,8 +42,8 @@ func Create(params *CreateParams) (string, error) {
4242
4343 var thing * iotclient.Thing
4444
45- if params .Clone != "" {
46- thing , err = cloneThing (iotClient , params .Clone )
45+ if params .CloneID != "" {
46+ thing , err = clone (iotClient , params .CloneID )
4747 if err != nil {
4848 return "" , err
4949 }
@@ -60,8 +60,8 @@ func Create(params *CreateParams) (string, error) {
6060
6161 thing .Name = params .Name
6262 force := true
63- if params .Device != "" {
64- thing .DeviceId = params .Device
63+ if params .DeviceID != "" {
64+ thing .DeviceId = params .DeviceID
6565 }
6666 thingID , err := iotClient .AddThing (thing , force )
6767 if err != nil {
@@ -71,7 +71,7 @@ func Create(params *CreateParams) (string, error) {
7171 return thingID , nil
7272}
7373
74- func cloneThing (client iot.Client , thingID string ) (* iotclient.Thing , error ) {
74+ func clone (client iot.Client , thingID string ) (* iotclient.Thing , error ) {
7575 clone , err := client .GetThing (thingID )
7676 if err != nil {
7777 return nil , fmt .Errorf ("%s: %w" , "retrieving the thing to be cloned" , err )
0 commit comments