cloudscale

package module
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 15 Imported by: 7

README

cloudscale.ch Go API SDK

Go Reference Tests

If you want to manage your cloudscale.ch server resources with Go, you are at the right place.

There's a possibility to specify the CLOUDSCALE_API_URL environment variable to change the default url of https://api.cloudscale.ch, but you can almost certainly use the default.

Download from Github

GO111MODULE=on go get github.com/cloudscale-ch/cloudscale-go-sdk

Testing

The test directory contains integration tests, aside from the unit tests in the root directory. While the unit tests suite runs very quickly because they don't make any network calls, this can take some time to run.

test/integration

This folder contains tests for every type of operation in the cloudscale.ch API and runs tests against it.

Since the tests are run against live data, there is a higher chance of false positives and test failures due to network issues, data changes, etc.

Run the tests using:

CLOUDSCALE_API_TOKEN="HELPIMTRAPPEDINATOKENGENERATOR" make integration

If you want to give params to go test, you can use something like this:

TESTARGS='-run FloatingIP' make integration

Releasing

To create a new release, please do the following:

  • Merge all feature branches into a release branch
  • Checkout the release branch
  • Run make NEW_VERSION=v1.x.x bump-version
  • Commit the changes
  • Merge the release branch into master
  • Create a new release on GitHub.

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

View Source
const ServerRebooted = "rebooted"
View Source
const ServerRunning = "running"
View Source
const ServerStopped = "stopped"
View Source
const UserDataHandlingExtendCloudConfig = "extend-cloud-config"
View Source
const UserDataHandlingPassThrough = "pass-through"

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

Types

type Address

type Address struct {
	Version      int        `json:"version"`
	Address      string     `json:"address"`
	PrefixLength int        `json:"prefix_length"`
	Gateway      string     `json:"gateway"`
	ReversePtr   string     `json:"reverse_ptr"`
	Subnet       SubnetStub `json:"subnet"`
}

type AddressRequest added in v1.4.0

type AddressRequest struct {
	Subnet  string `json:"subnet,omitempty"`
	Address string `json:"address,omitempty"`
}

type BucketMetrics added in v1.9.0

type BucketMetrics struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
	Data  []BucketMetricsData
}

type BucketMetricsData added in v1.9.0

type BucketMetricsData struct {
	Subject    BucketMetricsDataSubject `json:"subject"`
	TimeSeries []BucketMetricsInterval  `json:"time_series"`
}

type BucketMetricsDataSubject added in v1.9.0

type BucketMetricsDataSubject struct {
	BucketName    string `json:"name"`
	ObjectsUserID string `json:"objects_user_id"`
}

type BucketMetricsInterval added in v1.9.0

type BucketMetricsInterval struct {
	Start time.Time                  `json:"start"`
	End   time.Time                  `json:"end"`
	Usage BucketMetricsIntervalUsage `json:"usage"`
}

type BucketMetricsIntervalUsage added in v1.9.0

type BucketMetricsIntervalUsage struct {
	Requests      int `json:"requests"`
	ObjectCount   int `json:"object_count"`
	StorageBytes  int `json:"storage_bytes"`
	ReceivedBytes int `json:"received_bytes"`
	SentBytes     int `json:"sent_bytes"`
}

type BucketMetricsRequest added in v1.9.0

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
	Metrics            MetricsService
	// contains filtered or unexported fields
}

Client manages communication with CloudScale API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new CloudScale API client.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) error

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

type CustomImage added in v1.7.0

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"`
	Zones            []Zone            `json:"zones"`
	CreatedAt        time.Time         `json:"created_at"`
}

type CustomImageImport added in v1.7.0

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 added in v1.7.0

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"`
	SourceFormat     string   `json:"source_format,omitempty"`
	Zones            []string `json:"zones,omitempty"`
}

type CustomImageImportsService added in v1.7.0

type CustomImageImportsService interface {
	Create(ctx context.Context, createRequest *CustomImageImportRequest) (*CustomImageImport, error)
	Get(ctx context.Context, CustomImageImportID string) (*CustomImageImport, error)
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]CustomImageImport, error)
}

type CustomImageImportsServiceOperations added in v1.7.0

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

func (CustomImageImportsServiceOperations) Create added in v1.7.0

func (CustomImageImportsServiceOperations) Get added in v1.7.0

func (CustomImageImportsServiceOperations) List added in v1.7.0

type CustomImageRequest added in v1.7.0

type CustomImageRequest struct {
	TaggedResourceRequest
	Name             string `json:"name,omitempty"`
	Slug             string `json:"slug,omitempty"`
	UserDataHandling string `json:"user_data_handling,omitempty"`
}

type CustomImageService added in v1.7.0

type CustomImageService interface {
	Get(ctx context.Context, CustomImageID string) (*CustomImage, error)
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]CustomImage, error)
	Update(ctx context.Context, customImageID string, updateRequest *CustomImageRequest) error
	Delete(ctx context.Context, customImageID string) error
}

type CustomImageServiceOperations added in v1.7.0

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

func (CustomImageServiceOperations) Delete added in v1.7.0

func (s CustomImageServiceOperations) Delete(ctx context.Context, customImageID string) error

func (CustomImageServiceOperations) Get added in v1.7.0

func (s CustomImageServiceOperations) Get(ctx context.Context, customImageID string) (*CustomImage, error)

func (CustomImageServiceOperations) List added in v1.7.0

func (CustomImageServiceOperations) Update added in v1.7.0

func (s CustomImageServiceOperations) Update(ctx context.Context, customImageID string, updateRequest *CustomImageRequest) error

type CustomImageStub added in v1.7.0

type CustomImageStub struct {
	HREF string `json:"href,omitempty"`
	UUID string `json:"uuid,omitempty"`
	Name string `json:"name,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	StatusCode int
	Message    map[string]string
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Flavor

type Flavor struct {
	Slug      string `json:"slug"`
	Name      string `json:"name"`
	VCPUCount int    `json:"vcpu_count"`
	MemoryGB  int    `json:"memory_gb"`
}

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"`
	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 added in v1.8.0

func (f FloatingIP) PrefixLength() int

type FloatingIPCreateRequest

type FloatingIPCreateRequest struct {
	RegionalResourceRequest
	TaggedResourceRequest
	IPVersion      int    `json:"ip_version"`
	Server         string `json:"server,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"`
	ReversePointer string `json:"reverse_ptr,omitempty"`
}

type FloatingIPsService

type FloatingIPsService interface {
	Create(ctx context.Context, floatingIPRequest *FloatingIPCreateRequest) (*FloatingIP, error)
	Get(ctx context.Context, ip string) (*FloatingIP, error)
	Update(ctx context.Context, ip string, FloatingIPRequest *FloatingIPUpdateRequest) error
	Delete(ctx context.Context, ip string) error
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]FloatingIP, error)
}

type FloatingIPsServiceOperations

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

func (FloatingIPsServiceOperations) Create

func (FloatingIPsServiceOperations) Delete

func (FloatingIPsServiceOperations) Get

func (FloatingIPsServiceOperations) List

func (FloatingIPsServiceOperations) Update

func (f FloatingIPsServiceOperations) Update(ctx context.Context, ip string, floatingIPUpdateRequest *FloatingIPUpdateRequest) error

type Image

type Image struct {
	Slug            string `json:"slug"`
	Name            string `json:"name"`
	OperatingSystem string `json:"operating_system"`
}

type Interface

type Interface struct {
	Type      string      `json:"type,omitempty"`
	Network   NetworkStub `json:"network,omitempty"`
	Addresses []Address   `json:"addresses,omitempty"`
}

type InterfaceRequest added in v1.1.0

type InterfaceRequest struct {
	Network   string            `json:"network,omitempty"`
	Addresses *[]AddressRequest `json:"addresses,omitempty"`
}

type ListRequestModifier added in v1.2.0

type ListRequestModifier func(r *http.Request)

func WithNameFilter added in v1.2.0

func WithNameFilter(name string) ListRequestModifier

WithNameFilter uses an undocumented feature of the cloudscale.ch API

func WithTagFilter added in v1.2.0

func WithTagFilter(tags TagMap) ListRequestModifier

type Metadata

type Metadata struct {
	AvailabilityZone string `json:"availability_zone,omitempty"`

	Meta struct {
		CloudscaleUUID string `json:"cloudscale_uuid,omitempty"`
	} `json:"meta,omitempty"`
}

type MetadataClient

type MetadataClient struct {
	BaseURL *url.URL
	// contains filtered or unexported fields
}

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 added in v1.9.0

type MetricsService interface {
	GetBucketMetrics(ctx context.Context, request *BucketMetricsRequest) (*BucketMetrics, error)
}

type MetricsServiceOperations added in v1.9.0

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

func (MetricsServiceOperations) GetBucketMetrics added in v1.9.0

func (s MetricsServiceOperations) GetBucketMetrics(ctx context.Context, request *BucketMetricsRequest) (*BucketMetrics, error)

type Network added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

type NetworkService interface {
	Create(ctx context.Context, createRequest *NetworkCreateRequest) (*Network, error)
	Get(ctx context.Context, networkID string) (*Network, error)
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]Network, error)
	Update(ctx context.Context, networkID string, updateRequest *NetworkUpdateRequest) error
	Delete(ctx context.Context, networkID string) error
}

type NetworkServiceOperations added in v1.1.0

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

func (NetworkServiceOperations) Create added in v1.1.0

func (s NetworkServiceOperations) Create(ctx context.Context, createRequest *NetworkCreateRequest) (*Network, error)

func (NetworkServiceOperations) Delete added in v1.1.0

func (s NetworkServiceOperations) Delete(ctx context.Context, networkID string) error

func (NetworkServiceOperations) Get added in v1.1.0

func (s NetworkServiceOperations) Get(ctx context.Context, networkID string) (*Network, error)

func (NetworkServiceOperations) List added in v1.1.0

func (NetworkServiceOperations) Update added in v1.1.0

func (f NetworkServiceOperations) Update(ctx context.Context, networkID string, updateRequest *NetworkUpdateRequest) error

type NetworkStub added in v1.1.0

type NetworkStub struct {
	HREF string `json:"href,omitempty"`
	Name string `json:"name,omitempty"`
	UUID string `json:"uuid,omitempty"`
}

type NetworkUpdateRequest added in v1.1.0

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 {
	Create(ctx context.Context, createRequest *ObjectsUserRequest) (*ObjectsUser, error)
	Get(ctx context.Context, objectsUserID string) (*ObjectsUser, error)
	Update(ctx context.Context, objectsUserID string, updateRequest *ObjectsUserRequest) error
	Delete(ctx context.Context, objectsUserID string) error
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]ObjectsUser, error)
}

ObjectsUsersService manages users of the S3-compatible objects storage

type ObjectsUsersServiceOperations

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

ObjectsUsersServiceOperations contains config for this service

func (ObjectsUsersServiceOperations) Create

Create an objects user with the specified attributes.

func (ObjectsUsersServiceOperations) Delete

func (s ObjectsUsersServiceOperations) Delete(ctx context.Context, objectsUserID string) error

Delete an objects user

func (ObjectsUsersServiceOperations) Get

func (s ObjectsUsersServiceOperations) Get(ctx context.Context, objectsUserID string) (*ObjectsUser, error)

Get an objects user by its ID

func (ObjectsUsersServiceOperations) List

List all objects users

func (ObjectsUsersServiceOperations) Update

func (s ObjectsUsersServiceOperations) Update(ctx context.Context, objectsUserID string, updateRequest *ObjectsUserRequest) error

Update the properties of an objects user

type Region

type Region struct {
	Slug  string `json:"slug"`
	Zones []Zone `json:"zones"`
}

type RegionService

type RegionService interface {
	List(ctx context.Context) ([]Region, error)
}

type RegionServiceOperations

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

func (RegionServiceOperations) List

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 {
	Create(ctx context.Context, createRequest *ServerGroupRequest) (*ServerGroup, error)
	Get(ctx context.Context, serverGroupID string) (*ServerGroup, error)
	Update(ctx context.Context, networkID string, updateRequest *ServerGroupRequest) error
	Delete(ctx context.Context, serverGroupID string) error
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]ServerGroup, error)
}

type ServerGroupServiceOperations

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

func (ServerGroupServiceOperations) Create

func (ServerGroupServiceOperations) Delete

func (s ServerGroupServiceOperations) Delete(ctx context.Context, serverGroupID string) error

func (ServerGroupServiceOperations) Get

func (s ServerGroupServiceOperations) Get(ctx context.Context, serverGroupID string) (*ServerGroup, error)

func (ServerGroupServiceOperations) List

func (ServerGroupServiceOperations) Update added in v1.2.0

func (f ServerGroupServiceOperations) Update(ctx context.Context, serverGroupID string, updateRequest *ServerGroupRequest) error

type ServerGroupStub

type ServerGroupStub struct {
	HREF string `json:"href"`
	UUID string `json:"uuid"`
	Name string `json:"name"`
}

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           *[]Volume           `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 {
	Create(ctx context.Context, createRequest *ServerRequest) (*Server, error)
	Get(ctx context.Context, serverID string) (*Server, error)
	Update(ctx context.Context, serverID string, updateRequest *ServerUpdateRequest) error
	Delete(ctx context.Context, serverID string) error
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]Server, error)
	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 {
	// contains filtered or unexported fields
}

func (ServerServiceOperations) Create

func (s ServerServiceOperations) Create(ctx context.Context, createRequest *ServerRequest) (*Server, error)

func (ServerServiceOperations) Delete

func (s ServerServiceOperations) Delete(ctx context.Context, serverID string) error

func (ServerServiceOperations) Get

func (s ServerServiceOperations) Get(ctx context.Context, serverID string) (*Server, error)

func (ServerServiceOperations) List

func (s ServerServiceOperations) List(ctx context.Context, modifiers ...ListRequestModifier) ([]Server, error)

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, serverID string, updateRequest *ServerUpdateRequest) error

type ServerStub

type ServerStub struct {
	HREF string `json:"href"`
	UUID string `json:"uuid"`
}

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 Subnet added in v1.1.0

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 added in v1.3.0

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"`
}

type SubnetService added in v1.1.0

type SubnetService interface {
	Create(ctx context.Context, createRequest *SubnetCreateRequest) (*Subnet, error)
	Get(ctx context.Context, subnetID string) (*Subnet, error)
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]Subnet, error)
	Update(ctx context.Context, subnetID string, updateRequest *SubnetUpdateRequest) error
	Delete(ctx context.Context, subnetID string) error
}

type SubnetServiceOperations added in v1.1.0

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

func (SubnetServiceOperations) Create added in v1.3.0

func (s SubnetServiceOperations) Create(ctx context.Context, createRequest *SubnetCreateRequest) (*Subnet, error)

func (SubnetServiceOperations) Delete added in v1.3.0

func (s SubnetServiceOperations) Delete(ctx context.Context, subnetID string) error

func (SubnetServiceOperations) Get added in v1.1.0

func (s SubnetServiceOperations) Get(ctx context.Context, subnetID string) (*Subnet, error)

func (SubnetServiceOperations) List added in v1.1.0

func (s SubnetServiceOperations) List(ctx context.Context, modifiers ...ListRequestModifier) ([]Subnet, error)

func (SubnetServiceOperations) Update added in v1.4.0

func (f SubnetServiceOperations) Update(ctx context.Context, subnetID string, updateRequest *SubnetUpdateRequest) error

type SubnetStub added in v1.1.0

type SubnetStub struct {
	HREF string `json:"href,omitempty"`
	CIDR string `json:"cidr,omitempty"`
	UUID string `json:"uuid,omitempty"`
}

type SubnetUpdateRequest added in v1.4.0

type SubnetUpdateRequest struct {
	TaggedResourceRequest
	GatewayAddress string   `json:"gateway_address,omitempty"`
	DNSServers     []string `json:"dns_servers,omitempty"`
}

type TagMap added in v1.2.0

type TagMap map[string]string

type TaggedResource added in v1.2.0

type TaggedResource struct {
	Tags TagMap `json:"tags"`
}

type TaggedResourceRequest added in v1.2.0

type TaggedResourceRequest struct {
	Tags TagMap `json:"tags,omitempty"`
}

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 {
	Create(ctx context.Context, createRequest *VolumeRequest) (*Volume, error)
	Get(ctx context.Context, volumeID string) (*Volume, error)
	List(ctx context.Context, modifiers ...ListRequestModifier) ([]Volume, error)
	Update(ctx context.Context, volumeID string, updateRequest *VolumeRequest) error
	Delete(ctx context.Context, volumeID string) error
}

type VolumeServiceOperations

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

func (VolumeServiceOperations) Create

func (s VolumeServiceOperations) Create(ctx context.Context, createRequest *VolumeRequest) (*Volume, error)

func (VolumeServiceOperations) Delete

func (s VolumeServiceOperations) Delete(ctx context.Context, volumeID string) error

func (VolumeServiceOperations) Get

func (s VolumeServiceOperations) Get(ctx context.Context, volumeID string) (*Volume, error)

func (VolumeServiceOperations) List

func (s VolumeServiceOperations) List(ctx context.Context, modifiers ...ListRequestModifier) ([]Volume, error)

func (VolumeServiceOperations) Update

func (f VolumeServiceOperations) Update(ctx context.Context, volumeID string, updateRequest *VolumeRequest) error

type VolumeStub

type VolumeStub struct {
	Type       string `json:"type"`
	DevicePath string `json:"device_path"`
	SizeGB     int    `json:"size_gb"`
	UUID       string `json:"uuid"`
}

type ZonalResource

type ZonalResource struct {
	Zone Zone `json:"zone"`
}

type ZonalResourceRequest

type ZonalResourceRequest struct {
	Zone string `json:"zone,omitempty"`
}

type Zone

type Zone struct {
	Slug string `json:"slug"`
}

Jump to

Keyboard shortcuts

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