-
Notifications
You must be signed in to change notification settings - Fork 5
/
jamfproapi_device_communication_settings.go
56 lines (43 loc) · 2.17 KB
/
jamfproapi_device_communication_settings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// jamfproapi_device_communication_settings.go
// Jamf Pro Api - Device Communication Settings
// api reference: https://developer.jamf.com/jamf-pro/reference/get_v1-device-communication-settings
// Jamf Pro API requires the structs to support a JSON data structure.
package jamfpro
import "fmt"
const uriDeviceCommunicationSettings = "/api/v1/device-communication-settings"
// structs
type ResourceDeviceCommunicationSettings struct {
AutoRenewMobileDeviceMdmProfileWhenCaRenewed bool `json:"autoRenewMobileDeviceMdmProfileWhenCaRenewed"`
AutoRenewMobileDeviceMdmProfileWhenDeviceIdentityCertExpiring bool `json:"autoRenewMobileDeviceMdmProfileWhenDeviceIdentityCertExpiring"`
AutoRenewComputerMdmProfileWhenCaRenewed bool `json:"autoRenewComputerMdmProfileWhenCaRenewed"`
AutoRenewComputerMdmProfileWhenDeviceIdentityCertExpiring bool `json:"autoRenewComputerMdmProfileWhenDeviceIdentityCertExpiring"`
MdmProfileMobileDeviceExpirationLimitInDays int `json:"mdmProfileMobileDeviceExpirationLimitInDays"`
MdmProfileComputerExpirationLimitInDays int `json:"mdmProfileComputerExpirationLimitInDays"`
}
// CRUD
// Gets device communication settings
func (c *Client) GetDeviceCommunicationSettings() (*ResourceDeviceCommunicationSettings, error) {
endpoint := uriDeviceCommunicationSettings
var out ResourceDeviceCommunicationSettings
resp, err := c.HTTP.DoRequest("GET", endpoint, nil, &out)
if err != nil {
return nil, fmt.Errorf(errMsgFailedGet, "device communication settings", err)
}
if resp != nil && resp.Body != nil {
defer resp.Body.Close()
}
return &out, nil
}
// Updates device communication settings
func (c *Client) UpdateDeviceCommunicationSettings(updatedSettings ResourceDeviceCommunicationSettings) (*ResourceDeviceCommunicationSettings, error) {
endpoint := uriDeviceCommunicationSettings
var out ResourceDeviceCommunicationSettings
resp, err := c.HTTP.DoRequest("PUT", endpoint, updatedSettings, &out)
if err != nil {
return nil, fmt.Errorf(errMsgFailedUpdate, "device communication settings", err)
}
if resp != nil && resp.Body != nil {
defer resp.Body.Close()
}
return &out, nil
}