This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
forked from xanzy/go-cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudstack.go
842 lines (690 loc) · 20.9 KB
/
cloudstack.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
//
// Copyright 2014, 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 (
"crypto/hmac"
"crypto/sha1"
"crypto/tls"
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"
)
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 {
client *http.Client // The http client for communicating
baseURL string // The base URL of the API
apiKey string // Api key
secret string // Secret key
async bool // Wait for async calls to finish
timeout int64 // Max waiting timeout in seconds for async jobs to finish; defaults to 60 seconds
Cluster *ClusterService
InternalLB *InternalLBService
NAT *NATService
Address *AddressService
NiciraNVP *NiciraNVPService
SystemCapacity *SystemCapacityService
Network *NetworkService
VPC *VPCService
NetworkACL *NetworkACLService
Template *TemplateService
VMGroup *VMGroupService
OvsElement *OvsElementService
StratosphereSSP *StratosphereSSPService
VPN *VPNService
Snapshot *SnapshotService
Pool *PoolService
NetworkOffering *NetworkOfferingService
LoadBalancer *LoadBalancerService
Account *AccountService
SSH *SSHService
Baremetal *BaremetalService
NetworkDevice *NetworkDeviceService
Asyncjob *AsyncjobService
CloudIdentifier *CloudIdentifierService
SystemVM *SystemVMService
ISO *ISOService
Resourcetags *ResourcetagsService
S3 *S3Service
Host *HostService
Volume *VolumeService
Zone *ZoneService
Pod *PodService
Configuration *ConfigurationService
VLAN *VLANService
Limit *LimitService
Alert *AlertService
Resourcemetadata *ResourcemetadataService
Nic *NicService
Firewall *FirewallService
Router *RouterService
Swift *SwiftService
Login *LoginService
LDAP *LDAPService
Usage *UsageService
AffinityGroup *AffinityGroupService
Hypervisor *HypervisorService
APIDiscovery *APIDiscoveryService
ServiceOffering *ServiceOfferingService
Logout *LogoutService
Certificate *CertificateService
Project *ProjectService
SecurityGroup *SecurityGroupService
ImageStore *ImageStoreService
DiskOffering *DiskOfferingService
StoragePool *StoragePoolService
BigSwitchVNS *BigSwitchVNSService
VirtualMachine *VirtualMachineService
GuestOS *GuestOSService
UCS *UCSService
AutoScale *AutoScaleService
Domain *DomainService
Region *RegionService
Event *EventService
User *UserService
PortableIP *PortableIPService
}
// Creates a new client for communicating with CloudStack
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}, // If verifyssl is true, skipping the verify should be false and vice versa
},
},
baseURL: apiurl,
apiKey: apikey,
secret: secret,
async: async,
timeout: 60,
}
cs.Cluster = NewClusterService(cs)
cs.InternalLB = NewInternalLBService(cs)
cs.NAT = NewNATService(cs)
cs.Address = NewAddressService(cs)
cs.NiciraNVP = NewNiciraNVPService(cs)
cs.SystemCapacity = NewSystemCapacityService(cs)
cs.Network = NewNetworkService(cs)
cs.VPC = NewVPCService(cs)
cs.NetworkACL = NewNetworkACLService(cs)
cs.Template = NewTemplateService(cs)
cs.VMGroup = NewVMGroupService(cs)
cs.OvsElement = NewOvsElementService(cs)
cs.StratosphereSSP = NewStratosphereSSPService(cs)
cs.VPN = NewVPNService(cs)
cs.Snapshot = NewSnapshotService(cs)
cs.Pool = NewPoolService(cs)
cs.NetworkOffering = NewNetworkOfferingService(cs)
cs.LoadBalancer = NewLoadBalancerService(cs)
cs.Account = NewAccountService(cs)
cs.SSH = NewSSHService(cs)
cs.Baremetal = NewBaremetalService(cs)
cs.NetworkDevice = NewNetworkDeviceService(cs)
cs.Asyncjob = NewAsyncjobService(cs)
cs.CloudIdentifier = NewCloudIdentifierService(cs)
cs.SystemVM = NewSystemVMService(cs)
cs.ISO = NewISOService(cs)
cs.Resourcetags = NewResourcetagsService(cs)
cs.S3 = NewS3Service(cs)
cs.Host = NewHostService(cs)
cs.Volume = NewVolumeService(cs)
cs.Zone = NewZoneService(cs)
cs.Pod = NewPodService(cs)
cs.Configuration = NewConfigurationService(cs)
cs.VLAN = NewVLANService(cs)
cs.Limit = NewLimitService(cs)
cs.Alert = NewAlertService(cs)
cs.Resourcemetadata = NewResourcemetadataService(cs)
cs.Nic = NewNicService(cs)
cs.Firewall = NewFirewallService(cs)
cs.Router = NewRouterService(cs)
cs.Swift = NewSwiftService(cs)
cs.Login = NewLoginService(cs)
cs.LDAP = NewLDAPService(cs)
cs.Usage = NewUsageService(cs)
cs.AffinityGroup = NewAffinityGroupService(cs)
cs.Hypervisor = NewHypervisorService(cs)
cs.APIDiscovery = NewAPIDiscoveryService(cs)
cs.ServiceOffering = NewServiceOfferingService(cs)
cs.Logout = NewLogoutService(cs)
cs.Certificate = NewCertificateService(cs)
cs.Project = NewProjectService(cs)
cs.SecurityGroup = NewSecurityGroupService(cs)
cs.ImageStore = NewImageStoreService(cs)
cs.DiskOffering = NewDiskOfferingService(cs)
cs.StoragePool = NewStoragePoolService(cs)
cs.BigSwitchVNS = NewBigSwitchVNSService(cs)
cs.VirtualMachine = NewVirtualMachineService(cs)
cs.GuestOS = NewGuestOSService(cs)
cs.UCS = NewUCSService(cs)
cs.AutoScale = NewAutoScaleService(cs)
cs.Domain = NewDomainService(cs)
cs.Region = NewRegionService(cs)
cs.Event = NewEventService(cs)
cs.User = NewUserService(cs)
cs.PortableIP = NewPortableIPService(cs)
return cs
}
// Default non-async client. So for async calls you need to implement and check the async job result yourself. When using
// HTTPS with a self-signed certificate to connect to your CloudStack API, you would probably want to set 'verifyssl' to
// false so the call ignores the SSL errors/warnings.
func NewClient(apiurl string, apikey string, secret string, verifyssl bool) *CloudStackClient {
cs := newClient(apiurl, apikey, secret, false, verifyssl)
return cs
}
// For sync API calls this client behaves exactly the same as a standard client call, but for async API calls
// this client will wait until the async job is finished or until the configured AsyncTimeout is reached. When the async
// job finishes successfully it will return actual object received from the API and nil, but when the timout is
// reached it will return the initial object containing the async job ID for the running job and a warning.
func NewAsyncClient(apiurl string, apikey string, secret string, verifyssl bool) *CloudStackClient {
cs := newClient(apiurl, apikey, secret, true, verifyssl)
return cs
}
// When using the async client an api call will wait for the async call to finish before returning. The default is to poll for 60
// seconds, to check if the async job is finished.
func (cs *CloudStackClient) AsyncTimeout(timeoutInSeconds int64) {
cs.timeout = timeoutInSeconds
}
// 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
// timeout, the async job return a warning saying the timer has expired.
func (cs *CloudStackClient) GetAsyncJobResult(jobid string, timeout int64) (b json.RawMessage, warn error, err error) {
currentTime := time.Now().Unix()
for {
p := cs.Asyncjob.NewQueryAsyncJobResultParams(jobid)
r, err := cs.Asyncjob.QueryAsyncJobResult(p)
if err != nil {
return nil, nil, err
}
// Status 1 means the job is finished successfully
if r.Jobstatus == 1 {
b, err := getRawValue(r.Jobresult)
if err != nil {
return nil, nil, err
}
return b, nil, nil
}
// When the status is 2, the job has failed
if r.Jobstatus == 2 {
if r.Jobresulttype == "text" {
return nil, nil, fmt.Errorf(string(r.Jobresult))
} else {
return nil, nil, fmt.Errorf("Undefined error: %s", string(r.Jobresult))
}
}
if time.Now().Unix()-currentTime > timeout {
return nil, fmt.Errorf("Timeout while waiting for async job to finish"), nil
}
time.Sleep(3 * time.Second)
}
}
// Execute the request against a CS API. Will return the raw JSON data returned by the API and nil if
// no error occured. If the API returns an error the result will be nil and the HTTP error code and CS
// error details. If a processing (code) error occurs the result will be nil and the generated error
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")
// Generate signature for API call
// * Serialize parameters and sort them by key, done by Encode
// * Convert the entire argument string to lowercase
// * Replace all instances of '+' to '%20'
// * Calculate HMAC SHA1 of argument string with CloudStack secret
// * URL encode the string and convert to base64
s := params.Encode()
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))
signature = url.QueryEscape(signature)
// Create the final URL before we issue the request
url := cs.baseURL + "?" + s + "&signature=" + signature
resp, err := cs.client.Get(url)
if err != nil {
return nil, err
}
b, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, err
}
// Need to get the raw value to make the result play nice
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
}
// Generic function to get the first raw value from a response as json.RawMessage
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 ClusterService struct {
cs *CloudStackClient
}
func NewClusterService(cs *CloudStackClient) *ClusterService {
return &ClusterService{cs: cs}
}
type InternalLBService struct {
cs *CloudStackClient
}
func NewInternalLBService(cs *CloudStackClient) *InternalLBService {
return &InternalLBService{cs: cs}
}
type NATService struct {
cs *CloudStackClient
}
func NewNATService(cs *CloudStackClient) *NATService {
return &NATService{cs: cs}
}
type AddressService struct {
cs *CloudStackClient
}
func NewAddressService(cs *CloudStackClient) *AddressService {
return &AddressService{cs: cs}
}
type NiciraNVPService struct {
cs *CloudStackClient
}
func NewNiciraNVPService(cs *CloudStackClient) *NiciraNVPService {
return &NiciraNVPService{cs: cs}
}
type SystemCapacityService struct {
cs *CloudStackClient
}
func NewSystemCapacityService(cs *CloudStackClient) *SystemCapacityService {
return &SystemCapacityService{cs: cs}
}
type NetworkService struct {
cs *CloudStackClient
}
func NewNetworkService(cs *CloudStackClient) *NetworkService {
return &NetworkService{cs: cs}
}
type VPCService struct {
cs *CloudStackClient
}
func NewVPCService(cs *CloudStackClient) *VPCService {
return &VPCService{cs: cs}
}
type NetworkACLService struct {
cs *CloudStackClient
}
func NewNetworkACLService(cs *CloudStackClient) *NetworkACLService {
return &NetworkACLService{cs: cs}
}
type TemplateService struct {
cs *CloudStackClient
}
func NewTemplateService(cs *CloudStackClient) *TemplateService {
return &TemplateService{cs: cs}
}
type VMGroupService struct {
cs *CloudStackClient
}
func NewVMGroupService(cs *CloudStackClient) *VMGroupService {
return &VMGroupService{cs: cs}
}
type OvsElementService struct {
cs *CloudStackClient
}
func NewOvsElementService(cs *CloudStackClient) *OvsElementService {
return &OvsElementService{cs: cs}
}
type StratosphereSSPService struct {
cs *CloudStackClient
}
func NewStratosphereSSPService(cs *CloudStackClient) *StratosphereSSPService {
return &StratosphereSSPService{cs: cs}
}
type VPNService struct {
cs *CloudStackClient
}
func NewVPNService(cs *CloudStackClient) *VPNService {
return &VPNService{cs: cs}
}
type SnapshotService struct {
cs *CloudStackClient
}
func NewSnapshotService(cs *CloudStackClient) *SnapshotService {
return &SnapshotService{cs: cs}
}
type PoolService struct {
cs *CloudStackClient
}
func NewPoolService(cs *CloudStackClient) *PoolService {
return &PoolService{cs: cs}
}
type NetworkOfferingService struct {
cs *CloudStackClient
}
func NewNetworkOfferingService(cs *CloudStackClient) *NetworkOfferingService {
return &NetworkOfferingService{cs: cs}
}
type LoadBalancerService struct {
cs *CloudStackClient
}
func NewLoadBalancerService(cs *CloudStackClient) *LoadBalancerService {
return &LoadBalancerService{cs: cs}
}
type AccountService struct {
cs *CloudStackClient
}
func NewAccountService(cs *CloudStackClient) *AccountService {
return &AccountService{cs: cs}
}
type SSHService struct {
cs *CloudStackClient
}
func NewSSHService(cs *CloudStackClient) *SSHService {
return &SSHService{cs: cs}
}
type BaremetalService struct {
cs *CloudStackClient
}
func NewBaremetalService(cs *CloudStackClient) *BaremetalService {
return &BaremetalService{cs: cs}
}
type NetworkDeviceService struct {
cs *CloudStackClient
}
func NewNetworkDeviceService(cs *CloudStackClient) *NetworkDeviceService {
return &NetworkDeviceService{cs: cs}
}
type AsyncjobService struct {
cs *CloudStackClient
}
func NewAsyncjobService(cs *CloudStackClient) *AsyncjobService {
return &AsyncjobService{cs: cs}
}
type CloudIdentifierService struct {
cs *CloudStackClient
}
func NewCloudIdentifierService(cs *CloudStackClient) *CloudIdentifierService {
return &CloudIdentifierService{cs: cs}
}
type SystemVMService struct {
cs *CloudStackClient
}
func NewSystemVMService(cs *CloudStackClient) *SystemVMService {
return &SystemVMService{cs: cs}
}
type ISOService struct {
cs *CloudStackClient
}
func NewISOService(cs *CloudStackClient) *ISOService {
return &ISOService{cs: cs}
}
type ResourcetagsService struct {
cs *CloudStackClient
}
func NewResourcetagsService(cs *CloudStackClient) *ResourcetagsService {
return &ResourcetagsService{cs: cs}
}
type S3Service struct {
cs *CloudStackClient
}
func NewS3Service(cs *CloudStackClient) *S3Service {
return &S3Service{cs: cs}
}
type HostService struct {
cs *CloudStackClient
}
func NewHostService(cs *CloudStackClient) *HostService {
return &HostService{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}
}
type PodService struct {
cs *CloudStackClient
}
func NewPodService(cs *CloudStackClient) *PodService {
return &PodService{cs: cs}
}
type ConfigurationService struct {
cs *CloudStackClient
}
func NewConfigurationService(cs *CloudStackClient) *ConfigurationService {
return &ConfigurationService{cs: cs}
}
type VLANService struct {
cs *CloudStackClient
}
func NewVLANService(cs *CloudStackClient) *VLANService {
return &VLANService{cs: cs}
}
type LimitService struct {
cs *CloudStackClient
}
func NewLimitService(cs *CloudStackClient) *LimitService {
return &LimitService{cs: cs}
}
type AlertService struct {
cs *CloudStackClient
}
func NewAlertService(cs *CloudStackClient) *AlertService {
return &AlertService{cs: cs}
}
type ResourcemetadataService struct {
cs *CloudStackClient
}
func NewResourcemetadataService(cs *CloudStackClient) *ResourcemetadataService {
return &ResourcemetadataService{cs: cs}
}
type NicService struct {
cs *CloudStackClient
}
func NewNicService(cs *CloudStackClient) *NicService {
return &NicService{cs: cs}
}
type FirewallService struct {
cs *CloudStackClient
}
func NewFirewallService(cs *CloudStackClient) *FirewallService {
return &FirewallService{cs: cs}
}
type RouterService struct {
cs *CloudStackClient
}
func NewRouterService(cs *CloudStackClient) *RouterService {
return &RouterService{cs: cs}
}
type SwiftService struct {
cs *CloudStackClient
}
func NewSwiftService(cs *CloudStackClient) *SwiftService {
return &SwiftService{cs: cs}
}
type LoginService struct {
cs *CloudStackClient
}
func NewLoginService(cs *CloudStackClient) *LoginService {
return &LoginService{cs: cs}
}
type LDAPService struct {
cs *CloudStackClient
}
func NewLDAPService(cs *CloudStackClient) *LDAPService {
return &LDAPService{cs: cs}
}
type UsageService struct {
cs *CloudStackClient
}
func NewUsageService(cs *CloudStackClient) *UsageService {
return &UsageService{cs: cs}
}
type AffinityGroupService struct {
cs *CloudStackClient
}
func NewAffinityGroupService(cs *CloudStackClient) *AffinityGroupService {
return &AffinityGroupService{cs: cs}
}
type HypervisorService struct {
cs *CloudStackClient
}
func NewHypervisorService(cs *CloudStackClient) *HypervisorService {
return &HypervisorService{cs: cs}
}
type APIDiscoveryService struct {
cs *CloudStackClient
}
func NewAPIDiscoveryService(cs *CloudStackClient) *APIDiscoveryService {
return &APIDiscoveryService{cs: cs}
}
type ServiceOfferingService struct {
cs *CloudStackClient
}
func NewServiceOfferingService(cs *CloudStackClient) *ServiceOfferingService {
return &ServiceOfferingService{cs: cs}
}
type LogoutService struct {
cs *CloudStackClient
}
func NewLogoutService(cs *CloudStackClient) *LogoutService {
return &LogoutService{cs: cs}
}
type CertificateService struct {
cs *CloudStackClient
}
func NewCertificateService(cs *CloudStackClient) *CertificateService {
return &CertificateService{cs: cs}
}
type ProjectService struct {
cs *CloudStackClient
}
func NewProjectService(cs *CloudStackClient) *ProjectService {
return &ProjectService{cs: cs}
}
type SecurityGroupService struct {
cs *CloudStackClient
}
func NewSecurityGroupService(cs *CloudStackClient) *SecurityGroupService {
return &SecurityGroupService{cs: cs}
}
type ImageStoreService struct {
cs *CloudStackClient
}
func NewImageStoreService(cs *CloudStackClient) *ImageStoreService {
return &ImageStoreService{cs: cs}
}
type DiskOfferingService struct {
cs *CloudStackClient
}
func NewDiskOfferingService(cs *CloudStackClient) *DiskOfferingService {
return &DiskOfferingService{cs: cs}
}
type StoragePoolService struct {
cs *CloudStackClient
}
func NewStoragePoolService(cs *CloudStackClient) *StoragePoolService {
return &StoragePoolService{cs: cs}
}
type BigSwitchVNSService struct {
cs *CloudStackClient
}
func NewBigSwitchVNSService(cs *CloudStackClient) *BigSwitchVNSService {
return &BigSwitchVNSService{cs: cs}
}
type VirtualMachineService struct {
cs *CloudStackClient
}
func NewVirtualMachineService(cs *CloudStackClient) *VirtualMachineService {
return &VirtualMachineService{cs: cs}
}
type GuestOSService struct {
cs *CloudStackClient
}
func NewGuestOSService(cs *CloudStackClient) *GuestOSService {
return &GuestOSService{cs: cs}
}
type UCSService struct {
cs *CloudStackClient
}
func NewUCSService(cs *CloudStackClient) *UCSService {
return &UCSService{cs: cs}
}
type AutoScaleService struct {
cs *CloudStackClient
}
func NewAutoScaleService(cs *CloudStackClient) *AutoScaleService {
return &AutoScaleService{cs: cs}
}
type DomainService struct {
cs *CloudStackClient
}
func NewDomainService(cs *CloudStackClient) *DomainService {
return &DomainService{cs: cs}
}
type RegionService struct {
cs *CloudStackClient
}
func NewRegionService(cs *CloudStackClient) *RegionService {
return &RegionService{cs: cs}
}
type EventService struct {
cs *CloudStackClient
}
func NewEventService(cs *CloudStackClient) *EventService {
return &EventService{cs: cs}
}
type UserService struct {
cs *CloudStackClient
}
func NewUserService(cs *CloudStackClient) *UserService {
return &UserService{cs: cs}
}
type PortableIPService struct {
cs *CloudStackClient
}
func NewPortableIPService(cs *CloudStackClient) *PortableIPService {
return &PortableIPService{cs: cs}
}