Skip to content

Commit

Permalink
Merge pull request #441 from deploymenttheory/dev-jl
Browse files Browse the repository at this point in the history
Examples Lib Update: Adjusting all IDs to strings as per SDK change
  • Loading branch information
thejoeker12 authored Jul 23, 2024
2 parents 32a45a9 + 1d999fd commit 3c93ff3
Show file tree
Hide file tree
Showing 163 changed files with 185 additions and 229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"log"
"strconv"

"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
)
Expand Down Expand Up @@ -30,7 +31,7 @@ func main() {
fmt.Printf("Deleting account group ID: %d, Name: %s\n", group.ID, group.Name)

// Using the function to delete account groups by ID
err = client.DeleteAccountGroupByID(group.ID)
err = client.DeleteAccountGroupByID(strconv.Itoa(group.ID))
if err != nil {
log.Printf("Error deleting account group ID %d: %v\n", group.ID, err)
continue // Move to the next group if there's an error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// Define the variable for the group ID
groupID := 3 // Change this value as needed
groupID := "1" // Change this value as needed

// Call GetGroupByID function
group, err := client.GetAccountGroupByID(groupID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
},
}

accountGroupID := 2
accountGroupID := "1"

// Call UpdateAccountGroupByID function
updatedGroup, err := client.UpdateAccountGroupByID(accountGroupID, updatedAccountGroup)
Expand Down
2 changes: 1 addition & 1 deletion examples/accounts/DeleteAccountByID/DeleteAccountByID.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
}

// Let's assume you want to delete an account with ID 31.
accountID := 388
accountID := "388"

// Call DeleteAccountByID function
err = client.DeleteAccountByID(accountID)
Expand Down
2 changes: 1 addition & 1 deletion examples/accounts/GetAccountByID/GetAccountByID.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// Define the variable for the ID number
accountID := 2 // Change this value as needed
accountID := "2" // Change this value as needed

// Call GetAccountByID function
account, err := client.GetAccountByID(accountID)
Expand Down
2 changes: 1 addition & 1 deletion examples/accounts/UpdateAccountByID/UpdateAccountByID.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func main() {
}

// Let's assume we are updating an account with ID 1.
accountID := 501
accountID := "501"

// Call UpdateAccountByID function
updatedAccount, err := client.UpdateAccountByID(accountID, accountDetail)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}

advancedComputerSearchID := 1 // Replace 1 with the actual advanced computer search ID
advancedComputerSearchID := "1" // Replace 1 with the actual advanced computer search ID

// Delete the advanced computer search by ID
err = client.DeleteAdvancedComputerSearchByID(advancedComputerSearchID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}

advancedComputerSearchID := 1 // Replace 1 with the actual advanced computer search ID
advancedComputerSearchID := "1" // Replace 1 with the actual advanced computer search ID

// Call GetAdvancedComputerSearchByID function using the constant ID
advancedComputerSearch, err := client.GetAdvancedComputerSearchByID(advancedComputerSearchID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func main() {
},
}

searchID := 12
searchID := "12"

// Convert the profile to XML to see the output (optional, for debug purposes)
xmlData, err := xml.MarshalIndent(updatedSearch, "", " ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ func main() {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}

SearchIDToDelete := 123
SearchIDToDelete := "123"

// Use the client to delete an advanced mobile device search by ID
// Replace 123 with the actual ID
err = client.DeleteAdvancedMobileDeviceSearchByID(SearchIDToDelete)
if err != nil {
log.Fatalf("Error deleting advanced mobile device search by ID: %v", err)
} else {
log.Printf("Successfully deleted Advanced Mobile Device Search with ID: %d\n", SearchIDToDelete)
log.Printf("Successfully deleted Advanced Mobile Device Search with ID: %s\n", SearchIDToDelete)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// The ID of the advanced mobile device search you want to retrieve
searchID := 13 // Replace with the actual ID you want to retrieve
searchID := "13" // Replace with the actual ID you want to retrieve

// Call the GetAdvancedMobileDeviceSearchByID function
search, err := client.GetAdvancedMobileDeviceSearchByID(searchID)
Expand All @@ -34,5 +34,5 @@ func main() {
}

// Print the pretty XML
fmt.Printf("Advanced Mobile Device Search (ID: %d):\n%s\n", searchID, string(output))
fmt.Printf("Advanced Mobile Device Search (ID: %s):\n%s\n", searchID, string(output))
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func main() {
},
}

searchID := 14
searchID := "14"

// Convert the profile to XML to see the output (optional, for debug purposes)
xmlData, err := xml.MarshalIndent(updatedSearch, "", " ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func main() {
}

// Delete advanced user search by ID
err = client.DeleteAdvancedUserSearchByID(123) // Replace 123 with the actual ID
err = client.DeleteAdvancedUserSearchByID("123") // Replace 123 with the actual ID
if err != nil {
log.Fatalf("Error deleting advanced user search by ID: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// ID of the advanced user search to retrieve
advancedUserSearchID := 29 // Replace with the actual ID
advancedUserSearchID := "29" // Replace with the actual ID

// Call GetAdvancedUserSearchByID function
advancedUserSearch, err := client.GetAdvancedUserSearchByID(advancedUserSearchID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func main() {
},
}

searchID := 17 // Replace 123 with the actual ID
searchID := "17" // Replace 123 with the actual ID

// Update by ID
updatedByID, err := client.UpdateAdvancedUserSearchByID(searchID, updatedAdvancedUserSearch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
}

// Define the ID of the file extension you want to delete
fileExtensionID := 147 // Replace with the ID of the extension you want to delete
fileExtensionID := "147" // Replace with the ID of the extension you want to delete

// Call DeleteAllowedFileExtensionByID function
err = client.DeleteAllowedFileExtensionByID(fileExtensionID)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// Define the ID for the file extension you want to fetch
fileExtensionID := 142 // Replace with the desired ID
fileExtensionID := "142" // Replace with the desired ID

// Call GetAllowedFileExtensionByID function
allowedExtension, err := client.GetAllowedFileExtensionByID(fileExtensionID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func main() {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}

profileID := 8 // Use the actual ID of the profile to be deleted
profileID := "8" // Use the actual ID of the profile to be deleted

err = client.DeleteBYOProfileByID(profileID)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// Replace with the actual ID you want to retrieve
profileID := 11
profileID := "11"

profile, err := client.GetBYOProfileByID(profileID)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
},
}

profileID := 4 // Use the actual ID of the profile to be updated
profileID := "4" // 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, "", " ")
Expand Down
4 changes: 2 additions & 2 deletions examples/classes/DeleteClassByID/DeleteClassByID.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ func main() {
}

// The ID of the class you want to delete
classIDToDelete := 123 // Replace with the actual ID
classIDToDelete := "123" // Replace with the actual ID

// Call the delete function with the class ID
err = client.DeleteClassByID(classIDToDelete)
if err != nil {
log.Fatalf("Error deleting class by ID: %v", err)
} else {
fmt.Printf("Class with ID %d deleted successfully.\n", classIDToDelete)
fmt.Printf("Class with ID %s deleted successfully.\n", classIDToDelete)
}

}
5 changes: 3 additions & 2 deletions examples/classes/GetClassesByID/GetClassesByID.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"log"
"strconv"

"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
)
Expand All @@ -17,14 +18,14 @@ func main() {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}

classID := 1 // Replace with the actual ID of the class you want to fetch
classID := "1" // Replace with the actual ID of the class you want to fetch

// Get class by ID
class, err := client.GetClassByID(classID)
if err != nil {
log.Fatalf("Error fetching class by ID: %s\n", err)
}

fmt.Printf("Class ID: %d, Name: %s, Description: %s\n", class.ID, class.Name, class.Description)
fmt.Printf("Class ID: %v, Name: %s, Description: %s\n", strconv.Itoa(class.ID), class.Name, class.Description)
// Output additional class details as needed
}
2 changes: 1 addition & 1 deletion examples/classes/UpdateClassesByID/UpdateClassesByID.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func main() {
// Ensure other fields are aligned with the ResourceClass struct definition
}

classID := 7
classID := "7"

// Call the update function with the class ID and the new details.
err = client.UpdateClassByID(classID, updatedClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"log"
"strconv"

"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
)
Expand All @@ -29,7 +30,7 @@ func main() {
for _, extAtt := range extAtts.Results {
fmt.Printf("Deleting computer extension attribute ID: %d, Name: %s\n", extAtt.ID, extAtt.Name)

err = client.DeleteComputerExtensionAttributeByID(extAtt.ID)
err = client.DeleteComputerExtensionAttributeByID(strconv.Itoa(extAtt.ID))
if err != nil {
log.Printf("Error deleting computer extension attribute ID %d: %v\n", extAtt.ID, err)
continue // Move to the next computer extension attribute if there's an error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func main() {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}

AttributeIDToDelete := 1 // Replace 1 with the actual attribute ID
AttributeIDToDelete := "1" // Replace 1 with the actual attribute ID

// Deleting the attribute with specified ID
err = client.DeleteComputerExtensionAttributeByID(AttributeIDToDelete)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"regexp"
"strconv"
"strings"

"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
Expand Down Expand Up @@ -51,7 +52,7 @@ func main() {
log.Printf("Processing extension attribute '%s' (ID: %d)\n", attributeItem.Name, attributeItem.ID)

// Get details for each attribute
attribute, err := client.GetComputerExtensionAttributeByID(attributeItem.ID)
attribute, err := client.GetComputerExtensionAttributeByID(strconv.Itoa(attributeItem.ID))
if err != nil {
log.Printf("Failed to fetch details for attribute %s (ID: %d): %v", attributeItem.Name, attributeItem.ID, err)
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// Provide the ID of the computer extension attribute you want to fetch
attributeID := 1 // You can change this ID as required
attributeID := "1" // You can change this ID as required

// Call GetComputerExtensionAttributeByID function
attribute, err := client.GetComputerExtensionAttributeByID(attributeID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
}

// Assuming you're updating the attribute with ID = 1
updatedAttribute, err := client.UpdateComputerExtensionAttributeByID(1, attributeToUpdate)
updatedAttribute, err := client.UpdateComputerExtensionAttributeByID("1", attributeToUpdate)
if err != nil {
log.Fatalf("Error updating Computer Extension Attribute by ID: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// Define the fuction parameters
computerID := 21
computerID := "1"

// Call the GetComputerHistoryByComputerID function
computerHistory, err := client.GetComputerHistoryByComputerID(computerID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
}

// Define the fuction parameters
computerID := 18
computerID := "1"
DataSubset := "General" // General / ComputerUsageLogs / Audits / PolicyLogs / CasperRemoteLogs / ScreenSharingLogs / CasperImagingLogs / Commands / UserLocation / MacAppStoreApplications

// Call the GetComputerHistoryByComputerIDAndDataSubset function
Expand Down
Loading

0 comments on commit 3c93ff3

Please sign in to comment.