oneandone_cloudserver_api

package module
v0.0.0-...-455ab6a Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

README

1&1 Cloudserver API Go Client

This project contains a Go implementation of a client for the 1&1 Cloudserver's public API.

About 1&1 Cloudserver API

The Cloudserver API Documentation can be found here: WILL BE ADDED LATER

Usage

Import the library:

import oaocs "github.com/jlusiardi/oneandone-cloudserver-api"

Then use go get to download and install the library.

Create a new API instance:

api := oaocs.New("YOUR_TOKEN", "[WILL BE REPLACED LATER]")
Servers

Query all server:

servers, err := api.GetServers()
if err != nil {
	// some error handling
}

Create a new server:

server, err := api.CreateServer(oaocs.ServerCreateData{
        Name:             "Some Name",
        Description:      "Some Description",
        ApplianceId:      "ID of used Appliance",
        FirewallPolicyId: "ID of applied Firewall Policy",
        Hardware: oaocs.Hardware{
                CoresPerProcessor: 1,
                Vcores:            1,	// 1 Core
                Ram:               1,	// 1GB Ram
                Hdds: []oaocs.Hdd{
                        oaocs.Hdd{
                                IsMain: true,
                                Size:   20,	// 20GB SSD
                	},
        	},
        },
        PowerOn: true,
})
if err != nil {
	// error handling
}
Firewall Policies

Create a new firewall policy that opens all TCP ports:

firewall, err := api.CreateFirewallPolicy(oaocs.FirewallPolicyCreateData{
        Name:        "Name of the Policy",
        Description: "Description of the Policy",
        Rules: []oaocs.FirewallPolicyRulesCreateData{
                oaocs.FirewallPolicyRulesCreateData{
                         Protocol: "TCP",
                         PortFrom: oaocs.Int2Pointer(1),
                         PortTo:   oaocs.Int2Pointer(65535),
                         SourceIp: "0.0.0.0",
                },
        },
})
if err != nil {
        // error handling
}

Contributing

We are happy to recieve your reports on any issue and also pull requests are welcome!

Documentation

Index

Constants

View Source
const (
	PublicIpPathSegment        = "public_ips"
	SharedStoragesPathSegment  = "shared_storages"
	PrivateNetworksPathSegment = "private_networks"
)
View Source
const (
	IpTypeV4 = "IPV4"
	IpTypeV6 = "IPV6"
)

Variables

This section is empty.

Functions

func Int2Pointer

func Int2Pointer(input int) *int

Function to convert a given integer value into a pointer to the same value.

This function is used to be able to define ports with the CreateFirewallPolicy function and the definition of ports in the FirewallPolicyCreateData struct.

Types

type API

type API struct {
	Endpoint string
	Client   *RestClient
}

Struct to hold the required information for accessing the API.

Instances of this type contain the URL of the endpoint to access the API as well as the API access token to be used. They offer also all methods that allow to access the various objects that are returned by top level resources of the API.

func New

func New(token string, url string) *API

Creates a new API instance.

Explanations about given token and url information can be found online under the following url TODO add url!

func (*API) CreateFirewallPolicy

func (api *API) CreateFirewallPolicy(configuration FirewallPolicyCreateData) (*FirewallPolicy, error)

POST /firewall_policies

func (*API) CreateLoadBalancer

func (api *API) CreateLoadBalancer(loadBalancer LoadBalancer) (*LoadBalancer, error)

POST /load_balancers

func (*API) CreateMonitoringPolicy

func (api *API) CreateMonitoringPolicy(configuration MonitoringPolicy) (*MonitoringPolicy, error)

POST /monitoring_policies

func (*API) CreatePrivateNetwork

func (api *API) CreatePrivateNetwork(configuration PrivateNetworkSettings) (*PrivateNetwork, error)

POST /private_networks

func (*API) CreatePublicIp

func (api *API) CreatePublicIp(configuration PublicIpSettings) (*PublicIp, error)

POST /public_ips

func (*API) CreateServer

func (api *API) CreateServer(configuration ServerCreateData) (*Server, error)

POST /servers

func (*API) CreateSharedStorage

func (api *API) CreateSharedStorage(configuration SharedStorageSettings) (*SharedStorage, error)

POST /shared_storages

func (*API) CreateUser

func (api *API) CreateUser(configuration UserCreateData) User

POST /users

func (*API) GetDvdIso

func (api *API) GetDvdIso(Id string) (*DvdIso, error)

GET /dvd_isos/{id}

func (*API) GetDvdIsos

func (api *API) GetDvdIsos() ([]DvdIso, error)

GET /dvd_isos

func (*API) GetFirewallPolicies

func (api *API) GetFirewallPolicies() ([]FirewallPolicy, error)

GET /firewall_policies

func (*API) GetFirewallPolicy

func (api *API) GetFirewallPolicy(Id string) (*FirewallPolicy, error)

GET /firewall_policies/{id}

func (*API) GetFixedInstanceSizes

func (api *API) GetFixedInstanceSizes() ([]FixedInstanceInformation, error)

func (*API) GetLoadBalancer

func (api *API) GetLoadBalancer(id string) (*LoadBalancer, error)

GET /load_balancers/{id}

func (*API) GetLoadBalancers

func (api *API) GetLoadBalancers() ([]LoadBalancer, error)

GET /load_balancers

func (*API) GetLog

func (api *API) GetLog(id string) (*Log, error)

GET /logs/{id}

func (*API) GetLogs

func (api *API) GetLogs(period string) ([]Log, error)

GET /logs

func (*API) GetMonitoringPolicies

func (api *API) GetMonitoringPolicies() ([]MonitoringPolicy, error)

GET /monitoring_policies

func (*API) GetMonitoringPolicy

func (api *API) GetMonitoringPolicy(Id string) (*MonitoringPolicy, error)

GET /monitoring_policies/{id}

func (*API) GetPrivateNetwork

func (api *API) GetPrivateNetwork(Id string) (*PrivateNetwork, error)

GET /private_networks/{id}

func (*API) GetPrivateNetworks

func (api *API) GetPrivateNetworks() ([]PrivateNetwork, error)

GET /private_networks

func (*API) GetPublicIp

func (api *API) GetPublicIp(Id string) (*PublicIp, error)

GET /public_ips/{id}

func (*API) GetPublicIps

func (api *API) GetPublicIps() ([]PublicIp, error)

GET /public_ips

func (*API) GetServer

func (api *API) GetServer(Id string) (*Server, error)

GET /servers/{id}

func (*API) GetServerAppliance

func (api *API) GetServerAppliance(Id string) (*ServerAppliance, error)

GET /server_appliances/{id}

func (*API) GetServerAppliances

func (api *API) GetServerAppliances() ([]ServerAppliance, error)

GET /server_appliances

func (*API) GetServers

func (api *API) GetServers() ([]Server, error)

GET /servers

func (*API) GetSharedStorage

func (api *API) GetSharedStorage(sharedStorageId string) (*SharedStorage, error)

GET /shared_storages/{id}

func (*API) GetSharedStorageAccessCredentials

func (api *API) GetSharedStorageAccessCredentials() (*SharedStorageAccessCredentials, error)

GET /shared_storages/access

func (*API) GetSharedStorages

func (api *API) GetSharedStorages() ([]SharedStorage, error)

GET /shared_storages

func (*API) GetUsages

func (api *API) GetUsages(period string) (*Usages, error)

GET /usages

func (*API) GetUser

func (api *API) GetUser(Id string) User

GET /users/{id}

func (*API) GetUsers

func (api *API) GetUsers() []User

GET /users

func (*API) ServerApplianceFindNewest

func (api *API) ServerApplianceFindNewest(family string, os string, osType string, architecture int, autoInstall bool) (*ServerAppliance, error)

Function to get the newest operating system

Returns the newest operating system as ServerAppliance object

func (*API) ServerApplianceListArchitectures

func (api *API) ServerApplianceListArchitectures(family string, os string, osType string) ([]int, error)

Function to get the available architectures for the given operating system

Returns the available architectures. i.E. [32, 64]

func (*API) ServerApplianceListFamilies

func (api *API) ServerApplianceListFamilies() ([]string, error)

Function to get the available operating system families

Returns the available operating system families. i.E. [Linux, Windows]

func (*API) ServerApplianceListOperationSystems

func (api *API) ServerApplianceListOperationSystems(family string) ([]string, error)

Function to get the available operating system by the os family

Returns all operating systems who are in the given family. i.E. Linux: [Ubuntu, Debian] and so on..

func (*API) ServerApplianceListTypes

func (api *API) ServerApplianceListTypes(family string, os string) ([]string, error)

Function to get the available operating system type images

Returns the available operating system types. i.E. [Minimal, Standard, ISO_OS]

type ApiError

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

func (ApiError) Error

func (e ApiError) Error() string

func (*ApiError) HttpStatusCode

func (e *ApiError) HttpStatusCode() int

func (*ApiError) Message

func (e *ApiError) Message() string

type DvdIso

type DvdIso struct {
	Id           string `json:"id"`
	Name         string `json:"name"`
	OsFamily     string `json:"os_family"`
	Os           string `json:"os"`
	OsVersion    string `json:"os_version"`
	Architecture int    `json:"architecture"`
	Type         string `json:"type"`
	// contains filtered or unexported fields
}

Struct to describe a ISO image that can be used to boot a server.

Values of this type describe ISO images that can be inserted into the servers virtual DVD drive.

type FirewallInIpInServer

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

type FirewallPolicy

type FirewallPolicy struct {

	// should be fixed: Status        Status                   `json:"status"`
	Status        string                   `json:"state"`
	DefaultPolicy int                      `json:"default"`
	Rules         []FirewallPolicyRules    `json:"rules"`
	ServerIps     []FirewallPolicyServerIp `json:"server_ips"`
	// contains filtered or unexported fields
}

func (*FirewallPolicy) AddServerIp

func (fwp *FirewallPolicy) AddServerIp(ipId string) (*FirewallPolicy, error)

PUT /firewall_policies/{id}/server_ips

func (*FirewallPolicy) Delete

func (fwp *FirewallPolicy) Delete() (*FirewallPolicy, error)

DELETE /firewall_policies/{id}

func (*FirewallPolicy) DeleteServerIp

func (fwp *FirewallPolicy) DeleteServerIp(ipId string) (*FirewallPolicy, error)

DELETE /firewall_policies/{id}/server_ips/{id}

func (*FirewallPolicy) WaitForState

func (fwp *FirewallPolicy) WaitForState(State string) error

func (*FirewallPolicy) WaitUntilDeleted

func (fwp *FirewallPolicy) WaitUntilDeleted() error

type FirewallPolicyAddIpsData

type FirewallPolicyAddIpsData struct {
	ServerIps []string `json:"server_ips"`
}

type FirewallPolicyCreateData

type FirewallPolicyCreateData struct {
	Name        string                          `json:"name"`
	Description string                          `json:"description"`
	Rules       []FirewallPolicyRulesCreateData `json:"rules"`
}

type FirewallPolicyRules

type FirewallPolicyRules struct {
	Protocol string `json:"protocol"`
	PortFrom *int   `json:"port_from"`
	PortTo   *int   `json:"port_to"`
	SourceIp string `json:"source"`
	// contains filtered or unexported fields
}

type FirewallPolicyRulesCreateData

type FirewallPolicyRulesCreateData struct {
	Protocol string `json:"protocol"`
	PortFrom *int   `json:"port_from"`
	PortTo   *int   `json:"port_to"`
	SourceIp string `json:"source"`
}

type FirewallPolicyServerIp

type FirewallPolicyServerIp struct {
	Ip         string `json:"ip"`
	ServerName string `json:"server_name"`
	// contains filtered or unexported fields
}

type FixedInstanceInformation

type FixedInstanceInformation struct {
	Hardware Hardware `json:"hardware"`
	// contains filtered or unexported fields
}

type Hardware

type Hardware struct {
	Vcores            int   `json:"vcore"`
	CoresPerProcessor int   `json:"cores_per_processor"`
	Ram               int   `json:"ram"`
	Hdds              []Hdd `json:"hdds"`
}

type Hdd

type Hdd struct {
	Size   int  `json:"size"`
	IsMain bool `json:"is_main"`
	// contains filtered or unexported fields
}

type ImageInServer

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

type IpInServer

type IpInServer struct {
	Ip         string               `json:"ip"`
	ReverseDns string               `json:"reverse_dns"`
	Firewall   FirewallInIpInServer `json:"firewall_policy"`
	// contains filtered or unexported fields
}

type LoadBalancer

type LoadBalancer struct {
	Name                  string                  `json:"name"`
	Description           string                  `json:"description"`
	State                 string                  `json:"state"`
	CreationDate          string                  `json:"creation_date"`
	Ip                    string                  `json:"ip"`
	HealthCheckTest       string                  `json:"health_check_test"`
	HealthCheckInterval   int                     `json:"health_check_interval"`
	HealthCheckPath       string                  `json:"health_check_path"`
	HealthCheckPathParser string                  `json:"health_check_path_parser"`
	Persistence           bool                    `json:"persistence"`
	PersistenceTime       int                     `json:"persistence_time"`
	Method                string                  `json:"method"`
	Rules                 []LoadBalancerRules     `json:"rules"`
	ServerIps             []LoadBalancerServerIps `json:"server_ips"`
	CloudPanelId          string                  `json:"cloudpanel_id"`
	// contains filtered or unexported fields
}

func (*LoadBalancer) Delete

func (lb *LoadBalancer) Delete() (*LoadBalancer, error)

DELETE /load_balancers/{id}

func (*LoadBalancer) Update

func (lb *LoadBalancer) Update(loadBalancerUpdate LoadBalancerUpdate) (*LoadBalancer, error)

PUT /load_balancers/{id}

type LoadBalancerRules

type LoadBalancerRules struct {
	Protocol     string `json:"protocol"`
	PortBalancer int    `json:"port_balancer"`
	PortServer   int    `json:"port_server"`
	Source       string `json:"source"`
	// contains filtered or unexported fields
}

type LoadBalancerServerIps

type LoadBalancerServerIps struct {
	Ip         string `json:"ip"`
	ServerName string `json:"server_name"`
	// contains filtered or unexported fields
}

type LoadBalancerUpdate

type LoadBalancerUpdate struct {
	Name                  string `json:"name"`
	Description           string `json:"description"`
	HealthCheckTest       string `json:"health_check_test"`
	HealthCheckInterval   int    `json:"health_check_interval"`
	HealthCheckPath       string `json:"health_check_path"`
	HealthCheckPathParser string `json:"health_check_path_parser"`
	Persistence           bool   `json:"persistence"`
	PersistenceTime       int    `json:"persistence_time"`
	Method                string `json:"method"`
}

type Log

type Log struct {
	StartDate string `json:"start_date"`
	EndDate   string `json:"end_date"`
	Duration  int    `json:"duration"`
	Status    Status
	Action    string `json:"action"`

	Resource     LogDetails
	User         LogDetails
	CloudPanelId string `json:"cloudpanel_id"`
	// contains filtered or unexported fields
}

type LogDetails

type LogDetails struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type MonitoringLevel

type MonitoringLevel struct {
	Warning  MonitoringValue `json:"warning"`
	Critical MonitoringValue `json:"critical"`
}

type MonitoringLimits

type MonitoringLimits struct {
	Upper int `json:"upper"`
	Lower int `json:"lower"`
}

type MonitoringPolicy

type MonitoringPolicy struct {
	Status
	Name         string              `json:"name"`
	Default      int                 `json:"default"`
	CreationDate string              `json:"creation_date"`
	Email        string              `json:"email"`
	Agent        bool                `json:"agent"`
	Servers      []MonitoringServer  `json:"servers"`
	Thresholds   MonitoringThreshold `json:"thresholds"`
	Ports        []MonitoringPort    `json:"ports"`
	Processes    []MonitoringProcess `json:"processes"`
	CloudPanelId string              `json:"cloudpanel_id"`
	// contains filtered or unexported fields
}

func (*MonitoringPolicy) Delete

func (mp *MonitoringPolicy) Delete() (*MonitoringPolicy, error)

DELETE /monitoring_policies/{id}

type MonitoringPolicyCreateData

type MonitoringPolicyCreateData struct {
}

type MonitoringPort

type MonitoringPort struct {
	Protocol          string `json:"protocol"`
	Port              int    `json:"port"`
	AlertIf           string `json:"alert_if"`
	EmailNotification bool   `json:"email_notification"`
}

type MonitoringProcess

type MonitoringProcess struct {
	Process           string `json:"process"`
	AlertIf           string `json:"alert_if"`
	EmailNotification bool   `json:"email_notification"`
}

type MonitoringServer

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

type MonitoringStatus

type MonitoringStatus struct {
	Resource string          `json:"resource"`
	Date     string          `json:"date"`
	State    string          `json:"state"`
	Value    MonitoringValue `json:"value"`
}

type MonitoringThreshold

type MonitoringThreshold struct {
	Cpu          MonitoringLevel `json:"cpu"`
	Ram          MonitoringLevel `json:"ram"`
	Disk         MonitoringLevel `json:"disk"`
	Transfer     MonitoringLevel `json:"transfer"`
	InternalPing MonitoringLevel `json:"internal_ping"`
}

type MonitoringValue

type MonitoringValue struct {
	Value int  `json:"value"`
	Alert bool `json:"alert"`
}

type PrivateNetwork

type PrivateNetwork struct {
	CloudpanelId string `json:"cloudpanel_id"`

	NetworkAddress string                 `json:"network_address"`
	SubnetMask     string                 `json:"subnet_mask"`
	State          string                 `json:"state"`
	CreationDate   string                 `json:"creation_date"`
	Servers        []PrivateNetworkServer `json:"servers"`
	// contains filtered or unexported fields
}

func (*PrivateNetwork) AddServers

func (pn *PrivateNetwork) AddServers(privateNetworkAddServers PrivateNetworkAddServers) (*PrivateNetwork, error)

PUT /private_networks/{id}/servers

func (*PrivateNetwork) Delete

func (pn *PrivateNetwork) Delete() (*PrivateNetwork, error)

DELETE /private_networks/{id}

func (*PrivateNetwork) GetServer

func (pn *PrivateNetwork) GetServer(id string) (*PrivateNetworkServer, error)

GET /private_networks/{id}/servers/{id}

func (*PrivateNetwork) GetServers

func (pn *PrivateNetwork) GetServers() ([]PrivateNetworkServer, error)

GET /private_networks/{id}/servers

func (*PrivateNetwork) Update

func (pn *PrivateNetwork) Update(configuration PrivateNetworkSettings) (*PrivateNetwork, error)

PUT /private_networks/{id}

type PrivateNetworkAddServers

type PrivateNetworkAddServers struct {
	Servers []string `json:"servers"`
}

type PrivateNetworkServer

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

func (*PrivateNetworkServer) Delete

func (pns *PrivateNetworkServer) Delete() (*PrivateNetwork, error)

DELETE /private_networks/{id}/servers/{id}

type PrivateNetworkSettings

type PrivateNetworkSettings struct {
	Name           string `json:"name"`
	Description    string `json:"description"`
	NetworkAddress string `json:"network_address"`
	SubnetMask     string `json:"subnet_mask"`
}

type PublicIp

type PublicIp struct {
	IpAddress string `json:"ip"`

	AssignedTo   ServerForIp `json:"assigned_to"`
	ReverseDns   string      `json:"reverse_dns"`
	IsDhcp       bool        `json:"dhcp"`
	State        string      `json:"state"`
	CreationDate string      `json:"creation_date"`
	// contains filtered or unexported fields
}

func (*PublicIp) Delete

func (ip *PublicIp) Delete() (*PublicIp, error)

DELETE /public_ips/{id}

func (*PublicIp) UpdateReverseDns

func (ip *PublicIp) UpdateReverseDns(ipAddressConfiguration PublicIpSettings) (*PublicIp, error)

PUT /public_ips/{id}

type PublicIpSettings

type PublicIpSettings struct {
	ReverseDns string `json:"reverse_dns"`
	Type       string `json:"type"`
}

type RestClient

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

func NewRestClient

func NewRestClient(token string) *RestClient

func (*RestClient) Delete

func (c *RestClient) Delete(url string, result interface{}, expectedStatus int) error

func (*RestClient) Get

func (c *RestClient) Get(url string, result interface{}, expectedStatus int) error

func (*RestClient) Post

func (c *RestClient) Post(url string, requestBody interface{}, result interface{}, expectedStatus int) error

func (*RestClient) Put

func (c *RestClient) Put(url string, requestBody interface{}, result interface{}, expectedStatus int) error

type Server

type Server struct {
	Password string        `json:"first_password"`
	Status   Status        `json:"status"`
	Hardware Hardware      `json:"hardware"`
	Image    ImageInServer `json:"image"`
	Ips      []IpInServer  `json:"ips"`
	// contains filtered or unexported fields
}

func (*Server) Clone

func (server *Server) Clone(NewName string) Server

POST /servers/{server_id}/clone

func (*Server) Delete

func (s *Server) Delete() (*Server, error)

DELETE /servers/{id}

func (*Server) GetStatus

func (s *Server) GetStatus() (*Status, error)

GET /servers/{id}/status

func (*Server) Reboot

func (s *Server) Reboot(hardware bool) (*Server, error)

PUT /servers/{id}/status/action

func (*Server) RenameServer

func (s *Server) RenameServer(data ServerRenameData) (*Server, error)

PUT /servers/{id}

func (*Server) Shutdown

func (s *Server) Shutdown(hardware bool) (*Server, error)

func (*Server) Start

func (s *Server) Start() (*Server, error)

func (*Server) WaitForState

func (server *Server) WaitForState(State string) error

Function to perform busy-wating for a certain server state.

This function queries the server with the given id every 5s until the server's state equals the given state.

func (*Server) WaitUntilDeleted

func (server *Server) WaitUntilDeleted() error

type ServerAction

type ServerAction struct {
	Action string `json:"action"`
	Method string `json:"method"`
}

type ServerAppliance

type ServerAppliance struct {
	OsImageType        string                   `json:"os_image_type"`
	OsFamily           string                   `json:"os_family"`
	Os                 string                   `json:"os"`
	OsVersion          string                   `json:"os_version"`
	MinHddSize         int                      `json:"min_hdd_size"`
	Architecture       int                      `json:"architecture"`
	Licenses           []ServerApplianceLicence `json:"licenses"`
	IsAutomaticInstall bool                     `json:"automatic_installation"`
	Type               string                   `json:"type"`
	// contains filtered or unexported fields
}

type ServerApplianceLicence

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

type ServerCreateData

type ServerCreateData struct {
	Name               string   `json:"name"`
	Description        string   `json:"description"`
	Hardware           Hardware `json:"hardware"`
	ApplianceId        string   `json:"appliance_id"`
	Password           string   `json:"password"`
	PowerOn            bool     `json:"power_on"`
	FirewallPolicyId   string   `json:"firewall_policy_id"`
	IpId               string   `json:"ip_id"`
	LoadBalancerId     string   `json:"load_balancer_id"`
	MonitoringPolicyId string   `json:"monitoring_policy_id"`
	PrivateNetworkId   string   `json:"private_network_id"`
}

type ServerForIp

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

type ServerRenameData

type ServerRenameData struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type SharedStorage

type SharedStorage struct {
	Size  int    `json:"size"`
	State string `json:"state"`

	CloudPanelId string `json:"cloudpanel_id"`
	SizeUsed     string `json:"size_used"`
	CifsPath     string `json:"cifs_path"`
	NfsPath      string `json:"nfs_path"`

	CreationDate  string                `json:"creation_date"`
	SharedStorage []SharedStorageServer `json:"servers"`
	// contains filtered or unexported fields
}

func (*SharedStorage) Delete

func (st *SharedStorage) Delete() (*SharedStorage, error)

DELETE /shared_storages/{id}

func (*SharedStorage) GetServerPermission

func (st *SharedStorage) GetServerPermission(sharedStorageServerId string) (*SharedStorageServer, error)

GET /shared_storages/{id}/servers/{id}

func (*SharedStorage) GetServersPermissions

func (st *SharedStorage) GetServersPermissions() ([]SharedStorageServer, error)

GET /shared_storages/{id}/servers

func (*SharedStorage) UpdateConfig

func (st *SharedStorage) UpdateConfig(configuration SharedStorageSettings) (*SharedStorage, error)

PUT /shared_storages/{id}

func (*SharedStorage) UpdateServerPermissions

func (st *SharedStorage) UpdateServerPermissions(sharedStorageServerPermissions SharedStorageServerPermissions) (*SharedStorage, error)

PUT /shared_storages/{id}/servers

func (*SharedStorage) WaitForState

func (st *SharedStorage) WaitForState(expectedState string) error

Function to perform busy-wating for a certain shared storage state.

This function queries the shared storage with the given id every 5s until the shared storage's state equals the given state.

type SharedStorageAccessCredentials

type SharedStorageAccessCredentials struct {
	State               string `json:"state"`
	KerberosContentFile string `json:"kerberos_content_file"`
	UserDomain          string `json:"user_domain"`
	// contains filtered or unexported fields
}

func (*SharedStorageAccessCredentials) UpdateAccessCredentials

func (stac *SharedStorageAccessCredentials) UpdateAccessCredentials(sharedStorageAccessCredentialsSettings SharedStorageAccessCredentialsSettings) (*SharedStorageAccessCredentials, error)

PUT /shared_storages/access

type SharedStorageAccessCredentialsSettings

type SharedStorageAccessCredentialsSettings struct {
	Password string `json:"password"`
}

type SharedStorageServer

type SharedStorageServer struct {
	Id     string `json:"id"`
	Name   string `json:"name"`
	Rights string `json:"rights"`
	// contains filtered or unexported fields
}

func (*SharedStorageServer) DeleteServerPermission

func (sts *SharedStorageServer) DeleteServerPermission() (*SharedStorageServer, error)

DELETE /shared_storages/{id}/servers/{id}

type SharedStorageServerPermissions

type SharedStorageServerPermissions struct {
	SharedStorageServer []SharedStorageServer `json:"servers"`
}

type SharedStorageSettings

type SharedStorageSettings struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Size        int    `json:"size"`
}

type Status

type Status struct {
	State   string `json:"state"`
	Percent int    `json:"percent"`
}

Struct to hold the status of an API object.

Values of this type are used to represent the status of API objects like servers, firewall policies and the like.

The value of the "State" field can represent fixed states like "ACTIVE" or "POWERED_ON" but also transitional states like "POWERING_ON" or "CONFIGURING".

For fixed states the "Percent" field is empty where as for transitional states it contains the progress of the transition in percent.

type Usages

type Usages struct {
	PublicIPs string `json:"PUBLIC_IPS"`
	// contains filtered or unexported fields
}

type User

type User struct {
	State     string `json:"state"`
	Role      string `json:"role"`
	ApiActive bool   `json:"api_active"`
	// contains filtered or unexported fields
}

func (*User) Delete

func (user *User) Delete() User

DELETE /users/{id}

func (*User) ModifyUser

func (user *User) ModifyUser(data UserCreateData) User

PUT /users/{id}

type UserCreateData

type UserCreateData struct {
	Password string `json:"password"`
	Email    string `json:"email"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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