Documentation ¶
Overview ¶
Package api contains client and functions to interact with API
Index ¶
- Variables
- type API
- func (s *API) AttachIP(ipID, serverID string) error
- func (s *API) CreateIP() (*IPV4, error)
- func (s *API) CreateImage(volumeID string, name string, bootscript string, arch string) (*Image, error)
- func (s *API) CreateMarketPlaceImage(images MarketImage) error
- func (s *API) CreateMarketPlaceImageVersion(uuidImage string, version MarketVersion) error
- func (s *API) CreateMarketPlaceLocalImage(uuidImage, uuidVersion, uuidLocalImage string, local MarketLocalImage) error
- func (s *API) CreateSecurityGroup(group NewSecurityGroup) (*SecurityGroup, error)
- func (s *API) CreateSecurityGroupRule(GroupID string, rules NewSecurityGroupRule) (*SecurityGroupRule, error)
- func (s *API) CreateServer(definition ServerDefinition) (*Server, error)
- func (s *API) CreateSnapshot(volumeID string, name string) (*Snapshot, error)
- func (s *API) CreateToken(req *CreateTokenRequest) (*Token, error)
- func (s *API) CreateVolume(definition VolumeDefinition) (*Volume, error)
- func (s *API) DeleteIP(ipID string) error
- func (s *API) DeleteImage(imageID string) error
- func (s *API) DeleteMarketPlaceImage(uudImage string) error
- func (s *API) DeleteMarketPlaceImageVersion(uuidImage, uuidVersion string) error
- func (s *API) DeleteMarketPlaceLocalImage(uuidImage, uuidVersion, uuidLocalImage string) error
- func (s *API) DeleteResponse(apiURL, resource string) (*http.Response, error)
- func (s *API) DeleteSecurityGroup(securityGroupID string) error
- func (s *API) DeleteSecurityGroupRule(GroupID, RuleID string) error
- func (s *API) DeleteServer(serverID string) error
- func (s *API) DeleteSnapshot(snapshotID string) error
- func (s *API) DeleteToken(id string) error
- func (s *API) DeleteUserdata(serverID, key string, metadata bool) error
- func (s *API) DeleteVolume(volumeID string) error
- func (s *API) DetachIP(ipID string) error
- func (s *API) GetBootscript(bootscriptID string) (*Bootscript, error)
- func (s *API) GetBootscripts() ([]Bootscript, error)
- func (s *API) GetContainerDatas(container string) ([]*ContainerData, error)
- func (s *API) GetContainers() ([]*Container, error)
- func (s *API) GetDashboard() (*Dashboard, error)
- func (s *API) GetIP(ipID string) (*IPV4, error)
- func (s *API) GetIPS() ([]IPV4, error)
- func (s *API) GetImage(imageID string) (*Image, error)
- func (s *API) GetImages() (*[]MarketImage, error)
- func (s *API) GetMarketPlaceImageCurrentVersion(uuidImage string) (*MarketVersion, error)
- func (s *API) GetMarketPlaceImageVersions(uuidImage, uuidVersion string) (*MarketVersions, error)
- func (s *API) GetMarketPlaceImages(uuidImage string) (*MarketImages, error)
- func (s *API) GetMarketPlaceLocalImages(uuidImage, uuidVersion, uuidLocalImage string) (*MarketLocalImages, error)
- func (s *API) GetOrganization() ([]Organization, error)
- func (s *API) GetPermissions() (Permissions, error)
- func (s *API) GetQuotas() (Quotas, error)
- func (s *API) GetResponsePaginate(apiURL, resource string, values url.Values) (*http.Response, error)
- func (s *API) GetSecurityGroup(groupsID string) (*SecurityGroup, error)
- func (s *API) GetSecurityGroupRule(groupID string, rulesID string) (*SecurityGroupRule, error)
- func (s *API) GetSecurityGroupRules(groupID string) ([]SecurityGroupRule, error)
- func (s *API) GetSecurityGroups() ([]SecurityGroup, error)
- func (s *API) GetServer(serverID string) (*Server, error)
- func (s *API) GetServerAvailabilities() (ServerAvailabilities, error)
- func (s *API) GetServers(all bool, limit int) ([]Server, error)
- func (s *API) GetSnapshot(snapshotID string) (*Snapshot, error)
- func (s *API) GetSnapshots() ([]Snapshot, error)
- func (s *API) GetTask(id string) (*Task, error)
- func (s *API) GetTasks() ([]Task, error)
- func (s *API) GetToken(id string) (*Token, error)
- func (s *API) GetTokens() ([]Token, error)
- func (s *API) GetUser() (*User, error)
- func (s *API) GetUserID() (string, error)
- func (s *API) GetUserdata(serverID, key string, metadata bool) (*Userdata, error)
- func (s *API) GetUserdatas(serverID string, metadata bool) (*Userdatas, error)
- func (s *API) GetVolume(volumeID string) (*Volume, error)
- func (s *API) GetVolumes() (*[]Volume, error)
- func (s *API) PatchResponse(apiURL, resource string, data interface{}) (*http.Response, error)
- func (s *API) PatchServer(serverID string, definition ServerPatchDefinition) error
- func (s *API) PatchUserSSHKey(UserID string, definition UserPatchSSHKeyDefinition) (*User, error)
- func (s *API) PatchUserdata(serverID, key string, value []byte, metadata bool) error
- func (s *API) PostResponse(apiURL, resource string, data interface{}) (*http.Response, error)
- func (s *API) PostServerAction(serverID, action string) (*Task, error)
- func (s *API) PutResponse(apiURL, resource string, data interface{}) (*http.Response, error)
- func (s *API) SetPassword(password string)
- func (s *API) UpdateIP(req UpdateIPRequest) (*IPV4, error)
- func (s *API) UpdateMarketPlaceImage(uudiImage string, images MarketImage) error
- func (s *API) UpdateMarketPlaceImageVersion(uuidImage, uuidVersion string, version MarketVersion) error
- func (s *API) UpdateMarketPlaceLocalImage(uuidImage, uuidVersion, uuidLocalImage string, local MarketLocalImage) error
- func (s *API) UpdateSecurityGroup(group UpdateSecurityGroup, securityGroupID string) (*SecurityGroup, error)
- func (s *API) UpdateSecurityGroupRule(rules UpdateSecurityGroupRule, GroupID, RuleID string) (*SecurityGroupRule, error)
- func (s *API) UpdateToken(req *UpdateTokenRequest) (*Token, error)
- func (s *API) UpdateVolume(volumeID string, definition VolumePutDefinition) (*Volume, error)
- type APIError
- type Bootscript
- type Container
- type ContainerData
- type CreateTokenRequest
- type Dashboard
- type DashboardResp
- type GetIP
- type GetIPS
- type GetQuotas
- type HTTPClient
- type IPAddress
- type IPV4
- type IPV6
- type Image
- type ImageDefinition
- type ImageIdentifier
- type Images
- type InstanceTypeAvailability
- type KeyDefinition
- type MarketImage
- type MarketImages
- type MarketLocalImage
- type MarketLocalImageDefinition
- type MarketLocalImages
- type MarketVersion
- type MarketVersionDefinition
- type MarketVersions
- type NewSecurityGroup
- type NewSecurityGroupRule
- type OneImage
- type OneServer
- type Organization
- type PermCategory
- type Permissions
- type Quotas
- type Role
- type SecurityGroup
- type SecurityGroupRef
- type SecurityGroupRule
- type Server
- type ServerAction
- type ServerAvailabilities
- type ServerAvailability
- type ServerDefinition
- type ServerPatchDefinition
- type ServerRef
- type Servers
- type Snapshot
- type SnapshotDefinition
- type Snapshots
- type SortServers
- type Task
- type Tasks
- type Token
- type UpdateIPRequest
- type UpdateSecurityGroup
- type UpdateSecurityGroupRule
- type UpdateTokenRequest
- type User
- type UserPatchSSHKeyDefinition
- type Userdata
- type Userdatas
- type UsersDefinition
- type Volume
- type VolumeDefinition
- type VolumePutDefinition
Constants ¶
This section is empty.
Variables ¶
var ( AccountAPI = "https://account.scaleway.com/" MetadataAPI = "http://169.254.42.42/" MarketplaceAPI = "https://api-marketplace.scaleway.com" ComputeAPIPar1 = "https://cp-par1.scaleway.com/" ComputeAPIAms1 = "https://cp-ams1.scaleway.com/" URLPublicDNS = ".pub.cloud.scaleway.com" URLPrivateDNS = ".priv.cloud.scaleway.com" )
https://cp-par1.scaleway.com/products/servers https://cp-ams1.scaleway.com/products/servers Default values
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Organization string // Organization is the identifier of the organization Token string // Token is the authentication token for the organization Client HTTPClient // Client is used for all HTTP interactions Region string // contains filtered or unexported fields }
API is the interface used to communicate with the API
func (*API) CreateImage ¶
func (s *API) CreateImage(volumeID string, name string, bootscript string, arch string) (*Image, error)
CreateImage creates a new image
func (*API) CreateMarketPlaceImage ¶
func (s *API) CreateMarketPlaceImage(images MarketImage) error
CreateMarketPlaceImage adds new image
func (*API) CreateMarketPlaceImageVersion ¶
func (s *API) CreateMarketPlaceImageVersion(uuidImage string, version MarketVersion) error
CreateMarketPlaceImageVersion adds new image version
func (*API) CreateMarketPlaceLocalImage ¶
func (s *API) CreateMarketPlaceLocalImage(uuidImage, uuidVersion, uuidLocalImage string, local MarketLocalImage) error
CreateMarketPlaceLocalImage adds new local image
func (*API) CreateSecurityGroup ¶
func (s *API) CreateSecurityGroup(group NewSecurityGroup) (*SecurityGroup, error)
CreateSecurityGroup posts a group on a server
func (*API) CreateSecurityGroupRule ¶
func (s *API) CreateSecurityGroupRule(GroupID string, rules NewSecurityGroupRule) (*SecurityGroupRule, error)
CreateSecurityGroupRule posts a rule on a server
func (*API) CreateServer ¶
func (s *API) CreateServer(definition ServerDefinition) (*Server, error)
CreateServer creates a new server
func (*API) CreateSnapshot ¶
CreateSnapshot creates a new snapshot
func (*API) CreateToken ¶
func (s *API) CreateToken(req *CreateTokenRequest) (*Token, error)
func (*API) CreateVolume ¶
func (s *API) CreateVolume(definition VolumeDefinition) (*Volume, error)
CreateVolume creates a new volume
func (*API) DeleteImage ¶
DeleteImage deletes a image
func (*API) DeleteMarketPlaceImage ¶
DeleteMarketPlaceImage deletes image
func (*API) DeleteMarketPlaceImageVersion ¶
DeleteMarketPlaceImageVersion delete image version
func (*API) DeleteMarketPlaceLocalImage ¶
DeleteMarketPlaceLocalImage deletes local image
func (*API) DeleteResponse ¶
DeleteResponse returns an http.Response object for the deleted resource
func (*API) DeleteSecurityGroup ¶
DeleteSecurityGroup deletes a SecurityGroup
func (*API) DeleteSecurityGroupRule ¶
DeleteSecurityGroupRule deletes a SecurityGroupRule
func (*API) DeleteServer ¶
DeleteServer deletes a server
func (*API) DeleteSnapshot ¶
DeleteSnapshot deletes a snapshot
func (*API) DeleteToken ¶
func (*API) DeleteUserdata ¶
DeleteUserdata deletes a server user_data
func (*API) DeleteVolume ¶
DeleteVolume deletes a volume
func (*API) GetBootscript ¶
func (s *API) GetBootscript(bootscriptID string) (*Bootscript, error)
GetBootscript gets a bootscript from the API
func (*API) GetBootscripts ¶
func (s *API) GetBootscripts() ([]Bootscript, error)
GetBootscripts gets the list of bootscripts from the API
func (*API) GetContainerDatas ¶
func (s *API) GetContainerDatas(container string) ([]*ContainerData, error)
GetContainerDatas returns a GetContainerDatas
func (*API) GetContainers ¶
GetContainers returns a GetContainers
func (*API) GetDashboard ¶
GetDashboard returns the dashboard
func (*API) GetImages ¶
func (s *API) GetImages() (*[]MarketImage, error)
GetImages gets the list of images from the API
func (*API) GetMarketPlaceImageCurrentVersion ¶
func (s *API) GetMarketPlaceImageCurrentVersion(uuidImage string) (*MarketVersion, error)
GetMarketPlaceImageCurrentVersion return the image current version
func (*API) GetMarketPlaceImageVersions ¶
func (s *API) GetMarketPlaceImageVersions(uuidImage, uuidVersion string) (*MarketVersions, error)
GetMarketPlaceImageVersions returns image version
func (*API) GetMarketPlaceImages ¶
func (s *API) GetMarketPlaceImages(uuidImage string) (*MarketImages, error)
GetMarketPlaceImages returns images from marketplace
func (*API) GetMarketPlaceLocalImages ¶
func (s *API) GetMarketPlaceLocalImages(uuidImage, uuidVersion, uuidLocalImage string) (*MarketLocalImages, error)
GetMarketPlaceLocalImages returns images from local region
func (*API) GetOrganization ¶
func (s *API) GetOrganization() ([]Organization, error)
GetOrganization returns Organization
func (*API) GetPermissions ¶
func (s *API) GetPermissions() (Permissions, error)
GetPermissions returns the permissions
func (*API) GetResponsePaginate ¶
func (s *API) GetResponsePaginate(apiURL, resource string, values url.Values) (*http.Response, error)
GetResponsePaginate fetchs all resources and returns an http.Response object for the requested resource
func (*API) GetSecurityGroup ¶
func (s *API) GetSecurityGroup(groupsID string) (*SecurityGroup, error)
GetSecurityGroup returns a SecurityGroup
func (*API) GetSecurityGroupRule ¶
func (s *API) GetSecurityGroupRule(groupID string, rulesID string) (*SecurityGroupRule, error)
GetASecurityGroupRule returns a SecurityGroupRule
func (*API) GetSecurityGroupRules ¶
func (s *API) GetSecurityGroupRules(groupID string) ([]SecurityGroupRule, error)
GetSecurityGroupRules returns a GroupRules
func (*API) GetSecurityGroups ¶
func (s *API) GetSecurityGroups() ([]SecurityGroup, error)
GetSecurityGroups returns a SecurityGroups
func (*API) GetServerAvailabilities ¶
func (s *API) GetServerAvailabilities() (ServerAvailabilities, error)
func (*API) GetServers ¶
GetServers gets the list of servers from the API
func (*API) GetSnapshot ¶
GetSnapshot gets a snapshot from the API
func (*API) GetSnapshots ¶
GetSnapshots gets the list of snapshots from the API
func (*API) GetUserdata ¶
GetUserdata gets a specific userdata for a server
func (*API) GetUserdatas ¶
GetUserdatas gets list of userdata for a server
func (*API) GetVolumes ¶
GetVolumes gets the list of volumes from the API
func (*API) PatchResponse ¶
PatchResponse returns an http.Response object for the updated resource
func (*API) PatchServer ¶
func (s *API) PatchServer(serverID string, definition ServerPatchDefinition) error
PatchServer updates a server
func (*API) PatchUserSSHKey ¶
func (s *API) PatchUserSSHKey(UserID string, definition UserPatchSSHKeyDefinition) (*User, error)
PatchUserSSHKey updates a user
func (*API) PatchUserdata ¶
PatchUserdata sets a user data
func (*API) PostResponse ¶
PostResponse returns an http.Response object for the updated resource
func (*API) PostServerAction ¶
PostServerAction posts an action on a server
func (*API) PutResponse ¶
PutResponse returns an http.Response object for the updated resource
func (*API) SetPassword ¶
SetPassword register the password
func (*API) UpdateMarketPlaceImage ¶
func (s *API) UpdateMarketPlaceImage(uudiImage string, images MarketImage) error
UpdateMarketPlaceImage updates image
func (*API) UpdateMarketPlaceImageVersion ¶
func (s *API) UpdateMarketPlaceImageVersion(uuidImage, uuidVersion string, version MarketVersion) error
UpdateMarketPlaceImageVersion updates image version
func (*API) UpdateMarketPlaceLocalImage ¶
func (s *API) UpdateMarketPlaceLocalImage(uuidImage, uuidVersion, uuidLocalImage string, local MarketLocalImage) error
UpdateMarketPlaceLocalImage updates local image
func (*API) UpdateSecurityGroup ¶
func (s *API) UpdateSecurityGroup(group UpdateSecurityGroup, securityGroupID string) (*SecurityGroup, error)
UpdateSecurityGroup updates a SecurityGroup
func (*API) UpdateSecurityGroupRule ¶
func (s *API) UpdateSecurityGroupRule(rules UpdateSecurityGroupRule, GroupID, RuleID string) (*SecurityGroupRule, error)
UpdateSecurityGroupRule updates a SecurityGroupRule
func (*API) UpdateToken ¶
func (s *API) UpdateToken(req *UpdateTokenRequest) (*Token, error)
func (*API) UpdateVolume ¶
func (s *API) UpdateVolume(volumeID string, definition VolumePutDefinition) (*Volume, error)
UpdateVolume updates a volume
type APIError ¶
type APIError 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:"-"` }
APIError represents a API Error
type Bootscript ¶
type Bootscript struct { Bootcmdargs string `json:"bootcmdargs,omitempty"` Dtb string `json:"dtb,omitempty"` Initrd string `json:"initrd,omitempty"` Kernel string `json:"kernel,omitempty"` // Arch is the architecture target of the bootscript Arch string `json:"architecture,omitempty"` // Identifier is a unique identifier for the bootscript Identifier string `json:"id,omitempty"` // Organization is the owner of the bootscript Organization string `json:"organization,omitempty"` // Name is a user-defined name for the bootscript Title string `json:"title,omitempty"` // Public is true for public bootscripts and false for user bootscripts Public bool `json:"public,omitempty"` Default bool `json:"default,omitempty"` }
Bootscript represents a Bootscript
type Container ¶
type Container struct { Organization `json:"organization"` Name string `json:"name"` Size string `json:"size"` }
Container represents a container (S3)
type ContainerData ¶
type ContainerData struct { LastModified string `json:"last_modified"` Name string `json:"name"` Size string `json:"size"` }
ContainerData represents a container data (S3)
type CreateTokenRequest ¶
type Dashboard ¶
type Dashboard 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"` }
Dashboard represents a dashboard
type DashboardResp ¶
type DashboardResp struct {
Dashboard Dashboard
}
DashboardResp represents a dashboard received from the API
type GetIP ¶
type GetIP struct {
IP IPV4 `json:"ip"`
}
GetIP represents the response of a GET /ips/{id_ip}
type GetIPS ¶
type GetIPS struct {
IPS []IPV4 `json:"ips"`
}
GetIPS represents the response of a GET /ips/
type GetQuotas ¶
type GetQuotas struct {
Quotas Quotas `json:"quotas"`
}
GetQuotas represents the response of GET /organizations/{orga_id}/quotas
type HTTPClient ¶
HTTPClient wraps the net/http Client Do method
type IPAddress ¶
type IPAddress 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"` }
IPAddress represents a IP address
type IPV4 ¶
type IPV4 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"` Address string `json:"address"` }
IPV4 represents the IPs fields
type IPV6 ¶
type IPV6 struct { Netmask string `json:"netmask"` Gateway string `json:"gateway"` Address string `json:"address"` }
IPV6 represents a ipv6
type Image ¶
type Image 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 Volume `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 *Bootscript `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"` }
Image represents a Image
type ImageDefinition ¶
type ImageDefinition 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"` }
ImageDefinition represents a image definition
type ImageIdentifier ¶
ImageIdentifier represents a Image Identifier
type Images ¶
type Images struct { // Images holds images of the response Images []Image `json:"images,omitempty"` }
Images represents a group of images
type InstanceTypeAvailability ¶
type InstanceTypeAvailability string
var ( InstanceTypeAvailable InstanceTypeAvailability = "available" InstanceTypeScarce InstanceTypeAvailability = "scarce" InstanceTypeShortage InstanceTypeAvailability = "shortage" )
type KeyDefinition ¶
type KeyDefinition struct { Key string `json:"key"` Fingerprint string `json:"fingerprint,omitempty"` }
KeyDefinition represents a key
type MarketImage ¶
type MarketImage struct { Categories []string `json:"categories"` CreationDate string `json:"creation_date"` CurrentPublicVersion string `json:"current_public_version"` Description string `json:"description"` ID string `json:"id"` Logo string `json:"logo"` ModificationDate string `json:"modification_date"` Name string `json:"name"` Organization struct { ID string `json:"id"` Name string `json:"name"` } `json:"organization"` Public bool `json:"-"` MarketVersions }
MarketImage represents MarketPlace image
type MarketImages ¶
type MarketImages struct {
Images []MarketImage `json:"images"`
}
MarketImages represents MarketPlace images
type MarketLocalImage ¶
type MarketLocalImage struct {
LocalImages MarketLocalImageDefinition `json:"local_image"`
}
MarketLocalImage represents local image
type MarketLocalImageDefinition ¶
type MarketLocalImageDefinition struct { Arch string `json:"arch"` ID string `json:"id"` Zone string `json:"zone"` }
MarketLocalImageDefinition represents localImage of marketplace version
type MarketLocalImages ¶
type MarketLocalImages struct {
LocalImages []MarketLocalImageDefinition `json:"local_images"`
}
MarketLocalImages represents an array of local images
type MarketVersion ¶
type MarketVersion struct {
Version MarketVersionDefinition `json:"version"`
}
MarketVersion represents version of marketplace image
type MarketVersionDefinition ¶
type MarketVersionDefinition struct { CreationDate string `json:"creation_date"` ID string `json:"id"` Image struct { ID string `json:"id"` Name string `json:"name"` } `json:"image"` ModificationDate string `json:"modification_date"` Name string `json:"name"` MarketLocalImages }
MarketVersionDefinition represents version of marketplace image
type MarketVersions ¶
type MarketVersions struct {
Versions []MarketVersionDefinition `json:"versions"`
}
MarketVersions represents an array of marketplace image versions
type NewSecurityGroup ¶
type NewSecurityGroup struct { Organization string `json:"organization"` Name string `json:"name"` Description string `json:"description"` EnableDefaultSecurity bool `json:"enable_default_security"` }
NewSecurityGroup definition POST request /security_groups
type NewSecurityGroupRule ¶
type NewSecurityGroupRule 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"` }
NewSecurityGroupRule definition POST/PUT request /_group/{groupID}
type OneImage ¶
type OneImage struct {
Image Image `json:"image,omitempty"`
}
OneImage represents the response of a GET /images/UUID API call
type OneServer ¶
type OneServer struct {
Server Server `json:"server,omitempty"`
}
OneServer represents the response of a GET /servers/UUID API call
type Organization ¶
type Organization struct { ID string `json:"id"` Name string `json:"name"` Users []User `json:"users"` }
Organization represents a Organization
type PermCategory ¶
PermCategory represents Permissions's fields
type Permissions ¶
type Permissions map[string]PermCategory
Permissions represents the response of GET /permissions
type Role ¶
type Role struct { Organization Organization `json:"organization,omitempty"` Role string `json:"role,omitempty"` }
Role represents a Token UserId Role
type SecurityGroup ¶
type SecurityGroup struct { Description string `json:"description"` ID string `json:"id"` Organization string `json:"organization"` Name string `json:"name"` Servers []ServerRef `json:"servers"` EnableDefaultSecurity bool `json:"enable_default_security"` OrganizationDefault bool `json:"organization_default"` }
SecurityGroup definition
type SecurityGroupRef ¶
type SecurityGroupRule ¶
type SecurityGroupRule 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"` Position int `json:"position"` DestPortTo string `json:"dest_port_to"` Editable bool `json:"editable"` ID string `json:"id"` }
SecurityGroupRule definition
type Server ¶
type Server struct { // Arch is the architecture target of the server Arch string `json:"arch,omitempty"` // 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 Image `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 IPAddress `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 *Bootscript `json:"bootscript,omitempty"` // BootType defines the type of boot. Can be local or bootscript BootType string `json:"boot_type,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]Volume `json:"volumes,omitempty"` // SecurityGroup is the selected security group object SecurityGroup SecurityGroupRef `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, C2[SML], VC1S) CommercialType string `json:"commercial_type,omitempty"` // Location of the server Location struct { Platform string `json:"platform_id,omitempty"` Chassis string `json:"chassis_id,omitempty"` Cluster string `json:"cluster_id,omitempty"` Hypervisor string `json:"hypervisor_id,omitempty"` Blade string `json:"blade_id,omitempty"` Node string `json:"node_id,omitempty"` ZoneID string `json:"zone_id,omitempty"` } `json:"location,omitempty"` IPV6 *IPV6 `json:"ipv6,omitempty"` EnableIPV6 bool `json:"enable_ipv6,omitempty"` // This fields are not returned by the API, we generate it DNSPublic string `json:"dns_public,omitempty"` DNSPrivate string `json:"dns_private,omitempty"` }
Server represents a server
type ServerAction ¶
type ServerAction struct { // Action is the name of the action to trigger Action string `json:"action,omitempty"` }
ServerAction represents an action to perform on a server
type ServerAvailabilities ¶
type ServerAvailabilities map[string]ServerAvailability
func (ServerAvailabilities) CommercialTypes ¶
func (a ServerAvailabilities) CommercialTypes() []string
type ServerAvailability ¶
type ServerAvailability struct {
Availability InstanceTypeAvailability `json:"availability"`
}
type ServerDefinition ¶
type ServerDefinition 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, C2[SML], VC1S) CommercialType string `json:"commercial_type"` // BootType defines the type of boot. Can be local or bootscript BootType string `json:"boot_type,omitempty"` PublicIP string `json:"public_ip,omitempty"` EnableIPV6 bool `json:"enable_ipv6,omitempty"` SecurityGroup string `json:"security_group,omitempty"` }
ServerDefinition represents a server with image definition
type ServerPatchDefinition ¶
type ServerPatchDefinition struct { Arch *string `json:"arch,omitempty"` Name *string `json:"name,omitempty"` CreationDate *string `json:"creation_date,omitempty"` ModificationDate *string `json:"modification_date,omitempty"` Image *Image `json:"image,omitempty"` DynamicIPRequired *bool `json:"dynamic_ip_required,omitempty"` PublicAddress *IPAddress `json:"public_ip,omitempty"` State *string `json:"state,omitempty"` StateDetail *string `json:"state_detail,omitempty"` PrivateIP *string `json:"private_ip,omitempty"` Bootscript *string `json:"bootscript,omitempty"` Hostname *string `json:"hostname,omitempty"` Volumes *map[string]Volume `json:"volumes,omitempty"` SecurityGroup *SecurityGroupRef `json:"security_group,omitempty"` Organization *string `json:"organization,omitempty"` Tags *[]string `json:"tags,omitempty"` IPV6 *IPV6 `json:"ipv6,omitempty"` EnableIPV6 *bool `json:"enable_ipv6,omitempty"` }
ServerPatchDefinition represents a server with nullable fields (for PATCH)
type Servers ¶
type Servers struct { // Servers holds servers of the response Servers []Server `json:"servers,omitempty"` }
Servers represents a group of servers
type Snapshot ¶
type Snapshot 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 Volume `json:"base_volume,omitempty"` }
Snapshot represents a Snapshot
type SnapshotDefinition ¶
type SnapshotDefinition struct { VolumeIDentifier string `json:"volume_id"` Name string `json:"name,omitempty"` Organization string `json:"organization"` }
SnapshotDefinition represents a snapshot definition
type Snapshots ¶
type Snapshots struct { // Snapshots holds snapshots of the response Snapshots []Snapshot `json:"snapshots,omitempty"` }
Snapshots represents a group of snapshots
type SortServers ¶
type SortServers []Server
SortServers represents a wrapper to sort by CreationDate the servers
func (SortServers) Len ¶
func (s SortServers) Len() int
func (SortServers) Less ¶
func (s SortServers) Less(i, j int) bool
func (SortServers) Swap ¶
func (s SortServers) Swap(i, j int)
type Task ¶
type Task 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"` }
Task represents a Task
type Tasks ¶
type Tasks struct { // Tasks holds tasks of the response Tasks []Task `json:"tasks,omitempty"` }
Tasks represents a group of tasks
type Token ¶
type Token struct { UserID string `json:"user_id"` Description string `json:"description,omitempty"` Roles Role `json:"roles"` Expires string `json:"expires"` InheritsUsersPerms bool `json:"inherits_user_perms"` ID string `json:"id"` }
Token represents a Token
type UpdateIPRequest ¶
type UpdateSecurityGroup ¶
type UpdateSecurityGroup struct { Organization string `json:"organization"` Name string `json:"name"` Description string `json:"description"` OrganizationDefault bool `json:"organization_default"` }
UpdateSecurityGroup definition PUT request /security_groups
type UpdateSecurityGroupRule ¶
type UpdateSecurityGroupRule struct { Action string `json:"action"` Direction string `json:"direction"` IPRange string `json:"ip_range"` Protocol string `json:"protocol"` Position int `json:"position"` DestPortFrom int `json:"dest_port_from,omitempty"` }
UpdateSecurityGroupRule definition POST/PUT request /_group/{groupID}
type UpdateTokenRequest ¶
type User ¶
type User struct { Email string `json:"email"` Firstname string `json:"firstname"` Fullname string `json:"fullname"` ID string `json:"id"` Lastname string `json:"lastname"` Organizations []Organization `json:"organizations"` Roles []Role `json:"roles"` SSHPublicKeys []KeyDefinition `json:"ssh_public_keys"` }
User represents a User
type UserPatchSSHKeyDefinition ¶
type UserPatchSSHKeyDefinition struct {
SSHPublicKeys []KeyDefinition `json:"ssh_public_keys"`
}
UserPatchSSHKeyDefinition represents a User Patch
type Userdatas ¶
type Userdatas struct {
UserData []string `json:"user_data"`
}
Userdatas represents the response of a GET /user_data
type UsersDefinition ¶
type UsersDefinition struct {
User User `json:"user"`
}
UsersDefinition represents the response of a GET /user
type Volume ¶
type Volume 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 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"` }
Volume represents a Volume
type VolumeDefinition ¶
type VolumeDefinition 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"` }
VolumeDefinition represents a volume definition
type VolumePutDefinition ¶
type VolumePutDefinition 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"` }
VolumePutDefinition represents a volume with nullable fields (for PUT)