diff --git a/examples/policies/UpdatePolicyByID/UpdatePolicyByID.go b/examples/policies/UpdatePolicyByID/UpdatePolicyByID.go index 5adc802f..cf9aa8aa 100644 --- a/examples/policies/UpdatePolicyByID/UpdatePolicyByID.go +++ b/examples/policies/UpdatePolicyByID/UpdatePolicyByID.go @@ -23,13 +23,13 @@ func main() { General: jamfpro.PolicySubsetGeneral{ Name: "disk-encryption-sdk", Enabled: false, - Trigger: "EVENT", TriggerCheckin: false, TriggerEnrollmentComplete: false, TriggerLogin: false, TriggerLogout: false, TriggerNetworkStateChanged: false, TriggerStartup: false, + TriggerOther: "EVENT", Frequency: "Once per computer", RetryEvent: "none", RetryAttempts: -1, @@ -37,6 +37,30 @@ func main() { LocationUserOnly: false, TargetDrive: "/", Offline: false, + Category: &jamfpro.SharedResourceCategory{ + ID: -1, + Name: "No category assigned", + }, + DateTimeLimitations: &jamfpro.PolicySubsetGeneralDateTimeLimitations{ + ActivationDate: "", + ActivationDateEpoch: 0, + ActivationDateUTC: "", + ExpirationDate: "", + ExpirationDateEpoch: 0, + ExpirationDateUTC: "", + NoExecuteStart: "", + NoExecuteEnd: "", + }, + NetworkLimitations: &jamfpro.PolicySubsetGeneralNetworkLimitations{ + MinimumNetworkConnection: "No Minimum", + AnyIPAddress: true, + NetworkSegments: "", + }, + NetworkRequirements: "Any", + Site: &jamfpro.SharedResourceSite{ + ID: -1, + Name: "None", + }, }, SelfService: &jamfpro.PolicySubsetSelfService{ UseForSelfService: false, @@ -47,30 +71,28 @@ func main() { ForceUsersToViewDescription: false, //SelfServiceIcon: jamfpro.PolicySelfServiceIcon{ID: -1, Filename: "", URI: ""}, FeatureOnMainPage: false, - SelfServiceCategories: []jamfpro.PolicySubsetSelfServiceCategory{ + SelfServiceCategories: &[]jamfpro.PolicySubsetSelfServiceCategory{ { - Category: jamfpro.PolicyCategory{ - //ID: "-1", - //Name: "None", - DisplayIn: false, // or true, depending on your requirements - FeatureIn: false, // or true, depending on your requirements - }, + ID: -1, + Name: "None", + DisplayIn: false, // or true, depending on your requirements + FeatureIn: false, // or true, depending on your requirements }, }, }, - AccountMaintenance: jamfpro.PolicySubsetAccountMaintenance{ - ManagementAccount: jamfpro.PolicySubsetAccountMaintenanceManagementAccount{ + AccountMaintenance: &jamfpro.PolicySubsetAccountMaintenance{ + ManagementAccount: &jamfpro.PolicySubsetAccountMaintenanceManagementAccount{ Action: "rotate", ManagedPassword: "", ManagedPasswordLength: 0, }, - OpenFirmwareEfiPassword: jamfpro.PolicySubsetAccountMaintenanceOpenFirmwareEfiPassword{ + OpenFirmwareEfiPassword: &jamfpro.PolicySubsetAccountMaintenanceOpenFirmwareEfiPassword{ OfMode: "none", OfPassword: "", OfPasswordSHA256: "", }, }, - Maintenance: jamfpro.PolicySubsetMaintenance{ + Maintenance: &jamfpro.PolicySubsetMaintenance{ Recon: false, ResetName: false, InstallAllCachedPackages: false, @@ -82,7 +104,7 @@ func main() { UserCache: false, Verify: false, }, - FilesProcesses: jamfpro.PolicySubsetFilesProcesses{ + FilesProcesses: &jamfpro.PolicySubsetFilesProcesses{ DeleteFile: false, UpdateLocateDatabase: false, SpotlightSearch: "", @@ -90,21 +112,21 @@ func main() { KillProcess: false, RunCommand: "", }, - UserInteraction: jamfpro.PolicySubsetUserInteraction{ + UserInteraction: &jamfpro.PolicySubsetUserInteraction{ MessageStart: "", AllowUserToDefer: false, AllowDeferralUntilUtc: "", AllowDeferralMinutes: 0, MessageFinish: "", }, - DiskEncryption: jamfpro.PolicySubsetDiskEncryption{ + DiskEncryption: &jamfpro.PolicySubsetDiskEncryption{ Action: "apply", DiskEncryptionConfigurationID: 1, AuthRestart: true, //RemediateKeyType: "", //RemediateDiskEncryptionConfigurationID: 0, }, - Reboot: jamfpro.PolicySubsetReboot{ + Reboot: &jamfpro.PolicySubsetReboot{ Message: "This computer will restart in 5 minutes. Please save anything you are working on and log out by choosing Log Out from the bottom of the Apple menu.", StartupDisk: "Current Startup Disk", SpecifyStartup: "", @@ -132,5 +154,4 @@ func main() { // Print the ID of the updated policy fmt.Printf("Updated Policy ID: %d\n", response.ID) - } diff --git a/examples/policies/UpdatePolicyByName/UpdatePolicyByName.go b/examples/policies/UpdatePolicyByName/UpdatePolicyByName.go index 412e96fe..82523f39 100644 --- a/examples/policies/UpdatePolicyByName/UpdatePolicyByName.go +++ b/examples/policies/UpdatePolicyByName/UpdatePolicyByName.go @@ -23,13 +23,13 @@ func main() { General: jamfpro.PolicySubsetGeneral{ Name: "disk-encryption-sdk", Enabled: false, - Trigger: "EVENT", TriggerCheckin: false, TriggerEnrollmentComplete: false, TriggerLogin: false, TriggerLogout: false, TriggerNetworkStateChanged: false, TriggerStartup: false, + TriggerOther: "EVENT", Frequency: "Once per computer", RetryEvent: "none", RetryAttempts: -1, @@ -37,8 +37,32 @@ func main() { LocationUserOnly: false, TargetDrive: "/", Offline: false, + Category: &jamfpro.SharedResourceCategory{ + ID: -1, + Name: "No category assigned", + }, + DateTimeLimitations: &jamfpro.PolicySubsetGeneralDateTimeLimitations{ + ActivationDate: "", + ActivationDateEpoch: 0, + ActivationDateUTC: "", + ExpirationDate: "", + ExpirationDateEpoch: 0, + ExpirationDateUTC: "", + NoExecuteStart: "", + NoExecuteEnd: "", + }, + NetworkLimitations: &jamfpro.PolicySubsetGeneralNetworkLimitations{ + MinimumNetworkConnection: "No Minimum", + AnyIPAddress: true, + NetworkSegments: "", + }, + NetworkRequirements: "Any", + Site: &jamfpro.SharedResourceSite{ + ID: -1, + Name: "None", + }, }, - SelfService: jamfpro.PolicySubsetSelfService{ + SelfService: &jamfpro.PolicySubsetSelfService{ UseForSelfService: false, SelfServiceDisplayName: "", InstallButtonText: "Install", @@ -47,30 +71,28 @@ func main() { ForceUsersToViewDescription: false, //SelfServiceIcon: jamfpro.PolicySelfServiceIcon{ID: -1, Filename: "", URI: ""}, FeatureOnMainPage: false, - SelfServiceCategories: []jamfpro.PolicySubsetSelfServiceCategory{ + SelfServiceCategories: &[]jamfpro.PolicySubsetSelfServiceCategory{ { - Category: jamfpro.PolicyCategory{ - //ID: "-1", - //Name: "None", - DisplayIn: false, // or true, depending on your requirements - FeatureIn: false, // or true, depending on your requirements - }, + ID: -1, + Name: "None", + DisplayIn: false, // or true, depending on your requirements + FeatureIn: false, // or true, depending on your requirements }, }, }, - AccountMaintenance: jamfpro.PolicySubsetAccountMaintenance{ - ManagementAccount: jamfpro.PolicySubsetAccountMaintenanceManagementAccount{ + AccountMaintenance: &jamfpro.PolicySubsetAccountMaintenance{ + ManagementAccount: &jamfpro.PolicySubsetAccountMaintenanceManagementAccount{ Action: "rotate", ManagedPassword: "", ManagedPasswordLength: 0, }, - OpenFirmwareEfiPassword: jamfpro.PolicySubsetAccountMaintenanceOpenFirmwareEfiPassword{ + OpenFirmwareEfiPassword: &jamfpro.PolicySubsetAccountMaintenanceOpenFirmwareEfiPassword{ OfMode: "none", OfPassword: "", OfPasswordSHA256: "", }, }, - Maintenance: jamfpro.PolicySubsetMaintenance{ + Maintenance: &jamfpro.PolicySubsetMaintenance{ Recon: false, ResetName: false, InstallAllCachedPackages: false, @@ -82,7 +104,7 @@ func main() { UserCache: false, Verify: false, }, - FilesProcesses: jamfpro.PolicySubsetFilesProcesses{ + FilesProcesses: &jamfpro.PolicySubsetFilesProcesses{ DeleteFile: false, UpdateLocateDatabase: false, SpotlightSearch: "", @@ -90,21 +112,21 @@ func main() { KillProcess: false, RunCommand: "", }, - UserInteraction: jamfpro.PolicySubsetUserInteraction{ + UserInteraction: &jamfpro.PolicySubsetUserInteraction{ MessageStart: "", AllowUserToDefer: false, AllowDeferralUntilUtc: "", AllowDeferralMinutes: 0, MessageFinish: "", }, - DiskEncryption: jamfpro.PolicySubsetDiskEncryption{ + DiskEncryption: &jamfpro.PolicySubsetDiskEncryption{ Action: "apply", DiskEncryptionConfigurationID: 1, AuthRestart: true, //RemediateKeyType: "", //RemediateDiskEncryptionConfigurationID: 0, }, - Reboot: jamfpro.PolicySubsetReboot{ + Reboot: &jamfpro.PolicySubsetReboot{ Message: "This computer will restart in 5 minutes. Please save anything you are working on and log out by choosing Log Out from the bottom of the Apple menu.", StartupDisk: "Current Startup Disk", SpecifyStartup: "", @@ -122,7 +144,7 @@ func main() { } fmt.Println("Policy Details to be Sent:\n", string(policyXML)) - policyName := "policy-creation-test" + policyName := "disk-encryption-sdk" // Update the policy response, err := client.UpdatePolicyByName(policyName, updatedPolicy) @@ -132,5 +154,4 @@ func main() { // Print the ID of the updated policy fmt.Printf("Updated Policy ID: %d\n", response.ID) - }