123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937 |
- package cloudstack
- import (
- "bytes"
- "crypto/hmac"
- "crypto/sha1"
- "crypto/tls"
- "encoding/base64"
- "encoding/json"
- "errors"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/url"
- "regexp"
- "sort"
- "strings"
- "time"
- )
- const UnlimitedResourceID = "-1"
- var idRegex = regexp.MustCompile(`^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-1)$`)
- func IsID(id string) bool {
- return idRegex.MatchString(id)
- }
- type OptionFunc func(*CloudStackClient, interface{}) error
- type CSError struct {
- ErrorCode int `json:"errorcode"`
- CSErrorCode int `json:"cserrorcode"`
- ErrorText string `json:"errortext"`
- }
- func (e *CSError) Error() error {
- return fmt.Errorf("CloudStack API error %d (CSExceptionErrorCode: %d): %s", e.ErrorCode, e.CSErrorCode, e.ErrorText)
- }
- type CloudStackClient struct {
- HTTPGETOnly bool
- client *http.Client
- baseURL string
- apiKey string
- secret string
- async bool
- timeout int64
- 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
- }
- func newClient(apiurl string, apikey string, secret string, async bool, verifyssl bool) *CloudStackClient {
- cs := &CloudStackClient{
- client: &http.Client{
- Transport: &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- TLSClientConfig: &tls.Config{InsecureSkipVerify: !verifyssl},
- },
- Timeout: time.Duration(60 * time.Second),
- },
- baseURL: apiurl,
- apiKey: apikey,
- secret: secret,
- async: async,
- timeout: 300,
- }
- cs.APIDiscovery = NewAPIDiscoveryService(cs)
- cs.Account = NewAccountService(cs)
- cs.Address = NewAddressService(cs)
- cs.AffinityGroup = NewAffinityGroupService(cs)
- cs.Alert = NewAlertService(cs)
- cs.Asyncjob = NewAsyncjobService(cs)
- cs.Authentication = NewAuthenticationService(cs)
- cs.AutoScale = NewAutoScaleService(cs)
- cs.Baremetal = NewBaremetalService(cs)
- cs.Certificate = NewCertificateService(cs)
- cs.CloudIdentifier = NewCloudIdentifierService(cs)
- cs.Cluster = NewClusterService(cs)
- cs.Configuration = NewConfigurationService(cs)
- cs.DiskOffering = NewDiskOfferingService(cs)
- cs.Domain = NewDomainService(cs)
- cs.Event = NewEventService(cs)
- cs.Firewall = NewFirewallService(cs)
- cs.GuestOS = NewGuestOSService(cs)
- cs.Host = NewHostService(cs)
- cs.Hypervisor = NewHypervisorService(cs)
- cs.ISO = NewISOService(cs)
- cs.ImageStore = NewImageStoreService(cs)
- cs.InternalLB = NewInternalLBService(cs)
- cs.LDAP = NewLDAPService(cs)
- cs.Limit = NewLimitService(cs)
- cs.LoadBalancer = NewLoadBalancerService(cs)
- cs.NAT = NewNATService(cs)
- cs.NetworkACL = NewNetworkACLService(cs)
- cs.NetworkDevice = NewNetworkDeviceService(cs)
- cs.NetworkOffering = NewNetworkOfferingService(cs)
- cs.Network = NewNetworkService(cs)
- cs.Nic = NewNicService(cs)
- cs.NiciraNVP = NewNiciraNVPService(cs)
- cs.OvsElement = NewOvsElementService(cs)
- cs.Pod = NewPodService(cs)
- cs.Pool = NewPoolService(cs)
- cs.PortableIP = NewPortableIPService(cs)
- cs.Project = NewProjectService(cs)
- cs.Quota = NewQuotaService(cs)
- cs.Region = NewRegionService(cs)
- cs.Resourcemetadata = NewResourcemetadataService(cs)
- cs.Resourcetags = NewResourcetagsService(cs)
- cs.Router = NewRouterService(cs)
- cs.SSH = NewSSHService(cs)
- cs.SecurityGroup = NewSecurityGroupService(cs)
- cs.ServiceOffering = NewServiceOfferingService(cs)
- cs.Snapshot = NewSnapshotService(cs)
- cs.StoragePool = NewStoragePoolService(cs)
- cs.StratosphereSSP = NewStratosphereSSPService(cs)
- cs.Swift = NewSwiftService(cs)
- cs.SystemCapacity = NewSystemCapacityService(cs)
- cs.SystemVM = NewSystemVMService(cs)
- cs.Template = NewTemplateService(cs)
- cs.UCS = NewUCSService(cs)
- cs.Usage = NewUsageService(cs)
- cs.User = NewUserService(cs)
- cs.VLAN = NewVLANService(cs)
- cs.VMGroup = NewVMGroupService(cs)
- cs.VPC = NewVPCService(cs)
- cs.VPN = NewVPNService(cs)
- cs.VirtualMachine = NewVirtualMachineService(cs)
- cs.Volume = NewVolumeService(cs)
- cs.Zone = NewZoneService(cs)
- return cs
- }
- func NewClient(apiurl string, apikey string, secret string, verifyssl bool) *CloudStackClient {
- cs := newClient(apiurl, apikey, secret, false, verifyssl)
- return cs
- }
- func NewAsyncClient(apiurl string, apikey string, secret string, verifyssl bool) *CloudStackClient {
- cs := newClient(apiurl, apikey, secret, true, verifyssl)
- return cs
- }
- func (cs *CloudStackClient) AsyncTimeout(timeoutInSeconds int64) {
- cs.timeout = timeoutInSeconds
- }
- var AsyncTimeoutErr = errors.New("Timeout while waiting for async job to finish")
- func (cs *CloudStackClient) GetAsyncJobResult(jobid string, timeout int64) (json.RawMessage, error) {
- var timer time.Duration
- currentTime := time.Now().Unix()
- for {
- p := cs.Asyncjob.NewQueryAsyncJobResultParams(jobid)
- r, err := cs.Asyncjob.QueryAsyncJobResult(p)
- if err != nil {
- return nil, err
- }
-
- if r.Jobstatus == 1 {
- return r.Jobresult, nil
- }
-
- if r.Jobstatus == 2 {
- if r.Jobresulttype == "text" {
- return nil, fmt.Errorf(string(r.Jobresult))
- } else {
- return nil, fmt.Errorf("Undefined error: %s", string(r.Jobresult))
- }
- }
- if time.Now().Unix()-currentTime > timeout {
- return nil, AsyncTimeoutErr
- }
-
-
- if timer < 15 {
- timer++
- }
- time.Sleep(timer * time.Second)
- }
- }
- func (cs *CloudStackClient) newRequest(api string, params url.Values) (json.RawMessage, error) {
- params.Set("apiKey", cs.apiKey)
- params.Set("command", api)
- params.Set("response", "json")
-
-
-
-
-
-
- s := encodeValues(params)
- s2 := strings.ToLower(s)
- s3 := strings.Replace(s2, "+", "%20", -1)
- mac := hmac.New(sha1.New, []byte(cs.secret))
- mac.Write([]byte(s3))
- signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))
- var err error
- var resp *http.Response
- if !cs.HTTPGETOnly && (api == "deployVirtualMachine" || api == "updateVirtualMachine") {
-
-
-
- params.Set("signature", signature)
-
- resp, err = cs.client.PostForm(cs.baseURL, params)
- } else {
-
- url := cs.baseURL + "?" + s + "&signature=" + url.QueryEscape(signature)
-
- resp, err = cs.client.Get(url)
- }
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
- b, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return nil, err
- }
-
- b, err = getRawValue(b)
- if err != nil {
- return nil, err
- }
- if resp.StatusCode != 200 {
- var e CSError
- if err := json.Unmarshal(b, &e); err != nil {
- return nil, err
- }
- return nil, e.Error()
- }
- return b, nil
- }
- func encodeValues(v url.Values) string {
- if v == nil {
- return ""
- }
- var buf bytes.Buffer
- keys := make([]string, 0, len(v))
- for k := range v {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- for _, k := range keys {
- vs := v[k]
- prefix := k + "="
- for _, v := range vs {
- if buf.Len() > 0 {
- buf.WriteByte('&')
- }
- buf.WriteString(prefix)
- buf.WriteString(url.QueryEscape(v))
- }
- }
- return buf.String()
- }
- func getRawValue(b json.RawMessage) (json.RawMessage, error) {
- var m map[string]json.RawMessage
- if err := json.Unmarshal(b, &m); err != nil {
- return nil, err
- }
- for _, v := range m {
- return v, nil
- }
- return nil, fmt.Errorf("Unable to extract the raw value from:\n\n%s\n\n", string(b))
- }
- type ProjectIDSetter interface {
- SetProjectid(string)
- }
- func WithProject(project string) OptionFunc {
- return func(cs *CloudStackClient, p interface{}) error {
- ps, ok := p.(ProjectIDSetter)
- if !ok || project == "" {
- return nil
- }
- if !IsID(project) {
- id, _, err := cs.Project.GetProjectID(project)
- if err != nil {
- return err
- }
- project = id
- }
- ps.SetProjectid(project)
- return nil
- }
- }
- type VPCIDSetter interface {
- SetVpcid(string)
- }
- func WithVPCID(id string) OptionFunc {
- return func(cs *CloudStackClient, p interface{}) error {
- vs, ok := p.(VPCIDSetter)
- if !ok || id == "" {
- return nil
- }
- vs.SetVpcid(id)
- return nil
- }
- }
- type APIDiscoveryService struct {
- cs *CloudStackClient
- }
- func NewAPIDiscoveryService(cs *CloudStackClient) *APIDiscoveryService {
- return &APIDiscoveryService{cs: cs}
- }
- type AccountService struct {
- cs *CloudStackClient
- }
- func NewAccountService(cs *CloudStackClient) *AccountService {
- return &AccountService{cs: cs}
- }
- type AddressService struct {
- cs *CloudStackClient
- }
- func NewAddressService(cs *CloudStackClient) *AddressService {
- return &AddressService{cs: cs}
- }
- type AffinityGroupService struct {
- cs *CloudStackClient
- }
- func NewAffinityGroupService(cs *CloudStackClient) *AffinityGroupService {
- return &AffinityGroupService{cs: cs}
- }
- type AlertService struct {
- cs *CloudStackClient
- }
- func NewAlertService(cs *CloudStackClient) *AlertService {
- return &AlertService{cs: cs}
- }
- type AsyncjobService struct {
- cs *CloudStackClient
- }
- func NewAsyncjobService(cs *CloudStackClient) *AsyncjobService {
- return &AsyncjobService{cs: cs}
- }
- type AuthenticationService struct {
- cs *CloudStackClient
- }
- func NewAuthenticationService(cs *CloudStackClient) *AuthenticationService {
- return &AuthenticationService{cs: cs}
- }
- type AutoScaleService struct {
- cs *CloudStackClient
- }
- func NewAutoScaleService(cs *CloudStackClient) *AutoScaleService {
- return &AutoScaleService{cs: cs}
- }
- type BaremetalService struct {
- cs *CloudStackClient
- }
- func NewBaremetalService(cs *CloudStackClient) *BaremetalService {
- return &BaremetalService{cs: cs}
- }
- type CertificateService struct {
- cs *CloudStackClient
- }
- func NewCertificateService(cs *CloudStackClient) *CertificateService {
- return &CertificateService{cs: cs}
- }
- type CloudIdentifierService struct {
- cs *CloudStackClient
- }
- func NewCloudIdentifierService(cs *CloudStackClient) *CloudIdentifierService {
- return &CloudIdentifierService{cs: cs}
- }
- type ClusterService struct {
- cs *CloudStackClient
- }
- func NewClusterService(cs *CloudStackClient) *ClusterService {
- return &ClusterService{cs: cs}
- }
- type ConfigurationService struct {
- cs *CloudStackClient
- }
- func NewConfigurationService(cs *CloudStackClient) *ConfigurationService {
- return &ConfigurationService{cs: cs}
- }
- type DiskOfferingService struct {
- cs *CloudStackClient
- }
- func NewDiskOfferingService(cs *CloudStackClient) *DiskOfferingService {
- return &DiskOfferingService{cs: cs}
- }
- type DomainService struct {
- cs *CloudStackClient
- }
- func NewDomainService(cs *CloudStackClient) *DomainService {
- return &DomainService{cs: cs}
- }
- type EventService struct {
- cs *CloudStackClient
- }
- func NewEventService(cs *CloudStackClient) *EventService {
- return &EventService{cs: cs}
- }
- type FirewallService struct {
- cs *CloudStackClient
- }
- func NewFirewallService(cs *CloudStackClient) *FirewallService {
- return &FirewallService{cs: cs}
- }
- type GuestOSService struct {
- cs *CloudStackClient
- }
- func NewGuestOSService(cs *CloudStackClient) *GuestOSService {
- return &GuestOSService{cs: cs}
- }
- type HostService struct {
- cs *CloudStackClient
- }
- func NewHostService(cs *CloudStackClient) *HostService {
- return &HostService{cs: cs}
- }
- type HypervisorService struct {
- cs *CloudStackClient
- }
- func NewHypervisorService(cs *CloudStackClient) *HypervisorService {
- return &HypervisorService{cs: cs}
- }
- type ISOService struct {
- cs *CloudStackClient
- }
- func NewISOService(cs *CloudStackClient) *ISOService {
- return &ISOService{cs: cs}
- }
- type ImageStoreService struct {
- cs *CloudStackClient
- }
- func NewImageStoreService(cs *CloudStackClient) *ImageStoreService {
- return &ImageStoreService{cs: cs}
- }
- type InternalLBService struct {
- cs *CloudStackClient
- }
- func NewInternalLBService(cs *CloudStackClient) *InternalLBService {
- return &InternalLBService{cs: cs}
- }
- type LDAPService struct {
- cs *CloudStackClient
- }
- func NewLDAPService(cs *CloudStackClient) *LDAPService {
- return &LDAPService{cs: cs}
- }
- type LimitService struct {
- cs *CloudStackClient
- }
- func NewLimitService(cs *CloudStackClient) *LimitService {
- return &LimitService{cs: cs}
- }
- type LoadBalancerService struct {
- cs *CloudStackClient
- }
- func NewLoadBalancerService(cs *CloudStackClient) *LoadBalancerService {
- return &LoadBalancerService{cs: cs}
- }
- type NATService struct {
- cs *CloudStackClient
- }
- func NewNATService(cs *CloudStackClient) *NATService {
- return &NATService{cs: cs}
- }
- type NetworkACLService struct {
- cs *CloudStackClient
- }
- func NewNetworkACLService(cs *CloudStackClient) *NetworkACLService {
- return &NetworkACLService{cs: cs}
- }
- type NetworkDeviceService struct {
- cs *CloudStackClient
- }
- func NewNetworkDeviceService(cs *CloudStackClient) *NetworkDeviceService {
- return &NetworkDeviceService{cs: cs}
- }
- type NetworkOfferingService struct {
- cs *CloudStackClient
- }
- func NewNetworkOfferingService(cs *CloudStackClient) *NetworkOfferingService {
- return &NetworkOfferingService{cs: cs}
- }
- type NetworkService struct {
- cs *CloudStackClient
- }
- func NewNetworkService(cs *CloudStackClient) *NetworkService {
- return &NetworkService{cs: cs}
- }
- type NicService struct {
- cs *CloudStackClient
- }
- func NewNicService(cs *CloudStackClient) *NicService {
- return &NicService{cs: cs}
- }
- type NiciraNVPService struct {
- cs *CloudStackClient
- }
- func NewNiciraNVPService(cs *CloudStackClient) *NiciraNVPService {
- return &NiciraNVPService{cs: cs}
- }
- type OvsElementService struct {
- cs *CloudStackClient
- }
- func NewOvsElementService(cs *CloudStackClient) *OvsElementService {
- return &OvsElementService{cs: cs}
- }
- type PodService struct {
- cs *CloudStackClient
- }
- func NewPodService(cs *CloudStackClient) *PodService {
- return &PodService{cs: cs}
- }
- type PoolService struct {
- cs *CloudStackClient
- }
- func NewPoolService(cs *CloudStackClient) *PoolService {
- return &PoolService{cs: cs}
- }
- type PortableIPService struct {
- cs *CloudStackClient
- }
- func NewPortableIPService(cs *CloudStackClient) *PortableIPService {
- return &PortableIPService{cs: cs}
- }
- type ProjectService struct {
- cs *CloudStackClient
- }
- func NewProjectService(cs *CloudStackClient) *ProjectService {
- return &ProjectService{cs: cs}
- }
- type QuotaService struct {
- cs *CloudStackClient
- }
- func NewQuotaService(cs *CloudStackClient) *QuotaService {
- return &QuotaService{cs: cs}
- }
- type RegionService struct {
- cs *CloudStackClient
- }
- func NewRegionService(cs *CloudStackClient) *RegionService {
- return &RegionService{cs: cs}
- }
- type ResourcemetadataService struct {
- cs *CloudStackClient
- }
- func NewResourcemetadataService(cs *CloudStackClient) *ResourcemetadataService {
- return &ResourcemetadataService{cs: cs}
- }
- type ResourcetagsService struct {
- cs *CloudStackClient
- }
- func NewResourcetagsService(cs *CloudStackClient) *ResourcetagsService {
- return &ResourcetagsService{cs: cs}
- }
- type RouterService struct {
- cs *CloudStackClient
- }
- func NewRouterService(cs *CloudStackClient) *RouterService {
- return &RouterService{cs: cs}
- }
- type SSHService struct {
- cs *CloudStackClient
- }
- func NewSSHService(cs *CloudStackClient) *SSHService {
- return &SSHService{cs: cs}
- }
- type SecurityGroupService struct {
- cs *CloudStackClient
- }
- func NewSecurityGroupService(cs *CloudStackClient) *SecurityGroupService {
- return &SecurityGroupService{cs: cs}
- }
- type ServiceOfferingService struct {
- cs *CloudStackClient
- }
- func NewServiceOfferingService(cs *CloudStackClient) *ServiceOfferingService {
- return &ServiceOfferingService{cs: cs}
- }
- type SnapshotService struct {
- cs *CloudStackClient
- }
- func NewSnapshotService(cs *CloudStackClient) *SnapshotService {
- return &SnapshotService{cs: cs}
- }
- type StoragePoolService struct {
- cs *CloudStackClient
- }
- func NewStoragePoolService(cs *CloudStackClient) *StoragePoolService {
- return &StoragePoolService{cs: cs}
- }
- type StratosphereSSPService struct {
- cs *CloudStackClient
- }
- func NewStratosphereSSPService(cs *CloudStackClient) *StratosphereSSPService {
- return &StratosphereSSPService{cs: cs}
- }
- type SwiftService struct {
- cs *CloudStackClient
- }
- func NewSwiftService(cs *CloudStackClient) *SwiftService {
- return &SwiftService{cs: cs}
- }
- type SystemCapacityService struct {
- cs *CloudStackClient
- }
- func NewSystemCapacityService(cs *CloudStackClient) *SystemCapacityService {
- return &SystemCapacityService{cs: cs}
- }
- type SystemVMService struct {
- cs *CloudStackClient
- }
- func NewSystemVMService(cs *CloudStackClient) *SystemVMService {
- return &SystemVMService{cs: cs}
- }
- type TemplateService struct {
- cs *CloudStackClient
- }
- func NewTemplateService(cs *CloudStackClient) *TemplateService {
- return &TemplateService{cs: cs}
- }
- type UCSService struct {
- cs *CloudStackClient
- }
- func NewUCSService(cs *CloudStackClient) *UCSService {
- return &UCSService{cs: cs}
- }
- type UsageService struct {
- cs *CloudStackClient
- }
- func NewUsageService(cs *CloudStackClient) *UsageService {
- return &UsageService{cs: cs}
- }
- type UserService struct {
- cs *CloudStackClient
- }
- func NewUserService(cs *CloudStackClient) *UserService {
- return &UserService{cs: cs}
- }
- type VLANService struct {
- cs *CloudStackClient
- }
- func NewVLANService(cs *CloudStackClient) *VLANService {
- return &VLANService{cs: cs}
- }
- type VMGroupService struct {
- cs *CloudStackClient
- }
- func NewVMGroupService(cs *CloudStackClient) *VMGroupService {
- return &VMGroupService{cs: cs}
- }
- type VPCService struct {
- cs *CloudStackClient
- }
- func NewVPCService(cs *CloudStackClient) *VPCService {
- return &VPCService{cs: cs}
- }
- type VPNService struct {
- cs *CloudStackClient
- }
- func NewVPNService(cs *CloudStackClient) *VPNService {
- return &VPNService{cs: cs}
- }
- type VirtualMachineService struct {
- cs *CloudStackClient
- }
- func NewVirtualMachineService(cs *CloudStackClient) *VirtualMachineService {
- return &VirtualMachineService{cs: cs}
- }
- type VolumeService struct {
- cs *CloudStackClient
- }
- func NewVolumeService(cs *CloudStackClient) *VolumeService {
- return &VolumeService{cs: cs}
- }
- type ZoneService struct {
- cs *CloudStackClient
- }
- func NewZoneService(cs *CloudStackClient) *ZoneService {
- return &ZoneService{cs: cs}
- }
|