Skip to content

Commit bf7593b

Browse files
committed
fix: jamf connect structs and crud funcs
1 parent bc5b31c commit bf7593b

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

examples/jamf_connect/RetryJamfConnectDeploymentTasksByID/RetryJamfConnectDeploymentTasksByID.go renamed to examples/jamf_connect/RetryJamfConnectDeploymentTasksByConfigProfileUUID/RetryJamfConnectDeploymentTasksByConfigProfileUUID.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ func main() {
1717
}
1818

1919
// Example config profile UUID and computer IDs to retry
20-
configProfileUUID := "24a7bb2a-9871-4895-9009-d1be07ed31b1"
20+
configProfileUUID := "5ec9527a-40da-4633-9ccc-7fc3fecea1dc"
2121
computerIDs := []string{"1", "2"}
2222

23-
err = client.RetryJamfConnectDeploymentTasksByID(configProfileUUID, computerIDs)
23+
err = client.RetryJamfConnectDeploymentTasksByConfigProfileUUID(configProfileUUID, computerIDs)
2424
if err != nil {
2525
log.Fatalf("Error retrying tasks: %v", err)
2626
}

examples/jamf_connect/UpdateJamfConnectConfigProfileByID/UpdateJamfConnectConfigProfileByID.go renamed to examples/jamf_connect/UpdateJamfConnectConfigProfileByConfigProfileUUID/UpdateJamfConnectConfigProfileByConfigProfileUUID.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ func main() {
2020

2121
// Create update payload
2222
profileUpdate := &jamfpro.ResourceJamfConnectConfigProfileUpdate{
23-
Version: "2.3.0",
24-
AutoDeploymentType: "PATCH_UPDATES", // Can be PATCH_UPDATES, MINOR_AND_PATCH_UPDATES, INITIAL_INSTALLATION_ONLY, or NONE
23+
JamfConnectVersion: "2.43.0", // 2.43.0 / 2.42.0 / 2.41.0 / 2.41.0 / 2.40.0 / 2.39.0 / 2.38.0 / 2.37.0 / 2.36.1 / 2.36.0
24+
AutoDeploymentType: "MINOR_AND_PATCH_UPDATES", // "NONE" / "PATCH_UPDATES" / "MINOR_AND_PATCH_UPDATES"
2525
}
2626

2727
// Define the UUID of the profile to update
28-
profileUUID := "d265dfd3-8fde-4bf2-aa56-b167c8b68069"
28+
profileUUID := "e9224719-906e-4879-b393-f302fa40e89d"
2929

30-
updatedProfile, err := client.UpdateJamfConnectConfigProfileByID(profileUUID, profileUpdate)
30+
updatedProfile, err := client.UpdateJamfConnectConfigProfileByConfigProfileUUID(profileUUID, profileUpdate)
3131
if err != nil {
3232
log.Fatalf("Error updating Jamf Connect config profile: %v", err)
3333
}

sdk/jamfpro/jamfproapi_jamf_connect.go

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ type ResourceJamfConnect struct {
5252

5353
// Struct representing a Jamf Connect config profile
5454
type ResourceJamfConnectConfigProfile struct {
55-
UUID string `json:"uuid"`
56-
ProfileID string `json:"profileId"`
57-
ProfileName string `json:"profileName"`
58-
ProfileScopeDescription string `json:"profileScopeDescription"`
59-
Version string `json:"version"`
60-
AutoDeploymentType string `json:"autoDeploymentType"`
55+
UUID string `json:"uuid"`
56+
ProfileID int `json:"profileId"`
57+
ProfileName string `json:"profileName"`
58+
ScopeDescription string `json:"scopeDescription"`
59+
SiteID string `json:"siteId"`
60+
Version string `json:"version"`
61+
AutoDeploymentType string `json:"autoDeploymentType"`
6162
}
6263

6364
// ResourceJamfConnectTaskRetry represents the request structure for task retry
@@ -67,8 +68,8 @@ type ResourceJamfConnectTaskRetry struct {
6768

6869
// ResourceJamfConnectConfigProfileUpdate represents the updateable fields for a Jamf Connect profile
6970
type ResourceJamfConnectConfigProfileUpdate struct {
70-
Version string `json:"version"`
71-
AutoDeploymentType string `json:"autoDeploymentType"`
71+
JamfConnectVersion string `json:"version,omitempty"`
72+
AutoDeploymentType string `json:"autoDeploymentType,omitempty"`
7273
}
7374

7475
// CRUD
@@ -90,7 +91,7 @@ func (c *Client) GetJamfConnectSettings() (*ResourceJamfConnect, error) {
9091
return &jamfConnect, nil
9192
}
9293

93-
// GetJamfConnectConfigProfiles Gets full list of Jamf Connect config profiles & handles pagination
94+
// GetJamfConnectConfigProfiles gets full list of Jamf Connect config profiles & handles pagination
9495
func (c *Client) GetJamfConnectConfigProfiles(sort_filter string) (*ResponseJamfConnectConfigProfilesList, error) {
9596
endpoint := fmt.Sprintf("%s/config-profiles", uriJamfConnect)
9697

@@ -120,15 +121,15 @@ func (c *Client) GetJamfConnectConfigProfiles(sort_filter string) (*ResponseJamf
120121
return &out, nil
121122
}
122123

123-
// UpdateJamfConnectConfigProfile updates the way the Jamf Connect app gets updated on computers within scope of the associated configuration profile.
124+
// UpdateJamfConnectConfigProfileByConfigProfileUUID updates the way the Jamf Connect app gets updated on computers within scope of the associated configuration profile.
124125
// The profile is identified by its UUID.
125-
func (c *Client) UpdateJamfConnectConfigProfileByID(id string, profileUpdate *ResourceJamfConnectConfigProfileUpdate) (*ResourceJamfConnectConfigProfile, error) {
126-
endpoint := fmt.Sprintf("%s/config-profiles/%s", uriJamfConnect, id)
126+
func (c *Client) UpdateJamfConnectConfigProfileByConfigProfileUUID(configProfileUUID string, profileUpdate *ResourceJamfConnectConfigProfileUpdate) (*ResourceJamfConnectConfigProfile, error) {
127+
endpoint := fmt.Sprintf("%s/config-profiles/%s", uriJamfConnect, configProfileUUID)
127128
var updatedProfile ResourceJamfConnectConfigProfile
128129

129130
resp, err := c.HTTP.DoRequest("PUT", endpoint, profileUpdate, &updatedProfile)
130131
if err != nil {
131-
return nil, fmt.Errorf(errMsgFailedUpdateByID, "jamf connect config profile", id, err)
132+
return nil, fmt.Errorf(errMsgFailedUpdateByID, "jamf connect config profile", configProfileUUID, err)
132133
}
133134

134135
if resp != nil && resp.Body != nil {
@@ -138,9 +139,9 @@ func (c *Client) UpdateJamfConnectConfigProfileByID(id string, profileUpdate *Re
138139
return &updatedProfile, nil
139140
}
140141

141-
// RetryJamfConnectDeploymentTasks requests a retry of Connect install tasks for a specified computers
142+
// RetryJamfConnectDeploymentTasksByConfigProfileUUID requests a retry of Connect install tasks for a specified computers
142143
// asscoiated with a specific jamf connect configuration profile.
143-
func (c *Client) RetryJamfConnectDeploymentTasksByID(configProfileUUID string, computerIDs []string) error {
144+
func (c *Client) RetryJamfConnectDeploymentTasksByConfigProfileUUID(configProfileUUID string, computerIDs []string) error {
144145
endpoint := fmt.Sprintf("%s/deployments/%s/tasks/retry", uriJamfConnect, configProfileUUID)
145146

146147
requestBody := &ResourceJamfConnectTaskRetry{

0 commit comments

Comments
 (0)