Documentation ¶
Overview ¶
Package api contains client and functions to interact with Scaleway API
Index ¶
- Constants
- Variables
- func CreateServer(api *ScalewayAPI, c *ConfigCreateServer) (string, error)
- func CreateVolumeFromHumanSize(api *ScalewayAPI, size string) (*string, error)
- func InspectIdentifiers(api *ScalewayAPI, ci chan ScalewayResolvedIdentifier, ...)
- func ResolveGateway(api *ScalewayAPI, gateway string) (string, error)
- func ResolveIdentifiers(api *ScalewayAPI, needles []string, out chan ScalewayResolvedIdentifier)
- func StartServer(api *ScalewayAPI, needle string, wait bool) error
- func StartServerOnce(api *ScalewayAPI, needle string, wait bool, successChan chan bool, ...)
- type ByCreationDate
- type ConfigCreateServer
- type InspectIdentifierResult
- type ScalewayAPI
- func (s *ScalewayAPI) AttachIP(ipID, serverID string) error
- func (s *ScalewayAPI) CheckCredentials() error
- func (s *ScalewayAPI) DeleteIP(ipID string) error
- func (s *ScalewayAPI) DeleteImage(imageID string) error
- func (s *ScalewayAPI) DeleteResponse(resource string) (*http.Response, error)
- func (s *ScalewayAPI) DeleteSecurityGroup(securityGroupID string) error
- func (s *ScalewayAPI) DeleteSecurityGroupRule(SecurityGroupID, RuleID string) error
- func (s *ScalewayAPI) DeleteServer(serverID string) error
- func (a *ScalewayAPI) DeleteServerSafe(serverID string) error
- func (s *ScalewayAPI) DeleteUserdata(serverID string, key string) error
- func (s *ScalewayAPI) DisableAccountAPI()
- func (s *ScalewayAPI) DisableMetadataAPI()
- func (s *ScalewayAPI) EnableAccountAPI()
- func (s *ScalewayAPI) EnableMetadataAPI()
- func (s *ScalewayAPI) GetASecurityGroup(groupsID string) (*ScalewayGetSecurityGroup, error)
- func (s *ScalewayAPI) GetASecurityGroupRule(groupID string, rulesID string) (*ScalewayGetSecurityGroupRule, error)
- func (s *ScalewayAPI) GetBootscript(bootscriptID string) (*ScalewayBootscript, error)
- func (s *ScalewayAPI) GetBootscriptID(needle string) string
- func (s *ScalewayAPI) GetBootscripts() (*[]ScalewayBootscript, error)
- func (s *ScalewayAPI) GetContainerDatas(container string) (*ScalewayGetContainerDatas, error)
- func (s *ScalewayAPI) GetContainers() (*ScalewayGetContainers, error)
- func (s *ScalewayAPI) GetDashboard() (*ScalewayDashboard, error)
- func (s *ScalewayAPI) GetIP(ipID string) (*ScalewayGetIP, error)
- func (s *ScalewayAPI) GetIPS() (*ScalewayGetIPS, error)
- func (s *ScalewayAPI) GetImage(imageID string) (*ScalewayImage, error)
- func (s *ScalewayAPI) GetImageID(needle string, exitIfMissing bool) string
- func (s *ScalewayAPI) GetImages() (*[]ScalewayImage, error)
- func (s *ScalewayAPI) GetOrganization() (*ScalewayOrganizationsDefinition, error)
- func (s *ScalewayAPI) GetPermissions() (*ScalewayPermissionDefinition, error)
- func (s *ScalewayAPI) GetQuotas() (*ScalewayGetQuotas, error)
- func (s *ScalewayAPI) GetResponse(resource string) (*http.Response, error)
- func (s *ScalewayAPI) GetSecurityGroupRules(groupID string) (*ScalewayGetSecurityGroupRules, error)
- func (s *ScalewayAPI) GetSecurityGroups() (*ScalewayGetSecurityGroups, error)
- func (s *ScalewayAPI) GetServer(serverID string) (*ScalewayServer, error)
- func (s *ScalewayAPI) GetServerID(needle string) string
- func (s *ScalewayAPI) GetServers(all bool, limit int) (*[]ScalewayServer, error)
- func (s *ScalewayAPI) GetSnapshot(snapshotID string) (*ScalewaySnapshot, error)
- func (s *ScalewayAPI) GetSnapshotID(needle string) string
- func (s *ScalewayAPI) GetSnapshots() (*[]ScalewaySnapshot, error)
- func (s *ScalewayAPI) GetTasks() (*[]ScalewayTask, error)
- func (s *ScalewayAPI) GetUser() (*ScalewayUserDefinition, error)
- func (s *ScalewayAPI) GetUserID() (string, error)
- func (s *ScalewayAPI) GetUserdata(serverID string, key string) (*ScalewayUserdata, error)
- func (s *ScalewayAPI) GetUserdatas(serverID string) (*ScalewayUserdatas, error)
- func (s *ScalewayAPI) GetVolume(volumeID string) (*ScalewayVolume, error)
- func (s *ScalewayAPI) GetVolumes() (*[]ScalewayVolume, error)
- func (s *ScalewayAPI) HideAPICredentials(input string) string
- func (s *ScalewayAPI) NewIP() (*ScalewayGetIP, error)
- func (s *ScalewayAPI) PatchResponse(resource string, data interface{}) (*http.Response, error)
- func (s *ScalewayAPI) PatchServer(serverID string, definition ScalewayServerPatchDefinition) error
- func (s *ScalewayAPI) PatchUserSSHKey(UserID string, definition ScalewayUserPatchSSHKeyDefinition) error
- func (s *ScalewayAPI) PatchUserdata(serverID string, key string, value []byte) error
- func (s *ScalewayAPI) PostImage(volumeID string, name string, bootscript string, arch string) (string, error)
- func (s *ScalewayAPI) PostResponse(resource string, data interface{}) (*http.Response, error)
- func (s *ScalewayAPI) PostSecurityGroup(group ScalewayNewSecurityGroup) error
- func (s *ScalewayAPI) PostSecurityGroupRule(SecurityGroupID string, rules ScalewayNewSecurityGroupRule) error
- func (s *ScalewayAPI) PostServer(definition ScalewayServerDefinition) (string, error)
- func (s *ScalewayAPI) PostServerAction(serverID, action string) error
- func (s *ScalewayAPI) PostSnapshot(volumeID string, name string) (string, error)
- func (s *ScalewayAPI) PostVolume(definition ScalewayVolumeDefinition) (string, error)
- func (s *ScalewayAPI) PutResponse(resource string, data interface{}) (*http.Response, error)
- func (s *ScalewayAPI) PutSecurityGroup(group ScalewayNewSecurityGroup, securityGroupID string) error
- func (s *ScalewayAPI) PutSecurityGroupRule(rules ScalewayNewSecurityGroupRule, securityGroupID, RuleID string) error
- func (s *ScalewayAPI) PutVolume(volumeID string, definition ScalewayVolumePutDefinition) error
- func (s *ScalewayAPI) ResolveBootscript(needle string) (ScalewayResolverResults, error)
- func (s *ScalewayAPI) ResolveImage(needle string) (ScalewayResolverResults, error)
- func (s *ScalewayAPI) ResolveServer(needle string) (ScalewayResolverResults, error)
- func (s *ScalewayAPI) ResolveSnapshot(needle string) (ScalewayResolverResults, error)
- func (s *ScalewayAPI) SetPassword(password string)
- func (s *ScalewayAPI) Sync()
- type ScalewayAPIError
- type ScalewayBootCmdArgs
- type ScalewayBootscript
- type ScalewayBootscripts
- type ScalewayCache
- func (c *ScalewayCache) ClearBootscripts()
- func (c *ScalewayCache) ClearImages()
- func (c *ScalewayCache) ClearServers()
- func (c *ScalewayCache) ClearSnapshots()
- func (c *ScalewayCache) ClearVolumes()
- func (c *ScalewayCache) Flush() error
- func (c *ScalewayCache) GetNbBootscripts() int
- func (c *ScalewayCache) GetNbImages() int
- func (c *ScalewayCache) GetNbServers() int
- func (c *ScalewayCache) GetNbSnapshots() int
- func (c *ScalewayCache) GetNbVolumes() int
- func (c *ScalewayCache) InsertBootscript(identifier, name string)
- func (c *ScalewayCache) InsertImage(identifier, name string)
- func (c *ScalewayCache) InsertServer(identifier, name string)
- func (c *ScalewayCache) InsertSnapshot(identifier, name string)
- func (c *ScalewayCache) InsertVolume(identifier, name string)
- func (c *ScalewayCache) LookUpBootscripts(needle string, acceptUUID bool) ScalewayResolverResults
- func (c *ScalewayCache) LookUpIdentifiers(needle string) ScalewayResolverResults
- func (c *ScalewayCache) LookUpImages(needle string, acceptUUID bool) ScalewayResolverResults
- func (c *ScalewayCache) LookUpServers(needle string, acceptUUID bool) ScalewayResolverResults
- func (c *ScalewayCache) LookUpSnapshots(needle string, acceptUUID bool) ScalewayResolverResults
- func (c *ScalewayCache) LookUpVolumes(needle string, acceptUUID bool) ScalewayResolverResults
- func (c *ScalewayCache) RemoveBootscript(identifier string)
- func (c *ScalewayCache) RemoveImage(identifier string)
- func (c *ScalewayCache) RemoveServer(identifier string)
- func (c *ScalewayCache) RemoveSnapshot(identifier string)
- func (c *ScalewayCache) RemoveVolume(identifier string)
- func (c *ScalewayCache) Save() error
- type ScalewayConnect
- type ScalewayConnectResponse
- type ScalewayContainer
- type ScalewayContainerData
- type ScalewayDashboard
- type ScalewayDashboardResp
- type ScalewayGetContainerDatas
- type ScalewayGetContainers
- type ScalewayGetIP
- type ScalewayGetIPS
- type ScalewayGetQuotas
- type ScalewayGetSecurityGroup
- type ScalewayGetSecurityGroupRule
- type ScalewayGetSecurityGroupRules
- type ScalewayGetSecurityGroups
- type ScalewayIPAddress
- type ScalewayIPDefinition
- type ScalewayImage
- type ScalewayImageDefinition
- type ScalewayImageInterface
- type ScalewayImages
- type ScalewayInitrd
- type ScalewayKernel
- type ScalewayKeyDefinition
- type ScalewayNewSecurityGroup
- type ScalewayNewSecurityGroupRule
- type ScalewayOneBootscript
- type ScalewayOneImage
- type ScalewayOneServer
- type ScalewayOneSnapshot
- type ScalewayOneTask
- type ScalewayOneVolume
- type ScalewayOrganizationDefinition
- type ScalewayOrganizationsDefinition
- type ScalewayPermCategory
- type ScalewayPermissionDefinition
- type ScalewayPermissions
- type ScalewayQuota
- type ScalewayResolvedIdentifier
- type ScalewayResolverResult
- type ScalewayResolverResults
- type ScalewayRoleDefinition
- type ScalewaySecurityGroup
- type ScalewaySecurityGroupRule
- type ScalewaySecurityGroups
- type ScalewayServer
- type ScalewayServerAction
- type ScalewayServerDefinition
- type ScalewayServerPatchDefinition
- type ScalewayServers
- type ScalewaySnapshot
- type ScalewaySnapshotDefinition
- type ScalewaySnapshots
- type ScalewayTask
- type ScalewayTasks
- type ScalewayTokenDefinition
- type ScalewayTokensDefinition
- type ScalewayUserDefinition
- type ScalewayUserPatchSSHKeyDefinition
- type ScalewayUserdata
- type ScalewayUserdatas
- type ScalewayUsersDefinition
- type ScalewayVolume
- type ScalewayVolumeDefinition
- type ScalewayVolumePutDefinition
- type ScalewayVolumes
Constants ¶
const ( // IdentifierUnknown is used when we don't know explicitely the type key of the object (used for nil comparison) IdentifierUnknown = 1 << iota // IdentifierServer is the type key of cached server objects IdentifierServer // IdentifierImage is the type key of cached image objects IdentifierImage // IdentifierSnapshot is the type key of cached snapshot objects IdentifierSnapshot // IdentifierBootscript is the type key of cached bootscript objects IdentifierBootscript // IdentifierVolume is the type key of cached volume objects IdentifierVolume )
Variables ¶
var ( ComputeAPI = "https://api.scaleway.com/" AccountAPI = "https://account.scaleway.com/" MetadataAPI = "http://169.254.42.42/" )
Default values
var FuncMap = template.FuncMap{ "json": func(v interface{}) string { a, _ := json.Marshal(v) return string(a) }, }
FuncMap used for json inspection
Functions ¶
func CreateServer ¶
func CreateServer(api *ScalewayAPI, c *ConfigCreateServer) (string, error)
CreateServer creates a server using API based on typical server fields
func CreateVolumeFromHumanSize ¶
func CreateVolumeFromHumanSize(api *ScalewayAPI, size string) (*string, error)
CreateVolumeFromHumanSize creates a volume on the API with a human readable size
func InspectIdentifiers ¶
func InspectIdentifiers(api *ScalewayAPI, ci chan ScalewayResolvedIdentifier, cj chan InspectIdentifierResult)
InspectIdentifiers inspects identifiers concurrently
func ResolveGateway ¶
func ResolveGateway(api *ScalewayAPI, gateway string) (string, error)
ResolveGateway tries to resolve a server public ip address, else returns the input string, i.e. IPv4, hostname
func ResolveIdentifiers ¶
func ResolveIdentifiers(api *ScalewayAPI, needles []string, out chan ScalewayResolvedIdentifier)
ResolveIdentifiers resolves needles provided by the user
func StartServer ¶
func StartServer(api *ScalewayAPI, needle string, wait bool) error
StartServer start a server based on its needle, can optionaly block while server is booting
func StartServerOnce ¶
func StartServerOnce(api *ScalewayAPI, needle string, wait bool, successChan chan bool, errChan chan error)
StartServerOnce wraps StartServer for golang channel
Types ¶
type ByCreationDate ¶
type ByCreationDate []ScalewayImageInterface
ByCreationDate sorts images by CreationDate field
func (ByCreationDate) Len ¶
func (a ByCreationDate) Len() int
func (ByCreationDate) Less ¶
func (a ByCreationDate) Less(i, j int) bool
func (ByCreationDate) Swap ¶
func (a ByCreationDate) Swap(i, j int)
type ConfigCreateServer ¶ added in v1.6.0
type InspectIdentifierResult ¶
type InspectIdentifierResult struct { Type int Object interface{} }
InspectIdentifierResult is returned by `InspectIdentifiers` and contains the inspected `Object` with its `Type`
type ScalewayAPI ¶
type ScalewayAPI struct { // ComputeAPI is the endpoint to the Scaleway API ComputeAPI string // AccountAPI is the endpoint to the Scaleway Account API AccountAPI string // APIEndPoint or ACCOUNTEndPoint APIUrl string // Organization is the identifier of the Scaleway organization Organization string // Token is the authentication token for the Scaleway organization Token string // Cache is used to quickly resolve identifiers from names Cache *ScalewayCache // contains filtered or unexported fields }
ScalewayAPI is the interface used to communicate with the Scaleway API
func NewScalewayAPI ¶
func NewScalewayAPI(apiEndPoint, accountEndPoint, organization, token string) (*ScalewayAPI, error)
NewScalewayAPI creates a ready-to-use ScalewayAPI client
func (*ScalewayAPI) AttachIP ¶ added in v1.6.0
func (s *ScalewayAPI) AttachIP(ipID, serverID string) error
AttachIP attachs an IP to a server
func (*ScalewayAPI) CheckCredentials ¶
func (s *ScalewayAPI) CheckCredentials() error
CheckCredentials performs a dummy check to ensure we can contact the API
func (*ScalewayAPI) DeleteIP ¶ added in v1.6.0
func (s *ScalewayAPI) DeleteIP(ipID string) error
DeleteIP deletes an IP
func (*ScalewayAPI) DeleteImage ¶
func (s *ScalewayAPI) DeleteImage(imageID string) error
DeleteImage deletes a image
func (*ScalewayAPI) DeleteResponse ¶
func (s *ScalewayAPI) DeleteResponse(resource string) (*http.Response, error)
DeleteResponse returns an http.Response object for the deleted resource
func (*ScalewayAPI) DeleteSecurityGroup ¶ added in v1.7.0
func (s *ScalewayAPI) DeleteSecurityGroup(securityGroupID string) error
DeleteSecurityGroup deletes a SecurityGroup
func (*ScalewayAPI) DeleteSecurityGroupRule ¶ added in v1.7.0
func (s *ScalewayAPI) DeleteSecurityGroupRule(SecurityGroupID, RuleID string) error
DeleteSecurityGroupRule deletes a SecurityGroupRule
func (*ScalewayAPI) DeleteServer ¶
func (s *ScalewayAPI) DeleteServer(serverID string) error
DeleteServer deletes a server
func (*ScalewayAPI) DeleteServerSafe ¶
func (a *ScalewayAPI) DeleteServerSafe(serverID string) error
DeleteServerSafe tries to delete a server using multiple ways
func (*ScalewayAPI) DeleteUserdata ¶ added in v1.5.0
func (s *ScalewayAPI) DeleteUserdata(serverID string, key string) error
DeleteUserdata deletes a server user_data
func (*ScalewayAPI) DisableAccountAPI ¶
func (s *ScalewayAPI) DisableAccountAPI()
DisableAccountAPI disable accountAPI
func (*ScalewayAPI) DisableMetadataAPI ¶ added in v1.5.0
func (s *ScalewayAPI) DisableMetadataAPI()
DisableMetadataAPI disable metadataAPI
func (*ScalewayAPI) EnableAccountAPI ¶
func (s *ScalewayAPI) EnableAccountAPI()
EnableAccountAPI enable accountAPI
func (*ScalewayAPI) EnableMetadataAPI ¶ added in v1.5.0
func (s *ScalewayAPI) EnableMetadataAPI()
EnableMetadataAPI enable metadataAPI
func (*ScalewayAPI) GetASecurityGroup ¶ added in v1.6.0
func (s *ScalewayAPI) GetASecurityGroup(groupsID string) (*ScalewayGetSecurityGroup, error)
GetASecurityGroup returns a ScalewaySecurityGroup
func (*ScalewayAPI) GetASecurityGroupRule ¶ added in v1.6.0
func (s *ScalewayAPI) GetASecurityGroupRule(groupID string, rulesID string) (*ScalewayGetSecurityGroupRule, error)
GetASecurityGroupRule returns a ScalewaySecurityGroupRule
func (*ScalewayAPI) GetBootscript ¶
func (s *ScalewayAPI) GetBootscript(bootscriptID string) (*ScalewayBootscript, error)
GetBootscript gets a bootscript from the ScalewayAPI
func (*ScalewayAPI) GetBootscriptID ¶
func (s *ScalewayAPI) GetBootscriptID(needle string) string
GetBootscriptID returns exactly one bootscript matching or dies
func (*ScalewayAPI) GetBootscripts ¶
func (s *ScalewayAPI) GetBootscripts() (*[]ScalewayBootscript, error)
GetBootscripts gets the list of bootscripts from the ScalewayAPI
func (*ScalewayAPI) GetContainerDatas ¶ added in v1.6.0
func (s *ScalewayAPI) GetContainerDatas(container string) (*ScalewayGetContainerDatas, error)
GetContainerDatas returns a ScalewayGetContainerDatas
func (*ScalewayAPI) GetContainers ¶ added in v1.6.0
func (s *ScalewayAPI) GetContainers() (*ScalewayGetContainers, error)
GetContainers returns a ScalewayGetContainers
func (*ScalewayAPI) GetDashboard ¶ added in v1.6.0
func (s *ScalewayAPI) GetDashboard() (*ScalewayDashboard, error)
GetDashboard returns the dashboard
func (*ScalewayAPI) GetIP ¶ added in v1.6.0
func (s *ScalewayAPI) GetIP(ipID string) (*ScalewayGetIP, error)
GetIP returns a ScalewayGetIP
func (*ScalewayAPI) GetIPS ¶ added in v1.6.0
func (s *ScalewayAPI) GetIPS() (*ScalewayGetIPS, error)
GetIPS returns a ScalewayGetIPS
func (*ScalewayAPI) GetImage ¶
func (s *ScalewayAPI) GetImage(imageID string) (*ScalewayImage, error)
GetImage gets an image from the ScalewayAPI
func (*ScalewayAPI) GetImageID ¶
func (s *ScalewayAPI) GetImageID(needle string, exitIfMissing bool) string
GetImageID returns exactly one image matching or dies
func (*ScalewayAPI) GetImages ¶
func (s *ScalewayAPI) GetImages() (*[]ScalewayImage, error)
GetImages gets the list of images from the ScalewayAPI
func (*ScalewayAPI) GetOrganization ¶
func (s *ScalewayAPI) GetOrganization() (*ScalewayOrganizationsDefinition, error)
GetOrganization returns Organization
func (*ScalewayAPI) GetPermissions ¶ added in v1.6.0
func (s *ScalewayAPI) GetPermissions() (*ScalewayPermissionDefinition, error)
GetPermissions returns the permissions
func (*ScalewayAPI) GetQuotas ¶ added in v1.6.0
func (s *ScalewayAPI) GetQuotas() (*ScalewayGetQuotas, error)
GetQuotas returns a ScalewayGetQuotas
func (*ScalewayAPI) GetResponse ¶
func (s *ScalewayAPI) GetResponse(resource string) (*http.Response, error)
GetResponse returns an http.Response object for the requested resource
func (*ScalewayAPI) GetSecurityGroupRules ¶ added in v1.6.0
func (s *ScalewayAPI) GetSecurityGroupRules(groupID string) (*ScalewayGetSecurityGroupRules, error)
GetSecurityGroupRules returns a ScalewaySecurityGroupRules
func (*ScalewayAPI) GetSecurityGroups ¶ added in v1.6.0
func (s *ScalewayAPI) GetSecurityGroups() (*ScalewayGetSecurityGroups, error)
GetSecurityGroups returns a ScalewaySecurityGroups
func (*ScalewayAPI) GetServer ¶
func (s *ScalewayAPI) GetServer(serverID string) (*ScalewayServer, error)
GetServer gets a server from the ScalewayAPI
func (*ScalewayAPI) GetServerID ¶
func (s *ScalewayAPI) GetServerID(needle string) string
GetServerID returns exactly one server matching or dies
func (*ScalewayAPI) GetServers ¶
func (s *ScalewayAPI) GetServers(all bool, limit int) (*[]ScalewayServer, error)
GetServers gets the list of servers from the ScalewayAPI
func (*ScalewayAPI) GetSnapshot ¶
func (s *ScalewayAPI) GetSnapshot(snapshotID string) (*ScalewaySnapshot, error)
GetSnapshot gets a snapshot from the ScalewayAPI
func (*ScalewayAPI) GetSnapshotID ¶
func (s *ScalewayAPI) GetSnapshotID(needle string) string
GetSnapshotID returns exactly one snapshot matching or dies
func (*ScalewayAPI) GetSnapshots ¶
func (s *ScalewayAPI) GetSnapshots() (*[]ScalewaySnapshot, error)
GetSnapshots gets the list of snapshots from the ScalewayAPI
func (*ScalewayAPI) GetTasks ¶
func (s *ScalewayAPI) GetTasks() (*[]ScalewayTask, error)
GetTasks get the list of tasks from the ScalewayAPI
func (*ScalewayAPI) GetUser ¶
func (s *ScalewayAPI) GetUser() (*ScalewayUserDefinition, error)
GetUser returns the user
func (*ScalewayAPI) GetUserID ¶
func (s *ScalewayAPI) GetUserID() (string, error)
GetUserID returns the userID
func (*ScalewayAPI) GetUserdata ¶ added in v1.5.0
func (s *ScalewayAPI) GetUserdata(serverID string, key string) (*ScalewayUserdata, error)
GetUserdata gets a specific userdata for a server
func (*ScalewayAPI) GetUserdatas ¶ added in v1.5.0
func (s *ScalewayAPI) GetUserdatas(serverID string) (*ScalewayUserdatas, error)
GetUserdatas gets list of userdata for a server
func (*ScalewayAPI) GetVolume ¶
func (s *ScalewayAPI) GetVolume(volumeID string) (*ScalewayVolume, error)
GetVolume gets a volume from the ScalewayAPI
func (*ScalewayAPI) GetVolumes ¶
func (s *ScalewayAPI) GetVolumes() (*[]ScalewayVolume, error)
GetVolumes gets the list of volumes from the ScalewayAPI
func (*ScalewayAPI) HideAPICredentials ¶
func (s *ScalewayAPI) HideAPICredentials(input string) string
HideAPICredentials removes API credentials from a string
func (*ScalewayAPI) NewIP ¶ added in v1.6.0
func (s *ScalewayAPI) NewIP() (*ScalewayGetIP, error)
NewIP returns a new IP
func (*ScalewayAPI) PatchResponse ¶
func (s *ScalewayAPI) PatchResponse(resource string, data interface{}) (*http.Response, error)
PatchResponse returns an http.Response object for the updated resource
func (*ScalewayAPI) PatchServer ¶
func (s *ScalewayAPI) PatchServer(serverID string, definition ScalewayServerPatchDefinition) error
PatchServer updates a server
func (*ScalewayAPI) PatchUserSSHKey ¶
func (s *ScalewayAPI) PatchUserSSHKey(UserID string, definition ScalewayUserPatchSSHKeyDefinition) error
PatchUserSSHKey updates a user
func (*ScalewayAPI) PatchUserdata ¶ added in v1.5.0
func (s *ScalewayAPI) PatchUserdata(serverID string, key string, value []byte) error
PatchUserdata sets a user data
func (*ScalewayAPI) PostImage ¶
func (s *ScalewayAPI) PostImage(volumeID string, name string, bootscript string, arch string) (string, error)
PostImage creates a new image
func (*ScalewayAPI) PostResponse ¶
func (s *ScalewayAPI) PostResponse(resource string, data interface{}) (*http.Response, error)
PostResponse returns an http.Response object for the updated resource
func (*ScalewayAPI) PostSecurityGroup ¶ added in v1.7.0
func (s *ScalewayAPI) PostSecurityGroup(group ScalewayNewSecurityGroup) error
PostSecurityGroup posts a group on a server
func (*ScalewayAPI) PostSecurityGroupRule ¶ added in v1.7.0
func (s *ScalewayAPI) PostSecurityGroupRule(SecurityGroupID string, rules ScalewayNewSecurityGroupRule) error
PostSecurityGroupRule posts a rule on a server
func (*ScalewayAPI) PostServer ¶
func (s *ScalewayAPI) PostServer(definition ScalewayServerDefinition) (string, error)
PostServer creates a new server
func (*ScalewayAPI) PostServerAction ¶
func (s *ScalewayAPI) PostServerAction(serverID, action string) error
PostServerAction posts an action on a server
func (*ScalewayAPI) PostSnapshot ¶
func (s *ScalewayAPI) PostSnapshot(volumeID string, name string) (string, error)
PostSnapshot creates a new snapshot
func (*ScalewayAPI) PostVolume ¶
func (s *ScalewayAPI) PostVolume(definition ScalewayVolumeDefinition) (string, error)
PostVolume creates a new volume
func (*ScalewayAPI) PutResponse ¶
func (s *ScalewayAPI) PutResponse(resource string, data interface{}) (*http.Response, error)
PutResponse returns an http.Response object for the updated resource
func (*ScalewayAPI) PutSecurityGroup ¶ added in v1.7.0
func (s *ScalewayAPI) PutSecurityGroup(group ScalewayNewSecurityGroup, securityGroupID string) error
PutSecurityGroup updates a SecurityGroup
func (*ScalewayAPI) PutSecurityGroupRule ¶ added in v1.7.0
func (s *ScalewayAPI) PutSecurityGroupRule(rules ScalewayNewSecurityGroupRule, securityGroupID, RuleID string) error
PutSecurityGroupRule updates a SecurityGroupRule
func (*ScalewayAPI) PutVolume ¶
func (s *ScalewayAPI) PutVolume(volumeID string, definition ScalewayVolumePutDefinition) error
PutVolume updates a volume
func (*ScalewayAPI) ResolveBootscript ¶
func (s *ScalewayAPI) ResolveBootscript(needle string) (ScalewayResolverResults, error)
ResolveBootscript attempts the find a matching Identifier for the input string
func (*ScalewayAPI) ResolveImage ¶
func (s *ScalewayAPI) ResolveImage(needle string) (ScalewayResolverResults, error)
ResolveImage attempts the find a matching Identifier for the input string
func (*ScalewayAPI) ResolveServer ¶
func (s *ScalewayAPI) ResolveServer(needle string) (ScalewayResolverResults, error)
ResolveServer attempts the find a matching Identifier for the input string
func (*ScalewayAPI) ResolveSnapshot ¶
func (s *ScalewayAPI) ResolveSnapshot(needle string) (ScalewayResolverResults, error)
ResolveSnapshot attempts the find a matching Identifier for the input string
func (*ScalewayAPI) SetPassword ¶
func (s *ScalewayAPI) SetPassword(password string)
SetPassword register the password
type ScalewayAPIError ¶
type ScalewayAPIError struct { // Message is a human-friendly error message APIMessage string `json:"message,omitempty"` // Type is a string code that defines the kind of error Type string `json:"type,omitempty"` // Fields contains detail about validation error Fields map[string][]string `json:"fields,omitempty"` // StatusCode is the HTTP status code received StatusCode int `json:"-"` // Message Message string `json:"-"` }
ScalewayAPIError represents a Scaleway API Error
func (ScalewayAPIError) Debug ¶
func (e ScalewayAPIError) Debug()
Debug create a debug log entry with HTTP error informations
func (ScalewayAPIError) Error ¶
func (e ScalewayAPIError) Error() string
Error returns a string representing the error
type ScalewayBootCmdArgs ¶
type ScalewayBootCmdArgs struct { // Identifier is the unique identifier of boot args Identifier string `json:"id,omitempty"` // Value is the content of the cmd args Value string `json:"value,omitempty"` }
ScalewayBootCmdArgs represents the boot arguments of a bootscript
type ScalewayBootscript ¶
type ScalewayBootscript struct { // Identifier is a unique identifier for the bootscript Identifier string `json:"id,omitempty"` // Name is a user-defined name for the bootscript Title string `json:"title,omitempty"` // BootCmdArgs represents the arguments used to boot BootCmdArgs ScalewayBootCmdArgs `json:"bootcmdargs,omitempty"` // Initrd is the initrd used by this bootscript Initrd ScalewayInitrd `json:"initrd,omitempty"` // Kernel is the kernel associated to this server Kernel ScalewayKernel `json:"kernel,omitempty"` // Public is true for public bootscripts and false for user bootscripts Public bool `json:"public,omitempty"` }
ScalewayBootscript represents a Scaleway Bootscript
type ScalewayBootscripts ¶
type ScalewayBootscripts struct { // Bootscripts holds Scaleway bootscripts of the response Bootscripts []ScalewayBootscript `json:"bootscripts,omitempty"` }
ScalewayBootscripts represents a group of Scaleway bootscripts
type ScalewayCache ¶
type ScalewayCache struct { // Images contains names of Scaleway images indexed by identifier Images map[string]string `json:"images"` // Snapshots contains names of Scaleway snapshots indexed by identifier Snapshots map[string]string `json:"snapshots"` // Volumes contains names of Scaleway volumes indexed by identifier Volumes map[string]string `json:"volumes"` // Bootscripts contains names of Scaleway bootscripts indexed by identifier Bootscripts map[string]string `json:"bootscripts"` // Servers contains names of Scaleway C1 servers indexed by identifier Servers map[string]string `json:"servers"` // Path is the path to the cache file Path string `json:"-"` // Modified tells if the cache needs to be overwritten or not Modified bool `json:"-"` // Lock allows ScalewayCache to be used concurrently Lock sync.Mutex `json:"-"` }
ScalewayCache is used not to query the API to resolve full identifiers
func NewScalewayCache ¶
func NewScalewayCache() (*ScalewayCache, error)
NewScalewayCache loads a per-user cache
func (*ScalewayCache) ClearBootscripts ¶
func (c *ScalewayCache) ClearBootscripts()
ClearBootscripts removes all bootscripts from the cache
func (*ScalewayCache) ClearImages ¶
func (c *ScalewayCache) ClearImages()
ClearImages removes all images from the cache
func (*ScalewayCache) ClearServers ¶
func (c *ScalewayCache) ClearServers()
ClearServers removes all servers from the cache
func (*ScalewayCache) ClearSnapshots ¶
func (c *ScalewayCache) ClearSnapshots()
ClearSnapshots removes all snapshots from the cache
func (*ScalewayCache) ClearVolumes ¶
func (c *ScalewayCache) ClearVolumes()
ClearVolumes removes all volumes from the cache
func (*ScalewayCache) Flush ¶
func (c *ScalewayCache) Flush() error
Flush flushes the cache database
func (*ScalewayCache) GetNbBootscripts ¶
func (c *ScalewayCache) GetNbBootscripts() int
GetNbBootscripts returns the number of bootscripts in the cache
func (*ScalewayCache) GetNbImages ¶
func (c *ScalewayCache) GetNbImages() int
GetNbImages returns the number of images in the cache
func (*ScalewayCache) GetNbServers ¶
func (c *ScalewayCache) GetNbServers() int
GetNbServers returns the number of servers in the cache
func (*ScalewayCache) GetNbSnapshots ¶
func (c *ScalewayCache) GetNbSnapshots() int
GetNbSnapshots returns the number of snapshots in the cache
func (*ScalewayCache) GetNbVolumes ¶
func (c *ScalewayCache) GetNbVolumes() int
GetNbVolumes returns the number of volumes in the cache
func (*ScalewayCache) InsertBootscript ¶
func (c *ScalewayCache) InsertBootscript(identifier, name string)
InsertBootscript registers an bootscript in the cache
func (*ScalewayCache) InsertImage ¶
func (c *ScalewayCache) InsertImage(identifier, name string)
InsertImage registers an image in the cache
func (*ScalewayCache) InsertServer ¶
func (c *ScalewayCache) InsertServer(identifier, name string)
InsertServer registers a server in the cache
func (*ScalewayCache) InsertSnapshot ¶
func (c *ScalewayCache) InsertSnapshot(identifier, name string)
InsertSnapshot registers an snapshot in the cache
func (*ScalewayCache) InsertVolume ¶
func (c *ScalewayCache) InsertVolume(identifier, name string)
InsertVolume registers an volume in the cache
func (*ScalewayCache) LookUpBootscripts ¶
func (c *ScalewayCache) LookUpBootscripts(needle string, acceptUUID bool) ScalewayResolverResults
LookUpBootscripts attempts to return identifiers matching a pattern
func (*ScalewayCache) LookUpIdentifiers ¶
func (c *ScalewayCache) LookUpIdentifiers(needle string) ScalewayResolverResults
LookUpIdentifiers attempts to return identifiers matching a pattern
func (*ScalewayCache) LookUpImages ¶
func (c *ScalewayCache) LookUpImages(needle string, acceptUUID bool) ScalewayResolverResults
LookUpImages attempts to return identifiers matching a pattern
func (*ScalewayCache) LookUpServers ¶
func (c *ScalewayCache) LookUpServers(needle string, acceptUUID bool) ScalewayResolverResults
LookUpServers attempts to return identifiers matching a pattern
func (*ScalewayCache) LookUpSnapshots ¶
func (c *ScalewayCache) LookUpSnapshots(needle string, acceptUUID bool) ScalewayResolverResults
LookUpSnapshots attempts to return identifiers matching a pattern
func (*ScalewayCache) LookUpVolumes ¶
func (c *ScalewayCache) LookUpVolumes(needle string, acceptUUID bool) ScalewayResolverResults
LookUpVolumes attempts to return identifiers matching a pattern
func (*ScalewayCache) RemoveBootscript ¶
func (c *ScalewayCache) RemoveBootscript(identifier string)
RemoveBootscript removes a bootscript from the cache
func (*ScalewayCache) RemoveImage ¶
func (c *ScalewayCache) RemoveImage(identifier string)
RemoveImage removes a server from the cache
func (*ScalewayCache) RemoveServer ¶
func (c *ScalewayCache) RemoveServer(identifier string)
RemoveServer removes a server from the cache
func (*ScalewayCache) RemoveSnapshot ¶
func (c *ScalewayCache) RemoveSnapshot(identifier string)
RemoveSnapshot removes a server from the cache
func (*ScalewayCache) RemoveVolume ¶
func (c *ScalewayCache) RemoveVolume(identifier string)
RemoveVolume removes a server from the cache
func (*ScalewayCache) Save ¶
func (c *ScalewayCache) Save() error
Save atomically overwrites the current cache database
type ScalewayConnect ¶
type ScalewayConnect struct { Email string `json:"email"` Password string `json:"password"` Description string `json:"description"` Expires bool `json:"expires"` }
ScalewayConnect represents the data to connect
type ScalewayConnectResponse ¶
type ScalewayConnectResponse struct {
Token ScalewayTokenDefinition `json:"token"`
}
ScalewayConnectResponse represents the answer from POST /tokens
type ScalewayContainer ¶ added in v1.6.0
type ScalewayContainer struct { ScalewayOrganizationDefinition `json:"organization"` Name string `json:"name"` Size string `json:"size"` }
type ScalewayContainerData ¶ added in v1.6.0
type ScalewayDashboard ¶ added in v1.6.0
type ScalewayDashboard struct { VolumesCount int `json:"volumes_count"` RunningServersCount int `json:"running_servers_count"` ImagesCount int `json:"images_count"` SnapshotsCount int `json:"snapshots_count"` ServersCount int `json:"servers_count"` IPsCount int `json:"ips_count"` }
ScalewayDashboard represents a dashboard
type ScalewayDashboardResp ¶ added in v1.6.0
type ScalewayDashboardResp struct {
Dashboard ScalewayDashboard
}
ScalewayDashboardResp represents a dashboard received from the API
type ScalewayGetContainerDatas ¶ added in v1.6.0
type ScalewayGetContainerDatas struct {
Container []ScalewayContainerData `json:"container"`
}
type ScalewayGetContainers ¶ added in v1.6.0
type ScalewayGetContainers struct {
Containers []ScalewayContainer `json:"containers"`
}
type ScalewayGetIP ¶ added in v1.6.0
type ScalewayGetIP struct {
IP ScalewayIPDefinition `json:"ip"`
}
ScalewayGetIP represents the response of a GET /ips/{id_ip}
type ScalewayGetIPS ¶ added in v1.6.0
type ScalewayGetIPS struct {
IPS []ScalewayIPDefinition `json:"ips"`
}
ScalewayGetIPS represents the response of a GET /ips/
type ScalewayGetQuotas ¶ added in v1.6.0
type ScalewayGetQuotas struct {
Quotas ScalewayQuota `json:"quotas"`
}
ScalewayGetQuotas represents the response of GET /organizations/{orga_id}/quotas
type ScalewayGetSecurityGroup ¶ added in v1.6.0
type ScalewayGetSecurityGroup struct {
SecurityGroups ScalewaySecurityGroups `json:"security_group"`
}
ScalewayGetSecurityGroup represents the response of a GET /security_groups/{groupID}
type ScalewayGetSecurityGroupRule ¶ added in v1.6.0
type ScalewayGetSecurityGroupRule struct {
Rules ScalewaySecurityGroupRule `json:"rule"`
}
ScalewayGetSecurityGroupRule represents the response of a GET /security_group/{groupID}/rules/{ruleID}
type ScalewayGetSecurityGroupRules ¶ added in v1.6.0
type ScalewayGetSecurityGroupRules struct {
Rules []ScalewaySecurityGroupRule `json:"rules"`
}
ScalewayGetSecurityGroupRules represents the response of a GET /security_group/{groupID}/rules
type ScalewayGetSecurityGroups ¶ added in v1.6.0
type ScalewayGetSecurityGroups struct {
SecurityGroups []ScalewaySecurityGroups `json:"security_groups"`
}
ScalewayGetSecurityGroups represents the response of a GET /security_groups/
type ScalewayIPAddress ¶
type ScalewayIPAddress struct { // Identifier is a unique identifier for the IP address Identifier string `json:"id,omitempty"` // IP is an IPv4 address IP string `json:"address,omitempty"` // Dynamic is a flag that defines an IP that change on each reboot Dynamic *bool `json:"dynamic,omitempty"` }
ScalewayIPAddress represents a Scaleway IP address
type ScalewayIPDefinition ¶ added in v1.6.0
type ScalewayIPDefinition struct { Organization string `json:"organization"` Reverse string `json:"reverse"` ID string `json:"id"` Server struct { Identifier string `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"server,omitempty"` Address string `json:"address"` }
ScalewayIPDefinition represents the IP's fields
type ScalewayImage ¶
type ScalewayImage struct { // Identifier is a unique identifier for the image Identifier string `json:"id,omitempty"` // Name is a user-defined name for the image Name string `json:"name,omitempty"` // CreationDate is the creation date of the image CreationDate string `json:"creation_date,omitempty"` // ModificationDate is the date of the last modification of the image ModificationDate string `json:"modification_date,omitempty"` // RootVolume is the root volume bound to the image RootVolume ScalewayVolume `json:"root_volume,omitempty"` // Public is true for public images and false for user images Public bool `json:"public,omitempty"` // Bootscript is the bootscript bound to the image DefaultBootscript *ScalewayBootscript `json:"default_bootscript,omitempty"` // Organization is the owner of the image Organization string `json:"organization,omitempty"` // Arch is the architecture target of the image Arch string `json:"arch,omitempty"` }
ScalewayImage represents a Scaleway Image
type ScalewayImageDefinition ¶
type ScalewayImageDefinition struct { SnapshotIDentifier string `json:"root_volume"` Name string `json:"name,omitempty"` Organization string `json:"organization"` Arch string `json:"arch"` DefaultBootscript *string `json:"default_bootscript,omitempty"` }
ScalewayImageDefinition represents a Scaleway image definition
type ScalewayImageInterface ¶
type ScalewayImageInterface struct { CreationDate time.Time Identifier string Name string Tag string VirtualSize float64 Public bool Type string Organization string }
ScalewayImageInterface is an interface to multiple Scaleway items
type ScalewayImages ¶
type ScalewayImages struct { // Images holds scaleway images of the response Images []ScalewayImage `json:"images,omitempty"` }
ScalewayImages represents a group of Scaleway images
type ScalewayInitrd ¶
type ScalewayInitrd struct { // Identifier is the unique identifier of the initrd Identifier string `json:"id,omitempty"` // Path is the path to the initrd used Path string `json:"path,omitempty"` // Title is the title of the initrd used Title string `json:"title,omitempty"` }
ScalewayInitrd represents the initrd used by a bootscript
type ScalewayKernel ¶
type ScalewayKernel struct { // Identifier is the unique identifier of the kernel Identifier string `json:"id,omitempty"` // DTB is the kernel DTB used by this kernel DTB string `json:"dtb"` // Path is the path to the kernel image Path string `json:"path,omitempty"` // Title is the title of the kernel Title string `json:"title,omitempty"` }
ScalewayKernel represents a kernel used on C1 servers
type ScalewayKeyDefinition ¶
type ScalewayKeyDefinition struct {
Key string `json:"key"`
}
ScalewayKeyDefinition represents a key
type ScalewayNewSecurityGroup ¶ added in v1.6.0
type ScalewayNewSecurityGroup struct { Organization string `json:"organization"` Name string `json:"name"` Description string `json:"description"` }
ScalewayNewSecurityGroup definition POST/PUT request /security_groups
type ScalewayNewSecurityGroupRule ¶ added in v1.6.0
type ScalewayNewSecurityGroupRule struct { Action string `json:"action"` Direction string `json:"direction"` IPRange string `json:"ip_range"` Protocol string `json:"protocol"` DestPortFrom int `json:"dest_port_from,omitempty"` }
ScalewayNewSecurityGroupRule definition POST/PUT request /security_group/{groupID}
type ScalewayOneBootscript ¶
type ScalewayOneBootscript struct {
Bootscript ScalewayBootscript `json:"bootscript,omitempty"`
}
ScalewayOneBootscript represents the response of a GET /bootscripts/UUID API call
type ScalewayOneImage ¶
type ScalewayOneImage struct {
Image ScalewayImage `json:"image,omitempty"`
}
ScalewayOneImage represents the response of a GET /images/UUID API call
type ScalewayOneServer ¶
type ScalewayOneServer struct {
Server ScalewayServer `json:"server,omitempty"`
}
ScalewayOneServer represents the response of a GET /servers/UUID API call
type ScalewayOneSnapshot ¶
type ScalewayOneSnapshot struct {
Snapshot ScalewaySnapshot `json:"snapshot,omitempty"`
}
ScalewayOneSnapshot represents the response of a GET /snapshots/UUID API call
type ScalewayOneTask ¶
type ScalewayOneTask struct {
Task ScalewayTask `json:"task,omitempty"`
}
ScalewayOneTask represents the response of a GET /tasks/UUID API call
type ScalewayOneVolume ¶
type ScalewayOneVolume struct {
Volume ScalewayVolume `json:"volume,omitempty"`
}
ScalewayOneVolume represents the response of a GET /volumes/UUID API call
type ScalewayOrganizationDefinition ¶
type ScalewayOrganizationDefinition struct { ID string `json:"id"` Name string `json:"name"` Users []ScalewayUserDefinition `json:"users"` }
ScalewayOrganizationDefinition represents a Scaleway Organization
type ScalewayOrganizationsDefinition ¶
type ScalewayOrganizationsDefinition struct {
Organizations []ScalewayOrganizationDefinition `json:"organizations"`
}
ScalewayOrganizationsDefinition represents a Scaleway Organizations
type ScalewayPermCategory ¶ added in v1.6.0
ScalewayPermCategory represents ScalewayPermissions's fields
type ScalewayPermissionDefinition ¶ added in v1.6.0
type ScalewayPermissionDefinition struct {
Permissions ScalewayPermissions `json:"permissions"`
}
ScalewayPermissionDefinition represents the permissions
type ScalewayPermissions ¶ added in v1.6.0
type ScalewayPermissions map[string]ScalewayPermCategory
ScalewayPermissions represents the response of GET /permissions
type ScalewayQuota ¶ added in v1.6.0
type ScalewayResolvedIdentifier ¶
type ScalewayResolvedIdentifier struct { // Identifiers holds matching identifiers Identifiers ScalewayResolverResults // Needle is the criteria used to lookup identifiers Needle string }
ScalewayResolvedIdentifier represents a list of matching identifier for a specifier pattern
type ScalewayResolverResult ¶
type ScalewayResolverResult struct { Identifier string Type int Name string Needle string RankMatch int }
ScalewayResolverResult is a structure containing human-readable information about resolver results. This structure is used to display the user choices.
func GetIdentifier ¶
func GetIdentifier(api *ScalewayAPI, needle string) *ScalewayResolverResult
GetIdentifier returns a an identifier if the resolved needles only match one element, else, it exists the program
func (*ScalewayResolverResult) CodeName ¶
func (s *ScalewayResolverResult) CodeName() string
CodeName returns a full resource name with typed prefix
func (*ScalewayResolverResult) ComputeRankMatch ¶
func (s *ScalewayResolverResult) ComputeRankMatch(needle string)
ComputeRankMatch fills `ScalewayResolverResult.RankMatch` with its `fuzzy` score
func (*ScalewayResolverResult) TruncIdentifier ¶
func (s *ScalewayResolverResult) TruncIdentifier() string
TruncIdentifier returns first 8 characters of an Identifier (UUID)
type ScalewayResolverResults ¶
type ScalewayResolverResults []ScalewayResolverResult
ScalewayResolverResults is a list of `ScalewayResolverResult`
func ResolveIdentifier ¶
func ResolveIdentifier(api *ScalewayAPI, needle string) ScalewayResolverResults
ResolveIdentifier resolves needle provided by the user
func (ScalewayResolverResults) Len ¶
func (s ScalewayResolverResults) Len() int
func (ScalewayResolverResults) Less ¶
func (s ScalewayResolverResults) Less(i, j int) bool
func (ScalewayResolverResults) Swap ¶
func (s ScalewayResolverResults) Swap(i, j int)
type ScalewayRoleDefinition ¶
type ScalewayRoleDefinition struct { Organization ScalewayOrganizationDefinition `json:"organization,omitempty"` Role string `json:"role,omitempty"` }
ScalewayRoleDefinition represents a Scaleway Token UserId Role
type ScalewaySecurityGroup ¶
type ScalewaySecurityGroup struct { // Identifier is a unique identifier for the security group Identifier string `json:"id,omitempty"` // Name is the user-defined name of the security group Name string `json:"name,omitempty"` }
ScalewaySecurityGroup represents a Scaleway security group
type ScalewaySecurityGroupRule ¶ added in v1.6.0
type ScalewaySecurityGroupRule struct { Direction string `json:"direction"` Protocol string `json:"protocol"` IPRange string `json:"ip_range"` DestPortFrom int `json:"dest_port_from,omitempty"` Action string `json:"action"` Postion int `json:"position"` DestPortTo string `json:"dest_port_to"` Editable bool `json:"editable"` ID string `json:"id"` }
ScalewaySecurityGroupRule definition
type ScalewaySecurityGroups ¶ added in v1.6.0
type ScalewaySecurityGroups struct { Description string `json:"description"` EnableDefaultSecurity bool `json:"enable_default_security"` ID string `json:"id"` Organization string `json:"organization"` Name string `json:"name"` OrganizationDefault bool `json:"organization_default"` Servers []ScalewaySecurityGroup `json:"servers"` }
ScalewaySecurityGroups definition
type ScalewayServer ¶
type ScalewayServer struct { // Identifier is a unique identifier for the server Identifier string `json:"id,omitempty"` // Name is the user-defined name of the server Name string `json:"name,omitempty"` // CreationDate is the creation date of the server CreationDate string `json:"creation_date,omitempty"` // ModificationDate is the date of the last modification of the server ModificationDate string `json:"modification_date,omitempty"` // Image is the image used by the server Image ScalewayImage `json:"image,omitempty"` // DynamicIPRequired is a flag that defines a server with a dynamic ip address attached DynamicIPRequired *bool `json:"dynamic_ip_required,omitempty"` // PublicIP is the public IP address bound to the server PublicAddress ScalewayIPAddress `json:"public_ip,omitempty"` // State is the current status of the server State string `json:"state,omitempty"` // StateDetail is the detailed status of the server StateDetail string `json:"state_detail,omitempty"` // PrivateIP represents the private IPV4 attached to the server (changes on each boot) PrivateIP string `json:"private_ip,omitempty"` // Bootscript is the unique identifier of the selected bootscript Bootscript *ScalewayBootscript `json:"bootscript,omitempty"` // Hostname represents the ServerName in a format compatible with unix's hostname Hostname string `json:"hostname,omitempty"` // Tags represents user-defined tags Tags []string `json:"tags,omitempty"` // Volumes are the attached volumes Volumes map[string]ScalewayVolume `json:"volumes,omitempty"` // SecurityGroup is the selected security group object SecurityGroup ScalewaySecurityGroup `json:"security_group,omitempty"` // Organization is the owner of the server Organization string `json:"organization,omitempty"` // CommercialType is the commercial type of the server (i.e: C1) CommercialType string `json:"commercial_type,omitempty"` // Location of the server Location struct { Platform string `json:"platform_id,omitempty"` Chassis string `json:"chassis_id,omitempty"` Blade string `json:"blade_id,omitempty"` Node string `json:"node_id,omitempty"` } `json:"location,omitempty"` }
ScalewayServer represents a Scaleway C1 server
func WaitForServerReady ¶
func WaitForServerReady(api *ScalewayAPI, serverID string, gateway string) (*ScalewayServer, error)
WaitForServerReady wait for a server state to be running, then wait for the SSH port to be available
func WaitForServerState ¶
func WaitForServerState(api *ScalewayAPI, serverID string, targetState string) (*ScalewayServer, error)
WaitForServerState asks API in a loop until a server matches a wanted state
func WaitForServerStopped ¶
func WaitForServerStopped(api *ScalewayAPI, serverID string) (*ScalewayServer, error)
WaitForServerStopped wait for a server state to be stopped
type ScalewayServerAction ¶
type ScalewayServerAction struct { // Action is the name of the action to trigger Action string `json:"action,omitempty"` }
ScalewayServerAction represents an action to perform on a Scaleway C1 server
type ScalewayServerDefinition ¶
type ScalewayServerDefinition struct { // Name is the user-defined name of the server Name string `json:"name"` // Image is the image used by the server Image *string `json:"image,omitempty"` // Volumes are the attached volumes Volumes map[string]string `json:"volumes,omitempty"` // DynamicIPRequired is a flag that defines a server with a dynamic ip address attached DynamicIPRequired *bool `json:"dynamic_ip_required,omitempty"` // Bootscript is the bootscript used by the server Bootscript *string `json:"bootscript"` // Tags are the metadata tags attached to the server Tags []string `json:"tags,omitempty"` // Organization is the owner of the server Organization string `json:"organization"` // CommercialType is the commercial type of the server (i.e: C1) CommercialType string `json:"commercial_type"` PublicIP string `json:"public_ip,omitempty"` }
ScalewayServerDefinition represents a Scaleway C1 server with image definition
type ScalewayServerPatchDefinition ¶
type ScalewayServerPatchDefinition struct { Name *string `json:"name,omitempty"` CreationDate *string `json:"creation_date,omitempty"` ModificationDate *string `json:"modification_date,omitempty"` Image *ScalewayImage `json:"image,omitempty"` DynamicIPRequired *bool `json:"dynamic_ip_required,omitempty"` PublicAddress *ScalewayIPAddress `json:"public_ip,omitempty"` State *string `json:"state,omitempty"` StateDetail *string `json:"state_detail,omitempty"` PrivateIP *string `json:"private_ip,omitempty"` Bootscript *ScalewayBootscript `json:"bootscript,omitempty"` Hostname *string `json:"hostname,omitempty"` Volumes *map[string]ScalewayVolume `json:"volumes,omitempty"` SecurityGroup *ScalewaySecurityGroup `json:"security_group,omitempty"` Organization *string `json:"organization,omitempty"` Tags *[]string `json:"tags,omitempty"` }
ScalewayServerPatchDefinition represents a Scaleway C1 server with nullable fields (for PATCH)
type ScalewayServers ¶
type ScalewayServers struct { // Servers holds scaleway servers of the response Servers []ScalewayServer `json:"servers,omitempty"` }
ScalewayServers represents a group of Scaleway C1 servers
type ScalewaySnapshot ¶
type ScalewaySnapshot struct { // Identifier is a unique identifier for the snapshot Identifier string `json:"id,omitempty"` // Name is a user-defined name for the snapshot Name string `json:"name,omitempty"` // CreationDate is the creation date of the snapshot CreationDate string `json:"creation_date,omitempty"` // ModificationDate is the date of the last modification of the snapshot ModificationDate string `json:"modification_date,omitempty"` // Size is the allocated size of the volume Size uint64 `json:"size,omitempty"` // Organization is the owner of the snapshot Organization string `json:"organization"` // State is the current state of the snapshot State string `json:"state"` // VolumeType is the kind of volume behind the snapshot VolumeType string `json:"volume_type"` // BaseVolume is the volume from which the snapshot inherits BaseVolume ScalewayVolume `json:"base_volume,omitempty"` }
ScalewaySnapshot represents a Scaleway Snapshot
type ScalewaySnapshotDefinition ¶
type ScalewaySnapshotDefinition struct { VolumeIDentifier string `json:"volume_id"` Name string `json:"name,omitempty"` Organization string `json:"organization"` }
ScalewaySnapshotDefinition represents a Scaleway snapshot definition
type ScalewaySnapshots ¶
type ScalewaySnapshots struct { // Snapshots holds scaleway snapshots of the response Snapshots []ScalewaySnapshot `json:"snapshots,omitempty"` }
ScalewaySnapshots represents a group of Scaleway snapshots
type ScalewayTask ¶
type ScalewayTask struct { // Identifier is a unique identifier for the task Identifier string `json:"id,omitempty"` // StartDate is the start date of the task StartDate string `json:"started_at,omitempty"` // TerminationDate is the termination date of the task TerminationDate string `json:"terminated_at,omitempty"` HrefFrom string `json:"href_from,omitempty"` Description string `json:"description,omitempty"` Status string `json:"status,omitempty"` Progress int `json:"progress,omitempty"` }
ScalewayTask represents a Scaleway Task
type ScalewayTasks ¶
type ScalewayTasks struct { // Tasks holds scaleway tasks of the response Tasks []ScalewayTask `json:"tasks,omitempty"` }
ScalewayTasks represents a group of Scaleway tasks
type ScalewayTokenDefinition ¶
type ScalewayTokenDefinition struct { UserID string `json:"user_id"` Description string `json:"description,omitempty"` Roles ScalewayRoleDefinition `json:"roles"` Expires string `json:"expires"` InheritsUsersPerms bool `json:"inherits_user_perms"` ID string `json:"id"` }
ScalewayTokenDefinition represents a Scaleway Token
type ScalewayTokensDefinition ¶
type ScalewayTokensDefinition struct {
Token ScalewayTokenDefinition `json:"token"`
}
ScalewayTokensDefinition represents a Scaleway Tokens
type ScalewayUserDefinition ¶
type ScalewayUserDefinition struct { Email string `json:"email"` Firstname string `json:"firstname"` Fullname string `json:"fullname"` ID string `json:"id"` Lastname string `json:"lastname"` Organizations []ScalewayOrganizationDefinition `json:"organizations"` Roles []ScalewayRoleDefinition `json:"roles"` SSHPublicKeys []ScalewayKeyDefinition `json:"ssh_public_keys"` }
ScalewayUserDefinition represents a Scaleway User
type ScalewayUserPatchSSHKeyDefinition ¶
type ScalewayUserPatchSSHKeyDefinition struct {
SSHPublicKeys []ScalewayKeyDefinition `json:"ssh_public_keys"`
}
ScalewayUserPatchSSHKeyDefinition represents a User Patch
type ScalewayUserdata ¶ added in v1.5.0
type ScalewayUserdata []byte
ScalewayUserdata represents []byte
func (*ScalewayUserdata) String ¶ added in v1.5.0
func (s *ScalewayUserdata) String() string
type ScalewayUserdatas ¶ added in v1.5.0
type ScalewayUserdatas struct {
UserData []string `json:"user_data"`
}
ScalewayUserdatas represents the response of a GET /user_data
type ScalewayUsersDefinition ¶
type ScalewayUsersDefinition struct {
User ScalewayUserDefinition `json:"user"`
}
ScalewayUsersDefinition represents the response of a GET /user
type ScalewayVolume ¶
type ScalewayVolume struct { // Identifier is a unique identifier for the volume Identifier string `json:"id,omitempty"` // Size is the allocated size of the volume Size uint64 `json:"size,omitempty"` // CreationDate is the creation date of the volume CreationDate string `json:"creation_date,omitempty"` // ModificationDate is the date of the last modification of the volume ModificationDate string `json:"modification_date,omitempty"` // Organization is the organization owning the volume Organization string `json:"organization,omitempty"` // Name is the name of the volume Name string `json:"name,omitempty"` // Server is the server using this image Server *struct { Identifier string `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"server,omitempty"` // VolumeType is a Scaleway identifier for the kind of volume (default: l_ssd) VolumeType string `json:"volume_type,omitempty"` // ExportURI represents the url used by initrd/scripts to attach the volume ExportURI string `json:"export_uri,omitempty"` }
ScalewayVolume represents a Scaleway Volume
type ScalewayVolumeDefinition ¶
type ScalewayVolumeDefinition struct { // Name is the user-defined name of the volume Name string `json:"name"` // Image is the image used by the volume Size uint64 `json:"size"` // Bootscript is the bootscript used by the volume Type string `json:"volume_type"` // Organization is the owner of the volume Organization string `json:"organization"` }
ScalewayVolumeDefinition represents a Scaleway C1 volume definition
type ScalewayVolumePutDefinition ¶
type ScalewayVolumePutDefinition struct { Identifier *string `json:"id,omitempty"` Size *uint64 `json:"size,omitempty"` CreationDate *string `json:"creation_date,omitempty"` ModificationDate *string `json:"modification_date,omitempty"` Organization *string `json:"organization,omitempty"` Name *string `json:"name,omitempty"` Server struct { Identifier *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` } `json:"server,omitempty"` VolumeType *string `json:"volume_type,omitempty"` ExportURI *string `json:"export_uri,omitempty"` }
ScalewayVolumePutDefinition represents a Scaleway C1 volume with nullable fields (for PUT)
type ScalewayVolumes ¶
type ScalewayVolumes struct { // Volumes holds scaleway volumes of the response Volumes []ScalewayVolume `json:"volumes,omitempty"` }
ScalewayVolumes represents a group of Scaleway volumes