Skip to content

Commit e0d2a35

Browse files
authored
Merge pull request #608 from deploymenttheory/fix-plist_structs
Added new resource types to the SDK with new examples
2 parents 807782c + c37cd0e commit e0d2a35

File tree

36 files changed

+1494
-251
lines changed

36 files changed

+1494
-251
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"log"
7+
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
14+
15+
// Initialize the Jamf Pro client with the HTTP client configuration
16+
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
19+
}
20+
21+
// Define the ID of the cloud identity provider to retrieve
22+
cloudIdpID := "1001"
23+
24+
// Call GetCloudIdentityProviderByID function
25+
cloudIdp, err := client.GetCloudIdentityProviderConfigurationByID(cloudIdpID)
26+
if err != nil {
27+
log.Fatalf("Error fetching cloud identity provider: %v", err)
28+
}
29+
30+
// Pretty print the cloud identity provider in JSON
31+
JSON, err := json.MarshalIndent(cloudIdp, "", " ") // Indent with 4 spaces
32+
if err != nil {
33+
log.Fatalf("Error marshaling cloud identity provider data: %v", err)
34+
}
35+
fmt.Printf("Cloud Identity Provider (ID: %s):\n%s\n", cloudIdpID, string(JSON))
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"log"
7+
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
14+
15+
// Initialize the Jamf Pro client with the HTTP client configuration
16+
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
19+
}
20+
21+
// Optional: Define sort filter (e.g., "id:asc" or "displayName:desc")
22+
sortFilter := "id:desc"
23+
24+
// Call GetCloudIdentityProviders function
25+
cloudIdps, err := client.GetCloudIdentityProviders(sortFilter)
26+
if err != nil {
27+
log.Fatalf("Error fetching cloud identity providers: %v", err)
28+
}
29+
30+
// Pretty print the cloud identity providers in JSON
31+
JSON, err := json.MarshalIndent(cloudIdps, "", " ") // Indent with 4 spaces
32+
if err != nil {
33+
log.Fatalf("Error marshaling cloud identity providers data: %v", err)
34+
}
35+
fmt.Println("Cloud Identity Providers:\n", string(JSON))
36+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
8+
)
9+
10+
func main() {
11+
// Define the path to the JSON configuration file
12+
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
13+
14+
// Initialize the Jamf Pro client with the HTTP client configuration
15+
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
16+
if err != nil {
17+
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
18+
}
19+
20+
// Define the language IDs to delete
21+
languageIds := []string{"en", "fr", "es"}
22+
23+
// Call DeleteMultipleEnrollmentMessagesByLanguageIDs function
24+
err = client.DeleteMultipleEnrollmentMessagesByLanguageIDs(languageIds)
25+
if err != nil {
26+
log.Fatalf("Error deleting enrollment language messages: %v", err)
27+
}
28+
29+
fmt.Printf("Successfully deleted enrollment messages for languages: %v\n", languageIds)
30+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"log"
7+
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
14+
15+
// Initialize the Jamf Pro client with the HTTP client configuration
16+
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
19+
}
20+
21+
// Call GetEnrollment function
22+
enrollment, err := client.GetEnrollment()
23+
if err != nil {
24+
log.Fatalf("Error getting enrollment configuration: %v", err)
25+
}
26+
27+
// Pretty print the enrollment configuration in JSON
28+
JSON, err := json.MarshalIndent(enrollment, "", " ") // Indent with 4 spaces
29+
if err != nil {
30+
log.Fatalf("Error marshaling enrollment data: %v", err)
31+
}
32+
fmt.Println("Current Enrollment Configuration:\n", string(JSON))
33+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"log"
7+
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
13+
14+
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
15+
if err != nil {
16+
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
17+
}
18+
19+
languageCodes, err := client.GetEnrollmentLanguageCodes()
20+
if err != nil {
21+
log.Fatalf("Error getting enrollment language codes: %v", err)
22+
}
23+
24+
JSON, err := json.MarshalIndent(languageCodes, "", " ") // Indent with 4 spaces
25+
if err != nil {
26+
log.Fatalf("Error marshaling language codes data: %v", err)
27+
}
28+
fmt.Println("Available Language Codes:\n", string(JSON))
29+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"log"
7+
8+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
9+
)
10+
11+
func main() {
12+
// Define the path to the JSON configuration file
13+
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
14+
15+
// Initialize the Jamf Pro client with the HTTP client configuration
16+
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
17+
if err != nil {
18+
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
19+
}
20+
21+
// Specify the language ID (ISO 639-1 code)
22+
languageId := "en"
23+
24+
// Call GetEnrollmentMessageByLanguageID function
25+
languageMsg, err := client.GetEnrollmentMessageByLanguageID(languageId)
26+
if err != nil {
27+
log.Fatalf("Error getting enrollment language messaging: %v", err)
28+
}
29+
30+
// Pretty print the language messaging configuration in JSON
31+
JSON, err := json.MarshalIndent(languageMsg, "", " ") // Indent with 4 spaces
32+
if err != nil {
33+
log.Fatalf("Error marshaling language messaging data: %v", err)
34+
}
35+
fmt.Println("Enrollment Language Messaging Configuration:\n", string(JSON))
36+
}

0 commit comments

Comments
 (0)