-
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 #12 from deploymenttheory/dev
Added classicapi_computer_extension_attributes_test.go
- Loading branch information
Showing
6 changed files
with
707 additions
and
1 deletion.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
examples/computer_prestages/GetComputerPrestageByID/GetComputerPrestageByID.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,51 @@ | ||
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 inside the main function | ||
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) | ||
} | ||
|
||
// Define the ID of the Computer Prestage you want to fetch as a string | ||
prestageID := "2" // Replace with the actual prestage ID as a string | ||
|
||
// Call GetComputerPrestageByID function | ||
prestage, err := client.GetComputerPrestageByID(prestageID) | ||
if err != nil { | ||
log.Fatalf("Error fetching Computer Prestage by ID: %v", err) | ||
} | ||
|
||
// Pretty print the prestage in XML | ||
prestageXML, err := xml.MarshalIndent(prestage, "", " ") // Indent with 4 spaces | ||
if err != nil { | ||
log.Fatalf("Error marshaling Computer Prestage data: %v", err) | ||
} | ||
fmt.Println("Fetched Computer Prestage:\n", string(prestageXML)) | ||
} |
52 changes: 52 additions & 0 deletions
52
examples/computer_prestages/GetComputerPrestageNameByID/GetComputerPrestageNameByID.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,52 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro" | ||
) | ||
|
||
const ( | ||
prestageName = "pse-ade_lbgstaging_Jamf_Connect_New_Config-1.1-0000" // Replace with the actual prestage name you want to fetch | ||
) | ||
|
||
func main() { | ||
// Define the path to the JSON configuration file inside the main function | ||
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 GetComputerPrestageByNameByID function | ||
prestage, err := client.GetComputerPrestageByNameByID(prestageName) | ||
if err != nil { | ||
log.Fatalf("Error fetching Jamf computer prestage by name: %v", err) | ||
} | ||
|
||
// Pretty print the prestage in JSON | ||
prestageJSON, err := json.MarshalIndent(prestage, "", " ") // Indent with 4 spaces | ||
if err != nil { | ||
log.Fatalf("Error marshaling Jamf computer prestage data: %v", err) | ||
} | ||
fmt.Println("Fetched Jamf computer prestage:\n", string(prestageJSON)) | ||
} |
48 changes: 48 additions & 0 deletions
48
examples/computer_prestages/GetComputerPrestages/GetComputerPrestages.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,48 @@ | ||
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 inside the main function | ||
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 GetComputerPrestages function | ||
prestages, err := client.GetComputerPrestages() | ||
if err != nil { | ||
log.Fatalf("Error fetching Computer Prestages: %v", err) | ||
} | ||
|
||
// Pretty print the prestages in XML | ||
prestagesXML, err := xml.MarshalIndent(prestages, "", " ") // Indent with 4 spaces | ||
if err != nil { | ||
log.Fatalf("Error marshaling Computer Prestages data: %v", err) | ||
} | ||
fmt.Println("Fetched Computer Prestages:\n", string(prestagesXML)) | ||
} |
Oops, something went wrong.