Skip to content
Go language library for CloudStack API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Godeps
examples
.gitignore
.travis.yml
AccountApi.go
AccountApi_test.go
AccountStruct.go
AddressApi.go
AddressApi_test.go
AffinityGroupApi.go
AffinityGroupStruct.go
AffinityGroupTypeStruct.go
CapacityStruct.go
ClusterApi.go
ClusterApi_test.go
ClusterStruct.go
DiskOfferingApi.go
DiskOfferingApi_test.go
DiskOfferingStruct.go
DomainApi.go
DomainApi_test.go
DomainStruct.go
FirewallApi.go
FirewallApi_test.go
FirewallRuleStruct.go
HostApi.go
HostApi_test.go
HostStruct.go
ImageStoreApi.go
ImageStoreApi_test.go
ImageStoreStruct.go
IpForwardingRuleStruct.go
LICENSE
LoadBalancerApi.go
LoadBalancerApi_test.go
LoadBalancerRuleInstanceStruct.go
LoadBalancerRuleStruct.go
NATApi.go
NATApi_test.go
NetworkApi.go
NetworkApi_test.go
NetworkOfferingApi.go
NetworkOfferingApi_test.go
NetworkOfferingStruct.go
NetworkServiceCapabilityStruct.go
NetworkServiceProviderStruct.go
NetworkServiceStruct.go
NetworkStruct.go
NicStruct.go
PodApi.go
PodApi_test.go
PodStruct.go
PortForwardingRuleStruct.go
ProjectApi.go
ProjectApi_test.go
ProjectStruct.go
PublicIpAddressStruct.go
README.md
ResourcetagsApi.go
ResourcetagsApi_test.go
ResultStruct.go
SecurityGroupApi.go
SecurityGroupStruct.go
ServiceOfferingApi.go
ServiceOfferingApi_test.go
ServiceOfferingStruct.go
StoragePoolApi.go
StoragePoolApi_test.go
StoragePoolStruct.go
StorageProviderApi.go
StorageProviderApi_test.go
StorageProviderStruct.go
TagStruct.go
TemplateApi.go
TemplateApi_test.go
TemplateStruct.go
UserApi.go
UserApi_test.go
UserStruct.go
VirtualMachineApi.go
VirtualMachineApi_test.go
VirtualMachineMethods.go
VirtualMachineMethods_test.go
VirtualMachineResource.go.bak
VirtualMachineStruct.go
VolumeApi.go
VolumeApi_test.go
VolumeStruct.go
ZoneApi.go
ZoneApi_test.go
ZoneStruct.go
cloudstack.go
cloudstack_test.go
config.go
keypair.go
types.go
types_test.go
vars.go

README.md

golang-cloudstack-library

Build Status

Go language library for CloudStack API

Installation

go get github.com/atsaki/golang-cloudstack-library

Usage

package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/url"

	"github.com/atsaki/golang-cloudstack-library"
)

func main() {

	log.SetOutput(ioutil.Discard)

	endpoint, _ := url.Parse("http://localhost:8080/client/api")
	apikey := ""
	secretkey := ""
	username := "admin"
	password := "password"

	client, _ := cloudstack.NewClient(endpoint, apikey, secretkey, username, password)

	params := cloudstack.NewListZonesParameter()
	params.Name.Set("zone1")

	zones, _ := client.ListZones(params)
	b, _ := json.MarshalIndent(zones, "", "    ")

	fmt.Println("Count:", len(zones))
	fmt.Println(string(b))
}

This returns JSON response as follows.

Count: 1
[
    {
        "allocationstate": "Enabled",
        "capacity": null,
        "description": null,
        "dhcpprovider": "VirtualRouter",
        "displaytext": null,
        "dns1": "8.8.8.8",
        "dns2": null,
        "domain": null,
        "domainid": null,
        "domainname": null,
        "guestcidraddress": "10.1.1.0/24",
        "id": "7fdea428-8228-4dfd-850b-d60eed5004a4",
        "internaldns1": "8.8.4.4",
        "internaldns2": null,
        "ip6dns1": null,
        "ip6dns2": null,
        "localstorageenabled": false,
        "name": "zone1",
        "networktype": "Advanced",
        "resourcedetails": null,
        "securitygroupsenabled": false,
        "tags": [],
        "vlan": null,
        "zonetoken": "c263e076-5887-355b-afe9-cc988a1ccac7"
    }
]

Projects Using This Library

You can’t perform that action at this time.