-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from deploymenttheory/dev
Dev
- Loading branch information
Showing
28 changed files
with
1,342 additions
and
1,369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/xml" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro" | ||
) | ||
|
||
func main() { | ||
// Define the path to the JSON configuration file | ||
configFilePath := "/Users/dafyddwatkins/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json" | ||
|
||
// Load the client OAuth credentials from the configuration file | ||
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath) | ||
if err != nil { | ||
log.Fatalf("Failed to load client OAuth configuration: %v", err) | ||
} | ||
|
||
// Configuration for the jamfpro | ||
config := jamfpro.Config{ | ||
InstanceName: authConfig.InstanceName, | ||
DebugMode: true, | ||
Logger: jamfpro.NewDefaultLogger(), | ||
ClientID: authConfig.ClientID, | ||
ClientSecret: authConfig.ClientSecret, | ||
} | ||
|
||
// Create a new jamfpro client instance | ||
client, err := jamfpro.NewClient(config) | ||
if err != nil { | ||
log.Fatalf("Failed to create Jamf Pro client: %v", err) | ||
} | ||
// Create a BYOProfile structure to send | ||
newProfile := jamfpro.ResponseBYOProfile{ | ||
General: jamfpro.BYOProfileGeneralInfo{ | ||
Name: "Personal Device Profile", | ||
Site: jamfpro.BYOProfileSiteInfo{ID: -1, Name: "None"}, | ||
Enabled: true, | ||
Description: "Used for Android or iOS BYO device enrollments", | ||
}, | ||
} | ||
|
||
// Convert the profile to XML to see the output (optional, for debug purposes) | ||
xmlData, err := xml.MarshalIndent(newProfile, "", " ") | ||
if err != nil { | ||
log.Fatalf("Error marshaling XML: %v", err) | ||
} | ||
fmt.Printf("XML Request: %s\n", xmlData) | ||
|
||
// Now call the create function | ||
createdProfile, err := client.CreateBYOProfile(&newProfile) | ||
if err != nil { | ||
log.Fatalf("Error creating BYO Profile: %v", err) | ||
} | ||
fmt.Printf("Created BYO Profile: %+v\n", createdProfile) | ||
} |
43 changes: 43 additions & 0 deletions
43
examples/byoprofiles/DeleteBYOProfileByID/DeleteBYOProfileByID.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json" | ||
|
||
// Load the client OAuth credentials from the configuration file | ||
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath) | ||
if err != nil { | ||
log.Fatalf("Failed to load client OAuth configuration: %v", err) | ||
} | ||
|
||
// Configuration for the jamfpro | ||
config := jamfpro.Config{ | ||
InstanceName: authConfig.InstanceName, | ||
DebugMode: true, | ||
Logger: jamfpro.NewDefaultLogger(), | ||
ClientID: authConfig.ClientID, | ||
ClientSecret: authConfig.ClientSecret, | ||
} | ||
|
||
// Create a new jamfpro client instance | ||
client, err := jamfpro.NewClient(config) | ||
if err != nil { | ||
log.Fatalf("Failed to create Jamf Pro client: %v", err) | ||
} | ||
|
||
profileID := 1 // Use the actual ID of the profile to be deleted | ||
|
||
err = client.DeleteBYOProfileByID(profileID) | ||
if err != nil { | ||
log.Fatalf("Error deleting BYO Profile by ID: %v", err) | ||
} else { | ||
fmt.Println("BYO Profile deleted successfully by ID") | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
examples/byoprofiles/DeleteBYOProfileByName/DeleteBYOProfileByName.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json" | ||
|
||
// Load the client OAuth credentials from the configuration file | ||
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath) | ||
if err != nil { | ||
log.Fatalf("Failed to load client OAuth configuration: %v", err) | ||
} | ||
|
||
// Configuration for the jamfpro | ||
config := jamfpro.Config{ | ||
InstanceName: authConfig.InstanceName, | ||
DebugMode: true, | ||
Logger: jamfpro.NewDefaultLogger(), | ||
ClientID: authConfig.ClientID, | ||
ClientSecret: authConfig.ClientSecret, | ||
} | ||
|
||
// Create a new jamfpro client instance | ||
client, err := jamfpro.NewClient(config) | ||
if err != nil { | ||
log.Fatalf("Failed to create Jamf Pro client: %v", err) | ||
} | ||
|
||
profileName := "Personal Device Profile" // Use the actual name of the profile to be deleted | ||
|
||
err = client.DeleteBYOProfileByName(profileName) | ||
if err != nil { | ||
log.Fatalf("Error deleting BYO Profile by name: %v", err) | ||
} else { | ||
fmt.Println("BYO Profile deleted successfully by name") | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
examples/byoprofiles/GetBYOProfileByID/GetBYOProfileByID.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json" | ||
|
||
// Load the client OAuth credentials from the configuration file | ||
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath) | ||
if err != nil { | ||
log.Fatalf("Failed to load client OAuth configuration: %v", err) | ||
} | ||
|
||
// Configuration for the jamfpro | ||
config := jamfpro.Config{ | ||
InstanceName: authConfig.InstanceName, | ||
DebugMode: true, | ||
Logger: jamfpro.NewDefaultLogger(), | ||
ClientID: authConfig.ClientID, | ||
ClientSecret: authConfig.ClientSecret, | ||
} | ||
|
||
// Create a new jamfpro client instance | ||
client, err := jamfpro.NewClient(config) | ||
if err != nil { | ||
log.Fatalf("Failed to create Jamf Pro client: %v", err) | ||
} | ||
|
||
// Replace with the actual ID you want to retrieve | ||
profileID := 1 | ||
profile, err := client.GetBYOProfileByID(profileID) | ||
if err != nil { | ||
log.Fatalf("Error fetching BYO Profile by ID: %v", err) | ||
} | ||
fmt.Printf("Fetched BYO Profile: %+v\n", profile) | ||
} |
42 changes: 42 additions & 0 deletions
42
examples/byoprofiles/GetBYOProfileByName/GetBYOProfileByName.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json" | ||
|
||
// Load the client OAuth credentials from the configuration file | ||
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath) | ||
if err != nil { | ||
log.Fatalf("Failed to load client OAuth configuration: %v", err) | ||
} | ||
|
||
// Configuration for the jamfpro | ||
config := jamfpro.Config{ | ||
InstanceName: authConfig.InstanceName, | ||
DebugMode: true, | ||
Logger: jamfpro.NewDefaultLogger(), | ||
ClientID: authConfig.ClientID, | ||
ClientSecret: authConfig.ClientSecret, | ||
} | ||
|
||
// Create a new jamfpro client instance | ||
client, err := jamfpro.NewClient(config) | ||
if err != nil { | ||
log.Fatalf("Failed to create Jamf Pro client: %v", err) | ||
} | ||
|
||
// Replace with the actual name you want to retrieve | ||
profileName := "Personal Device Profile" | ||
profile, err := client.GetBYOProfileByName(profileName) | ||
if err != nil { | ||
log.Fatalf("Error fetching BYO Profile by name: %v", err) | ||
} | ||
fmt.Printf("Fetched BYO Profile: %+v\n", profile) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json" | ||
|
||
// Load the client OAuth credentials from the configuration file | ||
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath) | ||
if err != nil { | ||
log.Fatalf("Failed to load client OAuth configuration: %v", err) | ||
} | ||
|
||
// Configuration for the jamfpro | ||
config := jamfpro.Config{ | ||
InstanceName: authConfig.InstanceName, | ||
DebugMode: true, | ||
Logger: jamfpro.NewDefaultLogger(), | ||
ClientID: authConfig.ClientID, | ||
ClientSecret: authConfig.ClientSecret, | ||
} | ||
|
||
// Create a new jamfpro client instance | ||
client, err := jamfpro.NewClient(config) | ||
if err != nil { | ||
log.Fatalf("Failed to create Jamf Pro client: %v", err) | ||
} | ||
|
||
// Call GetBYOProfiles function | ||
profiles, err := client.GetBYOProfiles() | ||
if err != nil { | ||
log.Fatalf("Failed to get BYO Profiles: %v", err) | ||
} | ||
|
||
// Print out the profiles | ||
fmt.Printf("Total BYO Profiles: %d\n", profiles.Size) | ||
for _, profile := range profiles.BYOProfiles { | ||
fmt.Printf("ID: %d, Name: %s\n", profile.ID, profile.Name) | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
examples/byoprofiles/UpdateBYOProfileByID/UpdateBYOProfileByID.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/xml" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro" | ||
) | ||
|
||
func main() { | ||
// Define the path to the JSON configuration file | ||
configFilePath := "/Users/dafyddwatkins/GitHub/deploymenttheory/go-api-sdk-jamfpro/clientauth.json" | ||
|
||
// Load the client OAuth credentials from the configuration file | ||
authConfig, err := jamfpro.LoadClientAuthConfig(configFilePath) | ||
if err != nil { | ||
log.Fatalf("Failed to load client OAuth configuration: %v", err) | ||
} | ||
|
||
// Configuration for the jamfpro | ||
config := jamfpro.Config{ | ||
InstanceName: authConfig.InstanceName, | ||
DebugMode: true, | ||
Logger: jamfpro.NewDefaultLogger(), | ||
ClientID: authConfig.ClientID, | ||
ClientSecret: authConfig.ClientSecret, | ||
} | ||
|
||
// Create a new jamfpro client instance | ||
client, err := jamfpro.NewClient(config) | ||
if err != nil { | ||
log.Fatalf("Failed to create Jamf Pro client: %v", err) | ||
} | ||
|
||
// Create a BYOProfile structure to send | ||
updatedProfile := jamfpro.ResponseBYOProfile{ | ||
General: jamfpro.BYOProfileGeneralInfo{ | ||
Name: "Personal Device Profile Updated", | ||
Site: jamfpro.BYOProfileSiteInfo{ID: -1, Name: "None"}, | ||
Enabled: true, | ||
Description: "Updated description for BYO device enrollments", | ||
}, | ||
} | ||
|
||
profileID := 1 // Use the actual ID of the profile to be updated | ||
|
||
// Convert the profile to XML to see the output (optional, for debug purposes) | ||
xmlData, err := xml.MarshalIndent(updatedProfile, "", " ") | ||
if err != nil { | ||
log.Fatalf("Error marshaling XML: %v", err) | ||
} | ||
fmt.Printf("XML Request: %s\n", xmlData) | ||
|
||
// Now call the update function | ||
updatedProfileResp, err := client.UpdateBYOProfileByID(profileID, &updatedProfile) | ||
if err != nil { | ||
log.Fatalf("Error updating BYO Profile by ID: %v", err) | ||
} | ||
fmt.Printf("Updated BYO Profile: %+v\n", updatedProfileResp) | ||
} |
Oops, something went wrong.