Skip to content

Commit 8143c7d

Browse files
hosomoxtoacart
authored andcommitted
Changes requested in PR feedback.
Signed-off-by: hosom <hosom@github.com>
1 parent a2568f5 commit 8143c7d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

v2/devices.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ func (dr *DevicesResource) GetPostureAttributes(ctx context.Context, deviceID st
9898
return body[DevicePostureAttributes](dr, req)
9999
}
100100

101+
// SetPostureAttribute sets the posture attribute of the device identified by deviceID.
102+
func (dr *DevicesResource) SetPostureAttribute(ctx context.Context, deviceID, attributeKey string, request DevicePostureAttributeRequest) error {
103+
req, err := dr.buildRequest(ctx, http.MethodPost, dr.buildURL("device", deviceID, "attributes", attributeKey), requestBody(request))
104+
if err != nil {
105+
return err
106+
}
107+
108+
return dr.do(req, nil)
109+
}
110+
101111
// List lists every [Device] in the tailnet.
102112
func (dr *DevicesResource) List(ctx context.Context) ([]Device, error) {
103113
req, err := dr.buildRequest(ctx, http.MethodGet, dr.buildTailnetURL("devices"))
@@ -136,7 +146,7 @@ func (dr *DevicesResource) Delete(ctx context.Context, deviceID string) error {
136146
return dr.do(req, nil)
137147
}
138148

139-
// SetName updates the name of the device by deviceID.
149+
// SetName updates the name of the device identified by deviceID.
140150
func (dr *DevicesResource) SetName(ctx context.Context, deviceID, name string) error {
141151
req, err := dr.buildRequest(ctx, http.MethodPost, dr.buildURL("device", deviceID, "name"), requestBody(map[string]string{
142152
"name": name,
@@ -160,16 +170,6 @@ func (dr *DevicesResource) SetTags(ctx context.Context, deviceID string, tags []
160170
return dr.do(req, nil)
161171
}
162172

163-
// SetPostureAttribute sets the posture attribute of the device identified by deviceID.
164-
func (dr *DevicesResource) SetPostureAttribute(ctx context.Context, deviceID, attributeKey string, request DevicePostureAttributeRequest) error {
165-
req, err := dr.buildRequest(ctx, http.MethodPost, dr.buildURL("device", deviceID, "attributes", attributeKey), requestBody(request))
166-
if err != nil {
167-
return err
168-
}
169-
170-
return dr.do(req, nil)
171-
}
172-
173173
// DeviceKey type represents the properties of the key of an individual device within
174174
// the tailnet.
175175
type DeviceKey struct {

0 commit comments

Comments
 (0)