vendor: update go-cloudstack v2.4.1
This fixes #7263 and updates the dependency go-cloudstack v2.4.1 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
f0b1d3cbf2
commit
47e03a815f
2
go.mod
2
go.mod
|
@ -160,7 +160,7 @@ require (
|
|||
github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1
|
||||
github.com/ulikunitz/xz v0.0.0-20180703112113-636d36a76670
|
||||
github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311
|
||||
github.com/xanzy/go-cloudstack v2.1.4+incompatible
|
||||
github.com/xanzy/go-cloudstack v2.4.1+incompatible
|
||||
golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
|
||||
|
|
2
go.sum
2
go.sum
|
@ -358,6 +358,8 @@ github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311 h1:s5pyxd5S6wRs2WpE
|
|||
github.com/vmware/govmomi v0.0.0-20170707011325-c2105a174311/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU=
|
||||
github.com/xanzy/go-cloudstack v2.1.4+incompatible h1:5c72sRFakVv8wH/HsQFg+xr37CmNQU2UbJfaBjW5f0c=
|
||||
github.com/xanzy/go-cloudstack v2.1.4+incompatible/go.mod h1:s3eL3z5pNXF5FVybcT+LIVdId8pYn709yv6v5mrkrQE=
|
||||
github.com/xanzy/go-cloudstack v2.4.1+incompatible h1:Oc4xa2+I94h1g/QJ+nHoq597nJz2KXzxuQx/weOx0AU=
|
||||
github.com/xanzy/go-cloudstack v2.4.1+incompatible/go.mod h1:s3eL3z5pNXF5FVybcT+LIVdId8pYn709yv6v5mrkrQE=
|
||||
golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4 h1:AJCW0rhPjFKEAoValWpqnRKxX8YV0Xvqfw+dOexCTPc=
|
||||
golang.org/x/crypto v0.0.0-20180322175230-88942b9c40a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -63,6 +63,7 @@ func (s *APIDiscoveryService) ListApis(p *ListApisParams) (*ListApisResponse, er
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -72,25 +73,29 @@ type ListApisResponse struct {
|
|||
}
|
||||
|
||||
type Api struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
Isasync bool `json:"isasync,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Params []struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
Length int `json:"length,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Related string `json:"related,omitempty"`
|
||||
Required bool `json:"required,omitempty"`
|
||||
Since string `json:"since,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
} `json:"params,omitempty"`
|
||||
Related string `json:"related,omitempty"`
|
||||
Response []struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Response []string `json:"response,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
} `json:"response,omitempty"`
|
||||
Since string `json:"since,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Description string `json:"description"`
|
||||
Isasync bool `json:"isasync"`
|
||||
Name string `json:"name"`
|
||||
Params []ApiParams `json:"params"`
|
||||
Related string `json:"related"`
|
||||
Response []ApiResponse `json:"response"`
|
||||
Since string `json:"since"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type ApiResponse struct {
|
||||
Description string `json:"description"`
|
||||
Name string `json:"name"`
|
||||
Response []interface{} `json:"response"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type ApiParams struct {
|
||||
Description string `json:"description"`
|
||||
Length int `json:"length"`
|
||||
Name string `json:"name"`
|
||||
Related string `json:"related"`
|
||||
Required bool `json:"required"`
|
||||
Since string `json:"since"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -177,52 +177,42 @@ func (s *AddressService) AssociateIpAddress(p *AssociateIpAddressParams) (*Assoc
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AssociateIpAddressResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Allocated string `json:"allocated,omitempty"`
|
||||
Associatednetworkid string `json:"associatednetworkid,omitempty"`
|
||||
Associatednetworkname string `json:"associatednetworkname,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Fordisplay bool `json:"fordisplay,omitempty"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isportable bool `json:"isportable,omitempty"`
|
||||
Issourcenat bool `json:"issourcenat,omitempty"`
|
||||
Isstaticnat bool `json:"isstaticnat,omitempty"`
|
||||
Issystem bool `json:"issystem,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Purpose string `json:"purpose,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
Virtualmachinename string `json:"virtualmachinename,omitempty"`
|
||||
Vlanid string `json:"vlanid,omitempty"`
|
||||
Vlanname string `json:"vlanname,omitempty"`
|
||||
Vmipaddress string `json:"vmipaddress,omitempty"`
|
||||
Vpcid string `json:"vpcid,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Account string `json:"account"`
|
||||
Allocated string `json:"allocated"`
|
||||
Associatednetworkid string `json:"associatednetworkid"`
|
||||
Associatednetworkname string `json:"associatednetworkname"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Fordisplay bool `json:"fordisplay"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork"`
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Isportable bool `json:"isportable"`
|
||||
Issourcenat bool `json:"issourcenat"`
|
||||
Isstaticnat bool `json:"isstaticnat"`
|
||||
Issystem bool `json:"issystem"`
|
||||
Networkid string `json:"networkid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Purpose string `json:"purpose"`
|
||||
State string `json:"state"`
|
||||
Tags []Tags `json:"tags"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname"`
|
||||
Virtualmachineid string `json:"virtualmachineid"`
|
||||
Virtualmachinename string `json:"virtualmachinename"`
|
||||
Vlanid string `json:"vlanid"`
|
||||
Vlanname string `json:"vlanname"`
|
||||
Vmipaddress string `json:"vmipaddress"`
|
||||
Vpcid string `json:"vpcid"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type DisassociateIpAddressParams struct {
|
||||
|
@ -283,13 +273,14 @@ func (s *AddressService) DisassociateIpAddress(p *DisassociateIpAddressParams) (
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DisassociateIpAddressResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListPublicIpAddressesParams struct {
|
||||
|
@ -587,7 +578,7 @@ func (s *AddressService) GetPublicIpAddressByID(id string, opts ...OptionFunc) (
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -624,6 +615,7 @@ func (s *AddressService) ListPublicIpAddresses(p *ListPublicIpAddressesParams) (
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -633,47 +625,36 @@ type ListPublicIpAddressesResponse struct {
|
|||
}
|
||||
|
||||
type PublicIpAddress struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Allocated string `json:"allocated,omitempty"`
|
||||
Associatednetworkid string `json:"associatednetworkid,omitempty"`
|
||||
Associatednetworkname string `json:"associatednetworkname,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Fordisplay bool `json:"fordisplay,omitempty"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isportable bool `json:"isportable,omitempty"`
|
||||
Issourcenat bool `json:"issourcenat,omitempty"`
|
||||
Isstaticnat bool `json:"isstaticnat,omitempty"`
|
||||
Issystem bool `json:"issystem,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Purpose string `json:"purpose,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
Virtualmachinename string `json:"virtualmachinename,omitempty"`
|
||||
Vlanid string `json:"vlanid,omitempty"`
|
||||
Vlanname string `json:"vlanname,omitempty"`
|
||||
Vmipaddress string `json:"vmipaddress,omitempty"`
|
||||
Vpcid string `json:"vpcid,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Allocated string `json:"allocated"`
|
||||
Associatednetworkid string `json:"associatednetworkid"`
|
||||
Associatednetworkname string `json:"associatednetworkname"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Fordisplay bool `json:"fordisplay"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork"`
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Isportable bool `json:"isportable"`
|
||||
Issourcenat bool `json:"issourcenat"`
|
||||
Isstaticnat bool `json:"isstaticnat"`
|
||||
Issystem bool `json:"issystem"`
|
||||
Networkid string `json:"networkid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Purpose string `json:"purpose"`
|
||||
State string `json:"state"`
|
||||
Tags []Tags `json:"tags"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname"`
|
||||
Virtualmachineid string `json:"virtualmachineid"`
|
||||
Virtualmachinename string `json:"virtualmachinename"`
|
||||
Vlanid string `json:"vlanid"`
|
||||
Vlanname string `json:"vlanname"`
|
||||
Vmipaddress string `json:"vmipaddress"`
|
||||
Vpcid string `json:"vpcid"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type UpdateIpAddressParams struct {
|
||||
|
@ -762,50 +743,40 @@ func (s *AddressService) UpdateIpAddress(p *UpdateIpAddressParams) (*UpdateIpAdd
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateIpAddressResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Allocated string `json:"allocated,omitempty"`
|
||||
Associatednetworkid string `json:"associatednetworkid,omitempty"`
|
||||
Associatednetworkname string `json:"associatednetworkname,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Fordisplay bool `json:"fordisplay,omitempty"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isportable bool `json:"isportable,omitempty"`
|
||||
Issourcenat bool `json:"issourcenat,omitempty"`
|
||||
Isstaticnat bool `json:"isstaticnat,omitempty"`
|
||||
Issystem bool `json:"issystem,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Purpose string `json:"purpose,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
Virtualmachinename string `json:"virtualmachinename,omitempty"`
|
||||
Vlanid string `json:"vlanid,omitempty"`
|
||||
Vlanname string `json:"vlanname,omitempty"`
|
||||
Vmipaddress string `json:"vmipaddress,omitempty"`
|
||||
Vpcid string `json:"vpcid,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Account string `json:"account"`
|
||||
Allocated string `json:"allocated"`
|
||||
Associatednetworkid string `json:"associatednetworkid"`
|
||||
Associatednetworkname string `json:"associatednetworkname"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Fordisplay bool `json:"fordisplay"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork"`
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Isportable bool `json:"isportable"`
|
||||
Issourcenat bool `json:"issourcenat"`
|
||||
Isstaticnat bool `json:"isstaticnat"`
|
||||
Issystem bool `json:"issystem"`
|
||||
Networkid string `json:"networkid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Purpose string `json:"purpose"`
|
||||
State string `json:"state"`
|
||||
Tags []Tags `json:"tags"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname"`
|
||||
Virtualmachineid string `json:"virtualmachineid"`
|
||||
Virtualmachinename string `json:"virtualmachinename"`
|
||||
Vlanid string `json:"vlanid"`
|
||||
Vlanname string `json:"vlanname"`
|
||||
Vmipaddress string `json:"vmipaddress"`
|
||||
Vpcid string `json:"vpcid"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -143,21 +143,22 @@ func (s *AffinityGroupService) CreateAffinityGroup(p *CreateAffinityGroupParams)
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateAffinityGroupResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
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"`
|
||||
}
|
||||
|
||||
type DeleteAffinityGroupParams struct {
|
||||
|
@ -261,13 +262,93 @@ func (s *AffinityGroupService) DeleteAffinityGroup(p *DeleteAffinityGroupParams)
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteAffinityGroupResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListAffinityGroupTypesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListAffinityGroupTypesParams) 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)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListAffinityGroupTypesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAffinityGroupTypesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAffinityGroupTypesParams) 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 ListAffinityGroupTypesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *AffinityGroupService) NewListAffinityGroupTypesParams() *ListAffinityGroupTypesParams {
|
||||
p := &ListAffinityGroupTypesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists affinity group types available
|
||||
func (s *AffinityGroupService) ListAffinityGroupTypes(p *ListAffinityGroupTypesParams) (*ListAffinityGroupTypesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listAffinityGroupTypes", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListAffinityGroupTypesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListAffinityGroupTypesResponse struct {
|
||||
Count int `json:"count"`
|
||||
AffinityGroupTypes []*AffinityGroupType `json:"affinitygrouptype"`
|
||||
}
|
||||
|
||||
type AffinityGroupType struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type ListAffinityGroupsParams struct {
|
||||
|
@ -433,7 +514,7 @@ func (s *AffinityGroupService) GetAffinityGroupID(name string, opts ...OptionFun
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -487,7 +568,7 @@ func (s *AffinityGroupService) GetAffinityGroupByID(id string, opts ...OptionFun
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -528,6 +609,7 @@ func (s *AffinityGroupService) ListAffinityGroups(p *ListAffinityGroupsParams) (
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -537,16 +619,16 @@ type ListAffinityGroupsResponse struct {
|
|||
}
|
||||
|
||||
type AffinityGroup struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
|
||||
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"`
|
||||
}
|
||||
|
||||
type UpdateVMAffinityGroupParams struct {
|
||||
|
@ -636,260 +718,114 @@ func (s *AffinityGroupService) UpdateVMAffinityGroup(p *UpdateVMAffinityGroupPar
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateVMAffinityGroupResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Affinitygroup []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
|
||||
} `json:"affinitygroup,omitempty"`
|
||||
Cpunumber int `json:"cpunumber,omitempty"`
|
||||
Cpuspeed int `json:"cpuspeed,omitempty"`
|
||||
Cpuused string `json:"cpuused,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
Diskioread int64 `json:"diskioread,omitempty"`
|
||||
Diskiowrite int64 `json:"diskiowrite,omitempty"`
|
||||
Diskkbsread int64 `json:"diskkbsread,omitempty"`
|
||||
Diskkbswrite int64 `json:"diskkbswrite,omitempty"`
|
||||
Diskofferingid string `json:"diskofferingid,omitempty"`
|
||||
Diskofferingname string `json:"diskofferingname,omitempty"`
|
||||
Displayname string `json:"displayname,omitempty"`
|
||||
Displayvm bool `json:"displayvm,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Groupid string `json:"groupid,omitempty"`
|
||||
Guestosid string `json:"guestosid,omitempty"`
|
||||
Haenable bool `json:"haenable,omitempty"`
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Instancename string `json:"instancename,omitempty"`
|
||||
Isdynamicallyscalable bool `json:"isdynamicallyscalable,omitempty"`
|
||||
Isodisplaytext string `json:"isodisplaytext,omitempty"`
|
||||
Isoid string `json:"isoid,omitempty"`
|
||||
Isoname string `json:"isoname,omitempty"`
|
||||
Keypair string `json:"keypair,omitempty"`
|
||||
Memory int `json:"memory,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkkbsread int64 `json:"networkkbsread,omitempty"`
|
||||
Networkkbswrite int64 `json:"networkkbswrite,omitempty"`
|
||||
Nic []struct {
|
||||
Broadcasturi string `json:"broadcasturi,omitempty"`
|
||||
Deviceid string `json:"deviceid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6address string `json:"ip6address,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Isolationuri string `json:"isolationuri,omitempty"`
|
||||
Macaddress string `json:"macaddress,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Networkname string `json:"networkname,omitempty"`
|
||||
Secondaryip []struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
} `json:"secondaryip,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
} `json:"nic,omitempty"`
|
||||
Ostypeid int64 `json:"ostypeid,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Passwordenabled bool `json:"passwordenabled,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Publicip string `json:"publicip,omitempty"`
|
||||
Publicipid string `json:"publicipid,omitempty"`
|
||||
Rootdeviceid int64 `json:"rootdeviceid,omitempty"`
|
||||
Rootdevicetype string `json:"rootdevicetype,omitempty"`
|
||||
Securitygroup []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Egressrule []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Cidr string `json:"cidr,omitempty"`
|
||||
Endport int `json:"endport,omitempty"`
|
||||
Icmpcode int `json:"icmpcode,omitempty"`
|
||||
Icmptype int `json:"icmptype,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Ruleid string `json:"ruleid,omitempty"`
|
||||
Securitygroupname string `json:"securitygroupname,omitempty"`
|
||||
Startport int `json:"startport,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
} `json:"egressrule,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ingressrule []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Cidr string `json:"cidr,omitempty"`
|
||||
Endport int `json:"endport,omitempty"`
|
||||
Icmpcode int `json:"icmpcode,omitempty"`
|
||||
Icmptype int `json:"icmptype,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Ruleid string `json:"ruleid,omitempty"`
|
||||
Securitygroupname string `json:"securitygroupname,omitempty"`
|
||||
Startport int `json:"startport,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
} `json:"ingressrule,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Virtualmachinecount int `json:"virtualmachinecount,omitempty"`
|
||||
Virtualmachineids []string `json:"virtualmachineids,omitempty"`
|
||||
} `json:"securitygroup,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Serviceofferingname string `json:"serviceofferingname,omitempty"`
|
||||
Servicestate string `json:"servicestate,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Templatedisplaytext string `json:"templatedisplaytext,omitempty"`
|
||||
Templateid string `json:"templateid,omitempty"`
|
||||
Templatename string `json:"templatename,omitempty"`
|
||||
Userid string `json:"userid,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Vgpu string `json:"vgpu,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Account string `json:"account"`
|
||||
Affinitygroup []UpdateVMAffinityGroupResponseAffinitygroup `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 []Nic `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 []UpdateVMAffinityGroupResponseSecuritygroup `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 ListAffinityGroupTypesParams struct {
|
||||
p map[string]interface{}
|
||||
type UpdateVMAffinityGroupResponseSecuritygroup struct {
|
||||
Account string `json:"account"`
|
||||
Description string `json:"description"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Egressrule []UpdateVMAffinityGroupResponseSecuritygroupRule `json:"egressrule"`
|
||||
Id string `json:"id"`
|
||||
Ingressrule []UpdateVMAffinityGroupResponseSecuritygroupRule `json:"ingressrule"`
|
||||
Name string `json:"name"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Tags []Tags `json:"tags"`
|
||||
Virtualmachinecount int `json:"virtualmachinecount"`
|
||||
Virtualmachineids []interface{} `json:"virtualmachineids"`
|
||||
}
|
||||
|
||||
func (p *ListAffinityGroupTypesParams) 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)
|
||||
}
|
||||
return u
|
||||
type UpdateVMAffinityGroupResponseSecuritygroupRule 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 []Tags `json:"tags"`
|
||||
}
|
||||
|
||||
func (p *ListAffinityGroupTypesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAffinityGroupTypesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAffinityGroupTypesParams) 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 ListAffinityGroupTypesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *AffinityGroupService) NewListAffinityGroupTypesParams() *ListAffinityGroupTypesParams {
|
||||
p := &ListAffinityGroupTypesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists affinity group types available
|
||||
func (s *AffinityGroupService) ListAffinityGroupTypes(p *ListAffinityGroupTypesParams) (*ListAffinityGroupTypesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listAffinityGroupTypes", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListAffinityGroupTypesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListAffinityGroupTypesResponse struct {
|
||||
Count int `json:"count"`
|
||||
AffinityGroupTypes []*AffinityGroupType `json:"affinitygrouptype"`
|
||||
}
|
||||
|
||||
type AffinityGroupType struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
type UpdateVMAffinityGroupResponseAffinitygroup 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"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -24,204 +24,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
type ListAlertsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
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["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["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListAlertsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *AlertService) NewListAlertsParams() *ListAlertsParams {
|
||||
p := &ListAlertsParams{}
|
||||
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 *AlertService) GetAlertID(name string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListAlertsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListAlerts(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.Alerts[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.Alerts {
|
||||
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 *AlertService) GetAlertByName(name string, opts ...OptionFunc) (*Alert, int, error) {
|
||||
id, count, err := s.GetAlertID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetAlertByID(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 *AlertService) GetAlertByID(id string, opts ...OptionFunc) (*Alert, int, error) {
|
||||
p := &ListAlertsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListAlerts(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.Alerts[0], l.Count, nil
|
||||
}
|
||||
return nil, l.Count, fmt.Errorf("There is more then one result for Alert UUID: %s!", id)
|
||||
}
|
||||
|
||||
// Lists all alerts.
|
||||
func (s *AlertService) ListAlerts(p *ListAlertsParams) (*ListAlertsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listAlerts", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListAlertsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListAlertsResponse struct {
|
||||
Count int `json:"count"`
|
||||
Alerts []*Alert `json:"alert"`
|
||||
}
|
||||
|
||||
type Alert struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Sent string `json:"sent,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type ArchiveAlertsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -298,12 +100,32 @@ func (s *AlertService) ArchiveAlerts(p *ArchiveAlertsParams) (*ArchiveAlertsResp
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ArchiveAlertsResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *ArchiveAlertsResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias ArchiveAlertsResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type DeleteAlertsParams struct {
|
||||
|
@ -382,12 +204,32 @@ func (s *AlertService) DeleteAlerts(p *DeleteAlertsParams) (*DeleteAlertsRespons
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteAlertsResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteAlertsResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteAlertsResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type GenerateAlertParams struct {
|
||||
|
@ -495,11 +337,211 @@ func (s *AlertService) GenerateAlert(p *GenerateAlertParams) (*GenerateAlertResp
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type GenerateAlertResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListAlertsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
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["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["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListAlertsParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListAlertsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *AlertService) NewListAlertsParams() *ListAlertsParams {
|
||||
p := &ListAlertsParams{}
|
||||
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 *AlertService) GetAlertID(name string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListAlertsParams{}
|
||||
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.ListAlerts(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.Alerts[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.Alerts {
|
||||
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 *AlertService) GetAlertByName(name string, opts ...OptionFunc) (*Alert, int, error) {
|
||||
id, count, err := s.GetAlertID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetAlertByID(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 *AlertService) GetAlertByID(id string, opts ...OptionFunc) (*Alert, int, error) {
|
||||
p := &ListAlertsParams{}
|
||||
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.ListAlerts(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.Alerts[0], l.Count, nil
|
||||
}
|
||||
return nil, l.Count, fmt.Errorf("There is more then one result for Alert UUID: %s!", id)
|
||||
}
|
||||
|
||||
// Lists all alerts.
|
||||
func (s *AlertService) ListAlerts(p *ListAlertsParams) (*ListAlertsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listAlerts", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListAlertsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListAlertsResponse struct {
|
||||
Count int `json:"count"`
|
||||
Alerts []*Alert `json:"alert"`
|
||||
}
|
||||
|
||||
type Alert struct {
|
||||
Description string `json:"description"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Sent string `json:"sent"`
|
||||
Type int `json:"type"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -23,76 +23,6 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
type QueryAsyncJobResultParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *QueryAsyncJobResultParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["jobid"]; found {
|
||||
u.Set("jobid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *QueryAsyncJobResultParams) SetJobid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["jobid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new QueryAsyncJobResultParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *AsyncjobService) NewQueryAsyncJobResultParams(jobid string) *QueryAsyncJobResultParams {
|
||||
p := &QueryAsyncJobResultParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["jobid"] = jobid
|
||||
return p
|
||||
}
|
||||
|
||||
// Retrieves the current status of asynchronous job.
|
||||
func (s *AsyncjobService) QueryAsyncJobResult(p *QueryAsyncJobResultParams) (*QueryAsyncJobResultResponse, error) {
|
||||
var resp json.RawMessage
|
||||
var err error
|
||||
|
||||
// We should be able to retry on failure as this call is idempotent
|
||||
for i := 0; i < 3; i++ {
|
||||
resp, err = s.cs.newRequest("queryAsyncJobResult", p.toURLValues())
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r QueryAsyncJobResultResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type QueryAsyncJobResultResponse struct {
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
Cmd string `json:"cmd,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Jobinstanceid string `json:"jobinstanceid,omitempty"`
|
||||
Jobinstancetype string `json:"jobinstancetype,omitempty"`
|
||||
Jobprocstatus int `json:"jobprocstatus,omitempty"`
|
||||
Jobresult json.RawMessage `json:"jobresult,omitempty"`
|
||||
Jobresultcode int `json:"jobresultcode,omitempty"`
|
||||
Jobresulttype string `json:"jobresulttype,omitempty"`
|
||||
Jobstatus int `json:"jobstatus,omitempty"`
|
||||
Userid string `json:"userid,omitempty"`
|
||||
}
|
||||
|
||||
type ListAsyncJobsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -216,6 +146,7 @@ func (s *AsyncjobService) ListAsyncJobs(p *ListAsyncJobsParams) (*ListAsyncJobsR
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -225,15 +156,86 @@ type ListAsyncJobsResponse struct {
|
|||
}
|
||||
|
||||
type AsyncJob struct {
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
Cmd string `json:"cmd,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Jobinstanceid string `json:"jobinstanceid,omitempty"`
|
||||
Jobinstancetype string `json:"jobinstancetype,omitempty"`
|
||||
Jobprocstatus int `json:"jobprocstatus,omitempty"`
|
||||
Jobresult json.RawMessage `json:"jobresult,omitempty"`
|
||||
Jobresultcode int `json:"jobresultcode,omitempty"`
|
||||
Jobresulttype string `json:"jobresulttype,omitempty"`
|
||||
Jobstatus int `json:"jobstatus,omitempty"`
|
||||
Userid string `json:"userid,omitempty"`
|
||||
Accountid string `json:"accountid"`
|
||||
Cmd string `json:"cmd"`
|
||||
Created string `json:"created"`
|
||||
Jobinstanceid string `json:"jobinstanceid"`
|
||||
Jobinstancetype string `json:"jobinstancetype"`
|
||||
Jobprocstatus int `json:"jobprocstatus"`
|
||||
Jobresult json.RawMessage `json:"jobresult"`
|
||||
Jobresultcode int `json:"jobresultcode"`
|
||||
Jobresulttype string `json:"jobresulttype"`
|
||||
Jobstatus int `json:"jobstatus"`
|
||||
Userid string `json:"userid"`
|
||||
}
|
||||
|
||||
type QueryAsyncJobResultParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *QueryAsyncJobResultParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["jobid"]; found {
|
||||
u.Set("jobid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *QueryAsyncJobResultParams) SetJobID(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["jobid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new QueryAsyncJobResultParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *AsyncjobService) NewQueryAsyncJobResultParams(jobid string) *QueryAsyncJobResultParams {
|
||||
p := &QueryAsyncJobResultParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["jobid"] = jobid
|
||||
return p
|
||||
}
|
||||
|
||||
// Retrieves the current status of asynchronous job.
|
||||
func (s *AsyncjobService) QueryAsyncJobResult(p *QueryAsyncJobResultParams) (*QueryAsyncJobResultResponse, error) {
|
||||
var resp json.RawMessage
|
||||
var err error
|
||||
|
||||
// We should be able to retry on failure as this call is idempotent
|
||||
for i := 0; i < 3; i++ {
|
||||
resp, err = s.cs.newRequest("queryAsyncJobResult", p.toURLValues())
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r QueryAsyncJobResultResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type QueryAsyncJobResultResponse struct {
|
||||
Accountid string `json:"accountid"`
|
||||
Cmd string `json:"cmd"`
|
||||
Created string `json:"created"`
|
||||
Jobinstanceid string `json:"jobinstanceid"`
|
||||
Jobinstancetype string `json:"jobinstancetype"`
|
||||
Jobprocstatus int `json:"jobprocstatus"`
|
||||
Jobresult json.RawMessage `json:"jobresult"`
|
||||
Jobresultcode int `json:"jobresultcode"`
|
||||
Jobresulttype string `json:"jobresulttype"`
|
||||
Jobstatus int `json:"jobstatus"`
|
||||
Userid string `json:"userid"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -100,21 +100,23 @@ func (s *AuthenticationService) Login(p *LoginParams) (*LoginResponse, error) {
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type LoginResponse struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Firstname string `json:"firstname,omitempty"`
|
||||
Lastname string `json:"lastname,omitempty"`
|
||||
Registered string `json:"registered,omitempty"`
|
||||
Sessionkey string `json:"sessionkey,omitempty"`
|
||||
Timeout int `json:"timeout,omitempty"`
|
||||
Timezone string `json:"timezone,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Userid string `json:"userid,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Domainid string `json:"domainid"`
|
||||
Firstname string `json:"firstname"`
|
||||
Lastname string `json:"lastname"`
|
||||
Registered string `json:"registered"`
|
||||
Sessionkey string `json:"sessionkey"`
|
||||
Timeout int `json:"timeout"`
|
||||
Timezone string `json:"timezone"`
|
||||
Timezoneoffset string `json:"timezoneoffset"`
|
||||
Type string `json:"type"`
|
||||
Userid string `json:"userid"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type LogoutParams struct {
|
||||
|
@ -148,9 +150,10 @@ func (s *AuthenticationService) Logout(p *LogoutParams) (*LogoutResponse, error)
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type LogoutResponse struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -22,6 +22,130 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
type AddBaremetalDhcpParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["dhcpservertype"]; found {
|
||||
u.Set("dhcpservertype", v.(string))
|
||||
}
|
||||
if v, found := p.p["password"]; found {
|
||||
u.Set("password", v.(string))
|
||||
}
|
||||
if v, found := p.p["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", 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))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) SetDhcpservertype(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["dhcpservertype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) SetPassword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["password"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) SetUrl(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["url"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) 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 AddBaremetalDhcpParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BaremetalService) NewAddBaremetalDhcpParams(dhcpservertype string, password string, physicalnetworkid string, url string, username string) *AddBaremetalDhcpParams {
|
||||
p := &AddBaremetalDhcpParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["dhcpservertype"] = dhcpservertype
|
||||
p.p["password"] = password
|
||||
p.p["physicalnetworkid"] = physicalnetworkid
|
||||
p.p["url"] = url
|
||||
p.p["username"] = username
|
||||
return p
|
||||
}
|
||||
|
||||
// adds a baremetal dhcp server
|
||||
func (s *BaremetalService) AddBaremetalDhcp(p *AddBaremetalDhcpParams) (*AddBaremetalDhcpResponse, error) {
|
||||
resp, err := s.cs.newRequest("addBaremetalDhcp", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r AddBaremetalDhcpResponse
|
||||
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 AddBaremetalDhcpResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Dhcpservertype string `json:"dhcpservertype"`
|
||||
Id string `json:"id"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type AddBaremetalPxeKickStartServerParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -156,12 +280,13 @@ func (s *BaremetalService) AddBaremetalPxeKickStartServer(p *AddBaremetalPxeKick
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddBaremetalPxeKickStartServerResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Tftpdir string `json:"tftpdir,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Tftpdir string `json:"tftpdir"`
|
||||
}
|
||||
|
||||
type AddBaremetalPxePingServerParams struct {
|
||||
|
@ -344,104 +469,57 @@ func (s *BaremetalService) AddBaremetalPxePingServer(p *AddBaremetalPxePingServe
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddBaremetalPxePingServerResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Pingdir string `json:"pingdir,omitempty"`
|
||||
Pingstorageserverip string `json:"pingstorageserverip,omitempty"`
|
||||
Tftpdir string `json:"tftpdir,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Pingdir string `json:"pingdir"`
|
||||
Pingstorageserverip string `json:"pingstorageserverip"`
|
||||
Tftpdir string `json:"tftpdir"`
|
||||
}
|
||||
|
||||
type AddBaremetalDhcpParams struct {
|
||||
type AddBaremetalRctParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) toURLValues() url.Values {
|
||||
func (p *AddBaremetalRctParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["dhcpservertype"]; found {
|
||||
u.Set("dhcpservertype", v.(string))
|
||||
}
|
||||
if v, found := p.p["password"]; found {
|
||||
u.Set("password", v.(string))
|
||||
}
|
||||
if v, found := p.p["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", 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["baremetalrcturl"]; found {
|
||||
u.Set("baremetalrcturl", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) SetDhcpservertype(v string) {
|
||||
func (p *AddBaremetalRctParams) SetBaremetalrcturl(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["dhcpservertype"] = v
|
||||
p.p["baremetalrcturl"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) SetPassword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["password"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) SetUrl(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["url"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBaremetalDhcpParams) 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 AddBaremetalDhcpParams instance,
|
||||
// You should always use this function to get a new AddBaremetalRctParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BaremetalService) NewAddBaremetalDhcpParams(dhcpservertype string, password string, physicalnetworkid string, url string, username string) *AddBaremetalDhcpParams {
|
||||
p := &AddBaremetalDhcpParams{}
|
||||
func (s *BaremetalService) NewAddBaremetalRctParams(baremetalrcturl string) *AddBaremetalRctParams {
|
||||
p := &AddBaremetalRctParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["dhcpservertype"] = dhcpservertype
|
||||
p.p["password"] = password
|
||||
p.p["physicalnetworkid"] = physicalnetworkid
|
||||
p.p["url"] = url
|
||||
p.p["username"] = username
|
||||
p.p["baremetalrcturl"] = baremetalrcturl
|
||||
return p
|
||||
}
|
||||
|
||||
// adds a baremetal dhcp server
|
||||
func (s *BaremetalService) AddBaremetalDhcp(p *AddBaremetalDhcpParams) (*AddBaremetalDhcpResponse, error) {
|
||||
resp, err := s.cs.newRequest("addBaremetalDhcp", p.toURLValues())
|
||||
// adds baremetal rack configuration text
|
||||
func (s *BaremetalService) AddBaremetalRct(p *AddBaremetalRctParams) (*AddBaremetalRctResponse, error) {
|
||||
resp, err := s.cs.newRequest("addBaremetalRct", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r AddBaremetalDhcpResponse
|
||||
var r AddBaremetalRctResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -465,16 +543,82 @@ func (s *BaremetalService) AddBaremetalDhcp(p *AddBaremetalDhcpParams) (*AddBare
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddBaremetalDhcpResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Dhcpservertype string `json:"dhcpservertype,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
type AddBaremetalRctResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Id string `json:"id"`
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type DeleteBaremetalRctParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteBaremetalRctParams) 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 *DeleteBaremetalRctParams) 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 DeleteBaremetalRctParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BaremetalService) NewDeleteBaremetalRctParams(id string) *DeleteBaremetalRctParams {
|
||||
p := &DeleteBaremetalRctParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// deletes baremetal rack configuration text
|
||||
func (s *BaremetalService) DeleteBaremetalRct(p *DeleteBaremetalRctParams) (*DeleteBaremetalRctResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteBaremetalRct", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteBaremetalRctResponse
|
||||
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 DeleteBaremetalRctResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListBaremetalDhcpParams struct {
|
||||
|
@ -578,6 +722,7 @@ func (s *BaremetalService) ListBaremetalDhcp(p *ListBaremetalDhcpParams) (*ListB
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -587,11 +732,11 @@ type ListBaremetalDhcpResponse struct {
|
|||
}
|
||||
|
||||
type BaremetalDhcp struct {
|
||||
Dhcpservertype string `json:"dhcpservertype,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Dhcpservertype string `json:"dhcpservertype"`
|
||||
Id string `json:"id"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type ListBaremetalPxeServersParams struct {
|
||||
|
@ -684,6 +829,7 @@ func (s *BaremetalService) ListBaremetalPxeServers(p *ListBaremetalPxeServersPar
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -693,149 +839,10 @@ type ListBaremetalPxeServersResponse struct {
|
|||
}
|
||||
|
||||
type BaremetalPxeServer struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
type AddBaremetalRctParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *AddBaremetalRctParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["baremetalrcturl"]; found {
|
||||
u.Set("baremetalrcturl", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *AddBaremetalRctParams) SetBaremetalrcturl(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["baremetalrcturl"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new AddBaremetalRctParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BaremetalService) NewAddBaremetalRctParams(baremetalrcturl string) *AddBaremetalRctParams {
|
||||
p := &AddBaremetalRctParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["baremetalrcturl"] = baremetalrcturl
|
||||
return p
|
||||
}
|
||||
|
||||
// adds baremetal rack configuration text
|
||||
func (s *BaremetalService) AddBaremetalRct(p *AddBaremetalRctParams) (*AddBaremetalRctResponse, error) {
|
||||
resp, err := s.cs.newRequest("addBaremetalRct", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r AddBaremetalRctResponse
|
||||
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 AddBaremetalRctResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
type DeleteBaremetalRctParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteBaremetalRctParams) 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 *DeleteBaremetalRctParams) 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 DeleteBaremetalRctParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BaremetalService) NewDeleteBaremetalRctParams(id string) *DeleteBaremetalRctParams {
|
||||
p := &DeleteBaremetalRctParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// deletes baremetal rack configuration text
|
||||
func (s *BaremetalService) DeleteBaremetalRct(p *DeleteBaremetalRctParams) (*DeleteBaremetalRctResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteBaremetalRct", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteBaremetalRctResponse
|
||||
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 DeleteBaremetalRctResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
Id string `json:"id"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type ListBaremetalRctParams struct {
|
||||
|
@ -904,6 +911,7 @@ func (s *BaremetalService) ListBaremetalRct(p *ListBaremetalRctParams) (*ListBar
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -913,6 +921,74 @@ type ListBaremetalRctResponse struct {
|
|||
}
|
||||
|
||||
type BaremetalRct struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Id string `json:"id"`
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type NotifyBaremetalProvisionDoneParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *NotifyBaremetalProvisionDoneParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["mac"]; found {
|
||||
u.Set("mac", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *NotifyBaremetalProvisionDoneParams) SetMac(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["mac"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new NotifyBaremetalProvisionDoneParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BaremetalService) NewNotifyBaremetalProvisionDoneParams(mac string) *NotifyBaremetalProvisionDoneParams {
|
||||
p := &NotifyBaremetalProvisionDoneParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["mac"] = mac
|
||||
return p
|
||||
}
|
||||
|
||||
// Notify provision has been done on a host. This api is for baremetal virtual router service, not for end user
|
||||
func (s *BaremetalService) NotifyBaremetalProvisionDone(p *NotifyBaremetalProvisionDoneParams) (*NotifyBaremetalProvisionDoneResponse, error) {
|
||||
resp, err := s.cs.newRequest("notifyBaremetalProvisionDone", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r NotifyBaremetalProvisionDoneResponse
|
||||
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 NotifyBaremetalProvisionDoneResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
|
327
vendor/github.com/xanzy/go-cloudstack/cloudstack/BigSwitchBCFService.go
generated
vendored
Normal file
327
vendor/github.com/xanzy/go-cloudstack/cloudstack/BigSwitchBCFService.go
generated
vendored
Normal file
|
@ -0,0 +1,327 @@
|
|||
//
|
||||
// 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 AddBigSwitchBcfDeviceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *AddBigSwitchBcfDeviceParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["hostname"]; found {
|
||||
u.Set("hostname", v.(string))
|
||||
}
|
||||
if v, found := p.p["nat"]; found {
|
||||
vv := strconv.FormatBool(v.(bool))
|
||||
u.Set("nat", vv)
|
||||
}
|
||||
if v, found := p.p["password"]; found {
|
||||
u.Set("password", v.(string))
|
||||
}
|
||||
if v, found := p.p["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["username"]; found {
|
||||
u.Set("username", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *AddBigSwitchBcfDeviceParams) SetHostname(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostname"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBigSwitchBcfDeviceParams) SetNat(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["nat"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBigSwitchBcfDeviceParams) SetPassword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["password"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBigSwitchBcfDeviceParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBigSwitchBcfDeviceParams) 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 AddBigSwitchBcfDeviceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BigSwitchBCFService) NewAddBigSwitchBcfDeviceParams(hostname string, nat bool, password string, physicalnetworkid string, username string) *AddBigSwitchBcfDeviceParams {
|
||||
p := &AddBigSwitchBcfDeviceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["hostname"] = hostname
|
||||
p.p["nat"] = nat
|
||||
p.p["password"] = password
|
||||
p.p["physicalnetworkid"] = physicalnetworkid
|
||||
p.p["username"] = username
|
||||
return p
|
||||
}
|
||||
|
||||
// Adds a BigSwitch BCF Controller device
|
||||
func (s *BigSwitchBCFService) AddBigSwitchBcfDevice(p *AddBigSwitchBcfDeviceParams) (*AddBigSwitchBcfDeviceResponse, error) {
|
||||
resp, err := s.cs.newRequest("addBigSwitchBcfDevice", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r AddBigSwitchBcfDeviceResponse
|
||||
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 AddBigSwitchBcfDeviceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Bcfdeviceid string `json:"bcfdeviceid"`
|
||||
Bigswitchdevicename string `json:"bigswitchdevicename"`
|
||||
Hostname string `json:"hostname"`
|
||||
Nat bool `json:"nat"`
|
||||
Password string `json:"password"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type DeleteBigSwitchBcfDeviceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteBigSwitchBcfDeviceParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["bcfdeviceid"]; found {
|
||||
u.Set("bcfdeviceid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DeleteBigSwitchBcfDeviceParams) SetBcfdeviceid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["bcfdeviceid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DeleteBigSwitchBcfDeviceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BigSwitchBCFService) NewDeleteBigSwitchBcfDeviceParams(bcfdeviceid string) *DeleteBigSwitchBcfDeviceParams {
|
||||
p := &DeleteBigSwitchBcfDeviceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["bcfdeviceid"] = bcfdeviceid
|
||||
return p
|
||||
}
|
||||
|
||||
// delete a BigSwitch BCF Controller device
|
||||
func (s *BigSwitchBCFService) DeleteBigSwitchBcfDevice(p *DeleteBigSwitchBcfDeviceParams) (*DeleteBigSwitchBcfDeviceResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteBigSwitchBcfDevice", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteBigSwitchBcfDeviceResponse
|
||||
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 DeleteBigSwitchBcfDeviceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListBigSwitchBcfDevicesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListBigSwitchBcfDevicesParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["bcfdeviceid"]; found {
|
||||
u.Set("bcfdeviceid", 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["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListBigSwitchBcfDevicesParams) SetBcfdeviceid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["bcfdeviceid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListBigSwitchBcfDevicesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListBigSwitchBcfDevicesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListBigSwitchBcfDevicesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListBigSwitchBcfDevicesParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListBigSwitchBcfDevicesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BigSwitchBCFService) NewListBigSwitchBcfDevicesParams() *ListBigSwitchBcfDevicesParams {
|
||||
p := &ListBigSwitchBcfDevicesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists BigSwitch BCF Controller devices
|
||||
func (s *BigSwitchBCFService) ListBigSwitchBcfDevices(p *ListBigSwitchBcfDevicesParams) (*ListBigSwitchBcfDevicesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listBigSwitchBcfDevices", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListBigSwitchBcfDevicesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListBigSwitchBcfDevicesResponse struct {
|
||||
Count int `json:"count"`
|
||||
BigSwitchBcfDevices []*BigSwitchBcfDevice `json:"bigswitchbcfdevice"`
|
||||
}
|
||||
|
||||
type BigSwitchBcfDevice struct {
|
||||
Bcfdeviceid string `json:"bcfdeviceid"`
|
||||
Bigswitchdevicename string `json:"bigswitchdevicename"`
|
||||
Hostname string `json:"hostname"`
|
||||
Nat bool `json:"nat"`
|
||||
Password string `json:"password"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Username string `json:"username"`
|
||||
}
|
508
vendor/github.com/xanzy/go-cloudstack/cloudstack/BrocadeVCSService.go
generated
vendored
Normal file
508
vendor/github.com/xanzy/go-cloudstack/cloudstack/BrocadeVCSService.go
generated
vendored
Normal file
|
@ -0,0 +1,508 @@
|
|||
//
|
||||
// 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"
|
||||
)
|
||||
|
||||
type AddBrocadeVcsDeviceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *AddBrocadeVcsDeviceParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["hostname"]; found {
|
||||
u.Set("hostname", v.(string))
|
||||
}
|
||||
if v, found := p.p["password"]; found {
|
||||
u.Set("password", v.(string))
|
||||
}
|
||||
if v, found := p.p["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["username"]; found {
|
||||
u.Set("username", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *AddBrocadeVcsDeviceParams) SetHostname(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostname"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBrocadeVcsDeviceParams) SetPassword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["password"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBrocadeVcsDeviceParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddBrocadeVcsDeviceParams) 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 AddBrocadeVcsDeviceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BrocadeVCSService) NewAddBrocadeVcsDeviceParams(hostname string, password string, physicalnetworkid string, username string) *AddBrocadeVcsDeviceParams {
|
||||
p := &AddBrocadeVcsDeviceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["hostname"] = hostname
|
||||
p.p["password"] = password
|
||||
p.p["physicalnetworkid"] = physicalnetworkid
|
||||
p.p["username"] = username
|
||||
return p
|
||||
}
|
||||
|
||||
// Adds a Brocade VCS Switch
|
||||
func (s *BrocadeVCSService) AddBrocadeVcsDevice(p *AddBrocadeVcsDeviceParams) (*AddBrocadeVcsDeviceResponse, error) {
|
||||
resp, err := s.cs.newRequest("addBrocadeVcsDevice", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r AddBrocadeVcsDeviceResponse
|
||||
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 AddBrocadeVcsDeviceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Brocadedevicename string `json:"brocadedevicename"`
|
||||
Hostname string `json:"hostname"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Vcsdeviceid string `json:"vcsdeviceid"`
|
||||
}
|
||||
|
||||
type DeleteBrocadeVcsDeviceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteBrocadeVcsDeviceParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["vcsdeviceid"]; found {
|
||||
u.Set("vcsdeviceid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DeleteBrocadeVcsDeviceParams) 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 DeleteBrocadeVcsDeviceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BrocadeVCSService) NewDeleteBrocadeVcsDeviceParams(vcsdeviceid string) *DeleteBrocadeVcsDeviceParams {
|
||||
p := &DeleteBrocadeVcsDeviceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["vcsdeviceid"] = vcsdeviceid
|
||||
return p
|
||||
}
|
||||
|
||||
// delete a Brocade VCS Switch
|
||||
func (s *BrocadeVCSService) DeleteBrocadeVcsDevice(p *DeleteBrocadeVcsDeviceParams) (*DeleteBrocadeVcsDeviceResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteBrocadeVcsDevice", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteBrocadeVcsDeviceResponse
|
||||
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 DeleteBrocadeVcsDeviceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
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"`
|
||||
Externalid string `json:"externalid"`
|
||||
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"`
|
||||
Redundantrouter bool `json:"redundantrouter"`
|
||||
Related string `json:"related"`
|
||||
Reservediprange string `json:"reservediprange"`
|
||||
Restartrequired bool `json:"restartrequired"`
|
||||
Service []BrocadeVcsDeviceNetworkService `json:"service"`
|
||||
Specifyipranges bool `json:"specifyipranges"`
|
||||
State string `json:"state"`
|
||||
Strechedl2subnet bool `json:"strechedl2subnet"`
|
||||
Subdomainaccess bool `json:"subdomainaccess"`
|
||||
Tags []Tags `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 BrocadeVcsDeviceNetworkService struct {
|
||||
Capability []BrocadeVcsDeviceNetworkServiceCapability `json:"capability"`
|
||||
Name string `json:"name"`
|
||||
Provider []BrocadeVcsDeviceNetworkServiceProvider `json:"provider"`
|
||||
}
|
||||
|
||||
type BrocadeVcsDeviceNetworkServiceProvider 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"`
|
||||
}
|
||||
|
||||
type BrocadeVcsDeviceNetworkServiceCapability struct {
|
||||
Canchooseservicecapability bool `json:"canchooseservicecapability"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
type ListBrocadeVcsDevicesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListBrocadeVcsDevicesParams) 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["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["vcsdeviceid"]; found {
|
||||
u.Set("vcsdeviceid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListBrocadeVcsDevicesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListBrocadeVcsDevicesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListBrocadeVcsDevicesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListBrocadeVcsDevicesParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListBrocadeVcsDevicesParams) 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 ListBrocadeVcsDevicesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *BrocadeVCSService) NewListBrocadeVcsDevicesParams() *ListBrocadeVcsDevicesParams {
|
||||
p := &ListBrocadeVcsDevicesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists Brocade VCS Switches
|
||||
func (s *BrocadeVCSService) ListBrocadeVcsDevices(p *ListBrocadeVcsDevicesParams) (*ListBrocadeVcsDevicesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listBrocadeVcsDevices", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListBrocadeVcsDevicesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListBrocadeVcsDevicesResponse struct {
|
||||
Count int `json:"count"`
|
||||
BrocadeVcsDevices []*BrocadeVcsDevice `json:"brocadevcsdevice"`
|
||||
}
|
||||
|
||||
type BrocadeVcsDevice struct {
|
||||
Brocadedevicename string `json:"brocadedevicename"`
|
||||
Hostname string `json:"hostname"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Vcsdeviceid string `json:"vcsdeviceid"`
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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,10 +131,11 @@ func (s *CertificateService) UploadCustomCertificate(p *UploadCustomCertificateP
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UploadCustomCertificateResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -64,11 +64,12 @@ func (s *CloudIdentifierService) GetCloudIdentifier(p *GetCloudIdentifierParams)
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type GetCloudIdentifierResponse struct {
|
||||
Cloudidentifier string `json:"cloudidentifier,omitempty"`
|
||||
Signature string `json:"signature,omitempty"`
|
||||
Userid string `json:"userid,omitempty"`
|
||||
Cloudidentifier string `json:"cloudidentifier"`
|
||||
Signature string `json:"signature"`
|
||||
Userid string `json:"userid"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -269,35 +269,141 @@ func (s *ClusterService) AddCluster(p *AddClusterParams) (*AddClusterResponse, e
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddClusterResponse struct {
|
||||
Allocationstate string `json:"allocationstate,omitempty"`
|
||||
Capacity []struct {
|
||||
Capacitytotal int64 `json:"capacitytotal,omitempty"`
|
||||
Capacityused int64 `json:"capacityused,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Percentused string `json:"percentused,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
} `json:"capacity,omitempty"`
|
||||
Clustertype string `json:"clustertype,omitempty"`
|
||||
Cpuovercommitratio string `json:"cpuovercommitratio,omitempty"`
|
||||
Hypervisortype string `json:"hypervisortype,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Managedstate string `json:"managedstate,omitempty"`
|
||||
Memoryovercommitratio string `json:"memoryovercommitratio,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Ovm3vip string `json:"ovm3vip,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
Allocationstate string `json:"allocationstate"`
|
||||
Capacity []AddClusterResponseCapacity `json:"capacity"`
|
||||
Clustertype string `json:"clustertype"`
|
||||
Cpuovercommitratio string `json:"cpuovercommitratio"`
|
||||
Hypervisortype string `json:"hypervisortype"`
|
||||
Id string `json:"id"`
|
||||
Managedstate string `json:"managedstate"`
|
||||
Memoryovercommitratio string `json:"memoryovercommitratio"`
|
||||
Name string `json:"name"`
|
||||
Ovm3vip string `json:"ovm3vip"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Resourcedetails map[string]string `json:"resourcedetails"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type AddClusterResponseCapacity struct {
|
||||
Capacityallocated int64 `json:"capacityallocated"`
|
||||
Capacitytotal int64 `json:"capacitytotal"`
|
||||
Capacityused int64 `json:"capacityused"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Name string `json:"name"`
|
||||
Percentused string `json:"percentused"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Type int `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type DedicateClusterParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DedicateClusterParams) 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["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
if v, found := p.p["domainid"]; found {
|
||||
u.Set("domainid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DedicateClusterParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateClusterParams) SetClusterid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clusterid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateClusterParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DedicateClusterParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ClusterService) NewDedicateClusterParams(clusterid string, domainid string) *DedicateClusterParams {
|
||||
p := &DedicateClusterParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["clusterid"] = clusterid
|
||||
p.p["domainid"] = domainid
|
||||
return p
|
||||
}
|
||||
|
||||
// Dedicate an existing cluster
|
||||
func (s *ClusterService) DedicateCluster(p *DedicateClusterParams) (*DedicateClusterResponse, error) {
|
||||
resp, err := s.cs.newRequest("dedicateCluster", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DedicateClusterResponse
|
||||
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 DedicateClusterResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Accountid string `json:"accountid"`
|
||||
Affinitygroupid string `json:"affinitygroupid"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Domainid string `json:"domainid"`
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
type DeleteClusterParams struct {
|
||||
|
@ -343,141 +449,196 @@ func (s *ClusterService) DeleteCluster(p *DeleteClusterParams) (*DeleteClusterRe
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteClusterResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type UpdateClusterParams struct {
|
||||
func (r *DeleteClusterResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteClusterResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type DisableOutOfBandManagementForClusterParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) toURLValues() url.Values {
|
||||
func (p *DisableOutOfBandManagementForClusterParams) 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["clustername"]; found {
|
||||
u.Set("clustername", 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["managedstate"]; found {
|
||||
u.Set("managedstate", v.(string))
|
||||
if v, found := p.p["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetAllocationstate(v string) {
|
||||
func (p *DisableOutOfBandManagementForClusterParams) SetClusterid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["allocationstate"] = v
|
||||
p.p["clusterid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetClustername(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clustername"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetClustertype(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clustertype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetHypervisor(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hypervisor"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetManagedstate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["managedstate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateClusterParams instance,
|
||||
// You should always use this function to get a new DisableOutOfBandManagementForClusterParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ClusterService) NewUpdateClusterParams(id string) *UpdateClusterParams {
|
||||
p := &UpdateClusterParams{}
|
||||
func (s *ClusterService) NewDisableOutOfBandManagementForClusterParams(clusterid string) *DisableOutOfBandManagementForClusterParams {
|
||||
p := &DisableOutOfBandManagementForClusterParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
p.p["clusterid"] = clusterid
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates an existing cluster
|
||||
func (s *ClusterService) UpdateCluster(p *UpdateClusterParams) (*UpdateClusterResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateCluster", p.toURLValues())
|
||||
// Disables out-of-band management for a cluster
|
||||
func (s *ClusterService) DisableOutOfBandManagementForCluster(p *DisableOutOfBandManagementForClusterParams) (*DisableOutOfBandManagementForClusterResponse, error) {
|
||||
resp, err := s.cs.newRequest("disableOutOfBandManagementForCluster", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateClusterResponse
|
||||
var r DisableOutOfBandManagementForClusterResponse
|
||||
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 UpdateClusterResponse struct {
|
||||
Allocationstate string `json:"allocationstate,omitempty"`
|
||||
Capacity []struct {
|
||||
Capacitytotal int64 `json:"capacitytotal,omitempty"`
|
||||
Capacityused int64 `json:"capacityused,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Percentused string `json:"percentused,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
} `json:"capacity,omitempty"`
|
||||
Clustertype string `json:"clustertype,omitempty"`
|
||||
Cpuovercommitratio string `json:"cpuovercommitratio,omitempty"`
|
||||
Hypervisortype string `json:"hypervisortype,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Managedstate string `json:"managedstate,omitempty"`
|
||||
Memoryovercommitratio string `json:"memoryovercommitratio,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Ovm3vip string `json:"ovm3vip,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
type DisableOutOfBandManagementForClusterResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Action string `json:"action"`
|
||||
Address string `json:"address"`
|
||||
Description string `json:"description"`
|
||||
Driver string `json:"driver"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Hostid string `json:"hostid"`
|
||||
Password string `json:"password"`
|
||||
Port string `json:"port"`
|
||||
Powerstate string `json:"powerstate"`
|
||||
Status bool `json:"status"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type EnableOutOfBandManagementForClusterParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *EnableOutOfBandManagementForClusterParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *EnableOutOfBandManagementForClusterParams) SetClusterid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clusterid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new EnableOutOfBandManagementForClusterParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ClusterService) NewEnableOutOfBandManagementForClusterParams(clusterid string) *EnableOutOfBandManagementForClusterParams {
|
||||
p := &EnableOutOfBandManagementForClusterParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["clusterid"] = clusterid
|
||||
return p
|
||||
}
|
||||
|
||||
// Enables out-of-band management for a cluster
|
||||
func (s *ClusterService) EnableOutOfBandManagementForCluster(p *EnableOutOfBandManagementForClusterParams) (*EnableOutOfBandManagementForClusterResponse, error) {
|
||||
resp, err := s.cs.newRequest("enableOutOfBandManagementForCluster", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r EnableOutOfBandManagementForClusterResponse
|
||||
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 EnableOutOfBandManagementForClusterResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Action string `json:"action"`
|
||||
Address string `json:"address"`
|
||||
Description string `json:"description"`
|
||||
Driver string `json:"driver"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Hostid string `json:"hostid"`
|
||||
Password string `json:"password"`
|
||||
Port string `json:"port"`
|
||||
Powerstate string `json:"powerstate"`
|
||||
Status bool `json:"status"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type ListClustersParams struct {
|
||||
|
@ -642,7 +803,7 @@ func (s *ClusterService) GetClusterID(name string, opts ...OptionFunc) (string,
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -692,7 +853,7 @@ func (s *ClusterService) GetClusterByID(id string, opts ...OptionFunc) (*Cluster
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -729,6 +890,7 @@ func (s *ClusterService) ListClusters(p *ListClustersParams) (*ListClustersRespo
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -738,197 +900,36 @@ type ListClustersResponse struct {
|
|||
}
|
||||
|
||||
type Cluster struct {
|
||||
Allocationstate string `json:"allocationstate,omitempty"`
|
||||
Capacity []struct {
|
||||
Capacitytotal int64 `json:"capacitytotal,omitempty"`
|
||||
Capacityused int64 `json:"capacityused,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Percentused string `json:"percentused,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
} `json:"capacity,omitempty"`
|
||||
Clustertype string `json:"clustertype,omitempty"`
|
||||
Cpuovercommitratio string `json:"cpuovercommitratio,omitempty"`
|
||||
Hypervisortype string `json:"hypervisortype,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Managedstate string `json:"managedstate,omitempty"`
|
||||
Memoryovercommitratio string `json:"memoryovercommitratio,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Ovm3vip string `json:"ovm3vip,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
Allocationstate string `json:"allocationstate"`
|
||||
Capacity []ClusterCapacity `json:"capacity"`
|
||||
Clustertype string `json:"clustertype"`
|
||||
Cpuovercommitratio string `json:"cpuovercommitratio"`
|
||||
Hypervisortype string `json:"hypervisortype"`
|
||||
Id string `json:"id"`
|
||||
Managedstate string `json:"managedstate"`
|
||||
Memoryovercommitratio string `json:"memoryovercommitratio"`
|
||||
Name string `json:"name"`
|
||||
Ovm3vip string `json:"ovm3vip"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Resourcedetails map[string]string `json:"resourcedetails"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type DedicateClusterParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DedicateClusterParams) 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["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
if v, found := p.p["domainid"]; found {
|
||||
u.Set("domainid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DedicateClusterParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateClusterParams) SetClusterid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clusterid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateClusterParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DedicateClusterParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ClusterService) NewDedicateClusterParams(clusterid string, domainid string) *DedicateClusterParams {
|
||||
p := &DedicateClusterParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["clusterid"] = clusterid
|
||||
p.p["domainid"] = domainid
|
||||
return p
|
||||
}
|
||||
|
||||
// Dedicate an existing cluster
|
||||
func (s *ClusterService) DedicateCluster(p *DedicateClusterParams) (*DedicateClusterResponse, error) {
|
||||
resp, err := s.cs.newRequest("dedicateCluster", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DedicateClusterResponse
|
||||
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 DedicateClusterResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
Affinitygroupid string `json:"affinitygroupid,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
type ReleaseDedicatedClusterParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ReleaseDedicatedClusterParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ReleaseDedicatedClusterParams) SetClusterid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clusterid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ReleaseDedicatedClusterParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ClusterService) NewReleaseDedicatedClusterParams(clusterid string) *ReleaseDedicatedClusterParams {
|
||||
p := &ReleaseDedicatedClusterParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["clusterid"] = clusterid
|
||||
return p
|
||||
}
|
||||
|
||||
// Release the dedication for cluster
|
||||
func (s *ClusterService) ReleaseDedicatedCluster(p *ReleaseDedicatedClusterParams) (*ReleaseDedicatedClusterResponse, error) {
|
||||
resp, err := s.cs.newRequest("releaseDedicatedCluster", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ReleaseDedicatedClusterResponse
|
||||
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 ReleaseDedicatedClusterResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
type ClusterCapacity struct {
|
||||
Capacityallocated int64 `json:"capacityallocated"`
|
||||
Capacitytotal int64 `json:"capacitytotal"`
|
||||
Capacityused int64 `json:"capacityused"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Name string `json:"name"`
|
||||
Percentused string `json:"percentused"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Type int `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type ListDedicatedClustersParams struct {
|
||||
|
@ -1041,6 +1042,7 @@ func (s *ClusterService) ListDedicatedClusters(p *ListDedicatedClustersParams) (
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -1050,10 +1052,213 @@ type ListDedicatedClustersResponse struct {
|
|||
}
|
||||
|
||||
type DedicatedCluster struct {
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
Affinitygroupid string `json:"affinitygroupid,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Accountid string `json:"accountid"`
|
||||
Affinitygroupid string `json:"affinitygroupid"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Domainid string `json:"domainid"`
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
type ReleaseDedicatedClusterParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ReleaseDedicatedClusterParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ReleaseDedicatedClusterParams) SetClusterid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clusterid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ReleaseDedicatedClusterParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ClusterService) NewReleaseDedicatedClusterParams(clusterid string) *ReleaseDedicatedClusterParams {
|
||||
p := &ReleaseDedicatedClusterParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["clusterid"] = clusterid
|
||||
return p
|
||||
}
|
||||
|
||||
// Release the dedication for cluster
|
||||
func (s *ClusterService) ReleaseDedicatedCluster(p *ReleaseDedicatedClusterParams) (*ReleaseDedicatedClusterResponse, error) {
|
||||
resp, err := s.cs.newRequest("releaseDedicatedCluster", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ReleaseDedicatedClusterResponse
|
||||
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 ReleaseDedicatedClusterResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type UpdateClusterParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) 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["clustername"]; found {
|
||||
u.Set("clustername", 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["managedstate"]; found {
|
||||
u.Set("managedstate", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetAllocationstate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["allocationstate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetClustername(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clustername"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetClustertype(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clustertype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetHypervisor(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hypervisor"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateClusterParams) SetManagedstate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["managedstate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateClusterParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ClusterService) NewUpdateClusterParams(id string) *UpdateClusterParams {
|
||||
p := &UpdateClusterParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates an existing cluster
|
||||
func (s *ClusterService) UpdateCluster(p *UpdateClusterParams) (*UpdateClusterResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateCluster", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateClusterResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateClusterResponse struct {
|
||||
Allocationstate string `json:"allocationstate"`
|
||||
Capacity []UpdateClusterResponseCapacity `json:"capacity"`
|
||||
Clustertype string `json:"clustertype"`
|
||||
Cpuovercommitratio string `json:"cpuovercommitratio"`
|
||||
Hypervisortype string `json:"hypervisortype"`
|
||||
Id string `json:"id"`
|
||||
Managedstate string `json:"managedstate"`
|
||||
Memoryovercommitratio string `json:"memoryovercommitratio"`
|
||||
Name string `json:"name"`
|
||||
Ovm3vip string `json:"ovm3vip"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Resourcedetails map[string]string `json:"resourcedetails"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type UpdateClusterResponseCapacity struct {
|
||||
Capacityallocated int64 `json:"capacityallocated"`
|
||||
Capacitytotal int64 `json:"capacitytotal"`
|
||||
Capacityused int64 `json:"capacityused"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Name string `json:"name"`
|
||||
Percentused string `json:"percentused"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Type int `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -22,114 +22,62 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
type UpdateConfigurationParams struct {
|
||||
type ListCapabilitiesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) toURLValues() url.Values {
|
||||
func (p *ListCapabilitiesParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["accountid"]; found {
|
||||
u.Set("accountid", v.(string))
|
||||
}
|
||||
if v, found := p.p["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["storageid"]; found {
|
||||
u.Set("storageid", v.(string))
|
||||
}
|
||||
if v, found := p.p["value"]; found {
|
||||
u.Set("value", v.(string))
|
||||
}
|
||||
if v, found := p.p["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) SetAccountid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["accountid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) SetClusterid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["clusterid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) SetStorageid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["storageid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) SetValue(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["value"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) 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 UpdateConfigurationParams instance,
|
||||
// You should always use this function to get a new ListCapabilitiesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ConfigurationService) NewUpdateConfigurationParams(name string) *UpdateConfigurationParams {
|
||||
p := &UpdateConfigurationParams{}
|
||||
func (s *ConfigurationService) NewListCapabilitiesParams() *ListCapabilitiesParams {
|
||||
p := &ListCapabilitiesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["name"] = name
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a configuration.
|
||||
func (s *ConfigurationService) UpdateConfiguration(p *UpdateConfigurationParams) (*UpdateConfigurationResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateConfiguration", p.toURLValues())
|
||||
// Lists capabilities
|
||||
func (s *ConfigurationService) ListCapabilities(p *ListCapabilitiesParams) (*ListCapabilitiesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listCapabilities", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateConfigurationResponse
|
||||
var r ListCapabilitiesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateConfigurationResponse struct {
|
||||
Category string `json:"category,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Id int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
type ListCapabilitiesResponse struct {
|
||||
Count int `json:"count"`
|
||||
Capabilities []*Capability `json:"capability"`
|
||||
}
|
||||
|
||||
type Capability struct {
|
||||
Allowusercreateprojects bool `json:"allowusercreateprojects"`
|
||||
Allowuserexpungerecovervm bool `json:"allowuserexpungerecovervm"`
|
||||
Allowuserviewdestroyedvm bool `json:"allowuserviewdestroyedvm"`
|
||||
Apilimitinterval int `json:"apilimitinterval"`
|
||||
Apilimitmax int `json:"apilimitmax"`
|
||||
Cloudstackversion string `json:"cloudstackversion"`
|
||||
Customdiskofferingmaxsize int64 `json:"customdiskofferingmaxsize"`
|
||||
Customdiskofferingminsize int64 `json:"customdiskofferingminsize"`
|
||||
Dynamicrolesenabled bool `json:"dynamicrolesenabled"`
|
||||
Kvmsnapshotenabled bool `json:"kvmsnapshotenabled"`
|
||||
Projectinviterequired bool `json:"projectinviterequired"`
|
||||
Regionsecondaryenabled bool `json:"regionsecondaryenabled"`
|
||||
Securitygroupsenabled bool `json:"securitygroupsenabled"`
|
||||
SupportELB string `json:"supportELB"`
|
||||
Userpublictemplateenabled bool `json:"userpublictemplateenabled"`
|
||||
}
|
||||
|
||||
type ListConfigurationsParams struct {
|
||||
|
@ -150,6 +98,12 @@ func (p *ListConfigurationsParams) toURLValues() url.Values {
|
|||
if v, found := p.p["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
if v, found := p.p["domainid"]; found {
|
||||
u.Set("domainid", v.(string))
|
||||
}
|
||||
if v, found := p.p["imagestoreuuid"]; found {
|
||||
u.Set("imagestoreuuid", v.(string))
|
||||
}
|
||||
if v, found := p.p["keyword"]; found {
|
||||
u.Set("keyword", v.(string))
|
||||
}
|
||||
|
@ -197,6 +151,22 @@ func (p *ListConfigurationsParams) SetClusterid(v string) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *ListConfigurationsParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListConfigurationsParams) SetImagestoreuuid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["imagestoreuuid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListConfigurationsParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
|
@ -264,6 +234,7 @@ func (s *ConfigurationService) ListConfigurations(p *ListConfigurationsParams) (
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -273,68 +244,12 @@ type ListConfigurationsResponse struct {
|
|||
}
|
||||
|
||||
type Configuration struct {
|
||||
Category string `json:"category,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Id int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
type ListCapabilitiesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListCapabilitiesParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListCapabilitiesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ConfigurationService) NewListCapabilitiesParams() *ListCapabilitiesParams {
|
||||
p := &ListCapabilitiesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists capabilities
|
||||
func (s *ConfigurationService) ListCapabilities(p *ListCapabilitiesParams) (*ListCapabilitiesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listCapabilities", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListCapabilitiesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListCapabilitiesResponse struct {
|
||||
Count int `json:"count"`
|
||||
Capabilities []*Capability `json:"capability"`
|
||||
}
|
||||
|
||||
type Capability struct {
|
||||
Allowusercreateprojects bool `json:"allowusercreateprojects,omitempty"`
|
||||
Allowuserexpungerecovervm bool `json:"allowuserexpungerecovervm,omitempty"`
|
||||
Allowuserviewdestroyedvm bool `json:"allowuserviewdestroyedvm,omitempty"`
|
||||
Apilimitinterval int `json:"apilimitinterval,omitempty"`
|
||||
Apilimitmax int `json:"apilimitmax,omitempty"`
|
||||
Cloudstackversion string `json:"cloudstackversion,omitempty"`
|
||||
Customdiskofferingmaxsize int64 `json:"customdiskofferingmaxsize,omitempty"`
|
||||
Customdiskofferingminsize int64 `json:"customdiskofferingminsize,omitempty"`
|
||||
Kvmsnapshotenabled bool `json:"kvmsnapshotenabled,omitempty"`
|
||||
Projectinviterequired bool `json:"projectinviterequired,omitempty"`
|
||||
Regionsecondaryenabled bool `json:"regionsecondaryenabled,omitempty"`
|
||||
Securitygroupsenabled bool `json:"securitygroupsenabled,omitempty"`
|
||||
SupportELB string `json:"supportELB,omitempty"`
|
||||
Userpublictemplateenabled bool `json:"userpublictemplateenabled,omitempty"`
|
||||
Category string `json:"category"`
|
||||
Description string `json:"description"`
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Scope string `json:"scope"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
type ListDeploymentPlannersParams struct {
|
||||
|
@ -403,6 +318,7 @@ func (s *ConfigurationService) ListDeploymentPlanners(p *ListDeploymentPlannersP
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -412,222 +328,138 @@ type ListDeploymentPlannersResponse struct {
|
|||
}
|
||||
|
||||
type DeploymentPlanner struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ListLdapConfigurationsParams struct {
|
||||
type UpdateConfigurationParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListLdapConfigurationsParams) toURLValues() url.Values {
|
||||
func (p *UpdateConfigurationParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["hostname"]; found {
|
||||
u.Set("hostname", v.(string))
|
||||
if v, found := p.p["accountid"]; found {
|
||||
u.Set("accountid", v.(string))
|
||||
}
|
||||
if v, found := p.p["keyword"]; found {
|
||||
u.Set("keyword", v.(string))
|
||||
if v, found := p.p["clusterid"]; found {
|
||||
u.Set("clusterid", v.(string))
|
||||
}
|
||||
if v, found := p.p["page"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("page", vv)
|
||||
if v, found := p.p["domainid"]; found {
|
||||
u.Set("domainid", v.(string))
|
||||
}
|
||||
if v, found := p.p["pagesize"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("pagesize", vv)
|
||||
if v, found := p.p["imagestoreuuid"]; found {
|
||||
u.Set("imagestoreuuid", v.(string))
|
||||
}
|
||||
if v, found := p.p["port"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("port", vv)
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["storageid"]; found {
|
||||
u.Set("storageid", v.(string))
|
||||
}
|
||||
if v, found := p.p["value"]; found {
|
||||
u.Set("value", v.(string))
|
||||
}
|
||||
if v, found := p.p["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListLdapConfigurationsParams) SetHostname(v string) {
|
||||
func (p *UpdateConfigurationParams) SetAccountid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostname"] = v
|
||||
p.p["accountid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListLdapConfigurationsParams) SetKeyword(v string) {
|
||||
func (p *UpdateConfigurationParams) SetClusterid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
p.p["clusterid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListLdapConfigurationsParams) SetPage(v int) {
|
||||
func (p *UpdateConfigurationParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListLdapConfigurationsParams) SetPagesize(v int) {
|
||||
func (p *UpdateConfigurationParams) SetImagestoreuuid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
p.p["imagestoreuuid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListLdapConfigurationsParams) SetPort(v int) {
|
||||
func (p *UpdateConfigurationParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["port"] = v
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListLdapConfigurationsParams instance,
|
||||
func (p *UpdateConfigurationParams) SetStorageid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["storageid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) SetValue(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["value"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateConfigurationParams) 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 UpdateConfigurationParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ConfigurationService) NewListLdapConfigurationsParams() *ListLdapConfigurationsParams {
|
||||
p := &ListLdapConfigurationsParams{}
|
||||
func (s *ConfigurationService) NewUpdateConfigurationParams(name string) *UpdateConfigurationParams {
|
||||
p := &UpdateConfigurationParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["name"] = name
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists all LDAP configurations
|
||||
func (s *ConfigurationService) ListLdapConfigurations(p *ListLdapConfigurationsParams) (*ListLdapConfigurationsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listLdapConfigurations", p.toURLValues())
|
||||
// Updates a configuration.
|
||||
func (s *ConfigurationService) UpdateConfiguration(p *UpdateConfigurationParams) (*UpdateConfigurationResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateConfiguration", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListLdapConfigurationsResponse
|
||||
var r UpdateConfigurationResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListLdapConfigurationsResponse struct {
|
||||
Count int `json:"count"`
|
||||
LdapConfigurations []*LdapConfiguration `json:"ldapconfiguration"`
|
||||
}
|
||||
|
||||
type LdapConfiguration struct {
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Port int `json:"port,omitempty"`
|
||||
}
|
||||
|
||||
type AddLdapConfigurationParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *AddLdapConfigurationParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["hostname"]; found {
|
||||
u.Set("hostname", v.(string))
|
||||
}
|
||||
if v, found := p.p["port"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("port", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *AddLdapConfigurationParams) SetHostname(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostname"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddLdapConfigurationParams) SetPort(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["port"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new AddLdapConfigurationParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ConfigurationService) NewAddLdapConfigurationParams(hostname string, port int) *AddLdapConfigurationParams {
|
||||
p := &AddLdapConfigurationParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["hostname"] = hostname
|
||||
p.p["port"] = port
|
||||
return p
|
||||
}
|
||||
|
||||
// Add a new Ldap Configuration
|
||||
func (s *ConfigurationService) AddLdapConfiguration(p *AddLdapConfigurationParams) (*AddLdapConfigurationResponse, error) {
|
||||
resp, err := s.cs.newRequest("addLdapConfiguration", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r AddLdapConfigurationResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddLdapConfigurationResponse struct {
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Port int `json:"port,omitempty"`
|
||||
}
|
||||
|
||||
type DeleteLdapConfigurationParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteLdapConfigurationParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["hostname"]; found {
|
||||
u.Set("hostname", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DeleteLdapConfigurationParams) SetHostname(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostname"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DeleteLdapConfigurationParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ConfigurationService) NewDeleteLdapConfigurationParams(hostname string) *DeleteLdapConfigurationParams {
|
||||
p := &DeleteLdapConfigurationParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["hostname"] = hostname
|
||||
return p
|
||||
}
|
||||
|
||||
// Remove an Ldap Configuration
|
||||
func (s *ConfigurationService) DeleteLdapConfiguration(p *DeleteLdapConfigurationParams) (*DeleteLdapConfigurationResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteLdapConfiguration", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteLdapConfigurationResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteLdapConfigurationResponse struct {
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Port int `json:"port,omitempty"`
|
||||
type UpdateConfigurationResponse struct {
|
||||
Category string `json:"category"`
|
||||
Description string `json:"description"`
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Scope string `json:"scope"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
//
|
||||
// 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 CustomServiceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *CustomServiceParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
|
||||
for k, v := range p.p {
|
||||
switch t := v.(type) {
|
||||
case bool:
|
||||
u.Set(k, strconv.FormatBool(t))
|
||||
case int:
|
||||
u.Set(k, strconv.Itoa(t))
|
||||
case int64:
|
||||
vv := strconv.FormatInt(t, 10)
|
||||
u.Set(k, vv)
|
||||
case string:
|
||||
u.Set(k, t)
|
||||
case []string:
|
||||
u.Set(k, strings.Join(t, ", "))
|
||||
case map[string]string:
|
||||
i := 0
|
||||
for kk, vv := range t {
|
||||
u.Set(fmt.Sprintf("%s[%d].%s", k, i, kk), vv)
|
||||
i++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *CustomServiceParams) SetParam(param string, v interface{}) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p[param] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (s *CustomService) CustomRequest(api string, p *CustomServiceParams, result interface{}) error {
|
||||
resp, err := s.cs.newRequest(api, p.toURLValues())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return json.Unmarshal(resp, result)
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -255,147 +255,32 @@ func (s *DiskOfferingService) CreateDiskOffering(p *CreateDiskOfferingParams) (*
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateDiskOfferingResponse struct {
|
||||
CacheMode string `json:"cacheMode,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate,omitempty"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate,omitempty"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate,omitempty"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate,omitempty"`
|
||||
Disksize int64 `json:"disksize,omitempty"`
|
||||
Displayoffering bool `json:"displayoffering,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Iscustomized bool `json:"iscustomized,omitempty"`
|
||||
Iscustomizediops bool `json:"iscustomizediops,omitempty"`
|
||||
Maxiops int64 `json:"maxiops,omitempty"`
|
||||
Miniops int64 `json:"miniops,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Provisioningtype string `json:"provisioningtype,omitempty"`
|
||||
Storagetype string `json:"storagetype,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateDiskOfferingParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["displayoffering"]; found {
|
||||
vv := strconv.FormatBool(v.(bool))
|
||||
u.Set("displayoffering", vv)
|
||||
}
|
||||
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["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["sortkey"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("sortkey", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetDisplayoffering(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["displayoffering"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetDisplaytext(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["displaytext"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetSortkey(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["sortkey"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateDiskOfferingParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *DiskOfferingService) NewUpdateDiskOfferingParams(id string) *UpdateDiskOfferingParams {
|
||||
p := &UpdateDiskOfferingParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a disk offering.
|
||||
func (s *DiskOfferingService) UpdateDiskOffering(p *UpdateDiskOfferingParams) (*UpdateDiskOfferingResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateDiskOffering", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateDiskOfferingResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateDiskOfferingResponse struct {
|
||||
CacheMode string `json:"cacheMode,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate,omitempty"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate,omitempty"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate,omitempty"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate,omitempty"`
|
||||
Disksize int64 `json:"disksize,omitempty"`
|
||||
Displayoffering bool `json:"displayoffering,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Iscustomized bool `json:"iscustomized,omitempty"`
|
||||
Iscustomizediops bool `json:"iscustomizediops,omitempty"`
|
||||
Maxiops int64 `json:"maxiops,omitempty"`
|
||||
Miniops int64 `json:"miniops,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Provisioningtype string `json:"provisioningtype,omitempty"`
|
||||
Storagetype string `json:"storagetype,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
CacheMode string `json:"cacheMode"`
|
||||
Created string `json:"created"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate"`
|
||||
Disksize int64 `json:"disksize"`
|
||||
Displayoffering bool `json:"displayoffering"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"`
|
||||
Id string `json:"id"`
|
||||
Iscustomized bool `json:"iscustomized"`
|
||||
Iscustomizediops bool `json:"iscustomizediops"`
|
||||
Maxiops int64 `json:"maxiops"`
|
||||
Miniops int64 `json:"miniops"`
|
||||
Name string `json:"name"`
|
||||
Provisioningtype string `json:"provisioningtype"`
|
||||
Storagetype string `json:"storagetype"`
|
||||
Tags string `json:"tags"`
|
||||
}
|
||||
|
||||
type DeleteDiskOfferingParams struct {
|
||||
|
@ -441,12 +326,32 @@ func (s *DiskOfferingService) DeleteDiskOffering(p *DeleteDiskOfferingParams) (*
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteDiskOfferingResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteDiskOfferingResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteDiskOfferingResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListDiskOfferingsParams struct {
|
||||
|
@ -568,7 +473,7 @@ func (s *DiskOfferingService) GetDiskOfferingID(name string, opts ...OptionFunc)
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -618,7 +523,7 @@ func (s *DiskOfferingService) GetDiskOfferingByID(id string, opts ...OptionFunc)
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -655,6 +560,7 @@ func (s *DiskOfferingService) ListDiskOfferings(p *ListDiskOfferingsParams) (*Li
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -664,25 +570,142 @@ type ListDiskOfferingsResponse struct {
|
|||
}
|
||||
|
||||
type DiskOffering struct {
|
||||
CacheMode string `json:"cacheMode,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate,omitempty"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate,omitempty"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate,omitempty"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate,omitempty"`
|
||||
Disksize int64 `json:"disksize,omitempty"`
|
||||
Displayoffering bool `json:"displayoffering,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Iscustomized bool `json:"iscustomized,omitempty"`
|
||||
Iscustomizediops bool `json:"iscustomizediops,omitempty"`
|
||||
Maxiops int64 `json:"maxiops,omitempty"`
|
||||
Miniops int64 `json:"miniops,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Provisioningtype string `json:"provisioningtype,omitempty"`
|
||||
Storagetype string `json:"storagetype,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
CacheMode string `json:"cacheMode"`
|
||||
Created string `json:"created"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate"`
|
||||
Disksize int64 `json:"disksize"`
|
||||
Displayoffering bool `json:"displayoffering"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"`
|
||||
Id string `json:"id"`
|
||||
Iscustomized bool `json:"iscustomized"`
|
||||
Iscustomizediops bool `json:"iscustomizediops"`
|
||||
Maxiops int64 `json:"maxiops"`
|
||||
Miniops int64 `json:"miniops"`
|
||||
Name string `json:"name"`
|
||||
Provisioningtype string `json:"provisioningtype"`
|
||||
Storagetype string `json:"storagetype"`
|
||||
Tags string `json:"tags"`
|
||||
}
|
||||
|
||||
type UpdateDiskOfferingParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["displayoffering"]; found {
|
||||
vv := strconv.FormatBool(v.(bool))
|
||||
u.Set("displayoffering", vv)
|
||||
}
|
||||
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["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["sortkey"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("sortkey", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetDisplayoffering(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["displayoffering"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetDisplaytext(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["displaytext"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateDiskOfferingParams) SetSortkey(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["sortkey"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateDiskOfferingParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *DiskOfferingService) NewUpdateDiskOfferingParams(id string) *UpdateDiskOfferingParams {
|
||||
p := &UpdateDiskOfferingParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a disk offering.
|
||||
func (s *DiskOfferingService) UpdateDiskOffering(p *UpdateDiskOfferingParams) (*UpdateDiskOfferingResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateDiskOffering", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateDiskOfferingResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateDiskOfferingResponse struct {
|
||||
CacheMode string `json:"cacheMode"`
|
||||
Created string `json:"created"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate"`
|
||||
Disksize int64 `json:"disksize"`
|
||||
Displayoffering bool `json:"displayoffering"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"`
|
||||
Id string `json:"id"`
|
||||
Iscustomized bool `json:"iscustomized"`
|
||||
Iscustomizediops bool `json:"iscustomizediops"`
|
||||
Maxiops int64 `json:"maxiops"`
|
||||
Miniops int64 `json:"miniops"`
|
||||
Name string `json:"name"`
|
||||
Provisioningtype string `json:"provisioningtype"`
|
||||
Storagetype string `json:"storagetype"`
|
||||
Tags string `json:"tags"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -24,6 +24,258 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
type ArchiveEventsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["enddate"]; found {
|
||||
u.Set("enddate", v.(string))
|
||||
}
|
||||
if v, found := p.p["ids"]; found {
|
||||
vv := strings.Join(v.([]string), ",")
|
||||
u.Set("ids", vv)
|
||||
}
|
||||
if v, found := p.p["startdate"]; found {
|
||||
u.Set("startdate", v.(string))
|
||||
}
|
||||
if v, found := p.p["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) SetEnddate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["enddate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) SetIds(v []string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ids"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) SetStartdate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["startdate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ArchiveEventsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *EventService) NewArchiveEventsParams() *ArchiveEventsParams {
|
||||
p := &ArchiveEventsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Archive one or more events.
|
||||
func (s *EventService) ArchiveEvents(p *ArchiveEventsParams) (*ArchiveEventsResponse, error) {
|
||||
resp, err := s.cs.newRequest("archiveEvents", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ArchiveEventsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ArchiveEventsResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *ArchiveEventsResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias ArchiveEventsResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type DeleteEventsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["enddate"]; found {
|
||||
u.Set("enddate", v.(string))
|
||||
}
|
||||
if v, found := p.p["ids"]; found {
|
||||
vv := strings.Join(v.([]string), ",")
|
||||
u.Set("ids", vv)
|
||||
}
|
||||
if v, found := p.p["startdate"]; found {
|
||||
u.Set("startdate", v.(string))
|
||||
}
|
||||
if v, found := p.p["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) SetEnddate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["enddate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) SetIds(v []string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ids"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) SetStartdate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["startdate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DeleteEventsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *EventService) NewDeleteEventsParams() *DeleteEventsParams {
|
||||
p := &DeleteEventsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Delete one or more events.
|
||||
func (s *EventService) DeleteEvents(p *DeleteEventsParams) (*DeleteEventsResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteEvents", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteEventsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteEventsResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteEventsResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteEventsResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListEventTypesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListEventTypesParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListEventTypesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *EventService) NewListEventTypesParams() *ListEventTypesParams {
|
||||
p := &ListEventTypesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// List Event Types
|
||||
func (s *EventService) ListEventTypes(p *ListEventTypesParams) (*ListEventTypesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listEventTypes", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListEventTypesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListEventTypesResponse struct {
|
||||
Count int `json:"count"`
|
||||
EventTypes []*EventType `json:"eventtype"`
|
||||
}
|
||||
|
||||
type EventType struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ListEventsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -81,6 +333,9 @@ func (p *ListEventsParams) toURLValues() url.Values {
|
|||
if v, found := p.p["startdate"]; found {
|
||||
u.Set("startdate", v.(string))
|
||||
}
|
||||
if v, found := p.p["startid"]; found {
|
||||
u.Set("startid", v.(string))
|
||||
}
|
||||
if v, found := p.p["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
|
@ -199,6 +454,14 @@ func (p *ListEventsParams) SetStartdate(v string) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *ListEventsParams) SetStartid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["startid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListEventsParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
|
@ -222,7 +485,7 @@ func (s *EventService) GetEventByID(id string, opts ...OptionFunc) (*Event, int,
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -259,6 +522,7 @@ func (s *EventService) ListEvents(p *ListEventsParams) (*ListEventsResponse, err
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -268,228 +532,17 @@ type ListEventsResponse struct {
|
|||
}
|
||||
|
||||
type Event struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Level string `json:"level,omitempty"`
|
||||
Parentid string `json:"parentid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
}
|
||||
|
||||
type ListEventTypesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListEventTypesParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListEventTypesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *EventService) NewListEventTypesParams() *ListEventTypesParams {
|
||||
p := &ListEventTypesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// List Event Types
|
||||
func (s *EventService) ListEventTypes(p *ListEventTypesParams) (*ListEventTypesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listEventTypes", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListEventTypesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListEventTypesResponse struct {
|
||||
Count int `json:"count"`
|
||||
EventTypes []*EventType `json:"eventtype"`
|
||||
}
|
||||
|
||||
type EventType struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
type ArchiveEventsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["enddate"]; found {
|
||||
u.Set("enddate", v.(string))
|
||||
}
|
||||
if v, found := p.p["ids"]; found {
|
||||
vv := strings.Join(v.([]string), ",")
|
||||
u.Set("ids", vv)
|
||||
}
|
||||
if v, found := p.p["startdate"]; found {
|
||||
u.Set("startdate", v.(string))
|
||||
}
|
||||
if v, found := p.p["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) SetEnddate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["enddate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) SetIds(v []string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ids"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) SetStartdate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["startdate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ArchiveEventsParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ArchiveEventsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *EventService) NewArchiveEventsParams() *ArchiveEventsParams {
|
||||
p := &ArchiveEventsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Archive one or more events.
|
||||
func (s *EventService) ArchiveEvents(p *ArchiveEventsParams) (*ArchiveEventsResponse, error) {
|
||||
resp, err := s.cs.newRequest("archiveEvents", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ArchiveEventsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ArchiveEventsResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
}
|
||||
|
||||
type DeleteEventsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["enddate"]; found {
|
||||
u.Set("enddate", v.(string))
|
||||
}
|
||||
if v, found := p.p["ids"]; found {
|
||||
vv := strings.Join(v.([]string), ",")
|
||||
u.Set("ids", vv)
|
||||
}
|
||||
if v, found := p.p["startdate"]; found {
|
||||
u.Set("startdate", v.(string))
|
||||
}
|
||||
if v, found := p.p["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) SetEnddate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["enddate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) SetIds(v []string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ids"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) SetStartdate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["startdate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DeleteEventsParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DeleteEventsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *EventService) NewDeleteEventsParams() *DeleteEventsParams {
|
||||
p := &DeleteEventsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Delete one or more events.
|
||||
func (s *EventService) DeleteEvents(p *DeleteEventsParams) (*DeleteEventsResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteEvents", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteEventsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteEventsResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Created string `json:"created"`
|
||||
Description string `json:"description"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Id string `json:"id"`
|
||||
Level string `json:"level"`
|
||||
Parentid string `json:"parentid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
State string `json:"state"`
|
||||
Type string `json:"type"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
|
17
vendor/github.com/xanzy/go-cloudstack/cloudstack/ExtFirewallService.go
generated
vendored
Normal file
17
vendor/github.com/xanzy/go-cloudstack/cloudstack/ExtFirewallService.go
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// 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
|
17
vendor/github.com/xanzy/go-cloudstack/cloudstack/ExtLoadBalancerService.go
generated
vendored
Normal file
17
vendor/github.com/xanzy/go-cloudstack/cloudstack/ExtLoadBalancerService.go
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// 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
|
17
vendor/github.com/xanzy/go-cloudstack/cloudstack/ExternalDeviceService.go
generated
vendored
Normal file
17
vendor/github.com/xanzy/go-cloudstack/cloudstack/ExternalDeviceService.go
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// 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
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -24,140 +24,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
type ListHypervisorsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListHypervisorsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListHypervisorsParams) 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 ListHypervisorsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *HypervisorService) NewListHypervisorsParams() *ListHypervisorsParams {
|
||||
p := &ListHypervisorsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// List hypervisors
|
||||
func (s *HypervisorService) ListHypervisors(p *ListHypervisorsParams) (*ListHypervisorsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listHypervisors", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListHypervisorsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListHypervisorsResponse struct {
|
||||
Count int `json:"count"`
|
||||
Hypervisors []*Hypervisor `json:"hypervisor"`
|
||||
}
|
||||
|
||||
type Hypervisor struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateHypervisorCapabilitiesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateHypervisorCapabilitiesParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
u.Set("id", v.(string))
|
||||
}
|
||||
if v, found := p.p["maxguestslimit"]; found {
|
||||
vv := strconv.FormatInt(v.(int64), 10)
|
||||
u.Set("maxguestslimit", vv)
|
||||
}
|
||||
if v, found := p.p["securitygroupenabled"]; found {
|
||||
vv := strconv.FormatBool(v.(bool))
|
||||
u.Set("securitygroupenabled", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateHypervisorCapabilitiesParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateHypervisorCapabilitiesParams) SetMaxguestslimit(v int64) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["maxguestslimit"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateHypervisorCapabilitiesParams) SetSecuritygroupenabled(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["securitygroupenabled"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateHypervisorCapabilitiesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *HypervisorService) NewUpdateHypervisorCapabilitiesParams() *UpdateHypervisorCapabilitiesParams {
|
||||
p := &UpdateHypervisorCapabilitiesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a hypervisor capabilities.
|
||||
func (s *HypervisorService) UpdateHypervisorCapabilities(p *UpdateHypervisorCapabilitiesParams) (*UpdateHypervisorCapabilitiesResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateHypervisorCapabilities", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateHypervisorCapabilitiesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateHypervisorCapabilitiesResponse struct {
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Hypervisorversion string `json:"hypervisorversion,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Maxdatavolumeslimit int `json:"maxdatavolumeslimit,omitempty"`
|
||||
Maxguestslimit int64 `json:"maxguestslimit,omitempty"`
|
||||
Maxhostspercluster int `json:"maxhostspercluster,omitempty"`
|
||||
Securitygroupenabled bool `json:"securitygroupenabled,omitempty"`
|
||||
Storagemotionenabled bool `json:"storagemotionenabled,omitempty"`
|
||||
}
|
||||
|
||||
type ListHypervisorCapabilitiesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -242,7 +108,7 @@ func (s *HypervisorService) GetHypervisorCapabilityByID(id string, opts ...Optio
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -279,6 +145,7 @@ func (s *HypervisorService) ListHypervisorCapabilities(p *ListHypervisorCapabili
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -288,12 +155,148 @@ type ListHypervisorCapabilitiesResponse struct {
|
|||
}
|
||||
|
||||
type HypervisorCapability struct {
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Hypervisorversion string `json:"hypervisorversion,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Maxdatavolumeslimit int `json:"maxdatavolumeslimit,omitempty"`
|
||||
Maxguestslimit int64 `json:"maxguestslimit,omitempty"`
|
||||
Maxhostspercluster int `json:"maxhostspercluster,omitempty"`
|
||||
Securitygroupenabled bool `json:"securitygroupenabled,omitempty"`
|
||||
Storagemotionenabled bool `json:"storagemotionenabled,omitempty"`
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
Hypervisorversion string `json:"hypervisorversion"`
|
||||
Id string `json:"id"`
|
||||
Maxdatavolumeslimit int `json:"maxdatavolumeslimit"`
|
||||
Maxguestslimit int64 `json:"maxguestslimit"`
|
||||
Maxhostspercluster int `json:"maxhostspercluster"`
|
||||
Securitygroupenabled bool `json:"securitygroupenabled"`
|
||||
Storagemotionenabled bool `json:"storagemotionenabled"`
|
||||
}
|
||||
|
||||
type ListHypervisorsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListHypervisorsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListHypervisorsParams) 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 ListHypervisorsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *HypervisorService) NewListHypervisorsParams() *ListHypervisorsParams {
|
||||
p := &ListHypervisorsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// List hypervisors
|
||||
func (s *HypervisorService) ListHypervisors(p *ListHypervisorsParams) (*ListHypervisorsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listHypervisors", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListHypervisorsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListHypervisorsResponse struct {
|
||||
Count int `json:"count"`
|
||||
Hypervisors []*Hypervisor `json:"hypervisor"`
|
||||
}
|
||||
|
||||
type Hypervisor struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type UpdateHypervisorCapabilitiesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateHypervisorCapabilitiesParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
u.Set("id", v.(string))
|
||||
}
|
||||
if v, found := p.p["maxguestslimit"]; found {
|
||||
vv := strconv.FormatInt(v.(int64), 10)
|
||||
u.Set("maxguestslimit", vv)
|
||||
}
|
||||
if v, found := p.p["securitygroupenabled"]; found {
|
||||
vv := strconv.FormatBool(v.(bool))
|
||||
u.Set("securitygroupenabled", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateHypervisorCapabilitiesParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateHypervisorCapabilitiesParams) SetMaxguestslimit(v int64) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["maxguestslimit"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateHypervisorCapabilitiesParams) SetSecuritygroupenabled(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["securitygroupenabled"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateHypervisorCapabilitiesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *HypervisorService) NewUpdateHypervisorCapabilitiesParams() *UpdateHypervisorCapabilitiesParams {
|
||||
p := &UpdateHypervisorCapabilitiesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a hypervisor capabilities.
|
||||
func (s *HypervisorService) UpdateHypervisorCapabilities(p *UpdateHypervisorCapabilitiesParams) (*UpdateHypervisorCapabilitiesResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateHypervisorCapabilities", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateHypervisorCapabilitiesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateHypervisorCapabilitiesResponse struct {
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
Hypervisorversion string `json:"hypervisorversion"`
|
||||
Id string `json:"id"`
|
||||
Maxdatavolumeslimit int `json:"maxdatavolumeslimit"`
|
||||
Maxguestslimit int64 `json:"maxguestslimit"`
|
||||
Maxhostspercluster int `json:"maxhostspercluster"`
|
||||
Securitygroupenabled bool `json:"securitygroupenabled"`
|
||||
Storagemotionenabled bool `json:"storagemotionenabled"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -36,8 +36,7 @@ func (p *AddImageStoreParams) toURLValues() url.Values {
|
|||
if v, found := p.p["details"]; found {
|
||||
i := 0
|
||||
for k, vv := range v.(map[string]string) {
|
||||
u.Set(fmt.Sprintf("details[%d].key", i), k)
|
||||
u.Set(fmt.Sprintf("details[%d].value", i), vv)
|
||||
u.Set(fmt.Sprintf("details[%d].%s", i, k), vv)
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
@ -116,19 +115,19 @@ func (s *ImageStoreService) AddImageStore(p *AddImageStoreParams) (*AddImageStor
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddImageStoreResponse struct {
|
||||
Details []string `json:"details,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Providername string `json:"providername,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
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 AddImageStoreS3Params struct {
|
||||
|
@ -293,19 +292,267 @@ func (s *ImageStoreService) AddImageStoreS3(p *AddImageStoreS3Params) (*AddImage
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddImageStoreS3Response struct {
|
||||
Details []string `json:"details,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Providername string `json:"providername,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
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{}
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
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["provider"]; found {
|
||||
u.Set("provider", v.(string))
|
||||
}
|
||||
if v, found := p.p["scope"]; found {
|
||||
u.Set("scope", v.(string))
|
||||
}
|
||||
if v, found := p.p["url"]; found {
|
||||
u.Set("url", v.(string))
|
||||
}
|
||||
if v, found := p.p["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) SetDetails(v map[string]string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["details"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) SetProvider(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["provider"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) SetScope(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["scope"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) SetUrl(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["url"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) 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 CreateSecondaryStagingStoreParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ImageStoreService) NewCreateSecondaryStagingStoreParams(url string) *CreateSecondaryStagingStoreParams {
|
||||
p := &CreateSecondaryStagingStoreParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["url"] = url
|
||||
return p
|
||||
}
|
||||
|
||||
// create secondary staging store.
|
||||
func (s *ImageStoreService) CreateSecondaryStagingStore(p *CreateSecondaryStagingStoreParams) (*CreateSecondaryStagingStoreResponse, error) {
|
||||
resp, err := s.cs.newRequest("createSecondaryStagingStore", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r CreateSecondaryStagingStoreResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateSecondaryStagingStoreResponse struct {
|
||||
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 DeleteImageStoreParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteImageStoreParams) 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 *DeleteImageStoreParams) 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 DeleteImageStoreParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ImageStoreService) NewDeleteImageStoreParams(id string) *DeleteImageStoreParams {
|
||||
p := &DeleteImageStoreParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Deletes an image store or Secondary Storage.
|
||||
func (s *ImageStoreService) DeleteImageStore(p *DeleteImageStoreParams) (*DeleteImageStoreResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteImageStore", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteImageStoreResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteImageStoreResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteImageStoreResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteImageStoreResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type DeleteSecondaryStagingStoreParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteSecondaryStagingStoreParams) 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 *DeleteSecondaryStagingStoreParams) 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 DeleteSecondaryStagingStoreParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ImageStoreService) NewDeleteSecondaryStagingStoreParams(id string) *DeleteSecondaryStagingStoreParams {
|
||||
p := &DeleteSecondaryStagingStoreParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Deletes a secondary staging store .
|
||||
func (s *ImageStoreService) DeleteSecondaryStagingStore(p *DeleteSecondaryStagingStoreParams) (*DeleteSecondaryStagingStoreResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteSecondaryStagingStore", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteSecondaryStagingStoreResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteSecondaryStagingStoreResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteSecondaryStagingStoreResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteSecondaryStagingStoreResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListImageStoresParams struct {
|
||||
|
@ -425,7 +672,7 @@ func (s *ImageStoreService) GetImageStoreID(name string, opts ...OptionFunc) (st
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -475,7 +722,7 @@ func (s *ImageStoreService) GetImageStoreByID(id string, opts ...OptionFunc) (*I
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -512,6 +759,7 @@ func (s *ImageStoreService) ListImageStores(p *ListImageStoresParams) (*ListImag
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -521,173 +769,14 @@ type ListImageStoresResponse struct {
|
|||
}
|
||||
|
||||
type ImageStore struct {
|
||||
Details []string `json:"details,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Providername string `json:"providername,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
}
|
||||
|
||||
type DeleteImageStoreParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteImageStoreParams) 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 *DeleteImageStoreParams) 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 DeleteImageStoreParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ImageStoreService) NewDeleteImageStoreParams(id string) *DeleteImageStoreParams {
|
||||
p := &DeleteImageStoreParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Deletes an image store or Secondary Storage.
|
||||
func (s *ImageStoreService) DeleteImageStore(p *DeleteImageStoreParams) (*DeleteImageStoreResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteImageStore", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteImageStoreResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteImageStoreResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
}
|
||||
|
||||
type CreateSecondaryStagingStoreParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["details"]; found {
|
||||
i := 0
|
||||
for k, vv := range v.(map[string]string) {
|
||||
u.Set(fmt.Sprintf("details[%d].key", i), k)
|
||||
u.Set(fmt.Sprintf("details[%d].value", i), vv)
|
||||
i++
|
||||
}
|
||||
}
|
||||
if v, found := p.p["provider"]; found {
|
||||
u.Set("provider", v.(string))
|
||||
}
|
||||
if v, found := p.p["scope"]; found {
|
||||
u.Set("scope", v.(string))
|
||||
}
|
||||
if v, found := p.p["url"]; found {
|
||||
u.Set("url", v.(string))
|
||||
}
|
||||
if v, found := p.p["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) SetDetails(v map[string]string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["details"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) SetProvider(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["provider"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) SetScope(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["scope"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) SetUrl(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["url"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateSecondaryStagingStoreParams) 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 CreateSecondaryStagingStoreParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ImageStoreService) NewCreateSecondaryStagingStoreParams(url string) *CreateSecondaryStagingStoreParams {
|
||||
p := &CreateSecondaryStagingStoreParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["url"] = url
|
||||
return p
|
||||
}
|
||||
|
||||
// create secondary staging store.
|
||||
func (s *ImageStoreService) CreateSecondaryStagingStore(p *CreateSecondaryStagingStoreParams) (*CreateSecondaryStagingStoreResponse, error) {
|
||||
resp, err := s.cs.newRequest("createSecondaryStagingStore", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r CreateSecondaryStagingStoreResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateSecondaryStagingStoreResponse struct {
|
||||
Details []string `json:"details,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Providername string `json:"providername,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
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 ListSecondaryStagingStoresParams struct {
|
||||
|
@ -807,7 +896,7 @@ func (s *ImageStoreService) GetSecondaryStagingStoreID(name string, opts ...Opti
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -857,7 +946,7 @@ func (s *ImageStoreService) GetSecondaryStagingStoreByID(id string, opts ...Opti
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -894,6 +983,7 @@ func (s *ImageStoreService) ListSecondaryStagingStores(p *ListSecondaryStagingSt
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -903,66 +993,14 @@ type ListSecondaryStagingStoresResponse struct {
|
|||
}
|
||||
|
||||
type SecondaryStagingStore struct {
|
||||
Details []string `json:"details,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Providername string `json:"providername,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
}
|
||||
|
||||
type DeleteSecondaryStagingStoreParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteSecondaryStagingStoreParams) 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 *DeleteSecondaryStagingStoreParams) 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 DeleteSecondaryStagingStoreParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ImageStoreService) NewDeleteSecondaryStagingStoreParams(id string) *DeleteSecondaryStagingStoreParams {
|
||||
p := &DeleteSecondaryStagingStoreParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Deletes a secondary staging store .
|
||||
func (s *ImageStoreService) DeleteSecondaryStagingStore(p *DeleteSecondaryStagingStoreParams) (*DeleteSecondaryStagingStoreResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteSecondaryStagingStore", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteSecondaryStagingStoreResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteSecondaryStagingStoreResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
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 UpdateCloudToUseObjectStoreParams struct {
|
||||
|
@ -977,8 +1015,7 @@ func (p *UpdateCloudToUseObjectStoreParams) toURLValues() url.Values {
|
|||
if v, found := p.p["details"]; found {
|
||||
i := 0
|
||||
for k, vv := range v.(map[string]string) {
|
||||
u.Set(fmt.Sprintf("details[%d].key", i), k)
|
||||
u.Set(fmt.Sprintf("details[%d].value", i), vv)
|
||||
u.Set(fmt.Sprintf("details[%d].%s", i, k), vv)
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
@ -1046,17 +1083,17 @@ func (s *ImageStoreService) UpdateCloudToUseObjectStore(p *UpdateCloudToUseObjec
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateCloudToUseObjectStoreResponse struct {
|
||||
Details []string `json:"details,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Providername string `json:"providername,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
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"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -70,13 +70,13 @@ func (s *InternalLBService) NewConfigureInternalLoadBalancerElementParams(enable
|
|||
}
|
||||
|
||||
// Configures an Internal Load Balancer element.
|
||||
func (s *InternalLBService) ConfigureInternalLoadBalancerElement(p *ConfigureInternalLoadBalancerElementParams) (*ConfigureInternalLoadBalancerElementResponse, error) {
|
||||
func (s *InternalLBService) ConfigureInternalLoadBalancerElement(p *ConfigureInternalLoadBalancerElementParams) (*InternalLoadBalancerElementResponse, error) {
|
||||
resp, err := s.cs.newRequest("configureInternalLoadBalancerElement", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ConfigureInternalLoadBalancerElementResponse
|
||||
var r InternalLoadBalancerElementResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -100,14 +100,15 @@ func (s *InternalLBService) ConfigureInternalLoadBalancerElement(p *ConfigureInt
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ConfigureInternalLoadBalancerElementResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Nspid string `json:"nspid,omitempty"`
|
||||
type InternalLoadBalancerElementResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Id string `json:"id"`
|
||||
Nspid string `json:"nspid"`
|
||||
}
|
||||
|
||||
type CreateInternalLoadBalancerElementParams struct {
|
||||
|
@ -173,14 +174,15 @@ func (s *InternalLBService) CreateInternalLoadBalancerElement(p *CreateInternalL
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateInternalLoadBalancerElementResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Nspid string `json:"nspid,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Id string `json:"id"`
|
||||
Nspid string `json:"nspid"`
|
||||
}
|
||||
|
||||
type ListInternalLoadBalancerElementsParams struct {
|
||||
|
@ -279,7 +281,7 @@ func (s *InternalLBService) GetInternalLoadBalancerElementByID(id string, opts .
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -316,6 +318,7 @@ func (s *InternalLBService) ListInternalLoadBalancerElements(p *ListInternalLoad
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -325,297 +328,9 @@ type ListInternalLoadBalancerElementsResponse struct {
|
|||
}
|
||||
|
||||
type InternalLoadBalancerElement struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Nspid string `json:"nspid,omitempty"`
|
||||
}
|
||||
|
||||
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,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Dns1 string `json:"dns1,omitempty"`
|
||||
Dns2 string `json:"dns2,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Guestipaddress string `json:"guestipaddress,omitempty"`
|
||||
Guestmacaddress string `json:"guestmacaddress,omitempty"`
|
||||
Guestnetmask string `json:"guestnetmask,omitempty"`
|
||||
Guestnetworkid string `json:"guestnetworkid,omitempty"`
|
||||
Guestnetworkname string `json:"guestnetworkname,omitempty"`
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6dns1 string `json:"ip6dns1,omitempty"`
|
||||
Ip6dns2 string `json:"ip6dns2,omitempty"`
|
||||
Isredundantrouter bool `json:"isredundantrouter,omitempty"`
|
||||
Linklocalip string `json:"linklocalip,omitempty"`
|
||||
Linklocalmacaddress string `json:"linklocalmacaddress,omitempty"`
|
||||
Linklocalnetmask string `json:"linklocalnetmask,omitempty"`
|
||||
Linklocalnetworkid string `json:"linklocalnetworkid,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkdomain string `json:"networkdomain,omitempty"`
|
||||
Nic []struct {
|
||||
Broadcasturi string `json:"broadcasturi,omitempty"`
|
||||
Deviceid string `json:"deviceid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6address string `json:"ip6address,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Isolationuri string `json:"isolationuri,omitempty"`
|
||||
Macaddress string `json:"macaddress,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Networkname string `json:"networkname,omitempty"`
|
||||
Secondaryip []struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
} `json:"secondaryip,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
} `json:"nic,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Publicip string `json:"publicip,omitempty"`
|
||||
Publicmacaddress string `json:"publicmacaddress,omitempty"`
|
||||
Publicnetmask string `json:"publicnetmask,omitempty"`
|
||||
Publicnetworkid string `json:"publicnetworkid,omitempty"`
|
||||
Redundantstate string `json:"redundantstate,omitempty"`
|
||||
Requiresupgrade bool `json:"requiresupgrade,omitempty"`
|
||||
Role string `json:"role,omitempty"`
|
||||
Scriptsversion string `json:"scriptsversion,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Serviceofferingname string `json:"serviceofferingname,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Templateid string `json:"templateid,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Vpcid string `json:"vpcid,omitempty"`
|
||||
Vpcname string `json:"vpcname,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
}
|
||||
|
||||
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,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Dns1 string `json:"dns1,omitempty"`
|
||||
Dns2 string `json:"dns2,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Guestipaddress string `json:"guestipaddress,omitempty"`
|
||||
Guestmacaddress string `json:"guestmacaddress,omitempty"`
|
||||
Guestnetmask string `json:"guestnetmask,omitempty"`
|
||||
Guestnetworkid string `json:"guestnetworkid,omitempty"`
|
||||
Guestnetworkname string `json:"guestnetworkname,omitempty"`
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6dns1 string `json:"ip6dns1,omitempty"`
|
||||
Ip6dns2 string `json:"ip6dns2,omitempty"`
|
||||
Isredundantrouter bool `json:"isredundantrouter,omitempty"`
|
||||
Linklocalip string `json:"linklocalip,omitempty"`
|
||||
Linklocalmacaddress string `json:"linklocalmacaddress,omitempty"`
|
||||
Linklocalnetmask string `json:"linklocalnetmask,omitempty"`
|
||||
Linklocalnetworkid string `json:"linklocalnetworkid,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkdomain string `json:"networkdomain,omitempty"`
|
||||
Nic []struct {
|
||||
Broadcasturi string `json:"broadcasturi,omitempty"`
|
||||
Deviceid string `json:"deviceid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6address string `json:"ip6address,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Isolationuri string `json:"isolationuri,omitempty"`
|
||||
Macaddress string `json:"macaddress,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Networkname string `json:"networkname,omitempty"`
|
||||
Secondaryip []struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
} `json:"secondaryip,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
} `json:"nic,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Publicip string `json:"publicip,omitempty"`
|
||||
Publicmacaddress string `json:"publicmacaddress,omitempty"`
|
||||
Publicnetmask string `json:"publicnetmask,omitempty"`
|
||||
Publicnetworkid string `json:"publicnetworkid,omitempty"`
|
||||
Redundantstate string `json:"redundantstate,omitempty"`
|
||||
Requiresupgrade bool `json:"requiresupgrade,omitempty"`
|
||||
Role string `json:"role,omitempty"`
|
||||
Scriptsversion string `json:"scriptsversion,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Serviceofferingname string `json:"serviceofferingname,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Templateid string `json:"templateid,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Vpcid string `json:"vpcid,omitempty"`
|
||||
Vpcname string `json:"vpcname,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Id string `json:"id"`
|
||||
Nspid string `json:"nspid"`
|
||||
}
|
||||
|
||||
type ListInternalLoadBalancerVMsParams struct {
|
||||
|
@ -837,7 +552,7 @@ func (s *InternalLBService) GetInternalLoadBalancerVMID(name string, opts ...Opt
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -887,7 +602,7 @@ func (s *InternalLBService) GetInternalLoadBalancerVMByID(id string, opts ...Opt
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -924,6 +639,7 @@ func (s *InternalLBService) ListInternalLoadBalancerVMs(p *ListInternalLoadBalan
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -933,72 +649,296 @@ type ListInternalLoadBalancerVMsResponse struct {
|
|||
}
|
||||
|
||||
type InternalLoadBalancerVM struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Dns1 string `json:"dns1,omitempty"`
|
||||
Dns2 string `json:"dns2,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Guestipaddress string `json:"guestipaddress,omitempty"`
|
||||
Guestmacaddress string `json:"guestmacaddress,omitempty"`
|
||||
Guestnetmask string `json:"guestnetmask,omitempty"`
|
||||
Guestnetworkid string `json:"guestnetworkid,omitempty"`
|
||||
Guestnetworkname string `json:"guestnetworkname,omitempty"`
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6dns1 string `json:"ip6dns1,omitempty"`
|
||||
Ip6dns2 string `json:"ip6dns2,omitempty"`
|
||||
Isredundantrouter bool `json:"isredundantrouter,omitempty"`
|
||||
Linklocalip string `json:"linklocalip,omitempty"`
|
||||
Linklocalmacaddress string `json:"linklocalmacaddress,omitempty"`
|
||||
Linklocalnetmask string `json:"linklocalnetmask,omitempty"`
|
||||
Linklocalnetworkid string `json:"linklocalnetworkid,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkdomain string `json:"networkdomain,omitempty"`
|
||||
Nic []struct {
|
||||
Broadcasturi string `json:"broadcasturi,omitempty"`
|
||||
Deviceid string `json:"deviceid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6address string `json:"ip6address,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Isolationuri string `json:"isolationuri,omitempty"`
|
||||
Macaddress string `json:"macaddress,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Networkname string `json:"networkname,omitempty"`
|
||||
Secondaryip []struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
} `json:"secondaryip,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
} `json:"nic,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Publicip string `json:"publicip,omitempty"`
|
||||
Publicmacaddress string `json:"publicmacaddress,omitempty"`
|
||||
Publicnetmask string `json:"publicnetmask,omitempty"`
|
||||
Publicnetworkid string `json:"publicnetworkid,omitempty"`
|
||||
Redundantstate string `json:"redundantstate,omitempty"`
|
||||
Requiresupgrade bool `json:"requiresupgrade,omitempty"`
|
||||
Role string `json:"role,omitempty"`
|
||||
Scriptsversion string `json:"scriptsversion,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Serviceofferingname string `json:"serviceofferingname,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Templateid string `json:"templateid,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Vpcid string `json:"vpcid,omitempty"`
|
||||
Vpcname string `json:"vpcname,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
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 []Nic `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 []Nic `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 []Nic `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"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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.
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -22,6 +22,373 @@ import (
|
|||
"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{}
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) 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 {
|
||||
vv := strconv.FormatInt(v.(int64), 10)
|
||||
u.Set("id", 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["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["resourcetype"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("resourcetype", vv)
|
||||
}
|
||||
if v, found := p.p["resourcetypename"]; found {
|
||||
u.Set("resourcetypename", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetId(v int64) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetIsrecursive(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["isrecursive"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetListall(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["listall"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetResourcetype(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourcetype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetResourcetypename(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourcetypename"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListResourceLimitsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *LimitService) NewListResourceLimitsParams() *ListResourceLimitsParams {
|
||||
p := &ListResourceLimitsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists resource limits.
|
||||
func (s *LimitService) ListResourceLimits(p *ListResourceLimitsParams) (*ListResourceLimitsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listResourceLimits", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListResourceLimitsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListResourceLimitsResponse struct {
|
||||
Count int `json:"count"`
|
||||
ResourceLimits []*ResourceLimit `json:"resourcelimit"`
|
||||
}
|
||||
|
||||
type ResourceLimit struct {
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Max int64 `json:"max"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Resourcetype string `json:"resourcetype"`
|
||||
Resourcetypename string `json:"resourcetypename"`
|
||||
}
|
||||
|
||||
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{}
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) 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["resourcetype"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("resourcetype", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) SetResourcetype(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourcetype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateResourceCountParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *LimitService) NewUpdateResourceCountParams(domainid string) *UpdateResourceCountParams {
|
||||
p := &UpdateResourceCountParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["domainid"] = domainid
|
||||
return p
|
||||
}
|
||||
|
||||
// Recalculate and update resource count for an account or domain.
|
||||
func (s *LimitService) UpdateResourceCount(p *UpdateResourceCountParams) (*UpdateResourceCountResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateResourceCount", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateResourceCountResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateResourceCountResponse struct {
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Resourcecount int64 `json:"resourcecount"`
|
||||
Resourcetype string `json:"resourcetype"`
|
||||
Resourcetypename string `json:"resourcetypename"`
|
||||
}
|
||||
|
||||
type UpdateResourceLimitParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -111,365 +478,17 @@ func (s *LimitService) UpdateResourceLimit(p *UpdateResourceLimitParams) (*Updat
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateResourceLimitResponse struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Max int64 `json:"max,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateResourceCountParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) 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["resourcetype"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("resourcetype", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateResourceCountParams) SetResourcetype(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourcetype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateResourceCountParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *LimitService) NewUpdateResourceCountParams(domainid string) *UpdateResourceCountParams {
|
||||
p := &UpdateResourceCountParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["domainid"] = domainid
|
||||
return p
|
||||
}
|
||||
|
||||
// Recalculate and update resource count for an account or domain.
|
||||
func (s *LimitService) UpdateResourceCount(p *UpdateResourceCountParams) (*UpdateResourceCountResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateResourceCount", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateResourceCountResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateResourceCountResponse struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourcecount int64 `json:"resourcecount,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
}
|
||||
|
||||
type ListResourceLimitsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) 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 {
|
||||
vv := strconv.FormatInt(v.(int64), 10)
|
||||
u.Set("id", 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["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["resourcetype"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("resourcetype", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetId(v int64) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetIsrecursive(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["isrecursive"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetListall(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["listall"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListResourceLimitsParams) SetResourcetype(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourcetype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListResourceLimitsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *LimitService) NewListResourceLimitsParams() *ListResourceLimitsParams {
|
||||
p := &ListResourceLimitsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists resource limits.
|
||||
func (s *LimitService) ListResourceLimits(p *ListResourceLimitsParams) (*ListResourceLimitsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listResourceLimits", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListResourceLimitsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListResourceLimitsResponse struct {
|
||||
Count int `json:"count"`
|
||||
ResourceLimits []*ResourceLimit `json:"resourcelimit"`
|
||||
}
|
||||
|
||||
type ResourceLimit struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Max int64 `json:"max,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
}
|
||||
|
||||
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,omitempty"`
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
ApiAllowed int `json:"apiAllowed,omitempty"`
|
||||
ApiIssued int `json:"apiIssued,omitempty"`
|
||||
ExpireAfter int64 `json:"expireAfter,omitempty"`
|
||||
}
|
||||
|
||||
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,omitempty"`
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
ApiAllowed int `json:"apiAllowed,omitempty"`
|
||||
ApiIssued int `json:"apiIssued,omitempty"`
|
||||
ExpireAfter int64 `json:"expireAfter,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Max int64 `json:"max"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Resourcetype string `json:"resourcetype"`
|
||||
Resourcetypename string `json:"resourcetypename"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -24,91 +24,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
type EnableStaticNatParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["ipaddressid"]; found {
|
||||
u.Set("ipaddressid", v.(string))
|
||||
}
|
||||
if v, found := p.p["networkid"]; found {
|
||||
u.Set("networkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["virtualmachineid"]; found {
|
||||
u.Set("virtualmachineid", v.(string))
|
||||
}
|
||||
if v, found := p.p["vmguestip"]; found {
|
||||
u.Set("vmguestip", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) SetIpaddressid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ipaddressid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) SetNetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["networkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) SetVirtualmachineid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["virtualmachineid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) SetVmguestip(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["vmguestip"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new EnableStaticNatParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NATService) NewEnableStaticNatParams(ipaddressid string, virtualmachineid string) *EnableStaticNatParams {
|
||||
p := &EnableStaticNatParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ipaddressid"] = ipaddressid
|
||||
p.p["virtualmachineid"] = virtualmachineid
|
||||
return p
|
||||
}
|
||||
|
||||
// Enables static NAT for given IP address
|
||||
func (s *NATService) EnableStaticNat(p *EnableStaticNatParams) (*EnableStaticNatResponse, error) {
|
||||
resp, err := s.cs.newRequest("enableStaticNat", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r EnableStaticNatResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type EnableStaticNatResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
}
|
||||
|
||||
type CreateIpForwardingRuleParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -233,39 +148,29 @@ func (s *NATService) CreateIpForwardingRule(p *CreateIpForwardingRuleParams) (*C
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateIpForwardingRuleResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Cidrlist string `json:"cidrlist,omitempty"`
|
||||
Fordisplay bool `json:"fordisplay,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Ipaddressid string `json:"ipaddressid,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Privateendport string `json:"privateendport,omitempty"`
|
||||
Privateport string `json:"privateport,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Publicendport string `json:"publicendport,omitempty"`
|
||||
Publicport string `json:"publicport,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
Virtualmachinename string `json:"virtualmachinename,omitempty"`
|
||||
Vmguestip string `json:"vmguestip,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Cidrlist string `json:"cidrlist"`
|
||||
Fordisplay bool `json:"fordisplay"`
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Ipaddressid string `json:"ipaddressid"`
|
||||
Networkid string `json:"networkid"`
|
||||
Privateendport string `json:"privateendport"`
|
||||
Privateport string `json:"privateport"`
|
||||
Protocol string `json:"protocol"`
|
||||
Publicendport string `json:"publicendport"`
|
||||
Publicport string `json:"publicport"`
|
||||
State string `json:"state"`
|
||||
Tags []Tags `json:"tags"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname"`
|
||||
Virtualmachineid string `json:"virtualmachineid"`
|
||||
Virtualmachinename string `json:"virtualmachinename"`
|
||||
Vmguestip string `json:"vmguestip"`
|
||||
}
|
||||
|
||||
type DeleteIpForwardingRuleParams struct {
|
||||
|
@ -326,13 +231,187 @@ func (s *NATService) DeleteIpForwardingRule(p *DeleteIpForwardingRuleParams) (*D
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteIpForwardingRuleResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type DisableStaticNatParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DisableStaticNatParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["ipaddressid"]; found {
|
||||
u.Set("ipaddressid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DisableStaticNatParams) SetIpaddressid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ipaddressid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DisableStaticNatParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NATService) NewDisableStaticNatParams(ipaddressid string) *DisableStaticNatParams {
|
||||
p := &DisableStaticNatParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ipaddressid"] = ipaddressid
|
||||
return p
|
||||
}
|
||||
|
||||
// Disables static rule for given IP address
|
||||
func (s *NATService) DisableStaticNat(p *DisableStaticNatParams) (*DisableStaticNatResponse, error) {
|
||||
resp, err := s.cs.newRequest("disableStaticNat", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DisableStaticNatResponse
|
||||
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 DisableStaticNatResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type EnableStaticNatParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["ipaddressid"]; found {
|
||||
u.Set("ipaddressid", v.(string))
|
||||
}
|
||||
if v, found := p.p["networkid"]; found {
|
||||
u.Set("networkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["virtualmachineid"]; found {
|
||||
u.Set("virtualmachineid", v.(string))
|
||||
}
|
||||
if v, found := p.p["vmguestip"]; found {
|
||||
u.Set("vmguestip", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) SetIpaddressid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ipaddressid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) SetNetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["networkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) SetVirtualmachineid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["virtualmachineid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *EnableStaticNatParams) SetVmguestip(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["vmguestip"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new EnableStaticNatParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NATService) NewEnableStaticNatParams(ipaddressid string, virtualmachineid string) *EnableStaticNatParams {
|
||||
p := &EnableStaticNatParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ipaddressid"] = ipaddressid
|
||||
p.p["virtualmachineid"] = virtualmachineid
|
||||
return p
|
||||
}
|
||||
|
||||
// Enables static NAT for given IP address
|
||||
func (s *NATService) EnableStaticNat(p *EnableStaticNatParams) (*EnableStaticNatResponse, error) {
|
||||
resp, err := s.cs.newRequest("enableStaticNat", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r EnableStaticNatResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type EnableStaticNatResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *EnableStaticNatResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias EnableStaticNatResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListIpForwardingRulesParams struct {
|
||||
|
@ -487,7 +566,7 @@ func (s *NATService) GetIpForwardingRuleByID(id string, opts ...OptionFunc) (*Ip
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -524,6 +603,7 @@ func (s *NATService) ListIpForwardingRules(p *ListIpForwardingRulesParams) (*Lis
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -533,99 +613,21 @@ type ListIpForwardingRulesResponse struct {
|
|||
}
|
||||
|
||||
type IpForwardingRule struct {
|
||||
Cidrlist string `json:"cidrlist,omitempty"`
|
||||
Fordisplay bool `json:"fordisplay,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Ipaddressid string `json:"ipaddressid,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Privateendport string `json:"privateendport,omitempty"`
|
||||
Privateport string `json:"privateport,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Publicendport string `json:"publicendport,omitempty"`
|
||||
Publicport string `json:"publicport,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
Virtualmachinename string `json:"virtualmachinename,omitempty"`
|
||||
Vmguestip string `json:"vmguestip,omitempty"`
|
||||
}
|
||||
|
||||
type DisableStaticNatParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DisableStaticNatParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["ipaddressid"]; found {
|
||||
u.Set("ipaddressid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DisableStaticNatParams) SetIpaddressid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ipaddressid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DisableStaticNatParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NATService) NewDisableStaticNatParams(ipaddressid string) *DisableStaticNatParams {
|
||||
p := &DisableStaticNatParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ipaddressid"] = ipaddressid
|
||||
return p
|
||||
}
|
||||
|
||||
// Disables static rule for given IP address
|
||||
func (s *NATService) DisableStaticNat(p *DisableStaticNatParams) (*DisableStaticNatResponse, error) {
|
||||
resp, err := s.cs.newRequest("disableStaticNat", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DisableStaticNatResponse
|
||||
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 DisableStaticNatResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
Cidrlist string `json:"cidrlist"`
|
||||
Fordisplay bool `json:"fordisplay"`
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Ipaddressid string `json:"ipaddressid"`
|
||||
Networkid string `json:"networkid"`
|
||||
Privateendport string `json:"privateendport"`
|
||||
Privateport string `json:"privateport"`
|
||||
Protocol string `json:"protocol"`
|
||||
Publicendport string `json:"publicendport"`
|
||||
Publicport string `json:"publicport"`
|
||||
State string `json:"state"`
|
||||
Tags []Tags `json:"tags"`
|
||||
Virtualmachinedisplayname string `json:"virtualmachinedisplayname"`
|
||||
Virtualmachineid string `json:"virtualmachineid"`
|
||||
Virtualmachinename string `json:"virtualmachinename"`
|
||||
Vmguestip string `json:"vmguestip"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -81,11 +81,83 @@ func (s *NetworkDeviceService) AddNetworkDevice(p *AddNetworkDeviceParams) (*Add
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddNetworkDeviceResponse struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
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 bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteNetworkDeviceResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteNetworkDeviceResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListNetworkDeviceParams struct {
|
||||
|
@ -181,6 +253,7 @@ func (s *NetworkDeviceService) ListNetworkDevice(p *ListNetworkDeviceParams) (*L
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -190,56 +263,5 @@ type ListNetworkDeviceResponse struct {
|
|||
}
|
||||
|
||||
type NetworkDevice struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
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,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -43,8 +43,7 @@ func (p *CreateNetworkOfferingParams) toURLValues() url.Values {
|
|||
if v, found := p.p["details"]; found {
|
||||
i := 0
|
||||
for k, vv := range v.(map[string]string) {
|
||||
u.Set(fmt.Sprintf("details[%d].key", i), k)
|
||||
u.Set(fmt.Sprintf("details[%d].value", i), vv)
|
||||
u.Set(fmt.Sprintf("details[%d].%s", i, k), vv)
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +54,10 @@ func (p *CreateNetworkOfferingParams) toURLValues() url.Values {
|
|||
vv := strconv.FormatBool(v.(bool))
|
||||
u.Set("egressdefaultpolicy", vv)
|
||||
}
|
||||
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))
|
||||
}
|
||||
|
@ -157,6 +160,14 @@ func (p *CreateNetworkOfferingParams) SetEgressdefaultpolicy(v bool) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *CreateNetworkOfferingParams) SetForvpc(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["forvpc"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateNetworkOfferingParams) SetGuestiptype(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
|
@ -297,214 +308,56 @@ func (s *NetworkOfferingService) CreateNetworkOffering(p *CreateNetworkOfferingP
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateNetworkOfferingResponse struct {
|
||||
Availability string `json:"availability,omitempty"`
|
||||
Conservemode bool `json:"conservemode,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Egressdefaultpolicy bool `json:"egressdefaultpolicy,omitempty"`
|
||||
Forvpc bool `json:"forvpc,omitempty"`
|
||||
Guestiptype string `json:"guestiptype,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Ispersistent bool `json:"ispersistent,omitempty"`
|
||||
Maxconnections int `json:"maxconnections,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkrate int `json:"networkrate,omitempty"`
|
||||
Service []struct {
|
||||
Capability []struct {
|
||||
Canchooseservicecapability bool `json:"canchooseservicecapability,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"capability,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Provider []struct {
|
||||
Canenableindividualservice bool `json:"canenableindividualservice,omitempty"`
|
||||
Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Servicelist []string `json:"servicelist,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
} `json:"provider,omitempty"`
|
||||
} `json:"service,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Specifyipranges bool `json:"specifyipranges,omitempty"`
|
||||
Specifyvlan bool `json:"specifyvlan,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
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 []CreateNetworkOfferingResponseService `json:"service"`
|
||||
Serviceofferingid string `json:"serviceofferingid"`
|
||||
Specifyipranges bool `json:"specifyipranges"`
|
||||
Specifyvlan bool `json:"specifyvlan"`
|
||||
State string `json:"state"`
|
||||
Supportspublicaccess bool `json:"supportspublicaccess"`
|
||||
Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"`
|
||||
Tags string `json:"tags"`
|
||||
Traffictype string `json:"traffictype"`
|
||||
}
|
||||
|
||||
type UpdateNetworkOfferingParams struct {
|
||||
p map[string]interface{}
|
||||
type CreateNetworkOfferingResponseService struct {
|
||||
Capability []CreateNetworkOfferingResponseServiceCapability `json:"capability"`
|
||||
Name string `json:"name"`
|
||||
Provider []CreateNetworkOfferingResponseServiceProvider `json:"provider"`
|
||||
}
|
||||
|
||||
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
|
||||
type CreateNetworkOfferingResponseServiceProvider 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"`
|
||||
}
|
||||
|
||||
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,omitempty"`
|
||||
Conservemode bool `json:"conservemode,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Egressdefaultpolicy bool `json:"egressdefaultpolicy,omitempty"`
|
||||
Forvpc bool `json:"forvpc,omitempty"`
|
||||
Guestiptype string `json:"guestiptype,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Ispersistent bool `json:"ispersistent,omitempty"`
|
||||
Maxconnections int `json:"maxconnections,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkrate int `json:"networkrate,omitempty"`
|
||||
Service []struct {
|
||||
Capability []struct {
|
||||
Canchooseservicecapability bool `json:"canchooseservicecapability,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"capability,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Provider []struct {
|
||||
Canenableindividualservice bool `json:"canenableindividualservice,omitempty"`
|
||||
Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Servicelist []string `json:"servicelist,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
} `json:"provider,omitempty"`
|
||||
} `json:"service,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Specifyipranges bool `json:"specifyipranges,omitempty"`
|
||||
Specifyvlan bool `json:"specifyvlan,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
type CreateNetworkOfferingResponseServiceCapability struct {
|
||||
Canchooseservicecapability bool `json:"canchooseservicecapability"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
type DeleteNetworkOfferingParams struct {
|
||||
|
@ -550,12 +403,32 @@ func (s *NetworkOfferingService) DeleteNetworkOffering(p *DeleteNetworkOfferingP
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteNetworkOfferingResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteNetworkOfferingResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteNetworkOfferingResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListNetworkOfferingsParams struct {
|
||||
|
@ -814,7 +687,7 @@ func (s *NetworkOfferingService) GetNetworkOfferingID(name string, opts ...Optio
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -864,7 +737,7 @@ func (s *NetworkOfferingService) GetNetworkOfferingByID(id string, opts ...Optio
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -901,6 +774,7 @@ func (s *NetworkOfferingService) ListNetworkOfferings(p *ListNetworkOfferingsPar
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -910,42 +784,234 @@ type ListNetworkOfferingsResponse struct {
|
|||
}
|
||||
|
||||
type NetworkOffering struct {
|
||||
Availability string `json:"availability,omitempty"`
|
||||
Conservemode bool `json:"conservemode,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Egressdefaultpolicy bool `json:"egressdefaultpolicy,omitempty"`
|
||||
Forvpc bool `json:"forvpc,omitempty"`
|
||||
Guestiptype string `json:"guestiptype,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Ispersistent bool `json:"ispersistent,omitempty"`
|
||||
Maxconnections int `json:"maxconnections,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkrate int `json:"networkrate,omitempty"`
|
||||
Service []struct {
|
||||
Capability []struct {
|
||||
Canchooseservicecapability bool `json:"canchooseservicecapability,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"capability,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Provider []struct {
|
||||
Canenableindividualservice bool `json:"canenableindividualservice,omitempty"`
|
||||
Destinationphysicalnetworkid string `json:"destinationphysicalnetworkid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Servicelist []string `json:"servicelist,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
} `json:"provider,omitempty"`
|
||||
} `json:"service,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Specifyipranges bool `json:"specifyipranges,omitempty"`
|
||||
Specifyvlan bool `json:"specifyvlan,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
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 []NetworkOfferingServiceInternal `json:"service"`
|
||||
Serviceofferingid string `json:"serviceofferingid"`
|
||||
Specifyipranges bool `json:"specifyipranges"`
|
||||
Specifyvlan bool `json:"specifyvlan"`
|
||||
State string `json:"state"`
|
||||
Supportspublicaccess bool `json:"supportspublicaccess"`
|
||||
Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"`
|
||||
Tags string `json:"tags"`
|
||||
Traffictype string `json:"traffictype"`
|
||||
}
|
||||
|
||||
type NetworkOfferingServiceInternal struct {
|
||||
Capability []NetworkOfferingServiceInternalCapability `json:"capability"`
|
||||
Name string `json:"name"`
|
||||
Provider []NetworkOfferingServiceInternalProvider `json:"provider"`
|
||||
}
|
||||
|
||||
type NetworkOfferingServiceInternalProvider 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"`
|
||||
}
|
||||
|
||||
type NetworkOfferingServiceInternalCapability struct {
|
||||
Canchooseservicecapability bool `json:"canchooseservicecapability"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
if v, found := p.p["tags"]; found {
|
||||
u.Set("tags", 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
|
||||
}
|
||||
|
||||
func (p *UpdateNetworkOfferingParams) SetTags(v 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 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 []UpdateNetworkOfferingResponseService `json:"service"`
|
||||
Serviceofferingid string `json:"serviceofferingid"`
|
||||
Specifyipranges bool `json:"specifyipranges"`
|
||||
Specifyvlan bool `json:"specifyvlan"`
|
||||
State string `json:"state"`
|
||||
Supportspublicaccess bool `json:"supportspublicaccess"`
|
||||
Supportsstrechedl2subnet bool `json:"supportsstrechedl2subnet"`
|
||||
Tags string `json:"tags"`
|
||||
Traffictype string `json:"traffictype"`
|
||||
}
|
||||
|
||||
type UpdateNetworkOfferingResponseService struct {
|
||||
Capability []UpdateNetworkOfferingResponseServiceCapability `json:"capability"`
|
||||
Name string `json:"name"`
|
||||
Provider []UpdateNetworkOfferingResponseServiceProvider `json:"provider"`
|
||||
}
|
||||
|
||||
type UpdateNetworkOfferingResponseServiceProvider 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"`
|
||||
}
|
||||
|
||||
type UpdateNetworkOfferingResponseServiceCapability struct {
|
||||
Canchooseservicecapability bool `json:"canchooseservicecapability"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -96,337 +96,21 @@ func (s *NicService) AddIpToNic(p *AddIpToNicParams) (*AddIpToNicResponse, error
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddIpToNicResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Nicid string `json:"nicid,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
}
|
||||
|
||||
type RemoveIpFromNicParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *RemoveIpFromNicParams) 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 *RemoveIpFromNicParams) 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 RemoveIpFromNicParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NicService) NewRemoveIpFromNicParams(id string) *RemoveIpFromNicParams {
|
||||
p := &RemoveIpFromNicParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Removes secondary IP from the NIC.
|
||||
func (s *NicService) RemoveIpFromNic(p *RemoveIpFromNicParams) (*RemoveIpFromNicResponse, error) {
|
||||
resp, err := s.cs.newRequest("removeIpFromNic", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r RemoveIpFromNicResponse
|
||||
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 RemoveIpFromNicResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateVmNicIpParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateVmNicIpParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["ipaddress"]; found {
|
||||
u.Set("ipaddress", v.(string))
|
||||
}
|
||||
if v, found := p.p["nicid"]; found {
|
||||
u.Set("nicid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateVmNicIpParams) SetIpaddress(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ipaddress"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateVmNicIpParams) SetNicid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["nicid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateVmNicIpParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NicService) NewUpdateVmNicIpParams(nicid string) *UpdateVmNicIpParams {
|
||||
p := &UpdateVmNicIpParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["nicid"] = nicid
|
||||
return p
|
||||
}
|
||||
|
||||
// Update the default Ip of a VM Nic
|
||||
func (s *NicService) UpdateVmNicIp(p *UpdateVmNicIpParams) (*UpdateVmNicIpResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateVmNicIp", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateVmNicIpResponse
|
||||
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 UpdateVmNicIpResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Affinitygroup []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
|
||||
} `json:"affinitygroup,omitempty"`
|
||||
Cpunumber int `json:"cpunumber,omitempty"`
|
||||
Cpuspeed int `json:"cpuspeed,omitempty"`
|
||||
Cpuused string `json:"cpuused,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
Diskioread int64 `json:"diskioread,omitempty"`
|
||||
Diskiowrite int64 `json:"diskiowrite,omitempty"`
|
||||
Diskkbsread int64 `json:"diskkbsread,omitempty"`
|
||||
Diskkbswrite int64 `json:"diskkbswrite,omitempty"`
|
||||
Diskofferingid string `json:"diskofferingid,omitempty"`
|
||||
Diskofferingname string `json:"diskofferingname,omitempty"`
|
||||
Displayname string `json:"displayname,omitempty"`
|
||||
Displayvm bool `json:"displayvm,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Groupid string `json:"groupid,omitempty"`
|
||||
Guestosid string `json:"guestosid,omitempty"`
|
||||
Haenable bool `json:"haenable,omitempty"`
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Instancename string `json:"instancename,omitempty"`
|
||||
Isdynamicallyscalable bool `json:"isdynamicallyscalable,omitempty"`
|
||||
Isodisplaytext string `json:"isodisplaytext,omitempty"`
|
||||
Isoid string `json:"isoid,omitempty"`
|
||||
Isoname string `json:"isoname,omitempty"`
|
||||
Keypair string `json:"keypair,omitempty"`
|
||||
Memory int `json:"memory,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkkbsread int64 `json:"networkkbsread,omitempty"`
|
||||
Networkkbswrite int64 `json:"networkkbswrite,omitempty"`
|
||||
Nic []struct {
|
||||
Broadcasturi string `json:"broadcasturi,omitempty"`
|
||||
Deviceid string `json:"deviceid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6address string `json:"ip6address,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Isolationuri string `json:"isolationuri,omitempty"`
|
||||
Macaddress string `json:"macaddress,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Networkname string `json:"networkname,omitempty"`
|
||||
Secondaryip []struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
} `json:"secondaryip,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
} `json:"nic,omitempty"`
|
||||
Ostypeid int64 `json:"ostypeid,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Passwordenabled bool `json:"passwordenabled,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Publicip string `json:"publicip,omitempty"`
|
||||
Publicipid string `json:"publicipid,omitempty"`
|
||||
Rootdeviceid int64 `json:"rootdeviceid,omitempty"`
|
||||
Rootdevicetype string `json:"rootdevicetype,omitempty"`
|
||||
Securitygroup []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Egressrule []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Cidr string `json:"cidr,omitempty"`
|
||||
Endport int `json:"endport,omitempty"`
|
||||
Icmpcode int `json:"icmpcode,omitempty"`
|
||||
Icmptype int `json:"icmptype,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Ruleid string `json:"ruleid,omitempty"`
|
||||
Securitygroupname string `json:"securitygroupname,omitempty"`
|
||||
Startport int `json:"startport,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
} `json:"egressrule,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ingressrule []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Cidr string `json:"cidr,omitempty"`
|
||||
Endport int `json:"endport,omitempty"`
|
||||
Icmpcode int `json:"icmpcode,omitempty"`
|
||||
Icmptype int `json:"icmptype,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Ruleid string `json:"ruleid,omitempty"`
|
||||
Securitygroupname string `json:"securitygroupname,omitempty"`
|
||||
Startport int `json:"startport,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
} `json:"ingressrule,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Virtualmachinecount int `json:"virtualmachinecount,omitempty"`
|
||||
Virtualmachineids []string `json:"virtualmachineids,omitempty"`
|
||||
} `json:"securitygroup,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Serviceofferingname string `json:"serviceofferingname,omitempty"`
|
||||
Servicestate string `json:"servicestate,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Templatedisplaytext string `json:"templatedisplaytext,omitempty"`
|
||||
Templateid string `json:"templateid,omitempty"`
|
||||
Templatename string `json:"templatename,omitempty"`
|
||||
Userid string `json:"userid,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Vgpu string `json:"vgpu,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Networkid string `json:"networkid"`
|
||||
Nicid string `json:"nicid"`
|
||||
Secondaryip []struct {
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
} `json:"secondaryip"`
|
||||
Virtualmachineid string `json:"virtualmachineid"`
|
||||
}
|
||||
|
||||
type ListNicsParams struct {
|
||||
|
@ -541,6 +225,7 @@ func (s *NicService) ListNics(p *ListNicsParams) (*ListNicsResponse, error) {
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -550,25 +235,282 @@ type ListNicsResponse struct {
|
|||
}
|
||||
|
||||
type Nic struct {
|
||||
Broadcasturi string `json:"broadcasturi,omitempty"`
|
||||
Deviceid string `json:"deviceid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6address string `json:"ip6address,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Isolationuri string `json:"isolationuri,omitempty"`
|
||||
Macaddress string `json:"macaddress,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Networkname string `json:"networkname,omitempty"`
|
||||
Secondaryip []struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
} `json:"secondaryip,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
Broadcasturi string `json:"broadcasturi"`
|
||||
Deviceid string `json:"deviceid"`
|
||||
Extradhcpoption []string `json:"extradhcpoption"`
|
||||
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"`
|
||||
}
|
||||
|
||||
type RemoveIpFromNicParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *RemoveIpFromNicParams) 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 *RemoveIpFromNicParams) 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 RemoveIpFromNicParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NicService) NewRemoveIpFromNicParams(id string) *RemoveIpFromNicParams {
|
||||
p := &RemoveIpFromNicParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Removes secondary IP from the NIC.
|
||||
func (s *NicService) RemoveIpFromNic(p *RemoveIpFromNicParams) (*RemoveIpFromNicResponse, error) {
|
||||
resp, err := s.cs.newRequest("removeIpFromNic", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r RemoveIpFromNicResponse
|
||||
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 RemoveIpFromNicResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type UpdateVmNicIpParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateVmNicIpParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["ipaddress"]; found {
|
||||
u.Set("ipaddress", v.(string))
|
||||
}
|
||||
if v, found := p.p["nicid"]; found {
|
||||
u.Set("nicid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateVmNicIpParams) SetIpaddress(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ipaddress"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateVmNicIpParams) SetNicid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["nicid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateVmNicIpParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NicService) NewUpdateVmNicIpParams(nicid string) *UpdateVmNicIpParams {
|
||||
p := &UpdateVmNicIpParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["nicid"] = nicid
|
||||
return p
|
||||
}
|
||||
|
||||
// Update the default Ip of a VM Nic
|
||||
func (s *NicService) UpdateVmNicIp(p *UpdateVmNicIpParams) (*UpdateVmNicIpResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateVmNicIp", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateVmNicIpResponse
|
||||
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 UpdateVmNicIpResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Account string `json:"account"`
|
||||
Affinitygroup []UpdateVmNicIpResponseAffinitygroup `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 []Nic `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 []UpdateVmNicIpResponseSecuritygroup `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 UpdateVmNicIpResponseSecuritygroup struct {
|
||||
Account string `json:"account"`
|
||||
Description string `json:"description"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Egressrule []UpdateVmNicIpResponseSecuritygroupRule `json:"egressrule"`
|
||||
Id string `json:"id"`
|
||||
Ingressrule []UpdateVmNicIpResponseSecuritygroupRule `json:"ingressrule"`
|
||||
Name string `json:"name"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Tags []Tags `json:"tags"`
|
||||
Virtualmachinecount int `json:"virtualmachinecount"`
|
||||
Virtualmachineids []interface{} `json:"virtualmachineids"`
|
||||
}
|
||||
|
||||
type UpdateVmNicIpResponseSecuritygroupRule 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 []Tags `json:"tags"`
|
||||
}
|
||||
|
||||
type UpdateVmNicIpResponseAffinitygroup 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"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -34,6 +34,9 @@ func (p *AddNiciraNvpDeviceParams) toURLValues() url.Values {
|
|||
if v, found := p.p["hostname"]; found {
|
||||
u.Set("hostname", v.(string))
|
||||
}
|
||||
if v, found := p.p["l2gatewayserviceuuid"]; found {
|
||||
u.Set("l2gatewayserviceuuid", v.(string))
|
||||
}
|
||||
if v, found := p.p["l3gatewayserviceuuid"]; found {
|
||||
u.Set("l3gatewayserviceuuid", v.(string))
|
||||
}
|
||||
|
@ -60,6 +63,14 @@ func (p *AddNiciraNvpDeviceParams) SetHostname(v string) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *AddNiciraNvpDeviceParams) SetL2gatewayserviceuuid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["l2gatewayserviceuuid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddNiciraNvpDeviceParams) SetL3gatewayserviceuuid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
|
@ -144,18 +155,20 @@ func (s *NiciraNVPService) AddNiciraNvpDevice(p *AddNiciraNvpDeviceParams) (*Add
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddNiciraNvpDeviceResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
L3gatewayserviceuuid string `json:"l3gatewayserviceuuid,omitempty"`
|
||||
Niciradevicename string `json:"niciradevicename,omitempty"`
|
||||
Nvpdeviceid string `json:"nvpdeviceid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Transportzoneuuid string `json:"transportzoneuuid,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Hostname string `json:"hostname"`
|
||||
L2gatewayserviceuuid string `json:"l2gatewayserviceuuid"`
|
||||
L3gatewayserviceuuid string `json:"l3gatewayserviceuuid"`
|
||||
Niciradevicename string `json:"niciradevicename"`
|
||||
Nvpdeviceid string `json:"nvpdeviceid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Transportzoneuuid string `json:"transportzoneuuid"`
|
||||
}
|
||||
|
||||
type DeleteNiciraNvpDeviceParams struct {
|
||||
|
@ -216,13 +229,14 @@ func (s *NiciraNVPService) DeleteNiciraNvpDevice(p *DeleteNiciraNvpDeviceParams)
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteNiciraNvpDeviceResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListNiciraNvpDevicesParams struct {
|
||||
|
@ -313,6 +327,7 @@ func (s *NiciraNVPService) ListNiciraNvpDevices(p *ListNiciraNvpDevicesParams) (
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -322,11 +337,12 @@ type ListNiciraNvpDevicesResponse struct {
|
|||
}
|
||||
|
||||
type NiciraNvpDevice struct {
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
L3gatewayserviceuuid string `json:"l3gatewayserviceuuid,omitempty"`
|
||||
Niciradevicename string `json:"niciradevicename,omitempty"`
|
||||
Nvpdeviceid string `json:"nvpdeviceid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Transportzoneuuid string `json:"transportzoneuuid,omitempty"`
|
||||
Hostname string `json:"hostname"`
|
||||
L2gatewayserviceuuid string `json:"l2gatewayserviceuuid"`
|
||||
L3gatewayserviceuuid string `json:"l3gatewayserviceuuid"`
|
||||
Niciradevicename string `json:"niciradevicename"`
|
||||
Nvpdeviceid string `json:"nvpdeviceid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Provider string `json:"provider"`
|
||||
Transportzoneuuid string `json:"transportzoneuuid"`
|
||||
}
|
||||
|
|
527
vendor/github.com/xanzy/go-cloudstack/cloudstack/NuageVSPService.go
generated
vendored
Normal file
527
vendor/github.com/xanzy/go-cloudstack/cloudstack/NuageVSPService.go
generated
vendored
Normal file
|
@ -0,0 +1,527 @@
|
|||
//
|
||||
// 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 AddNuageVspDeviceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["apiversion"]; found {
|
||||
u.Set("apiversion", v.(string))
|
||||
}
|
||||
if v, found := p.p["hostname"]; found {
|
||||
u.Set("hostname", v.(string))
|
||||
}
|
||||
if v, found := p.p["password"]; found {
|
||||
u.Set("password", v.(string))
|
||||
}
|
||||
if v, found := p.p["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["port"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("port", vv)
|
||||
}
|
||||
if v, found := p.p["retrycount"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("retrycount", vv)
|
||||
}
|
||||
if v, found := p.p["retryinterval"]; found {
|
||||
vv := strconv.FormatInt(v.(int64), 10)
|
||||
u.Set("retryinterval", vv)
|
||||
}
|
||||
if v, found := p.p["username"]; found {
|
||||
u.Set("username", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) SetApiversion(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["apiversion"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) SetHostname(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostname"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) SetPassword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["password"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) SetPort(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["port"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) SetRetrycount(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["retrycount"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) SetRetryinterval(v int64) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["retryinterval"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *AddNuageVspDeviceParams) 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 AddNuageVspDeviceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NuageVSPService) NewAddNuageVspDeviceParams(hostname string, password string, physicalnetworkid string, port int, username string) *AddNuageVspDeviceParams {
|
||||
p := &AddNuageVspDeviceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["hostname"] = hostname
|
||||
p.p["password"] = password
|
||||
p.p["physicalnetworkid"] = physicalnetworkid
|
||||
p.p["port"] = port
|
||||
p.p["username"] = username
|
||||
return p
|
||||
}
|
||||
|
||||
// Adds a Nuage VSP device
|
||||
func (s *NuageVSPService) AddNuageVspDevice(p *AddNuageVspDeviceParams) (*AddNuageVspDeviceResponse, error) {
|
||||
resp, err := s.cs.newRequest("addNuageVspDevice", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r AddNuageVspDeviceResponse
|
||||
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 AddNuageVspDeviceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Apiversion string `json:"apiversion"`
|
||||
Cmsid string `json:"cmsid"`
|
||||
Hostname string `json:"hostname"`
|
||||
Nuagedevicename string `json:"nuagedevicename"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Port int `json:"port"`
|
||||
Provider string `json:"provider"`
|
||||
Retrycount int `json:"retrycount"`
|
||||
Retryinterval int64 `json:"retryinterval"`
|
||||
Vspdeviceid string `json:"vspdeviceid"`
|
||||
}
|
||||
|
||||
type DeleteNuageVspDeviceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteNuageVspDeviceParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["vspdeviceid"]; found {
|
||||
u.Set("vspdeviceid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DeleteNuageVspDeviceParams) SetVspdeviceid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["vspdeviceid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DeleteNuageVspDeviceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NuageVSPService) NewDeleteNuageVspDeviceParams(vspdeviceid string) *DeleteNuageVspDeviceParams {
|
||||
p := &DeleteNuageVspDeviceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["vspdeviceid"] = vspdeviceid
|
||||
return p
|
||||
}
|
||||
|
||||
// delete a nuage vsp device
|
||||
func (s *NuageVSPService) DeleteNuageVspDevice(p *DeleteNuageVspDeviceParams) (*DeleteNuageVspDeviceResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteNuageVspDevice", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteNuageVspDeviceResponse
|
||||
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 DeleteNuageVspDeviceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListNuageVspDevicesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListNuageVspDevicesParams) 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["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["vspdeviceid"]; found {
|
||||
u.Set("vspdeviceid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListNuageVspDevicesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListNuageVspDevicesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListNuageVspDevicesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListNuageVspDevicesParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListNuageVspDevicesParams) SetVspdeviceid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["vspdeviceid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListNuageVspDevicesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NuageVSPService) NewListNuageVspDevicesParams() *ListNuageVspDevicesParams {
|
||||
p := &ListNuageVspDevicesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists Nuage VSP devices
|
||||
func (s *NuageVSPService) ListNuageVspDevices(p *ListNuageVspDevicesParams) (*ListNuageVspDevicesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listNuageVspDevices", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListNuageVspDevicesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListNuageVspDevicesResponse struct {
|
||||
Count int `json:"count"`
|
||||
NuageVspDevices []*NuageVspDevice `json:"nuagevspdevice"`
|
||||
}
|
||||
|
||||
type NuageVspDevice struct {
|
||||
Apiversion string `json:"apiversion"`
|
||||
Cmsid string `json:"cmsid"`
|
||||
Hostname string `json:"hostname"`
|
||||
Nuagedevicename string `json:"nuagedevicename"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Port int `json:"port"`
|
||||
Provider string `json:"provider"`
|
||||
Retrycount int `json:"retrycount"`
|
||||
Retryinterval int64 `json:"retryinterval"`
|
||||
Vspdeviceid string `json:"vspdeviceid"`
|
||||
}
|
||||
|
||||
type UpdateNuageVspDeviceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["apiversion"]; found {
|
||||
u.Set("apiversion", v.(string))
|
||||
}
|
||||
if v, found := p.p["hostname"]; found {
|
||||
u.Set("hostname", v.(string))
|
||||
}
|
||||
if v, found := p.p["password"]; found {
|
||||
u.Set("password", v.(string))
|
||||
}
|
||||
if v, found := p.p["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["port"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("port", vv)
|
||||
}
|
||||
if v, found := p.p["retrycount"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("retrycount", vv)
|
||||
}
|
||||
if v, found := p.p["retryinterval"]; found {
|
||||
vv := strconv.FormatInt(v.(int64), 10)
|
||||
u.Set("retryinterval", vv)
|
||||
}
|
||||
if v, found := p.p["username"]; found {
|
||||
u.Set("username", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) SetApiversion(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["apiversion"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) SetHostname(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostname"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) SetPassword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["password"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) SetPort(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["port"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) SetRetrycount(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["retrycount"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) SetRetryinterval(v int64) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["retryinterval"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateNuageVspDeviceParams) 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 UpdateNuageVspDeviceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *NuageVSPService) NewUpdateNuageVspDeviceParams(physicalnetworkid string) *UpdateNuageVspDeviceParams {
|
||||
p := &UpdateNuageVspDeviceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["physicalnetworkid"] = physicalnetworkid
|
||||
return p
|
||||
}
|
||||
|
||||
// Update a Nuage VSP device
|
||||
func (s *NuageVSPService) UpdateNuageVspDevice(p *UpdateNuageVspDeviceParams) (*UpdateNuageVspDeviceResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateNuageVspDevice", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateNuageVspDeviceResponse
|
||||
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 UpdateNuageVspDeviceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Apiversion string `json:"apiversion"`
|
||||
Cmsid string `json:"cmsid"`
|
||||
Hostname string `json:"hostname"`
|
||||
Nuagedevicename string `json:"nuagedevicename"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Port int `json:"port"`
|
||||
Provider string `json:"provider"`
|
||||
Retrycount int `json:"retrycount"`
|
||||
Retryinterval int64 `json:"retryinterval"`
|
||||
Vspdeviceid string `json:"vspdeviceid"`
|
||||
}
|
343
vendor/github.com/xanzy/go-cloudstack/cloudstack/OutofbandManagementService.go
generated
vendored
Normal file
343
vendor/github.com/xanzy/go-cloudstack/cloudstack/OutofbandManagementService.go
generated
vendored
Normal file
|
@ -0,0 +1,343 @@
|
|||
//
|
||||
// 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 ChangeOutOfBandManagementPasswordParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ChangeOutOfBandManagementPasswordParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["hostid"]; found {
|
||||
u.Set("hostid", v.(string))
|
||||
}
|
||||
if v, found := p.p["password"]; found {
|
||||
u.Set("password", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ChangeOutOfBandManagementPasswordParams) SetHostid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ChangeOutOfBandManagementPasswordParams) SetPassword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["password"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ChangeOutOfBandManagementPasswordParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *OutofbandManagementService) NewChangeOutOfBandManagementPasswordParams(hostid string) *ChangeOutOfBandManagementPasswordParams {
|
||||
p := &ChangeOutOfBandManagementPasswordParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["hostid"] = hostid
|
||||
return p
|
||||
}
|
||||
|
||||
// Changes out-of-band management interface password on the host and updates the interface configuration in CloudStack if the operation succeeds, else reverts the old password
|
||||
func (s *OutofbandManagementService) ChangeOutOfBandManagementPassword(p *ChangeOutOfBandManagementPasswordParams) (*ChangeOutOfBandManagementPasswordResponse, error) {
|
||||
resp, err := s.cs.newRequest("changeOutOfBandManagementPassword", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ChangeOutOfBandManagementPasswordResponse
|
||||
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 ChangeOutOfBandManagementPasswordResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Action string `json:"action"`
|
||||
Address string `json:"address"`
|
||||
Description string `json:"description"`
|
||||
Driver string `json:"driver"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Hostid string `json:"hostid"`
|
||||
Password string `json:"password"`
|
||||
Port string `json:"port"`
|
||||
Powerstate string `json:"powerstate"`
|
||||
Status bool `json:"status"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type ConfigureOutOfBandManagementParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ConfigureOutOfBandManagementParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["address"]; found {
|
||||
u.Set("address", v.(string))
|
||||
}
|
||||
if v, found := p.p["driver"]; found {
|
||||
u.Set("driver", v.(string))
|
||||
}
|
||||
if v, found := p.p["hostid"]; found {
|
||||
u.Set("hostid", v.(string))
|
||||
}
|
||||
if v, found := p.p["password"]; found {
|
||||
u.Set("password", v.(string))
|
||||
}
|
||||
if v, found := p.p["port"]; found {
|
||||
u.Set("port", v.(string))
|
||||
}
|
||||
if v, found := p.p["username"]; found {
|
||||
u.Set("username", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ConfigureOutOfBandManagementParams) SetAddress(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["address"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ConfigureOutOfBandManagementParams) SetDriver(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["driver"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ConfigureOutOfBandManagementParams) SetHostid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ConfigureOutOfBandManagementParams) SetPassword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["password"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ConfigureOutOfBandManagementParams) SetPort(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["port"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ConfigureOutOfBandManagementParams) 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 ConfigureOutOfBandManagementParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *OutofbandManagementService) NewConfigureOutOfBandManagementParams(address string, driver string, hostid string, password string, port string, username string) *ConfigureOutOfBandManagementParams {
|
||||
p := &ConfigureOutOfBandManagementParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["address"] = address
|
||||
p.p["driver"] = driver
|
||||
p.p["hostid"] = hostid
|
||||
p.p["password"] = password
|
||||
p.p["port"] = port
|
||||
p.p["username"] = username
|
||||
return p
|
||||
}
|
||||
|
||||
// Configures a host's out-of-band management interface
|
||||
func (s *OutofbandManagementService) ConfigureOutOfBandManagement(p *ConfigureOutOfBandManagementParams) (*OutOfBandManagementResponse, error) {
|
||||
resp, err := s.cs.newRequest("configureOutOfBandManagement", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r OutOfBandManagementResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type OutOfBandManagementResponse struct {
|
||||
Action string `json:"action"`
|
||||
Address string `json:"address"`
|
||||
Description string `json:"description"`
|
||||
Driver string `json:"driver"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Hostid string `json:"hostid"`
|
||||
Password string `json:"password"`
|
||||
Port string `json:"port"`
|
||||
Powerstate string `json:"powerstate"`
|
||||
Status bool `json:"status"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type IssueOutOfBandManagementPowerActionParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *IssueOutOfBandManagementPowerActionParams) 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["hostid"]; found {
|
||||
u.Set("hostid", v.(string))
|
||||
}
|
||||
if v, found := p.p["timeout"]; found {
|
||||
vv := strconv.FormatInt(v.(int64), 10)
|
||||
u.Set("timeout", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *IssueOutOfBandManagementPowerActionParams) SetAction(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["action"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *IssueOutOfBandManagementPowerActionParams) SetHostid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["hostid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *IssueOutOfBandManagementPowerActionParams) SetTimeout(v int64) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["timeout"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new IssueOutOfBandManagementPowerActionParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *OutofbandManagementService) NewIssueOutOfBandManagementPowerActionParams(action string, hostid string) *IssueOutOfBandManagementPowerActionParams {
|
||||
p := &IssueOutOfBandManagementPowerActionParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["action"] = action
|
||||
p.p["hostid"] = hostid
|
||||
return p
|
||||
}
|
||||
|
||||
// Initiates the specified power action to the host's out-of-band management interface
|
||||
func (s *OutofbandManagementService) IssueOutOfBandManagementPowerAction(p *IssueOutOfBandManagementPowerActionParams) (*IssueOutOfBandManagementPowerActionResponse, error) {
|
||||
resp, err := s.cs.newRequest("issueOutOfBandManagementPowerAction", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r IssueOutOfBandManagementPowerActionResponse
|
||||
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 IssueOutOfBandManagementPowerActionResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Action string `json:"action"`
|
||||
Address string `json:"address"`
|
||||
Description string `json:"description"`
|
||||
Driver string `json:"driver"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Hostid string `json:"hostid"`
|
||||
Password string `json:"password"`
|
||||
Port string `json:"port"`
|
||||
Powerstate string `json:"powerstate"`
|
||||
Status bool `json:"status"`
|
||||
Username string `json:"username"`
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -70,13 +70,13 @@ func (s *OvsElementService) NewConfigureOvsElementParams(enabled bool, id string
|
|||
}
|
||||
|
||||
// Configures an ovs element.
|
||||
func (s *OvsElementService) ConfigureOvsElement(p *ConfigureOvsElementParams) (*ConfigureOvsElementResponse, error) {
|
||||
func (s *OvsElementService) ConfigureOvsElement(p *ConfigureOvsElementParams) (*OvsElementResponse, error) {
|
||||
resp, err := s.cs.newRequest("configureOvsElement", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ConfigureOvsElementResponse
|
||||
var r OvsElementResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -100,19 +100,20 @@ func (s *OvsElementService) ConfigureOvsElement(p *ConfigureOvsElementParams) (*
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ConfigureOvsElementResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Nspid string `json:"nspid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
type OvsElementResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Id string `json:"id"`
|
||||
Nspid string `json:"nspid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
}
|
||||
|
||||
type ListOvsElementsParams struct {
|
||||
|
@ -211,7 +212,7 @@ func (s *OvsElementService) GetOvsElementByID(id string, opts ...OptionFunc) (*O
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -248,6 +249,7 @@ func (s *OvsElementService) ListOvsElements(p *ListOvsElementsParams) (*ListOvsE
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -257,12 +259,12 @@ type ListOvsElementsResponse struct {
|
|||
}
|
||||
|
||||
type OvsElement struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Nspid string `json:"nspid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Id string `json:"id"`
|
||||
Nspid string `json:"nspid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -137,167 +137,138 @@ func (s *PodService) CreatePod(p *CreatePodParams) (*CreatePodResponse, error) {
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreatePodResponse struct {
|
||||
Allocationstate string `json:"allocationstate,omitempty"`
|
||||
Capacity []struct {
|
||||
Capacitytotal int64 `json:"capacitytotal,omitempty"`
|
||||
Capacityused int64 `json:"capacityused,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Percentused string `json:"percentused,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
} `json:"capacity,omitempty"`
|
||||
Endip string `json:"endip,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Startip string `json:"startip,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
Allocationstate string `json:"allocationstate"`
|
||||
Capacity []CreatePodResponseCapacity `json:"capacity"`
|
||||
Endip []string `json:"endip"`
|
||||
Forsystemvms []string `json:"forsystemvms"`
|
||||
Gateway string `json:"gateway"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Netmask string `json:"netmask"`
|
||||
Startip []string `json:"startip"`
|
||||
Vlanid []string `json:"vlanid"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type UpdatePodParams struct {
|
||||
type CreatePodResponseCapacity struct {
|
||||
Capacityallocated int64 `json:"capacityallocated"`
|
||||
Capacitytotal int64 `json:"capacitytotal"`
|
||||
Capacityused int64 `json:"capacityused"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Name string `json:"name"`
|
||||
Percentused string `json:"percentused"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Type int `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type DedicatePodParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdatePodParams) toURLValues() url.Values {
|
||||
func (p *DedicatePodParams) 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["account"]; found {
|
||||
u.Set("account", v.(string))
|
||||
}
|
||||
if v, found := p.p["endip"]; found {
|
||||
u.Set("endip", v.(string))
|
||||
if v, found := p.p["domainid"]; found {
|
||||
u.Set("domainid", v.(string))
|
||||
}
|
||||
if v, found := p.p["gateway"]; found {
|
||||
u.Set("gateway", v.(string))
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
u.Set("id", v.(string))
|
||||
}
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["netmask"]; found {
|
||||
u.Set("netmask", v.(string))
|
||||
}
|
||||
if v, found := p.p["startip"]; found {
|
||||
u.Set("startip", v.(string))
|
||||
if v, found := p.p["podid"]; found {
|
||||
u.Set("podid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdatePodParams) SetAllocationstate(v string) {
|
||||
func (p *DedicatePodParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["allocationstate"] = v
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdatePodParams) SetEndip(v string) {
|
||||
func (p *DedicatePodParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["endip"] = v
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdatePodParams) SetGateway(v string) {
|
||||
func (p *DedicatePodParams) SetPodid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["gateway"] = v
|
||||
p.p["podid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdatePodParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdatePodParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdatePodParams) SetNetmask(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["netmask"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdatePodParams) SetStartip(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["startip"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdatePodParams instance,
|
||||
// You should always use this function to get a new DedicatePodParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *PodService) NewUpdatePodParams(id string) *UpdatePodParams {
|
||||
p := &UpdatePodParams{}
|
||||
func (s *PodService) NewDedicatePodParams(domainid string, podid string) *DedicatePodParams {
|
||||
p := &DedicatePodParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
p.p["domainid"] = domainid
|
||||
p.p["podid"] = podid
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a Pod.
|
||||
func (s *PodService) UpdatePod(p *UpdatePodParams) (*UpdatePodResponse, error) {
|
||||
resp, err := s.cs.newRequest("updatePod", p.toURLValues())
|
||||
// Dedicates a Pod.
|
||||
func (s *PodService) DedicatePod(p *DedicatePodParams) (*DedicatePodResponse, error) {
|
||||
resp, err := s.cs.newRequest("dedicatePod", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdatePodResponse
|
||||
var r DedicatePodResponse
|
||||
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 UpdatePodResponse struct {
|
||||
Allocationstate string `json:"allocationstate,omitempty"`
|
||||
Capacity []struct {
|
||||
Capacitytotal int64 `json:"capacitytotal,omitempty"`
|
||||
Capacityused int64 `json:"capacityused,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Percentused string `json:"percentused,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
} `json:"capacity,omitempty"`
|
||||
Endip string `json:"endip,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Startip string `json:"startip,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
type DedicatePodResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Accountid string `json:"accountid"`
|
||||
Affinitygroupid string `json:"affinitygroupid"`
|
||||
Domainid string `json:"domainid"`
|
||||
Id string `json:"id"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
}
|
||||
|
||||
type DeletePodParams struct {
|
||||
|
@ -343,12 +314,160 @@ func (s *PodService) DeletePod(p *DeletePodParams) (*DeletePodResponse, error) {
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeletePodResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeletePodResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeletePodResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListDedicatedPodsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) 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["domainid"]; found {
|
||||
u.Set("domainid", 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["podid"]; found {
|
||||
u.Set("podid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetAffinitygroupid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["affinitygroupid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetPodid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["podid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListDedicatedPodsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *PodService) NewListDedicatedPodsParams() *ListDedicatedPodsParams {
|
||||
p := &ListDedicatedPodsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists dedicated pods.
|
||||
func (s *PodService) ListDedicatedPods(p *ListDedicatedPodsParams) (*ListDedicatedPodsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listDedicatedPods", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListDedicatedPodsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListDedicatedPodsResponse struct {
|
||||
Count int `json:"count"`
|
||||
DedicatedPods []*DedicatedPod `json:"dedicatedpod"`
|
||||
}
|
||||
|
||||
type DedicatedPod struct {
|
||||
Accountid string `json:"accountid"`
|
||||
Affinitygroupid string `json:"affinitygroupid"`
|
||||
Domainid string `json:"domainid"`
|
||||
Id string `json:"id"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
}
|
||||
|
||||
type ListPodsParams struct {
|
||||
|
@ -469,7 +588,7 @@ func (s *PodService) GetPodID(name string, opts ...OptionFunc) (string, int, err
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -519,7 +638,7 @@ func (s *PodService) GetPodByID(id string, opts ...OptionFunc) (*Pod, int, error
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -556,6 +675,7 @@ func (s *PodService) ListPods(p *ListPodsParams) (*ListPodsResponse, error) {
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -565,126 +685,33 @@ type ListPodsResponse struct {
|
|||
}
|
||||
|
||||
type Pod struct {
|
||||
Allocationstate string `json:"allocationstate,omitempty"`
|
||||
Capacity []struct {
|
||||
Capacitytotal int64 `json:"capacitytotal,omitempty"`
|
||||
Capacityused int64 `json:"capacityused,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Percentused string `json:"percentused,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
} `json:"capacity,omitempty"`
|
||||
Endip string `json:"endip,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Startip string `json:"startip,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
Allocationstate string `json:"allocationstate"`
|
||||
Capacity []PodCapacity `json:"capacity"`
|
||||
Endip []string `json:"endip"`
|
||||
Forsystemvms []string `json:"forsystemvms"`
|
||||
Gateway string `json:"gateway"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Netmask string `json:"netmask"`
|
||||
Startip []string `json:"startip"`
|
||||
Vlanid []string `json:"vlanid"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type DedicatePodParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DedicatePodParams) 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["podid"]; found {
|
||||
u.Set("podid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DedicatePodParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicatePodParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicatePodParams) SetPodid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["podid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DedicatePodParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *PodService) NewDedicatePodParams(domainid string, podid string) *DedicatePodParams {
|
||||
p := &DedicatePodParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["domainid"] = domainid
|
||||
p.p["podid"] = podid
|
||||
return p
|
||||
}
|
||||
|
||||
// Dedicates a Pod.
|
||||
func (s *PodService) DedicatePod(p *DedicatePodParams) (*DedicatePodResponse, error) {
|
||||
resp, err := s.cs.newRequest("dedicatePod", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DedicatePodResponse
|
||||
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 DedicatePodResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
Affinitygroupid string `json:"affinitygroupid,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
type PodCapacity struct {
|
||||
Capacityallocated int64 `json:"capacityallocated"`
|
||||
Capacitytotal int64 `json:"capacitytotal"`
|
||||
Capacityused int64 `json:"capacityused"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Name string `json:"name"`
|
||||
Percentused string `json:"percentused"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Type int `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type ReleaseDedicatedPodParams struct {
|
||||
|
@ -745,138 +772,155 @@ func (s *PodService) ReleaseDedicatedPod(p *ReleaseDedicatedPodParams) (*Release
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ReleaseDedicatedPodResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListDedicatedPodsParams struct {
|
||||
type UpdatePodParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) toURLValues() url.Values {
|
||||
func (p *UpdatePodParams) 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["allocationstate"]; found {
|
||||
u.Set("allocationstate", v.(string))
|
||||
}
|
||||
if v, found := p.p["affinitygroupid"]; found {
|
||||
u.Set("affinitygroupid", v.(string))
|
||||
if v, found := p.p["endip"]; found {
|
||||
u.Set("endip", v.(string))
|
||||
}
|
||||
if v, found := p.p["domainid"]; found {
|
||||
u.Set("domainid", v.(string))
|
||||
if v, found := p.p["gateway"]; found {
|
||||
u.Set("gateway", v.(string))
|
||||
}
|
||||
if v, found := p.p["keyword"]; found {
|
||||
u.Set("keyword", v.(string))
|
||||
if v, found := p.p["id"]; found {
|
||||
u.Set("id", v.(string))
|
||||
}
|
||||
if v, found := p.p["page"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("page", vv)
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["pagesize"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("pagesize", vv)
|
||||
if v, found := p.p["netmask"]; found {
|
||||
u.Set("netmask", v.(string))
|
||||
}
|
||||
if v, found := p.p["podid"]; found {
|
||||
u.Set("podid", v.(string))
|
||||
if v, found := p.p["startip"]; found {
|
||||
u.Set("startip", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetAccount(v string) {
|
||||
func (p *UpdatePodParams) SetAllocationstate(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
p.p["allocationstate"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetAffinitygroupid(v string) {
|
||||
func (p *UpdatePodParams) SetEndip(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["affinitygroupid"] = v
|
||||
p.p["endip"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetDomainid(v string) {
|
||||
func (p *UpdatePodParams) SetGateway(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
p.p["gateway"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetKeyword(v string) {
|
||||
func (p *UpdatePodParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetPage(v int) {
|
||||
func (p *UpdatePodParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetPagesize(v int) {
|
||||
func (p *UpdatePodParams) SetNetmask(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
p.p["netmask"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedPodsParams) SetPodid(v string) {
|
||||
func (p *UpdatePodParams) SetStartip(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["podid"] = v
|
||||
p.p["startip"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListDedicatedPodsParams instance,
|
||||
// You should always use this function to get a new UpdatePodParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *PodService) NewListDedicatedPodsParams() *ListDedicatedPodsParams {
|
||||
p := &ListDedicatedPodsParams{}
|
||||
func (s *PodService) NewUpdatePodParams(id string) *UpdatePodParams {
|
||||
p := &UpdatePodParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists dedicated pods.
|
||||
func (s *PodService) ListDedicatedPods(p *ListDedicatedPodsParams) (*ListDedicatedPodsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listDedicatedPods", p.toURLValues())
|
||||
// Updates a Pod.
|
||||
func (s *PodService) UpdatePod(p *UpdatePodParams) (*UpdatePodResponse, error) {
|
||||
resp, err := s.cs.newRequest("updatePod", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListDedicatedPodsResponse
|
||||
var r UpdatePodResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListDedicatedPodsResponse struct {
|
||||
Count int `json:"count"`
|
||||
DedicatedPods []*DedicatedPod `json:"dedicatedpod"`
|
||||
type UpdatePodResponse struct {
|
||||
Allocationstate string `json:"allocationstate"`
|
||||
Capacity []UpdatePodResponseCapacity `json:"capacity"`
|
||||
Endip []string `json:"endip"`
|
||||
Forsystemvms []string `json:"forsystemvms"`
|
||||
Gateway string `json:"gateway"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Netmask string `json:"netmask"`
|
||||
Startip []string `json:"startip"`
|
||||
Vlanid []string `json:"vlanid"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type DedicatedPod struct {
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
Affinitygroupid string `json:"affinitygroupid,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
type UpdatePodResponseCapacity struct {
|
||||
Capacityallocated int64 `json:"capacityallocated"`
|
||||
Capacitytotal int64 `json:"capacitytotal"`
|
||||
Capacityused int64 `json:"capacityused"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Name string `json:"name"`
|
||||
Percentused string `json:"percentused"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Type int `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -147,30 +147,33 @@ func (s *PortableIPService) CreatePortableIpRange(p *CreatePortableIpRangeParams
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreatePortableIpRangeResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Endip string `json:"endip,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Portableipaddress []struct {
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
Allocated string `json:"allocated,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Regionid int `json:"regionid,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Vpcid string `json:"vpcid,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
} `json:"portableipaddress,omitempty"`
|
||||
Regionid int `json:"regionid,omitempty"`
|
||||
Startip string `json:"startip,omitempty"`
|
||||
Vlan string `json:"vlan,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Endip string `json:"endip"`
|
||||
Gateway string `json:"gateway"`
|
||||
Id string `json:"id"`
|
||||
Netmask string `json:"netmask"`
|
||||
Portableipaddress []CreatePortableIpRangeResponsePortableipaddress `json:"portableipaddress"`
|
||||
Regionid int `json:"regionid"`
|
||||
Startip string `json:"startip"`
|
||||
Vlan string `json:"vlan"`
|
||||
}
|
||||
|
||||
type CreatePortableIpRangeResponsePortableipaddress struct {
|
||||
Accountid string `json:"accountid"`
|
||||
Allocated string `json:"allocated"`
|
||||
Domainid string `json:"domainid"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Networkid string `json:"networkid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Regionid int `json:"regionid"`
|
||||
State string `json:"state"`
|
||||
Vpcid string `json:"vpcid"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
}
|
||||
|
||||
type DeletePortableIpRangeParams struct {
|
||||
|
@ -231,13 +234,14 @@ func (s *PortableIPService) DeletePortableIpRange(p *DeletePortableIpRangeParams
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeletePortableIpRangeResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListPortableIpRangesParams struct {
|
||||
|
@ -325,7 +329,7 @@ func (s *PortableIPService) GetPortableIpRangeByID(id string, opts ...OptionFunc
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -362,6 +366,7 @@ func (s *PortableIPService) ListPortableIpRanges(p *ListPortableIpRangesParams)
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -371,23 +376,25 @@ type ListPortableIpRangesResponse struct {
|
|||
}
|
||||
|
||||
type PortableIpRange struct {
|
||||
Endip string `json:"endip,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Portableipaddress []struct {
|
||||
Accountid string `json:"accountid,omitempty"`
|
||||
Allocated string `json:"allocated,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Regionid int `json:"regionid,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Vpcid string `json:"vpcid,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
} `json:"portableipaddress,omitempty"`
|
||||
Regionid int `json:"regionid,omitempty"`
|
||||
Startip string `json:"startip,omitempty"`
|
||||
Vlan string `json:"vlan,omitempty"`
|
||||
Endip string `json:"endip"`
|
||||
Gateway string `json:"gateway"`
|
||||
Id string `json:"id"`
|
||||
Netmask string `json:"netmask"`
|
||||
Portableipaddress []PortableIpRangePortableipaddress `json:"portableipaddress"`
|
||||
Regionid int `json:"regionid"`
|
||||
Startip string `json:"startip"`
|
||||
Vlan string `json:"vlan"`
|
||||
}
|
||||
|
||||
type PortableIpRangePortableipaddress struct {
|
||||
Accountid string `json:"accountid"`
|
||||
Allocated string `json:"allocated"`
|
||||
Domainid string `json:"domainid"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Networkid string `json:"networkid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Regionid int `json:"regionid"`
|
||||
State string `json:"state"`
|
||||
Vpcid string `json:"vpcid"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -52,9 +52,10 @@ func (s *QuotaService) QuotaIsEnabled(p *QuotaIsEnabledParams) (*QuotaIsEnabledR
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type QuotaIsEnabledResponse struct {
|
||||
Isenabled bool `json:"isenabled,omitempty"`
|
||||
Isenabled bool `json:"isenabled"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -90,144 +90,16 @@ func (s *RegionService) AddRegion(p *AddRegionParams) (*AddRegionResponse, error
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddRegionResponse struct {
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
Gslbserviceenabled bool `json:"gslbserviceenabled,omitempty"`
|
||||
Id int `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Portableipserviceenabled bool `json:"portableipserviceenabled,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateRegionParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateRegionParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["endpoint"]; found {
|
||||
u.Set("endpoint", v.(string))
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("id", vv)
|
||||
}
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateRegionParams) SetEndpoint(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["endpoint"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRegionParams) SetId(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRegionParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateRegionParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RegionService) NewUpdateRegionParams(id int) *UpdateRegionParams {
|
||||
p := &UpdateRegionParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a region
|
||||
func (s *RegionService) UpdateRegion(p *UpdateRegionParams) (*UpdateRegionResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateRegion", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateRegionResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateRegionResponse struct {
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
Gslbserviceenabled bool `json:"gslbserviceenabled,omitempty"`
|
||||
Id int `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Portableipserviceenabled bool `json:"portableipserviceenabled,omitempty"`
|
||||
}
|
||||
|
||||
type RemoveRegionParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *RemoveRegionParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("id", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *RemoveRegionParams) SetId(v int) {
|
||||
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 RemoveRegionParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RegionService) NewRemoveRegionParams(id int) *RemoveRegionParams {
|
||||
p := &RemoveRegionParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Removes specified region
|
||||
func (s *RegionService) RemoveRegion(p *RemoveRegionParams) (*RemoveRegionResponse, error) {
|
||||
resp, err := s.cs.newRequest("removeRegion", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r RemoveRegionResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type RemoveRegionResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
Gslbserviceenabled bool `json:"gslbserviceenabled"`
|
||||
Id int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Portableipserviceenabled bool `json:"portableipserviceenabled"`
|
||||
}
|
||||
|
||||
type ListRegionsParams struct {
|
||||
|
@ -319,6 +191,7 @@ func (s *RegionService) ListRegions(p *ListRegionsParams) (*ListRegionsResponse,
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -328,9 +201,159 @@ type ListRegionsResponse struct {
|
|||
}
|
||||
|
||||
type Region struct {
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
Gslbserviceenabled bool `json:"gslbserviceenabled,omitempty"`
|
||||
Id int `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Portableipserviceenabled bool `json:"portableipserviceenabled,omitempty"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
Gslbserviceenabled bool `json:"gslbserviceenabled"`
|
||||
Id int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Portableipserviceenabled bool `json:"portableipserviceenabled"`
|
||||
}
|
||||
|
||||
type RemoveRegionParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *RemoveRegionParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("id", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *RemoveRegionParams) SetId(v int) {
|
||||
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 RemoveRegionParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RegionService) NewRemoveRegionParams(id int) *RemoveRegionParams {
|
||||
p := &RemoveRegionParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Removes specified region
|
||||
func (s *RegionService) RemoveRegion(p *RemoveRegionParams) (*RemoveRegionResponse, error) {
|
||||
resp, err := s.cs.newRequest("removeRegion", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r RemoveRegionResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type RemoveRegionResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *RemoveRegionResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias RemoveRegionResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type UpdateRegionParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateRegionParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["endpoint"]; found {
|
||||
u.Set("endpoint", v.(string))
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("id", vv)
|
||||
}
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateRegionParams) SetEndpoint(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["endpoint"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRegionParams) SetId(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRegionParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateRegionParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RegionService) NewUpdateRegionParams(id int) *UpdateRegionParams {
|
||||
p := &UpdateRegionParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a region
|
||||
func (s *RegionService) UpdateRegion(p *UpdateRegionParams) (*UpdateRegionResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateRegion", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateRegionResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateRegionResponse struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
Gslbserviceenabled bool `json:"gslbserviceenabled"`
|
||||
Id int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Portableipserviceenabled bool `json:"portableipserviceenabled"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -35,8 +35,7 @@ func (p *AddResourceDetailParams) toURLValues() url.Values {
|
|||
if v, found := p.p["details"]; found {
|
||||
i := 0
|
||||
for k, vv := range v.(map[string]string) {
|
||||
u.Set(fmt.Sprintf("details[%d].key", i), k)
|
||||
u.Set(fmt.Sprintf("details[%d].value", i), vv)
|
||||
u.Set(fmt.Sprintf("details[%d].%s", i, k), vv)
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
@ -122,103 +121,65 @@ func (s *ResourcemetadataService) AddResourceDetail(p *AddResourceDetailParams)
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddResourceDetailResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type RemoveResourceDetailParams struct {
|
||||
type GetVolumeSnapshotDetailsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *RemoveResourceDetailParams) toURLValues() url.Values {
|
||||
func (p *GetVolumeSnapshotDetailsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["key"]; found {
|
||||
u.Set("key", v.(string))
|
||||
}
|
||||
if v, found := p.p["resourceid"]; found {
|
||||
u.Set("resourceid", v.(string))
|
||||
}
|
||||
if v, found := p.p["resourcetype"]; found {
|
||||
u.Set("resourcetype", v.(string))
|
||||
if v, found := p.p["snapshotid"]; found {
|
||||
u.Set("snapshotid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *RemoveResourceDetailParams) SetKey(v string) {
|
||||
func (p *GetVolumeSnapshotDetailsParams) SetSnapshotid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["key"] = v
|
||||
p.p["snapshotid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RemoveResourceDetailParams) SetResourceid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourceid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RemoveResourceDetailParams) SetResourcetype(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourcetype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new RemoveResourceDetailParams instance,
|
||||
// You should always use this function to get a new GetVolumeSnapshotDetailsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ResourcemetadataService) NewRemoveResourceDetailParams(resourceid string, resourcetype string) *RemoveResourceDetailParams {
|
||||
p := &RemoveResourceDetailParams{}
|
||||
func (s *ResourcemetadataService) NewGetVolumeSnapshotDetailsParams(snapshotid string) *GetVolumeSnapshotDetailsParams {
|
||||
p := &GetVolumeSnapshotDetailsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["resourceid"] = resourceid
|
||||
p.p["resourcetype"] = resourcetype
|
||||
p.p["snapshotid"] = snapshotid
|
||||
return p
|
||||
}
|
||||
|
||||
// Removes detail for the Resource.
|
||||
func (s *ResourcemetadataService) RemoveResourceDetail(p *RemoveResourceDetailParams) (*RemoveResourceDetailResponse, error) {
|
||||
resp, err := s.cs.newRequest("removeResourceDetail", p.toURLValues())
|
||||
// Get Volume Snapshot Details
|
||||
func (s *ResourcemetadataService) GetVolumeSnapshotDetails(p *GetVolumeSnapshotDetailsParams) (*GetVolumeSnapshotDetailsResponse, error) {
|
||||
resp, err := s.cs.newRequest("getVolumeSnapshotDetails", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r RemoveResourceDetailResponse
|
||||
var r GetVolumeSnapshotDetailsResponse
|
||||
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 RemoveResourceDetailResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
type GetVolumeSnapshotDetailsResponse struct {
|
||||
VolumeiScsiName string `json:"volumeiScsiName"`
|
||||
}
|
||||
|
||||
type ListResourceDetailsParams struct {
|
||||
|
@ -401,6 +362,7 @@ func (s *ResourcemetadataService) ListResourceDetails(p *ListResourceDetailsPara
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -410,14 +372,105 @@ type ListResourceDetailsResponse struct {
|
|||
}
|
||||
|
||||
type ResourceDetail struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
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"`
|
||||
}
|
||||
|
||||
type RemoveResourceDetailParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *RemoveResourceDetailParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["key"]; found {
|
||||
u.Set("key", v.(string))
|
||||
}
|
||||
if v, found := p.p["resourceid"]; found {
|
||||
u.Set("resourceid", v.(string))
|
||||
}
|
||||
if v, found := p.p["resourcetype"]; found {
|
||||
u.Set("resourcetype", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *RemoveResourceDetailParams) SetKey(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["key"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RemoveResourceDetailParams) SetResourceid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourceid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RemoveResourceDetailParams) SetResourcetype(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["resourcetype"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new RemoveResourceDetailParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ResourcemetadataService) NewRemoveResourceDetailParams(resourceid string, resourcetype string) *RemoveResourceDetailParams {
|
||||
p := &RemoveResourceDetailParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["resourceid"] = resourceid
|
||||
p.p["resourcetype"] = resourcetype
|
||||
return p
|
||||
}
|
||||
|
||||
// Removes detail for the Resource.
|
||||
func (s *ResourcemetadataService) RemoveResourceDetail(p *RemoveResourceDetailParams) (*RemoveResourceDetailResponse, error) {
|
||||
resp, err := s.cs.newRequest("removeResourceDetail", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r RemoveResourceDetailResponse
|
||||
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 RemoveResourceDetailResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -24,122 +24,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
type ListStorageTagsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListStorageTagsParams) 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)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListStorageTagsParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListStorageTagsParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListStorageTagsParams) 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 ListStorageTagsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ResourcetagsService) NewListStorageTagsParams() *ListStorageTagsParams {
|
||||
p := &ListStorageTagsParams{}
|
||||
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 *ResourcetagsService) GetStorageTagID(keyword string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListStorageTagsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["keyword"] = keyword
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListStorageTags(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.StorageTags[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.StorageTags {
|
||||
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 storage tags
|
||||
func (s *ResourcetagsService) ListStorageTags(p *ListStorageTagsParams) (*ListStorageTagsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listStorageTags", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListStorageTagsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListStorageTagsResponse struct {
|
||||
Count int `json:"count"`
|
||||
StorageTags []*StorageTag `json:"storagetag"`
|
||||
}
|
||||
|
||||
type StorageTag struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Poolid int64 `json:"poolid,omitempty"`
|
||||
}
|
||||
|
||||
type CreateTagsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -239,13 +123,14 @@ func (s *ResourcetagsService) CreateTags(p *CreateTagsParams) (*CreateTagsRespon
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateTagsResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type DeleteTagsParams struct {
|
||||
|
@ -335,13 +220,131 @@ func (s *ResourcetagsService) DeleteTags(p *DeleteTagsParams) (*DeleteTagsRespon
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteTagsResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ListStorageTagsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListStorageTagsParams) 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)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListStorageTagsParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListStorageTagsParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListStorageTagsParams) 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 ListStorageTagsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ResourcetagsService) NewListStorageTagsParams() *ListStorageTagsParams {
|
||||
p := &ListStorageTagsParams{}
|
||||
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 *ResourcetagsService) GetStorageTagID(keyword string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListStorageTagsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["keyword"] = keyword
|
||||
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListStorageTags(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.StorageTags[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.StorageTags {
|
||||
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 storage tags
|
||||
func (s *ResourcetagsService) ListStorageTags(p *ListStorageTagsParams) (*ListStorageTagsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listStorageTags", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListStorageTagsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListStorageTagsResponse struct {
|
||||
Count int `json:"count"`
|
||||
StorageTags []*StorageTag `json:"storagetag"`
|
||||
}
|
||||
|
||||
type StorageTag struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Poolid int64 `json:"poolid"`
|
||||
}
|
||||
|
||||
type ListTagsParams struct {
|
||||
|
@ -522,6 +525,7 @@ func (s *ResourcetagsService) ListTags(p *ListTagsParams) (*ListTagsResponse, er
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -531,14 +535,14 @@ type ListTagsResponse struct {
|
|||
}
|
||||
|
||||
type Tag struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
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"`
|
||||
}
|
||||
|
|
|
@ -0,0 +1,749 @@
|
|||
//
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CreateRoleParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *CreateRoleParams) 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["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *CreateRoleParams) SetDescription(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["description"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateRoleParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateRoleParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new CreateRoleParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RoleService) NewCreateRoleParams(name string, roleType string) *CreateRoleParams {
|
||||
p := &CreateRoleParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["name"] = name
|
||||
p.p["type"] = roleType
|
||||
return p
|
||||
}
|
||||
|
||||
// Creates a role
|
||||
func (s *RoleService) CreateRole(p *CreateRoleParams) (*CreateRoleResponse, error) {
|
||||
resp, err := s.cs.newRequest("createRole", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r CreateRoleResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateRoleResponse struct {
|
||||
Description string `json:"description"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type CreateRolePermissionParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *CreateRolePermissionParams) 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["permission"]; found {
|
||||
u.Set("permission", v.(string))
|
||||
}
|
||||
if v, found := p.p["roleid"]; found {
|
||||
u.Set("roleid", v.(string))
|
||||
}
|
||||
if v, found := p.p["rule"]; found {
|
||||
u.Set("rule", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *CreateRolePermissionParams) SetDescription(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["description"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateRolePermissionParams) SetPermission(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["permission"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateRolePermissionParams) SetRoleid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["roleid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateRolePermissionParams) SetRule(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["rule"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new CreateRolePermissionParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RoleService) NewCreateRolePermissionParams(permission string, roleid string, rule string) *CreateRolePermissionParams {
|
||||
p := &CreateRolePermissionParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["permission"] = permission
|
||||
p.p["roleid"] = roleid
|
||||
p.p["rule"] = rule
|
||||
return p
|
||||
}
|
||||
|
||||
// Adds a API permission to a role
|
||||
func (s *RoleService) CreateRolePermission(p *CreateRolePermissionParams) (*CreateRolePermissionResponse, error) {
|
||||
resp, err := s.cs.newRequest("createRolePermission", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r CreateRolePermissionResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateRolePermissionResponse struct {
|
||||
Description string `json:"description"`
|
||||
Id string `json:"id"`
|
||||
Permission string `json:"permission"`
|
||||
Roleid string `json:"roleid"`
|
||||
Rolename string `json:"rolename"`
|
||||
Rule string `json:"rule"`
|
||||
}
|
||||
|
||||
type DeleteRoleParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteRoleParams) 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 *DeleteRoleParams) 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 DeleteRoleParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RoleService) NewDeleteRoleParams(id string) *DeleteRoleParams {
|
||||
p := &DeleteRoleParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Deletes a role
|
||||
func (s *RoleService) DeleteRole(p *DeleteRoleParams) (*DeleteRoleResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteRole", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteRoleResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteRoleResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteRoleResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteRoleResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type DeleteRolePermissionParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteRolePermissionParams) 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 *DeleteRolePermissionParams) 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 DeleteRolePermissionParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RoleService) NewDeleteRolePermissionParams(id string) *DeleteRolePermissionParams {
|
||||
p := &DeleteRolePermissionParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Deletes a role permission
|
||||
func (s *RoleService) DeleteRolePermission(p *DeleteRolePermissionParams) (*DeleteRolePermissionResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteRolePermission", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteRolePermissionResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteRolePermissionResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteRolePermissionResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteRolePermissionResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListRolePermissionsParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListRolePermissionsParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["roleid"]; found {
|
||||
u.Set("roleid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListRolePermissionsParams) SetRoleid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["roleid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListRolePermissionsParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RoleService) NewListRolePermissionsParams() *ListRolePermissionsParams {
|
||||
p := &ListRolePermissionsParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
return p
|
||||
}
|
||||
|
||||
// Lists role permissions
|
||||
func (s *RoleService) ListRolePermissions(p *ListRolePermissionsParams) (*ListRolePermissionsResponse, error) {
|
||||
resp, err := s.cs.newRequest("listRolePermissions", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListRolePermissionsResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListRolePermissionsResponse struct {
|
||||
Count int `json:"count"`
|
||||
RolePermissions []*RolePermission `json:"rolepermission"`
|
||||
}
|
||||
|
||||
type RolePermission struct {
|
||||
Description string `json:"description"`
|
||||
Id string `json:"id"`
|
||||
Permission string `json:"permission"`
|
||||
Roleid string `json:"roleid"`
|
||||
Rolename string `json:"rolename"`
|
||||
Rule string `json:"rule"`
|
||||
}
|
||||
|
||||
type ListRolesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListRolesParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
u.Set("id", v.(string))
|
||||
}
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListRolesParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListRolesParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListRolesParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListRolesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RoleService) NewListRolesParams() *ListRolesParams {
|
||||
p := &ListRolesParams{}
|
||||
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 *RoleService) GetRoleID(name string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListRolesParams{}
|
||||
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.ListRoles(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.Roles[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.Roles {
|
||||
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 *RoleService) GetRoleByName(name string, opts ...OptionFunc) (*Role, int, error) {
|
||||
id, count, err := s.GetRoleID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetRoleByID(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 *RoleService) GetRoleByID(id string, opts ...OptionFunc) (*Role, int, error) {
|
||||
p := &ListRolesParams{}
|
||||
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.ListRoles(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.Roles[0], l.Count, nil
|
||||
}
|
||||
return nil, l.Count, fmt.Errorf("There is more then one result for Role UUID: %s!", id)
|
||||
}
|
||||
|
||||
// Lists dynamic roles in CloudStack
|
||||
func (s *RoleService) ListRoles(p *ListRolesParams) (*ListRolesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listRoles", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListRolesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListRolesResponse struct {
|
||||
Count int `json:"count"`
|
||||
Roles []*Role `json:"role"`
|
||||
}
|
||||
|
||||
type Role struct {
|
||||
Description string `json:"description"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type UpdateRoleParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateRoleParams) 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["id"]; found {
|
||||
u.Set("id", v.(string))
|
||||
}
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["type"]; found {
|
||||
u.Set("type", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateRoleParams) SetDescription(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["description"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRoleParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRoleParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRoleParams) SetType(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["type"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateRoleParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RoleService) NewUpdateRoleParams(id string) *UpdateRoleParams {
|
||||
p := &UpdateRoleParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a role
|
||||
func (s *RoleService) UpdateRole(p *UpdateRoleParams) (*UpdateRoleResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateRole", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateRoleResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateRoleResponse struct {
|
||||
Description string `json:"description"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type UpdateRolePermissionParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateRolePermissionParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["permission"]; found {
|
||||
u.Set("permission", v.(string))
|
||||
}
|
||||
if v, found := p.p["roleid"]; found {
|
||||
u.Set("roleid", v.(string))
|
||||
}
|
||||
if v, found := p.p["ruleid"]; found {
|
||||
u.Set("ruleid", v.(string))
|
||||
}
|
||||
if v, found := p.p["ruleorder"]; found {
|
||||
vv := strings.Join(v.([]string), ",")
|
||||
u.Set("ruleorder", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateRolePermissionParams) SetPermission(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["permission"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRolePermissionParams) SetRoleid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["roleid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRolePermissionParams) SetRuleid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ruleid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateRolePermissionParams) SetRuleorder(v []string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ruleorder"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateRolePermissionParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *RoleService) NewUpdateRolePermissionParams(roleid string) *UpdateRolePermissionParams {
|
||||
p := &UpdateRolePermissionParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["roleid"] = roleid
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a role permission order
|
||||
func (s *RoleService) UpdateRolePermission(p *UpdateRolePermissionParams) (*UpdateRolePermissionResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateRolePermission", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateRolePermissionResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateRolePermissionResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *UpdateRolePermissionResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias UpdateRolePermissionResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -22,397 +22,6 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
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,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Affinitygroup []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
VirtualmachineIds []string `json:"virtualmachineIds,omitempty"`
|
||||
} `json:"affinitygroup,omitempty"`
|
||||
Cpunumber int `json:"cpunumber,omitempty"`
|
||||
Cpuspeed int `json:"cpuspeed,omitempty"`
|
||||
Cpuused string `json:"cpuused,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
Diskioread int64 `json:"diskioread,omitempty"`
|
||||
Diskiowrite int64 `json:"diskiowrite,omitempty"`
|
||||
Diskkbsread int64 `json:"diskkbsread,omitempty"`
|
||||
Diskkbswrite int64 `json:"diskkbswrite,omitempty"`
|
||||
Diskofferingid string `json:"diskofferingid,omitempty"`
|
||||
Diskofferingname string `json:"diskofferingname,omitempty"`
|
||||
Displayname string `json:"displayname,omitempty"`
|
||||
Displayvm bool `json:"displayvm,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Groupid string `json:"groupid,omitempty"`
|
||||
Guestosid string `json:"guestosid,omitempty"`
|
||||
Haenable bool `json:"haenable,omitempty"`
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Instancename string `json:"instancename,omitempty"`
|
||||
Isdynamicallyscalable bool `json:"isdynamicallyscalable,omitempty"`
|
||||
Isodisplaytext string `json:"isodisplaytext,omitempty"`
|
||||
Isoid string `json:"isoid,omitempty"`
|
||||
Isoname string `json:"isoname,omitempty"`
|
||||
Keypair string `json:"keypair,omitempty"`
|
||||
Memory int `json:"memory,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkkbsread int64 `json:"networkkbsread,omitempty"`
|
||||
Networkkbswrite int64 `json:"networkkbswrite,omitempty"`
|
||||
Nic []struct {
|
||||
Broadcasturi string `json:"broadcasturi,omitempty"`
|
||||
Deviceid string `json:"deviceid,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6address string `json:"ip6address,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Isdefault bool `json:"isdefault,omitempty"`
|
||||
Isolationuri string `json:"isolationuri,omitempty"`
|
||||
Macaddress string `json:"macaddress,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Networkname string `json:"networkname,omitempty"`
|
||||
Secondaryip []struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
} `json:"secondaryip,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Virtualmachineid string `json:"virtualmachineid,omitempty"`
|
||||
} `json:"nic,omitempty"`
|
||||
Ostypeid int64 `json:"ostypeid,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Passwordenabled bool `json:"passwordenabled,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Publicip string `json:"publicip,omitempty"`
|
||||
Publicipid string `json:"publicipid,omitempty"`
|
||||
Rootdeviceid int64 `json:"rootdeviceid,omitempty"`
|
||||
Rootdevicetype string `json:"rootdevicetype,omitempty"`
|
||||
Securitygroup []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Egressrule []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Cidr string `json:"cidr,omitempty"`
|
||||
Endport int `json:"endport,omitempty"`
|
||||
Icmpcode int `json:"icmpcode,omitempty"`
|
||||
Icmptype int `json:"icmptype,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Ruleid string `json:"ruleid,omitempty"`
|
||||
Securitygroupname string `json:"securitygroupname,omitempty"`
|
||||
Startport int `json:"startport,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
} `json:"egressrule,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ingressrule []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Cidr string `json:"cidr,omitempty"`
|
||||
Endport int `json:"endport,omitempty"`
|
||||
Icmpcode int `json:"icmpcode,omitempty"`
|
||||
Icmptype int `json:"icmptype,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Ruleid string `json:"ruleid,omitempty"`
|
||||
Securitygroupname string `json:"securitygroupname,omitempty"`
|
||||
Startport int `json:"startport,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
} `json:"ingressrule,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Virtualmachinecount int `json:"virtualmachinecount,omitempty"`
|
||||
Virtualmachineids []string `json:"virtualmachineids,omitempty"`
|
||||
} `json:"securitygroup,omitempty"`
|
||||
Serviceofferingid string `json:"serviceofferingid,omitempty"`
|
||||
Serviceofferingname string `json:"serviceofferingname,omitempty"`
|
||||
Servicestate string `json:"servicestate,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Tags []struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Customer string `json:"customer,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Resourceid string `json:"resourceid,omitempty"`
|
||||
Resourcetype string `json:"resourcetype,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tags,omitempty"`
|
||||
Templatedisplaytext string `json:"templatedisplaytext,omitempty"`
|
||||
Templateid string `json:"templateid,omitempty"`
|
||||
Templatename string `json:"templatename,omitempty"`
|
||||
Userid string `json:"userid,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Vgpu string `json:"vgpu,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
}
|
||||
|
||||
type RegisterSSHKeyPairParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) 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["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["projectid"]; found {
|
||||
u.Set("projectid", v.(string))
|
||||
}
|
||||
if v, found := p.p["publickey"]; found {
|
||||
u.Set("publickey", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetPublickey(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["publickey"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new RegisterSSHKeyPairParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *SSHService) NewRegisterSSHKeyPairParams(name string, publickey string) *RegisterSSHKeyPairParams {
|
||||
p := &RegisterSSHKeyPairParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["name"] = name
|
||||
p.p["publickey"] = publickey
|
||||
return p
|
||||
}
|
||||
|
||||
// Register a public key in a keypair under a certain name
|
||||
func (s *SSHService) RegisterSSHKeyPair(p *RegisterSSHKeyPairParams) (*RegisterSSHKeyPairResponse, error) {
|
||||
resp, err := s.cs.newRequest("registerSSHKeyPair", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp, err = getRawValue(resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r RegisterSSHKeyPairResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type RegisterSSHKeyPairResponse struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
type CreateSSHKeyPairParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -493,11 +102,12 @@ func (s *SSHService) CreateSSHKeyPair(p *CreateSSHKeyPairParams) (*CreateSSHKeyP
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateSSHKeyPairResponse struct {
|
||||
Privatekey string `json:"privatekey,omitempty"`
|
||||
Privatekey string `json:"privatekey"`
|
||||
}
|
||||
|
||||
type DeleteSSHKeyPairParams struct {
|
||||
|
@ -576,12 +186,32 @@ func (s *SSHService) DeleteSSHKeyPair(p *DeleteSSHKeyPairParams) (*DeleteSSHKeyP
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteSSHKeyPairResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteSSHKeyPairResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteSSHKeyPairResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListSSHKeyPairsParams struct {
|
||||
|
@ -729,6 +359,7 @@ func (s *SSHService) ListSSHKeyPairs(p *ListSSHKeyPairsParams) (*ListSSHKeyPairs
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -738,9 +369,333 @@ type ListSSHKeyPairsResponse struct {
|
|||
}
|
||||
|
||||
type SSHKeyPair struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type RegisterSSHKeyPairParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) 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["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["projectid"]; found {
|
||||
u.Set("projectid", v.(string))
|
||||
}
|
||||
if v, found := p.p["publickey"]; found {
|
||||
u.Set("publickey", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *RegisterSSHKeyPairParams) SetPublickey(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["publickey"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new RegisterSSHKeyPairParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *SSHService) NewRegisterSSHKeyPairParams(name string, publickey string) *RegisterSSHKeyPairParams {
|
||||
p := &RegisterSSHKeyPairParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["name"] = name
|
||||
p.p["publickey"] = publickey
|
||||
return p
|
||||
}
|
||||
|
||||
// Register a public key in a keypair under a certain name
|
||||
func (s *SSHService) RegisterSSHKeyPair(p *RegisterSSHKeyPairParams) (*RegisterSSHKeyPairResponse, error) {
|
||||
resp, err := s.cs.newRequest("registerSSHKeyPair", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp, err = getRawValue(resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r RegisterSSHKeyPairResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type RegisterSSHKeyPairResponse struct {
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
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 []ResetSSHKeyForVirtualMachineResponseAffinitygroup `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 []Nic `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 []ResetSSHKeyForVirtualMachineResponseSecuritygroup `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 ResetSSHKeyForVirtualMachineResponseSecuritygroup struct {
|
||||
Account string `json:"account"`
|
||||
Description string `json:"description"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Egressrule []ResetSSHKeyForVirtualMachineResponseSecuritygroupRule `json:"egressrule"`
|
||||
Id string `json:"id"`
|
||||
Ingressrule []ResetSSHKeyForVirtualMachineResponseSecuritygroupRule `json:"ingressrule"`
|
||||
Name string `json:"name"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Tags []Tags `json:"tags"`
|
||||
Virtualmachinecount int `json:"virtualmachinecount"`
|
||||
Virtualmachineids []interface{} `json:"virtualmachineids"`
|
||||
}
|
||||
|
||||
type ResetSSHKeyForVirtualMachineResponseSecuritygroupRule 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 []Tags `json:"tags"`
|
||||
}
|
||||
|
||||
type ResetSSHKeyForVirtualMachineResponseAffinitygroup 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"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -368,41 +368,42 @@ func (s *ServiceOfferingService) CreateServiceOffering(p *CreateServiceOfferingP
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateServiceOfferingResponse struct {
|
||||
Cpunumber int `json:"cpunumber,omitempty"`
|
||||
Cpuspeed int `json:"cpuspeed,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Defaultuse bool `json:"defaultuse,omitempty"`
|
||||
Deploymentplanner string `json:"deploymentplanner,omitempty"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate,omitempty"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate,omitempty"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate,omitempty"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Hosttags string `json:"hosttags,omitempty"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Iscustomized bool `json:"iscustomized,omitempty"`
|
||||
Iscustomizediops bool `json:"iscustomizediops,omitempty"`
|
||||
Issystem bool `json:"issystem,omitempty"`
|
||||
Isvolatile bool `json:"isvolatile,omitempty"`
|
||||
Limitcpuuse bool `json:"limitcpuuse,omitempty"`
|
||||
Maxiops int64 `json:"maxiops,omitempty"`
|
||||
Memory int `json:"memory,omitempty"`
|
||||
Miniops int64 `json:"miniops,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkrate int `json:"networkrate,omitempty"`
|
||||
Offerha bool `json:"offerha,omitempty"`
|
||||
Provisioningtype string `json:"provisioningtype,omitempty"`
|
||||
Serviceofferingdetails map[string]string `json:"serviceofferingdetails,omitempty"`
|
||||
Storagetype string `json:"storagetype,omitempty"`
|
||||
Systemvmtype string `json:"systemvmtype,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Cpunumber int `json:"cpunumber"`
|
||||
Cpuspeed int `json:"cpuspeed"`
|
||||
Created string `json:"created"`
|
||||
Defaultuse bool `json:"defaultuse"`
|
||||
Deploymentplanner string `json:"deploymentplanner"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Hosttags string `json:"hosttags"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"`
|
||||
Id string `json:"id"`
|
||||
Iscustomized bool `json:"iscustomized"`
|
||||
Iscustomizediops bool `json:"iscustomizediops"`
|
||||
Issystem bool `json:"issystem"`
|
||||
Isvolatile bool `json:"isvolatile"`
|
||||
Limitcpuuse bool `json:"limitcpuuse"`
|
||||
Maxiops int64 `json:"maxiops"`
|
||||
Memory int `json:"memory"`
|
||||
Miniops int64 `json:"miniops"`
|
||||
Name string `json:"name"`
|
||||
Networkrate int `json:"networkrate"`
|
||||
Offerha bool `json:"offerha"`
|
||||
Provisioningtype string `json:"provisioningtype"`
|
||||
Serviceofferingdetails map[string]string `json:"serviceofferingdetails"`
|
||||
Storagetype string `json:"storagetype"`
|
||||
Systemvmtype string `json:"systemvmtype"`
|
||||
Tags string `json:"tags"`
|
||||
}
|
||||
|
||||
type DeleteServiceOfferingParams struct {
|
||||
|
@ -448,126 +449,32 @@ func (s *ServiceOfferingService) DeleteServiceOffering(p *DeleteServiceOfferingP
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteServiceOfferingResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type UpdateServiceOfferingParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
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["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["sortkey"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("sortkey", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) SetDisplaytext(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["displaytext"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) SetSortkey(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["sortkey"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateServiceOfferingParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ServiceOfferingService) NewUpdateServiceOfferingParams(id string) *UpdateServiceOfferingParams {
|
||||
p := &UpdateServiceOfferingParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a service offering.
|
||||
func (s *ServiceOfferingService) UpdateServiceOffering(p *UpdateServiceOfferingParams) (*UpdateServiceOfferingResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateServiceOffering", p.toURLValues())
|
||||
func (r *DeleteServiceOfferingResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
var r UpdateServiceOfferingResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateServiceOfferingResponse struct {
|
||||
Cpunumber int `json:"cpunumber,omitempty"`
|
||||
Cpuspeed int `json:"cpuspeed,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Defaultuse bool `json:"defaultuse,omitempty"`
|
||||
Deploymentplanner string `json:"deploymentplanner,omitempty"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate,omitempty"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate,omitempty"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate,omitempty"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Hosttags string `json:"hosttags,omitempty"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Iscustomized bool `json:"iscustomized,omitempty"`
|
||||
Iscustomizediops bool `json:"iscustomizediops,omitempty"`
|
||||
Issystem bool `json:"issystem,omitempty"`
|
||||
Isvolatile bool `json:"isvolatile,omitempty"`
|
||||
Limitcpuuse bool `json:"limitcpuuse,omitempty"`
|
||||
Maxiops int64 `json:"maxiops,omitempty"`
|
||||
Memory int `json:"memory,omitempty"`
|
||||
Miniops int64 `json:"miniops,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkrate int `json:"networkrate,omitempty"`
|
||||
Offerha bool `json:"offerha,omitempty"`
|
||||
Provisioningtype string `json:"provisioningtype,omitempty"`
|
||||
Serviceofferingdetails map[string]string `json:"serviceofferingdetails,omitempty"`
|
||||
Storagetype string `json:"storagetype,omitempty"`
|
||||
Systemvmtype string `json:"systemvmtype,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
type alias DeleteServiceOfferingResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListServiceOfferingsParams struct {
|
||||
|
@ -723,7 +630,7 @@ func (s *ServiceOfferingService) GetServiceOfferingID(name string, opts ...Optio
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -773,7 +680,7 @@ func (s *ServiceOfferingService) GetServiceOfferingByID(id string, opts ...Optio
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -810,6 +717,7 @@ func (s *ServiceOfferingService) ListServiceOfferings(p *ListServiceOfferingsPar
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -819,35 +727,150 @@ type ListServiceOfferingsResponse struct {
|
|||
}
|
||||
|
||||
type ServiceOffering struct {
|
||||
Cpunumber int `json:"cpunumber,omitempty"`
|
||||
Cpuspeed int `json:"cpuspeed,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Defaultuse bool `json:"defaultuse,omitempty"`
|
||||
Deploymentplanner string `json:"deploymentplanner,omitempty"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate,omitempty"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate,omitempty"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate,omitempty"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Hosttags string `json:"hosttags,omitempty"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Iscustomized bool `json:"iscustomized,omitempty"`
|
||||
Iscustomizediops bool `json:"iscustomizediops,omitempty"`
|
||||
Issystem bool `json:"issystem,omitempty"`
|
||||
Isvolatile bool `json:"isvolatile,omitempty"`
|
||||
Limitcpuuse bool `json:"limitcpuuse,omitempty"`
|
||||
Maxiops int64 `json:"maxiops,omitempty"`
|
||||
Memory int `json:"memory,omitempty"`
|
||||
Miniops int64 `json:"miniops,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Networkrate int `json:"networkrate,omitempty"`
|
||||
Offerha bool `json:"offerha,omitempty"`
|
||||
Provisioningtype string `json:"provisioningtype,omitempty"`
|
||||
Serviceofferingdetails map[string]string `json:"serviceofferingdetails,omitempty"`
|
||||
Storagetype string `json:"storagetype,omitempty"`
|
||||
Systemvmtype string `json:"systemvmtype,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Cpunumber int `json:"cpunumber"`
|
||||
Cpuspeed int `json:"cpuspeed"`
|
||||
Created string `json:"created"`
|
||||
Defaultuse bool `json:"defaultuse"`
|
||||
Deploymentplanner string `json:"deploymentplanner"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Hosttags string `json:"hosttags"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"`
|
||||
Id string `json:"id"`
|
||||
Iscustomized bool `json:"iscustomized"`
|
||||
Iscustomizediops bool `json:"iscustomizediops"`
|
||||
Issystem bool `json:"issystem"`
|
||||
Isvolatile bool `json:"isvolatile"`
|
||||
Limitcpuuse bool `json:"limitcpuuse"`
|
||||
Maxiops int64 `json:"maxiops"`
|
||||
Memory int `json:"memory"`
|
||||
Miniops int64 `json:"miniops"`
|
||||
Name string `json:"name"`
|
||||
Networkrate int `json:"networkrate"`
|
||||
Offerha bool `json:"offerha"`
|
||||
Provisioningtype string `json:"provisioningtype"`
|
||||
Serviceofferingdetails map[string]string `json:"serviceofferingdetails"`
|
||||
Storagetype string `json:"storagetype"`
|
||||
Systemvmtype string `json:"systemvmtype"`
|
||||
Tags string `json:"tags"`
|
||||
}
|
||||
|
||||
type UpdateServiceOfferingParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
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["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
if v, found := p.p["sortkey"]; found {
|
||||
vv := strconv.Itoa(v.(int))
|
||||
u.Set("sortkey", vv)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) SetDisplaytext(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["displaytext"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateServiceOfferingParams) SetSortkey(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["sortkey"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateServiceOfferingParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *ServiceOfferingService) NewUpdateServiceOfferingParams(id string) *UpdateServiceOfferingParams {
|
||||
p := &UpdateServiceOfferingParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a service offering.
|
||||
func (s *ServiceOfferingService) UpdateServiceOffering(p *UpdateServiceOfferingParams) (*UpdateServiceOfferingResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateServiceOffering", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateServiceOfferingResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateServiceOfferingResponse struct {
|
||||
Cpunumber int `json:"cpunumber"`
|
||||
Cpuspeed int `json:"cpuspeed"`
|
||||
Created string `json:"created"`
|
||||
Defaultuse bool `json:"defaultuse"`
|
||||
Deploymentplanner string `json:"deploymentplanner"`
|
||||
DiskBytesReadRate int64 `json:"diskBytesReadRate"`
|
||||
DiskBytesWriteRate int64 `json:"diskBytesWriteRate"`
|
||||
DiskIopsReadRate int64 `json:"diskIopsReadRate"`
|
||||
DiskIopsWriteRate int64 `json:"diskIopsWriteRate"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Hosttags string `json:"hosttags"`
|
||||
Hypervisorsnapshotreserve int `json:"hypervisorsnapshotreserve"`
|
||||
Id string `json:"id"`
|
||||
Iscustomized bool `json:"iscustomized"`
|
||||
Iscustomizediops bool `json:"iscustomizediops"`
|
||||
Issystem bool `json:"issystem"`
|
||||
Isvolatile bool `json:"isvolatile"`
|
||||
Limitcpuuse bool `json:"limitcpuuse"`
|
||||
Maxiops int64 `json:"maxiops"`
|
||||
Memory int `json:"memory"`
|
||||
Miniops int64 `json:"miniops"`
|
||||
Name string `json:"name"`
|
||||
Networkrate int `json:"networkrate"`
|
||||
Offerha bool `json:"offerha"`
|
||||
Provisioningtype string `json:"provisioningtype"`
|
||||
Serviceofferingdetails map[string]string `json:"serviceofferingdetails"`
|
||||
Storagetype string `json:"storagetype"`
|
||||
Systemvmtype string `json:"systemvmtype"`
|
||||
Tags string `json:"tags"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -22,6 +22,198 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
type CancelStorageMaintenanceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *CancelStorageMaintenanceParams) 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 *CancelStorageMaintenanceParams) 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 CancelStorageMaintenanceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *StoragePoolService) NewCancelStorageMaintenanceParams(id string) *CancelStorageMaintenanceParams {
|
||||
p := &CancelStorageMaintenanceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Cancels maintenance for primary storage
|
||||
func (s *StoragePoolService) CancelStorageMaintenance(p *CancelStorageMaintenanceParams) (*CancelStorageMaintenanceResponse, error) {
|
||||
resp, err := s.cs.newRequest("cancelStorageMaintenance", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r CancelStorageMaintenanceResponse
|
||||
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 CancelStorageMaintenanceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Allocatediops int64 `json:"allocatediops"`
|
||||
Capacityiops int64 `json:"capacityiops"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Created string `json:"created"`
|
||||
Disksizeallocated int64 `json:"disksizeallocated"`
|
||||
Disksizetotal int64 `json:"disksizetotal"`
|
||||
Disksizeused int64 `json:"disksizeused"`
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Name string `json:"name"`
|
||||
Overprovisionfactor string `json:"overprovisionfactor"`
|
||||
Path string `json:"path"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Provider string `json:"provider"`
|
||||
Scope string `json:"scope"`
|
||||
State string `json:"state"`
|
||||
Storagecapabilities map[string]string `json:"storagecapabilities"`
|
||||
Suitableformigration bool `json:"suitableformigration"`
|
||||
Tags string `json:"tags"`
|
||||
Type string `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type EnableStorageMaintenanceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *EnableStorageMaintenanceParams) 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 *EnableStorageMaintenanceParams) 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 EnableStorageMaintenanceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *StoragePoolService) NewEnableStorageMaintenanceParams(id string) *EnableStorageMaintenanceParams {
|
||||
p := &EnableStorageMaintenanceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Puts storage pool into maintenance state
|
||||
func (s *StoragePoolService) EnableStorageMaintenance(p *EnableStorageMaintenanceParams) (*EnableStorageMaintenanceResponse, error) {
|
||||
resp, err := s.cs.newRequest("enableStorageMaintenance", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r EnableStorageMaintenanceResponse
|
||||
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 EnableStorageMaintenanceResponse struct {
|
||||
JobID string `json:"jobid"`
|
||||
Allocatediops int64 `json:"allocatediops"`
|
||||
Capacityiops int64 `json:"capacityiops"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Created string `json:"created"`
|
||||
Disksizeallocated int64 `json:"disksizeallocated"`
|
||||
Disksizetotal int64 `json:"disksizetotal"`
|
||||
Disksizeused int64 `json:"disksizeused"`
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
Id string `json:"id"`
|
||||
Ipaddress string `json:"ipaddress"`
|
||||
Name string `json:"name"`
|
||||
Overprovisionfactor string `json:"overprovisionfactor"`
|
||||
Path string `json:"path"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Provider string `json:"provider"`
|
||||
Scope string `json:"scope"`
|
||||
State string `json:"state"`
|
||||
Storagecapabilities map[string]string `json:"storagecapabilities"`
|
||||
Suitableformigration bool `json:"suitableformigration"`
|
||||
Tags string `json:"tags"`
|
||||
Type string `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
||||
type ListStorageProvidersParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
@ -100,6 +292,7 @@ func (s *StoragePoolService) ListStorageProviders(p *ListStorageProvidersParams)
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -109,192 +302,6 @@ type ListStorageProvidersResponse struct {
|
|||
}
|
||||
|
||||
type StorageProvider struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type EnableStorageMaintenanceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *EnableStorageMaintenanceParams) 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 *EnableStorageMaintenanceParams) 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 EnableStorageMaintenanceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *StoragePoolService) NewEnableStorageMaintenanceParams(id string) *EnableStorageMaintenanceParams {
|
||||
p := &EnableStorageMaintenanceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Puts storage pool into maintenance state
|
||||
func (s *StoragePoolService) EnableStorageMaintenance(p *EnableStorageMaintenanceParams) (*EnableStorageMaintenanceResponse, error) {
|
||||
resp, err := s.cs.newRequest("enableStorageMaintenance", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r EnableStorageMaintenanceResponse
|
||||
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 EnableStorageMaintenanceResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Capacityiops int64 `json:"capacityiops,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Disksizeallocated int64 `json:"disksizeallocated,omitempty"`
|
||||
Disksizetotal int64 `json:"disksizetotal,omitempty"`
|
||||
Disksizeused int64 `json:"disksizeused,omitempty"`
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Overprovisionfactor string `json:"overprovisionfactor,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Storagecapabilities map[string]string `json:"storagecapabilities,omitempty"`
|
||||
Suitableformigration bool `json:"suitableformigration,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
}
|
||||
|
||||
type CancelStorageMaintenanceParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *CancelStorageMaintenanceParams) 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 *CancelStorageMaintenanceParams) 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 CancelStorageMaintenanceParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *StoragePoolService) NewCancelStorageMaintenanceParams(id string) *CancelStorageMaintenanceParams {
|
||||
p := &CancelStorageMaintenanceParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Cancels maintenance for primary storage
|
||||
func (s *StoragePoolService) CancelStorageMaintenance(p *CancelStorageMaintenanceParams) (*CancelStorageMaintenanceResponse, error) {
|
||||
resp, err := s.cs.newRequest("cancelStorageMaintenance", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r CancelStorageMaintenanceResponse
|
||||
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 CancelStorageMaintenanceResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Capacityiops int64 `json:"capacityiops,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Disksizeallocated int64 `json:"disksizeallocated,omitempty"`
|
||||
Disksizetotal int64 `json:"disksizetotal,omitempty"`
|
||||
Disksizeused int64 `json:"disksizeused,omitempty"`
|
||||
Hypervisor string `json:"hypervisor,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ipaddress string `json:"ipaddress,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Overprovisionfactor string `json:"overprovisionfactor,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Storagecapabilities map[string]string `json:"storagecapabilities,omitempty"`
|
||||
Suitableformigration bool `json:"suitableformigration,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -121,12 +121,84 @@ func (s *StratosphereSSPService) AddStratosphereSsp(p *AddStratosphereSspParams)
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddStratosphereSspResponse struct {
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
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 *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 bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteStratosphereSspResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteStratosphereSspResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -99,19 +99,19 @@ func (s *SwiftService) AddSwift(p *AddSwiftParams) (*AddSwiftResponse, error) {
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddSwiftResponse struct {
|
||||
Details []string `json:"details,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Providername string `json:"providername,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
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 ListSwiftsParams struct {
|
||||
|
@ -188,7 +188,7 @@ func (s *SwiftService) GetSwiftID(keyword string, opts ...OptionFunc) (string, i
|
|||
|
||||
p.p["keyword"] = keyword
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -228,6 +228,7 @@ func (s *SwiftService) ListSwifts(p *ListSwiftsParams) (*ListSwiftsResponse, err
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -237,13 +238,12 @@ type ListSwiftsResponse struct {
|
|||
}
|
||||
|
||||
type Swift struct {
|
||||
Details []string `json:"details,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Providername string `json:"providername,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
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"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -156,6 +156,7 @@ func (s *SystemCapacityService) ListCapacity(p *ListCapacityParams) (*ListCapaci
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -165,14 +166,16 @@ type ListCapacityResponse struct {
|
|||
}
|
||||
|
||||
type Capacity struct {
|
||||
Capacitytotal int64 `json:"capacitytotal,omitempty"`
|
||||
Capacityused int64 `json:"capacityused,omitempty"`
|
||||
Clusterid string `json:"clusterid,omitempty"`
|
||||
Clustername string `json:"clustername,omitempty"`
|
||||
Percentused string `json:"percentused,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Type int `json:"type,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Zonename string `json:"zonename,omitempty"`
|
||||
Capacityallocated int64 `json:"capacityallocated"`
|
||||
Capacitytotal int64 `json:"capacitytotal"`
|
||||
Capacityused int64 `json:"capacityused"`
|
||||
Clusterid string `json:"clusterid"`
|
||||
Clustername string `json:"clustername"`
|
||||
Name string `json:"name"`
|
||||
Percentused string `json:"percentused"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Type int `json:"type"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
Zonename string `json:"zonename"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -114,384 +114,15 @@ func (s *UCSService) AddUcsManager(p *AddUcsManagerParams) (*AddUcsManagerRespon
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AddUcsManagerResponse struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
}
|
||||
|
||||
type ListUcsManagersParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
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["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["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) 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 ListUcsManagersParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *UCSService) NewListUcsManagersParams() *ListUcsManagersParams {
|
||||
p := &ListUcsManagersParams{}
|
||||
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 *UCSService) GetUcsManagerID(keyword string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListUcsManagersParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["keyword"] = keyword
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListUcsManagers(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.UcsManagers[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.UcsManagers {
|
||||
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)
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *UCSService) GetUcsManagerByName(name string, opts ...OptionFunc) (*UcsManager, int, error) {
|
||||
id, count, err := s.GetUcsManagerID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetUcsManagerByID(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 *UCSService) GetUcsManagerByID(id string, opts ...OptionFunc) (*UcsManager, int, error) {
|
||||
p := &ListUcsManagersParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListUcsManagers(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.UcsManagers[0], l.Count, nil
|
||||
}
|
||||
return nil, l.Count, fmt.Errorf("There is more then one result for UcsManager UUID: %s!", id)
|
||||
}
|
||||
|
||||
// List ucs manager
|
||||
func (s *UCSService) ListUcsManagers(p *ListUcsManagersParams) (*ListUcsManagersResponse, error) {
|
||||
resp, err := s.cs.newRequest("listUcsManagers", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListUcsManagersResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListUcsManagersResponse struct {
|
||||
Count int `json:"count"`
|
||||
UcsManagers []*UcsManager `json:"ucsmanager"`
|
||||
}
|
||||
|
||||
type UcsManager struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
}
|
||||
|
||||
type ListUcsProfilesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) 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["ucsmanagerid"]; found {
|
||||
u.Set("ucsmanagerid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) SetUcsmanagerid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ucsmanagerid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListUcsProfilesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *UCSService) NewListUcsProfilesParams(ucsmanagerid string) *ListUcsProfilesParams {
|
||||
p := &ListUcsProfilesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ucsmanagerid"] = ucsmanagerid
|
||||
return p
|
||||
}
|
||||
|
||||
// List profile in ucs manager
|
||||
func (s *UCSService) ListUcsProfiles(p *ListUcsProfilesParams) (*ListUcsProfilesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listUcsProfiles", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListUcsProfilesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListUcsProfilesResponse struct {
|
||||
Count int `json:"count"`
|
||||
UcsProfiles []*UcsProfile `json:"ucsprofile"`
|
||||
}
|
||||
|
||||
type UcsProfile struct {
|
||||
Ucsdn string `json:"ucsdn,omitempty"`
|
||||
}
|
||||
|
||||
type ListUcsBladesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) 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["ucsmanagerid"]; found {
|
||||
u.Set("ucsmanagerid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) SetUcsmanagerid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ucsmanagerid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListUcsBladesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *UCSService) NewListUcsBladesParams(ucsmanagerid string) *ListUcsBladesParams {
|
||||
p := &ListUcsBladesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ucsmanagerid"] = ucsmanagerid
|
||||
return p
|
||||
}
|
||||
|
||||
// List ucs blades
|
||||
func (s *UCSService) ListUcsBlades(p *ListUcsBladesParams) (*ListUcsBladesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listUcsBlades", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListUcsBladesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListUcsBladesResponse struct {
|
||||
Count int `json:"count"`
|
||||
UcsBlades []*UcsBlade `json:"ucsblade"`
|
||||
}
|
||||
|
||||
type UcsBlade struct {
|
||||
Bladedn string `json:"bladedn,omitempty"`
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Profiledn string `json:"profiledn,omitempty"`
|
||||
Ucsmanagerid string `json:"ucsmanagerid,omitempty"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
}
|
||||
|
||||
type AssociateUcsProfileToBladeParams struct {
|
||||
|
@ -581,14 +212,459 @@ func (s *UCSService) AssociateUcsProfileToBlade(p *AssociateUcsProfileToBladePar
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type AssociateUcsProfileToBladeResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Bladedn string `json:"bladedn,omitempty"`
|
||||
Hostid string `json:"hostid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Profiledn string `json:"profiledn,omitempty"`
|
||||
Ucsmanagerid string `json:"ucsmanagerid,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Bladedn string `json:"bladedn"`
|
||||
Hostid string `json:"hostid"`
|
||||
Id string `json:"id"`
|
||||
Profiledn string `json:"profiledn"`
|
||||
Ucsmanagerid string `json:"ucsmanagerid"`
|
||||
}
|
||||
|
||||
type DeleteUcsManagerParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DeleteUcsManagerParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["ucsmanagerid"]; found {
|
||||
u.Set("ucsmanagerid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DeleteUcsManagerParams) SetUcsmanagerid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ucsmanagerid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DeleteUcsManagerParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *UCSService) NewDeleteUcsManagerParams(ucsmanagerid string) *DeleteUcsManagerParams {
|
||||
p := &DeleteUcsManagerParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ucsmanagerid"] = ucsmanagerid
|
||||
return p
|
||||
}
|
||||
|
||||
// Delete a Ucs manager
|
||||
func (s *UCSService) DeleteUcsManager(p *DeleteUcsManagerParams) (*DeleteUcsManagerResponse, error) {
|
||||
resp, err := s.cs.newRequest("deleteUcsManager", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DeleteUcsManagerResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteUcsManagerResponse struct {
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteUcsManagerResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteUcsManagerResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListUcsBladesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) 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["ucsmanagerid"]; found {
|
||||
u.Set("ucsmanagerid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsBladesParams) SetUcsmanagerid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ucsmanagerid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListUcsBladesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *UCSService) NewListUcsBladesParams(ucsmanagerid string) *ListUcsBladesParams {
|
||||
p := &ListUcsBladesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ucsmanagerid"] = ucsmanagerid
|
||||
return p
|
||||
}
|
||||
|
||||
// List ucs blades
|
||||
func (s *UCSService) ListUcsBlades(p *ListUcsBladesParams) (*ListUcsBladesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listUcsBlades", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListUcsBladesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListUcsBladesResponse struct {
|
||||
Count int `json:"count"`
|
||||
UcsBlades []*UcsBlade `json:"ucsblade"`
|
||||
}
|
||||
|
||||
type UcsBlade struct {
|
||||
Bladedn string `json:"bladedn"`
|
||||
Hostid string `json:"hostid"`
|
||||
Id string `json:"id"`
|
||||
Profiledn string `json:"profiledn"`
|
||||
Ucsmanagerid string `json:"ucsmanagerid"`
|
||||
}
|
||||
|
||||
type ListUcsManagersParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
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["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["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsManagersParams) 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 ListUcsManagersParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *UCSService) NewListUcsManagersParams() *ListUcsManagersParams {
|
||||
p := &ListUcsManagersParams{}
|
||||
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 *UCSService) GetUcsManagerID(keyword string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListUcsManagersParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["keyword"] = keyword
|
||||
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListUcsManagers(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.UcsManagers[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.UcsManagers {
|
||||
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)
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *UCSService) GetUcsManagerByName(name string, opts ...OptionFunc) (*UcsManager, int, error) {
|
||||
id, count, err := s.GetUcsManagerID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetUcsManagerByID(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 *UCSService) GetUcsManagerByID(id string, opts ...OptionFunc) (*UcsManager, int, error) {
|
||||
p := &ListUcsManagersParams{}
|
||||
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.ListUcsManagers(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.UcsManagers[0], l.Count, nil
|
||||
}
|
||||
return nil, l.Count, fmt.Errorf("There is more then one result for UcsManager UUID: %s!", id)
|
||||
}
|
||||
|
||||
// List ucs manager
|
||||
func (s *UCSService) ListUcsManagers(p *ListUcsManagersParams) (*ListUcsManagersResponse, error) {
|
||||
resp, err := s.cs.newRequest("listUcsManagers", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListUcsManagersResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListUcsManagersResponse struct {
|
||||
Count int `json:"count"`
|
||||
UcsManagers []*UcsManager `json:"ucsmanager"`
|
||||
}
|
||||
|
||||
type UcsManager struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
}
|
||||
|
||||
type ListUcsProfilesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) 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["ucsmanagerid"]; found {
|
||||
u.Set("ucsmanagerid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListUcsProfilesParams) SetUcsmanagerid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["ucsmanagerid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new ListUcsProfilesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *UCSService) NewListUcsProfilesParams(ucsmanagerid string) *ListUcsProfilesParams {
|
||||
p := &ListUcsProfilesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["ucsmanagerid"] = ucsmanagerid
|
||||
return p
|
||||
}
|
||||
|
||||
// List profile in ucs manager
|
||||
func (s *UCSService) ListUcsProfiles(p *ListUcsProfilesParams) (*ListUcsProfilesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listUcsProfiles", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListUcsProfilesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListUcsProfilesResponse struct {
|
||||
Count int `json:"count"`
|
||||
UcsProfiles []*UcsProfile `json:"ucsprofile"`
|
||||
}
|
||||
|
||||
type UcsProfile struct {
|
||||
Ucsdn string `json:"ucsdn"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -45,6 +45,10 @@ func (p *CreateVlanIpRangeParams) toURLValues() url.Values {
|
|||
if v, found := p.p["endipv6"]; found {
|
||||
u.Set("endipv6", v.(string))
|
||||
}
|
||||
if v, found := p.p["forsystemvms"]; found {
|
||||
vv := strconv.FormatBool(v.(bool))
|
||||
u.Set("forsystemvms", vv)
|
||||
}
|
||||
if v, found := p.p["forvirtualnetwork"]; found {
|
||||
vv := strconv.FormatBool(v.(bool))
|
||||
u.Set("forvirtualnetwork", vv)
|
||||
|
@ -120,6 +124,14 @@ func (p *CreateVlanIpRangeParams) SetEndipv6(v string) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *CreateVlanIpRangeParams) SetForsystemvms(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["forsystemvms"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *CreateVlanIpRangeParams) SetForvirtualnetwork(v bool) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
|
@ -243,32 +255,138 @@ func (s *VLANService) CreateVlanIpRange(p *CreateVlanIpRangeParams) (*CreateVlan
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateVlanIpRangeResponse struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Endip string `json:"endip,omitempty"`
|
||||
Endipv6 string `json:"endipv6,omitempty"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Startip string `json:"startip,omitempty"`
|
||||
Startipv6 string `json:"startipv6,omitempty"`
|
||||
Vlan string `json:"vlan,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Description string `json:"description"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Endip string `json:"endip"`
|
||||
Endipv6 string `json:"endipv6"`
|
||||
Forsystemvms bool `json:"forsystemvms"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork"`
|
||||
Gateway string `json:"gateway"`
|
||||
Id string `json:"id"`
|
||||
Ip6cidr string `json:"ip6cidr"`
|
||||
Ip6gateway string `json:"ip6gateway"`
|
||||
Netmask string `json:"netmask"`
|
||||
Networkid string `json:"networkid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Startip string `json:"startip"`
|
||||
Startipv6 string `json:"startipv6"`
|
||||
Vlan string `json:"vlan"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
}
|
||||
|
||||
type DedicateGuestVlanRangeParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) 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["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["projectid"]; found {
|
||||
u.Set("projectid", v.(string))
|
||||
}
|
||||
if v, found := p.p["vlanrange"]; found {
|
||||
u.Set("vlanrange", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetVlanrange(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["vlanrange"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DedicateGuestVlanRangeParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *VLANService) NewDedicateGuestVlanRangeParams(physicalnetworkid string, vlanrange string) *DedicateGuestVlanRangeParams {
|
||||
p := &DedicateGuestVlanRangeParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["physicalnetworkid"] = physicalnetworkid
|
||||
p.p["vlanrange"] = vlanrange
|
||||
return p
|
||||
}
|
||||
|
||||
// Dedicates a guest vlan range to an account
|
||||
func (s *VLANService) DedicateGuestVlanRange(p *DedicateGuestVlanRangeParams) (*DedicateGuestVlanRangeResponse, error) {
|
||||
resp, err := s.cs.newRequest("dedicateGuestVlanRange", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DedicateGuestVlanRangeResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DedicateGuestVlanRangeResponse struct {
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Guestvlanrange string `json:"guestvlanrange"`
|
||||
Id string `json:"id"`
|
||||
Physicalnetworkid int64 `json:"physicalnetworkid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Zoneid int64 `json:"zoneid"`
|
||||
}
|
||||
|
||||
type DeleteVlanIpRangeParams struct {
|
||||
|
@ -314,12 +432,229 @@ func (s *VLANService) DeleteVlanIpRange(p *DeleteVlanIpRangeParams) (*DeleteVlan
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteVlanIpRangeResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
func (r *DeleteVlanIpRangeResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
type alias DeleteVlanIpRangeResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListDedicatedGuestVlanRangesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) 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["guestvlanrange"]; found {
|
||||
u.Set("guestvlanrange", 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["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["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["projectid"]; found {
|
||||
u.Set("projectid", v.(string))
|
||||
}
|
||||
if v, found := p.p["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetGuestvlanrange(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["guestvlanrange"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) 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 ListDedicatedGuestVlanRangesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *VLANService) NewListDedicatedGuestVlanRangesParams() *ListDedicatedGuestVlanRangesParams {
|
||||
p := &ListDedicatedGuestVlanRangesParams{}
|
||||
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 *VLANService) GetDedicatedGuestVlanRangeByID(id string, opts ...OptionFunc) (*DedicatedGuestVlanRange, int, error) {
|
||||
p := &ListDedicatedGuestVlanRangesParams{}
|
||||
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.ListDedicatedGuestVlanRanges(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.DedicatedGuestVlanRanges[0], l.Count, nil
|
||||
}
|
||||
return nil, l.Count, fmt.Errorf("There is more then one result for DedicatedGuestVlanRange UUID: %s!", id)
|
||||
}
|
||||
|
||||
// Lists dedicated guest vlan ranges
|
||||
func (s *VLANService) ListDedicatedGuestVlanRanges(p *ListDedicatedGuestVlanRangesParams) (*ListDedicatedGuestVlanRangesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listDedicatedGuestVlanRanges", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListDedicatedGuestVlanRangesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListDedicatedGuestVlanRangesResponse struct {
|
||||
Count int `json:"count"`
|
||||
DedicatedGuestVlanRanges []*DedicatedGuestVlanRange `json:"dedicatedguestvlanrange"`
|
||||
}
|
||||
|
||||
type DedicatedGuestVlanRange struct {
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Guestvlanrange string `json:"guestvlanrange"`
|
||||
Id string `json:"id"`
|
||||
Physicalnetworkid int64 `json:"physicalnetworkid"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Zoneid int64 `json:"zoneid"`
|
||||
}
|
||||
|
||||
type ListVlanIpRangesParams struct {
|
||||
|
@ -495,7 +830,7 @@ func (s *VLANService) GetVlanIpRangeByID(id string, opts ...OptionFunc) (*VlanIp
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -532,6 +867,7 @@ func (s *VLANService) ListVlanIpRanges(p *ListVlanIpRangesParams) (*ListVlanIpRa
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -541,133 +877,29 @@ type ListVlanIpRangesResponse struct {
|
|||
}
|
||||
|
||||
type VlanIpRange struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Endip string `json:"endip,omitempty"`
|
||||
Endipv6 string `json:"endipv6,omitempty"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Ip6cidr string `json:"ip6cidr,omitempty"`
|
||||
Ip6gateway string `json:"ip6gateway,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
Networkid string `json:"networkid,omitempty"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid,omitempty"`
|
||||
Podid string `json:"podid,omitempty"`
|
||||
Podname string `json:"podname,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Startip string `json:"startip,omitempty"`
|
||||
Startipv6 string `json:"startipv6,omitempty"`
|
||||
Vlan string `json:"vlan,omitempty"`
|
||||
Zoneid string `json:"zoneid,omitempty"`
|
||||
}
|
||||
|
||||
type DedicateGuestVlanRangeParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) 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["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["projectid"]; found {
|
||||
u.Set("projectid", v.(string))
|
||||
}
|
||||
if v, found := p.p["vlanrange"]; found {
|
||||
u.Set("vlanrange", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DedicateGuestVlanRangeParams) SetVlanrange(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["vlanrange"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new DedicateGuestVlanRangeParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *VLANService) NewDedicateGuestVlanRangeParams(account string, domainid string, physicalnetworkid string, vlanrange string) *DedicateGuestVlanRangeParams {
|
||||
p := &DedicateGuestVlanRangeParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["account"] = account
|
||||
p.p["domainid"] = domainid
|
||||
p.p["physicalnetworkid"] = physicalnetworkid
|
||||
p.p["vlanrange"] = vlanrange
|
||||
return p
|
||||
}
|
||||
|
||||
// Dedicates a guest vlan range to an account
|
||||
func (s *VLANService) DedicateGuestVlanRange(p *DedicateGuestVlanRangeParams) (*DedicateGuestVlanRangeResponse, error) {
|
||||
resp, err := s.cs.newRequest("dedicateGuestVlanRange", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r DedicateGuestVlanRangeResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DedicateGuestVlanRangeResponse struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Guestvlanrange string `json:"guestvlanrange,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Physicalnetworkid int64 `json:"physicalnetworkid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Zoneid int64 `json:"zoneid,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Description string `json:"description"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Endip string `json:"endip"`
|
||||
Endipv6 string `json:"endipv6"`
|
||||
Forsystemvms bool `json:"forsystemvms"`
|
||||
Forvirtualnetwork bool `json:"forvirtualnetwork"`
|
||||
Gateway string `json:"gateway"`
|
||||
Id string `json:"id"`
|
||||
Ip6cidr string `json:"ip6cidr"`
|
||||
Ip6gateway string `json:"ip6gateway"`
|
||||
Netmask string `json:"netmask"`
|
||||
Networkid string `json:"networkid"`
|
||||
Physicalnetworkid string `json:"physicalnetworkid"`
|
||||
Podid string `json:"podid"`
|
||||
Podname string `json:"podname"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
Startip string `json:"startip"`
|
||||
Startipv6 string `json:"startipv6"`
|
||||
Vlan string `json:"vlan"`
|
||||
Zoneid string `json:"zoneid"`
|
||||
}
|
||||
|
||||
type ReleaseDedicatedGuestVlanRangeParams struct {
|
||||
|
@ -728,207 +960,12 @@ func (s *VLANService) ReleaseDedicatedGuestVlanRange(p *ReleaseDedicatedGuestVla
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ReleaseDedicatedGuestVlanRangeResponse struct {
|
||||
JobID string `json:"jobid,omitempty"`
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success bool `json:"success,omitempty"`
|
||||
}
|
||||
|
||||
type ListDedicatedGuestVlanRangesParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) 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["guestvlanrange"]; found {
|
||||
u.Set("guestvlanrange", 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["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["physicalnetworkid"]; found {
|
||||
u.Set("physicalnetworkid", v.(string))
|
||||
}
|
||||
if v, found := p.p["projectid"]; found {
|
||||
u.Set("projectid", v.(string))
|
||||
}
|
||||
if v, found := p.p["zoneid"]; found {
|
||||
u.Set("zoneid", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetAccount(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["account"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetDomainid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["domainid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetGuestvlanrange(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["guestvlanrange"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetKeyword(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["keyword"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetPage(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["page"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetPagesize(v int) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["pagesize"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetPhysicalnetworkid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["physicalnetworkid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) SetProjectid(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["projectid"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ListDedicatedGuestVlanRangesParams) 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 ListDedicatedGuestVlanRangesParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *VLANService) NewListDedicatedGuestVlanRangesParams() *ListDedicatedGuestVlanRangesParams {
|
||||
p := &ListDedicatedGuestVlanRangesParams{}
|
||||
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 *VLANService) GetDedicatedGuestVlanRangeByID(id string, opts ...OptionFunc) (*DedicatedGuestVlanRange, int, error) {
|
||||
p := &ListDedicatedGuestVlanRangesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListDedicatedGuestVlanRanges(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.DedicatedGuestVlanRanges[0], l.Count, nil
|
||||
}
|
||||
return nil, l.Count, fmt.Errorf("There is more then one result for DedicatedGuestVlanRange UUID: %s!", id)
|
||||
}
|
||||
|
||||
// Lists dedicated guest vlan ranges
|
||||
func (s *VLANService) ListDedicatedGuestVlanRanges(p *ListDedicatedGuestVlanRangesParams) (*ListDedicatedGuestVlanRangesResponse, error) {
|
||||
resp, err := s.cs.newRequest("listDedicatedGuestVlanRanges", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r ListDedicatedGuestVlanRangesResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type ListDedicatedGuestVlanRangesResponse struct {
|
||||
Count int `json:"count"`
|
||||
DedicatedGuestVlanRanges []*DedicatedGuestVlanRange `json:"dedicatedguestvlanrange"`
|
||||
}
|
||||
|
||||
type DedicatedGuestVlanRange struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Guestvlanrange string `json:"guestvlanrange,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Physicalnetworkid int64 `json:"physicalnetworkid,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Zoneid int64 `json:"zoneid,omitempty"`
|
||||
JobID string `json:"jobid"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -100,18 +100,19 @@ func (s *VMGroupService) CreateInstanceGroup(p *CreateInstanceGroupParams) (*Cre
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type CreateInstanceGroupResponse struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Created string `json:"created"`
|
||||
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 DeleteInstanceGroupParams struct {
|
||||
|
@ -157,80 +158,32 @@ func (s *VMGroupService) DeleteInstanceGroup(p *DeleteInstanceGroupParams) (*Del
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type DeleteInstanceGroupResponse struct {
|
||||
Displaytext string `json:"displaytext,omitempty"`
|
||||
Success string `json:"success,omitempty"`
|
||||
Displaytext string `json:"displaytext"`
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type UpdateInstanceGroupParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateInstanceGroupParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
u.Set("id", v.(string))
|
||||
}
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateInstanceGroupParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateInstanceGroupParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateInstanceGroupParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *VMGroupService) NewUpdateInstanceGroupParams(id string) *UpdateInstanceGroupParams {
|
||||
p := &UpdateInstanceGroupParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a vm group
|
||||
func (s *VMGroupService) UpdateInstanceGroup(p *UpdateInstanceGroupParams) (*UpdateInstanceGroupResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateInstanceGroup", p.toURLValues())
|
||||
func (r *DeleteInstanceGroupResponse) UnmarshalJSON(b []byte) error {
|
||||
var m map[string]interface{}
|
||||
err := json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
var r UpdateInstanceGroupResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
if success, ok := m["success"].(string); ok {
|
||||
m["success"] = success == "true"
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateInstanceGroupResponse struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
type alias DeleteInstanceGroupResponse
|
||||
return json.Unmarshal(b, (*alias)(r))
|
||||
}
|
||||
|
||||
type ListInstanceGroupsParams struct {
|
||||
|
@ -374,7 +327,7 @@ func (s *VMGroupService) GetInstanceGroupID(name string, opts ...OptionFunc) (st
|
|||
|
||||
p.p["name"] = name
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
|
@ -424,7 +377,7 @@ func (s *VMGroupService) GetInstanceGroupByID(id string, opts ...OptionFunc) (*I
|
|||
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
for _, fn := range append(s.cs.options, opts...) {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -461,6 +414,7 @@ func (s *VMGroupService) ListInstanceGroups(p *ListInstanceGroupsParams) (*ListI
|
|||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
|
@ -470,12 +424,81 @@ type ListInstanceGroupsResponse struct {
|
|||
}
|
||||
|
||||
type InstanceGroup struct {
|
||||
Account string `json:"account,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
Domainid string `json:"domainid,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Project string `json:"project,omitempty"`
|
||||
Projectid string `json:"projectid,omitempty"`
|
||||
Account string `json:"account"`
|
||||
Created string `json:"created"`
|
||||
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 UpdateInstanceGroupParams struct {
|
||||
p map[string]interface{}
|
||||
}
|
||||
|
||||
func (p *UpdateInstanceGroupParams) toURLValues() url.Values {
|
||||
u := url.Values{}
|
||||
if p.p == nil {
|
||||
return u
|
||||
}
|
||||
if v, found := p.p["id"]; found {
|
||||
u.Set("id", v.(string))
|
||||
}
|
||||
if v, found := p.p["name"]; found {
|
||||
u.Set("name", v.(string))
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func (p *UpdateInstanceGroupParams) SetId(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["id"] = v
|
||||
return
|
||||
}
|
||||
|
||||
func (p *UpdateInstanceGroupParams) SetName(v string) {
|
||||
if p.p == nil {
|
||||
p.p = make(map[string]interface{})
|
||||
}
|
||||
p.p["name"] = v
|
||||
return
|
||||
}
|
||||
|
||||
// You should always use this function to get a new UpdateInstanceGroupParams instance,
|
||||
// as then you are sure you have configured all required params
|
||||
func (s *VMGroupService) NewUpdateInstanceGroupParams(id string) *UpdateInstanceGroupParams {
|
||||
p := &UpdateInstanceGroupParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
p.p["id"] = id
|
||||
return p
|
||||
}
|
||||
|
||||
// Updates a vm group
|
||||
func (s *VMGroupService) UpdateInstanceGroup(p *UpdateInstanceGroupParams) (*UpdateInstanceGroupResponse, error) {
|
||||
resp, err := s.cs.newRequest("updateInstanceGroup", p.toURLValues())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r UpdateInstanceGroupResponse
|
||||
if err := json.Unmarshal(resp, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
type UpdateInstanceGroupResponse struct {
|
||||
Account string `json:"account"`
|
||||
Created string `json:"created"`
|
||||
Domain string `json:"domain"`
|
||||
Domainid string `json:"domainid"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Project string `json:"project"`
|
||||
Projectid string `json:"projectid"`
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2016, 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.
|
||||
|
@ -26,7 +26,9 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/cookiejar"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"sort"
|
||||
|
@ -65,80 +67,98 @@ type CloudStackClient struct {
|
|||
apiKey string // Api key
|
||||
secret string // Secret key
|
||||
async bool // Wait for async calls to finish
|
||||
options []OptionFunc // A list of option functions to apply to all API calls
|
||||
timeout int64 // Max waiting timeout in seconds for async jobs to finish; defaults to 300 seconds
|
||||
|
||||
APIDiscovery *APIDiscoveryService
|
||||
Account *AccountService
|
||||
Address *AddressService
|
||||
AffinityGroup *AffinityGroupService
|
||||
Alert *AlertService
|
||||
Asyncjob *AsyncjobService
|
||||
Authentication *AuthenticationService
|
||||
AutoScale *AutoScaleService
|
||||
Baremetal *BaremetalService
|
||||
Certificate *CertificateService
|
||||
CloudIdentifier *CloudIdentifierService
|
||||
Cluster *ClusterService
|
||||
Configuration *ConfigurationService
|
||||
DiskOffering *DiskOfferingService
|
||||
Domain *DomainService
|
||||
Event *EventService
|
||||
Firewall *FirewallService
|
||||
GuestOS *GuestOSService
|
||||
Host *HostService
|
||||
Hypervisor *HypervisorService
|
||||
ISO *ISOService
|
||||
ImageStore *ImageStoreService
|
||||
InternalLB *InternalLBService
|
||||
LDAP *LDAPService
|
||||
Limit *LimitService
|
||||
LoadBalancer *LoadBalancerService
|
||||
NAT *NATService
|
||||
NetworkACL *NetworkACLService
|
||||
NetworkDevice *NetworkDeviceService
|
||||
NetworkOffering *NetworkOfferingService
|
||||
Network *NetworkService
|
||||
Nic *NicService
|
||||
NiciraNVP *NiciraNVPService
|
||||
OvsElement *OvsElementService
|
||||
Pod *PodService
|
||||
Pool *PoolService
|
||||
PortableIP *PortableIPService
|
||||
Project *ProjectService
|
||||
Quota *QuotaService
|
||||
Region *RegionService
|
||||
Resourcemetadata *ResourcemetadataService
|
||||
Resourcetags *ResourcetagsService
|
||||
Router *RouterService
|
||||
SSH *SSHService
|
||||
SecurityGroup *SecurityGroupService
|
||||
ServiceOffering *ServiceOfferingService
|
||||
Snapshot *SnapshotService
|
||||
StoragePool *StoragePoolService
|
||||
StratosphereSSP *StratosphereSSPService
|
||||
Swift *SwiftService
|
||||
SystemCapacity *SystemCapacityService
|
||||
SystemVM *SystemVMService
|
||||
Template *TemplateService
|
||||
UCS *UCSService
|
||||
Usage *UsageService
|
||||
User *UserService
|
||||
VLAN *VLANService
|
||||
VMGroup *VMGroupService
|
||||
VPC *VPCService
|
||||
VPN *VPNService
|
||||
VirtualMachine *VirtualMachineService
|
||||
Volume *VolumeService
|
||||
Zone *ZoneService
|
||||
APIDiscovery *APIDiscoveryService
|
||||
Account *AccountService
|
||||
Address *AddressService
|
||||
AffinityGroup *AffinityGroupService
|
||||
Alert *AlertService
|
||||
Asyncjob *AsyncjobService
|
||||
Authentication *AuthenticationService
|
||||
AutoScale *AutoScaleService
|
||||
Baremetal *BaremetalService
|
||||
BigSwitchBCF *BigSwitchBCFService
|
||||
BrocadeVCS *BrocadeVCSService
|
||||
Certificate *CertificateService
|
||||
CloudIdentifier *CloudIdentifierService
|
||||
Cluster *ClusterService
|
||||
Configuration *ConfigurationService
|
||||
Custom *CustomService
|
||||
DiskOffering *DiskOfferingService
|
||||
Domain *DomainService
|
||||
Event *EventService
|
||||
Firewall *FirewallService
|
||||
GuestOS *GuestOSService
|
||||
Host *HostService
|
||||
Hypervisor *HypervisorService
|
||||
ISO *ISOService
|
||||
ImageStore *ImageStoreService
|
||||
InternalLB *InternalLBService
|
||||
LDAP *LDAPService
|
||||
Limit *LimitService
|
||||
LoadBalancer *LoadBalancerService
|
||||
NAT *NATService
|
||||
NetworkACL *NetworkACLService
|
||||
NetworkDevice *NetworkDeviceService
|
||||
NetworkOffering *NetworkOfferingService
|
||||
Network *NetworkService
|
||||
Nic *NicService
|
||||
NiciraNVP *NiciraNVPService
|
||||
NuageVSP *NuageVSPService
|
||||
OutofbandManagement *OutofbandManagementService
|
||||
OvsElement *OvsElementService
|
||||
Pod *PodService
|
||||
Pool *PoolService
|
||||
PortableIP *PortableIPService
|
||||
Project *ProjectService
|
||||
Quota *QuotaService
|
||||
Region *RegionService
|
||||
Resourcemetadata *ResourcemetadataService
|
||||
Resourcetags *ResourcetagsService
|
||||
Role *RoleService
|
||||
Router *RouterService
|
||||
SSH *SSHService
|
||||
SecurityGroup *SecurityGroupService
|
||||
ServiceOffering *ServiceOfferingService
|
||||
Snapshot *SnapshotService
|
||||
StoragePool *StoragePoolService
|
||||
StratosphereSSP *StratosphereSSPService
|
||||
Swift *SwiftService
|
||||
SystemCapacity *SystemCapacityService
|
||||
SystemVM *SystemVMService
|
||||
Template *TemplateService
|
||||
UCS *UCSService
|
||||
Usage *UsageService
|
||||
User *UserService
|
||||
VLAN *VLANService
|
||||
VMGroup *VMGroupService
|
||||
VPC *VPCService
|
||||
VPN *VPNService
|
||||
VirtualMachine *VirtualMachineService
|
||||
Volume *VolumeService
|
||||
Zone *ZoneService
|
||||
}
|
||||
|
||||
// Creates a new client for communicating with CloudStack
|
||||
func newClient(apiurl string, apikey string, secret string, async bool, verifyssl bool) *CloudStackClient {
|
||||
jar, _ := cookiejar.New(nil)
|
||||
cs := &CloudStackClient{
|
||||
client: &http.Client{
|
||||
Jar: jar,
|
||||
Transport: &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: !verifyssl}, // If verifyssl is true, skipping the verify should be false and vice versa
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
DualStack: true,
|
||||
}).DialContext,
|
||||
MaxIdleConns: 100,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: !verifyssl}, // If verifyssl is true, skipping the verify should be false and vice versa
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
},
|
||||
Timeout: time.Duration(60 * time.Second),
|
||||
},
|
||||
|
@ -146,6 +166,7 @@ func newClient(apiurl string, apikey string, secret string, async bool, verifyss
|
|||
apiKey: apikey,
|
||||
secret: secret,
|
||||
async: async,
|
||||
options: []OptionFunc{},
|
||||
timeout: 300,
|
||||
}
|
||||
cs.APIDiscovery = NewAPIDiscoveryService(cs)
|
||||
|
@ -157,10 +178,13 @@ func newClient(apiurl string, apikey string, secret string, async bool, verifyss
|
|||
cs.Authentication = NewAuthenticationService(cs)
|
||||
cs.AutoScale = NewAutoScaleService(cs)
|
||||
cs.Baremetal = NewBaremetalService(cs)
|
||||
cs.BigSwitchBCF = NewBigSwitchBCFService(cs)
|
||||
cs.BrocadeVCS = NewBrocadeVCSService(cs)
|
||||
cs.Certificate = NewCertificateService(cs)
|
||||
cs.CloudIdentifier = NewCloudIdentifierService(cs)
|
||||
cs.Cluster = NewClusterService(cs)
|
||||
cs.Configuration = NewConfigurationService(cs)
|
||||
cs.Custom = NewCustomService(cs)
|
||||
cs.DiskOffering = NewDiskOfferingService(cs)
|
||||
cs.Domain = NewDomainService(cs)
|
||||
cs.Event = NewEventService(cs)
|
||||
|
@ -181,6 +205,8 @@ func newClient(apiurl string, apikey string, secret string, async bool, verifyss
|
|||
cs.Network = NewNetworkService(cs)
|
||||
cs.Nic = NewNicService(cs)
|
||||
cs.NiciraNVP = NewNiciraNVPService(cs)
|
||||
cs.NuageVSP = NewNuageVSPService(cs)
|
||||
cs.OutofbandManagement = NewOutofbandManagementService(cs)
|
||||
cs.OvsElement = NewOvsElementService(cs)
|
||||
cs.Pod = NewPodService(cs)
|
||||
cs.Pool = NewPoolService(cs)
|
||||
|
@ -190,6 +216,7 @@ func newClient(apiurl string, apikey string, secret string, async bool, verifyss
|
|||
cs.Region = NewRegionService(cs)
|
||||
cs.Resourcemetadata = NewResourcemetadataService(cs)
|
||||
cs.Resourcetags = NewResourcetagsService(cs)
|
||||
cs.Role = NewRoleService(cs)
|
||||
cs.Router = NewRouterService(cs)
|
||||
cs.SSH = NewSSHService(cs)
|
||||
cs.SecurityGroup = NewSecurityGroupService(cs)
|
||||
|
@ -237,6 +264,15 @@ func (cs *CloudStackClient) AsyncTimeout(timeoutInSeconds int64) {
|
|||
cs.timeout = timeoutInSeconds
|
||||
}
|
||||
|
||||
// Set any default options that would be added to all API calls that support it.
|
||||
func (cs *CloudStackClient) DefaultOptions(options ...OptionFunc) {
|
||||
if options != nil {
|
||||
cs.options = options
|
||||
} else {
|
||||
cs.options = []OptionFunc{}
|
||||
}
|
||||
}
|
||||
|
||||
var AsyncTimeoutErr = errors.New("Timeout while waiting for async job to finish")
|
||||
|
||||
// A helper function that you can use to get the result of a running async job. If the job is not finished within the configured
|
||||
|
@ -303,7 +339,7 @@ func (cs *CloudStackClient) newRequest(api string, params url.Values) (json.RawM
|
|||
|
||||
var err error
|
||||
var resp *http.Response
|
||||
if !cs.HTTPGETOnly && (api == "deployVirtualMachine" || api == "updateVirtualMachine") {
|
||||
if !cs.HTTPGETOnly && (api == "deployVirtualMachine" || api == "login" || api == "updateVirtualMachine") {
|
||||
// The deployVirtualMachine API should be called using a POST call
|
||||
// so we don't have to worry about the userdata size
|
||||
|
||||
|
@ -503,6 +539,22 @@ func NewBaremetalService(cs *CloudStackClient) *BaremetalService {
|
|||
return &BaremetalService{cs: cs}
|
||||
}
|
||||
|
||||
type BigSwitchBCFService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
||||
func NewBigSwitchBCFService(cs *CloudStackClient) *BigSwitchBCFService {
|
||||
return &BigSwitchBCFService{cs: cs}
|
||||
}
|
||||
|
||||
type BrocadeVCSService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
||||
func NewBrocadeVCSService(cs *CloudStackClient) *BrocadeVCSService {
|
||||
return &BrocadeVCSService{cs: cs}
|
||||
}
|
||||
|
||||
type CertificateService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
@ -535,6 +587,14 @@ func NewConfigurationService(cs *CloudStackClient) *ConfigurationService {
|
|||
return &ConfigurationService{cs: cs}
|
||||
}
|
||||
|
||||
type CustomService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
||||
func NewCustomService(cs *CloudStackClient) *CustomService {
|
||||
return &CustomService{cs: cs}
|
||||
}
|
||||
|
||||
type DiskOfferingService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
@ -695,6 +755,22 @@ func NewNiciraNVPService(cs *CloudStackClient) *NiciraNVPService {
|
|||
return &NiciraNVPService{cs: cs}
|
||||
}
|
||||
|
||||
type NuageVSPService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
||||
func NewNuageVSPService(cs *CloudStackClient) *NuageVSPService {
|
||||
return &NuageVSPService{cs: cs}
|
||||
}
|
||||
|
||||
type OutofbandManagementService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
||||
func NewOutofbandManagementService(cs *CloudStackClient) *OutofbandManagementService {
|
||||
return &OutofbandManagementService{cs: cs}
|
||||
}
|
||||
|
||||
type OvsElementService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
@ -767,6 +843,14 @@ func NewResourcetagsService(cs *CloudStackClient) *ResourcetagsService {
|
|||
return &ResourcetagsService{cs: cs}
|
||||
}
|
||||
|
||||
type RoleService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
||||
func NewRoleService(cs *CloudStackClient) *RoleService {
|
||||
return &RoleService{cs: cs}
|
||||
}
|
||||
|
||||
type RouterService struct {
|
||||
cs *CloudStackClient
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue