@@ -72,6 +72,12 @@ type DevicePostureAttributes struct {
72
72
Expiries map [string ]Time `json:"expiries"`
73
73
}
74
74
75
+ type DevicePostureAttributeRequest struct {
76
+ Value any `json:"value"`
77
+ Expiry Time `json:"expiry"`
78
+ Comment string `json:"comment"`
79
+ }
80
+
75
81
// Get gets the [Device] identified by deviceID.
76
82
func (dr * DevicesResource ) Get (ctx context.Context , deviceID string ) (* Device , error ) {
77
83
req , err := dr .buildRequest (ctx , http .MethodGet , dr .buildURL ("device" , deviceID ))
@@ -82,6 +88,7 @@ func (dr *DevicesResource) Get(ctx context.Context, deviceID string) (*Device, e
82
88
return body [Device ](dr , req )
83
89
}
84
90
91
+ // GetPostureAttributes retrieves the posture attributes of the device identified by deviceID.
85
92
func (dr * DevicesResource ) GetPostureAttributes (ctx context.Context , deviceID string ) (* DevicePostureAttributes , error ) {
86
93
req , err := dr .buildRequest (ctx , http .MethodGet , dr .buildURL ("device" , deviceID , "attributes" ))
87
94
if err != nil {
@@ -153,6 +160,16 @@ func (dr *DevicesResource) SetTags(ctx context.Context, deviceID string, tags []
153
160
return dr .do (req , nil )
154
161
}
155
162
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
+
156
173
// DeviceKey type represents the properties of the key of an individual device within
157
174
// the tailnet.
158
175
type DeviceKey struct {
0 commit comments