-
Notifications
You must be signed in to change notification settings - Fork 8
/
GetMobileDeviceEnrollmentProfileByNameWithSubset.go
54 lines (46 loc) · 1.7 KB
/
GetMobileDeviceEnrollmentProfileByNameWithSubset.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
package main
import (
"fmt"
"log"
"github.com/deploymenttheory/go-api-http-client/httpclient"
"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"
// Load the client OAuth credentials from the configuration file
loadedConfig, err := jamfpro.LoadClientConfig(configFilePath)
if err != nil {
log.Fatalf("Failed to load client OAuth configuration: %v", err)
}
// Configuration for the HTTP client
config := httpclient.ClientConfig{
Auth: httpclient.AuthConfig{
ClientID: loadedConfig.Auth.ClientID,
ClientSecret: loadedConfig.Auth.ClientSecret,
},
Environment: httpclient.EnvironmentConfig{
APIType: loadedConfig.Environment.APIType,
InstanceName: loadedConfig.Environment.InstanceName,
},
ClientOptions: httpclient.ClientOptions{
LogLevel: loadedConfig.ClientOptions.LogLevel,
LogOutputFormat: loadedConfig.ClientOptions.LogOutputFormat,
LogConsoleSeparator: loadedConfig.ClientOptions.LogConsoleSeparator,
HideSensitiveData: loadedConfig.ClientOptions.HideSensitiveData,
},
}
// Create a new jamfpro client instance
client, err := jamfpro.BuildClient(config)
if err != nil {
log.Fatalf("Failed to create Jamf Pro client: %v", err)
}
name := "ProfileName" // Replace with the actual profile name
subset := "general" // Replace with the actual subset (e.g., "general")
profile, err := client.GetMobileDeviceEnrollmentProfileByNameWithSubset(name, subset)
if err != nil {
fmt.Println("Error fetching profile by name and subset:", err)
return
}
fmt.Printf("Profile: %+v\n", profile)
}