-
Notifications
You must be signed in to change notification settings - Fork 6
/
UpdateComputerInventoryCollectionSettings.go
95 lines (87 loc) · 3.76 KB
/
UpdateComputerInventoryCollectionSettings.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package main
import (
"encoding/json"
"fmt"
"log"
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
)
func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
// Initialize the Jamf Pro client with the HTTP client configuration
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
if err != nil {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}
// Define the new settings
newSettings := &jamfpro.ResourceComputerInventoryCollectionSettings{
ComputerInventoryCollectionPreferences: struct {
MonitorApplicationUsage bool `json:"monitorApplicationUsage"`
IncludeFonts bool `json:"includeFonts"`
IncludePlugins bool `json:"includePlugins"`
IncludePackages bool `json:"includePackages"`
IncludeSoftwareUpdates bool `json:"includeSoftwareUpdates"`
IncludeSoftwareId bool `json:"includeSoftwareId"`
IncludeAccounts bool `json:"includeAccounts"`
CalculateSizes bool `json:"calculateSizes"`
IncludeHiddenAccounts bool `json:"includeHiddenAccounts"`
IncludePrinters bool `json:"includePrinters"`
IncludeServices bool `json:"includeServices"`
CollectSyncedMobileDeviceInfo bool `json:"collectSyncedMobileDeviceInfo"`
UpdateLdapInfoOnComputerInventorySubmissions bool `json:"updateLdapInfoOnComputerInventorySubmissions"`
MonitorBeacons bool `json:"monitorBeacons"`
AllowChangingUserAndLocation bool `json:"allowChangingUserAndLocation"`
UseUnixUserPaths bool `json:"useUnixUserPaths"`
CollectUnmanagedCertificates bool `json:"collectUnmanagedCertificates"`
}{
MonitorApplicationUsage: false,
IncludeFonts: false,
IncludePlugins: false,
IncludePackages: true,
IncludeSoftwareUpdates: false,
IncludeSoftwareId: true,
IncludeAccounts: true,
CalculateSizes: false,
IncludeHiddenAccounts: false,
IncludePrinters: true,
IncludeServices: true,
CollectSyncedMobileDeviceInfo: false,
UpdateLdapInfoOnComputerInventorySubmissions: false,
MonitorBeacons: false,
AllowChangingUserAndLocation: true,
UseUnixUserPaths: true,
CollectUnmanagedCertificates: true,
},
ApplicationPaths: []jamfpro.ComputerInventoryCollectionSettingsSubsetPathItem{
{
ID: "1",
Path: "/Example/Path/To/App/",
},
},
FontPaths: []jamfpro.ComputerInventoryCollectionSettingsSubsetPathItem{
{
ID: "2",
Path: "/Example/Path/To/Font/",
},
},
PluginPaths: []jamfpro.ComputerInventoryCollectionSettingsSubsetPathItem{
{
ID: "3",
Path: "/Example/Path/To/Plugin/",
},
},
}
// Update computer inventory collection settings
updatedSettings, err := client.UpdateComputerInventoryCollectionSettings(newSettings)
if err != nil {
log.Fatalf("Error updating Computer Inventory Collection Settings: %s", err)
}
// Convert the updated settings to pretty-printed JSON
updatedSettingsJSON, err := json.MarshalIndent(updatedSettings, "", " ")
if err != nil {
log.Fatalf("Error marshalling updated Computer Inventory Collection Settings to JSON: %s", err)
}
// Print the pretty-printed JSON of the updated settings
fmt.Println("Updated Computer Inventory Collection Settings:")
fmt.Println(string(updatedSettingsJSON))
}