Documentation
¶
Overview ¶
Package metadata implements a client for the cloudscale.ch's OpenStack metadata API. This API allows a server to inspect information about itself, like its server ID.
Documentation for the API is available at:
https://www.cloudscale.ch/en/api/v1
Index ¶
- Constants
- Variables
- func CheckResponse(r *http.Response) error
- type Address
- type AddressRequest
- type BucketMetrics
- type BucketMetricsData
- type BucketMetricsDataSubject
- type BucketMetricsInterval
- type BucketMetricsIntervalUsage
- type BucketMetricsRequest
- type Client
- type CustomImage
- type CustomImageImport
- type CustomImageImportRequest
- type CustomImageImportsService
- type CustomImageRequest
- type CustomImageService
- type CustomImageServiceOperations
- type CustomImageStub
- type ErrorResponse
- type Flavor
- type FloatingIP
- type FloatingIPCreateRequest
- type FloatingIPUpdateRequest
- type FloatingIPsService
- type GenericCreateService
- type GenericDeleteService
- type GenericGetService
- type GenericListService
- type GenericServiceOperations
- func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Create(ctx context.Context, createRequest *TCreateRequest) (*TResource, error)
- func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Delete(ctx context.Context, resourceID string) error
- func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Get(ctx context.Context, resourceID string) (*TResource, error)
- func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) List(ctx context.Context, modifiers ...ListRequestModifier) ([]TResource, error)
- func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Update(ctx context.Context, resourceID string, updateRequest *TUpdateRequest) error
- func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) WaitFor(ctx context.Context, resourceID string, ...) (*TResource, error)
- type GenericUpdateService
- type GenericWaitForService
- type Image
- type Interface
- type InterfaceRequest
- type ListRequestModifier
- type LoadBalancer
- type LoadBalancerFlavorStub
- type LoadBalancerHealthMonitor
- type LoadBalancerHealthMonitorHTTP
- type LoadBalancerHealthMonitorHTTPRequest
- type LoadBalancerHealthMonitorRequest
- type LoadBalancerHealthMonitorService
- type LoadBalancerListener
- type LoadBalancerListenerRequest
- type LoadBalancerListenerService
- type LoadBalancerPool
- type LoadBalancerPoolMember
- type LoadBalancerPoolMemberRequest
- type LoadBalancerPoolMemberService
- type LoadBalancerPoolMemberServiceOperations
- func (l LoadBalancerPoolMemberServiceOperations) Create(ctx context.Context, poolID string, ...) (*LoadBalancerPoolMember, error)
- func (l LoadBalancerPoolMemberServiceOperations) Delete(ctx context.Context, poolID string, resourceID string) error
- func (l LoadBalancerPoolMemberServiceOperations) Get(ctx context.Context, poolID string, resourceID string) (*LoadBalancerPoolMember, error)
- func (l LoadBalancerPoolMemberServiceOperations) List(ctx context.Context, poolID string, modifiers ...ListRequestModifier) ([]LoadBalancerPoolMember, error)
- func (l LoadBalancerPoolMemberServiceOperations) Update(ctx context.Context, poolID string, resourceID string, ...) error
- func (l LoadBalancerPoolMemberServiceOperations) WaitFor(ctx context.Context, poolID string, resourceID string, ...) (*LoadBalancerPoolMember, error)
- type LoadBalancerPoolRequest
- type LoadBalancerPoolService
- type LoadBalancerPoolStub
- type LoadBalancerRequest
- type LoadBalancerService
- type LoadBalancerStub
- type Metadata
- type MetadataClient
- type MetricsService
- type MetricsServiceOperations
- type Network
- type NetworkCreateRequest
- type NetworkService
- type NetworkServiceOperations
- type NetworkStub
- type NetworkUpdateRequest
- type ObjectsUser
- type ObjectsUserRequest
- type ObjectsUsersService
- type Region
- type RegionService
- type RegionServiceOperations
- type RegionalResource
- type RegionalResourceRequest
- type Server
- type ServerGroup
- type ServerGroupRequest
- type ServerGroupService
- type ServerGroupStub
- type ServerRequest
- type ServerService
- type ServerServiceOperations
- func (s ServerServiceOperations) Reboot(ctx context.Context, serverID string) error
- func (s ServerServiceOperations) Start(ctx context.Context, serverID string) error
- func (s ServerServiceOperations) Stop(ctx context.Context, serverID string) error
- func (s ServerServiceOperations) Update(ctx context.Context, id string, req *ServerUpdateRequest) error
- type ServerStub
- type ServerUpdateRequest
- type ServerVolumeRequest
- type Subnet
- type SubnetCreateRequest
- type SubnetService
- type SubnetServiceOperations
- type SubnetStub
- type SubnetUpdateRequest
- type TagMap
- type TaggedResource
- type TaggedResourceRequest
- type VIPAddress
- type VIPAddressRequest
- type Volume
- type VolumeRequest
- type VolumeService
- type VolumeStub
- type ZonalResource
- type ZonalResourceRequest
- type Zone
Constants ¶
const ServerRebooted = "rebooted"
const ServerRunning = "running"
const ServerStopped = "stopped"
const UserDataHandlingExtendCloudConfig = "extend-cloud-config"
const UserDataHandlingPassThrough = "pass-through"
Variables ¶
var ImportIsSuccessful = func(importInfo *CustomImageImport) (bool, error) { if importInfo.Status == "success" { return true, nil } return false, fmt.Errorf("waiting for status: %s, current status: %s", "success", importInfo.Status) }
var LoadBalancerIsRunning = func(lb *LoadBalancer) (bool, error) { if lb.Status == "running" { return true, nil } return false, fmt.Errorf("waiting for status: %s, current status: %s", "running", lb.Status) }
var LoadBalancerPoolMemberIsUp = func(member *LoadBalancerPoolMember) (bool, error) { if member.MonitorStatus == "up" { return true, nil } return false, fmt.Errorf("waiting for monitor status: %s, current status: %s", "up", member.MonitorStatus) }
var ServerIsRunning = func(server *Server) (bool, error) { if server.Status == ServerRunning { return true, nil } return false, fmt.Errorf("waiting for status: %s, current status: %s", ServerRunning, server.Status) }
var ServerIsStopped = func(server *Server) (bool, error) { if server.Status == ServerStopped { return true, nil } return false, fmt.Errorf("waiting for status: %s, current status: %s", ServerStopped, server.Status) }
var UseCloudscaleDefaults = []string{"CLOUDSCALE_DEFAULTS"}
Functions ¶
func CheckResponse ¶
Types ¶
type AddressRequest ¶
type BucketMetrics ¶
type BucketMetrics struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
Data []BucketMetricsData
}
type BucketMetricsData ¶
type BucketMetricsData struct {
Subject BucketMetricsDataSubject `json:"subject"`
TimeSeries []BucketMetricsInterval `json:"time_series"`
}
type BucketMetricsInterval ¶
type BucketMetricsInterval struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
Usage BucketMetricsIntervalUsage `json:"usage"`
}
type BucketMetricsRequest ¶
type BucketMetricsRequest struct {
// Interpreted as midnight in the Europe/Zurich time zone at the start of
// the day represented by the day of the passed value in the UTC time zone.
Start time.Time
// Interpreted as midnight in the Europe/Zurich time zone at the end of
// the day represented by the day of the passed value in the UTC time zone.
End time.Time
BucketNames []string
ObjectsUserIDs []string
}
type Client ¶
type Client struct {
// Base URL for API requests.
BaseURL *url.URL
// Authentication token
AuthToken string
// User agent for client
UserAgent string
Regions RegionService
Servers ServerService
Volumes VolumeService
Networks NetworkService
Subnets SubnetService
FloatingIPs FloatingIPsService
ServerGroups ServerGroupService
ObjectsUsers ObjectsUsersService
CustomImages CustomImageService
CustomImageImports CustomImageImportsService
LoadBalancers LoadBalancerService
LoadBalancerPools LoadBalancerPoolService
LoadBalancerPoolMembers LoadBalancerPoolMemberService
LoadBalancerListeners LoadBalancerListenerService
LoadBalancerHealthMonitors LoadBalancerHealthMonitorService
Metrics MetricsService
// contains filtered or unexported fields
}
Client manages communication with CloudScale API.
type CustomImage ¶
type CustomImage struct {
ZonalResource
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
SizeGB int `json:"size_gb,omitempty"`
Checksums map[string]string `json:"checksums,omitempty"`
UserDataHandling string `json:"user_data_handling,omitempty"`
FirmwareType string `json:"firmware_type,omitempty"`
Zones []Zone `json:"zones"`
CreatedAt time.Time `json:"created_at"`
}
type CustomImageImport ¶
type CustomImageImport struct {
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
CustomImage CustomImageStub `json:"custom_image,omitempty"`
URL string `json:"url,omitempty"`
Status string `json:"status,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
}
type CustomImageImportRequest ¶
type CustomImageImportRequest struct {
TaggedResourceRequest
URL string `json:"url,omitempty"`
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
UserDataHandling string `json:"user_data_handling,omitempty"`
FirmwareType string `json:"firmware_type,omitempty"`
SourceFormat string `json:"source_format,omitempty"`
Zones []string `json:"zones,omitempty"`
}
type CustomImageImportsService ¶
type CustomImageImportsService interface {
GenericCreateService[CustomImageImport, CustomImageImportRequest]
GenericGetService[CustomImageImport]
GenericListService[CustomImageImport]
GenericWaitForService[CustomImageImport]
}
type CustomImageRequest ¶
type CustomImageRequest struct {
TaggedResourceRequest
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
UserDataHandling string `json:"user_data_handling,omitempty"`
}
type CustomImageService ¶
type CustomImageService interface {
GenericGetService[CustomImage]
GenericListService[CustomImage]
GenericUpdateService[CustomImage, CustomImageRequest]
GenericDeleteService[CustomImage]
GenericWaitForService[CustomImage]
}
type CustomImageServiceOperations ¶
type CustomImageServiceOperations struct {
// contains filtered or unexported fields
}
type CustomImageStub ¶
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type FloatingIP ¶
type FloatingIP struct {
Region *Region `json:"region"` // not using RegionalResource here, as FloatingIP can be regional or global
TaggedResource
HREF string `json:"href"`
Network string `json:"network"`
IPVersion int `json:"ip_version"`
NextHop string `json:"next_hop"`
Server *ServerStub `json:"server"`
LoadBalancer *LoadBalancerStub `json:"load_balancer"`
Type string `json:"type"`
ReversePointer string `json:"reverse_ptr,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
func (FloatingIP) IP ¶
func (f FloatingIP) IP() string
func (FloatingIP) PrefixLength ¶
func (f FloatingIP) PrefixLength() int
type FloatingIPCreateRequest ¶
type FloatingIPCreateRequest struct {
RegionalResourceRequest
TaggedResourceRequest
IPVersion int `json:"ip_version"`
Server string `json:"server,omitempty"`
LoadBalancer string `json:"load_balancer,omitempty"`
Type string `json:"type,omitempty"`
PrefixLength int `json:"prefix_length,omitempty"`
ReversePointer string `json:"reverse_ptr,omitempty"`
}
type FloatingIPUpdateRequest ¶
type FloatingIPUpdateRequest struct {
TaggedResourceRequest
Server string `json:"server,omitempty"`
LoadBalancer string `json:"load_balancer,omitempty"`
ReversePointer string `json:"reverse_ptr,omitempty"`
}
type FloatingIPsService ¶
type FloatingIPsService interface {
GenericCreateService[FloatingIP, FloatingIPCreateRequest]
GenericGetService[FloatingIP]
GenericListService[FloatingIP]
GenericUpdateService[FloatingIP, FloatingIPUpdateRequest]
GenericDeleteService[FloatingIP]
GenericWaitForService[FloatingIP]
}
type GenericCreateService ¶
type GenericDeleteService ¶
type GenericGetService ¶
type GenericListService ¶
type GenericListService[TResource any] interface { List(ctx context.Context, modifiers ...ListRequestModifier) ([]TResource, error) }
type GenericServiceOperations ¶
type GenericServiceOperations[TResource any, TCreateRequest any, TUpdateRequest any] struct { // contains filtered or unexported fields }
func (GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Create ¶
func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Create(ctx context.Context, createRequest *TCreateRequest) (*TResource, error)
func (GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Delete ¶
func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Delete(ctx context.Context, resourceID string) error
func (GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Get ¶
func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Get(ctx context.Context, resourceID string) (*TResource, error)
func (GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) List ¶
func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) List(ctx context.Context, modifiers ...ListRequestModifier) ([]TResource, error)
func (GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Update ¶
func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) Update(ctx context.Context, resourceID string, updateRequest *TUpdateRequest) error
func (GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) WaitFor ¶
func (g GenericServiceOperations[TResource, TCreateRequest, TUpdateRequest]) WaitFor( ctx context.Context, resourceID string, condition func(resource *TResource) (bool, error), opts ...backoff.RetryOption, ) (*TResource, error)
type GenericUpdateService ¶
type GenericWaitForService ¶
type Interface ¶
type Interface struct {
Type string `json:"type,omitempty"`
Network NetworkStub `json:"network,omitempty"`
Addresses []Address `json:"addresses,omitempty"`
}
type InterfaceRequest ¶
type InterfaceRequest struct {
Network string `json:"network,omitempty"`
Addresses *[]AddressRequest `json:"addresses,omitempty"`
}
type ListRequestModifier ¶
func WithNameFilter ¶
func WithNameFilter(name string) ListRequestModifier
WithNameFilter uses an undocumented feature of the cloudscale.ch API
func WithTagFilter ¶
func WithTagFilter(tags TagMap) ListRequestModifier
type LoadBalancer ¶
type LoadBalancer struct {
ZonalResource
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
Flavor LoadBalancerFlavorStub `json:"flavor,omitempty"`
Status string `json:"status,omitempty"`
VIPAddresses []VIPAddress `json:"vip_addresses,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
type LoadBalancerFlavorStub ¶
type LoadBalancerHealthMonitor ¶
type LoadBalancerHealthMonitor struct {
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Pool LoadBalancerPoolStub `json:"pool,omitempty"`
LoadBalancer LoadBalancerStub `json:"load_balancer,omitempty"`
DelayS int `json:"delay_s,omitempty"`
TimeoutS int `json:"timeout_s,omitempty"`
UpThreshold int `json:"up_threshold,omitempty"`
DownThreshold int `json:"down_threshold,omitempty"`
Type string `json:"type,omitempty"`
HTTP *LoadBalancerHealthMonitorHTTP `json:"http,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
type LoadBalancerHealthMonitorRequest ¶
type LoadBalancerHealthMonitorRequest struct {
TaggedResourceRequest
Pool string `json:"pool,omitempty"`
DelayS int `json:"delay_s,omitempty"`
TimeoutS int `json:"timeout_s,omitempty"`
UpThreshold int `json:"up_threshold,omitempty"`
DownThreshold int `json:"down_threshold,omitempty"`
Type string `json:"type,omitempty"`
HTTP *LoadBalancerHealthMonitorHTTPRequest `json:"http,omitempty"`
}
type LoadBalancerHealthMonitorService ¶
type LoadBalancerHealthMonitorService interface {
GenericCreateService[LoadBalancerHealthMonitor, LoadBalancerHealthMonitorRequest]
GenericGetService[LoadBalancerHealthMonitor]
GenericListService[LoadBalancerHealthMonitor]
GenericUpdateService[LoadBalancerHealthMonitor, LoadBalancerHealthMonitorRequest]
GenericDeleteService[LoadBalancerHealthMonitor]
GenericWaitForService[LoadBalancerHealthMonitor]
}
type LoadBalancerListener ¶
type LoadBalancerListener struct {
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
Pool *LoadBalancerPoolStub `json:"pool,omitempty"`
LoadBalancer LoadBalancerStub `json:"load_balancer,omitempty"`
Protocol string `json:"protocol,omitempty"`
ProtocolPort int `json:"protocol_port,omitempty"`
AllowedCIDRs []string `json:"allowed_cidrs,omitempty"`
TimeoutClientDataMS int `json:"timeout_client_data_ms,omitempty"`
TimeoutMemberConnectMS int `json:"timeout_member_connect_ms,omitempty"`
TimeoutMemberDataMS int `json:"timeout_member_data_ms,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
type LoadBalancerListenerRequest ¶
type LoadBalancerListenerRequest struct {
TaggedResourceRequest
Name string `json:"name,omitempty"`
Pool string `json:"pool,omitempty"`
Protocol string `json:"protocol,omitempty"`
ProtocolPort int `json:"protocol_port,omitempty"`
AllowedCIDRs *[]string `json:"allowed_cidrs,omitempty"`
TimeoutClientDataMS int `json:"timeout_client_data_ms,omitempty"`
TimeoutMemberConnectMS int `json:"timeout_member_connect_ms,omitempty"`
TimeoutMemberDataMS int `json:"timeout_member_data_ms,omitempty"`
}
type LoadBalancerListenerService ¶
type LoadBalancerListenerService interface {
GenericCreateService[LoadBalancerListener, LoadBalancerListenerRequest]
GenericGetService[LoadBalancerListener]
GenericListService[LoadBalancerListener]
GenericUpdateService[LoadBalancerListener, LoadBalancerListenerRequest]
GenericDeleteService[LoadBalancerListener]
GenericWaitForService[LoadBalancerListener]
}
type LoadBalancerPool ¶
type LoadBalancerPool struct {
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
LoadBalancer LoadBalancerStub `json:"load_balancer,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
Protocol string `json:"protocol,omitempty"`
}
type LoadBalancerPoolMember ¶
type LoadBalancerPoolMember struct {
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
Enabled bool `json:"enabled,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
Pool LoadBalancerPoolStub `json:"pool,omitempty"`
LoadBalancer LoadBalancerStub `json:"load_balancer,omitempty"`
ProtocolPort int `json:"protocol_port,omitempty"`
MonitorPort int `json:"monitor_port,omitempty"`
Address string `json:"address,omitempty"`
Subnet SubnetStub `json:"subnet,omitempty"`
MonitorStatus string `json:"monitor_status,omitempty"`
}
type LoadBalancerPoolMemberRequest ¶
type LoadBalancerPoolMemberRequest struct {
TaggedResourceRequest
Name string `json:"name,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
ProtocolPort int `json:"protocol_port,omitempty"`
MonitorPort int `json:"monitor_port,omitempty"`
Address string `json:"address,omitempty"`
Subnet string `json:"subnet,omitempty"`
}
type LoadBalancerPoolMemberService ¶
type LoadBalancerPoolMemberService interface {
Create(ctx context.Context, poolID string, createRequest *LoadBalancerPoolMemberRequest) (*LoadBalancerPoolMember, error)
Get(ctx context.Context, poolID string, resourceID string) (*LoadBalancerPoolMember, error)
List(ctx context.Context, poolID string, modifiers ...ListRequestModifier) ([]LoadBalancerPoolMember, error)
Update(ctx context.Context, poolID string, resourceID string, updateRequest *LoadBalancerPoolMemberRequest) error
Delete(ctx context.Context, poolID string, resourceID string) error
WaitFor(ctx context.Context, poolID string, resourceID string, condition func(resource *LoadBalancerPoolMember) (bool, error), opts ...backoff.RetryOption) (*LoadBalancerPoolMember, error)
}
type LoadBalancerPoolMemberServiceOperations ¶
type LoadBalancerPoolMemberServiceOperations struct {
// contains filtered or unexported fields
}
func (LoadBalancerPoolMemberServiceOperations) Create ¶
func (l LoadBalancerPoolMemberServiceOperations) Create(ctx context.Context, poolID string, createRequest *LoadBalancerPoolMemberRequest) (*LoadBalancerPoolMember, error)
func (LoadBalancerPoolMemberServiceOperations) Get ¶
func (l LoadBalancerPoolMemberServiceOperations) Get(ctx context.Context, poolID string, resourceID string) (*LoadBalancerPoolMember, error)
func (LoadBalancerPoolMemberServiceOperations) List ¶
func (l LoadBalancerPoolMemberServiceOperations) List(ctx context.Context, poolID string, modifiers ...ListRequestModifier) ([]LoadBalancerPoolMember, error)
func (LoadBalancerPoolMemberServiceOperations) Update ¶
func (l LoadBalancerPoolMemberServiceOperations) Update(ctx context.Context, poolID string, resourceID string, updateRequest *LoadBalancerPoolMemberRequest) error
func (LoadBalancerPoolMemberServiceOperations) WaitFor ¶
func (l LoadBalancerPoolMemberServiceOperations) WaitFor( ctx context.Context, poolID string, resourceID string, condition func(resource *LoadBalancerPoolMember) (bool, error), opts ...backoff.RetryOption, ) (*LoadBalancerPoolMember, error)
type LoadBalancerPoolRequest ¶
type LoadBalancerPoolRequest struct {
TaggedResourceRequest
Name string `json:"name,omitempty"`
LoadBalancer string `json:"load_balancer,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
Protocol string `json:"protocol,omitempty"`
}
type LoadBalancerPoolService ¶
type LoadBalancerPoolService interface {
GenericCreateService[LoadBalancerPool, LoadBalancerPoolRequest]
GenericGetService[LoadBalancerPool]
GenericListService[LoadBalancerPool]
GenericUpdateService[LoadBalancerPool, LoadBalancerPoolRequest]
GenericDeleteService[LoadBalancerPool]
GenericWaitForService[LoadBalancerPool]
}
type LoadBalancerPoolStub ¶
type LoadBalancerRequest ¶
type LoadBalancerRequest struct {
ZonalResourceRequest
TaggedResourceRequest
Name string `json:"name,omitempty"`
Flavor string `json:"flavor,omitempty"`
VIPAddresses *[]VIPAddressRequest `json:"vip_addresses,omitempty"`
}
type LoadBalancerService ¶
type LoadBalancerService interface {
GenericCreateService[LoadBalancer, LoadBalancerRequest]
GenericGetService[LoadBalancer]
GenericListService[LoadBalancer]
GenericUpdateService[LoadBalancer, LoadBalancerRequest]
GenericDeleteService[LoadBalancer]
GenericWaitForService[LoadBalancer]
}
type LoadBalancerStub ¶
type MetadataClient ¶
Client to interact with cloudscale.ch's OpenStack metadata API, from inside a server.
func NewMetadataClient ¶
func NewMetadataClient(httpClient *http.Client) *MetadataClient
NewClient creates a client for the metadata API.
func (*MetadataClient) GetMetadata ¶
func (c *MetadataClient) GetMetadata() (*Metadata, error)
Metadata contains the entire contents of a OpenStack's metadata. This method is unique because it returns all of the metadata at once, instead of individual metadata items.
func (*MetadataClient) GetRawUserData ¶
func (c *MetadataClient) GetRawUserData() (string, error)
RawUserData returns the user data that was provided by the user during Server creation. User data for cloudscale.ch is a YAML Script that is used for cloud-init.
func (*MetadataClient) GetServerID ¶
func (c *MetadataClient) GetServerID() (string, error)
ServerID returns the Server's unique identifier. This is automatically generated upon Server creation.
type MetricsService ¶
type MetricsService interface {
GetBucketMetrics(ctx context.Context, request *BucketMetricsRequest) (*BucketMetrics, error)
}
type MetricsServiceOperations ¶
type MetricsServiceOperations struct {
// contains filtered or unexported fields
}
func (MetricsServiceOperations) GetBucketMetrics ¶
func (s MetricsServiceOperations) GetBucketMetrics(ctx context.Context, request *BucketMetricsRequest) (*BucketMetrics, error)
type Network ¶
type Network struct {
ZonalResource
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
MTU int `json:"mtu,omitempty"`
Subnets []SubnetStub `json:"subnets"`
CreatedAt time.Time `json:"created_at"`
}
type NetworkCreateRequest ¶
type NetworkCreateRequest struct {
ZonalResourceRequest
TaggedResourceRequest
Name string `json:"name,omitempty"`
MTU int `json:"mtu,omitempty"`
AutoCreateIPV4Subnet *bool `json:"auto_create_ipv4_subnet,omitempty"`
}
type NetworkService ¶
type NetworkService interface {
GenericCreateService[Network, NetworkCreateRequest]
GenericGetService[Network]
GenericListService[Network]
GenericUpdateService[Network, NetworkUpdateRequest]
GenericDeleteService[Network]
GenericWaitForService[Network]
}
type NetworkServiceOperations ¶
type NetworkServiceOperations struct {
// contains filtered or unexported fields
}
type NetworkStub ¶
type NetworkUpdateRequest ¶
type NetworkUpdateRequest struct {
ZonalResourceRequest
TaggedResourceRequest
Name string `json:"name,omitempty"`
MTU int `json:"mtu,omitempty"`
}
type ObjectsUser ¶
type ObjectsUser struct {
TaggedResource
HREF string `json:"href,omitempty"`
ID string `json:"id,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Keys []map[string]string `json:"keys,omitempty"`
}
ObjectsUser contains information
type ObjectsUserRequest ¶
type ObjectsUserRequest struct {
TaggedResourceRequest
DisplayName string `json:"display_name,omitempty"`
}
ObjectsUserRequest is used to create and update Objects Users
type ObjectsUsersService ¶
type ObjectsUsersService interface {
GenericCreateService[ObjectsUser, ObjectsUserRequest]
GenericGetService[ObjectsUser]
GenericListService[ObjectsUser]
GenericUpdateService[ObjectsUser, ObjectsUserRequest]
GenericDeleteService[ObjectsUser]
GenericWaitForService[ObjectsUser]
}
ObjectsUsersService manages users of the S3-compatible objects storage
type RegionServiceOperations ¶
type RegionServiceOperations struct {
// contains filtered or unexported fields
}
type RegionalResource ¶
type RegionalResource struct {
Region Region `json:"Region"`
}
type RegionalResourceRequest ¶
type RegionalResourceRequest struct {
Region string `json:"region,omitempty"`
}
type Server ¶
type Server struct {
ZonalResource
TaggedResource
HREF string `json:"href"`
UUID string `json:"uuid"`
Name string `json:"name"`
Status string `json:"status"`
Flavor Flavor `json:"flavor"`
Image Image `json:"image"`
Volumes []VolumeStub `json:"volumes"`
Interfaces []Interface `json:"interfaces"`
SSHFingerprints []string `json:"ssh_fingerprints"`
SSHHostKeys []string `json:"ssh_host_keys"`
AntiAfinityWith []ServerStub `json:"anti_affinity_with"`
ServerGroups []ServerGroupStub `json:"server_groups"`
CreatedAt time.Time `json:"created_at"`
}
type ServerGroup ¶
type ServerGroup struct {
ZonalResource
TaggedResource
HREF string `json:"href"`
UUID string `json:"uuid"`
Name string `json:"name"`
Type string `json:"type"`
Servers []ServerStub `json:"servers"`
}
type ServerGroupRequest ¶
type ServerGroupRequest struct {
ZonalResourceRequest
TaggedResourceRequest
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
}
type ServerGroupService ¶
type ServerGroupService interface {
GenericCreateService[ServerGroup, ServerGroupRequest]
GenericGetService[ServerGroup]
GenericListService[ServerGroup]
GenericUpdateService[ServerGroup, ServerGroupRequest]
GenericDeleteService[ServerGroup]
GenericWaitForService[ServerGroup]
}
type ServerGroupStub ¶
type ServerRequest ¶
type ServerRequest struct {
ZonalResourceRequest
TaggedResourceRequest
Name string `json:"name"`
Flavor string `json:"flavor"`
Image string `json:"image"`
Zone string `json:"zone,omitempty"`
VolumeSizeGB int `json:"volume_size_gb,omitempty"`
Volumes *[]ServerVolumeRequest `json:"volumes,omitempty"`
Interfaces *[]InterfaceRequest `json:"interfaces,omitempty"`
BulkVolumeSizeGB int `json:"bulk_volume_size_gb,omitempty"`
SSHKeys []string `json:"ssh_keys"`
Password string `json:"password,omitempty"`
UsePublicNetwork *bool `json:"use_public_network,omitempty"`
UsePrivateNetwork *bool `json:"use_private_network,omitempty"`
UseIPV6 *bool `json:"use_ipv6,omitempty"`
AntiAffinityWith string `json:"anti_affinity_with,omitempty"`
ServerGroups []string `json:"server_groups,omitempty"`
UserData string `json:"user_data,omitempty"`
}
type ServerService ¶
type ServerService interface {
GenericCreateService[Server, ServerRequest]
GenericGetService[Server]
GenericListService[Server]
GenericUpdateService[Server, ServerUpdateRequest]
GenericDeleteService[Server]
GenericWaitForService[Server]
Reboot(ctx context.Context, serverID string) error
Start(ctx context.Context, serverID string) error
Stop(ctx context.Context, serverID string) error
}
type ServerServiceOperations ¶
type ServerServiceOperations struct {
GenericServiceOperations[Server, ServerRequest, ServerUpdateRequest]
// contains filtered or unexported fields
}
func (ServerServiceOperations) Reboot ¶
func (s ServerServiceOperations) Reboot(ctx context.Context, serverID string) error
func (ServerServiceOperations) Start ¶
func (s ServerServiceOperations) Start(ctx context.Context, serverID string) error
func (ServerServiceOperations) Stop ¶
func (s ServerServiceOperations) Stop(ctx context.Context, serverID string) error
func (ServerServiceOperations) Update ¶
func (s ServerServiceOperations) Update(ctx context.Context, id string, req *ServerUpdateRequest) error
type ServerStub ¶
type ServerUpdateRequest ¶
type ServerUpdateRequest struct {
TaggedResourceRequest
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
Flavor string `json:"flavor,omitempty"`
Interfaces *[]InterfaceRequest `json:"interfaces,omitempty"`
}
type ServerVolumeRequest ¶
type Subnet ¶
type Subnet struct {
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
CIDR string `json:"cidr,omitempty"`
Network NetworkStub `json:"network,omitempty"`
GatewayAddress string `json:"gateway_address,omitempty"`
DNSServers []string `json:"dns_servers,omitempty"`
}
type SubnetCreateRequest ¶
type SubnetCreateRequest struct {
TaggedResourceRequest
CIDR string `json:"cidr,omitempty"`
Network string `json:"network,omitempty"`
GatewayAddress string `json:"gateway_address,omitempty"`
DNSServers *[]string `json:"dns_servers,omitempty"`
}
func (SubnetCreateRequest) MarshalJSON ¶
func (request SubnetCreateRequest) MarshalJSON() ([]byte, error)
type SubnetService ¶
type SubnetService interface {
GenericCreateService[Subnet, SubnetCreateRequest]
GenericGetService[Subnet]
GenericListService[Subnet]
GenericUpdateService[Subnet, SubnetUpdateRequest]
GenericDeleteService[Subnet]
GenericWaitForService[Subnet]
}
type SubnetServiceOperations ¶
type SubnetServiceOperations struct {
// contains filtered or unexported fields
}
type SubnetStub ¶
type SubnetUpdateRequest ¶
type SubnetUpdateRequest struct {
TaggedResourceRequest
GatewayAddress string `json:"gateway_address,omitempty"`
DNSServers *[]string `json:"dns_servers"`
}
func (SubnetUpdateRequest) MarshalJSON ¶
func (request SubnetUpdateRequest) MarshalJSON() ([]byte, error)
type TaggedResource ¶
type TaggedResource struct {
Tags TagMap `json:"tags"`
}
type TaggedResourceRequest ¶
type TaggedResourceRequest struct {
Tags *TagMap `json:"tags,omitempty"`
}
type VIPAddress ¶
type VIPAddress struct {
Version int `json:"version,omitempty"`
Address string `json:"address,omitempty"`
Subnet SubnetStub `json:"subnet,omitempty"`
}
type VIPAddressRequest ¶
type Volume ¶
type Volume struct {
ZonalResource
TaggedResource
// Just use omitempty everywhere. This makes it easy to use restful. Errors
// will be coming from the API if something is disabled.
HREF string `json:"href,omitempty"`
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
SizeGB int `json:"size_gb,omitempty"`
Type string `json:"type,omitempty"`
ServerUUIDs *[]string `json:"server_uuids,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type VolumeRequest ¶
type VolumeRequest struct {
ZonalResourceRequest
TaggedResourceRequest
Name string `json:"name,omitempty"`
SizeGB int `json:"size_gb,omitempty"`
Type string `json:"type,omitempty"`
ServerUUIDs *[]string `json:"server_uuids,omitempty"`
}
type VolumeService ¶
type VolumeService interface {
GenericCreateService[Volume, VolumeRequest]
GenericGetService[Volume]
GenericListService[Volume]
GenericUpdateService[Volume, VolumeRequest]
GenericDeleteService[Volume]
GenericWaitForService[Volume]
}
type VolumeStub ¶
type ZonalResource ¶
type ZonalResource struct {
Zone Zone `json:"zone"`
}
type ZonalResourceRequest ¶
type ZonalResourceRequest struct {
Zone string `json:"zone,omitempty"`
}
Source Files
¶
- cloudscale.go
- custom_image_imports.go
- custom_images.go
- floating_ips.go
- generic_service.go
- load_balancer_health_monitors.go
- load_balancer_listeners.go
- load_balancer_pool_members.go
- load_balancer_pools.go
- load_balancers.go
- metadata.go
- metadata_json.go
- metrics.go
- networks.go
- objects_users.go
- regional_resources.go
- regions.go
- server_groups.go
- servers.go
- subnets.go
- tags.go
- volumes.go
- zonal_resources.go