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
Expand Up @@ -10,7 +10,7 @@ import (

func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig.json"

// Initialize the Jamf Pro client with the HTTP client configuration
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
Expand All @@ -20,8 +20,9 @@ func main() {

// Create new smart computer group
siteID := "-1"
newGroup := jamfpro.ResourceSmartComputerGroup{
Name: "Operating System Version like 15",
newGroup := jamfpro.ResourceSmartComputerGroupV2{
Name: "Operating System Version like 15",
Description: "This is a description",
Criteria: []jamfpro.SharedSubsetCriteriaJamfProAPI{
{
Name: "Operating System Version",
Expand All @@ -46,7 +47,7 @@ func main() {
}

// Call function
created, err := client.CreateSmartComputerGroup(newGroup)
created, err := client.CreateSmartComputerGroupV2(newGroup)
if err != nil {
log.Fatalf("Error creating smart computer group: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig.json"

// Initialize the Jamf Pro client with the HTTP client configuration
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
Expand All @@ -18,10 +18,10 @@ func main() {
}

// Define group ID to delete
groupID := "1"
groupID := "1196"

// Call function
err = client.DeleteSmartComputerGroupByID(groupID)
err = client.DeleteSmartComputerGroupByIDV2(groupID)
if err != nil {
log.Fatalf("Error deleting smart computer group: %v", err)
}
Expand Down
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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 a Smart Computer Group ID for testing
groupID := "1197" // Replace with actual group ID

// Call GetSmartComputerGroupByID function
group, err := client.GetSmartComputerGroupByIDV2(groupID)
if err != nil {
log.Fatalf("Error fetching Smart Computer Group by ID: %v", err)
}

// Pretty print the group in JSON
groupJSON, err := json.MarshalIndent(group, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling Smart Computer Group data: %v", err)
}
fmt.Println("Fetched Smart Computer Group:\n", string(groupJSON))
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig.json"

// Initialize the Jamf Pro client with the HTTP client configuration
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
Expand All @@ -22,7 +22,7 @@ func main() {
groupName := "Operating System Version like 15" // Replace with actual group name

// Call GetSmartComputerGroupByName function
group, err := client.GetSmartComputerGroupByName(groupName)
group, err := client.GetSmartComputerGroupByNameV2(groupName)
if err != nil {
log.Fatalf("Error fetching Smart Computer Group by name: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig.json"

// Initialize the Jamf Pro client with the HTTP client configuration
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
Expand All @@ -19,10 +19,10 @@ func main() {
}

// Define the group ID
groupID := "5"
groupID := "1197"

// Call function
membership, err := client.GetSmartComputerGroupMembershipByID(groupID)
membership, err := client.GetSmartComputerGroupMembershipByIDV2(groupID)
if err != nil {
log.Fatalf("Error fetching smart computer group membership: %v", err)
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig.json"

// Initialize the Jamf Pro client with the HTTP client configuration
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/dafyddwatkins/localtesting/jamfpro/clientconfig.json"
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig.json"

// Initialize the Jamf Pro client with the HTTP client configuration
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
Expand All @@ -19,15 +19,15 @@ func main() {
}

// Define group ID to update
groupID := "1"
groupID := "1197"
siteID := "-1"

// Create update data
updateGroup := jamfpro.ResourceSmartComputerGroup{
updateGroup := jamfpro.ResourceSmartComputerGroupV2{
Name: "Updated Smart Group",
Criteria: []jamfpro.SharedSubsetCriteriaJamfProAPI{
{
Name: "Account",
Name: "Username",
Priority: 0,
AndOr: "and",
SearchType: "is",
Expand All @@ -40,7 +40,7 @@ func main() {
}

// Call function
updated, err := client.UpdateSmartComputerGroupByID(groupID, updateGroup)
updated, err := client.UpdateSmartComputerGroupByIDV2(groupID, updateGroup)
if err != nil {
log.Fatalf("Error updating smart computer group: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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 new static computer group
newGroup := jamfpro.ResourceStaticComputerGroupV2{
Name: "Static Test Group",
Description: "Some kind of description",
}

// Call function
created, err := client.CreateStaticComputerGroupV2(newGroup)
if err != nil {
log.Fatalf("Error creating static computer group: %v", err)
}

// Pretty print the JSON
response, err := json.MarshalIndent(created, "", " ")
if err != nil {
log.Fatalf("Error marshaling created group data: %v", err)
}
fmt.Println("Created Static Computer Group:\n", string(response))
}
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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 group ID to delete
groupID := "1199"

// Call function
err = client.DeleteStaticComputerGroupByIDV2(groupID)
if err != nil {
log.Fatalf("Error deleting static computer group: %v", err)
}

fmt.Printf("Successfully deleted static computer group with ID %s\n", groupID)
}
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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 a Static Computer Group ID for testing
groupID := "8" // Replace with actual group ID

// Call GetStaticComputerGroupByID function
group, err := client.GetStaticComputerGroupByIDV2(groupID)
if err != nil {
log.Fatalf("Error fetching Static Computer Group by ID: %v", err)
}

// Pretty print the group in JSON
groupJSON, err := json.MarshalIndent(group, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling Static Computer Group data: %v", err)
}
fmt.Println("Fetched Static Computer Group:\n", string(groupJSON))
}
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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 a Static Computer Group name for testing
groupName := "Excluded Devices" // Replace with actual group name

// Call GetStaticComputerGroupByName function
group, err := client.GetStaticComputerGroupByNameV2(groupName)
if err != nil {
log.Fatalf("Error fetching Static Computer Group by name: %v", err)
}

// Pretty print the group in JSON
groupJSON, err := json.MarshalIndent(group, "", " ") // Indent with 4 spaces
if err != nil {
log.Fatalf("Error marshaling Static Computer Group data: %v", err)
}
fmt.Println("Fetched Static Computer Group:\n", string(groupJSON))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package main

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

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

func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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)
}

// Set sorting filter (optional)
// For more information on how to add parameters to this request, see docs/url_queries.md

params := url.Values{}
params.Add("sort", "name:asc")

// Call function
groups, err := client.GetStaticComputerGroupsV2(params)
if err != nil {
log.Fatalf("Error fetching static computer groups v2: %v", err)
}

// Pretty print the JSON
response, err := json.MarshalIndent(groups, "", " ")
if err != nil {
log.Fatalf("Error marshaling groups data: %v", err)
}
fmt.Println("Fetched Static Computer Groups V2:\n", string(response))
}
Loading
Loading