Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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 ID of the cloud identity provider to retrieve
cloudIdpID := "1001"

// Call GetCloudIdentityProviderByID function
cloudIdp, err := client.GetCloudIdentityProviderConfigurationByID(cloudIdpID)
if err != nil {
log.Fatalf("Error fetching cloud identity provider: %v", err)
}

// Pretty print the cloud identity provider in JSON
JSON, err := json.MarshalIndent(cloudIdp, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling cloud identity provider data: %v", err)
}
fmt.Printf("Cloud Identity Provider (ID: %s):\n%s\n", cloudIdpID, string(JSON))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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)
}

// Optional: Define sort filter (e.g., "id:asc" or "displayName:desc")
sortFilter := "id:desc"

// Call GetCloudIdentityProviders function
cloudIdps, err := client.GetCloudIdentityProviders(sortFilter)
if err != nil {
log.Fatalf("Error fetching cloud identity providers: %v", err)
}

// Pretty print the cloud identity providers in JSON
JSON, err := json.MarshalIndent(cloudIdps, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling cloud identity providers data: %v", err)
}
fmt.Println("Cloud Identity Providers:\n", string(JSON))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package main

import (
"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 language IDs to delete
languageIds := []string{"en", "fr", "es"}

// Call DeleteMultipleEnrollmentMessagesByLanguageIDs function
err = client.DeleteMultipleEnrollmentMessagesByLanguageIDs(languageIds)
if err != nil {
log.Fatalf("Error deleting enrollment language messages: %v", err)
}

fmt.Printf("Successfully deleted enrollment messages for languages: %v\n", languageIds)
}
33 changes: 33 additions & 0 deletions examples/enrollment/GetEnrollment/GetEnrollment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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)
}

// Call GetEnrollment function
enrollment, err := client.GetEnrollment()
if err != nil {
log.Fatalf("Error getting enrollment configuration: %v", err)
}

// Pretty print the enrollment configuration in JSON
JSON, err := json.MarshalIndent(enrollment, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling enrollment data: %v", err)
}
fmt.Println("Current Enrollment Configuration:\n", string(JSON))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package main

import (
"encoding/json"
"fmt"
"log"

"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
)

func main() {
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"

client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
if err != nil {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}

languageCodes, err := client.GetEnrollmentLanguageCodes()
if err != nil {
log.Fatalf("Error getting enrollment language codes: %v", err)
}

JSON, err := json.MarshalIndent(languageCodes, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling language codes data: %v", err)
}
fmt.Println("Available Language Codes:\n", string(JSON))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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)
}

// Specify the language ID (ISO 639-1 code)
languageId := "en"

// Call GetEnrollmentMessageByLanguageID function
languageMsg, err := client.GetEnrollmentMessageByLanguageID(languageId)
if err != nil {
log.Fatalf("Error getting enrollment language messaging: %v", err)
}

// Pretty print the language messaging configuration in JSON
JSON, err := json.MarshalIndent(languageMsg, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling language messaging data: %v", err)
}
fmt.Println("Enrollment Language Messaging Configuration:\n", string(JSON))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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 ID of the group to update
groupID := "1"

groupUpdate := &jamfpro.ResourceAccountDrivenUserEnrollmentAccessGroup{
ID: groupID,
GroupID: "12345",
LdapServerID: "1",
Name: "Updated ADUE Access Group",
SiteID: "-1",
EnterpriseEnrollmentEnabled: true,
PersonalEnrollmentEnabled: false,
AccountDrivenUserEnrollmentEnabled: true,
RequireEula: true,
}

updatedGroup, err := client.UpdateAccountDrivenUserEnrollmentAccessGroupByID(groupID, groupUpdate)
if err != nil {
log.Fatalf("Error updating ADUE access group: %v", err)
}

// Pretty print the updated group in JSON
JSON, err := json.MarshalIndent(updatedGroup, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling updated group data: %v", err)
}
fmt.Printf("Updated ADUE Access Group:\n%s\n", string(JSON))
}
94 changes: 94 additions & 0 deletions examples/enrollment/UpdateEnrollment/UpdateEnrollment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
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)
}

// Create an enrollment configuration with all available options
enrollmentConfig := &jamfpro.ResourceEnrollment{
// Basic Configuration
InstallSingleProfile: false,
SigningMdmProfileEnabled: false,

// MDM Signing Certificate Configuration
MdmSigningCertificate: &jamfpro.ResourceEnrollmentCertificate{
Filename: "null",
KeystorePassword: "thing",
IdentityKeystore: "WlhoaGJYQnNaU0J2WmlCaElHSmhjMlUyTkNCbGJtTnZaR1ZrSUhaaGJHbGtJSEF4TWk0Z2EyVjVjM1J2Y21VZ1ptbHNaUT09",
},

// Enrollment Restrictions and Cleanup
RestrictReenrollment: false,
FlushLocationInformation: false,
FlushLocationHistoryInformation: false,
FlushPolicyHistory: false,
FlushExtensionAttributes: false,
FlushSoftwareUpdatePlans: false,
FlushMdmCommandsOnReenroll: "DELETE_EVERYTHING_EXCEPT_ACKNOWLEDGED", // Options: DELETE_NOTHING/DELETE_ERRORS/DELETE_EVERYTHING_EXCEPT_ACKNOWLEDGED/DELETE_EVERYTHING

// macOS Management Configuration
MacOsEnterpriseEnrollmentEnabled: false,
ManagementUsername: "radmin",
CreateManagementAccount: true,
HideManagementAccount: false,
AllowSshOnlyManagementAccount: false,
EnsureSshRunning: true,
LaunchSelfService: false,
SignQuickAdd: false,

// Developer Certificate Configuration
DeveloperCertificateIdentity: &jamfpro.ResourceEnrollmentCertificate{
Filename: "null",
KeystorePassword: "",
IdentityKeystore: "",
},

// Certificate Details
DeveloperCertificateIdentityDetails: jamfpro.ResourceCertificateDetails{
Subject: "",
SerialNumber: "",
},
MdmSigningCertificateDetails: jamfpro.ResourceCertificateDetails{
Subject: "",
SerialNumber: "",
},

// iOS/Mobile Device Enrollment Configuration
IosEnterpriseEnrollmentEnabled: true,
IosPersonalEnrollmentEnabled: false,
PersonalDeviceEnrollmentType: "PERSONALDEVICEPROFILES", // Options: PERSONALDEVICEPROFILES/USERENROLLMENT

// Account Driven Enrollment Configuration
AccountDrivenUserEnrollmentEnabled: false,
AccountDrivenDeviceIosEnrollmentEnabled: false,
AccountDrivenDeviceMacosEnrollmentEnabled: false,
AccountDrivenUserVisionosEnrollmentEnabled: false,
AccountDrivenDeviceVisionosEnrollmentEnabled: false,
}

updatedEnrollment, err := client.UpdateEnrollment(enrollmentConfig)
if err != nil {
log.Fatalf("Error updating enrollment configuration: %v", err)
}

// Pretty print the updated enrollment configuration in JSON
JSON, err := json.MarshalIndent(updatedEnrollment, "", " ")
if err != nil {
log.Fatalf("Error marshaling enrollment data: %v", err)
}
fmt.Println("Updated Enrollment Configuration:\n", string(JSON))
}
Loading
Loading