Skip to content

Commit

Permalink
Add ACS 4.17 support (#38)
Browse files Browse the repository at this point in the history
* Add ACS 4.17 support

* update 4.17 apis

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

* add 4.17 new apis

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>

---------

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: dahn <daan.hoogland@gmail.com>
Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
  • Loading branch information
3 people authored Mar 31, 2023
1 parent 0051876 commit f4cfaae
Show file tree
Hide file tree
Showing 56 changed files with 64,861 additions and 57,822 deletions.
8 changes: 4 additions & 4 deletions cloudstack/AccountService.go
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ func (p *ListAccountsParams) toURLValues() url.Values {
return u
}
if v, found := p.p["accounttype"]; found {
vv := strconv.FormatInt(v.(int64), 10)
vv := strconv.Itoa(v.(int))
u.Set("accounttype", vv)
}
if v, found := p.p["details"]; found {
Expand Down Expand Up @@ -1053,18 +1053,18 @@ func (p *ListAccountsParams) toURLValues() url.Values {
return u
}

func (p *ListAccountsParams) SetAccounttype(v int64) {
func (p *ListAccountsParams) SetAccounttype(v int) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["accounttype"] = v
}

func (p *ListAccountsParams) GetAccounttype() (int64, bool) {
func (p *ListAccountsParams) GetAccounttype() (int, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["accounttype"].(int64)
value, ok := p.p["accounttype"].(int)
return value, ok
}

Expand Down
90 changes: 90 additions & 0 deletions cloudstack/AddressService.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type AddressServiceIface interface {
GetPublicIpAddressByID(id string, opts ...OptionFunc) (*PublicIpAddress, int, error)
UpdateIpAddress(p *UpdateIpAddressParams) (*UpdateIpAddressResponse, error)
NewUpdateIpAddressParams(id string) *UpdateIpAddressParams
ReleaseIpAddress(p *ReleaseIpAddressParams) (*ReleaseIpAddressResponse, error)
NewReleaseIpAddressParams(id string) *ReleaseIpAddressParams
}

type AssociateIpAddressParams struct {
Expand Down Expand Up @@ -1096,3 +1098,91 @@ type UpdateIpAddressResponse struct {
Zoneid string `json:"zoneid"`
Zonename string `json:"zonename"`
}

type ReleaseIpAddressParams struct {
p map[string]interface{}
}

func (p *ReleaseIpAddressParams) toURLValues() url.Values {
u := url.Values{}
if p.p == nil {
return u
}
if v, found := p.p["id"]; found {
u.Set("id", v.(string))
}
return u
}

func (p *ReleaseIpAddressParams) SetId(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["id"] = v
}

func (p *ReleaseIpAddressParams) GetId() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["id"].(string)
return value, ok
}

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

// Releases an IP address from the account.
func (s *AddressService) ReleaseIpAddress(p *ReleaseIpAddressParams) (*ReleaseIpAddressResponse, error) {
resp, err := s.cs.newRequest("releaseIpAddress", p.toURLValues())
if err != nil {
return nil, err
}

var r ReleaseIpAddressResponse
if err := json.Unmarshal(resp, &r); err != nil {
return nil, err
}

return &r, nil
}

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

func (r *ReleaseIpAddressResponse) 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"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
}
}

type alias ReleaseIpAddressResponse
return json.Unmarshal(b, (*alias)(r))
}
29 changes: 29 additions & 0 deletions cloudstack/AddressService_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cloudstack/AffinityGroupService.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ type UpdateVMAffinityGroupResponse struct {
Isoname string `json:"isoname"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Keypair string `json:"keypair"`
Keypairs string `json:"keypairs"`
Lastupdated string `json:"lastupdated"`
Memory int `json:"memory"`
Memoryintfreekbs int64 `json:"memoryintfreekbs"`
Expand Down
6 changes: 6 additions & 0 deletions cloudstack/BrocadeVCSService.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ type BrocadeVcsDeviceNetwork struct {
Aclid string `json:"aclid"`
Aclname string `json:"aclname"`
Acltype string `json:"acltype"`
Associatednetwork string `json:"associatednetwork"`
Associatednetworkid string `json:"associatednetworkid"`
Broadcastdomaintype string `json:"broadcastdomaintype"`
Broadcasturi string `json:"broadcasturi"`
Canusefordeploy bool `json:"canusefordeploy"`
Expand All @@ -424,13 +426,17 @@ type BrocadeVcsDeviceNetwork struct {
Dns2 string `json:"dns2"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Egressdefaultpolicy bool `json:"egressdefaultpolicy"`
Externalid string `json:"externalid"`
Gateway string `json:"gateway"`
Hasannotations bool `json:"hasannotations"`
Icon interface{} `json:"icon"`
Id string `json:"id"`
Internetprotocol string `json:"internetprotocol"`
Ip6cidr string `json:"ip6cidr"`
Ip6gateway string `json:"ip6gateway"`
Ip6routes []interface{} `json:"ip6routes"`
Ip6routing string `json:"ip6routing"`
Isdefault bool `json:"isdefault"`
Ispersistent bool `json:"ispersistent"`
Issystem bool `json:"issystem"`
Expand Down
58 changes: 58 additions & 0 deletions cloudstack/DiskOfferingService.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func (p *CreateDiskOfferingParams) toURLValues() url.Values {
vv := strconv.FormatInt(v.(int64), 10)
u.Set("disksize", vv)
}
if v, found := p.p["disksizestrictness"]; found {
vv := strconv.FormatBool(v.(bool))
u.Set("disksizestrictness", vv)
}
if v, found := p.p["displayoffering"]; found {
vv := strconv.FormatBool(v.(bool))
u.Set("displayoffering", vv)
Expand Down Expand Up @@ -329,6 +333,21 @@ func (p *CreateDiskOfferingParams) GetDisksize() (int64, bool) {
return value, ok
}

func (p *CreateDiskOfferingParams) SetDisksizestrictness(v bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["disksizestrictness"] = v
}

func (p *CreateDiskOfferingParams) GetDisksizestrictness() (bool, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["disksizestrictness"].(bool)
return value, ok
}

func (p *CreateDiskOfferingParams) SetDisplayoffering(v bool) {
if p.p == nil {
p.p = make(map[string]interface{})
Expand Down Expand Up @@ -644,6 +663,7 @@ type CreateDiskOfferingResponse struct {
DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"`
DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"`
Disksize int64 `json:"disksize"`
Disksizestrictness bool `json:"disksizestrictness"`
Displayoffering bool `json:"displayoffering"`
Displaytext string `json:"displaytext"`
Domain string `json:"domain"`
Expand Down Expand Up @@ -791,6 +811,12 @@ func (p *ListDiskOfferingsParams) toURLValues() url.Values {
vv := strconv.Itoa(v.(int))
u.Set("pagesize", vv)
}
if v, found := p.p["storageid"]; found {
u.Set("storageid", v.(string))
}
if v, found := p.p["volumeid"]; found {
u.Set("volumeid", v.(string))
}
if v, found := p.p["zoneid"]; found {
u.Set("zoneid", v.(string))
}
Expand Down Expand Up @@ -917,6 +943,36 @@ func (p *ListDiskOfferingsParams) GetPagesize() (int, bool) {
return value, ok
}

func (p *ListDiskOfferingsParams) SetStorageid(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["storageid"] = v
}

func (p *ListDiskOfferingsParams) GetStorageid() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["storageid"].(string)
return value, ok
}

func (p *ListDiskOfferingsParams) SetVolumeid(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["volumeid"] = v
}

func (p *ListDiskOfferingsParams) GetVolumeid() (string, bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
value, ok := p.p["volumeid"].(string)
return value, ok
}

func (p *ListDiskOfferingsParams) SetZoneid(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
Expand Down Expand Up @@ -1059,6 +1115,7 @@ type DiskOffering struct {
DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"`
DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"`
Disksize int64 `json:"disksize"`
Disksizestrictness bool `json:"disksizestrictness"`
Displayoffering bool `json:"displayoffering"`
Displaytext string `json:"displaytext"`
Domain string `json:"domain"`
Expand Down Expand Up @@ -1525,6 +1582,7 @@ type UpdateDiskOfferingResponse struct {
DiskIopsWriteRateMax int64 `json:"diskIopsWriteRateMax"`
DiskIopsWriteRateMaxLength int64 `json:"diskIopsWriteRateMaxLength"`
Disksize int64 `json:"disksize"`
Disksizestrictness bool `json:"disksizestrictness"`
Displayoffering bool `json:"displayoffering"`
Displaytext string `json:"displaytext"`
Domain string `json:"domain"`
Expand Down
Loading

0 comments on commit f4cfaae

Please sign in to comment.