Skip to content
Open
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
425 changes: 356 additions & 69 deletions cloudstack/BackupService.go

Large diffs are not rendered by default.

29 changes: 25 additions & 4 deletions cloudstack/BackupService_mock.go

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

2 changes: 2 additions & 0 deletions cloudstack/ConfigurationService.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ type ListCapabilitiesResponse struct {
}

type Capability struct {
Additionalconfigenabled bool `json:"additionalconfigenabled"`
Allowusercreateprojects bool `json:"allowusercreateprojects"`
Allowuserexpungerecovervm bool `json:"allowuserexpungerecovervm"`
Allowuserexpungerecovervolume bool `json:"allowuserexpungerecovervolume"`
Expand Down Expand Up @@ -1336,6 +1337,7 @@ func (s *ConfigurationService) UpdateStorageCapabilities(p *UpdateStorageCapabil

type UpdateStorageCapabilitiesResponse struct {
Allocatediops int64 `json:"allocatediops"`
Capacitybytes int64 `json:"capacitybytes"`
Capacityiops int64 `json:"capacityiops"`
Clusterid string `json:"clusterid"`
Clustername string `json:"clustername"`
Expand Down
25 changes: 25 additions & 0 deletions cloudstack/HostService.go
Original file line number Diff line number Diff line change
Expand Up @@ -4767,6 +4767,10 @@ func (p *UpdateHostParams) toURLValues() url.Values {
if v, found := p.p["annotation"]; found {
u.Set("annotation", v.(string))
}
if v, found := p.p["cleanupexternaldetails"]; found {
vv := strconv.FormatBool(v.(bool))
u.Set("cleanupexternaldetails", vv)
}
if v, found := p.p["externaldetails"]; found {
m := v.(map[string]string)
for i, k := range getSortedKeysFromMap(m) {
Expand Down Expand Up @@ -4839,6 +4843,27 @@ func (p *UpdateHostParams) GetAnnotation() (string, bool) {
return value, ok
}

func (p *UpdateHostParams) SetCleanupexternaldetails(v bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["cleanupexternaldetails"] = v
}

func (p *UpdateHostParams) ResetCleanupexternaldetails() {
if p.p != nil && p.p["cleanupexternaldetails"] != nil {
delete(p.p, "cleanupexternaldetails")
}
}

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

func (p *UpdateHostParams) SetExternaldetails(v map[string]string) {
if p.p == nil {
p.p = make(map[string]interface{})
Expand Down
3 changes: 3 additions & 0 deletions cloudstack/InternalLBService.go
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,7 @@ type InternalLoadBalancerVMHealthcheckresults struct {
Checktype string `json:"checktype"`
Details string `json:"details"`
Lastupdated string `json:"lastupdated"`
Status string `json:"status"`
Success bool `json:"success"`
}

Expand Down Expand Up @@ -1250,6 +1251,7 @@ type StartInternalLoadBalancerVMResponseHealthcheckresults struct {
Checktype string `json:"checktype"`
Details string `json:"details"`
Lastupdated string `json:"lastupdated"`
Status string `json:"status"`
Success bool `json:"success"`
}

Expand Down Expand Up @@ -1423,5 +1425,6 @@ type StopInternalLoadBalancerVMResponseHealthcheckresults struct {
Checktype string `json:"checktype"`
Details string `json:"details"`
Lastupdated string `json:"lastupdated"`
Status string `json:"status"`
Success bool `json:"success"`
}
32 changes: 32 additions & 0 deletions cloudstack/KubernetesService.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ func (p *CreateKubernetesClusterParams) toURLValues() url.Values {
if v, found := p.p["domainid"]; found {
u.Set("domainid", v.(string))
}
if v, found := p.p["enablecsi"]; found {
vv := strconv.FormatBool(v.(bool))
u.Set("enablecsi", vv)
}
if v, found := p.p["etcdnodes"]; found {
vv := strconv.FormatInt(v.(int64), 10)
u.Set("etcdnodes", vv)
Expand Down Expand Up @@ -688,6 +692,27 @@ func (p *CreateKubernetesClusterParams) GetDomainid() (string, bool) {
return value, ok
}

func (p *CreateKubernetesClusterParams) SetEnablecsi(v bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
p.p["enablecsi"] = v
}

func (p *CreateKubernetesClusterParams) ResetEnablecsi() {
if p.p != nil && p.p["enablecsi"] != nil {
delete(p.p, "enablecsi")
}
}

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

func (p *CreateKubernetesClusterParams) SetEtcdnodes(v int64) {
if p.p == nil {
p.p = make(map[string]interface{})
Expand Down Expand Up @@ -1065,6 +1090,7 @@ type CreateKubernetesClusterResponse struct {
Controlofferingname string `json:"controlofferingname"`
Cpunumber string `json:"cpunumber"`
Created string `json:"created"`
Csienabled bool `json:"csienabled"`
Description string `json:"description"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Expand Down Expand Up @@ -1815,6 +1841,7 @@ type KubernetesCluster struct {
Controlofferingname string `json:"controlofferingname"`
Cpunumber string `json:"cpunumber"`
Created string `json:"created"`
Csienabled bool `json:"csienabled"`
Description string `json:"description"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Expand Down Expand Up @@ -2461,6 +2488,7 @@ type ScaleKubernetesClusterResponse struct {
Controlofferingname string `json:"controlofferingname"`
Cpunumber string `json:"cpunumber"`
Created string `json:"created"`
Csienabled bool `json:"csienabled"`
Description string `json:"description"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Expand Down Expand Up @@ -2592,6 +2620,7 @@ type StartKubernetesClusterResponse struct {
Controlofferingname string `json:"controlofferingname"`
Cpunumber string `json:"cpunumber"`
Created string `json:"created"`
Csienabled bool `json:"csienabled"`
Description string `json:"description"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Expand Down Expand Up @@ -2936,6 +2965,7 @@ type UpgradeKubernetesClusterResponse struct {
Controlofferingname string `json:"controlofferingname"`
Cpunumber string `json:"cpunumber"`
Created string `json:"created"`
Csienabled bool `json:"csienabled"`
Description string `json:"description"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Expand Down Expand Up @@ -3483,6 +3513,7 @@ type AddNodesToKubernetesClusterResponse struct {
Controlofferingname string `json:"controlofferingname"`
Cpunumber string `json:"cpunumber"`
Created string `json:"created"`
Csienabled bool `json:"csienabled"`
Description string `json:"description"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Expand Down Expand Up @@ -3640,6 +3671,7 @@ type RemoveNodesFromKubernetesClusterResponse struct {
Controlofferingname string `json:"controlofferingname"`
Cpunumber string `json:"cpunumber"`
Created string `json:"created"`
Csienabled bool `json:"csienabled"`
Description string `json:"description"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
Expand Down
91 changes: 88 additions & 3 deletions cloudstack/LDAPService.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ import (
"fmt"
"net/url"
"strconv"
"strings"
)

type LDAPServiceIface interface {
AddLdapConfiguration(p *AddLdapConfigurationParams) (*AddLdapConfigurationResponse, error)
NewAddLdapConfigurationParams(hostname string, port int) *AddLdapConfigurationParams
DeleteLdapConfiguration(p *DeleteLdapConfigurationParams) (*DeleteLdapConfigurationResponse, error)
NewDeleteLdapConfigurationParams(hostname string) *DeleteLdapConfigurationParams
NewDeleteLdapConfigurationParams() *DeleteLdapConfigurationParams
ImportLdapUsers(p *ImportLdapUsersParams) (*ImportLdapUsersResponse, error)
NewImportLdapUsersParams() *ImportLdapUsersParams
LdapConfig(p *LdapConfigParams) (*LdapConfigResponse, error)
Expand All @@ -43,6 +44,7 @@ type LDAPServiceIface interface {
NewLinkDomainToLdapParams(accounttype int, domainid string, lDAPType string) *LinkDomainToLdapParams
ListLdapConfigurations(p *ListLdapConfigurationsParams) (*ListLdapConfigurationsResponse, error)
NewListLdapConfigurationsParams() *ListLdapConfigurationsParams
GetLdapConfigurationByID(id string, opts ...OptionFunc) (*LdapConfiguration, int, error)
ListLdapUsers(p *ListLdapUsersParams) (*ListLdapUsersResponse, error)
NewListLdapUsersParams() *ListLdapUsersParams
SearchLdap(p *SearchLdapParams) (*SearchLdapResponse, error)
Expand Down Expand Up @@ -162,6 +164,7 @@ func (s *LDAPService) AddLdapConfiguration(p *AddLdapConfigurationParams) (*AddL
type AddLdapConfigurationResponse struct {
Domainid string `json:"domainid"`
Hostname string `json:"hostname"`
Id string `json:"id"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Port int `json:"port"`
Expand All @@ -182,6 +185,9 @@ func (p *DeleteLdapConfigurationParams) toURLValues() url.Values {
if v, found := p.p["hostname"]; found {
u.Set("hostname", v.(string))
}
if v, found := p.p["id"]; found {
u.Set("id", v.(string))
}
if v, found := p.p["port"]; found {
vv := strconv.Itoa(v.(int))
u.Set("port", vv)
Expand Down Expand Up @@ -231,6 +237,27 @@ func (p *DeleteLdapConfigurationParams) GetHostname() (string, bool) {
return value, ok
}

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

func (p *DeleteLdapConfigurationParams) ResetId() {
if p.p != nil && p.p["id"] != nil {
delete(p.p, "id")
}
}

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

func (p *DeleteLdapConfigurationParams) SetPort(v int) {
if p.p == nil {
p.p = make(map[string]interface{})
Expand All @@ -254,10 +281,9 @@ func (p *DeleteLdapConfigurationParams) GetPort() (int, bool) {

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

Expand All @@ -279,6 +305,7 @@ func (s *LDAPService) DeleteLdapConfiguration(p *DeleteLdapConfigurationParams)
type DeleteLdapConfigurationResponse struct {
Domainid string `json:"domainid"`
Hostname string `json:"hostname"`
Id string `json:"id"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Port int `json:"port"`
Expand Down Expand Up @@ -1514,6 +1541,9 @@ func (p *ListLdapConfigurationsParams) toURLValues() url.Values {
if v, found := p.p["hostname"]; found {
u.Set("hostname", v.(string))
}
if v, found := p.p["id"]; found {
u.Set("id", v.(string))
}
if v, found := p.p["keyword"]; found {
u.Set("keyword", v.(string))
}
Expand Down Expand Up @@ -1578,6 +1608,27 @@ func (p *ListLdapConfigurationsParams) GetHostname() (string, bool) {
return value, ok
}

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

func (p *ListLdapConfigurationsParams) ResetId() {
if p.p != nil && p.p["id"] != nil {
delete(p.p, "id")
}
}

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

func (p *ListLdapConfigurationsParams) SetKeyword(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
Expand Down Expand Up @@ -1691,6 +1742,39 @@ func (s *LDAPService) NewListLdapConfigurationsParams() *ListLdapConfigurationsP
return p
}

// This is a courtesy helper function, which in some cases may not work as expected!
func (s *LDAPService) GetLdapConfigurationByID(id string, opts ...OptionFunc) (*LdapConfiguration, int, error) {
p := &ListLdapConfigurationsParams{}
p.p = make(map[string]interface{})

p.p["id"] = id

for _, fn := range append(s.cs.options, opts...) {
if err := fn(s.cs, p); err != nil {
return nil, -1, err
}
}

l, err := s.ListLdapConfigurations(p)
if err != nil {
if strings.Contains(err.Error(), fmt.Sprintf(
"Invalid parameter id value=%s due to incorrect long value format, "+
"or entity does not exist", id)) {
return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
}
return nil, -1, err
}

if l.Count == 0 {
return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
}

if l.Count == 1 {
return l.LdapConfigurations[0], l.Count, nil
}
return nil, l.Count, fmt.Errorf("There is more then one result for LdapConfiguration UUID: %s!", id)
}

// Lists all LDAP configurations
func (s *LDAPService) ListLdapConfigurations(p *ListLdapConfigurationsParams) (*ListLdapConfigurationsResponse, error) {
resp, err := s.cs.newRequest("listLdapConfigurations", p.toURLValues())
Expand All @@ -1714,6 +1798,7 @@ type ListLdapConfigurationsResponse struct {
type LdapConfiguration struct {
Domainid string `json:"domainid"`
Hostname string `json:"hostname"`
Id string `json:"id"`
JobID string `json:"jobid"`
Jobstatus int `json:"jobstatus"`
Port int `json:"port"`
Expand Down
Loading
Loading