Update the generated code using the correct layout
diff --git a/cloudstack/APIDiscoveryService.go b/cloudstack/APIDiscoveryService.go
index 3ddb53a..30ae04e 100644
--- a/cloudstack/APIDiscoveryService.go
+++ b/cloudstack/APIDiscoveryService.go
@@ -21,49 +21,6 @@
"net/url"
)
-type GetApiLimitParams struct {
- p map[string]interface{}
-}
-
-func (p *GetApiLimitParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- return u
-}
-
-// You should always use this function to get a new GetApiLimitParams instance,
-// as then you are sure you have configured all required params
-func (s *APIDiscoveryService) NewGetApiLimitParams() *GetApiLimitParams {
- p := &GetApiLimitParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Get API limit count for the caller
-func (s *APIDiscoveryService) GetApiLimit(p *GetApiLimitParams) (*GetApiLimitResponse, error) {
- resp, err := s.cs.newRequest("getApiLimit", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r GetApiLimitResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type GetApiLimitResponse struct {
- Account string `json:"account"`
- Accountid string `json:"accountid"`
- ApiAllowed int `json:"apiAllowed"`
- ApiIssued int `json:"apiIssued"`
- ExpireAfter int64 `json:"expireAfter"`
-}
-
type ListApisParams struct {
p map[string]interface{}
}
@@ -138,57 +95,3 @@
Since string `json:"since"`
Type string `json:"type"`
}
-
-type ResetApiLimitParams struct {
- p map[string]interface{}
-}
-
-func (p *ResetApiLimitParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- return u
-}
-
-func (p *ResetApiLimitParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-// You should always use this function to get a new ResetApiLimitParams instance,
-// as then you are sure you have configured all required params
-func (s *APIDiscoveryService) NewResetApiLimitParams() *ResetApiLimitParams {
- p := &ResetApiLimitParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Reset api count
-func (s *APIDiscoveryService) ResetApiLimit(p *ResetApiLimitParams) (*ResetApiLimitResponse, error) {
- resp, err := s.cs.newRequest("resetApiLimit", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ResetApiLimitResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ResetApiLimitResponse struct {
- Account string `json:"account"`
- Accountid string `json:"accountid"`
- ApiAllowed int `json:"apiAllowed"`
- ApiIssued int `json:"apiIssued"`
- ExpireAfter int64 `json:"expireAfter"`
-}
diff --git a/cloudstack/BrocadeVCSService.go b/cloudstack/BrocadeVCSService.go
index c7c3717..1390d29 100644
--- a/cloudstack/BrocadeVCSService.go
+++ b/cloudstack/BrocadeVCSService.go
@@ -18,6 +18,7 @@
import (
"encoding/json"
+ "fmt"
"net/url"
"strconv"
)
@@ -202,6 +203,208 @@
Success bool `json:"success"`
}
+type ListBrocadeVcsDeviceNetworksParams struct {
+ p map[string]interface{}
+}
+
+func (p *ListBrocadeVcsDeviceNetworksParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["keyword"]; found {
+ u.Set("keyword", v.(string))
+ }
+ if v, found := p.p["page"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("page", vv)
+ }
+ if v, found := p.p["pagesize"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("pagesize", vv)
+ }
+ if v, found := p.p["vcsdeviceid"]; found {
+ u.Set("vcsdeviceid", v.(string))
+ }
+ return u
+}
+
+func (p *ListBrocadeVcsDeviceNetworksParams) SetKeyword(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["keyword"] = v
+ return
+}
+
+func (p *ListBrocadeVcsDeviceNetworksParams) SetPage(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["page"] = v
+ return
+}
+
+func (p *ListBrocadeVcsDeviceNetworksParams) SetPagesize(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["pagesize"] = v
+ return
+}
+
+func (p *ListBrocadeVcsDeviceNetworksParams) SetVcsdeviceid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["vcsdeviceid"] = v
+ return
+}
+
+// You should always use this function to get a new ListBrocadeVcsDeviceNetworksParams instance,
+// as then you are sure you have configured all required params
+func (s *BrocadeVCSService) NewListBrocadeVcsDeviceNetworksParams(vcsdeviceid string) *ListBrocadeVcsDeviceNetworksParams {
+ p := &ListBrocadeVcsDeviceNetworksParams{}
+ p.p = make(map[string]interface{})
+ p.p["vcsdeviceid"] = vcsdeviceid
+ return p
+}
+
+// This is a courtesy helper function, which in some cases may not work as expected!
+func (s *BrocadeVCSService) GetBrocadeVcsDeviceNetworkID(keyword string, vcsdeviceid string, opts ...OptionFunc) (string, int, error) {
+ p := &ListBrocadeVcsDeviceNetworksParams{}
+ p.p = make(map[string]interface{})
+
+ p.p["keyword"] = keyword
+ p.p["vcsdeviceid"] = vcsdeviceid
+
+ for _, fn := range append(s.cs.options, opts...) {
+ if err := fn(s.cs, p); err != nil {
+ return "", -1, err
+ }
+ }
+
+ l, err := s.ListBrocadeVcsDeviceNetworks(p)
+ if err != nil {
+ return "", -1, err
+ }
+
+ if l.Count == 0 {
+ return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l)
+ }
+
+ if l.Count == 1 {
+ return l.BrocadeVcsDeviceNetworks[0].Id, l.Count, nil
+ }
+
+ if l.Count > 1 {
+ for _, v := range l.BrocadeVcsDeviceNetworks {
+ if v.Name == keyword {
+ return v.Id, l.Count, nil
+ }
+ }
+ }
+ return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l)
+}
+
+// lists network that are using a brocade vcs switch
+func (s *BrocadeVCSService) ListBrocadeVcsDeviceNetworks(p *ListBrocadeVcsDeviceNetworksParams) (*ListBrocadeVcsDeviceNetworksResponse, error) {
+ resp, err := s.cs.newRequest("listBrocadeVcsDeviceNetworks", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r ListBrocadeVcsDeviceNetworksResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type ListBrocadeVcsDeviceNetworksResponse struct {
+ Count int `json:"count"`
+ BrocadeVcsDeviceNetworks []*BrocadeVcsDeviceNetwork `json:"brocadevcsdevicenetwork"`
+}
+
+type BrocadeVcsDeviceNetwork struct {
+ Account string `json:"account"`
+ Aclid string `json:"aclid"`
+ Acltype string `json:"acltype"`
+ Broadcastdomaintype string `json:"broadcastdomaintype"`
+ Broadcasturi string `json:"broadcasturi"`
+ Canusefordeploy bool `json:"canusefordeploy"`
+ Cidr string `json:"cidr"`
+ Displaynetwork bool `json:"displaynetwork"`
+ Displaytext string `json:"displaytext"`
+ Dns1 string `json:"dns1"`
+ Dns2 string `json:"dns2"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Gateway string `json:"gateway"`
+ Id string `json:"id"`
+ Ip6cidr string `json:"ip6cidr"`
+ Ip6gateway string `json:"ip6gateway"`
+ Isdefault bool `json:"isdefault"`
+ Ispersistent bool `json:"ispersistent"`
+ Issystem bool `json:"issystem"`
+ Name string `json:"name"`
+ Netmask string `json:"netmask"`
+ Networkcidr string `json:"networkcidr"`
+ Networkdomain string `json:"networkdomain"`
+ Networkofferingavailability string `json:"networkofferingavailability"`
+ Networkofferingconservemode bool `json:"networkofferingconservemode"`
+ Networkofferingdisplaytext string `json:"networkofferingdisplaytext"`
+ Networkofferingid string `json:"networkofferingid"`
+ Networkofferingname string `json:"networkofferingname"`
+ Physicalnetworkid string `json:"physicalnetworkid"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Related string `json:"related"`
+ Reservediprange string `json:"reservediprange"`
+ Restartrequired bool `json:"restartrequired"`
+ Service []struct {
+ Capability []struct {
+ Canchooseservicecapability bool `json:"canchooseservicecapability"`
+ Name string `json:"name"`
+ Value string `json:"value"`
+ } `json:"capability"`
+ Name string `json:"name"`
+ Provider []struct {
+ Canenableindividualservice bool `json:"canenableindividualservice"`
+ Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Physicalnetworkid string `json:"physicalnetworkid"`
+ Servicelist []string `json:"servicelist"`
+ State string `json:"state"`
+ } `json:"provider"`
+ } `json:"service"`
+ Specifyipranges bool `json:"specifyipranges"`
+ State string `json:"state"`
+ Strechedl2subnet bool `json:"strechedl2subnet"`
+ Subdomainaccess bool `json:"subdomainaccess"`
+ Tags []struct {
+ Account string `json:"account"`
+ Customer string `json:"customer"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Key string `json:"key"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Resourceid string `json:"resourceid"`
+ Resourcetype string `json:"resourcetype"`
+ Value string `json:"value"`
+ } `json:"tags"`
+ Traffictype string `json:"traffictype"`
+ Type string `json:"type"`
+ Vlan string `json:"vlan"`
+ Vpcid string `json:"vpcid"`
+ Zoneid string `json:"zoneid"`
+ Zonename string `json:"zonename"`
+ Zonesnetworkspans []interface{} `json:"zonesnetworkspans"`
+}
+
type ListBrocadeVcsDevicesParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/ClusterService.go b/cloudstack/ClusterService.go
index f757b33..ec4b669 100644
--- a/cloudstack/ClusterService.go
+++ b/cloudstack/ClusterService.go
@@ -905,235 +905,6 @@
Zonename string `json:"zonename"`
}
-type ListClustersMetricsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListClustersMetricsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["allocationstate"]; found {
- u.Set("allocationstate", v.(string))
- }
- if v, found := p.p["clustertype"]; found {
- u.Set("clustertype", v.(string))
- }
- if v, found := p.p["hypervisor"]; found {
- u.Set("hypervisor", 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))
- }
- if v, found := p.p["managedstate"]; found {
- u.Set("managedstate", v.(string))
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["podid"]; found {
- u.Set("podid", v.(string))
- }
- if v, found := p.p["showcapacities"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("showcapacities", vv)
- }
- if v, found := p.p["zoneid"]; found {
- u.Set("zoneid", v.(string))
- }
- return u
-}
-
-func (p *ListClustersMetricsParams) SetAllocationstate(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["allocationstate"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetClustertype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["clustertype"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetHypervisor(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["hypervisor"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetManagedstate(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["managedstate"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetPodid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["podid"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetShowcapacities(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["showcapacities"] = v
- return
-}
-
-func (p *ListClustersMetricsParams) SetZoneid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["zoneid"] = v
- return
-}
-
-// You should always use this function to get a new ListClustersMetricsParams instance,
-// as then you are sure you have configured all required params
-func (s *ClusterService) NewListClustersMetricsParams() *ListClustersMetricsParams {
- p := &ListClustersMetricsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *ClusterService) GetClustersMetricByID(id string, opts ...OptionFunc) (*ClustersMetric, int, error) {
- p := &ListClustersMetricsParams{}
- 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.ListClustersMetrics(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.ClustersMetrics[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for ClustersMetric UUID: %s!", id)
-}
-
-// Lists clusters metrics
-func (s *ClusterService) ListClustersMetrics(p *ListClustersMetricsParams) (*ListClustersMetricsResponse, error) {
- resp, err := s.cs.newRequest("listClustersMetrics", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListClustersMetricsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListClustersMetricsResponse struct {
- Count int `json:"count"`
- ClustersMetrics []*ClustersMetric `json:"clustersmetric"`
-}
-
-type ClustersMetric struct {
- Cpuallocated string `json:"cpuallocated"`
- Cpuallocateddisablethreshold bool `json:"cpuallocateddisablethreshold"`
- Cpuallocatedthreshold bool `json:"cpuallocatedthreshold"`
- Cpudisablethreshold bool `json:"cpudisablethreshold"`
- Cpumaxdeviation string `json:"cpumaxdeviation"`
- Cputhreshold bool `json:"cputhreshold"`
- Cputotal string `json:"cputotal"`
- Cpuused string `json:"cpuused"`
- Hosts string `json:"hosts"`
- Memoryallocated string `json:"memoryallocated"`
- Memoryallocateddisablethreshold bool `json:"memoryallocateddisablethreshold"`
- Memoryallocatedthreshold bool `json:"memoryallocatedthreshold"`
- Memorydisablethreshold bool `json:"memorydisablethreshold"`
- Memorymaxdeviation string `json:"memorymaxdeviation"`
- Memorythreshold bool `json:"memorythreshold"`
- Memorytotal string `json:"memorytotal"`
- Memoryused string `json:"memoryused"`
- State string `json:"state"`
-}
-
type ListDedicatedClustersParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/ExtLoadBalancer.go b/cloudstack/ExtLoadBalancerService.go
similarity index 90%
rename from cloudstack/ExtLoadBalancer.go
rename to cloudstack/ExtLoadBalancerService.go
index 2e4e00e..bdbf2d1 100644
--- a/cloudstack/ExtLoadBalancer.go
+++ b/cloudstack/ExtLoadBalancerService.go
@@ -81,7 +81,7 @@
// You should always use this function to get a new AddExternalLoadBalancerParams instance,
// as then you are sure you have configured all required params
-func (s *ExtLoadBalancer) NewAddExternalLoadBalancerParams(password string, url string, username string, zoneid string) *AddExternalLoadBalancerParams {
+func (s *ExtLoadBalancerService) NewAddExternalLoadBalancerParams(password string, url string, username string, zoneid string) *AddExternalLoadBalancerParams {
p := &AddExternalLoadBalancerParams{}
p.p = make(map[string]interface{})
p.p["password"] = password
@@ -92,7 +92,7 @@
}
// Adds F5 external load balancer appliance.
-func (s *ExtLoadBalancer) AddExternalLoadBalancer(p *AddExternalLoadBalancerParams) (*AddExternalLoadBalancerResponse, error) {
+func (s *ExtLoadBalancerService) AddExternalLoadBalancer(p *AddExternalLoadBalancerParams) (*AddExternalLoadBalancerResponse, error) {
resp, err := s.cs.newRequest("addExternalLoadBalancer", p.toURLValues())
if err != nil {
return nil, err
@@ -141,7 +141,7 @@
// You should always use this function to get a new DeleteExternalLoadBalancerParams instance,
// as then you are sure you have configured all required params
-func (s *ExtLoadBalancer) NewDeleteExternalLoadBalancerParams(id string) *DeleteExternalLoadBalancerParams {
+func (s *ExtLoadBalancerService) NewDeleteExternalLoadBalancerParams(id string) *DeleteExternalLoadBalancerParams {
p := &DeleteExternalLoadBalancerParams{}
p.p = make(map[string]interface{})
p.p["id"] = id
@@ -149,7 +149,7 @@
}
// Deletes a F5 external load balancer appliance added in a zone.
-func (s *ExtLoadBalancer) DeleteExternalLoadBalancer(p *DeleteExternalLoadBalancerParams) (*DeleteExternalLoadBalancerResponse, error) {
+func (s *ExtLoadBalancerService) DeleteExternalLoadBalancer(p *DeleteExternalLoadBalancerParams) (*DeleteExternalLoadBalancerResponse, error) {
resp, err := s.cs.newRequest("deleteExternalLoadBalancer", p.toURLValues())
if err != nil {
return nil, err
@@ -228,14 +228,14 @@
// You should always use this function to get a new ListExternalLoadBalancersParams instance,
// as then you are sure you have configured all required params
-func (s *ExtLoadBalancer) NewListExternalLoadBalancersParams() *ListExternalLoadBalancersParams {
+func (s *ExtLoadBalancerService) NewListExternalLoadBalancersParams() *ListExternalLoadBalancersParams {
p := &ListExternalLoadBalancersParams{}
p.p = make(map[string]interface{})
return p
}
// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *ExtLoadBalancer) GetExternalLoadBalancerID(keyword string, opts ...OptionFunc) (string, int, error) {
+func (s *ExtLoadBalancerService) GetExternalLoadBalancerID(keyword string, opts ...OptionFunc) (string, int, error) {
p := &ListExternalLoadBalancersParams{}
p.p = make(map[string]interface{})
@@ -271,7 +271,7 @@
}
// Lists F5 external load balancer appliances added in a zone.
-func (s *ExtLoadBalancer) ListExternalLoadBalancers(p *ListExternalLoadBalancersParams) (*ListExternalLoadBalancersResponse, error) {
+func (s *ExtLoadBalancerService) ListExternalLoadBalancers(p *ListExternalLoadBalancersParams) (*ListExternalLoadBalancersResponse, error) {
resp, err := s.cs.newRequest("listExternalLoadBalancers", p.toURLValues())
if err != nil {
return nil, err
diff --git a/cloudstack/HostService.go b/cloudstack/HostService.go
index 8b9d842..85e7a42 100644
--- a/cloudstack/HostService.go
+++ b/cloudstack/HostService.go
@@ -1858,292 +1858,6 @@
Zonename string `json:"zonename"`
}
-type ListHostsMetricsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListHostsMetricsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["clusterid"]; found {
- u.Set("clusterid", v.(string))
- }
- if v, found := p.p["details"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("details", vv)
- }
- if v, found := p.p["hahost"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("hahost", vv)
- }
- if v, found := p.p["hypervisor"]; found {
- u.Set("hypervisor", 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))
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["outofbandmanagementenabled"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("outofbandmanagementenabled", vv)
- }
- if v, found := p.p["outofbandmanagementpowerstate"]; found {
- u.Set("outofbandmanagementpowerstate", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["podid"]; found {
- u.Set("podid", v.(string))
- }
- if v, found := p.p["resourcestate"]; found {
- u.Set("resourcestate", v.(string))
- }
- if v, found := p.p["state"]; found {
- u.Set("state", v.(string))
- }
- if v, found := p.p["type"]; found {
- u.Set("type", v.(string))
- }
- if v, found := p.p["virtualmachineid"]; found {
- u.Set("virtualmachineid", v.(string))
- }
- if v, found := p.p["zoneid"]; found {
- u.Set("zoneid", v.(string))
- }
- return u
-}
-
-func (p *ListHostsMetricsParams) SetClusterid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["clusterid"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetDetails(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["details"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetHahost(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["hahost"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetHypervisor(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["hypervisor"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetOutofbandmanagementenabled(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["outofbandmanagementenabled"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetOutofbandmanagementpowerstate(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["outofbandmanagementpowerstate"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetPodid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["podid"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetResourcestate(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["resourcestate"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetState(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["state"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetType(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["type"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetVirtualmachineid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["virtualmachineid"] = v
- return
-}
-
-func (p *ListHostsMetricsParams) SetZoneid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["zoneid"] = v
- return
-}
-
-// You should always use this function to get a new ListHostsMetricsParams instance,
-// as then you are sure you have configured all required params
-func (s *HostService) NewListHostsMetricsParams() *ListHostsMetricsParams {
- p := &ListHostsMetricsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *HostService) GetHostsMetricByID(id string, opts ...OptionFunc) (*HostsMetric, int, error) {
- p := &ListHostsMetricsParams{}
- 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.ListHostsMetrics(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.HostsMetrics[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for HostsMetric UUID: %s!", id)
-}
-
-// Lists hosts metrics
-func (s *HostService) ListHostsMetrics(p *ListHostsMetricsParams) (*ListHostsMetricsResponse, error) {
- resp, err := s.cs.newRequest("listHostsMetrics", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListHostsMetricsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListHostsMetricsResponse struct {
- Count int `json:"count"`
- HostsMetrics []*HostsMetric `json:"hostsmetric"`
-}
-
-type HostsMetric struct {
- Cpuallocateddisablethreshold bool `json:"cpuallocateddisablethreshold"`
- Cpuallocatedghz string `json:"cpuallocatedghz"`
- Cpuallocatedthreshold bool `json:"cpuallocatedthreshold"`
- Cpudisablethreshold bool `json:"cpudisablethreshold"`
- Cputhreshold bool `json:"cputhreshold"`
- Cputotalghz string `json:"cputotalghz"`
- Cpuusedghz string `json:"cpuusedghz"`
- Instances string `json:"instances"`
- Memoryallocateddisablethreshold bool `json:"memoryallocateddisablethreshold"`
- Memoryallocatedgb string `json:"memoryallocatedgb"`
- Memoryallocatedthreshold bool `json:"memoryallocatedthreshold"`
- Memorydisablethreshold bool `json:"memorydisablethreshold"`
- Memorythreshold bool `json:"memorythreshold"`
- Memorytotalgb string `json:"memorytotalgb"`
- Memoryusedgb string `json:"memoryusedgb"`
- Networkread string `json:"networkread"`
- Networkwrite string `json:"networkwrite"`
- Powerstate string `json:"powerstate"`
-}
-
type PrepareHostForMaintenanceParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/ImageStoreService.go b/cloudstack/ImageStoreService.go
index ef9b0b6..41dc41f 100644
--- a/cloudstack/ImageStoreService.go
+++ b/cloudstack/ImageStoreService.go
@@ -131,6 +131,184 @@
Zonename string `json:"zonename"`
}
+type AddImageStoreS3Params struct {
+ p map[string]interface{}
+}
+
+func (p *AddImageStoreS3Params) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["accesskey"]; found {
+ u.Set("accesskey", v.(string))
+ }
+ if v, found := p.p["bucket"]; found {
+ u.Set("bucket", v.(string))
+ }
+ if v, found := p.p["connectiontimeout"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("connectiontimeout", vv)
+ }
+ if v, found := p.p["connectionttl"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("connectionttl", vv)
+ }
+ if v, found := p.p["endpoint"]; found {
+ u.Set("endpoint", v.(string))
+ }
+ if v, found := p.p["maxerrorretry"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("maxerrorretry", vv)
+ }
+ if v, found := p.p["s3signer"]; found {
+ u.Set("s3signer", v.(string))
+ }
+ if v, found := p.p["secretkey"]; found {
+ u.Set("secretkey", v.(string))
+ }
+ if v, found := p.p["sockettimeout"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("sockettimeout", vv)
+ }
+ if v, found := p.p["usehttps"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("usehttps", vv)
+ }
+ if v, found := p.p["usetcpkeepalive"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("usetcpkeepalive", vv)
+ }
+ return u
+}
+
+func (p *AddImageStoreS3Params) SetAccesskey(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["accesskey"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetBucket(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["bucket"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetConnectiontimeout(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["connectiontimeout"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetConnectionttl(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["connectionttl"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetEndpoint(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["endpoint"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetMaxerrorretry(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["maxerrorretry"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetS3signer(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["s3signer"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetSecretkey(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["secretkey"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetSockettimeout(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["sockettimeout"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetUsehttps(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["usehttps"] = v
+ return
+}
+
+func (p *AddImageStoreS3Params) SetUsetcpkeepalive(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["usetcpkeepalive"] = v
+ return
+}
+
+// You should always use this function to get a new AddImageStoreS3Params instance,
+// as then you are sure you have configured all required params
+func (s *ImageStoreService) NewAddImageStoreS3Params(accesskey string, bucket string, endpoint string, secretkey string) *AddImageStoreS3Params {
+ p := &AddImageStoreS3Params{}
+ p.p = make(map[string]interface{})
+ p.p["accesskey"] = accesskey
+ p.p["bucket"] = bucket
+ p.p["endpoint"] = endpoint
+ p.p["secretkey"] = secretkey
+ return p
+}
+
+// Adds S3 Image Store
+func (s *ImageStoreService) AddImageStoreS3(p *AddImageStoreS3Params) (*AddImageStoreS3Response, error) {
+ resp, err := s.cs.newRequest("addImageStoreS3", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r AddImageStoreS3Response
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type AddImageStoreS3Response struct {
+ Details []interface{} `json:"details"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Protocol string `json:"protocol"`
+ Providername string `json:"providername"`
+ Scope string `json:"scope"`
+ Url string `json:"url"`
+ Zoneid string `json:"zoneid"`
+ Zonename string `json:"zonename"`
+}
+
type CreateSecondaryStagingStoreParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/InternalLBService.go b/cloudstack/InternalLBService.go
index a052b59..905e7c5 100644
--- a/cloudstack/InternalLBService.go
+++ b/cloudstack/InternalLBService.go
@@ -332,3 +332,685 @@
Id string `json:"id"`
Nspid string `json:"nspid"`
}
+
+type ListInternalLoadBalancerVMsParams struct {
+ p map[string]interface{}
+}
+
+func (p *ListInternalLoadBalancerVMsParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["account"]; found {
+ u.Set("account", v.(string))
+ }
+ if v, found := p.p["domainid"]; found {
+ u.Set("domainid", v.(string))
+ }
+ if v, found := p.p["forvpc"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("forvpc", vv)
+ }
+ if v, found := p.p["hostid"]; found {
+ u.Set("hostid", v.(string))
+ }
+ if v, found := p.p["id"]; found {
+ u.Set("id", v.(string))
+ }
+ if v, found := p.p["isrecursive"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("isrecursive", vv)
+ }
+ if v, found := p.p["keyword"]; found {
+ u.Set("keyword", v.(string))
+ }
+ if v, found := p.p["listall"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("listall", vv)
+ }
+ if v, found := p.p["name"]; found {
+ u.Set("name", v.(string))
+ }
+ if v, found := p.p["networkid"]; found {
+ u.Set("networkid", v.(string))
+ }
+ if v, found := p.p["page"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("page", vv)
+ }
+ if v, found := p.p["pagesize"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("pagesize", vv)
+ }
+ if v, found := p.p["podid"]; found {
+ u.Set("podid", v.(string))
+ }
+ if v, found := p.p["projectid"]; found {
+ u.Set("projectid", v.(string))
+ }
+ if v, found := p.p["state"]; found {
+ u.Set("state", v.(string))
+ }
+ if v, found := p.p["vpcid"]; found {
+ u.Set("vpcid", v.(string))
+ }
+ if v, found := p.p["zoneid"]; found {
+ u.Set("zoneid", v.(string))
+ }
+ return u
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetAccount(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["account"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetDomainid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["domainid"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetForvpc(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["forvpc"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetHostid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["hostid"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetIsrecursive(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["isrecursive"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetKeyword(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["keyword"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetListall(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["listall"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetName(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["name"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetNetworkid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["networkid"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetPage(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["page"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetPagesize(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["pagesize"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetPodid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["podid"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetProjectid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["projectid"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetState(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["state"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetVpcid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["vpcid"] = v
+ return
+}
+
+func (p *ListInternalLoadBalancerVMsParams) SetZoneid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["zoneid"] = v
+ return
+}
+
+// You should always use this function to get a new ListInternalLoadBalancerVMsParams instance,
+// as then you are sure you have configured all required params
+func (s *InternalLBService) NewListInternalLoadBalancerVMsParams() *ListInternalLoadBalancerVMsParams {
+ p := &ListInternalLoadBalancerVMsParams{}
+ p.p = make(map[string]interface{})
+ return p
+}
+
+// This is a courtesy helper function, which in some cases may not work as expected!
+func (s *InternalLBService) GetInternalLoadBalancerVMID(name string, opts ...OptionFunc) (string, int, error) {
+ p := &ListInternalLoadBalancerVMsParams{}
+ p.p = make(map[string]interface{})
+
+ p.p["name"] = name
+
+ for _, fn := range append(s.cs.options, opts...) {
+ if err := fn(s.cs, p); err != nil {
+ return "", -1, err
+ }
+ }
+
+ l, err := s.ListInternalLoadBalancerVMs(p)
+ if err != nil {
+ return "", -1, err
+ }
+
+ if l.Count == 0 {
+ return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
+ }
+
+ if l.Count == 1 {
+ return l.InternalLoadBalancerVMs[0].Id, l.Count, nil
+ }
+
+ if l.Count > 1 {
+ for _, v := range l.InternalLoadBalancerVMs {
+ if v.Name == name {
+ return v.Id, l.Count, nil
+ }
+ }
+ }
+ return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
+}
+
+// This is a courtesy helper function, which in some cases may not work as expected!
+func (s *InternalLBService) GetInternalLoadBalancerVMByName(name string, opts ...OptionFunc) (*InternalLoadBalancerVM, int, error) {
+ id, count, err := s.GetInternalLoadBalancerVMID(name, opts...)
+ if err != nil {
+ return nil, count, err
+ }
+
+ r, count, err := s.GetInternalLoadBalancerVMByID(id, opts...)
+ if err != nil {
+ return nil, count, err
+ }
+ return r, count, nil
+}
+
+// This is a courtesy helper function, which in some cases may not work as expected!
+func (s *InternalLBService) GetInternalLoadBalancerVMByID(id string, opts ...OptionFunc) (*InternalLoadBalancerVM, int, error) {
+ p := &ListInternalLoadBalancerVMsParams{}
+ 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.ListInternalLoadBalancerVMs(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.InternalLoadBalancerVMs[0], l.Count, nil
+ }
+ return nil, l.Count, fmt.Errorf("There is more then one result for InternalLoadBalancerVM UUID: %s!", id)
+}
+
+// List internal LB VMs.
+func (s *InternalLBService) ListInternalLoadBalancerVMs(p *ListInternalLoadBalancerVMsParams) (*ListInternalLoadBalancerVMsResponse, error) {
+ resp, err := s.cs.newRequest("listInternalLoadBalancerVMs", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r ListInternalLoadBalancerVMsResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type ListInternalLoadBalancerVMsResponse struct {
+ Count int `json:"count"`
+ InternalLoadBalancerVMs []*InternalLoadBalancerVM `json:"internalloadbalancervm"`
+}
+
+type InternalLoadBalancerVM struct {
+ Account string `json:"account"`
+ Created string `json:"created"`
+ Dns1 string `json:"dns1"`
+ Dns2 string `json:"dns2"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Gateway string `json:"gateway"`
+ Guestipaddress string `json:"guestipaddress"`
+ Guestmacaddress string `json:"guestmacaddress"`
+ Guestnetmask string `json:"guestnetmask"`
+ Guestnetworkid string `json:"guestnetworkid"`
+ Guestnetworkname string `json:"guestnetworkname"`
+ Hostid string `json:"hostid"`
+ Hostname string `json:"hostname"`
+ Hypervisor string `json:"hypervisor"`
+ Id string `json:"id"`
+ Ip6dns1 string `json:"ip6dns1"`
+ Ip6dns2 string `json:"ip6dns2"`
+ Isredundantrouter bool `json:"isredundantrouter"`
+ Linklocalip string `json:"linklocalip"`
+ Linklocalmacaddress string `json:"linklocalmacaddress"`
+ Linklocalnetmask string `json:"linklocalnetmask"`
+ Linklocalnetworkid string `json:"linklocalnetworkid"`
+ Name string `json:"name"`
+ Networkdomain string `json:"networkdomain"`
+ Nic []struct {
+ Broadcasturi string `json:"broadcasturi"`
+ Deviceid string `json:"deviceid"`
+ Gateway string `json:"gateway"`
+ Id string `json:"id"`
+ Ip6address string `json:"ip6address"`
+ Ip6cidr string `json:"ip6cidr"`
+ Ip6gateway string `json:"ip6gateway"`
+ Ipaddress string `json:"ipaddress"`
+ Isdefault bool `json:"isdefault"`
+ Isolationuri string `json:"isolationuri"`
+ Macaddress string `json:"macaddress"`
+ Netmask string `json:"netmask"`
+ Networkid string `json:"networkid"`
+ Networkname string `json:"networkname"`
+ Nsxlogicalswitch string `json:"nsxlogicalswitch"`
+ Nsxlogicalswitchport string `json:"nsxlogicalswitchport"`
+ Secondaryip []struct {
+ Id string `json:"id"`
+ Ipaddress string `json:"ipaddress"`
+ } `json:"secondaryip"`
+ Traffictype string `json:"traffictype"`
+ Type string `json:"type"`
+ Virtualmachineid string `json:"virtualmachineid"`
+ } `json:"nic"`
+ Podid string `json:"podid"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Publicip string `json:"publicip"`
+ Publicmacaddress string `json:"publicmacaddress"`
+ Publicnetmask string `json:"publicnetmask"`
+ Publicnetworkid string `json:"publicnetworkid"`
+ Redundantstate string `json:"redundantstate"`
+ Requiresupgrade bool `json:"requiresupgrade"`
+ Role string `json:"role"`
+ Scriptsversion string `json:"scriptsversion"`
+ Serviceofferingid string `json:"serviceofferingid"`
+ Serviceofferingname string `json:"serviceofferingname"`
+ State string `json:"state"`
+ Templateid string `json:"templateid"`
+ Version string `json:"version"`
+ Vpcid string `json:"vpcid"`
+ Vpcname string `json:"vpcname"`
+ Zoneid string `json:"zoneid"`
+ Zonename string `json:"zonename"`
+}
+
+type StartInternalLoadBalancerVMParams struct {
+ p map[string]interface{}
+}
+
+func (p *StartInternalLoadBalancerVMParams) 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 *StartInternalLoadBalancerVMParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+// You should always use this function to get a new StartInternalLoadBalancerVMParams instance,
+// as then you are sure you have configured all required params
+func (s *InternalLBService) NewStartInternalLoadBalancerVMParams(id string) *StartInternalLoadBalancerVMParams {
+ p := &StartInternalLoadBalancerVMParams{}
+ p.p = make(map[string]interface{})
+ p.p["id"] = id
+ return p
+}
+
+// Starts an existing internal lb vm.
+func (s *InternalLBService) StartInternalLoadBalancerVM(p *StartInternalLoadBalancerVMParams) (*StartInternalLoadBalancerVMResponse, error) {
+ resp, err := s.cs.newRequest("startInternalLoadBalancerVM", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r StartInternalLoadBalancerVMResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ // If we have a async client, we need to wait for the async result
+ if s.cs.async {
+ b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
+ if err != nil {
+ if err == AsyncTimeoutErr {
+ return &r, err
+ }
+ return nil, err
+ }
+
+ b, err = getRawValue(b)
+ if err != nil {
+ return nil, err
+ }
+
+ if err := json.Unmarshal(b, &r); err != nil {
+ return nil, err
+ }
+ }
+
+ return &r, nil
+}
+
+type StartInternalLoadBalancerVMResponse struct {
+ JobID string `json:"jobid"`
+ Account string `json:"account"`
+ Created string `json:"created"`
+ Dns1 string `json:"dns1"`
+ Dns2 string `json:"dns2"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Gateway string `json:"gateway"`
+ Guestipaddress string `json:"guestipaddress"`
+ Guestmacaddress string `json:"guestmacaddress"`
+ Guestnetmask string `json:"guestnetmask"`
+ Guestnetworkid string `json:"guestnetworkid"`
+ Guestnetworkname string `json:"guestnetworkname"`
+ Hostid string `json:"hostid"`
+ Hostname string `json:"hostname"`
+ Hypervisor string `json:"hypervisor"`
+ Id string `json:"id"`
+ Ip6dns1 string `json:"ip6dns1"`
+ Ip6dns2 string `json:"ip6dns2"`
+ Isredundantrouter bool `json:"isredundantrouter"`
+ Linklocalip string `json:"linklocalip"`
+ Linklocalmacaddress string `json:"linklocalmacaddress"`
+ Linklocalnetmask string `json:"linklocalnetmask"`
+ Linklocalnetworkid string `json:"linklocalnetworkid"`
+ Name string `json:"name"`
+ Networkdomain string `json:"networkdomain"`
+ Nic []struct {
+ Broadcasturi string `json:"broadcasturi"`
+ Deviceid string `json:"deviceid"`
+ Gateway string `json:"gateway"`
+ Id string `json:"id"`
+ Ip6address string `json:"ip6address"`
+ Ip6cidr string `json:"ip6cidr"`
+ Ip6gateway string `json:"ip6gateway"`
+ Ipaddress string `json:"ipaddress"`
+ Isdefault bool `json:"isdefault"`
+ Isolationuri string `json:"isolationuri"`
+ Macaddress string `json:"macaddress"`
+ Netmask string `json:"netmask"`
+ Networkid string `json:"networkid"`
+ Networkname string `json:"networkname"`
+ Nsxlogicalswitch string `json:"nsxlogicalswitch"`
+ Nsxlogicalswitchport string `json:"nsxlogicalswitchport"`
+ Secondaryip []struct {
+ Id string `json:"id"`
+ Ipaddress string `json:"ipaddress"`
+ } `json:"secondaryip"`
+ Traffictype string `json:"traffictype"`
+ Type string `json:"type"`
+ Virtualmachineid string `json:"virtualmachineid"`
+ } `json:"nic"`
+ Podid string `json:"podid"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Publicip string `json:"publicip"`
+ Publicmacaddress string `json:"publicmacaddress"`
+ Publicnetmask string `json:"publicnetmask"`
+ Publicnetworkid string `json:"publicnetworkid"`
+ Redundantstate string `json:"redundantstate"`
+ Requiresupgrade bool `json:"requiresupgrade"`
+ Role string `json:"role"`
+ Scriptsversion string `json:"scriptsversion"`
+ Serviceofferingid string `json:"serviceofferingid"`
+ Serviceofferingname string `json:"serviceofferingname"`
+ State string `json:"state"`
+ Templateid string `json:"templateid"`
+ Version string `json:"version"`
+ Vpcid string `json:"vpcid"`
+ Vpcname string `json:"vpcname"`
+ Zoneid string `json:"zoneid"`
+ Zonename string `json:"zonename"`
+}
+
+type StopInternalLoadBalancerVMParams struct {
+ p map[string]interface{}
+}
+
+func (p *StopInternalLoadBalancerVMParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["forced"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("forced", vv)
+ }
+ if v, found := p.p["id"]; found {
+ u.Set("id", v.(string))
+ }
+ return u
+}
+
+func (p *StopInternalLoadBalancerVMParams) SetForced(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["forced"] = v
+ return
+}
+
+func (p *StopInternalLoadBalancerVMParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+// You should always use this function to get a new StopInternalLoadBalancerVMParams instance,
+// as then you are sure you have configured all required params
+func (s *InternalLBService) NewStopInternalLoadBalancerVMParams(id string) *StopInternalLoadBalancerVMParams {
+ p := &StopInternalLoadBalancerVMParams{}
+ p.p = make(map[string]interface{})
+ p.p["id"] = id
+ return p
+}
+
+// Stops an Internal LB vm.
+func (s *InternalLBService) StopInternalLoadBalancerVM(p *StopInternalLoadBalancerVMParams) (*StopInternalLoadBalancerVMResponse, error) {
+ resp, err := s.cs.newRequest("stopInternalLoadBalancerVM", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r StopInternalLoadBalancerVMResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ // If we have a async client, we need to wait for the async result
+ if s.cs.async {
+ b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
+ if err != nil {
+ if err == AsyncTimeoutErr {
+ return &r, err
+ }
+ return nil, err
+ }
+
+ b, err = getRawValue(b)
+ if err != nil {
+ return nil, err
+ }
+
+ if err := json.Unmarshal(b, &r); err != nil {
+ return nil, err
+ }
+ }
+
+ return &r, nil
+}
+
+type StopInternalLoadBalancerVMResponse struct {
+ JobID string `json:"jobid"`
+ Account string `json:"account"`
+ Created string `json:"created"`
+ Dns1 string `json:"dns1"`
+ Dns2 string `json:"dns2"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Gateway string `json:"gateway"`
+ Guestipaddress string `json:"guestipaddress"`
+ Guestmacaddress string `json:"guestmacaddress"`
+ Guestnetmask string `json:"guestnetmask"`
+ Guestnetworkid string `json:"guestnetworkid"`
+ Guestnetworkname string `json:"guestnetworkname"`
+ Hostid string `json:"hostid"`
+ Hostname string `json:"hostname"`
+ Hypervisor string `json:"hypervisor"`
+ Id string `json:"id"`
+ Ip6dns1 string `json:"ip6dns1"`
+ Ip6dns2 string `json:"ip6dns2"`
+ Isredundantrouter bool `json:"isredundantrouter"`
+ Linklocalip string `json:"linklocalip"`
+ Linklocalmacaddress string `json:"linklocalmacaddress"`
+ Linklocalnetmask string `json:"linklocalnetmask"`
+ Linklocalnetworkid string `json:"linklocalnetworkid"`
+ Name string `json:"name"`
+ Networkdomain string `json:"networkdomain"`
+ Nic []struct {
+ Broadcasturi string `json:"broadcasturi"`
+ Deviceid string `json:"deviceid"`
+ Gateway string `json:"gateway"`
+ Id string `json:"id"`
+ Ip6address string `json:"ip6address"`
+ Ip6cidr string `json:"ip6cidr"`
+ Ip6gateway string `json:"ip6gateway"`
+ Ipaddress string `json:"ipaddress"`
+ Isdefault bool `json:"isdefault"`
+ Isolationuri string `json:"isolationuri"`
+ Macaddress string `json:"macaddress"`
+ Netmask string `json:"netmask"`
+ Networkid string `json:"networkid"`
+ Networkname string `json:"networkname"`
+ Nsxlogicalswitch string `json:"nsxlogicalswitch"`
+ Nsxlogicalswitchport string `json:"nsxlogicalswitchport"`
+ Secondaryip []struct {
+ Id string `json:"id"`
+ Ipaddress string `json:"ipaddress"`
+ } `json:"secondaryip"`
+ Traffictype string `json:"traffictype"`
+ Type string `json:"type"`
+ Virtualmachineid string `json:"virtualmachineid"`
+ } `json:"nic"`
+ Podid string `json:"podid"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Publicip string `json:"publicip"`
+ Publicmacaddress string `json:"publicmacaddress"`
+ Publicnetmask string `json:"publicnetmask"`
+ Publicnetworkid string `json:"publicnetworkid"`
+ Redundantstate string `json:"redundantstate"`
+ Requiresupgrade bool `json:"requiresupgrade"`
+ Role string `json:"role"`
+ Scriptsversion string `json:"scriptsversion"`
+ Serviceofferingid string `json:"serviceofferingid"`
+ Serviceofferingname string `json:"serviceofferingname"`
+ State string `json:"state"`
+ Templateid string `json:"templateid"`
+ Version string `json:"version"`
+ Vpcid string `json:"vpcid"`
+ Vpcname string `json:"vpcname"`
+ Zoneid string `json:"zoneid"`
+ Zonename string `json:"zonename"`
+}
diff --git a/cloudstack/LDAPService.go b/cloudstack/LDAPService.go
index f8b884f..1188d20 100644
--- a/cloudstack/LDAPService.go
+++ b/cloudstack/LDAPService.go
@@ -140,6 +140,168 @@
Port int `json:"port"`
}
+type ImportLdapUsersParams struct {
+ p map[string]interface{}
+}
+
+func (p *ImportLdapUsersParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["account"]; found {
+ u.Set("account", v.(string))
+ }
+ if v, found := p.p["accountdetails"]; found {
+ i := 0
+ for k, vv := range v.(map[string]string) {
+ u.Set(fmt.Sprintf("accountdetails[%d].key", i), k)
+ u.Set(fmt.Sprintf("accountdetails[%d].value", i), vv)
+ i++
+ }
+ }
+ if v, found := p.p["accounttype"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("accounttype", vv)
+ }
+ if v, found := p.p["domainid"]; found {
+ u.Set("domainid", v.(string))
+ }
+ if v, found := p.p["group"]; found {
+ u.Set("group", v.(string))
+ }
+ if v, found := p.p["keyword"]; found {
+ u.Set("keyword", v.(string))
+ }
+ if v, found := p.p["page"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("page", vv)
+ }
+ if v, found := p.p["pagesize"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("pagesize", vv)
+ }
+ if v, found := p.p["roleid"]; found {
+ u.Set("roleid", v.(string))
+ }
+ if v, found := p.p["timezone"]; found {
+ u.Set("timezone", v.(string))
+ }
+ return u
+}
+
+func (p *ImportLdapUsersParams) SetAccount(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["account"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetAccountdetails(v map[string]string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["accountdetails"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetAccounttype(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["accounttype"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetDomainid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["domainid"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetGroup(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["group"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetKeyword(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["keyword"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetPage(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["page"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetPagesize(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["pagesize"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetRoleid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["roleid"] = v
+ return
+}
+
+func (p *ImportLdapUsersParams) SetTimezone(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["timezone"] = v
+ return
+}
+
+// You should always use this function to get a new ImportLdapUsersParams instance,
+// as then you are sure you have configured all required params
+func (s *LDAPService) NewImportLdapUsersParams() *ImportLdapUsersParams {
+ p := &ImportLdapUsersParams{}
+ p.p = make(map[string]interface{})
+ return p
+}
+
+// Import LDAP users
+func (s *LDAPService) ImportLdapUsers(p *ImportLdapUsersParams) (*ImportLdapUsersResponse, error) {
+ resp, err := s.cs.newRequest("importLdapUsers", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r ImportLdapUsersResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type ImportLdapUsersResponse struct {
+ Domain string `json:"domain"`
+ Email string `json:"email"`
+ Firstname string `json:"firstname"`
+ Lastname string `json:"lastname"`
+ Principal string `json:"principal"`
+ Username string `json:"username"`
+}
+
type LdapConfigParams struct {
p map[string]interface{}
}
@@ -781,6 +943,101 @@
Port int `json:"port"`
}
+type ListLdapUsersParams struct {
+ p map[string]interface{}
+}
+
+func (p *ListLdapUsersParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["keyword"]; found {
+ u.Set("keyword", v.(string))
+ }
+ if v, found := p.p["listtype"]; found {
+ u.Set("listtype", v.(string))
+ }
+ if v, found := p.p["page"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("page", vv)
+ }
+ if v, found := p.p["pagesize"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("pagesize", vv)
+ }
+ return u
+}
+
+func (p *ListLdapUsersParams) SetKeyword(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["keyword"] = v
+ return
+}
+
+func (p *ListLdapUsersParams) SetListtype(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["listtype"] = v
+ return
+}
+
+func (p *ListLdapUsersParams) SetPage(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["page"] = v
+ return
+}
+
+func (p *ListLdapUsersParams) SetPagesize(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["pagesize"] = v
+ return
+}
+
+// You should always use this function to get a new ListLdapUsersParams instance,
+// as then you are sure you have configured all required params
+func (s *LDAPService) NewListLdapUsersParams() *ListLdapUsersParams {
+ p := &ListLdapUsersParams{}
+ p.p = make(map[string]interface{})
+ return p
+}
+
+// Lists all LDAP Users
+func (s *LDAPService) ListLdapUsers(p *ListLdapUsersParams) (*ListLdapUsersResponse, error) {
+ resp, err := s.cs.newRequest("listLdapUsers", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r ListLdapUsersResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type ListLdapUsersResponse struct {
+ Count int `json:"count"`
+ LdapUsers []*LdapUser `json:"ldapuser"`
+}
+
+type LdapUser struct {
+ Domain string `json:"domain"`
+ Email string `json:"email"`
+ Firstname string `json:"firstname"`
+ Lastname string `json:"lastname"`
+ Principal string `json:"principal"`
+ Username string `json:"username"`
+}
+
type SearchLdapParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/LICENSE b/cloudstack/LICENSE
deleted file mode 100644
index 5c304d1..0000000
--- a/cloudstack/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/cloudstack/LimitService.go b/cloudstack/LimitService.go
index e9db644..79deffe 100644
--- a/cloudstack/LimitService.go
+++ b/cloudstack/LimitService.go
@@ -22,6 +22,49 @@
"strconv"
)
+type GetApiLimitParams struct {
+ p map[string]interface{}
+}
+
+func (p *GetApiLimitParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ return u
+}
+
+// You should always use this function to get a new GetApiLimitParams instance,
+// as then you are sure you have configured all required params
+func (s *LimitService) NewGetApiLimitParams() *GetApiLimitParams {
+ p := &GetApiLimitParams{}
+ p.p = make(map[string]interface{})
+ return p
+}
+
+// Get API limit count for the caller
+func (s *LimitService) GetApiLimit(p *GetApiLimitParams) (*GetApiLimitResponse, error) {
+ resp, err := s.cs.newRequest("getApiLimit", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r GetApiLimitResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type GetApiLimitResponse struct {
+ Account string `json:"account"`
+ Accountid string `json:"accountid"`
+ ApiAllowed int `json:"apiAllowed"`
+ ApiIssued int `json:"apiIssued"`
+ ExpireAfter int64 `json:"expireAfter"`
+}
+
type ListResourceLimitsParams struct {
p map[string]interface{}
}
@@ -188,6 +231,60 @@
Resourcetype string `json:"resourcetype"`
}
+type ResetApiLimitParams struct {
+ p map[string]interface{}
+}
+
+func (p *ResetApiLimitParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["account"]; found {
+ u.Set("account", v.(string))
+ }
+ return u
+}
+
+func (p *ResetApiLimitParams) SetAccount(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["account"] = v
+ return
+}
+
+// You should always use this function to get a new ResetApiLimitParams instance,
+// as then you are sure you have configured all required params
+func (s *LimitService) NewResetApiLimitParams() *ResetApiLimitParams {
+ p := &ResetApiLimitParams{}
+ p.p = make(map[string]interface{})
+ return p
+}
+
+// Reset api count
+func (s *LimitService) ResetApiLimit(p *ResetApiLimitParams) (*ResetApiLimitResponse, error) {
+ resp, err := s.cs.newRequest("resetApiLimit", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r ResetApiLimitResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type ResetApiLimitResponse struct {
+ Account string `json:"account"`
+ Accountid string `json:"accountid"`
+ ApiAllowed int `json:"apiAllowed"`
+ ApiIssued int `json:"apiIssued"`
+ ExpireAfter int64 `json:"expireAfter"`
+}
+
type UpdateResourceCountParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/MetricsService.go b/cloudstack/MetricsService.go
deleted file mode 100644
index 9a1e155..0000000
--- a/cloudstack/MetricsService.go
+++ /dev/null
@@ -1,811 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package cloudstack
-
-import (
- "encoding/json"
- "fmt"
- "net/url"
- "strconv"
- "strings"
-)
-
-type ListInfrastructureParams struct {
- p map[string]interface{}
-}
-
-func (p *ListInfrastructureParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- return u
-}
-
-// You should always use this function to get a new ListInfrastructureParams instance,
-// as then you are sure you have configured all required params
-func (s *MetricsService) NewListInfrastructureParams() *ListInfrastructureParams {
- p := &ListInfrastructureParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Lists infrastructure
-func (s *MetricsService) ListInfrastructure(p *ListInfrastructureParams) (*ListInfrastructureResponse, error) {
- resp, err := s.cs.newRequest("listInfrastructure", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListInfrastructureResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListInfrastructureResponse struct {
- Count int `json:"count"`
- Infrastructure []*Infrastructure `json:"infrastructure"`
-}
-
-type Infrastructure struct {
- Clusters int `json:"clusters"`
- Cpusockets int `json:"cpusockets"`
- Hosts int `json:"hosts"`
- Imagestores int `json:"imagestores"`
- Pods int `json:"pods"`
- Routers int `json:"routers"`
- Storagepools int `json:"storagepools"`
- Systemvms int `json:"systemvms"`
- Zones int `json:"zones"`
-}
-
-type ListStoragePoolsMetricsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListStoragePoolsMetricsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["clusterid"]; found {
- u.Set("clusterid", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["ipaddress"]; found {
- u.Set("ipaddress", v.(string))
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["path"]; found {
- u.Set("path", v.(string))
- }
- if v, found := p.p["podid"]; found {
- u.Set("podid", v.(string))
- }
- if v, found := p.p["scope"]; found {
- u.Set("scope", v.(string))
- }
- if v, found := p.p["zoneid"]; found {
- u.Set("zoneid", v.(string))
- }
- return u
-}
-
-func (p *ListStoragePoolsMetricsParams) SetClusterid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["clusterid"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetIpaddress(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["ipaddress"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetPath(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["path"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetPodid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["podid"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetScope(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["scope"] = v
- return
-}
-
-func (p *ListStoragePoolsMetricsParams) SetZoneid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["zoneid"] = v
- return
-}
-
-// You should always use this function to get a new ListStoragePoolsMetricsParams instance,
-// as then you are sure you have configured all required params
-func (s *MetricsService) NewListStoragePoolsMetricsParams() *ListStoragePoolsMetricsParams {
- p := &ListStoragePoolsMetricsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *MetricsService) GetStoragePoolsMetricByID(id string, opts ...OptionFunc) (*StoragePoolsMetric, int, error) {
- p := &ListStoragePoolsMetricsParams{}
- 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.ListStoragePoolsMetrics(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.StoragePoolsMetrics[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for StoragePoolsMetric UUID: %s!", id)
-}
-
-// Lists storage pool metrics
-func (s *MetricsService) ListStoragePoolsMetrics(p *ListStoragePoolsMetricsParams) (*ListStoragePoolsMetricsResponse, error) {
- resp, err := s.cs.newRequest("listStoragePoolsMetrics", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListStoragePoolsMetricsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListStoragePoolsMetricsResponse struct {
- Count int `json:"count"`
- StoragePoolsMetrics []*StoragePoolsMetric `json:"storagepoolsmetric"`
-}
-
-type StoragePoolsMetric struct {
- Disksizeallocatedgb string `json:"disksizeallocatedgb"`
- Disksizetotalgb string `json:"disksizetotalgb"`
- Disksizeunallocatedgb string `json:"disksizeunallocatedgb"`
- Disksizeusedgb string `json:"disksizeusedgb"`
- Storageallocateddisablethreshold bool `json:"storageallocateddisablethreshold"`
- Storageallocatedthreshold bool `json:"storageallocatedthreshold"`
- Storageusagedisablethreshold bool `json:"storageusagedisablethreshold"`
- Storageusagethreshold bool `json:"storageusagethreshold"`
-}
-
-type ListVolumesMetricsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListVolumesMetricsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["diskofferingid"]; found {
- u.Set("diskofferingid", v.(string))
- }
- if v, found := p.p["displayvolume"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("displayvolume", vv)
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["hostid"]; found {
- u.Set("hostid", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["ids"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("ids", vv)
- }
- if v, found := p.p["isrecursive"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("isrecursive", vv)
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["listall"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("listall", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["podid"]; found {
- u.Set("podid", v.(string))
- }
- if v, found := p.p["podid"]; found {
- u.Set("podid", v.(string))
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["storageid"]; found {
- u.Set("storageid", v.(string))
- }
- if v, found := p.p["storageid"]; found {
- u.Set("storageid", v.(string))
- }
- if v, found := p.p["tags"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("tags[%d].key", i), k)
- u.Set(fmt.Sprintf("tags[%d].value", i), vv)
- i++
- }
- }
- if v, found := p.p["type"]; found {
- u.Set("type", v.(string))
- }
- if v, found := p.p["virtualmachineid"]; found {
- u.Set("virtualmachineid", v.(string))
- }
- if v, found := p.p["zoneid"]; found {
- u.Set("zoneid", v.(string))
- }
- return u
-}
-
-func (p *ListVolumesMetricsParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetDiskofferingid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["diskofferingid"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetDisplayvolume(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["displayvolume"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetHostid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["hostid"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetIds(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["ids"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetIsrecursive(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["isrecursive"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetListall(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["listall"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetPodid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["podid"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetStorageid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["storageid"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetTags(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["tags"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetType(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["type"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetVirtualmachineid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["virtualmachineid"] = v
- return
-}
-
-func (p *ListVolumesMetricsParams) SetZoneid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["zoneid"] = v
- return
-}
-
-// You should always use this function to get a new ListVolumesMetricsParams instance,
-// as then you are sure you have configured all required params
-func (s *MetricsService) NewListVolumesMetricsParams() *ListVolumesMetricsParams {
- p := &ListVolumesMetricsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *MetricsService) GetVolumesMetricByID(id string, opts ...OptionFunc) (*VolumesMetric, int, error) {
- p := &ListVolumesMetricsParams{}
- 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.ListVolumesMetrics(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.VolumesMetrics[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for VolumesMetric UUID: %s!", id)
-}
-
-// Lists volume metrics
-func (s *MetricsService) ListVolumesMetrics(p *ListVolumesMetricsParams) (*ListVolumesMetricsResponse, error) {
- resp, err := s.cs.newRequest("listVolumesMetrics", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListVolumesMetricsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListVolumesMetricsResponse struct {
- Count int `json:"count"`
- VolumesMetrics []*VolumesMetric `json:"volumesmetric"`
-}
-
-type VolumesMetric struct {
- Sizegb string `json:"sizegb"`
-}
-
-type ListZonesMetricsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListZonesMetricsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["available"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("available", vv)
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", 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))
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["networktype"]; found {
- u.Set("networktype", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["showcapacities"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("showcapacities", vv)
- }
- if v, found := p.p["tags"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("tags[%d].key", i), k)
- u.Set(fmt.Sprintf("tags[%d].value", i), vv)
- i++
- }
- }
- return u
-}
-
-func (p *ListZonesMetricsParams) SetAvailable(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["available"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetNetworktype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networktype"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetShowcapacities(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["showcapacities"] = v
- return
-}
-
-func (p *ListZonesMetricsParams) SetTags(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["tags"] = v
- return
-}
-
-// You should always use this function to get a new ListZonesMetricsParams instance,
-// as then you are sure you have configured all required params
-func (s *MetricsService) NewListZonesMetricsParams() *ListZonesMetricsParams {
- p := &ListZonesMetricsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *MetricsService) GetZonesMetricByID(id string, opts ...OptionFunc) (*ZonesMetric, int, error) {
- p := &ListZonesMetricsParams{}
- 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.ListZonesMetrics(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.ZonesMetrics[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for ZonesMetric UUID: %s!", id)
-}
-
-// Lists zone metrics
-func (s *MetricsService) ListZonesMetrics(p *ListZonesMetricsParams) (*ListZonesMetricsResponse, error) {
- resp, err := s.cs.newRequest("listZonesMetrics", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListZonesMetricsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListZonesMetricsResponse struct {
- Count int `json:"count"`
- ZonesMetrics []*ZonesMetric `json:"zonesmetric"`
-}
-
-type ZonesMetric struct {
- Clusters string `json:"clusters"`
- Cpuallocated string `json:"cpuallocated"`
- Cpuallocateddisablethreshold bool `json:"cpuallocateddisablethreshold"`
- Cpuallocatedthreshold bool `json:"cpuallocatedthreshold"`
- Cpudisablethreshold bool `json:"cpudisablethreshold"`
- Cpumaxdeviation string `json:"cpumaxdeviation"`
- Cputhreshold bool `json:"cputhreshold"`
- Cputotal string `json:"cputotal"`
- Cpuused string `json:"cpuused"`
- Memoryallocated string `json:"memoryallocated"`
- Memoryallocateddisablethreshold bool `json:"memoryallocateddisablethreshold"`
- Memoryallocatedthreshold bool `json:"memoryallocatedthreshold"`
- Memorydisablethreshold bool `json:"memorydisablethreshold"`
- Memorymaxdeviation string `json:"memorymaxdeviation"`
- Memorythreshold bool `json:"memorythreshold"`
- Memorytotal string `json:"memorytotal"`
- Memoryused string `json:"memoryused"`
- State string `json:"state"`
-}
diff --git a/cloudstack/MiscService.go b/cloudstack/MiscService.go
deleted file mode 100644
index 51cc92b..0000000
--- a/cloudstack/MiscService.go
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package cloudstack
-
-import (
- "encoding/json"
- "net/url"
-)
-
-type ListElastistorInterfaceParams struct {
- p map[string]interface{}
-}
-
-func (p *ListElastistorInterfaceParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["controllerid"]; found {
- u.Set("controllerid", v.(string))
- }
- return u
-}
-
-func (p *ListElastistorInterfaceParams) SetControllerid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["controllerid"] = v
- return
-}
-
-// You should always use this function to get a new ListElastistorInterfaceParams instance,
-// as then you are sure you have configured all required params
-func (s *MiscService) NewListElastistorInterfaceParams() *ListElastistorInterfaceParams {
- p := &ListElastistorInterfaceParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Lists the network Interfaces of elastistor
-func (s *MiscService) ListElastistorInterface(p *ListElastistorInterfaceParams) (*ListElastistorInterfaceResponse, error) {
- resp, err := s.cs.newRequest("listElastistorInterface", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListElastistorInterfaceResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListElastistorInterfaceResponse struct {
- Count int `json:"count"`
- ElastistorInterface []*ElastistorInterface `json:"elastistorinterface"`
-}
-
-type ElastistorInterface struct {
- Compression string `json:"compression"`
- Deduplication string `json:"deduplication"`
- Graceallowed string `json:"graceallowed"`
- Id string `json:"id"`
- Name string `json:"name"`
- Sync string `json:"sync"`
-}
diff --git a/cloudstack/NetworkACLService.go b/cloudstack/NetworkACLService.go
index d6c52cb..e050b80 100644
--- a/cloudstack/NetworkACLService.go
+++ b/cloudstack/NetworkACLService.go
@@ -1,5 +1,5 @@
//
-// Copyright 2017, Sander van Harmelen
+// Copyright 2018, Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -248,94 +248,40 @@
Traffictype string `json:"traffictype"`
}
-type UpdateNetworkACLItemParams struct {
+type CreateNetworkACLListParams struct {
p map[string]interface{}
}
-func (p *UpdateNetworkACLItemParams) toURLValues() url.Values {
+func (p *CreateNetworkACLListParams) toURLValues() url.Values {
u := url.Values{}
if p.p == nil {
return u
}
- if v, found := p.p["action"]; found {
- u.Set("action", v.(string))
- }
- if v, found := p.p["cidrlist"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("cidrlist", vv)
- }
- if v, found := p.p["customid"]; found {
- u.Set("customid", v.(string))
- }
- if v, found := p.p["endport"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("endport", vv)
+ if v, found := p.p["description"]; found {
+ u.Set("description", v.(string))
}
if v, found := p.p["fordisplay"]; found {
vv := strconv.FormatBool(v.(bool))
u.Set("fordisplay", vv)
}
- if v, found := p.p["icmpcode"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("icmpcode", vv)
+ if v, found := p.p["name"]; found {
+ u.Set("name", v.(string))
}
- if v, found := p.p["icmptype"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("icmptype", vv)
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["number"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("number", vv)
- }
- if v, found := p.p["protocol"]; found {
- u.Set("protocol", v.(string))
- }
- if v, found := p.p["startport"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("startport", vv)
- }
- if v, found := p.p["traffictype"]; found {
- u.Set("traffictype", v.(string))
+ if v, found := p.p["vpcid"]; found {
+ u.Set("vpcid", v.(string))
}
return u
}
-func (p *UpdateNetworkACLItemParams) SetAction(v string) {
+func (p *CreateNetworkACLListParams) SetDescription(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["action"] = v
+ p.p["description"] = v
return
}
-func (p *UpdateNetworkACLItemParams) SetCidrlist(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["cidrlist"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetCustomid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["customid"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetEndport(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["endport"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetFordisplay(v bool) {
+func (p *CreateNetworkACLListParams) SetFordisplay(v bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
@@ -343,79 +289,40 @@
return
}
-func (p *UpdateNetworkACLItemParams) SetIcmpcode(v int) {
+func (p *CreateNetworkACLListParams) SetName(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["icmpcode"] = v
+ p.p["name"] = v
return
}
-func (p *UpdateNetworkACLItemParams) SetIcmptype(v int) {
+func (p *CreateNetworkACLListParams) SetVpcid(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["icmptype"] = v
+ p.p["vpcid"] = v
return
}
-func (p *UpdateNetworkACLItemParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetNumber(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["number"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetProtocol(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["protocol"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetStartport(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["startport"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetTraffictype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["traffictype"] = v
- return
-}
-
-// You should always use this function to get a new UpdateNetworkACLItemParams instance,
+// You should always use this function to get a new CreateNetworkACLListParams instance,
// as then you are sure you have configured all required params
-func (s *NetworkACLService) NewUpdateNetworkACLItemParams(id string) *UpdateNetworkACLItemParams {
- p := &UpdateNetworkACLItemParams{}
+func (s *NetworkACLService) NewCreateNetworkACLListParams(name string, vpcid string) *CreateNetworkACLListParams {
+ p := &CreateNetworkACLListParams{}
p.p = make(map[string]interface{})
- p.p["id"] = id
+ p.p["name"] = name
+ p.p["vpcid"] = vpcid
return p
}
-// Updates ACL item with specified ID
-func (s *NetworkACLService) UpdateNetworkACLItem(p *UpdateNetworkACLItemParams) (*UpdateNetworkACLItemResponse, error) {
- resp, err := s.cs.newRequest("updateNetworkACLItem", p.toURLValues())
+// Creates a network ACL for the given VPC
+func (s *NetworkACLService) CreateNetworkACLList(p *CreateNetworkACLListParams) (*CreateNetworkACLListResponse, error) {
+ resp, err := s.cs.newRequest("createNetworkACLList", p.toURLValues())
if err != nil {
return nil, err
}
- var r UpdateNetworkACLItemResponse
+ var r CreateNetworkACLListResponse
if err := json.Unmarshal(resp, &r); err != nil {
return nil, err
}
@@ -443,33 +350,13 @@
return &r, nil
}
-type UpdateNetworkACLItemResponse struct {
- JobID string `json:"jobid"`
- Aclid string `json:"aclid"`
- Action string `json:"action"`
- Cidrlist string `json:"cidrlist"`
- Endport string `json:"endport"`
- Fordisplay bool `json:"fordisplay"`
- Icmpcode int `json:"icmpcode"`
- Icmptype int `json:"icmptype"`
- Id string `json:"id"`
- Number int `json:"number"`
- Protocol string `json:"protocol"`
- Startport string `json:"startport"`
- State string `json:"state"`
- Tags []struct {
- Account string `json:"account"`
- Customer string `json:"customer"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Key string `json:"key"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Resourceid string `json:"resourceid"`
- Resourcetype string `json:"resourcetype"`
- Value string `json:"value"`
- } `json:"tags"`
- Traffictype string `json:"traffictype"`
+type CreateNetworkACLListResponse struct {
+ JobID string `json:"jobid"`
+ Description string `json:"description"`
+ Fordisplay bool `json:"fordisplay"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Vpcid string `json:"vpcid"`
}
type DeleteNetworkACLParams struct {
@@ -540,6 +427,353 @@
Success bool `json:"success"`
}
+type DeleteNetworkACLListParams struct {
+ p map[string]interface{}
+}
+
+func (p *DeleteNetworkACLListParams) 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 *DeleteNetworkACLListParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+// You should always use this function to get a new DeleteNetworkACLListParams instance,
+// as then you are sure you have configured all required params
+func (s *NetworkACLService) NewDeleteNetworkACLListParams(id string) *DeleteNetworkACLListParams {
+ p := &DeleteNetworkACLListParams{}
+ p.p = make(map[string]interface{})
+ p.p["id"] = id
+ return p
+}
+
+// Deletes a network ACL
+func (s *NetworkACLService) DeleteNetworkACLList(p *DeleteNetworkACLListParams) (*DeleteNetworkACLListResponse, error) {
+ resp, err := s.cs.newRequest("deleteNetworkACLList", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r DeleteNetworkACLListResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ // If we have a async client, we need to wait for the async result
+ if s.cs.async {
+ b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
+ if err != nil {
+ if err == AsyncTimeoutErr {
+ return &r, err
+ }
+ return nil, err
+ }
+
+ if err := json.Unmarshal(b, &r); err != nil {
+ return nil, err
+ }
+ }
+
+ return &r, nil
+}
+
+type DeleteNetworkACLListResponse struct {
+ JobID string `json:"jobid"`
+ Displaytext string `json:"displaytext"`
+ Success bool `json:"success"`
+}
+
+type ListNetworkACLListsParams struct {
+ p map[string]interface{}
+}
+
+func (p *ListNetworkACLListsParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["account"]; found {
+ u.Set("account", v.(string))
+ }
+ if v, found := p.p["domainid"]; found {
+ u.Set("domainid", v.(string))
+ }
+ if v, found := p.p["fordisplay"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("fordisplay", vv)
+ }
+ if v, found := p.p["id"]; found {
+ u.Set("id", v.(string))
+ }
+ if v, found := p.p["isrecursive"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("isrecursive", vv)
+ }
+ if v, found := p.p["keyword"]; found {
+ u.Set("keyword", v.(string))
+ }
+ if v, found := p.p["listall"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("listall", vv)
+ }
+ if v, found := p.p["name"]; found {
+ u.Set("name", v.(string))
+ }
+ if v, found := p.p["networkid"]; found {
+ u.Set("networkid", v.(string))
+ }
+ if v, found := p.p["page"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("page", vv)
+ }
+ if v, found := p.p["pagesize"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("pagesize", vv)
+ }
+ if v, found := p.p["projectid"]; found {
+ u.Set("projectid", v.(string))
+ }
+ if v, found := p.p["vpcid"]; found {
+ u.Set("vpcid", v.(string))
+ }
+ return u
+}
+
+func (p *ListNetworkACLListsParams) SetAccount(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["account"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetDomainid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["domainid"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetFordisplay(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["fordisplay"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetIsrecursive(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["isrecursive"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetKeyword(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["keyword"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetListall(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["listall"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetName(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["name"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetNetworkid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["networkid"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetPage(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["page"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetPagesize(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["pagesize"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetProjectid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["projectid"] = v
+ return
+}
+
+func (p *ListNetworkACLListsParams) SetVpcid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["vpcid"] = v
+ return
+}
+
+// You should always use this function to get a new ListNetworkACLListsParams instance,
+// as then you are sure you have configured all required params
+func (s *NetworkACLService) NewListNetworkACLListsParams() *ListNetworkACLListsParams {
+ p := &ListNetworkACLListsParams{}
+ p.p = make(map[string]interface{})
+ return p
+}
+
+// This is a courtesy helper function, which in some cases may not work as expected!
+func (s *NetworkACLService) GetNetworkACLListID(name string, opts ...OptionFunc) (string, int, error) {
+ p := &ListNetworkACLListsParams{}
+ p.p = make(map[string]interface{})
+
+ p.p["name"] = name
+
+ for _, fn := range append(s.cs.options, opts...) {
+ if err := fn(s.cs, p); err != nil {
+ return "", -1, err
+ }
+ }
+
+ l, err := s.ListNetworkACLLists(p)
+ if err != nil {
+ return "", -1, err
+ }
+
+ if l.Count == 0 {
+ return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
+ }
+
+ if l.Count == 1 {
+ return l.NetworkACLLists[0].Id, l.Count, nil
+ }
+
+ if l.Count > 1 {
+ for _, v := range l.NetworkACLLists {
+ if v.Name == name {
+ return v.Id, l.Count, nil
+ }
+ }
+ }
+ return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
+}
+
+// This is a courtesy helper function, which in some cases may not work as expected!
+func (s *NetworkACLService) GetNetworkACLListByName(name string, opts ...OptionFunc) (*NetworkACLList, int, error) {
+ id, count, err := s.GetNetworkACLListID(name, opts...)
+ if err != nil {
+ return nil, count, err
+ }
+
+ r, count, err := s.GetNetworkACLListByID(id, opts...)
+ if err != nil {
+ return nil, count, err
+ }
+ return r, count, nil
+}
+
+// This is a courtesy helper function, which in some cases may not work as expected!
+func (s *NetworkACLService) GetNetworkACLListByID(id string, opts ...OptionFunc) (*NetworkACLList, int, error) {
+ p := &ListNetworkACLListsParams{}
+ 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.ListNetworkACLLists(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.NetworkACLLists[0], l.Count, nil
+ }
+ return nil, l.Count, fmt.Errorf("There is more then one result for NetworkACLList UUID: %s!", id)
+}
+
+// Lists all network ACLs
+func (s *NetworkACLService) ListNetworkACLLists(p *ListNetworkACLListsParams) (*ListNetworkACLListsResponse, error) {
+ resp, err := s.cs.newRequest("listNetworkACLLists", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r ListNetworkACLListsResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type ListNetworkACLListsResponse struct {
+ Count int `json:"count"`
+ NetworkACLLists []*NetworkACLList `json:"networkacllist"`
+}
+
+type NetworkACLList struct {
+ Description string `json:"description"`
+ Fordisplay bool `json:"fordisplay"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Vpcid string `json:"vpcid"`
+}
+
type ListNetworkACLsParams struct {
p map[string]interface{}
}
@@ -827,185 +1061,6 @@
Traffictype string `json:"traffictype"`
}
-type CreateNetworkACLListParams struct {
- p map[string]interface{}
-}
-
-func (p *CreateNetworkACLListParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["description"]; found {
- u.Set("description", v.(string))
- }
- if v, found := p.p["fordisplay"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("fordisplay", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["vpcid"]; found {
- u.Set("vpcid", v.(string))
- }
- return u
-}
-
-func (p *CreateNetworkACLListParams) SetDescription(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["description"] = v
- return
-}
-
-func (p *CreateNetworkACLListParams) SetFordisplay(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["fordisplay"] = v
- return
-}
-
-func (p *CreateNetworkACLListParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *CreateNetworkACLListParams) SetVpcid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["vpcid"] = v
- return
-}
-
-// You should always use this function to get a new CreateNetworkACLListParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkACLService) NewCreateNetworkACLListParams(name string, vpcid string) *CreateNetworkACLListParams {
- p := &CreateNetworkACLListParams{}
- p.p = make(map[string]interface{})
- p.p["name"] = name
- p.p["vpcid"] = vpcid
- return p
-}
-
-// Creates a network ACL for the given VPC
-func (s *NetworkACLService) CreateNetworkACLList(p *CreateNetworkACLListParams) (*CreateNetworkACLListResponse, error) {
- resp, err := s.cs.newRequest("createNetworkACLList", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r CreateNetworkACLListResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type CreateNetworkACLListResponse struct {
- JobID string `json:"jobid"`
- Description string `json:"description"`
- Fordisplay bool `json:"fordisplay"`
- Id string `json:"id"`
- Name string `json:"name"`
- Vpcid string `json:"vpcid"`
-}
-
-type DeleteNetworkACLListParams struct {
- p map[string]interface{}
-}
-
-func (p *DeleteNetworkACLListParams) 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 *DeleteNetworkACLListParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new DeleteNetworkACLListParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkACLService) NewDeleteNetworkACLListParams(id string) *DeleteNetworkACLListParams {
- p := &DeleteNetworkACLListParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Deletes a network ACL
-func (s *NetworkACLService) DeleteNetworkACLList(p *DeleteNetworkACLListParams) (*DeleteNetworkACLListResponse, error) {
- resp, err := s.cs.newRequest("deleteNetworkACLList", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r DeleteNetworkACLListResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type DeleteNetworkACLListResponse struct {
- JobID string `json:"jobid"`
- Displaytext string `json:"displaytext"`
- Success bool `json:"success"`
-}
-
type ReplaceNetworkACLListParams struct {
p map[string]interface{}
}
@@ -1096,79 +1151,94 @@
Success bool `json:"success"`
}
-type ListNetworkACLListsParams struct {
+type UpdateNetworkACLItemParams struct {
p map[string]interface{}
}
-func (p *ListNetworkACLListsParams) toURLValues() url.Values {
+func (p *UpdateNetworkACLItemParams) toURLValues() url.Values {
u := url.Values{}
if p.p == nil {
return u
}
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
+ if v, found := p.p["action"]; found {
+ u.Set("action", v.(string))
}
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
+ if v, found := p.p["cidrlist"]; found {
+ vv := strings.Join(v.([]string), ",")
+ u.Set("cidrlist", vv)
+ }
+ if v, found := p.p["customid"]; found {
+ u.Set("customid", v.(string))
+ }
+ if v, found := p.p["endport"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("endport", vv)
}
if v, found := p.p["fordisplay"]; found {
vv := strconv.FormatBool(v.(bool))
u.Set("fordisplay", vv)
}
+ if v, found := p.p["icmpcode"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("icmpcode", vv)
+ }
+ if v, found := p.p["icmptype"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("icmptype", vv)
+ }
if v, found := p.p["id"]; found {
u.Set("id", v.(string))
}
- if v, found := p.p["isrecursive"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("isrecursive", vv)
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["listall"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("listall", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["networkid"]; found {
- u.Set("networkid", v.(string))
- }
- if v, found := p.p["page"]; found {
+ if v, found := p.p["number"]; found {
vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
+ u.Set("number", vv)
}
- if v, found := p.p["pagesize"]; found {
+ if v, found := p.p["protocol"]; found {
+ u.Set("protocol", v.(string))
+ }
+ if v, found := p.p["startport"]; found {
vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
+ u.Set("startport", vv)
}
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["vpcid"]; found {
- u.Set("vpcid", v.(string))
+ if v, found := p.p["traffictype"]; found {
+ u.Set("traffictype", v.(string))
}
return u
}
-func (p *ListNetworkACLListsParams) SetAccount(v string) {
+func (p *UpdateNetworkACLItemParams) SetAction(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["account"] = v
+ p.p["action"] = v
return
}
-func (p *ListNetworkACLListsParams) SetDomainid(v string) {
+func (p *UpdateNetworkACLItemParams) SetCidrlist(v []string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["domainid"] = v
+ p.p["cidrlist"] = v
return
}
-func (p *ListNetworkACLListsParams) SetFordisplay(v bool) {
+func (p *UpdateNetworkACLItemParams) SetCustomid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["customid"] = v
+ return
+}
+
+func (p *UpdateNetworkACLItemParams) SetEndport(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["endport"] = v
+ return
+}
+
+func (p *UpdateNetworkACLItemParams) SetFordisplay(v bool) {
if p.p == nil {
p.p = make(map[string]interface{})
}
@@ -1176,7 +1246,23 @@
return
}
-func (p *ListNetworkACLListsParams) SetId(v string) {
+func (p *UpdateNetworkACLItemParams) SetIcmpcode(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["icmpcode"] = v
+ return
+}
+
+func (p *UpdateNetworkACLItemParams) SetIcmptype(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["icmptype"] = v
+ return
+}
+
+func (p *UpdateNetworkACLItemParams) SetId(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
@@ -1184,195 +1270,109 @@
return
}
-func (p *ListNetworkACLListsParams) SetIsrecursive(v bool) {
+func (p *UpdateNetworkACLItemParams) SetNumber(v int) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["isrecursive"] = v
+ p.p["number"] = v
return
}
-func (p *ListNetworkACLListsParams) SetKeyword(v string) {
+func (p *UpdateNetworkACLItemParams) SetProtocol(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["keyword"] = v
+ p.p["protocol"] = v
return
}
-func (p *ListNetworkACLListsParams) SetListall(v bool) {
+func (p *UpdateNetworkACLItemParams) SetStartport(v int) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["listall"] = v
+ p.p["startport"] = v
return
}
-func (p *ListNetworkACLListsParams) SetName(v string) {
+func (p *UpdateNetworkACLItemParams) SetTraffictype(v string) {
if p.p == nil {
p.p = make(map[string]interface{})
}
- p.p["name"] = v
+ p.p["traffictype"] = v
return
}
-func (p *ListNetworkACLListsParams) SetNetworkid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkid"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetVpcid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["vpcid"] = v
- return
-}
-
-// You should always use this function to get a new ListNetworkACLListsParams instance,
+// You should always use this function to get a new UpdateNetworkACLItemParams instance,
// as then you are sure you have configured all required params
-func (s *NetworkACLService) NewListNetworkACLListsParams() *ListNetworkACLListsParams {
- p := &ListNetworkACLListsParams{}
+func (s *NetworkACLService) NewUpdateNetworkACLItemParams(id string) *UpdateNetworkACLItemParams {
+ p := &UpdateNetworkACLItemParams{}
p.p = make(map[string]interface{})
+ p.p["id"] = id
return p
}
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkACLService) GetNetworkACLListID(name string, opts ...OptionFunc) (string, int, error) {
- p := &ListNetworkACLListsParams{}
- p.p = make(map[string]interface{})
-
- p.p["name"] = name
-
- for _, fn := range append(s.cs.options, opts...) {
- if err := fn(s.cs, p); err != nil {
- return "", -1, err
- }
- }
-
- l, err := s.ListNetworkACLLists(p)
- if err != nil {
- return "", -1, err
- }
-
- if l.Count == 0 {
- return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
- }
-
- if l.Count == 1 {
- return l.NetworkACLLists[0].Id, l.Count, nil
- }
-
- if l.Count > 1 {
- for _, v := range l.NetworkACLLists {
- if v.Name == name {
- return v.Id, l.Count, nil
- }
- }
- }
- return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkACLService) GetNetworkACLListByName(name string, opts ...OptionFunc) (*NetworkACLList, int, error) {
- id, count, err := s.GetNetworkACLListID(name, opts...)
- if err != nil {
- return nil, count, err
- }
-
- r, count, err := s.GetNetworkACLListByID(id, opts...)
- if err != nil {
- return nil, count, err
- }
- return r, count, nil
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkACLService) GetNetworkACLListByID(id string, opts ...OptionFunc) (*NetworkACLList, int, error) {
- p := &ListNetworkACLListsParams{}
- 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.ListNetworkACLLists(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.NetworkACLLists[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for NetworkACLList UUID: %s!", id)
-}
-
-// Lists all network ACLs
-func (s *NetworkACLService) ListNetworkACLLists(p *ListNetworkACLListsParams) (*ListNetworkACLListsResponse, error) {
- resp, err := s.cs.newRequest("listNetworkACLLists", p.toURLValues())
+// Updates ACL item with specified ID
+func (s *NetworkACLService) UpdateNetworkACLItem(p *UpdateNetworkACLItemParams) (*UpdateNetworkACLItemResponse, error) {
+ resp, err := s.cs.newRequest("updateNetworkACLItem", p.toURLValues())
if err != nil {
return nil, err
}
- var r ListNetworkACLListsResponse
+ var r UpdateNetworkACLItemResponse
if err := json.Unmarshal(resp, &r); err != nil {
return nil, err
}
+ // If we have a async client, we need to wait for the async result
+ if s.cs.async {
+ b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
+ if err != nil {
+ if err == AsyncTimeoutErr {
+ return &r, err
+ }
+ return nil, err
+ }
+
+ b, err = getRawValue(b)
+ if err != nil {
+ return nil, err
+ }
+
+ if err := json.Unmarshal(b, &r); err != nil {
+ return nil, err
+ }
+ }
+
return &r, nil
}
-type ListNetworkACLListsResponse struct {
- Count int `json:"count"`
- NetworkACLLists []*NetworkACLList `json:"networkacllist"`
-}
-
-type NetworkACLList struct {
- Description string `json:"description"`
- Fordisplay bool `json:"fordisplay"`
- Id string `json:"id"`
- Name string `json:"name"`
- Vpcid string `json:"vpcid"`
+type UpdateNetworkACLItemResponse struct {
+ JobID string `json:"jobid"`
+ Aclid string `json:"aclid"`
+ Action string `json:"action"`
+ Cidrlist string `json:"cidrlist"`
+ Endport string `json:"endport"`
+ Fordisplay bool `json:"fordisplay"`
+ Icmpcode int `json:"icmpcode"`
+ Icmptype int `json:"icmptype"`
+ Id string `json:"id"`
+ Number int `json:"number"`
+ Protocol string `json:"protocol"`
+ Startport string `json:"startport"`
+ State string `json:"state"`
+ Tags []struct {
+ Account string `json:"account"`
+ Customer string `json:"customer"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Key string `json:"key"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Resourceid string `json:"resourceid"`
+ Resourcetype string `json:"resourcetype"`
+ Value string `json:"value"`
+ } `json:"tags"`
+ Traffictype string `json:"traffictype"`
}
type UpdateNetworkACLListParams struct {
diff --git a/cloudstack/NetworkDeviceService.go b/cloudstack/NetworkDeviceService.go
index 288dcec..6f44b98 100644
--- a/cloudstack/NetworkDeviceService.go
+++ b/cloudstack/NetworkDeviceService.go
@@ -1,5 +1,5 @@
//
-// Copyright 2017, Sander van Harmelen
+// Copyright 2018, Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -89,6 +89,58 @@
Id string `json:"id"`
}
+type DeleteNetworkDeviceParams struct {
+ p map[string]interface{}
+}
+
+func (p *DeleteNetworkDeviceParams) 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 *DeleteNetworkDeviceParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+// You should always use this function to get a new DeleteNetworkDeviceParams instance,
+// as then you are sure you have configured all required params
+func (s *NetworkDeviceService) NewDeleteNetworkDeviceParams(id string) *DeleteNetworkDeviceParams {
+ p := &DeleteNetworkDeviceParams{}
+ p.p = make(map[string]interface{})
+ p.p["id"] = id
+ return p
+}
+
+// Deletes network device.
+func (s *NetworkDeviceService) DeleteNetworkDevice(p *DeleteNetworkDeviceParams) (*DeleteNetworkDeviceResponse, error) {
+ resp, err := s.cs.newRequest("deleteNetworkDevice", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r DeleteNetworkDeviceResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type DeleteNetworkDeviceResponse struct {
+ Displaytext string `json:"displaytext"`
+ Success string `json:"success"`
+}
+
type ListNetworkDeviceParams struct {
p map[string]interface{}
}
@@ -194,55 +246,3 @@
type NetworkDevice struct {
Id string `json:"id"`
}
-
-type DeleteNetworkDeviceParams struct {
- p map[string]interface{}
-}
-
-func (p *DeleteNetworkDeviceParams) 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 *DeleteNetworkDeviceParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new DeleteNetworkDeviceParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkDeviceService) NewDeleteNetworkDeviceParams(id string) *DeleteNetworkDeviceParams {
- p := &DeleteNetworkDeviceParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Deletes network device.
-func (s *NetworkDeviceService) DeleteNetworkDevice(p *DeleteNetworkDeviceParams) (*DeleteNetworkDeviceResponse, error) {
- resp, err := s.cs.newRequest("deleteNetworkDevice", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r DeleteNetworkDeviceResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type DeleteNetworkDeviceResponse struct {
- Displaytext string `json:"displaytext"`
- Success string `json:"success"`
-}
diff --git a/cloudstack/NetworkOfferingService.go b/cloudstack/NetworkOfferingService.go
index e78c75f..59b6663 100644
--- a/cloudstack/NetworkOfferingService.go
+++ b/cloudstack/NetworkOfferingService.go
@@ -1,5 +1,5 @@
//
-// Copyright 2017, Sander van Harmelen
+// Copyright 2018, Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -341,173 +341,6 @@
Traffictype string `json:"traffictype"`
}
-type UpdateNetworkOfferingParams struct {
- p map[string]interface{}
-}
-
-func (p *UpdateNetworkOfferingParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["availability"]; found {
- u.Set("availability", v.(string))
- }
- if v, found := p.p["displaytext"]; found {
- u.Set("displaytext", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["keepaliveenabled"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("keepaliveenabled", vv)
- }
- if v, found := p.p["maxconnections"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("maxconnections", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["sortkey"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("sortkey", vv)
- }
- if v, found := p.p["state"]; found {
- u.Set("state", v.(string))
- }
- return u
-}
-
-func (p *UpdateNetworkOfferingParams) SetAvailability(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["availability"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetDisplaytext(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["displaytext"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetKeepaliveenabled(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keepaliveenabled"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetMaxconnections(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["maxconnections"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetSortkey(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["sortkey"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetState(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["state"] = v
- return
-}
-
-// You should always use this function to get a new UpdateNetworkOfferingParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkOfferingService) NewUpdateNetworkOfferingParams() *UpdateNetworkOfferingParams {
- p := &UpdateNetworkOfferingParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Updates a network offering.
-func (s *NetworkOfferingService) UpdateNetworkOffering(p *UpdateNetworkOfferingParams) (*UpdateNetworkOfferingResponse, error) {
- resp, err := s.cs.newRequest("updateNetworkOffering", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r UpdateNetworkOfferingResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type UpdateNetworkOfferingResponse struct {
- Availability string `json:"availability"`
- Conservemode bool `json:"conservemode"`
- Created string `json:"created"`
- Details map[string]string `json:"details"`
- Displaytext string `json:"displaytext"`
- Egressdefaultpolicy bool `json:"egressdefaultpolicy"`
- Forvpc bool `json:"forvpc"`
- Guestiptype string `json:"guestiptype"`
- Id string `json:"id"`
- Isdefault bool `json:"isdefault"`
- Ispersistent bool `json:"ispersistent"`
- Maxconnections int `json:"maxconnections"`
- Name string `json:"name"`
- Networkrate int `json:"networkrate"`
- Service []struct {
- Capability []struct {
- Canchooseservicecapability bool `json:"canchooseservicecapability"`
- Name string `json:"name"`
- Value string `json:"value"`
- } `json:"capability"`
- Name string `json:"name"`
- Provider []struct {
- Canenableindividualservice bool `json:"canenableindividualservice"`
- Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"`
- Id string `json:"id"`
- Name string `json:"name"`
- Physicalnetworkid string `json:"physicalnetworkid"`
- Servicelist []string `json:"servicelist"`
- State string `json:"state"`
- } `json:"provider"`
- } `json:"service"`
- Serviceofferingid string `json:"serviceofferingid"`
- Specifyipranges bool `json:"specifyipranges"`
- Specifyvlan bool `json:"specifyvlan"`
- State string `json:"state"`
- Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"`
- Tags string `json:"tags"`
- Traffictype string `json:"traffictype"`
-}
-
type DeleteNetworkOfferingParams struct {
p map[string]interface{}
}
@@ -952,3 +785,170 @@
Tags string `json:"tags"`
Traffictype string `json:"traffictype"`
}
+
+type UpdateNetworkOfferingParams struct {
+ p map[string]interface{}
+}
+
+func (p *UpdateNetworkOfferingParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["availability"]; found {
+ u.Set("availability", v.(string))
+ }
+ if v, found := p.p["displaytext"]; found {
+ u.Set("displaytext", v.(string))
+ }
+ if v, found := p.p["id"]; found {
+ u.Set("id", v.(string))
+ }
+ if v, found := p.p["keepaliveenabled"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("keepaliveenabled", vv)
+ }
+ if v, found := p.p["maxconnections"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("maxconnections", vv)
+ }
+ if v, found := p.p["name"]; found {
+ u.Set("name", v.(string))
+ }
+ if v, found := p.p["sortkey"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("sortkey", vv)
+ }
+ if v, found := p.p["state"]; found {
+ u.Set("state", v.(string))
+ }
+ return u
+}
+
+func (p *UpdateNetworkOfferingParams) SetAvailability(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["availability"] = v
+ return
+}
+
+func (p *UpdateNetworkOfferingParams) SetDisplaytext(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["displaytext"] = v
+ return
+}
+
+func (p *UpdateNetworkOfferingParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+func (p *UpdateNetworkOfferingParams) SetKeepaliveenabled(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["keepaliveenabled"] = v
+ return
+}
+
+func (p *UpdateNetworkOfferingParams) SetMaxconnections(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["maxconnections"] = v
+ return
+}
+
+func (p *UpdateNetworkOfferingParams) SetName(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["name"] = v
+ return
+}
+
+func (p *UpdateNetworkOfferingParams) SetSortkey(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["sortkey"] = v
+ return
+}
+
+func (p *UpdateNetworkOfferingParams) SetState(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["state"] = v
+ return
+}
+
+// You should always use this function to get a new UpdateNetworkOfferingParams instance,
+// as then you are sure you have configured all required params
+func (s *NetworkOfferingService) NewUpdateNetworkOfferingParams() *UpdateNetworkOfferingParams {
+ p := &UpdateNetworkOfferingParams{}
+ p.p = make(map[string]interface{})
+ return p
+}
+
+// Updates a network offering.
+func (s *NetworkOfferingService) UpdateNetworkOffering(p *UpdateNetworkOfferingParams) (*UpdateNetworkOfferingResponse, error) {
+ resp, err := s.cs.newRequest("updateNetworkOffering", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r UpdateNetworkOfferingResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type UpdateNetworkOfferingResponse struct {
+ Availability string `json:"availability"`
+ Conservemode bool `json:"conservemode"`
+ Created string `json:"created"`
+ Details map[string]string `json:"details"`
+ Displaytext string `json:"displaytext"`
+ Egressdefaultpolicy bool `json:"egressdefaultpolicy"`
+ Forvpc bool `json:"forvpc"`
+ Guestiptype string `json:"guestiptype"`
+ Id string `json:"id"`
+ Isdefault bool `json:"isdefault"`
+ Ispersistent bool `json:"ispersistent"`
+ Maxconnections int `json:"maxconnections"`
+ Name string `json:"name"`
+ Networkrate int `json:"networkrate"`
+ Service []struct {
+ Capability []struct {
+ Canchooseservicecapability bool `json:"canchooseservicecapability"`
+ Name string `json:"name"`
+ Value string `json:"value"`
+ } `json:"capability"`
+ Name string `json:"name"`
+ Provider []struct {
+ Canenableindividualservice bool `json:"canenableindividualservice"`
+ Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Physicalnetworkid string `json:"physicalnetworkid"`
+ Servicelist []string `json:"servicelist"`
+ State string `json:"state"`
+ } `json:"provider"`
+ } `json:"service"`
+ Serviceofferingid string `json:"serviceofferingid"`
+ Specifyipranges bool `json:"specifyipranges"`
+ Specifyvlan bool `json:"specifyvlan"`
+ State string `json:"state"`
+ Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"`
+ Tags string `json:"tags"`
+ Traffictype string `json:"traffictype"`
+}
diff --git a/cloudstack/NetworkService.go b/cloudstack/NetworkService.go
index dcbd09d..6129da1 100644
--- a/cloudstack/NetworkService.go
+++ b/cloudstack/NetworkService.go
@@ -24,72 +24,6 @@
"strings"
)
-type AddNetworkDeviceParams struct {
- p map[string]interface{}
-}
-
-func (p *AddNetworkDeviceParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["networkdeviceparameterlist"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].key", i), k)
- u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].value", i), vv)
- i++
- }
- }
- if v, found := p.p["networkdevicetype"]; found {
- u.Set("networkdevicetype", v.(string))
- }
- return u
-}
-
-func (p *AddNetworkDeviceParams) SetNetworkdeviceparameterlist(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkdeviceparameterlist"] = v
- return
-}
-
-func (p *AddNetworkDeviceParams) SetNetworkdevicetype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkdevicetype"] = v
- return
-}
-
-// You should always use this function to get a new AddNetworkDeviceParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewAddNetworkDeviceParams() *AddNetworkDeviceParams {
- p := &AddNetworkDeviceParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer
-func (s *NetworkService) AddNetworkDevice(p *AddNetworkDeviceParams) (*AddNetworkDeviceResponse, error) {
- resp, err := s.cs.newRequest("addNetworkDevice", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r AddNetworkDeviceResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type AddNetworkDeviceResponse struct {
- Id string `json:"id"`
-}
-
type AddNetworkServiceProviderParams struct {
p map[string]interface{}
}
@@ -702,658 +636,6 @@
Zonesnetworkspans []interface{} `json:"zonesnetworkspans"`
}
-type CreateNetworkACLParams struct {
- p map[string]interface{}
-}
-
-func (p *CreateNetworkACLParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["aclid"]; found {
- u.Set("aclid", v.(string))
- }
- if v, found := p.p["action"]; found {
- u.Set("action", v.(string))
- }
- if v, found := p.p["cidrlist"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("cidrlist", vv)
- }
- if v, found := p.p["endport"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("endport", vv)
- }
- if v, found := p.p["fordisplay"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("fordisplay", vv)
- }
- if v, found := p.p["icmpcode"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("icmpcode", vv)
- }
- if v, found := p.p["icmptype"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("icmptype", vv)
- }
- if v, found := p.p["networkid"]; found {
- u.Set("networkid", v.(string))
- }
- if v, found := p.p["number"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("number", vv)
- }
- if v, found := p.p["protocol"]; found {
- u.Set("protocol", v.(string))
- }
- if v, found := p.p["startport"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("startport", vv)
- }
- if v, found := p.p["traffictype"]; found {
- u.Set("traffictype", v.(string))
- }
- return u
-}
-
-func (p *CreateNetworkACLParams) SetAclid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["aclid"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetAction(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["action"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetCidrlist(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["cidrlist"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetEndport(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["endport"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetFordisplay(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["fordisplay"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetIcmpcode(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["icmpcode"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetIcmptype(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["icmptype"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetNetworkid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkid"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetNumber(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["number"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetProtocol(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["protocol"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetStartport(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["startport"] = v
- return
-}
-
-func (p *CreateNetworkACLParams) SetTraffictype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["traffictype"] = v
- return
-}
-
-// You should always use this function to get a new CreateNetworkACLParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewCreateNetworkACLParams(protocol string) *CreateNetworkACLParams {
- p := &CreateNetworkACLParams{}
- p.p = make(map[string]interface{})
- p.p["protocol"] = protocol
- return p
-}
-
-// Creates a ACL rule in the given network (the network has to belong to VPC)
-func (s *NetworkService) CreateNetworkACL(p *CreateNetworkACLParams) (*CreateNetworkACLResponse, error) {
- resp, err := s.cs.newRequest("createNetworkACL", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r CreateNetworkACLResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type CreateNetworkACLResponse struct {
- JobID string `json:"jobid"`
- Aclid string `json:"aclid"`
- Action string `json:"action"`
- Cidrlist string `json:"cidrlist"`
- Endport string `json:"endport"`
- Fordisplay bool `json:"fordisplay"`
- Icmpcode int `json:"icmpcode"`
- Icmptype int `json:"icmptype"`
- Id string `json:"id"`
- Number int `json:"number"`
- Protocol string `json:"protocol"`
- Startport string `json:"startport"`
- State string `json:"state"`
- Tags []struct {
- Account string `json:"account"`
- Customer string `json:"customer"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Key string `json:"key"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Resourceid string `json:"resourceid"`
- Resourcetype string `json:"resourcetype"`
- Value string `json:"value"`
- } `json:"tags"`
- Traffictype string `json:"traffictype"`
-}
-
-type CreateNetworkACLListParams struct {
- p map[string]interface{}
-}
-
-func (p *CreateNetworkACLListParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["description"]; found {
- u.Set("description", v.(string))
- }
- if v, found := p.p["fordisplay"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("fordisplay", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["vpcid"]; found {
- u.Set("vpcid", v.(string))
- }
- return u
-}
-
-func (p *CreateNetworkACLListParams) SetDescription(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["description"] = v
- return
-}
-
-func (p *CreateNetworkACLListParams) SetFordisplay(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["fordisplay"] = v
- return
-}
-
-func (p *CreateNetworkACLListParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *CreateNetworkACLListParams) SetVpcid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["vpcid"] = v
- return
-}
-
-// You should always use this function to get a new CreateNetworkACLListParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewCreateNetworkACLListParams(name string, vpcid string) *CreateNetworkACLListParams {
- p := &CreateNetworkACLListParams{}
- p.p = make(map[string]interface{})
- p.p["name"] = name
- p.p["vpcid"] = vpcid
- return p
-}
-
-// Creates a network ACL for the given VPC
-func (s *NetworkService) CreateNetworkACLList(p *CreateNetworkACLListParams) (*CreateNetworkACLListResponse, error) {
- resp, err := s.cs.newRequest("createNetworkACLList", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r CreateNetworkACLListResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type CreateNetworkACLListResponse struct {
- JobID string `json:"jobid"`
- Description string `json:"description"`
- Fordisplay bool `json:"fordisplay"`
- Id string `json:"id"`
- Name string `json:"name"`
- Vpcid string `json:"vpcid"`
-}
-
-type CreateNetworkOfferingParams struct {
- p map[string]interface{}
-}
-
-func (p *CreateNetworkOfferingParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["availability"]; found {
- u.Set("availability", v.(string))
- }
- if v, found := p.p["conservemode"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("conservemode", vv)
- }
- if v, found := p.p["details"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("details[%d].%s", i, k), vv)
- i++
- }
- }
- if v, found := p.p["displaytext"]; found {
- u.Set("displaytext", v.(string))
- }
- if v, found := p.p["egressdefaultpolicy"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("egressdefaultpolicy", vv)
- }
- if v, found := p.p["guestiptype"]; found {
- u.Set("guestiptype", v.(string))
- }
- if v, found := p.p["ispersistent"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("ispersistent", vv)
- }
- if v, found := p.p["keepaliveenabled"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("keepaliveenabled", vv)
- }
- if v, found := p.p["maxconnections"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("maxconnections", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["networkrate"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("networkrate", vv)
- }
- if v, found := p.p["servicecapabilitylist"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("servicecapabilitylist[%d].key", i), k)
- u.Set(fmt.Sprintf("servicecapabilitylist[%d].value", i), vv)
- i++
- }
- }
- if v, found := p.p["serviceofferingid"]; found {
- u.Set("serviceofferingid", v.(string))
- }
- if v, found := p.p["serviceproviderlist"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("serviceproviderlist[%d].service", i), k)
- u.Set(fmt.Sprintf("serviceproviderlist[%d].provider", i), vv)
- i++
- }
- }
- if v, found := p.p["specifyipranges"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("specifyipranges", vv)
- }
- if v, found := p.p["specifyvlan"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("specifyvlan", vv)
- }
- if v, found := p.p["supportedservices"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("supportedservices", vv)
- }
- if v, found := p.p["tags"]; found {
- u.Set("tags", v.(string))
- }
- if v, found := p.p["traffictype"]; found {
- u.Set("traffictype", v.(string))
- }
- return u
-}
-
-func (p *CreateNetworkOfferingParams) SetAvailability(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["availability"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetConservemode(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["conservemode"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetDetails(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["details"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetDisplaytext(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["displaytext"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetEgressdefaultpolicy(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["egressdefaultpolicy"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetGuestiptype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["guestiptype"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetIspersistent(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["ispersistent"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetKeepaliveenabled(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keepaliveenabled"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetMaxconnections(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["maxconnections"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetNetworkrate(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkrate"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetServicecapabilitylist(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["servicecapabilitylist"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetServiceofferingid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["serviceofferingid"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetServiceproviderlist(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["serviceproviderlist"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetSpecifyipranges(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["specifyipranges"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetSpecifyvlan(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["specifyvlan"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetSupportedservices(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["supportedservices"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetTags(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["tags"] = v
- return
-}
-
-func (p *CreateNetworkOfferingParams) SetTraffictype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["traffictype"] = v
- return
-}
-
-// You should always use this function to get a new CreateNetworkOfferingParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewCreateNetworkOfferingParams(displaytext string, guestiptype string, name string, supportedservices []string, traffictype string) *CreateNetworkOfferingParams {
- p := &CreateNetworkOfferingParams{}
- p.p = make(map[string]interface{})
- p.p["displaytext"] = displaytext
- p.p["guestiptype"] = guestiptype
- p.p["name"] = name
- p.p["supportedservices"] = supportedservices
- p.p["traffictype"] = traffictype
- return p
-}
-
-// Creates a network offering.
-func (s *NetworkService) CreateNetworkOffering(p *CreateNetworkOfferingParams) (*CreateNetworkOfferingResponse, error) {
- resp, err := s.cs.newRequest("createNetworkOffering", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- if resp, err = getRawValue(resp); err != nil {
- return nil, err
- }
-
- var r CreateNetworkOfferingResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type CreateNetworkOfferingResponse struct {
- Availability string `json:"availability"`
- Conservemode bool `json:"conservemode"`
- Created string `json:"created"`
- Details map[string]string `json:"details"`
- Displaytext string `json:"displaytext"`
- Egressdefaultpolicy bool `json:"egressdefaultpolicy"`
- Forvpc bool `json:"forvpc"`
- Guestiptype string `json:"guestiptype"`
- Id string `json:"id"`
- Isdefault bool `json:"isdefault"`
- Ispersistent bool `json:"ispersistent"`
- Maxconnections int `json:"maxconnections"`
- Name string `json:"name"`
- Networkrate int `json:"networkrate"`
- Service []struct {
- Capability []struct {
- Canchooseservicecapability bool `json:"canchooseservicecapability"`
- Name string `json:"name"`
- Value string `json:"value"`
- } `json:"capability"`
- Name string `json:"name"`
- Provider []struct {
- Canenableindividualservice bool `json:"canenableindividualservice"`
- Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"`
- Id string `json:"id"`
- Name string `json:"name"`
- Physicalnetworkid string `json:"physicalnetworkid"`
- Servicelist []string `json:"servicelist"`
- State string `json:"state"`
- } `json:"provider"`
- } `json:"service"`
- Serviceofferingid string `json:"serviceofferingid"`
- Specifyipranges bool `json:"specifyipranges"`
- Specifyvlan bool `json:"specifyvlan"`
- State string `json:"state"`
- Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"`
- Tags string `json:"tags"`
- Traffictype string `json:"traffictype"`
-}
-
type CreatePhysicalNetworkParams struct {
p map[string]interface{}
}
@@ -2012,246 +1294,6 @@
Success bool `json:"success"`
}
-type DeleteNetworkACLParams struct {
- p map[string]interface{}
-}
-
-func (p *DeleteNetworkACLParams) 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 *DeleteNetworkACLParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new DeleteNetworkACLParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewDeleteNetworkACLParams(id string) *DeleteNetworkACLParams {
- p := &DeleteNetworkACLParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Deletes a network ACL
-func (s *NetworkService) DeleteNetworkACL(p *DeleteNetworkACLParams) (*DeleteNetworkACLResponse, error) {
- resp, err := s.cs.newRequest("deleteNetworkACL", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r DeleteNetworkACLResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type DeleteNetworkACLResponse struct {
- JobID string `json:"jobid"`
- Displaytext string `json:"displaytext"`
- Success bool `json:"success"`
-}
-
-type DeleteNetworkACLListParams struct {
- p map[string]interface{}
-}
-
-func (p *DeleteNetworkACLListParams) 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 *DeleteNetworkACLListParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new DeleteNetworkACLListParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewDeleteNetworkACLListParams(id string) *DeleteNetworkACLListParams {
- p := &DeleteNetworkACLListParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Deletes a network ACL
-func (s *NetworkService) DeleteNetworkACLList(p *DeleteNetworkACLListParams) (*DeleteNetworkACLListResponse, error) {
- resp, err := s.cs.newRequest("deleteNetworkACLList", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r DeleteNetworkACLListResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type DeleteNetworkACLListResponse struct {
- JobID string `json:"jobid"`
- Displaytext string `json:"displaytext"`
- Success bool `json:"success"`
-}
-
-type DeleteNetworkDeviceParams struct {
- p map[string]interface{}
-}
-
-func (p *DeleteNetworkDeviceParams) 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 *DeleteNetworkDeviceParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new DeleteNetworkDeviceParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewDeleteNetworkDeviceParams(id string) *DeleteNetworkDeviceParams {
- p := &DeleteNetworkDeviceParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Deletes network device.
-func (s *NetworkService) DeleteNetworkDevice(p *DeleteNetworkDeviceParams) (*DeleteNetworkDeviceResponse, error) {
- resp, err := s.cs.newRequest("deleteNetworkDevice", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r DeleteNetworkDeviceResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type DeleteNetworkDeviceResponse struct {
- Displaytext string `json:"displaytext"`
- Success string `json:"success"`
-}
-
-type DeleteNetworkOfferingParams struct {
- p map[string]interface{}
-}
-
-func (p *DeleteNetworkOfferingParams) 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 *DeleteNetworkOfferingParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new DeleteNetworkOfferingParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewDeleteNetworkOfferingParams(id string) *DeleteNetworkOfferingParams {
- p := &DeleteNetworkOfferingParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Deletes a network offering.
-func (s *NetworkService) DeleteNetworkOffering(p *DeleteNetworkOfferingParams) (*DeleteNetworkOfferingResponse, error) {
- resp, err := s.cs.newRequest("deleteNetworkOffering", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r DeleteNetworkOfferingResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type DeleteNetworkOfferingResponse struct {
- Displaytext string `json:"displaytext"`
- Success string `json:"success"`
-}
-
type DeleteNetworkServiceProviderParams struct {
p map[string]interface{}
}
@@ -2532,208 +1574,6 @@
Success bool `json:"success"`
}
-type ListBrocadeVcsDeviceNetworksParams struct {
- p map[string]interface{}
-}
-
-func (p *ListBrocadeVcsDeviceNetworksParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["vcsdeviceid"]; found {
- u.Set("vcsdeviceid", v.(string))
- }
- return u
-}
-
-func (p *ListBrocadeVcsDeviceNetworksParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListBrocadeVcsDeviceNetworksParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListBrocadeVcsDeviceNetworksParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListBrocadeVcsDeviceNetworksParams) SetVcsdeviceid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["vcsdeviceid"] = v
- return
-}
-
-// You should always use this function to get a new ListBrocadeVcsDeviceNetworksParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewListBrocadeVcsDeviceNetworksParams(vcsdeviceid string) *ListBrocadeVcsDeviceNetworksParams {
- p := &ListBrocadeVcsDeviceNetworksParams{}
- p.p = make(map[string]interface{})
- p.p["vcsdeviceid"] = vcsdeviceid
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkService) GetBrocadeVcsDeviceNetworkID(keyword string, vcsdeviceid string, opts ...OptionFunc) (string, int, error) {
- p := &ListBrocadeVcsDeviceNetworksParams{}
- p.p = make(map[string]interface{})
-
- p.p["keyword"] = keyword
- p.p["vcsdeviceid"] = vcsdeviceid
-
- for _, fn := range append(s.cs.options, opts...) {
- if err := fn(s.cs, p); err != nil {
- return "", -1, err
- }
- }
-
- l, err := s.ListBrocadeVcsDeviceNetworks(p)
- if err != nil {
- return "", -1, err
- }
-
- if l.Count == 0 {
- return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l)
- }
-
- if l.Count == 1 {
- return l.BrocadeVcsDeviceNetworks[0].Id, l.Count, nil
- }
-
- if l.Count > 1 {
- for _, v := range l.BrocadeVcsDeviceNetworks {
- if v.Name == keyword {
- return v.Id, l.Count, nil
- }
- }
- }
- return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l)
-}
-
-// lists network that are using a brocade vcs switch
-func (s *NetworkService) ListBrocadeVcsDeviceNetworks(p *ListBrocadeVcsDeviceNetworksParams) (*ListBrocadeVcsDeviceNetworksResponse, error) {
- resp, err := s.cs.newRequest("listBrocadeVcsDeviceNetworks", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListBrocadeVcsDeviceNetworksResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListBrocadeVcsDeviceNetworksResponse struct {
- Count int `json:"count"`
- BrocadeVcsDeviceNetworks []*BrocadeVcsDeviceNetwork `json:"brocadevcsdevicenetwork"`
-}
-
-type BrocadeVcsDeviceNetwork struct {
- Account string `json:"account"`
- Aclid string `json:"aclid"`
- Acltype string `json:"acltype"`
- Broadcastdomaintype string `json:"broadcastdomaintype"`
- Broadcasturi string `json:"broadcasturi"`
- Canusefordeploy bool `json:"canusefordeploy"`
- Cidr string `json:"cidr"`
- Displaynetwork bool `json:"displaynetwork"`
- Displaytext string `json:"displaytext"`
- Dns1 string `json:"dns1"`
- Dns2 string `json:"dns2"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Gateway string `json:"gateway"`
- Id string `json:"id"`
- Ip6cidr string `json:"ip6cidr"`
- Ip6gateway string `json:"ip6gateway"`
- Isdefault bool `json:"isdefault"`
- Ispersistent bool `json:"ispersistent"`
- Issystem bool `json:"issystem"`
- Name string `json:"name"`
- Netmask string `json:"netmask"`
- Networkcidr string `json:"networkcidr"`
- Networkdomain string `json:"networkdomain"`
- Networkofferingavailability string `json:"networkofferingavailability"`
- Networkofferingconservemode bool `json:"networkofferingconservemode"`
- Networkofferingdisplaytext string `json:"networkofferingdisplaytext"`
- Networkofferingid string `json:"networkofferingid"`
- Networkofferingname string `json:"networkofferingname"`
- Physicalnetworkid string `json:"physicalnetworkid"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Related string `json:"related"`
- Reservediprange string `json:"reservediprange"`
- Restartrequired bool `json:"restartrequired"`
- Service []struct {
- Capability []struct {
- Canchooseservicecapability bool `json:"canchooseservicecapability"`
- Name string `json:"name"`
- Value string `json:"value"`
- } `json:"capability"`
- Name string `json:"name"`
- Provider []struct {
- Canenableindividualservice bool `json:"canenableindividualservice"`
- Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"`
- Id string `json:"id"`
- Name string `json:"name"`
- Physicalnetworkid string `json:"physicalnetworkid"`
- Servicelist []string `json:"servicelist"`
- State string `json:"state"`
- } `json:"provider"`
- } `json:"service"`
- Specifyipranges bool `json:"specifyipranges"`
- State string `json:"state"`
- Strechedl2subnet bool `json:"strechedl2subnet"`
- Subdomainaccess bool `json:"subdomainaccess"`
- Tags []struct {
- Account string `json:"account"`
- Customer string `json:"customer"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Key string `json:"key"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Resourceid string `json:"resourceid"`
- Resourcetype string `json:"resourcetype"`
- Value string `json:"value"`
- } `json:"tags"`
- Traffictype string `json:"traffictype"`
- Type string `json:"type"`
- Vlan string `json:"vlan"`
- Vpcid string `json:"vpcid"`
- Zoneid string `json:"zoneid"`
- Zonename string `json:"zonename"`
- Zonesnetworkspans []interface{} `json:"zonesnetworkspans"`
-}
-
type ListF5LoadBalancerNetworksParams struct {
p map[string]interface{}
}
@@ -3138,678 +1978,6 @@
Zonesnetworkspans []interface{} `json:"zonesnetworkspans"`
}
-type ListNetworkACLListsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListNetworkACLListsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["fordisplay"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("fordisplay", vv)
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["isrecursive"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("isrecursive", vv)
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["listall"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("listall", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["networkid"]; found {
- u.Set("networkid", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["vpcid"]; found {
- u.Set("vpcid", v.(string))
- }
- return u
-}
-
-func (p *ListNetworkACLListsParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetFordisplay(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["fordisplay"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetIsrecursive(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["isrecursive"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetListall(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["listall"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetNetworkid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkid"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *ListNetworkACLListsParams) SetVpcid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["vpcid"] = v
- return
-}
-
-// You should always use this function to get a new ListNetworkACLListsParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewListNetworkACLListsParams() *ListNetworkACLListsParams {
- p := &ListNetworkACLListsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkService) GetNetworkACLListID(name string, opts ...OptionFunc) (string, int, error) {
- p := &ListNetworkACLListsParams{}
- p.p = make(map[string]interface{})
-
- p.p["name"] = name
-
- for _, fn := range append(s.cs.options, opts...) {
- if err := fn(s.cs, p); err != nil {
- return "", -1, err
- }
- }
-
- l, err := s.ListNetworkACLLists(p)
- if err != nil {
- return "", -1, err
- }
-
- if l.Count == 0 {
- return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
- }
-
- if l.Count == 1 {
- return l.NetworkACLLists[0].Id, l.Count, nil
- }
-
- if l.Count > 1 {
- for _, v := range l.NetworkACLLists {
- if v.Name == name {
- return v.Id, l.Count, nil
- }
- }
- }
- return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkService) GetNetworkACLListByName(name string, opts ...OptionFunc) (*NetworkACLList, int, error) {
- id, count, err := s.GetNetworkACLListID(name, opts...)
- if err != nil {
- return nil, count, err
- }
-
- r, count, err := s.GetNetworkACLListByID(id, opts...)
- if err != nil {
- return nil, count, err
- }
- return r, count, nil
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkService) GetNetworkACLListByID(id string, opts ...OptionFunc) (*NetworkACLList, int, error) {
- p := &ListNetworkACLListsParams{}
- 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.ListNetworkACLLists(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.NetworkACLLists[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for NetworkACLList UUID: %s!", id)
-}
-
-// Lists all network ACLs
-func (s *NetworkService) ListNetworkACLLists(p *ListNetworkACLListsParams) (*ListNetworkACLListsResponse, error) {
- resp, err := s.cs.newRequest("listNetworkACLLists", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListNetworkACLListsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListNetworkACLListsResponse struct {
- Count int `json:"count"`
- NetworkACLLists []*NetworkACLList `json:"networkacllist"`
-}
-
-type NetworkACLList struct {
- Description string `json:"description"`
- Fordisplay bool `json:"fordisplay"`
- Id string `json:"id"`
- Name string `json:"name"`
- Vpcid string `json:"vpcid"`
-}
-
-type ListNetworkACLsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListNetworkACLsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["aclid"]; found {
- u.Set("aclid", v.(string))
- }
- if v, found := p.p["action"]; found {
- u.Set("action", v.(string))
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["fordisplay"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("fordisplay", vv)
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["isrecursive"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("isrecursive", vv)
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["listall"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("listall", vv)
- }
- if v, found := p.p["networkid"]; found {
- u.Set("networkid", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["protocol"]; found {
- u.Set("protocol", v.(string))
- }
- if v, found := p.p["tags"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("tags[%d].key", i), k)
- u.Set(fmt.Sprintf("tags[%d].value", i), vv)
- i++
- }
- }
- if v, found := p.p["traffictype"]; found {
- u.Set("traffictype", v.(string))
- }
- return u
-}
-
-func (p *ListNetworkACLsParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetAclid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["aclid"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetAction(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["action"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetFordisplay(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["fordisplay"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetIsrecursive(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["isrecursive"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetListall(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["listall"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetNetworkid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkid"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetProtocol(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["protocol"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetTags(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["tags"] = v
- return
-}
-
-func (p *ListNetworkACLsParams) SetTraffictype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["traffictype"] = v
- return
-}
-
-// You should always use this function to get a new ListNetworkACLsParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewListNetworkACLsParams() *ListNetworkACLsParams {
- p := &ListNetworkACLsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkService) GetNetworkACLByID(id string, opts ...OptionFunc) (*NetworkACL, int, error) {
- p := &ListNetworkACLsParams{}
- 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.ListNetworkACLs(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.NetworkACLs[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for NetworkACL UUID: %s!", id)
-}
-
-// Lists all network ACL items
-func (s *NetworkService) ListNetworkACLs(p *ListNetworkACLsParams) (*ListNetworkACLsResponse, error) {
- resp, err := s.cs.newRequest("listNetworkACLs", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListNetworkACLsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListNetworkACLsResponse struct {
- Count int `json:"count"`
- NetworkACLs []*NetworkACL `json:"networkacl"`
-}
-
-type NetworkACL struct {
- Aclid string `json:"aclid"`
- Action string `json:"action"`
- Cidrlist string `json:"cidrlist"`
- Endport string `json:"endport"`
- Fordisplay bool `json:"fordisplay"`
- Icmpcode int `json:"icmpcode"`
- Icmptype int `json:"icmptype"`
- Id string `json:"id"`
- Number int `json:"number"`
- Protocol string `json:"protocol"`
- Startport string `json:"startport"`
- State string `json:"state"`
- Tags []struct {
- Account string `json:"account"`
- Customer string `json:"customer"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Key string `json:"key"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Resourceid string `json:"resourceid"`
- Resourcetype string `json:"resourcetype"`
- Value string `json:"value"`
- } `json:"tags"`
- Traffictype string `json:"traffictype"`
-}
-
-type ListNetworkDeviceParams struct {
- p map[string]interface{}
-}
-
-func (p *ListNetworkDeviceParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["networkdeviceparameterlist"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].key", i), k)
- u.Set(fmt.Sprintf("networkdeviceparameterlist[%d].value", i), vv)
- i++
- }
- }
- if v, found := p.p["networkdevicetype"]; found {
- u.Set("networkdevicetype", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- return u
-}
-
-func (p *ListNetworkDeviceParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListNetworkDeviceParams) SetNetworkdeviceparameterlist(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkdeviceparameterlist"] = v
- return
-}
-
-func (p *ListNetworkDeviceParams) SetNetworkdevicetype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkdevicetype"] = v
- return
-}
-
-func (p *ListNetworkDeviceParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListNetworkDeviceParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-// You should always use this function to get a new ListNetworkDeviceParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewListNetworkDeviceParams() *ListNetworkDeviceParams {
- p := &ListNetworkDeviceParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// List network devices
-func (s *NetworkService) ListNetworkDevice(p *ListNetworkDeviceParams) (*ListNetworkDeviceResponse, error) {
- resp, err := s.cs.newRequest("listNetworkDevice", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListNetworkDeviceResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListNetworkDeviceResponse struct {
- Count int `json:"count"`
- NetworkDevice []*NetworkDevice `json:"networkdevice"`
-}
-
-type NetworkDevice struct {
- Id string `json:"id"`
-}
-
type ListNetworkIsolationMethodsParams struct {
p map[string]interface{}
}
@@ -3889,399 +2057,6 @@
Name string `json:"name"`
}
-type ListNetworkOfferingsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListNetworkOfferingsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["availability"]; found {
- u.Set("availability", v.(string))
- }
- if v, found := p.p["displaytext"]; found {
- u.Set("displaytext", v.(string))
- }
- if v, found := p.p["forvpc"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("forvpc", vv)
- }
- if v, found := p.p["guestiptype"]; found {
- u.Set("guestiptype", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["isdefault"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("isdefault", vv)
- }
- if v, found := p.p["istagged"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("istagged", vv)
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["networkid"]; found {
- u.Set("networkid", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["sourcenatsupported"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("sourcenatsupported", vv)
- }
- if v, found := p.p["specifyipranges"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("specifyipranges", vv)
- }
- if v, found := p.p["specifyvlan"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("specifyvlan", vv)
- }
- if v, found := p.p["state"]; found {
- u.Set("state", v.(string))
- }
- if v, found := p.p["supportedservices"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("supportedservices", vv)
- }
- if v, found := p.p["tags"]; found {
- u.Set("tags", v.(string))
- }
- if v, found := p.p["traffictype"]; found {
- u.Set("traffictype", v.(string))
- }
- if v, found := p.p["zoneid"]; found {
- u.Set("zoneid", v.(string))
- }
- return u
-}
-
-func (p *ListNetworkOfferingsParams) SetAvailability(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["availability"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetDisplaytext(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["displaytext"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetForvpc(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["forvpc"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetGuestiptype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["guestiptype"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetIsdefault(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["isdefault"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetIstagged(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["istagged"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetNetworkid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkid"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetSourcenatsupported(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["sourcenatsupported"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetSpecifyipranges(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["specifyipranges"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetSpecifyvlan(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["specifyvlan"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetState(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["state"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetSupportedservices(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["supportedservices"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetTags(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["tags"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetTraffictype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["traffictype"] = v
- return
-}
-
-func (p *ListNetworkOfferingsParams) SetZoneid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["zoneid"] = v
- return
-}
-
-// You should always use this function to get a new ListNetworkOfferingsParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewListNetworkOfferingsParams() *ListNetworkOfferingsParams {
- p := &ListNetworkOfferingsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkService) GetNetworkOfferingID(name string, opts ...OptionFunc) (string, int, error) {
- p := &ListNetworkOfferingsParams{}
- p.p = make(map[string]interface{})
-
- p.p["name"] = name
-
- for _, fn := range append(s.cs.options, opts...) {
- if err := fn(s.cs, p); err != nil {
- return "", -1, err
- }
- }
-
- l, err := s.ListNetworkOfferings(p)
- if err != nil {
- return "", -1, err
- }
-
- if l.Count == 0 {
- return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
- }
-
- if l.Count == 1 {
- return l.NetworkOfferings[0].Id, l.Count, nil
- }
-
- if l.Count > 1 {
- for _, v := range l.NetworkOfferings {
- if v.Name == name {
- return v.Id, l.Count, nil
- }
- }
- }
- return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkService) GetNetworkOfferingByName(name string, opts ...OptionFunc) (*NetworkOffering, int, error) {
- id, count, err := s.GetNetworkOfferingID(name, opts...)
- if err != nil {
- return nil, count, err
- }
-
- r, count, err := s.GetNetworkOfferingByID(id, opts...)
- if err != nil {
- return nil, count, err
- }
- return r, count, nil
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *NetworkService) GetNetworkOfferingByID(id string, opts ...OptionFunc) (*NetworkOffering, int, error) {
- p := &ListNetworkOfferingsParams{}
- 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.ListNetworkOfferings(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.NetworkOfferings[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for NetworkOffering UUID: %s!", id)
-}
-
-// Lists all available network offerings.
-func (s *NetworkService) ListNetworkOfferings(p *ListNetworkOfferingsParams) (*ListNetworkOfferingsResponse, error) {
- resp, err := s.cs.newRequest("listNetworkOfferings", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListNetworkOfferingsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListNetworkOfferingsResponse struct {
- Count int `json:"count"`
- NetworkOfferings []*NetworkOffering `json:"networkoffering"`
-}
-
-type NetworkOffering struct {
- Availability string `json:"availability"`
- Conservemode bool `json:"conservemode"`
- Created string `json:"created"`
- Details map[string]string `json:"details"`
- Displaytext string `json:"displaytext"`
- Egressdefaultpolicy bool `json:"egressdefaultpolicy"`
- Forvpc bool `json:"forvpc"`
- Guestiptype string `json:"guestiptype"`
- Id string `json:"id"`
- Isdefault bool `json:"isdefault"`
- Ispersistent bool `json:"ispersistent"`
- Maxconnections int `json:"maxconnections"`
- Name string `json:"name"`
- Networkrate int `json:"networkrate"`
- Service []struct {
- Capability []struct {
- Canchooseservicecapability bool `json:"canchooseservicecapability"`
- Name string `json:"name"`
- Value string `json:"value"`
- } `json:"capability"`
- Name string `json:"name"`
- Provider []struct {
- Canenableindividualservice bool `json:"canenableindividualservice"`
- Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"`
- Id string `json:"id"`
- Name string `json:"name"`
- Physicalnetworkid string `json:"physicalnetworkid"`
- Servicelist []string `json:"servicelist"`
- State string `json:"state"`
- } `json:"provider"`
- } `json:"service"`
- Serviceofferingid string `json:"serviceofferingid"`
- Specifyipranges bool `json:"specifyipranges"`
- Specifyvlan bool `json:"specifyvlan"`
- State string `json:"state"`
- Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"`
- Tags string `json:"tags"`
- Traffictype string `json:"traffictype"`
-}
-
type ListNetworkServiceProvidersParams struct {
p map[string]interface{}
}
@@ -6139,96 +3914,6 @@
Success string `json:"success"`
}
-type ReplaceNetworkACLListParams struct {
- p map[string]interface{}
-}
-
-func (p *ReplaceNetworkACLListParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["aclid"]; found {
- u.Set("aclid", v.(string))
- }
- if v, found := p.p["gatewayid"]; found {
- u.Set("gatewayid", v.(string))
- }
- if v, found := p.p["networkid"]; found {
- u.Set("networkid", v.(string))
- }
- return u
-}
-
-func (p *ReplaceNetworkACLListParams) SetAclid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["aclid"] = v
- return
-}
-
-func (p *ReplaceNetworkACLListParams) SetGatewayid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["gatewayid"] = v
- return
-}
-
-func (p *ReplaceNetworkACLListParams) SetNetworkid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkid"] = v
- return
-}
-
-// You should always use this function to get a new ReplaceNetworkACLListParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewReplaceNetworkACLListParams(aclid string) *ReplaceNetworkACLListParams {
- p := &ReplaceNetworkACLListParams{}
- p.p = make(map[string]interface{})
- p.p["aclid"] = aclid
- return p
-}
-
-// Replaces ACL associated with a network or private gateway
-func (s *NetworkService) ReplaceNetworkACLList(p *ReplaceNetworkACLListParams) (*ReplaceNetworkACLListResponse, error) {
- resp, err := s.cs.newRequest("replaceNetworkACLList", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ReplaceNetworkACLListResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type ReplaceNetworkACLListResponse struct {
- JobID string `json:"jobid"`
- Displaytext string `json:"displaytext"`
- Success bool `json:"success"`
-}
-
type RestartNetworkParams struct {
p map[string]interface{}
}
@@ -6589,488 +4274,6 @@
Zonesnetworkspans []interface{} `json:"zonesnetworkspans"`
}
-type UpdateNetworkACLItemParams struct {
- p map[string]interface{}
-}
-
-func (p *UpdateNetworkACLItemParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["action"]; found {
- u.Set("action", v.(string))
- }
- if v, found := p.p["cidrlist"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("cidrlist", vv)
- }
- if v, found := p.p["customid"]; found {
- u.Set("customid", v.(string))
- }
- if v, found := p.p["endport"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("endport", vv)
- }
- if v, found := p.p["fordisplay"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("fordisplay", vv)
- }
- if v, found := p.p["icmpcode"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("icmpcode", vv)
- }
- if v, found := p.p["icmptype"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("icmptype", vv)
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["number"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("number", vv)
- }
- if v, found := p.p["protocol"]; found {
- u.Set("protocol", v.(string))
- }
- if v, found := p.p["startport"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("startport", vv)
- }
- if v, found := p.p["traffictype"]; found {
- u.Set("traffictype", v.(string))
- }
- return u
-}
-
-func (p *UpdateNetworkACLItemParams) SetAction(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["action"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetCidrlist(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["cidrlist"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetCustomid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["customid"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetEndport(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["endport"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetFordisplay(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["fordisplay"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetIcmpcode(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["icmpcode"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetIcmptype(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["icmptype"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetNumber(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["number"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetProtocol(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["protocol"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetStartport(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["startport"] = v
- return
-}
-
-func (p *UpdateNetworkACLItemParams) SetTraffictype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["traffictype"] = v
- return
-}
-
-// You should always use this function to get a new UpdateNetworkACLItemParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewUpdateNetworkACLItemParams(id string) *UpdateNetworkACLItemParams {
- p := &UpdateNetworkACLItemParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Updates ACL item with specified ID
-func (s *NetworkService) UpdateNetworkACLItem(p *UpdateNetworkACLItemParams) (*UpdateNetworkACLItemResponse, error) {
- resp, err := s.cs.newRequest("updateNetworkACLItem", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r UpdateNetworkACLItemResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type UpdateNetworkACLItemResponse struct {
- JobID string `json:"jobid"`
- Aclid string `json:"aclid"`
- Action string `json:"action"`
- Cidrlist string `json:"cidrlist"`
- Endport string `json:"endport"`
- Fordisplay bool `json:"fordisplay"`
- Icmpcode int `json:"icmpcode"`
- Icmptype int `json:"icmptype"`
- Id string `json:"id"`
- Number int `json:"number"`
- Protocol string `json:"protocol"`
- Startport string `json:"startport"`
- State string `json:"state"`
- Tags []struct {
- Account string `json:"account"`
- Customer string `json:"customer"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Key string `json:"key"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Resourceid string `json:"resourceid"`
- Resourcetype string `json:"resourcetype"`
- Value string `json:"value"`
- } `json:"tags"`
- Traffictype string `json:"traffictype"`
-}
-
-type UpdateNetworkACLListParams struct {
- p map[string]interface{}
-}
-
-func (p *UpdateNetworkACLListParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["customid"]; found {
- u.Set("customid", v.(string))
- }
- if v, found := p.p["fordisplay"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("fordisplay", vv)
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- return u
-}
-
-func (p *UpdateNetworkACLListParams) SetCustomid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["customid"] = v
- return
-}
-
-func (p *UpdateNetworkACLListParams) SetFordisplay(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["fordisplay"] = v
- return
-}
-
-func (p *UpdateNetworkACLListParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new UpdateNetworkACLListParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewUpdateNetworkACLListParams(id string) *UpdateNetworkACLListParams {
- p := &UpdateNetworkACLListParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Updates network ACL list
-func (s *NetworkService) UpdateNetworkACLList(p *UpdateNetworkACLListParams) (*UpdateNetworkACLListResponse, error) {
- resp, err := s.cs.newRequest("updateNetworkACLList", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r UpdateNetworkACLListResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type UpdateNetworkACLListResponse struct {
- JobID string `json:"jobid"`
- Displaytext string `json:"displaytext"`
- Success bool `json:"success"`
-}
-
-type UpdateNetworkOfferingParams struct {
- p map[string]interface{}
-}
-
-func (p *UpdateNetworkOfferingParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["availability"]; found {
- u.Set("availability", v.(string))
- }
- if v, found := p.p["displaytext"]; found {
- u.Set("displaytext", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["keepaliveenabled"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("keepaliveenabled", vv)
- }
- if v, found := p.p["maxconnections"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("maxconnections", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["sortkey"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("sortkey", vv)
- }
- if v, found := p.p["state"]; found {
- u.Set("state", v.(string))
- }
- return u
-}
-
-func (p *UpdateNetworkOfferingParams) SetAvailability(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["availability"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetDisplaytext(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["displaytext"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetKeepaliveenabled(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keepaliveenabled"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetMaxconnections(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["maxconnections"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetSortkey(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["sortkey"] = v
- return
-}
-
-func (p *UpdateNetworkOfferingParams) SetState(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["state"] = v
- return
-}
-
-// You should always use this function to get a new UpdateNetworkOfferingParams instance,
-// as then you are sure you have configured all required params
-func (s *NetworkService) NewUpdateNetworkOfferingParams() *UpdateNetworkOfferingParams {
- p := &UpdateNetworkOfferingParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Updates a network offering.
-func (s *NetworkService) UpdateNetworkOffering(p *UpdateNetworkOfferingParams) (*UpdateNetworkOfferingResponse, error) {
- resp, err := s.cs.newRequest("updateNetworkOffering", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r UpdateNetworkOfferingResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type UpdateNetworkOfferingResponse struct {
- Availability string `json:"availability"`
- Conservemode bool `json:"conservemode"`
- Created string `json:"created"`
- Details map[string]string `json:"details"`
- Displaytext string `json:"displaytext"`
- Egressdefaultpolicy bool `json:"egressdefaultpolicy"`
- Forvpc bool `json:"forvpc"`
- Guestiptype string `json:"guestiptype"`
- Id string `json:"id"`
- Isdefault bool `json:"isdefault"`
- Ispersistent bool `json:"ispersistent"`
- Maxconnections int `json:"maxconnections"`
- Name string `json:"name"`
- Networkrate int `json:"networkrate"`
- Service []struct {
- Capability []struct {
- Canchooseservicecapability bool `json:"canchooseservicecapability"`
- Name string `json:"name"`
- Value string `json:"value"`
- } `json:"capability"`
- Name string `json:"name"`
- Provider []struct {
- Canenableindividualservice bool `json:"canenableindividualservice"`
- Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid"`
- Id string `json:"id"`
- Name string `json:"name"`
- Physicalnetworkid string `json:"physicalnetworkid"`
- Servicelist []string `json:"servicelist"`
- State string `json:"state"`
- } `json:"provider"`
- } `json:"service"`
- Serviceofferingid string `json:"serviceofferingid"`
- Specifyipranges bool `json:"specifyipranges"`
- Specifyvlan bool `json:"specifyvlan"`
- State string `json:"state"`
- Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"`
- Tags string `json:"tags"`
- Traffictype string `json:"traffictype"`
-}
-
type UpdateNetworkServiceProviderParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/PoolService.go b/cloudstack/PoolService.go
index 8bc1315..cdd8e59 100644
--- a/cloudstack/PoolService.go
+++ b/cloudstack/PoolService.go
@@ -410,68 +410,6 @@
Zonename string `json:"zonename"`
}
-type ListElastistorPoolParams struct {
- p map[string]interface{}
-}
-
-func (p *ListElastistorPoolParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["id"]; found {
- vv := strconv.FormatInt(v.(int64), 10)
- u.Set("id", vv)
- }
- return u
-}
-
-func (p *ListElastistorPoolParams) SetId(v int64) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new ListElastistorPoolParams instance,
-// as then you are sure you have configured all required params
-func (s *PoolService) NewListElastistorPoolParams() *ListElastistorPoolParams {
- p := &ListElastistorPoolParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Lists the pools of elastistor
-func (s *PoolService) ListElastistorPool(p *ListElastistorPoolParams) (*ListElastistorPoolResponse, error) {
- resp, err := s.cs.newRequest("listElastistorPool", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListElastistorPoolResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListElastistorPoolResponse struct {
- Count int `json:"count"`
- ElastistorPool []*ElastistorPool `json:"elastistorpool"`
-}
-
-type ElastistorPool struct {
- Controllerid string `json:"controllerid"`
- Gateway string `json:"gateway"`
- Id string `json:"id"`
- Maxiops int64 `json:"maxiops"`
- Name string `json:"name"`
- Size int64 `json:"size"`
- State string `json:"state"`
-}
-
type ListStoragePoolsParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/S3Service.go b/cloudstack/S3Service.go
deleted file mode 100644
index 4c616cd..0000000
--- a/cloudstack/S3Service.go
+++ /dev/null
@@ -1,201 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package cloudstack
-
-import (
- "encoding/json"
- "net/url"
- "strconv"
-)
-
-type AddImageStoreS3Params struct {
- p map[string]interface{}
-}
-
-func (p *AddImageStoreS3Params) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["accesskey"]; found {
- u.Set("accesskey", v.(string))
- }
- if v, found := p.p["bucket"]; found {
- u.Set("bucket", v.(string))
- }
- if v, found := p.p["connectiontimeout"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("connectiontimeout", vv)
- }
- if v, found := p.p["connectionttl"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("connectionttl", vv)
- }
- if v, found := p.p["endpoint"]; found {
- u.Set("endpoint", v.(string))
- }
- if v, found := p.p["maxerrorretry"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("maxerrorretry", vv)
- }
- if v, found := p.p["s3signer"]; found {
- u.Set("s3signer", v.(string))
- }
- if v, found := p.p["secretkey"]; found {
- u.Set("secretkey", v.(string))
- }
- if v, found := p.p["sockettimeout"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("sockettimeout", vv)
- }
- if v, found := p.p["usehttps"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("usehttps", vv)
- }
- if v, found := p.p["usetcpkeepalive"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("usetcpkeepalive", vv)
- }
- return u
-}
-
-func (p *AddImageStoreS3Params) SetAccesskey(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["accesskey"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetBucket(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["bucket"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetConnectiontimeout(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["connectiontimeout"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetConnectionttl(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["connectionttl"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetEndpoint(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["endpoint"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetMaxerrorretry(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["maxerrorretry"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetS3signer(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["s3signer"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetSecretkey(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["secretkey"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetSockettimeout(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["sockettimeout"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetUsehttps(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["usehttps"] = v
- return
-}
-
-func (p *AddImageStoreS3Params) SetUsetcpkeepalive(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["usetcpkeepalive"] = v
- return
-}
-
-// You should always use this function to get a new AddImageStoreS3Params instance,
-// as then you are sure you have configured all required params
-func (s *S3Service) NewAddImageStoreS3Params(accesskey string, bucket string, endpoint string, secretkey string) *AddImageStoreS3Params {
- p := &AddImageStoreS3Params{}
- p.p = make(map[string]interface{})
- p.p["accesskey"] = accesskey
- p.p["bucket"] = bucket
- p.p["endpoint"] = endpoint
- p.p["secretkey"] = secretkey
- return p
-}
-
-// Adds S3 Image Store
-func (s *S3Service) AddImageStoreS3(p *AddImageStoreS3Params) (*AddImageStoreS3Response, error) {
- resp, err := s.cs.newRequest("addImageStoreS3", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r AddImageStoreS3Response
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type AddImageStoreS3Response struct {
- Details []interface{} `json:"details"`
- Id string `json:"id"`
- Name string `json:"name"`
- Protocol string `json:"protocol"`
- Providername string `json:"providername"`
- Scope string `json:"scope"`
- Url string `json:"url"`
- Zoneid string `json:"zoneid"`
- Zonename string `json:"zonename"`
-}
diff --git a/cloudstack/SSHService.go b/cloudstack/SSHService.go
index ac0a7d9..d03ba8a 100644
--- a/cloudstack/SSHService.go
+++ b/cloudstack/SSHService.go
@@ -460,3 +460,285 @@
Fingerprint string `json:"fingerprint"`
Name string `json:"name"`
}
+
+type ResetSSHKeyForVirtualMachineParams struct {
+ p map[string]interface{}
+}
+
+func (p *ResetSSHKeyForVirtualMachineParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["account"]; found {
+ u.Set("account", v.(string))
+ }
+ if v, found := p.p["domainid"]; found {
+ u.Set("domainid", v.(string))
+ }
+ if v, found := p.p["id"]; found {
+ u.Set("id", v.(string))
+ }
+ if v, found := p.p["keypair"]; found {
+ u.Set("keypair", v.(string))
+ }
+ if v, found := p.p["projectid"]; found {
+ u.Set("projectid", v.(string))
+ }
+ return u
+}
+
+func (p *ResetSSHKeyForVirtualMachineParams) SetAccount(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["account"] = v
+ return
+}
+
+func (p *ResetSSHKeyForVirtualMachineParams) SetDomainid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["domainid"] = v
+ return
+}
+
+func (p *ResetSSHKeyForVirtualMachineParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+func (p *ResetSSHKeyForVirtualMachineParams) SetKeypair(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["keypair"] = v
+ return
+}
+
+func (p *ResetSSHKeyForVirtualMachineParams) SetProjectid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["projectid"] = v
+ return
+}
+
+// You should always use this function to get a new ResetSSHKeyForVirtualMachineParams instance,
+// as then you are sure you have configured all required params
+func (s *SSHService) NewResetSSHKeyForVirtualMachineParams(id string, keypair string) *ResetSSHKeyForVirtualMachineParams {
+ p := &ResetSSHKeyForVirtualMachineParams{}
+ p.p = make(map[string]interface{})
+ p.p["id"] = id
+ p.p["keypair"] = keypair
+ return p
+}
+
+// Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async]
+func (s *SSHService) ResetSSHKeyForVirtualMachine(p *ResetSSHKeyForVirtualMachineParams) (*ResetSSHKeyForVirtualMachineResponse, error) {
+ resp, err := s.cs.newRequest("resetSSHKeyForVirtualMachine", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r ResetSSHKeyForVirtualMachineResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ // If we have a async client, we need to wait for the async result
+ if s.cs.async {
+ b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
+ if err != nil {
+ if err == AsyncTimeoutErr {
+ return &r, err
+ }
+ return nil, err
+ }
+
+ b, err = getRawValue(b)
+ if err != nil {
+ return nil, err
+ }
+
+ if err := json.Unmarshal(b, &r); err != nil {
+ return nil, err
+ }
+ }
+
+ return &r, nil
+}
+
+type ResetSSHKeyForVirtualMachineResponse struct {
+ JobID string `json:"jobid"`
+ Account string `json:"account"`
+ Affinitygroup []struct {
+ Account string `json:"account"`
+ Description string `json:"description"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Type string `json:"type"`
+ VirtualmachineIds []string `json:"virtualmachineIds"`
+ } `json:"affinitygroup"`
+ Cpunumber int `json:"cpunumber"`
+ Cpuspeed int `json:"cpuspeed"`
+ Cpuused string `json:"cpuused"`
+ Created string `json:"created"`
+ Details map[string]string `json:"details"`
+ Diskioread int64 `json:"diskioread"`
+ Diskiowrite int64 `json:"diskiowrite"`
+ Diskkbsread int64 `json:"diskkbsread"`
+ Diskkbswrite int64 `json:"diskkbswrite"`
+ Diskofferingid string `json:"diskofferingid"`
+ Diskofferingname string `json:"diskofferingname"`
+ Displayname string `json:"displayname"`
+ Displayvm bool `json:"displayvm"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Forvirtualnetwork bool `json:"forvirtualnetwork"`
+ Group string `json:"group"`
+ Groupid string `json:"groupid"`
+ Guestosid string `json:"guestosid"`
+ Haenable bool `json:"haenable"`
+ Hostid string `json:"hostid"`
+ Hostname string `json:"hostname"`
+ Hypervisor string `json:"hypervisor"`
+ Id string `json:"id"`
+ Instancename string `json:"instancename"`
+ Isdynamicallyscalable bool `json:"isdynamicallyscalable"`
+ Isodisplaytext string `json:"isodisplaytext"`
+ Isoid string `json:"isoid"`
+ Isoname string `json:"isoname"`
+ Keypair string `json:"keypair"`
+ Memory int `json:"memory"`
+ Memoryintfreekbs int64 `json:"memoryintfreekbs"`
+ Memorykbs int64 `json:"memorykbs"`
+ Memorytargetkbs int64 `json:"memorytargetkbs"`
+ Name string `json:"name"`
+ Networkkbsread int64 `json:"networkkbsread"`
+ Networkkbswrite int64 `json:"networkkbswrite"`
+ Nic []struct {
+ Broadcasturi string `json:"broadcasturi"`
+ Deviceid string `json:"deviceid"`
+ Gateway string `json:"gateway"`
+ Id string `json:"id"`
+ Ip6address string `json:"ip6address"`
+ Ip6cidr string `json:"ip6cidr"`
+ Ip6gateway string `json:"ip6gateway"`
+ Ipaddress string `json:"ipaddress"`
+ Isdefault bool `json:"isdefault"`
+ Isolationuri string `json:"isolationuri"`
+ Macaddress string `json:"macaddress"`
+ Netmask string `json:"netmask"`
+ Networkid string `json:"networkid"`
+ Networkname string `json:"networkname"`
+ Nsxlogicalswitch string `json:"nsxlogicalswitch"`
+ Nsxlogicalswitchport string `json:"nsxlogicalswitchport"`
+ Secondaryip []struct {
+ Id string `json:"id"`
+ Ipaddress string `json:"ipaddress"`
+ } `json:"secondaryip"`
+ Traffictype string `json:"traffictype"`
+ Type string `json:"type"`
+ Virtualmachineid string `json:"virtualmachineid"`
+ } `json:"nic"`
+ Ostypeid int64 `json:"ostypeid"`
+ Password string `json:"password"`
+ Passwordenabled bool `json:"passwordenabled"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Publicip string `json:"publicip"`
+ Publicipid string `json:"publicipid"`
+ Rootdeviceid int64 `json:"rootdeviceid"`
+ Rootdevicetype string `json:"rootdevicetype"`
+ Securitygroup []struct {
+ Account string `json:"account"`
+ Description string `json:"description"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Egressrule []struct {
+ Account string `json:"account"`
+ Cidr string `json:"cidr"`
+ Endport int `json:"endport"`
+ Icmpcode int `json:"icmpcode"`
+ Icmptype int `json:"icmptype"`
+ Protocol string `json:"protocol"`
+ Ruleid string `json:"ruleid"`
+ Securitygroupname string `json:"securitygroupname"`
+ Startport int `json:"startport"`
+ Tags []struct {
+ Account string `json:"account"`
+ Customer string `json:"customer"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Key string `json:"key"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Resourceid string `json:"resourceid"`
+ Resourcetype string `json:"resourcetype"`
+ Value string `json:"value"`
+ } `json:"tags"`
+ } `json:"egressrule"`
+ Id string `json:"id"`
+ Ingressrule []struct {
+ Account string `json:"account"`
+ Cidr string `json:"cidr"`
+ Endport int `json:"endport"`
+ Icmpcode int `json:"icmpcode"`
+ Icmptype int `json:"icmptype"`
+ Protocol string `json:"protocol"`
+ Ruleid string `json:"ruleid"`
+ Securitygroupname string `json:"securitygroupname"`
+ Startport int `json:"startport"`
+ Tags []struct {
+ Account string `json:"account"`
+ Customer string `json:"customer"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Key string `json:"key"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Resourceid string `json:"resourceid"`
+ Resourcetype string `json:"resourcetype"`
+ Value string `json:"value"`
+ } `json:"tags"`
+ } `json:"ingressrule"`
+ Name string `json:"name"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Tags []struct {
+ Account string `json:"account"`
+ Customer string `json:"customer"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Key string `json:"key"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ Resourceid string `json:"resourceid"`
+ Resourcetype string `json:"resourcetype"`
+ Value string `json:"value"`
+ } `json:"tags"`
+ Virtualmachinecount int `json:"virtualmachinecount"`
+ Virtualmachineids []interface{} `json:"virtualmachineids"`
+ } `json:"securitygroup"`
+ Serviceofferingid string `json:"serviceofferingid"`
+ Serviceofferingname string `json:"serviceofferingname"`
+ Servicestate string `json:"servicestate"`
+ State string `json:"state"`
+ Templatedisplaytext string `json:"templatedisplaytext"`
+ Templateid string `json:"templateid"`
+ Templatename string `json:"templatename"`
+ Userid string `json:"userid"`
+ Username string `json:"username"`
+ Vgpu string `json:"vgpu"`
+ Zoneid string `json:"zoneid"`
+ Zonename string `json:"zonename"`
+}
diff --git a/cloudstack/StratosphereSSP.go b/cloudstack/StratosphereSSP.go
deleted file mode 100644
index 1b3dad7..0000000
--- a/cloudstack/StratosphereSSP.go
+++ /dev/null
@@ -1,185 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package cloudstack
-
-import (
- "encoding/json"
- "net/url"
-)
-
-type AddStratosphereSspParams struct {
- p map[string]interface{}
-}
-
-func (p *AddStratosphereSspParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["password"]; found {
- u.Set("password", v.(string))
- }
- if v, found := p.p["tenantuuid"]; found {
- u.Set("tenantuuid", v.(string))
- }
- if v, found := p.p["url"]; found {
- u.Set("url", v.(string))
- }
- if v, found := p.p["username"]; found {
- u.Set("username", v.(string))
- }
- if v, found := p.p["zoneid"]; found {
- u.Set("zoneid", v.(string))
- }
- return u
-}
-
-func (p *AddStratosphereSspParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *AddStratosphereSspParams) SetPassword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["password"] = v
- return
-}
-
-func (p *AddStratosphereSspParams) SetTenantuuid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["tenantuuid"] = v
- return
-}
-
-func (p *AddStratosphereSspParams) SetUrl(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["url"] = v
- return
-}
-
-func (p *AddStratosphereSspParams) SetUsername(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["username"] = v
- return
-}
-
-func (p *AddStratosphereSspParams) SetZoneid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["zoneid"] = v
- return
-}
-
-// You should always use this function to get a new AddStratosphereSspParams instance,
-// as then you are sure you have configured all required params
-func (s *StratosphereSSP) NewAddStratosphereSspParams(name string, url string, zoneid string) *AddStratosphereSspParams {
- p := &AddStratosphereSspParams{}
- p.p = make(map[string]interface{})
- p.p["name"] = name
- p.p["url"] = url
- p.p["zoneid"] = zoneid
- return p
-}
-
-// Adds stratosphere ssp server
-func (s *StratosphereSSP) AddStratosphereSsp(p *AddStratosphereSspParams) (*AddStratosphereSspResponse, error) {
- resp, err := s.cs.newRequest("addStratosphereSsp", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r AddStratosphereSspResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type AddStratosphereSspResponse struct {
- Hostid string `json:"hostid"`
- Name string `json:"name"`
- Url string `json:"url"`
- Zoneid string `json:"zoneid"`
-}
-
-type DeleteStratosphereSspParams struct {
- p map[string]interface{}
-}
-
-func (p *DeleteStratosphereSspParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["hostid"]; found {
- u.Set("hostid", v.(string))
- }
- return u
-}
-
-func (p *DeleteStratosphereSspParams) SetHostid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["hostid"] = v
- return
-}
-
-// You should always use this function to get a new DeleteStratosphereSspParams instance,
-// as then you are sure you have configured all required params
-func (s *StratosphereSSP) NewDeleteStratosphereSspParams(hostid string) *DeleteStratosphereSspParams {
- p := &DeleteStratosphereSspParams{}
- p.p = make(map[string]interface{})
- p.p["hostid"] = hostid
- return p
-}
-
-// Removes stratosphere ssp server
-func (s *StratosphereSSP) DeleteStratosphereSsp(p *DeleteStratosphereSspParams) (*DeleteStratosphereSspResponse, error) {
- resp, err := s.cs.newRequest("deleteStratosphereSsp", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r DeleteStratosphereSspResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type DeleteStratosphereSspResponse struct {
- Displaytext string `json:"displaytext"`
- Success string `json:"success"`
-}
diff --git a/cloudstack/StratosphereSSPService.go b/cloudstack/StratosphereSSPService.go
index 1b4a1ba..c89363b 100644
--- a/cloudstack/StratosphereSSPService.go
+++ b/cloudstack/StratosphereSSPService.go
@@ -1,5 +1,5 @@
//
-// Copyright 2017, Sander van Harmelen
+// Copyright 2018, Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -131,3 +131,55 @@
Url string `json:"url"`
Zoneid string `json:"zoneid"`
}
+
+type DeleteStratosphereSspParams struct {
+ p map[string]interface{}
+}
+
+func (p *DeleteStratosphereSspParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["hostid"]; found {
+ u.Set("hostid", v.(string))
+ }
+ return u
+}
+
+func (p *DeleteStratosphereSspParams) SetHostid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["hostid"] = v
+ return
+}
+
+// You should always use this function to get a new DeleteStratosphereSspParams instance,
+// as then you are sure you have configured all required params
+func (s *StratosphereSSPService) NewDeleteStratosphereSspParams(hostid string) *DeleteStratosphereSspParams {
+ p := &DeleteStratosphereSspParams{}
+ p.p = make(map[string]interface{})
+ p.p["hostid"] = hostid
+ return p
+}
+
+// Removes stratosphere ssp server
+func (s *StratosphereSSPService) DeleteStratosphereSsp(p *DeleteStratosphereSspParams) (*DeleteStratosphereSspResponse, error) {
+ resp, err := s.cs.newRequest("deleteStratosphereSsp", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r DeleteStratosphereSspResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type DeleteStratosphereSspResponse struct {
+ Displaytext string `json:"displaytext"`
+ Success string `json:"success"`
+}
diff --git a/cloudstack/UserService.go b/cloudstack/UserService.go
index 36f655a..e70000c 100644
--- a/cloudstack/UserService.go
+++ b/cloudstack/UserService.go
@@ -24,130 +24,6 @@
"strings"
)
-type AddVpnUserParams struct {
- p map[string]interface{}
-}
-
-func (p *AddVpnUserParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["password"]; found {
- u.Set("password", v.(string))
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["username"]; found {
- u.Set("username", v.(string))
- }
- return u
-}
-
-func (p *AddVpnUserParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *AddVpnUserParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *AddVpnUserParams) SetPassword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["password"] = v
- return
-}
-
-func (p *AddVpnUserParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *AddVpnUserParams) SetUsername(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["username"] = v
- return
-}
-
-// You should always use this function to get a new AddVpnUserParams instance,
-// as then you are sure you have configured all required params
-func (s *UserService) NewAddVpnUserParams(password string, username string) *AddVpnUserParams {
- p := &AddVpnUserParams{}
- p.p = make(map[string]interface{})
- p.p["password"] = password
- p.p["username"] = username
- return p
-}
-
-// Adds vpn users
-func (s *UserService) AddVpnUser(p *AddVpnUserParams) (*AddVpnUserResponse, error) {
- resp, err := s.cs.newRequest("addVpnUser", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r AddVpnUserResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type AddVpnUserResponse struct {
- JobID string `json:"jobid"`
- Account string `json:"account"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Id string `json:"id"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- State string `json:"state"`
- Username string `json:"username"`
-}
-
type CreateUserParams struct {
p map[string]interface{}
}
@@ -650,263 +526,6 @@
Virtualmachineid string `json:"virtualmachineid"`
}
-type ImportLdapUsersParams struct {
- p map[string]interface{}
-}
-
-func (p *ImportLdapUsersParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["accountdetails"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("accountdetails[%d].key", i), k)
- u.Set(fmt.Sprintf("accountdetails[%d].value", i), vv)
- i++
- }
- }
- if v, found := p.p["accounttype"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("accounttype", vv)
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["group"]; found {
- u.Set("group", v.(string))
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["roleid"]; found {
- u.Set("roleid", v.(string))
- }
- if v, found := p.p["timezone"]; found {
- u.Set("timezone", v.(string))
- }
- return u
-}
-
-func (p *ImportLdapUsersParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetAccountdetails(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["accountdetails"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetAccounttype(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["accounttype"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetGroup(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["group"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetRoleid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["roleid"] = v
- return
-}
-
-func (p *ImportLdapUsersParams) SetTimezone(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["timezone"] = v
- return
-}
-
-// You should always use this function to get a new ImportLdapUsersParams instance,
-// as then you are sure you have configured all required params
-func (s *UserService) NewImportLdapUsersParams() *ImportLdapUsersParams {
- p := &ImportLdapUsersParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Import LDAP users
-func (s *UserService) ImportLdapUsers(p *ImportLdapUsersParams) (*ImportLdapUsersResponse, error) {
- resp, err := s.cs.newRequest("importLdapUsers", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ImportLdapUsersResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ImportLdapUsersResponse struct {
- Domain string `json:"domain"`
- Email string `json:"email"`
- Firstname string `json:"firstname"`
- Lastname string `json:"lastname"`
- Principal string `json:"principal"`
- Username string `json:"username"`
-}
-
-type ListLdapUsersParams struct {
- p map[string]interface{}
-}
-
-func (p *ListLdapUsersParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["listtype"]; found {
- u.Set("listtype", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- return u
-}
-
-func (p *ListLdapUsersParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListLdapUsersParams) SetListtype(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["listtype"] = v
- return
-}
-
-func (p *ListLdapUsersParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListLdapUsersParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-// You should always use this function to get a new ListLdapUsersParams instance,
-// as then you are sure you have configured all required params
-func (s *UserService) NewListLdapUsersParams() *ListLdapUsersParams {
- p := &ListLdapUsersParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// Lists all LDAP Users
-func (s *UserService) ListLdapUsers(p *ListLdapUsersParams) (*ListLdapUsersResponse, error) {
- resp, err := s.cs.newRequest("listLdapUsers", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListLdapUsersResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListLdapUsersResponse struct {
- Count int `json:"count"`
- LdapUsers []*LdapUser `json:"ldapuser"`
-}
-
-type LdapUser struct {
- Domain string `json:"domain"`
- Email string `json:"email"`
- Firstname string `json:"firstname"`
- Lastname string `json:"lastname"`
- Principal string `json:"principal"`
- Username string `json:"username"`
-}
-
type ListUsersParams struct {
p map[string]interface{}
}
@@ -1129,204 +748,6 @@
Username string `json:"username"`
}
-type ListVpnUsersParams struct {
- p map[string]interface{}
-}
-
-func (p *ListVpnUsersParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["isrecursive"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("isrecursive", vv)
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["listall"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("listall", vv)
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["username"]; found {
- u.Set("username", v.(string))
- }
- return u
-}
-
-func (p *ListVpnUsersParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetIsrecursive(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["isrecursive"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetListall(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["listall"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *ListVpnUsersParams) SetUsername(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["username"] = v
- return
-}
-
-// You should always use this function to get a new ListVpnUsersParams instance,
-// as then you are sure you have configured all required params
-func (s *UserService) NewListVpnUsersParams() *ListVpnUsersParams {
- p := &ListVpnUsersParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *UserService) GetVpnUserByID(id string, opts ...OptionFunc) (*VpnUser, int, error) {
- p := &ListVpnUsersParams{}
- 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.ListVpnUsers(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.VpnUsers[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for VpnUser UUID: %s!", id)
-}
-
-// Lists vpn users
-func (s *UserService) ListVpnUsers(p *ListVpnUsersParams) (*ListVpnUsersResponse, error) {
- resp, err := s.cs.newRequest("listVpnUsers", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListVpnUsersResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListVpnUsersResponse struct {
- Count int `json:"count"`
- VpnUsers []*VpnUser `json:"vpnuser"`
-}
-
-type VpnUser struct {
- Account string `json:"account"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Id string `json:"id"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- State string `json:"state"`
- Username string `json:"username"`
-}
-
type LockUserParams struct {
p map[string]interface{}
}
@@ -1453,107 +874,6 @@
Secretkey string `json:"secretkey"`
}
-type RemoveVpnUserParams struct {
- p map[string]interface{}
-}
-
-func (p *RemoveVpnUserParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["username"]; found {
- u.Set("username", v.(string))
- }
- return u
-}
-
-func (p *RemoveVpnUserParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *RemoveVpnUserParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *RemoveVpnUserParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *RemoveVpnUserParams) SetUsername(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["username"] = v
- return
-}
-
-// You should always use this function to get a new RemoveVpnUserParams instance,
-// as then you are sure you have configured all required params
-func (s *UserService) NewRemoveVpnUserParams(username string) *RemoveVpnUserParams {
- p := &RemoveVpnUserParams{}
- p.p = make(map[string]interface{})
- p.p["username"] = username
- return p
-}
-
-// Removes vpn user
-func (s *UserService) RemoveVpnUser(p *RemoveVpnUserParams) (*RemoveVpnUserResponse, error) {
- resp, err := s.cs.newRequest("removeVpnUser", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r RemoveVpnUserResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type RemoveVpnUserResponse struct {
- JobID string `json:"jobid"`
- Displaytext string `json:"displaytext"`
- Success bool `json:"success"`
-}
-
type UpdateUserParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/VPNService.go b/cloudstack/VPNService.go
index 68e0779..796de85 100644
--- a/cloudstack/VPNService.go
+++ b/cloudstack/VPNService.go
@@ -24,6 +24,130 @@
"strings"
)
+type AddVpnUserParams struct {
+ p map[string]interface{}
+}
+
+func (p *AddVpnUserParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["account"]; found {
+ u.Set("account", v.(string))
+ }
+ if v, found := p.p["domainid"]; found {
+ u.Set("domainid", v.(string))
+ }
+ if v, found := p.p["password"]; found {
+ u.Set("password", v.(string))
+ }
+ if v, found := p.p["projectid"]; found {
+ u.Set("projectid", v.(string))
+ }
+ if v, found := p.p["username"]; found {
+ u.Set("username", v.(string))
+ }
+ return u
+}
+
+func (p *AddVpnUserParams) SetAccount(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["account"] = v
+ return
+}
+
+func (p *AddVpnUserParams) SetDomainid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["domainid"] = v
+ return
+}
+
+func (p *AddVpnUserParams) SetPassword(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["password"] = v
+ return
+}
+
+func (p *AddVpnUserParams) SetProjectid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["projectid"] = v
+ return
+}
+
+func (p *AddVpnUserParams) SetUsername(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["username"] = v
+ return
+}
+
+// You should always use this function to get a new AddVpnUserParams instance,
+// as then you are sure you have configured all required params
+func (s *VPNService) NewAddVpnUserParams(password string, username string) *AddVpnUserParams {
+ p := &AddVpnUserParams{}
+ p.p = make(map[string]interface{})
+ p.p["password"] = password
+ p.p["username"] = username
+ return p
+}
+
+// Adds vpn users
+func (s *VPNService) AddVpnUser(p *AddVpnUserParams) (*AddVpnUserResponse, error) {
+ resp, err := s.cs.newRequest("addVpnUser", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r AddVpnUserResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ // If we have a async client, we need to wait for the async result
+ if s.cs.async {
+ b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
+ if err != nil {
+ if err == AsyncTimeoutErr {
+ return &r, err
+ }
+ return nil, err
+ }
+
+ b, err = getRawValue(b)
+ if err != nil {
+ return nil, err
+ }
+
+ if err := json.Unmarshal(b, &r); err != nil {
+ return nil, err
+ }
+ }
+
+ return &r, nil
+}
+
+type AddVpnUserResponse struct {
+ JobID string `json:"jobid"`
+ Account string `json:"account"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Id string `json:"id"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ State string `json:"state"`
+ Username string `json:"username"`
+}
+
type CreateRemoteAccessVpnParams struct {
p map[string]interface{}
}
@@ -1797,6 +1921,305 @@
Vpcid string `json:"vpcid"`
}
+type ListVpnUsersParams struct {
+ p map[string]interface{}
+}
+
+func (p *ListVpnUsersParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["account"]; found {
+ u.Set("account", v.(string))
+ }
+ if v, found := p.p["domainid"]; found {
+ u.Set("domainid", v.(string))
+ }
+ if v, found := p.p["id"]; found {
+ u.Set("id", v.(string))
+ }
+ if v, found := p.p["isrecursive"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("isrecursive", vv)
+ }
+ if v, found := p.p["keyword"]; found {
+ u.Set("keyword", v.(string))
+ }
+ if v, found := p.p["listall"]; found {
+ vv := strconv.FormatBool(v.(bool))
+ u.Set("listall", vv)
+ }
+ if v, found := p.p["page"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("page", vv)
+ }
+ if v, found := p.p["pagesize"]; found {
+ vv := strconv.Itoa(v.(int))
+ u.Set("pagesize", vv)
+ }
+ if v, found := p.p["projectid"]; found {
+ u.Set("projectid", v.(string))
+ }
+ if v, found := p.p["username"]; found {
+ u.Set("username", v.(string))
+ }
+ return u
+}
+
+func (p *ListVpnUsersParams) SetAccount(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["account"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetDomainid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["domainid"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetId(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["id"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetIsrecursive(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["isrecursive"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetKeyword(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["keyword"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetListall(v bool) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["listall"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetPage(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["page"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetPagesize(v int) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["pagesize"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetProjectid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["projectid"] = v
+ return
+}
+
+func (p *ListVpnUsersParams) SetUsername(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["username"] = v
+ return
+}
+
+// You should always use this function to get a new ListVpnUsersParams instance,
+// as then you are sure you have configured all required params
+func (s *VPNService) NewListVpnUsersParams() *ListVpnUsersParams {
+ p := &ListVpnUsersParams{}
+ p.p = make(map[string]interface{})
+ return p
+}
+
+// This is a courtesy helper function, which in some cases may not work as expected!
+func (s *VPNService) GetVpnUserByID(id string, opts ...OptionFunc) (*VpnUser, int, error) {
+ p := &ListVpnUsersParams{}
+ 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.ListVpnUsers(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.VpnUsers[0], l.Count, nil
+ }
+ return nil, l.Count, fmt.Errorf("There is more then one result for VpnUser UUID: %s!", id)
+}
+
+// Lists vpn users
+func (s *VPNService) ListVpnUsers(p *ListVpnUsersParams) (*ListVpnUsersResponse, error) {
+ resp, err := s.cs.newRequest("listVpnUsers", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r ListVpnUsersResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ return &r, nil
+}
+
+type ListVpnUsersResponse struct {
+ Count int `json:"count"`
+ VpnUsers []*VpnUser `json:"vpnuser"`
+}
+
+type VpnUser struct {
+ Account string `json:"account"`
+ Domain string `json:"domain"`
+ Domainid string `json:"domainid"`
+ Id string `json:"id"`
+ Project string `json:"project"`
+ Projectid string `json:"projectid"`
+ State string `json:"state"`
+ Username string `json:"username"`
+}
+
+type RemoveVpnUserParams struct {
+ p map[string]interface{}
+}
+
+func (p *RemoveVpnUserParams) toURLValues() url.Values {
+ u := url.Values{}
+ if p.p == nil {
+ return u
+ }
+ if v, found := p.p["account"]; found {
+ u.Set("account", v.(string))
+ }
+ if v, found := p.p["domainid"]; found {
+ u.Set("domainid", v.(string))
+ }
+ if v, found := p.p["projectid"]; found {
+ u.Set("projectid", v.(string))
+ }
+ if v, found := p.p["username"]; found {
+ u.Set("username", v.(string))
+ }
+ return u
+}
+
+func (p *RemoveVpnUserParams) SetAccount(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["account"] = v
+ return
+}
+
+func (p *RemoveVpnUserParams) SetDomainid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["domainid"] = v
+ return
+}
+
+func (p *RemoveVpnUserParams) SetProjectid(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["projectid"] = v
+ return
+}
+
+func (p *RemoveVpnUserParams) SetUsername(v string) {
+ if p.p == nil {
+ p.p = make(map[string]interface{})
+ }
+ p.p["username"] = v
+ return
+}
+
+// You should always use this function to get a new RemoveVpnUserParams instance,
+// as then you are sure you have configured all required params
+func (s *VPNService) NewRemoveVpnUserParams(username string) *RemoveVpnUserParams {
+ p := &RemoveVpnUserParams{}
+ p.p = make(map[string]interface{})
+ p.p["username"] = username
+ return p
+}
+
+// Removes vpn user
+func (s *VPNService) RemoveVpnUser(p *RemoveVpnUserParams) (*RemoveVpnUserResponse, error) {
+ resp, err := s.cs.newRequest("removeVpnUser", p.toURLValues())
+ if err != nil {
+ return nil, err
+ }
+
+ var r RemoveVpnUserResponse
+ if err := json.Unmarshal(resp, &r); err != nil {
+ return nil, err
+ }
+
+ // If we have a async client, we need to wait for the async result
+ if s.cs.async {
+ b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
+ if err != nil {
+ if err == AsyncTimeoutErr {
+ return &r, err
+ }
+ return nil, err
+ }
+
+ if err := json.Unmarshal(b, &r); err != nil {
+ return nil, err
+ }
+ }
+
+ return &r, nil
+}
+
+type RemoveVpnUserResponse struct {
+ JobID string `json:"jobid"`
+ Displaytext string `json:"displaytext"`
+ Success bool `json:"success"`
+}
+
type ResetVpnConnectionParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/VirtualMachineService.go b/cloudstack/VirtualMachineService.go
index 23d6488..de873e1 100644
--- a/cloudstack/VirtualMachineService.go
+++ b/cloudstack/VirtualMachineService.go
@@ -1791,394 +1791,6 @@
Encryptedpassword string `json:"encryptedpassword"`
}
-type ListInternalLoadBalancerVMsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListInternalLoadBalancerVMsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["forvpc"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("forvpc", vv)
- }
- if v, found := p.p["hostid"]; found {
- u.Set("hostid", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["isrecursive"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("isrecursive", vv)
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["listall"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("listall", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["networkid"]; found {
- u.Set("networkid", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["podid"]; found {
- u.Set("podid", v.(string))
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["state"]; found {
- u.Set("state", v.(string))
- }
- if v, found := p.p["vpcid"]; found {
- u.Set("vpcid", v.(string))
- }
- if v, found := p.p["zoneid"]; found {
- u.Set("zoneid", v.(string))
- }
- return u
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetForvpc(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["forvpc"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetHostid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["hostid"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetIsrecursive(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["isrecursive"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetListall(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["listall"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetNetworkid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkid"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetPodid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["podid"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetState(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["state"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetVpcid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["vpcid"] = v
- return
-}
-
-func (p *ListInternalLoadBalancerVMsParams) SetZoneid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["zoneid"] = v
- return
-}
-
-// You should always use this function to get a new ListInternalLoadBalancerVMsParams instance,
-// as then you are sure you have configured all required params
-func (s *VirtualMachineService) NewListInternalLoadBalancerVMsParams() *ListInternalLoadBalancerVMsParams {
- p := &ListInternalLoadBalancerVMsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *VirtualMachineService) GetInternalLoadBalancerVMID(name string, opts ...OptionFunc) (string, int, error) {
- p := &ListInternalLoadBalancerVMsParams{}
- p.p = make(map[string]interface{})
-
- p.p["name"] = name
-
- for _, fn := range append(s.cs.options, opts...) {
- if err := fn(s.cs, p); err != nil {
- return "", -1, err
- }
- }
-
- l, err := s.ListInternalLoadBalancerVMs(p)
- if err != nil {
- return "", -1, err
- }
-
- if l.Count == 0 {
- return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
- }
-
- if l.Count == 1 {
- return l.InternalLoadBalancerVMs[0].Id, l.Count, nil
- }
-
- if l.Count > 1 {
- for _, v := range l.InternalLoadBalancerVMs {
- if v.Name == name {
- return v.Id, l.Count, nil
- }
- }
- }
- return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *VirtualMachineService) GetInternalLoadBalancerVMByName(name string, opts ...OptionFunc) (*InternalLoadBalancerVM, int, error) {
- id, count, err := s.GetInternalLoadBalancerVMID(name, opts...)
- if err != nil {
- return nil, count, err
- }
-
- r, count, err := s.GetInternalLoadBalancerVMByID(id, opts...)
- if err != nil {
- return nil, count, err
- }
- return r, count, nil
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *VirtualMachineService) GetInternalLoadBalancerVMByID(id string, opts ...OptionFunc) (*InternalLoadBalancerVM, int, error) {
- p := &ListInternalLoadBalancerVMsParams{}
- 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.ListInternalLoadBalancerVMs(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.InternalLoadBalancerVMs[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for InternalLoadBalancerVM UUID: %s!", id)
-}
-
-// List internal LB VMs.
-func (s *VirtualMachineService) ListInternalLoadBalancerVMs(p *ListInternalLoadBalancerVMsParams) (*ListInternalLoadBalancerVMsResponse, error) {
- resp, err := s.cs.newRequest("listInternalLoadBalancerVMs", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListInternalLoadBalancerVMsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListInternalLoadBalancerVMsResponse struct {
- Count int `json:"count"`
- InternalLoadBalancerVMs []*InternalLoadBalancerVM `json:"internalloadbalancervm"`
-}
-
-type InternalLoadBalancerVM struct {
- Account string `json:"account"`
- Created string `json:"created"`
- Dns1 string `json:"dns1"`
- Dns2 string `json:"dns2"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Gateway string `json:"gateway"`
- Guestipaddress string `json:"guestipaddress"`
- Guestmacaddress string `json:"guestmacaddress"`
- Guestnetmask string `json:"guestnetmask"`
- Guestnetworkid string `json:"guestnetworkid"`
- Guestnetworkname string `json:"guestnetworkname"`
- Hostid string `json:"hostid"`
- Hostname string `json:"hostname"`
- Hypervisor string `json:"hypervisor"`
- Id string `json:"id"`
- Ip6dns1 string `json:"ip6dns1"`
- Ip6dns2 string `json:"ip6dns2"`
- Isredundantrouter bool `json:"isredundantrouter"`
- Linklocalip string `json:"linklocalip"`
- Linklocalmacaddress string `json:"linklocalmacaddress"`
- Linklocalnetmask string `json:"linklocalnetmask"`
- Linklocalnetworkid string `json:"linklocalnetworkid"`
- Name string `json:"name"`
- Networkdomain string `json:"networkdomain"`
- Nic []struct {
- Broadcasturi string `json:"broadcasturi"`
- Deviceid string `json:"deviceid"`
- Gateway string `json:"gateway"`
- Id string `json:"id"`
- Ip6address string `json:"ip6address"`
- Ip6cidr string `json:"ip6cidr"`
- Ip6gateway string `json:"ip6gateway"`
- Ipaddress string `json:"ipaddress"`
- Isdefault bool `json:"isdefault"`
- Isolationuri string `json:"isolationuri"`
- Macaddress string `json:"macaddress"`
- Netmask string `json:"netmask"`
- Networkid string `json:"networkid"`
- Networkname string `json:"networkname"`
- Nsxlogicalswitch string `json:"nsxlogicalswitch"`
- Nsxlogicalswitchport string `json:"nsxlogicalswitchport"`
- Secondaryip []struct {
- Id string `json:"id"`
- Ipaddress string `json:"ipaddress"`
- } `json:"secondaryip"`
- Traffictype string `json:"traffictype"`
- Type string `json:"type"`
- Virtualmachineid string `json:"virtualmachineid"`
- } `json:"nic"`
- Podid string `json:"podid"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Publicip string `json:"publicip"`
- Publicmacaddress string `json:"publicmacaddress"`
- Publicnetmask string `json:"publicnetmask"`
- Publicnetworkid string `json:"publicnetworkid"`
- Redundantstate string `json:"redundantstate"`
- Requiresupgrade bool `json:"requiresupgrade"`
- Role string `json:"role"`
- Scriptsversion string `json:"scriptsversion"`
- Serviceofferingid string `json:"serviceofferingid"`
- Serviceofferingname string `json:"serviceofferingname"`
- State string `json:"state"`
- Templateid string `json:"templateid"`
- Version string `json:"version"`
- Vpcid string `json:"vpcid"`
- Vpcname string `json:"vpcname"`
- Zoneid string `json:"zoneid"`
- Zonename string `json:"zonename"`
-}
-
type ListVirtualMachinesParams struct {
p map[string]interface{}
}
@@ -2823,442 +2435,6 @@
Zonename string `json:"zonename"`
}
-type ListVirtualMachinesMetricsParams struct {
- p map[string]interface{}
-}
-
-func (p *ListVirtualMachinesMetricsParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["affinitygroupid"]; found {
- u.Set("affinitygroupid", v.(string))
- }
- if v, found := p.p["details"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("details", vv)
- }
- if v, found := p.p["displayvm"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("displayvm", vv)
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["forvirtualnetwork"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("forvirtualnetwork", vv)
- }
- if v, found := p.p["groupid"]; found {
- u.Set("groupid", v.(string))
- }
- if v, found := p.p["hostid"]; found {
- u.Set("hostid", v.(string))
- }
- if v, found := p.p["hostid"]; found {
- u.Set("hostid", v.(string))
- }
- if v, found := p.p["hypervisor"]; found {
- u.Set("hypervisor", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["ids"]; found {
- vv := strings.Join(v.([]string), ",")
- u.Set("ids", vv)
- }
- if v, found := p.p["isoid"]; found {
- u.Set("isoid", v.(string))
- }
- if v, found := p.p["isrecursive"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("isrecursive", vv)
- }
- if v, found := p.p["keypair"]; found {
- u.Set("keypair", v.(string))
- }
- if v, found := p.p["keyword"]; found {
- u.Set("keyword", v.(string))
- }
- if v, found := p.p["listall"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("listall", vv)
- }
- if v, found := p.p["name"]; found {
- u.Set("name", v.(string))
- }
- if v, found := p.p["networkid"]; found {
- u.Set("networkid", v.(string))
- }
- if v, found := p.p["page"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("page", vv)
- }
- if v, found := p.p["pagesize"]; found {
- vv := strconv.Itoa(v.(int))
- u.Set("pagesize", vv)
- }
- if v, found := p.p["podid"]; found {
- u.Set("podid", v.(string))
- }
- if v, found := p.p["podid"]; found {
- u.Set("podid", v.(string))
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- if v, found := p.p["serviceofferingid"]; found {
- u.Set("serviceofferingid", v.(string))
- }
- if v, found := p.p["state"]; found {
- u.Set("state", v.(string))
- }
- if v, found := p.p["storageid"]; found {
- u.Set("storageid", v.(string))
- }
- if v, found := p.p["storageid"]; found {
- u.Set("storageid", v.(string))
- }
- if v, found := p.p["tags"]; found {
- i := 0
- for k, vv := range v.(map[string]string) {
- u.Set(fmt.Sprintf("tags[%d].key", i), k)
- u.Set(fmt.Sprintf("tags[%d].value", i), vv)
- i++
- }
- }
- if v, found := p.p["templateid"]; found {
- u.Set("templateid", v.(string))
- }
- if v, found := p.p["userid"]; found {
- u.Set("userid", v.(string))
- }
- if v, found := p.p["vpcid"]; found {
- u.Set("vpcid", v.(string))
- }
- if v, found := p.p["zoneid"]; found {
- u.Set("zoneid", v.(string))
- }
- return u
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetAffinitygroupid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["affinitygroupid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetDetails(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["details"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetDisplayvm(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["displayvm"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetForvirtualnetwork(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["forvirtualnetwork"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetGroupid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["groupid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetHostid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["hostid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetHypervisor(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["hypervisor"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetIds(v []string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["ids"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetIsoid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["isoid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetIsrecursive(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["isrecursive"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetKeypair(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keypair"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetKeyword(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keyword"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetListall(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["listall"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetName(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["name"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetNetworkid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["networkid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetPage(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["page"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetPagesize(v int) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["pagesize"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetPodid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["podid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetServiceofferingid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["serviceofferingid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetState(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["state"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetStorageid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["storageid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetTags(v map[string]string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["tags"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetTemplateid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["templateid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetUserid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["userid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetVpcid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["vpcid"] = v
- return
-}
-
-func (p *ListVirtualMachinesMetricsParams) SetZoneid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["zoneid"] = v
- return
-}
-
-// You should always use this function to get a new ListVirtualMachinesMetricsParams instance,
-// as then you are sure you have configured all required params
-func (s *VirtualMachineService) NewListVirtualMachinesMetricsParams() *ListVirtualMachinesMetricsParams {
- p := &ListVirtualMachinesMetricsParams{}
- p.p = make(map[string]interface{})
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *VirtualMachineService) GetVirtualMachinesMetricByID(id string, opts ...OptionFunc) (*VirtualMachinesMetric, int, error) {
- p := &ListVirtualMachinesMetricsParams{}
- 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.ListVirtualMachinesMetrics(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.VirtualMachinesMetrics[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for VirtualMachinesMetric UUID: %s!", id)
-}
-
-// Lists VM metrics
-func (s *VirtualMachineService) ListVirtualMachinesMetrics(p *ListVirtualMachinesMetricsParams) (*ListVirtualMachinesMetricsResponse, error) {
- resp, err := s.cs.newRequest("listVirtualMachinesMetrics", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListVirtualMachinesMetricsResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListVirtualMachinesMetricsResponse struct {
- Count int `json:"count"`
- VirtualMachinesMetrics []*VirtualMachinesMetric `json:"virtualmachinesmetric"`
-}
-
-type VirtualMachinesMetric struct {
- Cputotal string `json:"cputotal"`
- Diskiopstotal int64 `json:"diskiopstotal"`
- Diskread string `json:"diskread"`
- Diskwrite string `json:"diskwrite"`
- Ipaddress string `json:"ipaddress"`
- Memorytotal string `json:"memorytotal"`
- Networkread string `json:"networkread"`
- Networkwrite string `json:"networkwrite"`
-}
-
type MigrateVirtualMachineParams struct {
p map[string]interface{}
}
@@ -4722,288 +3898,6 @@
Zonename string `json:"zonename"`
}
-type ResetSSHKeyForVirtualMachineParams struct {
- p map[string]interface{}
-}
-
-func (p *ResetSSHKeyForVirtualMachineParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["account"]; found {
- u.Set("account", v.(string))
- }
- if v, found := p.p["domainid"]; found {
- u.Set("domainid", v.(string))
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- if v, found := p.p["keypair"]; found {
- u.Set("keypair", v.(string))
- }
- if v, found := p.p["projectid"]; found {
- u.Set("projectid", v.(string))
- }
- return u
-}
-
-func (p *ResetSSHKeyForVirtualMachineParams) SetAccount(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["account"] = v
- return
-}
-
-func (p *ResetSSHKeyForVirtualMachineParams) SetDomainid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["domainid"] = v
- return
-}
-
-func (p *ResetSSHKeyForVirtualMachineParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-func (p *ResetSSHKeyForVirtualMachineParams) SetKeypair(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["keypair"] = v
- return
-}
-
-func (p *ResetSSHKeyForVirtualMachineParams) SetProjectid(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["projectid"] = v
- return
-}
-
-// You should always use this function to get a new ResetSSHKeyForVirtualMachineParams instance,
-// as then you are sure you have configured all required params
-func (s *VirtualMachineService) NewResetSSHKeyForVirtualMachineParams(id string, keypair string) *ResetSSHKeyForVirtualMachineParams {
- p := &ResetSSHKeyForVirtualMachineParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- p.p["keypair"] = keypair
- return p
-}
-
-// Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async]
-func (s *VirtualMachineService) ResetSSHKeyForVirtualMachine(p *ResetSSHKeyForVirtualMachineParams) (*ResetSSHKeyForVirtualMachineResponse, error) {
- resp, err := s.cs.newRequest("resetSSHKeyForVirtualMachine", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ResetSSHKeyForVirtualMachineResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type ResetSSHKeyForVirtualMachineResponse struct {
- JobID string `json:"jobid"`
- Account string `json:"account"`
- Affinitygroup []struct {
- Account string `json:"account"`
- Description string `json:"description"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Id string `json:"id"`
- Name string `json:"name"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Type string `json:"type"`
- VirtualmachineIds []string `json:"virtualmachineIds"`
- } `json:"affinitygroup"`
- Cpunumber int `json:"cpunumber"`
- Cpuspeed int `json:"cpuspeed"`
- Cpuused string `json:"cpuused"`
- Created string `json:"created"`
- Details map[string]string `json:"details"`
- Diskioread int64 `json:"diskioread"`
- Diskiowrite int64 `json:"diskiowrite"`
- Diskkbsread int64 `json:"diskkbsread"`
- Diskkbswrite int64 `json:"diskkbswrite"`
- Diskofferingid string `json:"diskofferingid"`
- Diskofferingname string `json:"diskofferingname"`
- Displayname string `json:"displayname"`
- Displayvm bool `json:"displayvm"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Forvirtualnetwork bool `json:"forvirtualnetwork"`
- Group string `json:"group"`
- Groupid string `json:"groupid"`
- Guestosid string `json:"guestosid"`
- Haenable bool `json:"haenable"`
- Hostid string `json:"hostid"`
- Hostname string `json:"hostname"`
- Hypervisor string `json:"hypervisor"`
- Id string `json:"id"`
- Instancename string `json:"instancename"`
- Isdynamicallyscalable bool `json:"isdynamicallyscalable"`
- Isodisplaytext string `json:"isodisplaytext"`
- Isoid string `json:"isoid"`
- Isoname string `json:"isoname"`
- Keypair string `json:"keypair"`
- Memory int `json:"memory"`
- Memoryintfreekbs int64 `json:"memoryintfreekbs"`
- Memorykbs int64 `json:"memorykbs"`
- Memorytargetkbs int64 `json:"memorytargetkbs"`
- Name string `json:"name"`
- Networkkbsread int64 `json:"networkkbsread"`
- Networkkbswrite int64 `json:"networkkbswrite"`
- Nic []struct {
- Broadcasturi string `json:"broadcasturi"`
- Deviceid string `json:"deviceid"`
- Gateway string `json:"gateway"`
- Id string `json:"id"`
- Ip6address string `json:"ip6address"`
- Ip6cidr string `json:"ip6cidr"`
- Ip6gateway string `json:"ip6gateway"`
- Ipaddress string `json:"ipaddress"`
- Isdefault bool `json:"isdefault"`
- Isolationuri string `json:"isolationuri"`
- Macaddress string `json:"macaddress"`
- Netmask string `json:"netmask"`
- Networkid string `json:"networkid"`
- Networkname string `json:"networkname"`
- Nsxlogicalswitch string `json:"nsxlogicalswitch"`
- Nsxlogicalswitchport string `json:"nsxlogicalswitchport"`
- Secondaryip []struct {
- Id string `json:"id"`
- Ipaddress string `json:"ipaddress"`
- } `json:"secondaryip"`
- Traffictype string `json:"traffictype"`
- Type string `json:"type"`
- Virtualmachineid string `json:"virtualmachineid"`
- } `json:"nic"`
- Ostypeid int64 `json:"ostypeid"`
- Password string `json:"password"`
- Passwordenabled bool `json:"passwordenabled"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Publicip string `json:"publicip"`
- Publicipid string `json:"publicipid"`
- Rootdeviceid int64 `json:"rootdeviceid"`
- Rootdevicetype string `json:"rootdevicetype"`
- Securitygroup []struct {
- Account string `json:"account"`
- Description string `json:"description"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Egressrule []struct {
- Account string `json:"account"`
- Cidr string `json:"cidr"`
- Endport int `json:"endport"`
- Icmpcode int `json:"icmpcode"`
- Icmptype int `json:"icmptype"`
- Protocol string `json:"protocol"`
- Ruleid string `json:"ruleid"`
- Securitygroupname string `json:"securitygroupname"`
- Startport int `json:"startport"`
- Tags []struct {
- Account string `json:"account"`
- Customer string `json:"customer"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Key string `json:"key"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Resourceid string `json:"resourceid"`
- Resourcetype string `json:"resourcetype"`
- Value string `json:"value"`
- } `json:"tags"`
- } `json:"egressrule"`
- Id string `json:"id"`
- Ingressrule []struct {
- Account string `json:"account"`
- Cidr string `json:"cidr"`
- Endport int `json:"endport"`
- Icmpcode int `json:"icmpcode"`
- Icmptype int `json:"icmptype"`
- Protocol string `json:"protocol"`
- Ruleid string `json:"ruleid"`
- Securitygroupname string `json:"securitygroupname"`
- Startport int `json:"startport"`
- Tags []struct {
- Account string `json:"account"`
- Customer string `json:"customer"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Key string `json:"key"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Resourceid string `json:"resourceid"`
- Resourcetype string `json:"resourcetype"`
- Value string `json:"value"`
- } `json:"tags"`
- } `json:"ingressrule"`
- Name string `json:"name"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Tags []struct {
- Account string `json:"account"`
- Customer string `json:"customer"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Key string `json:"key"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Resourceid string `json:"resourceid"`
- Resourcetype string `json:"resourcetype"`
- Value string `json:"value"`
- } `json:"tags"`
- Virtualmachinecount int `json:"virtualmachinecount"`
- Virtualmachineids []interface{} `json:"virtualmachineids"`
- } `json:"securitygroup"`
- Serviceofferingid string `json:"serviceofferingid"`
- Serviceofferingname string `json:"serviceofferingname"`
- Servicestate string `json:"servicestate"`
- State string `json:"state"`
- Templatedisplaytext string `json:"templatedisplaytext"`
- Templateid string `json:"templateid"`
- Templatename string `json:"templatename"`
- Userid string `json:"userid"`
- Username string `json:"username"`
- Vgpu string `json:"vgpu"`
- Zoneid string `json:"zoneid"`
- Zonename string `json:"zonename"`
-}
-
type RestoreVirtualMachineParams struct {
p map[string]interface{}
}
@@ -5347,147 +4241,6 @@
Success bool `json:"success"`
}
-type StartInternalLoadBalancerVMParams struct {
- p map[string]interface{}
-}
-
-func (p *StartInternalLoadBalancerVMParams) 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 *StartInternalLoadBalancerVMParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new StartInternalLoadBalancerVMParams instance,
-// as then you are sure you have configured all required params
-func (s *VirtualMachineService) NewStartInternalLoadBalancerVMParams(id string) *StartInternalLoadBalancerVMParams {
- p := &StartInternalLoadBalancerVMParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Starts an existing internal lb vm.
-func (s *VirtualMachineService) StartInternalLoadBalancerVM(p *StartInternalLoadBalancerVMParams) (*StartInternalLoadBalancerVMResponse, error) {
- resp, err := s.cs.newRequest("startInternalLoadBalancerVM", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r StartInternalLoadBalancerVMResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type StartInternalLoadBalancerVMResponse struct {
- JobID string `json:"jobid"`
- Account string `json:"account"`
- Created string `json:"created"`
- Dns1 string `json:"dns1"`
- Dns2 string `json:"dns2"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Gateway string `json:"gateway"`
- Guestipaddress string `json:"guestipaddress"`
- Guestmacaddress string `json:"guestmacaddress"`
- Guestnetmask string `json:"guestnetmask"`
- Guestnetworkid string `json:"guestnetworkid"`
- Guestnetworkname string `json:"guestnetworkname"`
- Hostid string `json:"hostid"`
- Hostname string `json:"hostname"`
- Hypervisor string `json:"hypervisor"`
- Id string `json:"id"`
- Ip6dns1 string `json:"ip6dns1"`
- Ip6dns2 string `json:"ip6dns2"`
- Isredundantrouter bool `json:"isredundantrouter"`
- Linklocalip string `json:"linklocalip"`
- Linklocalmacaddress string `json:"linklocalmacaddress"`
- Linklocalnetmask string `json:"linklocalnetmask"`
- Linklocalnetworkid string `json:"linklocalnetworkid"`
- Name string `json:"name"`
- Networkdomain string `json:"networkdomain"`
- Nic []struct {
- Broadcasturi string `json:"broadcasturi"`
- Deviceid string `json:"deviceid"`
- Gateway string `json:"gateway"`
- Id string `json:"id"`
- Ip6address string `json:"ip6address"`
- Ip6cidr string `json:"ip6cidr"`
- Ip6gateway string `json:"ip6gateway"`
- Ipaddress string `json:"ipaddress"`
- Isdefault bool `json:"isdefault"`
- Isolationuri string `json:"isolationuri"`
- Macaddress string `json:"macaddress"`
- Netmask string `json:"netmask"`
- Networkid string `json:"networkid"`
- Networkname string `json:"networkname"`
- Nsxlogicalswitch string `json:"nsxlogicalswitch"`
- Nsxlogicalswitchport string `json:"nsxlogicalswitchport"`
- Secondaryip []struct {
- Id string `json:"id"`
- Ipaddress string `json:"ipaddress"`
- } `json:"secondaryip"`
- Traffictype string `json:"traffictype"`
- Type string `json:"type"`
- Virtualmachineid string `json:"virtualmachineid"`
- } `json:"nic"`
- Podid string `json:"podid"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Publicip string `json:"publicip"`
- Publicmacaddress string `json:"publicmacaddress"`
- Publicnetmask string `json:"publicnetmask"`
- Publicnetworkid string `json:"publicnetworkid"`
- Redundantstate string `json:"redundantstate"`
- Requiresupgrade bool `json:"requiresupgrade"`
- Role string `json:"role"`
- Scriptsversion string `json:"scriptsversion"`
- Serviceofferingid string `json:"serviceofferingid"`
- Serviceofferingname string `json:"serviceofferingname"`
- State string `json:"state"`
- Templateid string `json:"templateid"`
- Version string `json:"version"`
- Vpcid string `json:"vpcid"`
- Vpcname string `json:"vpcname"`
- Zoneid string `json:"zoneid"`
- Zonename string `json:"zonename"`
-}
-
type StartVirtualMachineParams struct {
p map[string]interface{}
}
@@ -5747,159 +4500,6 @@
Zonename string `json:"zonename"`
}
-type StopInternalLoadBalancerVMParams struct {
- p map[string]interface{}
-}
-
-func (p *StopInternalLoadBalancerVMParams) toURLValues() url.Values {
- u := url.Values{}
- if p.p == nil {
- return u
- }
- if v, found := p.p["forced"]; found {
- vv := strconv.FormatBool(v.(bool))
- u.Set("forced", vv)
- }
- if v, found := p.p["id"]; found {
- u.Set("id", v.(string))
- }
- return u
-}
-
-func (p *StopInternalLoadBalancerVMParams) SetForced(v bool) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["forced"] = v
- return
-}
-
-func (p *StopInternalLoadBalancerVMParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new StopInternalLoadBalancerVMParams instance,
-// as then you are sure you have configured all required params
-func (s *VirtualMachineService) NewStopInternalLoadBalancerVMParams(id string) *StopInternalLoadBalancerVMParams {
- p := &StopInternalLoadBalancerVMParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// Stops an Internal LB vm.
-func (s *VirtualMachineService) StopInternalLoadBalancerVM(p *StopInternalLoadBalancerVMParams) (*StopInternalLoadBalancerVMResponse, error) {
- resp, err := s.cs.newRequest("stopInternalLoadBalancerVM", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r StopInternalLoadBalancerVMResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- // If we have a async client, we need to wait for the async result
- if s.cs.async {
- b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
- if err != nil {
- if err == AsyncTimeoutErr {
- return &r, err
- }
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal(b, &r); err != nil {
- return nil, err
- }
- }
-
- return &r, nil
-}
-
-type StopInternalLoadBalancerVMResponse struct {
- JobID string `json:"jobid"`
- Account string `json:"account"`
- Created string `json:"created"`
- Dns1 string `json:"dns1"`
- Dns2 string `json:"dns2"`
- Domain string `json:"domain"`
- Domainid string `json:"domainid"`
- Gateway string `json:"gateway"`
- Guestipaddress string `json:"guestipaddress"`
- Guestmacaddress string `json:"guestmacaddress"`
- Guestnetmask string `json:"guestnetmask"`
- Guestnetworkid string `json:"guestnetworkid"`
- Guestnetworkname string `json:"guestnetworkname"`
- Hostid string `json:"hostid"`
- Hostname string `json:"hostname"`
- Hypervisor string `json:"hypervisor"`
- Id string `json:"id"`
- Ip6dns1 string `json:"ip6dns1"`
- Ip6dns2 string `json:"ip6dns2"`
- Isredundantrouter bool `json:"isredundantrouter"`
- Linklocalip string `json:"linklocalip"`
- Linklocalmacaddress string `json:"linklocalmacaddress"`
- Linklocalnetmask string `json:"linklocalnetmask"`
- Linklocalnetworkid string `json:"linklocalnetworkid"`
- Name string `json:"name"`
- Networkdomain string `json:"networkdomain"`
- Nic []struct {
- Broadcasturi string `json:"broadcasturi"`
- Deviceid string `json:"deviceid"`
- Gateway string `json:"gateway"`
- Id string `json:"id"`
- Ip6address string `json:"ip6address"`
- Ip6cidr string `json:"ip6cidr"`
- Ip6gateway string `json:"ip6gateway"`
- Ipaddress string `json:"ipaddress"`
- Isdefault bool `json:"isdefault"`
- Isolationuri string `json:"isolationuri"`
- Macaddress string `json:"macaddress"`
- Netmask string `json:"netmask"`
- Networkid string `json:"networkid"`
- Networkname string `json:"networkname"`
- Nsxlogicalswitch string `json:"nsxlogicalswitch"`
- Nsxlogicalswitchport string `json:"nsxlogicalswitchport"`
- Secondaryip []struct {
- Id string `json:"id"`
- Ipaddress string `json:"ipaddress"`
- } `json:"secondaryip"`
- Traffictype string `json:"traffictype"`
- Type string `json:"type"`
- Virtualmachineid string `json:"virtualmachineid"`
- } `json:"nic"`
- Podid string `json:"podid"`
- Project string `json:"project"`
- Projectid string `json:"projectid"`
- Publicip string `json:"publicip"`
- Publicmacaddress string `json:"publicmacaddress"`
- Publicnetmask string `json:"publicnetmask"`
- Publicnetworkid string `json:"publicnetworkid"`
- Redundantstate string `json:"redundantstate"`
- Requiresupgrade bool `json:"requiresupgrade"`
- Role string `json:"role"`
- Scriptsversion string `json:"scriptsversion"`
- Serviceofferingid string `json:"serviceofferingid"`
- Serviceofferingname string `json:"serviceofferingname"`
- State string `json:"state"`
- Templateid string `json:"templateid"`
- Version string `json:"version"`
- Vpcid string `json:"vpcid"`
- Vpcname string `json:"vpcname"`
- Zoneid string `json:"zoneid"`
- Zonename string `json:"zonename"`
-}
-
type StopVirtualMachineParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/VolumeService.go b/cloudstack/VolumeService.go
index 82b1f41..ab96f16 100644
--- a/cloudstack/VolumeService.go
+++ b/cloudstack/VolumeService.go
@@ -1101,100 +1101,6 @@
VolumeiScsiName string `json:"volumeiScsiName"`
}
-type ListElastistorVolumeParams struct {
- p map[string]interface{}
-}
-
-func (p *ListElastistorVolumeParams) 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 *ListElastistorVolumeParams) SetId(v string) {
- if p.p == nil {
- p.p = make(map[string]interface{})
- }
- p.p["id"] = v
- return
-}
-
-// You should always use this function to get a new ListElastistorVolumeParams instance,
-// as then you are sure you have configured all required params
-func (s *VolumeService) NewListElastistorVolumeParams(id string) *ListElastistorVolumeParams {
- p := &ListElastistorVolumeParams{}
- p.p = make(map[string]interface{})
- p.p["id"] = id
- return p
-}
-
-// This is a courtesy helper function, which in some cases may not work as expected!
-func (s *VolumeService) GetElastistorVolumeByID(id string, opts ...OptionFunc) (*ElastistorVolume, int, error) {
- p := &ListElastistorVolumeParams{}
- 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.ListElastistorVolume(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.ElastistorVolume[0], l.Count, nil
- }
- return nil, l.Count, fmt.Errorf("There is more then one result for ElastistorVolume UUID: %s!", id)
-}
-
-// Lists the volumes of elastistor
-func (s *VolumeService) ListElastistorVolume(p *ListElastistorVolumeParams) (*ListElastistorVolumeResponse, error) {
- resp, err := s.cs.newRequest("listElastistorVolume", p.toURLValues())
- if err != nil {
- return nil, err
- }
-
- var r ListElastistorVolumeResponse
- if err := json.Unmarshal(resp, &r); err != nil {
- return nil, err
- }
-
- return &r, nil
-}
-
-type ListElastistorVolumeResponse struct {
- Count int `json:"count"`
- ElastistorVolume []*ElastistorVolume `json:"elastistorvolume"`
-}
-
-type ElastistorVolume struct {
- Compression string `json:"compression"`
- Deduplication string `json:"deduplication"`
- Graceallowed string `json:"graceallowed"`
- Id string `json:"id"`
- Name string `json:"name"`
- Sync string `json:"sync"`
-}
-
type ListVolumesParams struct {
p map[string]interface{}
}
diff --git a/cloudstack/cloudstack.go b/cloudstack/cloudstack.go
index fdd1306..a3c7171 100644
--- a/cloudstack/cloudstack.go
+++ b/cloudstack/cloudstack.go
@@ -88,7 +88,7 @@
Domain *DomainService
Event *EventService
ExtFirewall *ExtFirewallService
- ExtLoadBalancer *ExtLoadBalancer
+ ExtLoadBalancer *ExtLoadBalancerService
ExternalDevice *ExternalDeviceService
Firewall *FirewallService
GuestOS *GuestOSService
@@ -100,9 +100,10 @@
LDAP *LDAPService
Limit *LimitService
LoadBalancer *LoadBalancerService
- Metrics *MetricsService
- Misc *MiscService
NAT *NATService
+ NetworkACL *NetworkACLService
+ NetworkDevice *NetworkDeviceService
+ NetworkOffering *NetworkOfferingService
Network *NetworkService
Nic *NicService
NiciraNVP *NiciraNVPService
@@ -119,13 +120,12 @@
Resourcetags *ResourcetagsService
Role *RoleService
Router *RouterService
- S3 *S3Service
SSH *SSHService
SecurityGroup *SecurityGroupService
ServiceOffering *ServiceOfferingService
Snapshot *SnapshotService
StoragePool *StoragePoolService
- StratosphereSSP *StratosphereSSP
+ StratosphereSSP *StratosphereSSPService
Swift *SwiftService
SystemCapacity *SystemCapacityService
SystemVM *SystemVMService
@@ -179,7 +179,7 @@
cs.Domain = NewDomainService(cs)
cs.Event = NewEventService(cs)
cs.ExtFirewall = NewExtFirewallService(cs)
- cs.ExtLoadBalancer = NewExtLoadBalancer(cs)
+ cs.ExtLoadBalancer = NewExtLoadBalancerService(cs)
cs.ExternalDevice = NewExternalDeviceService(cs)
cs.Firewall = NewFirewallService(cs)
cs.GuestOS = NewGuestOSService(cs)
@@ -191,9 +191,10 @@
cs.LDAP = NewLDAPService(cs)
cs.Limit = NewLimitService(cs)
cs.LoadBalancer = NewLoadBalancerService(cs)
- cs.Metrics = NewMetricsService(cs)
- cs.Misc = NewMiscService(cs)
cs.NAT = NewNATService(cs)
+ cs.NetworkACL = NewNetworkACLService(cs)
+ cs.NetworkDevice = NewNetworkDeviceService(cs)
+ cs.NetworkOffering = NewNetworkOfferingService(cs)
cs.Network = NewNetworkService(cs)
cs.Nic = NewNicService(cs)
cs.NiciraNVP = NewNiciraNVPService(cs)
@@ -210,13 +211,12 @@
cs.Resourcetags = NewResourcetagsService(cs)
cs.Role = NewRoleService(cs)
cs.Router = NewRouterService(cs)
- cs.S3 = NewS3Service(cs)
cs.SSH = NewSSHService(cs)
cs.SecurityGroup = NewSecurityGroupService(cs)
cs.ServiceOffering = NewServiceOfferingService(cs)
cs.Snapshot = NewSnapshotService(cs)
cs.StoragePool = NewStoragePoolService(cs)
- cs.StratosphereSSP = NewStratosphereSSP(cs)
+ cs.StratosphereSSP = NewStratosphereSSPService(cs)
cs.Swift = NewSwiftService(cs)
cs.SystemCapacity = NewSystemCapacityService(cs)
cs.SystemVM = NewSystemVMService(cs)
@@ -620,12 +620,12 @@
return &ExtFirewallService{cs: cs}
}
-type ExtLoadBalancer struct {
+type ExtLoadBalancerService struct {
cs *CloudStackClient
}
-func NewExtLoadBalancer(cs *CloudStackClient) *ExtLoadBalancer {
- return &ExtLoadBalancer{cs: cs}
+func NewExtLoadBalancerService(cs *CloudStackClient) *ExtLoadBalancerService {
+ return &ExtLoadBalancerService{cs: cs}
}
type ExternalDeviceService struct {
@@ -716,22 +716,6 @@
return &LoadBalancerService{cs: cs}
}
-type MetricsService struct {
- cs *CloudStackClient
-}
-
-func NewMetricsService(cs *CloudStackClient) *MetricsService {
- return &MetricsService{cs: cs}
-}
-
-type MiscService struct {
- cs *CloudStackClient
-}
-
-func NewMiscService(cs *CloudStackClient) *MiscService {
- return &MiscService{cs: cs}
-}
-
type NATService struct {
cs *CloudStackClient
}
@@ -740,6 +724,30 @@
return &NATService{cs: cs}
}
+type NetworkACLService struct {
+ cs *CloudStackClient
+}
+
+func NewNetworkACLService(cs *CloudStackClient) *NetworkACLService {
+ return &NetworkACLService{cs: cs}
+}
+
+type NetworkDeviceService struct {
+ cs *CloudStackClient
+}
+
+func NewNetworkDeviceService(cs *CloudStackClient) *NetworkDeviceService {
+ return &NetworkDeviceService{cs: cs}
+}
+
+type NetworkOfferingService struct {
+ cs *CloudStackClient
+}
+
+func NewNetworkOfferingService(cs *CloudStackClient) *NetworkOfferingService {
+ return &NetworkOfferingService{cs: cs}
+}
+
type NetworkService struct {
cs *CloudStackClient
}
@@ -868,14 +876,6 @@
return &RouterService{cs: cs}
}
-type S3Service struct {
- cs *CloudStackClient
-}
-
-func NewS3Service(cs *CloudStackClient) *S3Service {
- return &S3Service{cs: cs}
-}
-
type SSHService struct {
cs *CloudStackClient
}
@@ -916,12 +916,12 @@
return &StoragePoolService{cs: cs}
}
-type StratosphereSSP struct {
+type StratosphereSSPService struct {
cs *CloudStackClient
}
-func NewStratosphereSSP(cs *CloudStackClient) *StratosphereSSP {
- return &StratosphereSSP{cs: cs}
+func NewStratosphereSSPService(cs *CloudStackClient) *StratosphereSSPService {
+ return &StratosphereSSPService{cs: cs}
}
type SwiftService struct {