@@ -31,50 +31,51 @@ type MobileDeviceApplicationsListItem struct {
31
31
DisplayName string `xml:"display_name"`
32
32
BundleID string `xml:"bundle_id"`
33
33
Version string `xml:"version"`
34
- InternalApp bool `xml:"internal_app"`
34
+ InternalApp * bool `xml:"internal_app"`
35
35
}
36
36
37
37
// Resource
38
38
39
39
// ResourceMobileDeviceApplication represents the detailed structure of a single mobile device application.
40
40
type ResourceMobileDeviceApplication struct {
41
- General MobileDeviceApplicationSubsetGeneral `xml:"general"`
41
+ General MobileDeviceApplicationSubsetGeneral `xml:"general"`
42
+ Scope MobileDeviceApplicationSubsetScope `xml:"scope"`
43
+ SelfService MobileDeviceApplicationSubsetGeneralSelfService `xml:"self_service"`
44
+ VPP MobileDeviceApplicationSubsetGeneralVPP `xml:"vpp,omitempty"`
45
+ AppConfiguration MobileDeviceApplicationSubsetGeneralAppConfiguration `xml:"app_configuration,omitempty"`
42
46
}
43
47
44
48
// Subsets and Containers
45
49
46
50
type MobileDeviceApplicationSubsetGeneral struct {
47
- ID int `xml:"id,omitempty"`
48
- Name string `xml:"name"`
49
- DisplayName string `xml:"display_name"`
50
- Description string `xml:"description,omitempty"`
51
- BundleID string `xml:"bundle_id"`
52
- Version string `xml:"version"`
53
- InternalApp bool `xml:"internal_app,omitempty"`
54
- OsType string `xml:"os_type,omitempty"`
55
- Category * SharedResourceCategory `xml:"category"`
56
- IPA MobileDeviceApplicationSubsetGeneralIPA `xml:"ipa,omitempty"`
57
- Icon MobileDeviceApplicationSubsetIcon `xml:"icon"`
58
- ProvisioningProfile int `xml:"mobile_device_provisioning_profile,omitempty"`
59
- ITunesStoreURL string `xml:"itunes_store_url,omitempty"`
60
- MakeAvailableAfterInstall bool `xml:"make_available_after_install,omitempty"`
61
- ITunesCountryRegion string `xml:"itunes_country_region,omitempty"`
62
- ITunesSyncTime int `xml:"itunes_sync_time,omitempty"`
63
- DeploymentType string `xml:"deployment_type,omitempty"`
64
- DeployAutomatically bool `xml:"deploy_automatically,omitempty"`
65
- DeployAsManagedApp bool `xml:"deploy_as_managed_app,omitempty"`
66
- RemoveAppWhenMDMProfileIsRemoved bool `xml:"remove_app_when_mdm_profile_is_removed,omitempty"`
67
- PreventBackupOfAppData bool `xml:"prevent_backup_of_app_data,omitempty"`
68
- KeepDescriptionAndIconUpToDate bool `xml:"keep_description_and_icon_up_to_date,omitempty"`
69
- Free bool `xml:"free,omitempty"`
70
- TakeOverManagement bool `xml:"take_over_management,omitempty"`
71
- HostExternally bool `xml:"host_externally,omitempty"`
72
- ExternalURL string `xml:"external_url,omitempty"`
73
- Site * SharedResourceSite `xml:"site"`
74
- Scope MobileDeviceApplicationSubsetScope `xml:"scope"`
75
- SelfService MobileDeviceApplicationSubsetGeneralSelfService `xml:"self_service"`
76
- VPP MobileDeviceApplicationSubsetGeneralVPP `xml:"vpp,omitempty"`
77
- AppConfiguration MobileDeviceApplicationSubsetGeneralAppConfiguration `xml:"app_configuration,omitempty"`
51
+ ID int `xml:"id,omitempty"`
52
+ Name string `xml:"name"`
53
+ DisplayName string `xml:"display_name"`
54
+ Description string `xml:"description,omitempty"`
55
+ BundleID string `xml:"bundle_id"`
56
+ Version string `xml:"version"`
57
+ InternalApp * bool `xml:"internal_app,omitempty"`
58
+ OsType string `xml:"os_type,omitempty"`
59
+ Category * SharedResourceCategory `xml:"category"`
60
+ IPA MobileDeviceApplicationSubsetGeneralIPA `xml:"ipa,omitempty"`
61
+ Icon MobileDeviceApplicationSubsetIcon `xml:"icon"`
62
+ ProvisioningProfile int `xml:"mobile_device_provisioning_profile,omitempty"`
63
+ ITunesStoreURL string `xml:"itunes_store_url,omitempty"`
64
+ MakeAvailableAfterInstall bool `xml:"make_available_after_install,omitempty"`
65
+ ITunesCountryRegion string `xml:"itunes_country_region,omitempty"`
66
+ ITunesSyncTime int `xml:"itunes_sync_time,omitempty"`
67
+ DeploymentType string `xml:"deployment_type,omitempty"`
68
+ DeployAutomatically * bool `xml:"deploy_automatically,omitempty"`
69
+ DeployAsManagedApp * bool `xml:"deploy_as_managed_app,omitempty"`
70
+ RemoveAppWhenMDMProfileIsRemoved * bool `xml:"remove_app_when_mdm_profile_is_removed,omitempty"`
71
+ PreventBackupOfAppData * bool `xml:"prevent_backup_of_app_data,omitempty"`
72
+ KeepDescriptionAndIconUpToDate * bool `xml:"keep_description_and_icon_up_to_date,omitempty"`
73
+ KeepAppUpdatedOnDevices * bool `xml:"keep_app_updated_on_devices,omitempty"`
74
+ Free * bool `xml:"free,omitempty"`
75
+ TakeOverManagement * bool `xml:"take_over_management,omitempty"`
76
+ HostExternally * bool `xml:"host_externally,omitempty"`
77
+ ExternalURL string `xml:"external_url,omitempty"`
78
+ Site * SharedResourceSite `xml:"site"`
78
79
}
79
80
80
81
type MobileDeviceApplicationSubsetGeneralIPA struct {
@@ -86,50 +87,53 @@ type MobileDeviceApplicationSubsetGeneralIPA struct {
86
87
type MobileDeviceApplicationSubsetGeneralSelfService struct {
87
88
SelfServiceDescription string `xml:"self_service_description,omitempty"`
88
89
SelfServiceIcon MobileDeviceApplicationSubsetIcon `xml:"self_service_icon,omitempty"`
89
- FeatureOnMainPage bool `xml:"feature_on_main_page,omitempty"`
90
+ FeatureOnMainPage * bool `xml:"feature_on_main_page,omitempty"`
90
91
SelfServiceCategories []SharedResourceSelfServiceCategory `xml:"self_service_categories>category,omitempty"`
91
- Notification bool `xml:"notification,omitempty"`
92
+ Notification * bool `xml:"notification,omitempty"`
92
93
NotificationSubject string `xml:"notification_subject,omitempty"`
93
94
NotificationMessage string `xml:"notification_message,omitempty"`
94
95
}
95
96
96
97
type MobileDeviceApplicationSubsetGeneralVPP struct {
97
- AssignVPPDeviceBasedLicenses bool `xml:"assign_vpp_device_based_licenses,omitempty"`
98
- VPPAdminAccountID int `xml:"vpp_admin_account_id,omitempty"`
98
+ AssignVPPDeviceBasedLicenses * bool `xml:"assign_vpp_device_based_licenses,omitempty"`
99
+ VPPAdminAccountID int `xml:"vpp_admin_account_id,omitempty"`
99
100
}
100
101
101
102
type MobileDeviceApplicationSubsetGeneralAppConfiguration struct {
102
- Preferences string `xml:"preferences,omitempty "`
103
+ Preferences string `xml:"preferences"`
103
104
}
104
105
105
106
// Shared Structs
106
107
107
108
type MobileDeviceApplicationSubsetScope struct {
108
- AllMobileDevices bool `xml:"all_mobile_devices,omitempty"`
109
- AllJSSUsers bool `xml:"all_jss_users,omitempty"`
110
- MobileDevices []MobileDeviceApplicationSubsetMobileDevice `xml:"mobile_devices>mobile_device,omitempty"`
111
- Buildings []MobileDeviceApplicationSubsetBuilding `xml:"buildings>building,omitempty"`
112
- Departments []MobileDeviceApplicationSubsetDepartment `xml:"departments>department,omitempty"`
113
- MobileDeviceGroups []MobileDeviceApplicationSubsetMobileDeviceGroup `xml:"mobile_device_groups>mobile_device_group,omitempty"`
114
- JSSUsers []MobileDeviceApplicationSubsetJSSUser `xml:"jss_users>user,omitempty"`
115
- JSSUserGroups []MobileDeviceApplicationSubsetJSSUserGroup `xml:"jss_user_groups>user_group,omitempty"`
116
- Limitations MobileDeviceApplicationSubsetLimitation `xml:"limitations,omitempty"`
117
- Exclusions MobileDeviceApplicationSubsetExclusion `xml:"exclusions,omitempty"`
109
+ AllMobileDevices * bool `xml:"all_mobile_devices,omitempty"`
110
+ AllJSSUsers * bool `xml:"all_jss_users,omitempty"`
111
+ MobileDevices []MobileDeviceApplicationSubsetMobileDevice `xml:"mobile_devices>mobile_device,omitempty"`
112
+ Buildings []MobileDeviceApplicationSubsetScopeEntity `xml:"buildings>building,omitempty"`
113
+ Departments []MobileDeviceApplicationSubsetScopeEntity `xml:"departments>department,omitempty"`
114
+ MobileDeviceGroups []MobileDeviceApplicationSubsetScopeEntity `xml:"mobile_device_groups>mobile_device_group,omitempty"`
115
+ JSSUsers []MobileDeviceApplicationSubsetScopeEntity `xml:"jss_users>user,omitempty"`
116
+ JSSUserGroups []MobileDeviceApplicationSubsetScopeEntity `xml:"jss_user_groups>user_group,omitempty"`
117
+ Limitations MobileDeviceApplicationSubsetLimitation `xml:"limitations,omitempty"`
118
+ Exclusions MobileDeviceApplicationSubsetExclusion `xml:"exclusions,omitempty"`
118
119
}
119
120
120
121
type MobileDeviceApplicationSubsetLimitation struct {
121
- Users []MobileDeviceApplicationSubsetUser `xml:"users>user,omitempty"`
122
- UserGroups []MobileDeviceApplicationSubsetUserGroup `xml:"user_groups>user_group,omitempty"`
122
+ Users []MobileDeviceApplicationSubsetScopeEntity `xml:"users>user,omitempty"`
123
+ UserGroups []MobileDeviceApplicationSubsetScopeEntity `xml:"user_groups>user_group,omitempty"`
123
124
NetworkSegments []MobileDeviceApplicationSubsetNetworkSegment `xml:"network_segments>network_segment,omitempty"`
124
125
}
125
126
126
127
type MobileDeviceApplicationSubsetExclusion struct {
127
- MobileDevices []MobileDeviceApplicationSubsetMobileDevice `xml:"mobile_devices>mobile_device,omitempty"`
128
- Buildings []MobileDeviceApplicationSubsetBuilding `xml:"buildings>building,omitempty"`
129
- Departments []MobileDeviceApplicationSubsetDepartment `xml:"departments>department,omitempty"`
130
- MobileDeviceGroups []MobileDeviceApplicationSubsetMobileDeviceGroup `xml:"mobile_device_groups>mobile_device_group,omitempty"`
131
- JSSUsers []MobileDeviceApplicationSubsetJSSUser `xml:"jss_users>user,omitempty"`
132
- JSSUserGroups []MobileDeviceApplicationSubsetJSSUserGroup `xml:"jss_user_groups>user_group,omitempty"`
128
+ MobileDevices []MobileDeviceApplicationSubsetMobileDevice `xml:"mobile_devices>mobile_device,omitempty"`
129
+ Buildings []MobileDeviceApplicationSubsetScopeEntity `xml:"buildings>building,omitempty"`
130
+ Users []MobileDeviceApplicationSubsetScopeEntity `xml:"users>user,omitempty"`
131
+ UserGroups []MobileDeviceApplicationSubsetScopeEntity `xml:"user_groups>user_group,omitempty"`
132
+ Departments []MobileDeviceApplicationSubsetScopeEntity `xml:"departments>department,omitempty"`
133
+ MobileDeviceGroups []MobileDeviceApplicationSubsetScopeEntity `xml:"mobile_device_groups>mobile_device_group,omitempty"`
134
+ NetworkSegments []MobileDeviceApplicationSubsetNetworkSegment `xml:"network_segments>network_segment,omitempty"`
135
+ JSSUsers []MobileDeviceApplicationSubsetScopeEntity `xml:"jss_users>user,omitempty"`
136
+ JSSUserGroups []MobileDeviceApplicationSubsetScopeEntity `xml:"jss_user_groups>user_group,omitempty"`
133
137
}
134
138
135
139
type MobileDeviceApplicationSubsetIcon struct {
@@ -140,50 +144,22 @@ type MobileDeviceApplicationSubsetIcon struct {
140
144
}
141
145
142
146
type MobileDeviceApplicationSubsetMobileDevice struct {
143
- ID int `xml:"id,omitempty "`
147
+ ID int `xml:"id"`
144
148
Name string `xml:"name,omitempty"`
145
149
UDID string `xml:"udid,omitempty"`
146
150
WifiMacAddress string `xml:"wifi_mac_address,omitempty"`
147
151
}
148
152
149
- type MobileDeviceApplicationSubsetBuilding struct {
150
- ID int `xml:"id,omitempty"`
151
- Name string `xml:"name,omitempty"`
152
- }
153
-
154
- type MobileDeviceApplicationSubsetDepartment struct {
155
- ID int `xml:"id,omitempty"`
156
- Name string `xml:"name,omitempty"`
157
- }
158
-
159
- type MobileDeviceApplicationSubsetMobileDeviceGroup struct {
160
- ID int `xml:"id,omitempty"`
161
- Name string `xml:"name,omitempty"`
162
- }
163
-
164
- type MobileDeviceApplicationSubsetJSSUser struct {
165
- ID int `xml:"id,omitempty"`
166
- Name string `xml:"name,omitempty"`
167
- }
153
+ // Entity
168
154
169
- type MobileDeviceApplicationSubsetJSSUserGroup struct {
170
- ID int `xml:"id,omitempty"`
171
- Name string `xml:"name,omitempty"`
172
- }
173
-
174
- type MobileDeviceApplicationSubsetUser struct {
175
- ID int `xml:"id,omitempty"`
176
- Name string `xml:"name,omitempty"`
177
- }
178
-
179
- type MobileDeviceApplicationSubsetUserGroup struct {
180
- ID int `xml:"id,omitempty"`
155
+ // Generic Entity struct for common use
156
+ type MobileDeviceApplicationSubsetScopeEntity struct {
157
+ ID int `xml:"id"`
181
158
Name string `xml:"name,omitempty"`
182
159
}
183
160
184
161
type MobileDeviceApplicationSubsetNetworkSegment struct {
185
- ID int `xml:"id,omitempty"`
186
- UID string `xml:"uid,omitempty"`
162
+ MobileDeviceApplicationSubsetScopeEntity
187
163
Name string `xml:"name,omitempty"`
188
164
}
189
165
@@ -309,7 +285,7 @@ func (c *Client) GetMobileDeviceApplicationByNameAndDataSubset(name string, subs
309
285
}
310
286
311
287
// CreateMobileDeviceApplication creates a new mobile device application on the Jamf Pro server.
312
- func (c * Client ) CreateMobileDeviceApplication (app * ResourceMobileDeviceApplication ) (* ResourceMobileDeviceApplication , error ) {
288
+ func (c * Client ) CreateMobileDeviceApplication (app * ResourceMobileDeviceApplication ) (* MobileDeviceApplicationsListItem , error ) {
313
289
endpoint := fmt .Sprintf ("%s/id/0" , uriMobileDeviceApplications )
314
290
315
291
requestBody := struct {
@@ -319,8 +295,11 @@ func (c *Client) CreateMobileDeviceApplication(app *ResourceMobileDeviceApplicat
319
295
ResourceMobileDeviceApplication : app ,
320
296
}
321
297
322
- var responseApp ResourceMobileDeviceApplication
323
- resp , err := c .HTTP .DoRequest ("POST" , endpoint , & requestBody , & responseApp )
298
+ var createResp struct {
299
+ ID int `xml:"id"`
300
+ }
301
+
302
+ resp , err := c .HTTP .DoRequest ("POST" , endpoint , & requestBody , & createResp )
324
303
if err != nil {
325
304
return nil , fmt .Errorf (errMsgFailedCreate , "mobile device application" , err )
326
305
}
@@ -329,7 +308,14 @@ func (c *Client) CreateMobileDeviceApplication(app *ResourceMobileDeviceApplicat
329
308
defer resp .Body .Close ()
330
309
}
331
310
332
- return & responseApp , nil
311
+ if createResp .ID == 0 {
312
+ return nil , fmt .Errorf ("no ID found in mobile device application creation response" )
313
+ }
314
+
315
+ return & MobileDeviceApplicationsListItem {
316
+ ID : createResp .ID ,
317
+ Name : app .General .Name ,
318
+ }, nil
333
319
}
334
320
335
321
// UpdateMobileDeviceApplicationByID updates a mobile device application by its ID on the Jamf Pro server.
0 commit comments