Skip to content

Commit 434d05e

Browse files
author
ShocOne
committed
struct encapsulation into resource
1 parent 2033629 commit 434d05e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sdk/jamfpro/classicapi_computer_groups.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ type ComputerGroup struct {
3636
type ComputerGroupRequest struct {
3737
Name string `xml:"name"`
3838
IsSmart bool `xml:"is_smart"`
39-
Site Site `xml:"site"`
39+
Site ComputerGroupSite `xml:"site"`
4040
Criteria []ComputerGroupCriterion `xml:"criteria>criterion"`
4141
Computers []ComputerGroupComputerItem `xml:"computers>computer,omitempty"`
4242
}
4343

44+
type ComputerGroupSite struct {
45+
ID int `json:"id,omitempty" xml:"id,omitempty"`
46+
Name string `json:"name,omitempty" xml:"name,omitempty"`
47+
}
48+
4449
type ComputerGroupCriterion struct {
4550
Name string `xml:"name"`
4651
Priority int `xml:"priority"`
@@ -123,7 +128,7 @@ func (c *Client) CreateComputerGroup(group *ComputerGroupRequest) (*ComputerGrou
123128

124129
// Check if site is not provided and set default values
125130
if group.Site.ID == 0 && group.Site.Name == "" {
126-
group.Site = Site{
131+
group.Site = ComputerGroupSite{
127132
ID: -1,
128133
Name: "None",
129134
}
@@ -156,7 +161,7 @@ func (c *Client) UpdateComputerGroupByID(id int, group *ComputerGroupRequest) (*
156161

157162
// Check if site is not provided and set default values
158163
if group.Site.ID == 0 && group.Site.Name == "" {
159-
group.Site = Site{
164+
group.Site = ComputerGroupSite{
160165
ID: -1,
161166
Name: "None",
162167
}
@@ -189,7 +194,7 @@ func (c *Client) UpdateComputerGroupByName(name string, group *ComputerGroupRequ
189194

190195
// Check if site is not provided and set default values
191196
if group.Site.ID == 0 && group.Site.Name == "" {
192-
group.Site = Site{
197+
group.Site = ComputerGroupSite{
193198
ID: -1,
194199
Name: "None",
195200
}

0 commit comments

Comments
 (0)