@@ -18,16 +18,16 @@ type CreateParams struct {
18
18
// Mandatory - contains the name of the thing
19
19
Name string
20
20
// Optional - contains the ID of the device to be bound to the thing
21
- Device string
21
+ DeviceID string
22
22
// Mandatory if device is empty - contains the path of the template file
23
23
Template string
24
24
// Mandatory if template is empty- name of things to be cloned
25
- Clone string
25
+ CloneID string
26
26
}
27
27
28
28
// Create allows to create a new thing
29
29
func Create (params * CreateParams ) (string , error ) {
30
- if params .Template == "" && params .Clone == "" {
30
+ if params .Template == "" && params .CloneID == "" {
31
31
return "" , fmt .Errorf ("%s" , "provide either a thing(ID) to clone (--clone) or a thing template file (--template)\n " )
32
32
}
33
33
@@ -42,8 +42,8 @@ func Create(params *CreateParams) (string, error) {
42
42
43
43
var thing * iotclient.Thing
44
44
45
- if params .Clone != "" {
46
- thing , err = cloneThing (iotClient , params .Clone )
45
+ if params .CloneID != "" {
46
+ thing , err = clone (iotClient , params .CloneID )
47
47
if err != nil {
48
48
return "" , err
49
49
}
@@ -60,8 +60,8 @@ func Create(params *CreateParams) (string, error) {
60
60
61
61
thing .Name = params .Name
62
62
force := true
63
- if params .Device != "" {
64
- thing .DeviceId = params .Device
63
+ if params .DeviceID != "" {
64
+ thing .DeviceId = params .DeviceID
65
65
}
66
66
thingID , err := iotClient .AddThing (thing , force )
67
67
if err != nil {
@@ -71,7 +71,7 @@ func Create(params *CreateParams) (string, error) {
71
71
return thingID , nil
72
72
}
73
73
74
- func cloneThing (client iot.Client , thingID string ) (* iotclient.Thing , error ) {
74
+ func clone (client iot.Client , thingID string ) (* iotclient.Thing , error ) {
75
75
clone , err := client .GetThing (thingID )
76
76
if err != nil {
77
77
return nil , fmt .Errorf ("%s: %w" , "retrieving the thing to be cloned" , err )
0 commit comments