goarubacloud

package module
v0.0.0-...-945cf49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 14 Imported by: 3

README

goarubacloud

Documentation

Index

Constants

View Source
const DefaultTimeout = 180

DefaultTimeout api requests after 180s

Variables

View Source
var Endpoints = map[string]string{
	"dc1": dc1,
	"dc2": dc2,
	"dc3": dc3,
	"dc4": dc4,
	"dc5": dc5,
	"dc6": dc6,
	"dc7": dc7,
	"dc8": dc8,
}
View Source
var (
	ErrNoEnpoint = errors.New("arubacloud: no endpoint provided")
)

Custom errors

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(endpoint, username, password string) (api *API, err error)

func (*API) CreateServerPro

func (a *API) CreateServerPro(name, admin_password string, os_template_id int, sshKey string, ipID int, diskSize int, cpuQuantity int, ramQuantity int, configureIPv6 bool) (server *models.Server, err error)

func (*API) CreateServerSmart

func (a *API) CreateServerSmart(name, admin_password string, package_id, os_template_id int, sshKey string, configureIPv6 bool) (server *models.Server, err error)

func (*API) DeleteServer

func (a *API) DeleteServer(server_id int) (err error)

func (*API) GetPreconfiguredPackage

func (a *API) GetPreconfiguredPackage(packagename string) (cloudpackage *models.CloudPackage, err error)

func (*API) GetPreconfiguredPackages

func (a *API) GetPreconfiguredPackages() (packagesTypes []*models.CloudPackage, err error)

func (*API) GetPurchasedIpAddress

func (a *API) GetPurchasedIpAddress(ip string) (IpAddress *models.IPAddress, err error)

func (*API) GetPurchasedIpAddresses

func (a *API) GetPurchasedIpAddresses() (packagesTypes []*models.IPAddress, err error)

func (*API) GetServer

func (a *API) GetServer(serverId int) (server *models.Server, err error)

func (*API) GetServers

func (a *API) GetServers() (servers []*models.Server, err error)

func (*API) GetTemplate

func (a *API) GetTemplate(templatename string, hypervisorType int) (template *models.Template, err error)

func (*API) GetTemplates

func (a *API) GetTemplates() (hypervisorTypes []*models.GetHypvervisorTypeResponse, err error)

func (*API) KillServer

func (a *API) KillServer(server_id int) (err error)

func (*API) PurchaseIpAddress

func (a *API) PurchaseIpAddress() (ip *models.IPAddress, err error)

func (*API) StartServer

func (a *API) StartServer(server_id int) (err error)

func (*API) StopServer

func (a *API) StopServer(server_id int) (err error)

type APIError

type APIError struct {
	// Error message.
	Message string
	// HTTP code.
	Code int
}

APIError represents an error that can occurred while calling the API.

func (*APIError) Error

func (err *APIError) Error() string

type APIResponse

type APIResponse struct {
	StatusCode int
	Status     string
	Body       []byte
}

type Client

type Client struct {
	EndPoint string
	Username string
	Password string
	Timeout  time.Duration
	Client   *http.Client
}

func NewClient

func NewClient(endpoint, username, password string) (*Client, error)

NewClient returns an ArubaCloud API Client.

func NewDefaultClient

func NewDefaultClient() (*Client, error)

NewDefaultClient returns an ArubaCloud API Client from external configuration

func NewEndpointClient

func NewEndpointClient(endpoint string) (*Client, error)

NewEndpointClient returns an ArubaCloud API Client from external configuration, for a specific endpoint

func (*Client) CallAPI

func (c *Client) CallAPI(method, path string, reqBody, resType interface{}) error

func (*Client) Get

func (c *Client) Get(url string, resType interface{}) error

func (*Client) Post

func (c *Client) Post(url string, data interface{}, resType interface{}) error

type GetPreconfiguredPackagesRequest

type GetPreconfiguredPackagesRequest struct {
	Username       string `json:"Username"`
	Password       string `json:"Password"`
	HypervisorType int    `json:"HypervisorType"`
}

type GetPurchasedIpAddresses

type GetPurchasedIpAddresses struct {
	Username string `json:"Username"`
	Password string `json:"Password"`
}

type GetServerDetailsRequest

type GetServerDetailsRequest struct {
	Username string `json:"Username,omitempty"`
	Password string `json:"Password,omitempty"`
	ServerId int    `json:"ServerId,omitempty"`
}

type GetServersRequest

type GetServersRequest struct {
	Username string `json:"Username"`
	Password string `json:"Password"`
}

type GetTemplatesRequest

type GetTemplatesRequest struct {
	Username string `json:"Username"`
	Password string `json:"Password"`
}

type NetworkAdapterConfiguration

type NetworkAdapterConfiguration struct {
	PublicIpAddresses  []PublicIpAddressDetails
	NetworkAdapterType int `json:"NetworkAdapterType"`
}

type PublicIpAddressDetails

type PublicIpAddressDetails struct {
	PrimaryIPAddress          bool `json:"PrimaryIPAddress"`
	PublicIpAddressResourceId int  `json:"PublicIpAddressResourceId"`
}

type Response

type Response struct {
	Success bool   `json:"Success,omitempty"`
	Value   string `json:"Value,omitempty"`
}

type ResponseBody

type ResponseBody struct {
	ExceptionInfo string `json:"ExceptionInfo"`
	ResultCode    int    `json:"ResultCode"`
	ResultMessage string `json:"ResultMessage"`
	Success       bool   `json:"Success"`
	Value         json.RawMessage
}

type SetEnqueueServerCreation

type SetEnqueueServerCreation struct {
	Username string `json:"Username"`
	Password string `json:"Password"`
	Server   struct {
		AdministratorPassword        string `json:"AdministratorPassword"`
		Name                         string `json:"Name"`
		SmartVMWarePackageID         int    `json:"SmartVMWarePackageID,omitempty"`
		Note                         string `json:"Note"`
		OSTemplateId                 int    `json:"OSTemplateId"`
		SshKey                       string `json:"SshKey"`
		SshPasswordAuthAllowed       bool   `json:"SshPasswordAuthAllowed,omitempty"`
		CPUQuantity                  int    `json:"CPUQuantity"`
		RAMQuantity                  int    `json:"RAMQuantity"`
		NetworkAdaptersConfiguration []NetworkAdapterConfiguration
		VirtualDisks                 []VirtualDiskDetails
		ConfigureIPv6                bool `json:"ConfigureIPv6"`
	}
}

type SetEnqueueServerDeletion

type SetEnqueueServerDeletion struct {
	Username string `json:"Username,omitempty"`
	Password string `json:"Password,omitempty"`
	ServerId int    `json:"ServerId,omitempty"`
}

type SetEnqueueServerKill

type SetEnqueueServerKill struct {
	Username string `json:"Username,omitempty"`
	Password string `json:"Password,omitempty"`
	ServerId int    `json:"ServerId,omitempty"`
}

type SetEnqueueServerStart

type SetEnqueueServerStart struct {
	Username string `json:"Username,omitempty"`
	Password string `json:"Password,omitempty"`
	ServerId int    `json:"ServerId,omitempty"`
}

type SetEnqueueServerStop

type SetEnqueueServerStop struct {
	Username string `json:"Username,omitempty"`
	Password string `json:"Password,omitempty"`
	ServerId int    `json:"ServerId,omitempty"`
}

type SetPurchaseIpAddress

type SetPurchaseIpAddress struct {
	Username string `json:"Username,omitempty"`
	Password string `json:"Password,omitempty"`
}

type VirtualDiskDetails

type VirtualDiskDetails struct {
	Size            int `json:"Size,omitempty"`
	VirtualDiskType int `json:"VirtualDiskType"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL