Skip to content

Commit b261e3e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into nm-mobile-device-prestages-2025-11-08
2 parents e5b714c + d911ca8 commit b261e3e

File tree

11 files changed

+653
-54
lines changed

11 files changed

+653
-54
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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+
// Create new smart mobile device group
22+
siteID := "-1"
23+
newGroup := jamfpro.ResourceSmartMobileDeviceGroupV1{
24+
GroupName: "Operating System Version like 18",
25+
GroupDescription: "This is a description",
26+
Criteria: []jamfpro.SharedSubsetCriteriaJamfProAPI{
27+
{
28+
Name: "OS Version",
29+
Priority: 0,
30+
AndOr: "and",
31+
SearchType: "like",
32+
Value: "18",
33+
OpeningParen: jamfpro.TruePtr(),
34+
ClosingParen: jamfpro.FalsePtr(),
35+
},
36+
{
37+
Name: "Model",
38+
Priority: 1,
39+
AndOr: "and",
40+
SearchType: "like",
41+
Value: "iPad",
42+
OpeningParen: jamfpro.FalsePtr(),
43+
ClosingParen: jamfpro.TruePtr(),
44+
},
45+
},
46+
SiteId: &siteID,
47+
}
48+
49+
// Call function
50+
created, err := client.CreateSmartMobileDeviceGroupV1(newGroup)
51+
if err != nil {
52+
log.Fatalf("Error creating smart mobile device group: %v", err)
53+
}
54+
55+
// Pretty print the JSON
56+
response, err := json.MarshalIndent(created, "", " ")
57+
if err != nil {
58+
log.Fatalf("Error marshaling created group data: %v", err)
59+
}
60+
fmt.Println("Created Smart Mobile Device Group:\n", string(response))
61+
}
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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 group ID to delete
21+
groupID := "4"
22+
23+
// Call function
24+
err = client.DeleteSmartMobileDeviceGroupByIDV1(groupID)
25+
if err != nil {
26+
log.Fatalf("Error deleting smart mobile device group: %v", err)
27+
}
28+
29+
fmt.Printf("Successfully deleted smart mobile device group with ID %s\n", groupID)
30+
}
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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 a Smart Mobile Device Group ID for testing
22+
groupID := "5" // Replace with actual group ID
23+
24+
// Call GetSmartMobileDeviceGroupByID function
25+
group, err := client.GetSmartMobileDeviceGroupByIDV1(groupID)
26+
if err != nil {
27+
log.Fatalf("Error fetching Smart Mobile Device Group by ID: %v", err)
28+
}
29+
30+
// Pretty print the group in JSON
31+
groupJSON, err := json.MarshalIndent(group, "", " ") // Indent with 4 spaces
32+
if err != nil {
33+
log.Fatalf("Error marshaling Smart Mobile Device Group data: %v", err)
34+
}
35+
fmt.Println("Fetched Smart Mobile Device Group:\n", string(groupJSON))
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/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 a Smart Mobile Device Group name for testing
22+
groupName := "Operating System Version like 18" // Replace with actual group name
23+
24+
// Call GetSmartMobileDeviceGroupByName function
25+
group, err := client.GetSmartMobileDeviceGroupByNameV1(groupName)
26+
if err != nil {
27+
log.Fatalf("Error fetching Smart Mobile Device Group by name: %v", err)
28+
}
29+
30+
// Pretty print the group in JSON
31+
groupJSON, err := json.MarshalIndent(group, "", " ") // Indent with 4 spaces
32+
if err != nil {
33+
log.Fatalf("Error marshaling Smart Mobile Device Group data: %v", err)
34+
}
35+
fmt.Println("Fetched Smart Mobile Device Group:\n", string(groupJSON))
36+
}
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig-fleet.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 group ID
22+
groupID := "5"
23+
24+
// Call function
25+
membership, err := client.GetSmartMobileDeviceGroupMembershipByIDV1(groupID)
26+
if err != nil {
27+
log.Fatalf("Error fetching smart mobile device group membership: %v", err)
28+
}
29+
30+
// Pretty print the JSON
31+
response, err := json.MarshalIndent(membership, "", " ")
32+
if err != nil {
33+
log.Fatalf("Error marshaling membership data: %v", err)
34+
}
35+
fmt.Println("Fetched Smart Computer Group Membership:\n", string(response))
36+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"log"
7+
"net/url"
8+
9+
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
10+
)
11+
12+
func main() {
13+
// Define the path to the JSON configuration file
14+
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig-fleet.json"
15+
16+
// Initialize the Jamf Pro client with the HTTP client configuration
17+
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
18+
if err != nil {
19+
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
20+
}
21+
22+
// Set sorting filter (optional)
23+
// For more information on how to add parameters to this request, see docs/url_queries.md
24+
25+
params := url.Values{}
26+
params.Add("sort", "groupName:asc")
27+
28+
// Call function
29+
groups, err := client.GetSmartMobileDeviceGroupsV1(params)
30+
if err != nil {
31+
log.Fatalf("Error fetching smart mobile device groups v1: %v", err)
32+
}
33+
34+
// Pretty print the JSON
35+
response, err := json.MarshalIndent(groups, "", " ")
36+
if err != nil {
37+
log.Fatalf("Error marshaling groups data: %v", err)
38+
}
39+
fmt.Println("Fetched Smart Mobile Device Groups V1:\n", string(response))
40+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig-fleet.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 group ID to update
22+
groupID := "5"
23+
siteID := "-1"
24+
25+
// Create update data
26+
updateGroup := jamfpro.ResourceSmartMobileDeviceGroupV1{
27+
GroupName: "Updated Smart Group",
28+
GroupDescription: "This is an updated smart group",
29+
Criteria: []jamfpro.SharedSubsetCriteriaJamfProAPI{
30+
{
31+
Name: "Username",
32+
Priority: 0,
33+
AndOr: "and",
34+
SearchType: "is",
35+
Value: "test",
36+
OpeningParen: jamfpro.FalsePtr(),
37+
ClosingParen: jamfpro.FalsePtr(),
38+
},
39+
},
40+
SiteId: &siteID,
41+
}
42+
43+
// Call function
44+
updated, err := client.UpdateSmartMobileDeviceGroupByIDV1(groupID, updateGroup)
45+
if err != nil {
46+
log.Fatalf("Error updating smart mobile device group: %v", err)
47+
}
48+
49+
// Pretty print the JSON
50+
response, err := json.MarshalIndent(updated, "", " ")
51+
if err != nil {
52+
log.Fatalf("Error marshaling updated group data: %v", err)
53+
}
54+
fmt.Println("Updated Smart Computer Group:\n", string(response))
55+
}

go.mod

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ require (
99
)
1010

1111
require (
12-
github.com/aws/aws-sdk-go-v2 v1.39.4
13-
github.com/aws/aws-sdk-go-v2/config v1.31.15
14-
github.com/aws/aws-sdk-go-v2/credentials v1.18.19
15-
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.0
16-
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.7
12+
github.com/aws/aws-sdk-go-v2 v1.39.6
13+
github.com/aws/aws-sdk-go-v2/config v1.31.17
14+
github.com/aws/aws-sdk-go-v2/credentials v1.18.21
15+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.2
16+
github.com/aws/aws-sdk-go-v2/service/s3 v1.90.0
1717
github.com/mitchellh/mapstructure v1.5.0
1818
github.com/mmcdole/gofeed v1.3.0
1919
golang.org/x/crypto v0.43.0
@@ -23,20 +23,20 @@ require (
2323
require (
2424
github.com/PuerkitoBio/goquery v1.8.0 // indirect
2525
github.com/andybalholm/cascadia v1.3.1 // indirect
26-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.2 // indirect
27-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.11 // indirect
28-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.11 // indirect
29-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.11 // indirect
26+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 // indirect
27+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 // indirect
28+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 // indirect
29+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 // indirect
3030
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
31-
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.11 // indirect
32-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.2 // indirect
33-
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.2 // indirect
34-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.11 // indirect
35-
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.11 // indirect
36-
github.com/aws/aws-sdk-go-v2/service/sso v1.29.8 // indirect
37-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.3 // indirect
38-
github.com/aws/aws-sdk-go-v2/service/sts v1.38.9 // indirect
39-
github.com/aws/smithy-go v1.23.1 // indirect
31+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.13 // indirect
32+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect
33+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.4 // indirect
34+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 // indirect
35+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.13 // indirect
36+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.1 // indirect
37+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.5 // indirect
38+
github.com/aws/aws-sdk-go-v2/service/sts v1.39.1 // indirect
39+
github.com/aws/smithy-go v1.23.2 // indirect
4040
github.com/json-iterator/go v1.1.12 // indirect
4141
github.com/mmcdole/goxpp v1.1.1-0.20240225020742-a0c311522b23 // indirect
4242
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect

0 commit comments

Comments
 (0)