Documentation
¶
Index ¶
- Constants
- type AttachElasticIp
- type AttachedNetworkInterface
- type Client
- type DateTime
- type DeploymentFee
- type ElasticIp
- type ElasticIpCreate
- type ElasticIpProduct
- type ElasticIpService
- type ErrorResponse
- type Id
- type Image
- type ImageService
- type KeyPair
- type KeyPairCreate
- type KeyPairService
- type Links
- type Location
- type LocationService
- type Module
- type ModuleService
- type Network
- type NetworkCreate
- type NetworkInterface
- type NetworkInterfaceCreate
- type NetworkInterfaceService
- type NetworkService
- type Order
- type OrderService
- type OrderStatus
- type Ordering
- type Pagination
- type PaginationOptions
- type Product
- type ProductAvailability
- type ProductItem
- type ProductService
- type ProductType
- type ProductUsageCycle
- type Response
- type SecurityGroup
- type Server
- type ServerAction
- type ServerAttachmentService
- type ServerCreate
- type ServerNetworkAttachment
- type ServerService
- type ServerStatus
- type SnaphostStatusKey
- type Snapshot
- type SnapshotCreate
- type SnapshotService
- type Status
- type SystemError
- type Volume
- type VolumeActionService
- type VolumeAttach
- type VolumeCreate
- type VolumeExpand
- type VolumeService
- type VolumeStatus
Constants ¶
View Source
const ( VolumeStatusAvailable = Id(1) VolumeStatusInUse = Id(2) VolumeStatusWorking = Id(3) VolumeStatusError = Id(4) )
View Source
const (
ErrorUnsupportedContentType = SystemError("received unsupported content type")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachElasticIp ¶
type Client ¶
type Client struct {
BaseURL *url.URL
UserAgent string
HttpClient *http.Client
// General entities
Product ProductService
Location LocationService
Module ModuleService
Image ImageService
// Compute
Server ServerService
ServerAttachment ServerAttachmentService
KeyPair KeyPairService
Network NetworkService
ElasticIp ElasticIpService
Volume VolumeService
VolumeAction VolumeActionService
Snapshot SnapshotService
// Other
Order OrderService
}
func NewClientWithToken ¶
type DeploymentFee ¶
type ElasticIpCreate ¶
type ElasticIpCreate struct {
LocationId Id `json:"location_id"`
}
type ElasticIpProduct ¶
type ElasticIpService ¶
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type Image ¶
type Image struct {
Id Id `json:"id"`
OperatingSystem string `json:"os"`
Version string `json:"version"`
Key string `json:"key"`
Category string `json:"category"`
Type string `json:"type"`
MinRootDiskSize int `json:"min_root_disk_size"`
Sorting int `json:"sorting"`
RequiredLicenses []*Product `json:"required_licenses"`
AvailableLocations []Id `json:"available_locations"`
}
func (*Image) AvailableAt ¶
type ImageService ¶
type KeyPairCreate ¶
type KeyPairService ¶
type LocationService ¶
type Module ¶
type Module struct {
Id Id `json:"id"`
Name string `json:"name"`
Parent *Module `json:"parent"`
Sorting int `json:"sorting"`
Locations []*Location `json:"locations"`
}
func (*Module) AvailableAt ¶
type ModuleService ¶
type Network ¶
type Network struct {
Id Id `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Cidr string `json:"cidr"`
Location Location `json:"location"`
DomainNameServers []string `json:"domain_name_servers"`
AllocationPoolStart string `json:"allocation_pool_start"`
AllocationPoolEnd string `json:"allocation_pool_end"`
GatewayIp string `json:"gateway_ip"`
UsedIps int `json:"used_ips"`
TotalIps int `json:"total_ips"`
}
type NetworkCreate ¶
type NetworkCreate struct {
Name string `json:"name"`
Description string `json:"description"`
LocationId Id `json:"location_id"`
DomainNameServer []string `json:"domain_name_server"`
Cidr string `json:"cidr"`
AllocationPoolStart string `json:"allocation_pool_start"`
AllocationPoolEnd string `json:"allocation_pool_end"`
GatewayIp string `json:"gateway_ip"`
}
type NetworkInterface ¶
type NetworkInterface struct {
Id Id `json:"id"`
PrivateIp string `json:"private_ip"`
MacAddress string `json:"mac_address"`
Network *Network `json:"network"`
AttachedElasticIp *ElasticIp `json:"attached_elastic_ip"`
SecurityGroups []*SecurityGroup `json:"security_groups"`
Security bool `json:"security"`
}
type NetworkInterfaceCreate ¶
type NetworkInterfaceService ¶
type NetworkInterfaceService interface {
List(ctx context.Context, options PaginationOptions) ([]*NetworkInterface, *Response, error)
Create(ctx context.Context, data *NetworkInterfaceCreate) (*NetworkInterface, *Response, error)
Delete(ctx context.Context, id Id) (*Response, error)
}
type NetworkService ¶
type NetworkService interface {
List(ctx context.Context, options PaginationOptions) ([]*Network, *Response, error)
Get(ctx context.Context, id Id) (*Network, *Response, error)
Create(ctx context.Context, data *NetworkCreate) (*Network, *Response, error)
Delete(ctx context.Context, id Id) (*Response, error)
}
type Order ¶
type Order struct {
Id Id `json:"id"`
Status OrderStatus `json:"status"`
}
type OrderService ¶
type OrderStatus ¶
type Pagination ¶
type PaginationOptions ¶
type Product ¶
type Product struct {
Id Id `json:"id"`
Name string `json:"product_name"`
Type ProductType `json:"type"`
Visibility string `json:"visibility"`
UsageCycle ProductUsageCycle `json:"usage_cycle"`
Items []*ProductItem `json:"items"`
Price float64 `json:"price"`
Availability []ProductAvailability `json:"availability"`
Category string `json:"category"`
DeploymentFees []*DeploymentFee `json:"deployment_fees"`
}
func (*Product) AvailableAt ¶
func (*Product) FindItem ¶
func (p *Product) FindItem(id Id) *ProductItem
type ProductAvailability ¶
type ProductItem ¶
type ProductService ¶
type ProductType ¶
type ProductUsageCycle ¶
type Response ¶
type Response struct {
*http.Response
Pagination
}
type SecurityGroup ¶
type Server ¶
type Server struct {
Id Id `json:"id"`
Name string `json:"name"`
Status ServerStatus `json:"status"`
Image Image `json:"image"`
Product Product `json:"product"`
Location Location `json:"location"`
Networks []*ServerNetworkAttachment `json:"networks"`
KeyPair KeyPair `json:"key_pair"`
}
func (*Server) GetFirstPublicIp ¶
type ServerAction ¶
type ServerAttachmentService ¶
type ServerAttachmentService interface {
ListAttachedElasticIps(ctx context.Context, server Id, options PaginationOptions) ([]*ElasticIp, *Response, error)
AttachElasticIp(ctx context.Context, server Id, data *AttachElasticIp) (*ElasticIp, *Response, error)
DetachElasticIp(ctx context.Context, server Id, elasticIp Id) (*Response, error)
}
type ServerCreate ¶
type ServerCreate struct {
Name string `json:"name"`
LocationId Id `json:"location_id"`
ImageId Id `json:"image_id"`
ProductId Id `json:"product_id"`
AttachExternalIp bool `json:"attach_external_ip"`
NetworkId Id `json:"network_id"`
PrivateIp string `json:"private_ip,omitempty"`
KeyPairId Id `json:"key_pair_id,omitempty"`
Password string `json:"password,omitempty"`
CloudInit string `json:"cloud_init,omitempty"`
}
type ServerNetworkAttachment ¶
type ServerNetworkAttachment struct {
Network
Interfaces []AttachedNetworkInterface `json:"network_interfaces"`
}
type ServerService ¶
type ServerService interface {
List(ctx context.Context, options PaginationOptions) ([]*Server, *Response, error)
Get(ctx context.Context, id Id) (*Server, *Response, error)
Create(ctx context.Context, data *ServerCreate) (*Ordering, *Response, error)
Update(ctx context.Context, id Id) (*Server, *Response, error)
Delete(ctx context.Context, id Id) (*Response, error)
RunAction(ctx context.Context, id Id, command string) (*Server, *Response, error)
}
type ServerStatus ¶
type ServerStatus struct {
Id Id `json:"id"`
Name string `json:"name"`
Key string `json:"key"`
Actions []ServerAction `json:"actions"`
}
type SnaphostStatusKey ¶ added in v0.0.1
type SnaphostStatusKey = string
const ( SnapshotStatusKeyAvailable SnaphostStatusKey = "available" SnapshotStatusKeyCreating SnaphostStatusKey = "creating" SnapshotStatusKeyError SnaphostStatusKey = "error" )
type Snapshot ¶
type Snapshot struct {
Id Id `json:"id"`
Name string `json:"name"`
Size int `json:"size"`
Status Status `json:"status"`
Volume Volume `json:"volume"`
Product Product `json:"product"`
CreatedAt DateTime `json:"created_at"`
}
func (*Snapshot) IsAvailable ¶ added in v0.0.1
type SnapshotCreate ¶
type SnapshotService ¶
type SnapshotService interface {
Get(ctx context.Context, snapshotId Id) (*Snapshot, *Response, error)
List(ctx context.Context, options PaginationOptions) ([]*Snapshot, *Response, error)
Create(ctx context.Context, data *SnapshotCreate) (*Snapshot, *Response, error)
Delete(ctx context.Context, snapshotId Id) (*Response, error)
}
type SystemError ¶
type SystemError string
func (SystemError) Error ¶
func (e SystemError) Error() string
type Volume ¶
type Volume struct {
Id Id `json:"id"`
Product Product `json:"product"`
Location Location `json:"location"`
Status VolumeStatus `json:"status"`
Name string `json:"name"`
Size int `json:"size"`
SerialNumber string `json:"serial"`
Snapshots int `json:"snapshots"`
Bootable bool `json:"bootable"`
RootVolume bool `json:"root_volume"`
AttachedTo *Server `json:"instance"`
CreatedAt DateTime `json:"created_at"`
}
type VolumeActionService ¶
type VolumeAttach ¶
type VolumeAttach struct {
ServerId Id `json:"instance_id"`
}
type VolumeCreate ¶
type VolumeExpand ¶
type VolumeExpand struct {
Size int `json:"size"`
}
type VolumeService ¶
type VolumeService interface {
List(ctx context.Context, options PaginationOptions) ([]*Volume, *Response, error)
Get(ctx context.Context, id Id) (*Volume, *Response, error)
Create(ctx context.Context, data *VolumeCreate) (*Volume, *Response, error)
Delete(ctx context.Context, id Id) (*Response, error)
Expand(ctx context.Context, id Id, data *VolumeExpand) (*Volume, *Response, error)
}
type VolumeStatus ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.