Skip to content

Commit 2d1b8ed

Browse files
committed
Update APIs and fix issue with traffic type response
1 parent 3a1384d commit 2d1b8ed

25 files changed

+83539
-81660
lines changed

cloudstack/BackupService.go

Lines changed: 356 additions & 69 deletions
Large diffs are not rendered by default.

cloudstack/BackupService_mock.go

Lines changed: 25 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudstack/ConfigurationService.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ type ListCapabilitiesResponse struct {
9393
}
9494

9595
type Capability struct {
96+
Additionalconfigenabled bool `json:"additionalconfigenabled"`
9697
Allowusercreateprojects bool `json:"allowusercreateprojects"`
9798
Allowuserexpungerecovervm bool `json:"allowuserexpungerecovervm"`
9899
Allowuserexpungerecovervolume bool `json:"allowuserexpungerecovervolume"`
@@ -1336,6 +1337,7 @@ func (s *ConfigurationService) UpdateStorageCapabilities(p *UpdateStorageCapabil
13361337

13371338
type UpdateStorageCapabilitiesResponse struct {
13381339
Allocatediops int64 `json:"allocatediops"`
1340+
Capacitybytes int64 `json:"capacitybytes"`
13391341
Capacityiops int64 `json:"capacityiops"`
13401342
Clusterid string `json:"clusterid"`
13411343
Clustername string `json:"clustername"`

cloudstack/HostService.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4767,6 +4767,10 @@ func (p *UpdateHostParams) toURLValues() url.Values {
47674767
if v, found := p.p["annotation"]; found {
47684768
u.Set("annotation", v.(string))
47694769
}
4770+
if v, found := p.p["cleanupexternaldetails"]; found {
4771+
vv := strconv.FormatBool(v.(bool))
4772+
u.Set("cleanupexternaldetails", vv)
4773+
}
47704774
if v, found := p.p["externaldetails"]; found {
47714775
m := v.(map[string]string)
47724776
for i, k := range getSortedKeysFromMap(m) {
@@ -4839,6 +4843,27 @@ func (p *UpdateHostParams) GetAnnotation() (string, bool) {
48394843
return value, ok
48404844
}
48414845

4846+
func (p *UpdateHostParams) SetCleanupexternaldetails(v bool) {
4847+
if p.p == nil {
4848+
p.p = make(map[string]interface{})
4849+
}
4850+
p.p["cleanupexternaldetails"] = v
4851+
}
4852+
4853+
func (p *UpdateHostParams) ResetCleanupexternaldetails() {
4854+
if p.p != nil && p.p["cleanupexternaldetails"] != nil {
4855+
delete(p.p, "cleanupexternaldetails")
4856+
}
4857+
}
4858+
4859+
func (p *UpdateHostParams) GetCleanupexternaldetails() (bool, bool) {
4860+
if p.p == nil {
4861+
p.p = make(map[string]interface{})
4862+
}
4863+
value, ok := p.p["cleanupexternaldetails"].(bool)
4864+
return value, ok
4865+
}
4866+
48424867
func (p *UpdateHostParams) SetExternaldetails(v map[string]string) {
48434868
if p.p == nil {
48444869
p.p = make(map[string]interface{})

cloudstack/InternalLBService.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,7 @@ type InternalLoadBalancerVMHealthcheckresults struct {
11021102
Checktype string `json:"checktype"`
11031103
Details string `json:"details"`
11041104
Lastupdated string `json:"lastupdated"`
1105+
Status string `json:"status"`
11051106
Success bool `json:"success"`
11061107
}
11071108

@@ -1250,6 +1251,7 @@ type StartInternalLoadBalancerVMResponseHealthcheckresults struct {
12501251
Checktype string `json:"checktype"`
12511252
Details string `json:"details"`
12521253
Lastupdated string `json:"lastupdated"`
1254+
Status string `json:"status"`
12531255
Success bool `json:"success"`
12541256
}
12551257

@@ -1423,5 +1425,6 @@ type StopInternalLoadBalancerVMResponseHealthcheckresults struct {
14231425
Checktype string `json:"checktype"`
14241426
Details string `json:"details"`
14251427
Lastupdated string `json:"lastupdated"`
1428+
Status string `json:"status"`
14261429
Success bool `json:"success"`
14271430
}

cloudstack/KubernetesService.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ func (p *CreateKubernetesClusterParams) toURLValues() url.Values {
397397
if v, found := p.p["domainid"]; found {
398398
u.Set("domainid", v.(string))
399399
}
400+
if v, found := p.p["enablecsi"]; found {
401+
vv := strconv.FormatBool(v.(bool))
402+
u.Set("enablecsi", vv)
403+
}
400404
if v, found := p.p["etcdnodes"]; found {
401405
vv := strconv.FormatInt(v.(int64), 10)
402406
u.Set("etcdnodes", vv)
@@ -688,6 +692,27 @@ func (p *CreateKubernetesClusterParams) GetDomainid() (string, bool) {
688692
return value, ok
689693
}
690694

695+
func (p *CreateKubernetesClusterParams) SetEnablecsi(v bool) {
696+
if p.p == nil {
697+
p.p = make(map[string]interface{})
698+
}
699+
p.p["enablecsi"] = v
700+
}
701+
702+
func (p *CreateKubernetesClusterParams) ResetEnablecsi() {
703+
if p.p != nil && p.p["enablecsi"] != nil {
704+
delete(p.p, "enablecsi")
705+
}
706+
}
707+
708+
func (p *CreateKubernetesClusterParams) GetEnablecsi() (bool, bool) {
709+
if p.p == nil {
710+
p.p = make(map[string]interface{})
711+
}
712+
value, ok := p.p["enablecsi"].(bool)
713+
return value, ok
714+
}
715+
691716
func (p *CreateKubernetesClusterParams) SetEtcdnodes(v int64) {
692717
if p.p == nil {
693718
p.p = make(map[string]interface{})
@@ -1065,6 +1090,7 @@ type CreateKubernetesClusterResponse struct {
10651090
Controlofferingname string `json:"controlofferingname"`
10661091
Cpunumber string `json:"cpunumber"`
10671092
Created string `json:"created"`
1093+
Csienabled bool `json:"csienabled"`
10681094
Description string `json:"description"`
10691095
Domain string `json:"domain"`
10701096
Domainid string `json:"domainid"`
@@ -1815,6 +1841,7 @@ type KubernetesCluster struct {
18151841
Controlofferingname string `json:"controlofferingname"`
18161842
Cpunumber string `json:"cpunumber"`
18171843
Created string `json:"created"`
1844+
Csienabled bool `json:"csienabled"`
18181845
Description string `json:"description"`
18191846
Domain string `json:"domain"`
18201847
Domainid string `json:"domainid"`
@@ -2461,6 +2488,7 @@ type ScaleKubernetesClusterResponse struct {
24612488
Controlofferingname string `json:"controlofferingname"`
24622489
Cpunumber string `json:"cpunumber"`
24632490
Created string `json:"created"`
2491+
Csienabled bool `json:"csienabled"`
24642492
Description string `json:"description"`
24652493
Domain string `json:"domain"`
24662494
Domainid string `json:"domainid"`
@@ -2592,6 +2620,7 @@ type StartKubernetesClusterResponse struct {
25922620
Controlofferingname string `json:"controlofferingname"`
25932621
Cpunumber string `json:"cpunumber"`
25942622
Created string `json:"created"`
2623+
Csienabled bool `json:"csienabled"`
25952624
Description string `json:"description"`
25962625
Domain string `json:"domain"`
25972626
Domainid string `json:"domainid"`
@@ -2936,6 +2965,7 @@ type UpgradeKubernetesClusterResponse struct {
29362965
Controlofferingname string `json:"controlofferingname"`
29372966
Cpunumber string `json:"cpunumber"`
29382967
Created string `json:"created"`
2968+
Csienabled bool `json:"csienabled"`
29392969
Description string `json:"description"`
29402970
Domain string `json:"domain"`
29412971
Domainid string `json:"domainid"`
@@ -3483,6 +3513,7 @@ type AddNodesToKubernetesClusterResponse struct {
34833513
Controlofferingname string `json:"controlofferingname"`
34843514
Cpunumber string `json:"cpunumber"`
34853515
Created string `json:"created"`
3516+
Csienabled bool `json:"csienabled"`
34863517
Description string `json:"description"`
34873518
Domain string `json:"domain"`
34883519
Domainid string `json:"domainid"`
@@ -3640,6 +3671,7 @@ type RemoveNodesFromKubernetesClusterResponse struct {
36403671
Controlofferingname string `json:"controlofferingname"`
36413672
Cpunumber string `json:"cpunumber"`
36423673
Created string `json:"created"`
3674+
Csienabled bool `json:"csienabled"`
36433675
Description string `json:"description"`
36443676
Domain string `json:"domain"`
36453677
Domainid string `json:"domainid"`

cloudstack/LDAPService.go

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ import (
2424
"fmt"
2525
"net/url"
2626
"strconv"
27+
"strings"
2728
)
2829

2930
type LDAPServiceIface interface {
3031
AddLdapConfiguration(p *AddLdapConfigurationParams) (*AddLdapConfigurationResponse, error)
3132
NewAddLdapConfigurationParams(hostname string, port int) *AddLdapConfigurationParams
3233
DeleteLdapConfiguration(p *DeleteLdapConfigurationParams) (*DeleteLdapConfigurationResponse, error)
33-
NewDeleteLdapConfigurationParams(hostname string) *DeleteLdapConfigurationParams
34+
NewDeleteLdapConfigurationParams() *DeleteLdapConfigurationParams
3435
ImportLdapUsers(p *ImportLdapUsersParams) (*ImportLdapUsersResponse, error)
3536
NewImportLdapUsersParams() *ImportLdapUsersParams
3637
LdapConfig(p *LdapConfigParams) (*LdapConfigResponse, error)
@@ -43,6 +44,7 @@ type LDAPServiceIface interface {
4344
NewLinkDomainToLdapParams(accounttype int, domainid string, lDAPType string) *LinkDomainToLdapParams
4445
ListLdapConfigurations(p *ListLdapConfigurationsParams) (*ListLdapConfigurationsResponse, error)
4546
NewListLdapConfigurationsParams() *ListLdapConfigurationsParams
47+
GetLdapConfigurationByID(id string, opts ...OptionFunc) (*LdapConfiguration, int, error)
4648
ListLdapUsers(p *ListLdapUsersParams) (*ListLdapUsersResponse, error)
4749
NewListLdapUsersParams() *ListLdapUsersParams
4850
SearchLdap(p *SearchLdapParams) (*SearchLdapResponse, error)
@@ -162,6 +164,7 @@ func (s *LDAPService) AddLdapConfiguration(p *AddLdapConfigurationParams) (*AddL
162164
type AddLdapConfigurationResponse struct {
163165
Domainid string `json:"domainid"`
164166
Hostname string `json:"hostname"`
167+
Id string `json:"id"`
165168
JobID string `json:"jobid"`
166169
Jobstatus int `json:"jobstatus"`
167170
Port int `json:"port"`
@@ -182,6 +185,9 @@ func (p *DeleteLdapConfigurationParams) toURLValues() url.Values {
182185
if v, found := p.p["hostname"]; found {
183186
u.Set("hostname", v.(string))
184187
}
188+
if v, found := p.p["id"]; found {
189+
u.Set("id", v.(string))
190+
}
185191
if v, found := p.p["port"]; found {
186192
vv := strconv.Itoa(v.(int))
187193
u.Set("port", vv)
@@ -231,6 +237,27 @@ func (p *DeleteLdapConfigurationParams) GetHostname() (string, bool) {
231237
return value, ok
232238
}
233239

240+
func (p *DeleteLdapConfigurationParams) SetId(v string) {
241+
if p.p == nil {
242+
p.p = make(map[string]interface{})
243+
}
244+
p.p["id"] = v
245+
}
246+
247+
func (p *DeleteLdapConfigurationParams) ResetId() {
248+
if p.p != nil && p.p["id"] != nil {
249+
delete(p.p, "id")
250+
}
251+
}
252+
253+
func (p *DeleteLdapConfigurationParams) GetId() (string, bool) {
254+
if p.p == nil {
255+
p.p = make(map[string]interface{})
256+
}
257+
value, ok := p.p["id"].(string)
258+
return value, ok
259+
}
260+
234261
func (p *DeleteLdapConfigurationParams) SetPort(v int) {
235262
if p.p == nil {
236263
p.p = make(map[string]interface{})
@@ -254,10 +281,9 @@ func (p *DeleteLdapConfigurationParams) GetPort() (int, bool) {
254281

255282
// You should always use this function to get a new DeleteLdapConfigurationParams instance,
256283
// as then you are sure you have configured all required params
257-
func (s *LDAPService) NewDeleteLdapConfigurationParams(hostname string) *DeleteLdapConfigurationParams {
284+
func (s *LDAPService) NewDeleteLdapConfigurationParams() *DeleteLdapConfigurationParams {
258285
p := &DeleteLdapConfigurationParams{}
259286
p.p = make(map[string]interface{})
260-
p.p["hostname"] = hostname
261287
return p
262288
}
263289

@@ -279,6 +305,7 @@ func (s *LDAPService) DeleteLdapConfiguration(p *DeleteLdapConfigurationParams)
279305
type DeleteLdapConfigurationResponse struct {
280306
Domainid string `json:"domainid"`
281307
Hostname string `json:"hostname"`
308+
Id string `json:"id"`
282309
JobID string `json:"jobid"`
283310
Jobstatus int `json:"jobstatus"`
284311
Port int `json:"port"`
@@ -1514,6 +1541,9 @@ func (p *ListLdapConfigurationsParams) toURLValues() url.Values {
15141541
if v, found := p.p["hostname"]; found {
15151542
u.Set("hostname", v.(string))
15161543
}
1544+
if v, found := p.p["id"]; found {
1545+
u.Set("id", v.(string))
1546+
}
15171547
if v, found := p.p["keyword"]; found {
15181548
u.Set("keyword", v.(string))
15191549
}
@@ -1578,6 +1608,27 @@ func (p *ListLdapConfigurationsParams) GetHostname() (string, bool) {
15781608
return value, ok
15791609
}
15801610

1611+
func (p *ListLdapConfigurationsParams) SetId(v string) {
1612+
if p.p == nil {
1613+
p.p = make(map[string]interface{})
1614+
}
1615+
p.p["id"] = v
1616+
}
1617+
1618+
func (p *ListLdapConfigurationsParams) ResetId() {
1619+
if p.p != nil && p.p["id"] != nil {
1620+
delete(p.p, "id")
1621+
}
1622+
}
1623+
1624+
func (p *ListLdapConfigurationsParams) GetId() (string, bool) {
1625+
if p.p == nil {
1626+
p.p = make(map[string]interface{})
1627+
}
1628+
value, ok := p.p["id"].(string)
1629+
return value, ok
1630+
}
1631+
15811632
func (p *ListLdapConfigurationsParams) SetKeyword(v string) {
15821633
if p.p == nil {
15831634
p.p = make(map[string]interface{})
@@ -1691,6 +1742,39 @@ func (s *LDAPService) NewListLdapConfigurationsParams() *ListLdapConfigurationsP
16911742
return p
16921743
}
16931744

1745+
// This is a courtesy helper function, which in some cases may not work as expected!
1746+
func (s *LDAPService) GetLdapConfigurationByID(id string, opts ...OptionFunc) (*LdapConfiguration, int, error) {
1747+
p := &ListLdapConfigurationsParams{}
1748+
p.p = make(map[string]interface{})
1749+
1750+
p.p["id"] = id
1751+
1752+
for _, fn := range append(s.cs.options, opts...) {
1753+
if err := fn(s.cs, p); err != nil {
1754+
return nil, -1, err
1755+
}
1756+
}
1757+
1758+
l, err := s.ListLdapConfigurations(p)
1759+
if err != nil {
1760+
if strings.Contains(err.Error(), fmt.Sprintf(
1761+
"Invalid parameter id value=%s due to incorrect long value format, "+
1762+
"or entity does not exist", id)) {
1763+
return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
1764+
}
1765+
return nil, -1, err
1766+
}
1767+
1768+
if l.Count == 0 {
1769+
return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
1770+
}
1771+
1772+
if l.Count == 1 {
1773+
return l.LdapConfigurations[0], l.Count, nil
1774+
}
1775+
return nil, l.Count, fmt.Errorf("There is more then one result for LdapConfiguration UUID: %s!", id)
1776+
}
1777+
16941778
// Lists all LDAP configurations
16951779
func (s *LDAPService) ListLdapConfigurations(p *ListLdapConfigurationsParams) (*ListLdapConfigurationsResponse, error) {
16961780
resp, err := s.cs.newRequest("listLdapConfigurations", p.toURLValues())
@@ -1714,6 +1798,7 @@ type ListLdapConfigurationsResponse struct {
17141798
type LdapConfiguration struct {
17151799
Domainid string `json:"domainid"`
17161800
Hostname string `json:"hostname"`
1801+
Id string `json:"id"`
17171802
JobID string `json:"jobid"`
17181803
Jobstatus int `json:"jobstatus"`
17191804
Port int `json:"port"`

0 commit comments

Comments
 (0)