Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

Update to support CloudStack 4.12.x.x #113

Merged
merged 1 commit into from
May 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cloudstack/APIDiscoveryService.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ type ListApisResponse struct {
type Api struct {
Description string `json:"description"`
Isasync bool `json:"isasync"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Name string `json:"name"`
Params []ApiParams `json:"params"`
Related string `json:"related"`
Expand Down
45 changes: 37 additions & 8 deletions cloudstack/AccountService.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ func (s *AccountService) AddAccountToProject(p *AddAccountToProjectParams) (*Add
}

type AddAccountToProjectResponse struct {
JobID string `json:"jobid"`
Displaytext string `json:"displaytext"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Success bool `json:"success"`
}

Expand Down Expand Up @@ -334,6 +335,8 @@ type CreateAccountResponse struct {
Iptotal int64 `json:"iptotal"`
Iscleanuprequired bool `json:"iscleanuprequired"`
Isdefault bool `json:"isdefault"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Memoryavailable string `json:"memoryavailable"`
Memorylimit string `json:"memorylimit"`
Memorytotal int64 `json:"memorytotal"`
Expand Down Expand Up @@ -464,8 +467,9 @@ func (s *AccountService) DeleteAccount(p *DeleteAccountParams) (*DeleteAccountRe
}

type DeleteAccountResponse struct {
JobID string `json:"jobid"`
Displaytext string `json:"displaytext"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Success bool `json:"success"`
}

Expand Down Expand Up @@ -544,8 +548,9 @@ func (s *AccountService) DeleteAccountFromProject(p *DeleteAccountFromProjectPar
}

type DeleteAccountFromProjectResponse struct {
JobID string `json:"jobid"`
Displaytext string `json:"displaytext"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Success bool `json:"success"`
}

Expand Down Expand Up @@ -651,7 +656,6 @@ func (s *AccountService) DisableAccount(p *DisableAccountParams) (*DisableAccoun
}

type DisableAccountResponse struct {
JobID string `json:"jobid"`
Accountdetails map[string]string `json:"accountdetails"`
Accounttype int `json:"accounttype"`
Cpuavailable string `json:"cpuavailable"`
Expand All @@ -667,6 +671,8 @@ type DisableAccountResponse struct {
Iptotal int64 `json:"iptotal"`
Iscleanuprequired bool `json:"iscleanuprequired"`
Isdefault bool `json:"isdefault"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Memoryavailable string `json:"memoryavailable"`
Memorylimit string `json:"memorylimit"`
Memorytotal int64 `json:"memorytotal"`
Expand Down Expand Up @@ -818,6 +824,8 @@ type EnableAccountResponse struct {
Iptotal int64 `json:"iptotal"`
Iscleanuprequired bool `json:"iscleanuprequired"`
Isdefault bool `json:"isdefault"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Memoryavailable string `json:"memoryavailable"`
Memorylimit string `json:"memorylimit"`
Memorytotal int64 `json:"memorytotal"`
Expand Down Expand Up @@ -945,7 +953,9 @@ func (s *AccountService) GetSolidFireAccountId(p *GetSolidFireAccountIdParams) (
}

type GetSolidFireAccountIdResponse struct {
SolidFireAccountId int64 `json:"solidFireAccountId"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
SolidFireAccountId int64 `json:"solidFireAccountId"`
}

type ListAccountsParams struct {
Expand Down Expand Up @@ -1214,6 +1224,8 @@ type Account struct {
Iptotal int64 `json:"iptotal"`
Iscleanuprequired bool `json:"iscleanuprequired"`
Isdefault bool `json:"isdefault"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Memoryavailable string `json:"memoryavailable"`
Memorylimit string `json:"memorylimit"`
Memorytotal int64 `json:"memorytotal"`
Expand Down Expand Up @@ -1439,6 +1451,8 @@ type ProjectAccount struct {
Ipavailable string `json:"ipavailable"`
Iplimit string `json:"iplimit"`
Iptotal int64 `json:"iptotal"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Memoryavailable string `json:"memoryavailable"`
Memorylimit string `json:"memorylimit"`
Memorytotal int64 `json:"memorytotal"`
Expand Down Expand Up @@ -1562,6 +1576,8 @@ type LockAccountResponse struct {
Iptotal int64 `json:"iptotal"`
Iscleanuprequired bool `json:"iscleanuprequired"`
Isdefault bool `json:"isdefault"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Memoryavailable string `json:"memoryavailable"`
Memorylimit string `json:"memorylimit"`
Memorytotal int64 `json:"memorytotal"`
Expand Down Expand Up @@ -1721,7 +1737,6 @@ func (s *AccountService) MarkDefaultZoneForAccount(p *MarkDefaultZoneForAccountP
}

type MarkDefaultZoneForAccountResponse struct {
JobID string `json:"jobid"`
Accountdetails map[string]string `json:"accountdetails"`
Accounttype int `json:"accounttype"`
Cpuavailable string `json:"cpuavailable"`
Expand All @@ -1737,6 +1752,8 @@ type MarkDefaultZoneForAccountResponse struct {
Iptotal int64 `json:"iptotal"`
Iscleanuprequired bool `json:"iscleanuprequired"`
Isdefault bool `json:"isdefault"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Memoryavailable string `json:"memoryavailable"`
Memorylimit string `json:"memorylimit"`
Memorytotal int64 `json:"memorytotal"`
Expand Down Expand Up @@ -1836,6 +1853,9 @@ func (p *UpdateAccountParams) toURLValues() url.Values {
if v, found := p.p["newname"]; found {
u.Set("newname", v.(string))
}
if v, found := p.p["roleid"]; found {
u.Set("roleid", v.(string))
}
return u
}

Expand Down Expand Up @@ -1887,12 +1907,19 @@ func (p *UpdateAccountParams) SetNewname(v string) {
return
}

func (p *UpdateAccountParams) SetRoleid(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["roleid"] = v
return
}

// You should always use this function to get a new UpdateAccountParams instance,
// as then you are sure you have configured all required params
func (s *AccountService) NewUpdateAccountParams(newname string) *UpdateAccountParams {
func (s *AccountService) NewUpdateAccountParams() *UpdateAccountParams {
p := &UpdateAccountParams{}
p.p = make(map[string]interface{})
p.p["newname"] = newname
return p
}

Expand Down Expand Up @@ -1927,6 +1954,8 @@ type UpdateAccountResponse struct {
Iptotal int64 `json:"iptotal"`
Iscleanuprequired bool `json:"iscleanuprequired"`
Isdefault bool `json:"isdefault"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Memoryavailable string `json:"memoryavailable"`
Memorylimit string `json:"memorylimit"`
Memorytotal int64 `json:"memorytotal"`
Expand Down
13 changes: 9 additions & 4 deletions cloudstack/AddressService.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (s *AddressService) NewAssociateIpAddressParams() *AssociateIpAddressParams
return p
}

// Acquires and associates a public IP to an account.
// Acquires and associates a public IP to an account. Either of the parameters are required, i.e. either zoneId, or networkId, or vpcId
func (s *AddressService) AssociateIpAddress(p *AssociateIpAddressParams) (*AssociateIpAddressResponse, error) {
resp, err := s.cs.newRequest("associateIpAddress", p.toURLValues())
if err != nil {
Expand Down Expand Up @@ -182,7 +182,6 @@ func (s *AddressService) AssociateIpAddress(p *AssociateIpAddressParams) (*Assoc
}

type AssociateIpAddressResponse struct {
JobID string `json:"jobid"`
Account string `json:"account"`
Allocated string `json:"allocated"`
Associatednetworkid string `json:"associatednetworkid"`
Expand All @@ -197,6 +196,8 @@ type AssociateIpAddressResponse struct {
Issourcenat bool `json:"issourcenat"`
Isstaticnat bool `json:"isstaticnat"`
Issystem bool `json:"issystem"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Networkid string `json:"networkid"`
Physicalnetworkid string `json:"physicalnetworkid"`
Project string `json:"project"`
Expand Down Expand Up @@ -278,8 +279,9 @@ func (s *AddressService) DisassociateIpAddress(p *DisassociateIpAddressParams) (
}

type DisassociateIpAddressResponse struct {
JobID string `json:"jobid"`
Displaytext string `json:"displaytext"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Success bool `json:"success"`
}

Expand Down Expand Up @@ -639,6 +641,8 @@ type PublicIpAddress struct {
Issourcenat bool `json:"issourcenat"`
Isstaticnat bool `json:"isstaticnat"`
Issystem bool `json:"issystem"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Networkid string `json:"networkid"`
Physicalnetworkid string `json:"physicalnetworkid"`
Project string `json:"project"`
Expand Down Expand Up @@ -748,7 +752,6 @@ func (s *AddressService) UpdateIpAddress(p *UpdateIpAddressParams) (*UpdateIpAdd
}

type UpdateIpAddressResponse struct {
JobID string `json:"jobid"`
Account string `json:"account"`
Allocated string `json:"allocated"`
Associatednetworkid string `json:"associatednetworkid"`
Expand All @@ -763,6 +766,8 @@ type UpdateIpAddressResponse struct {
Issourcenat bool `json:"issourcenat"`
Isstaticnat bool `json:"isstaticnat"`
Issystem bool `json:"issystem"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Networkid string `json:"networkid"`
Physicalnetworkid string `json:"physicalnetworkid"`
Project string `json:"project"`
Expand Down
45 changes: 40 additions & 5 deletions cloudstack/AffinityGroupService.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,13 @@ func (s *AffinityGroupService) CreateAffinityGroup(p *CreateAffinityGroupParams)
}

type CreateAffinityGroupResponse struct {
JobID string `json:"jobid"`
Account string `json:"account"`
Description string `json:"description"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Id string `json:"id"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Name string `json:"name"`
Project string `json:"project"`
Projectid string `json:"projectid"`
Expand Down Expand Up @@ -267,8 +268,9 @@ func (s *AffinityGroupService) DeleteAffinityGroup(p *DeleteAffinityGroupParams)
}

type DeleteAffinityGroupResponse struct {
JobID string `json:"jobid"`
Displaytext string `json:"displaytext"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Success bool `json:"success"`
}

Expand Down Expand Up @@ -348,7 +350,9 @@ type ListAffinityGroupTypesResponse struct {
}

type AffinityGroupType struct {
Type string `json:"type"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Type string `json:"type"`
}

type ListAffinityGroupsParams struct {
Expand Down Expand Up @@ -624,6 +628,8 @@ type AffinityGroup struct {
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Id string `json:"id"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Name string `json:"name"`
Project string `json:"project"`
Projectid string `json:"projectid"`
Expand Down Expand Up @@ -723,7 +729,6 @@ func (s *AffinityGroupService) UpdateVMAffinityGroup(p *UpdateVMAffinityGroupPar
}

type UpdateVMAffinityGroupResponse struct {
JobID string `json:"jobid"`
Account string `json:"account"`
Affinitygroup []UpdateVMAffinityGroupResponseAffinitygroup `json:"affinitygroup"`
Cpunumber int `json:"cpunumber"`
Expand Down Expand Up @@ -755,6 +760,8 @@ type UpdateVMAffinityGroupResponse struct {
Isodisplaytext string `json:"isodisplaytext"`
Isoid string `json:"isoid"`
Isoname string `json:"isoname"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Keypair string `json:"keypair"`
Memory int `json:"memory"`
Memoryintfreekbs int64 `json:"memoryintfreekbs"`
Expand All @@ -764,7 +771,7 @@ type UpdateVMAffinityGroupResponse struct {
Networkkbsread int64 `json:"networkkbsread"`
Networkkbswrite int64 `json:"networkkbswrite"`
Nic []Nic `json:"nic"`
Ostypeid int64 `json:"ostypeid"`
Ostypeid string `json:"ostypeid"`
Password string `json:"password"`
Passwordenabled bool `json:"passwordenabled"`
Project string `json:"project"`
Expand All @@ -778,6 +785,7 @@ type UpdateVMAffinityGroupResponse struct {
Serviceofferingname string `json:"serviceofferingname"`
Servicestate string `json:"servicestate"`
State string `json:"state"`
Tags []Tags `json:"tags"`
Templatedisplaytext string `json:"templatedisplaytext"`
Templateid string `json:"templateid"`
Templatename string `json:"templatename"`
Expand Down Expand Up @@ -829,3 +837,30 @@ type UpdateVMAffinityGroupResponseAffinitygroup struct {
Type string `json:"type"`
VirtualmachineIds []string `json:"virtualmachineIds"`
}

func (r *UpdateVMAffinityGroupResponse) UnmarshalJSON(b []byte) error {
var m map[string]interface{}
err := json.Unmarshal(b, &m)
if err != nil {
return err
}

if success, ok := m["success"].(string); ok {
m["success"] = success == "true"
b, err = json.Marshal(m)
if err != nil {
return err
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
b, err = json.Marshal(m)
if err != nil {
return err
}
}

type alias UpdateVMAffinityGroupResponse
return json.Unmarshal(b, (*alias)(r))
}
Loading