Skip to content

Commit

Permalink
Changes requested in PR feedback.
Browse files Browse the repository at this point in the history
Signed-off-by: hosom <[email protected]>
  • Loading branch information
hosom authored and oxtoacart committed Dec 17, 2024
1 parent a2568f5 commit 8143c7d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions v2/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ func (dr *DevicesResource) GetPostureAttributes(ctx context.Context, deviceID st
return body[DevicePostureAttributes](dr, req)
}

// SetPostureAttribute sets the posture attribute of the device identified by deviceID.
func (dr *DevicesResource) SetPostureAttribute(ctx context.Context, deviceID, attributeKey string, request DevicePostureAttributeRequest) error {
req, err := dr.buildRequest(ctx, http.MethodPost, dr.buildURL("device", deviceID, "attributes", attributeKey), requestBody(request))
if err != nil {
return err
}

return dr.do(req, nil)
}

// List lists every [Device] in the tailnet.
func (dr *DevicesResource) List(ctx context.Context) ([]Device, error) {
req, err := dr.buildRequest(ctx, http.MethodGet, dr.buildTailnetURL("devices"))
Expand Down Expand Up @@ -136,7 +146,7 @@ func (dr *DevicesResource) Delete(ctx context.Context, deviceID string) error {
return dr.do(req, nil)
}

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

// SetPostureAttribute sets the posture attribute of the device identified by deviceID.
func (dr *DevicesResource) SetPostureAttribute(ctx context.Context, deviceID, attributeKey string, request DevicePostureAttributeRequest) error {
req, err := dr.buildRequest(ctx, http.MethodPost, dr.buildURL("device", deviceID, "attributes", attributeKey), requestBody(request))
if err != nil {
return err
}

return dr.do(req, nil)
}

// DeviceKey type represents the properties of the key of an individual device within
// the tailnet.
type DeviceKey struct {
Expand Down

0 comments on commit 8143c7d

Please sign in to comment.