Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type Client
- type CloudProResourcesData
- type CloudProResourcesResponse
- type CloudProResourcesTotalResponse
- type CloudProResourcesUsedResponse
- type CloudProServerResponse
- type CloudProService
- type ConsoleResponse
- type ConsoleService
- type CreateServerOptions
- type DnsService
- type ErrorResponse
- type ErrorStatus
- type ListServer
- type ListServersResponse
- type ListTask
- type ListTasksResponse
- type ListTasksService
- type ListTemplate
- type ListTemplatesResponse
- type ListTemplatesService
- type MockClient
- type Option
- type PowerOperationResponse
- type PowerOperationsService
- func (s *PowerOperationsService) Action(serverId, action string) (*PowerOperationResponse, *http.Response, error)
- func (s *PowerOperationsService) PowerOff(serverId string) (*PowerOperationResponse, *http.Response, error)
- func (s *PowerOperationsService) PowerOn(serverId string) (*PowerOperationResponse, *http.Response, error)
- func (s *PowerOperationsService) Reset(serverId string) (*PowerOperationResponse, *http.Response, error)
- type ServersService
- type StandardResponse
Constants ¶
View Source
const (
LibraryVersion = "0.1"
)
const
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present.
Types ¶
type Client ¶
type Client struct { Option *Option BaseURL *url.URL UserAgent string ServersService *ServersService ListTemplatesService *ListTemplatesService ListTasksService *ListTasksService PowerOperationsService *PowerOperationsService ConsoleService *ConsoleService DnsService *DnsService CloudProService *CloudProService // contains filtered or unexported fields }
A Client manages communication with the CloudAtCost API.
func (*Client) NewFormRequest ¶
type CloudProResourcesData ¶
type CloudProResourcesData struct { Total []CloudProResourcesTotalResponse `json:"total"` Used CloudProResourcesUsedResponse `json:"used"` }
type CloudProResourcesResponse ¶
type CloudProResourcesResponse struct { Status string `json:"status"` Time int `json:"time"` API string `json:"api"` Action string `json:"action"` Data CloudProResourcesData `json:"data"` }
type CloudProServerResponse ¶
type CloudProService ¶
type CloudProService struct {
// contains filtered or unexported fields
}
func (*CloudProService) Create ¶
func (s *CloudProService) Create(opt *CreateServerOptions) (*CloudProServerResponse, *http.Response, error)
func (*CloudProService) Delete ¶
func (s *CloudProService) Delete(sid string) (*CloudProServerResponse, *http.Response, error)
func (*CloudProService) Resources ¶
func (s *CloudProService) Resources() (*CloudProResourcesData, *http.Response, error)
type ConsoleResponse ¶
type ConsoleService ¶
type ConsoleService struct {
// contains filtered or unexported fields
}
func (*ConsoleService) Console ¶
func (s *ConsoleService) Console(serverId string) (*ConsoleResponse, *http.Response, error)
type CreateServerOptions ¶
type DnsService ¶
type DnsService struct {
// contains filtered or unexported fields
}
func (*DnsService) ModifyReverseDns ¶
func (s *DnsService) ModifyReverseDns(serverId, hostname string) (*StandardResponse, *http.Response, error)
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response ErrorStatus ErrorStatus }
An ErrorResponse reports one or more errors caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type ErrorStatus ¶
type ErrorStatus struct { Status string `json:"status,omitempty"` Time string `json:"time,omitempty"` Error string `json:"error,omitempty"` ErrorDescription string `json:"error_description,omitempty"` }
ErrorStatus https://github.com/cloudatcost/api Error:
type ListServer ¶
type ListServer struct { Sid string `json:"sid"` ID string `json:"id"` Packageid string `json:"packageid"` Servername string `json:"servername"` Lable interface{} `json:"lable"` Vmname string `json:"vmname"` IP string `json:"ip"` Netmask string `json:"netmask"` Gateway string `json:"gateway"` Portgroup string `json:"portgroup"` Hostname string `json:"hostname"` Rootpass string `json:"rootpass"` Vncport string `json:"vncport"` Vncpass string `json:"vncpass"` Servertype string `json:"servertype"` Template string `json:"template"` CPU string `json:"cpu"` Cpuusage string `json:"cpuusage"` RAM string `json:"ram"` Ramusage string `json:"ramusage"` Storage string `json:"storage"` Hdusage string `json:"hdusage"` Sdate string `json:"sdate"` Status string `json:"status"` PanelNote string `json:"panel_note"` Mode string `json:"mode"` UID string `json:"uid"` }
type ListServersResponse ¶
type ListServersResponse struct { Status string `json:"status"` Time int `json:"time"` API string `json:"api"` Action string `json:"action"` Data []ListServer `json:"data"` }
type ListTasksResponse ¶
type ListTasksService ¶
type ListTasksService struct {
// contains filtered or unexported fields
}
type ListTemplate ¶
type ListTemplatesResponse ¶
type ListTemplatesResponse struct { Status string `json:"status"` Time int `json:"time"` API string `json:"api"` Action string `json:"action"` Data []ListTemplate `json:"data"` }
type ListTemplatesService ¶
type ListTemplatesService struct {
// contains filtered or unexported fields
}
func (*ListTemplatesService) ListTemplates ¶
func (s *ListTemplatesService) ListTemplates() ([]ListTemplate, *http.Response, error)
type MockClient ¶
type MockClient struct { Mux *http.ServeMux Client *Client Server *httptest.Server FixturesDir string }
A MockClient manages communication with the CloudatCost API mock.
func NewMockClient ¶
func NewMockClient() *MockClient
NewMockClient returns a new DCloudatCost API client mock.
func (*MockClient) ReadJSON ¶
func (r *MockClient) ReadJSON(filename string) string
ReadJSON Read json from file
type PowerOperationResponse ¶
type PowerOperationsService ¶
type PowerOperationsService struct {
// contains filtered or unexported fields
}
func (*PowerOperationsService) Action ¶
func (s *PowerOperationsService) Action(serverId, action string) (*PowerOperationResponse, *http.Response, error)
func (*PowerOperationsService) PowerOff ¶
func (s *PowerOperationsService) PowerOff(serverId string) (*PowerOperationResponse, *http.Response, error)
func (*PowerOperationsService) PowerOn ¶
func (s *PowerOperationsService) PowerOn(serverId string) (*PowerOperationResponse, *http.Response, error)
func (*PowerOperationsService) Reset ¶
func (s *PowerOperationsService) Reset(serverId string) (*PowerOperationResponse, *http.Response, error)
type ServersService ¶
type ServersService struct {
// contains filtered or unexported fields
}
func (*ServersService) List ¶
func (s *ServersService) List() ([]ListServer, *http.Response, error)
func (*ServersService) Rename ¶
func (s *ServersService) Rename(serverId, name string) (*StandardResponse, *http.Response, error)
Click to show internal directories.
Click to hide internal directories.