Documentation
¶
Index ¶
- type AdminListInstancesOptions
- type AdminListInstancesResponse
- type Client
- func (c *Client) AdminDeleteInstance(ctx context.Context, instanceID string) error
- func (c *Client) AdminGetInstance(ctx context.Context, instanceID string) (*Instance, error)
- func (c *Client) AdminListInstances(ctx context.Context, opts *AdminListInstancesOptions) (*AdminListInstancesResponse, error)
- func (c *Client) AdminResetInstance(ctx context.Context, instanceID string) error
- func (c *Client) AdminRestartInstance(ctx context.Context, instanceID string) error
- func (c *Client) AdminStartInstance(ctx context.Context, instanceID string) error
- func (c *Client) AdminStopInstance(ctx context.Context, instanceID string) error
- func (c *Client) CreateInstance(ctx context.Context, req InstanceCreateRequest) (*Instance, error)
- func (c *Client) DeleteInstance(ctx context.Context, instanceID string) error
- func (c *Client) GetInstance(ctx context.Context, instanceID string) (*Instance, error)
- func (c *Client) ListInstances(ctx context.Context) ([]Instance, error)
- func (c *Client) ListTemplateZones(ctx context.Context, templateID string) ([]string, error)
- func (c *Client) ListTemplates(ctx context.Context) ([]Template, error)
- func (c *Client) ResetInstance(ctx context.Context, instanceID string) error
- func (c *Client) RestartInstance(ctx context.Context, instanceID string) error
- func (c *Client) StartInstance(ctx context.Context, instanceID string) error
- func (c *Client) StopInstance(ctx context.Context, instanceID string) error
- type Instance
- type InstanceCreateRequest
- type ListOpts
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminListInstancesOptions ¶
type AdminListInstancesOptions struct {
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
UserID string `url:"userID,omitempty"`
CustomerID string `url:"customerID,omitempty"`
Status string `url:"status,omitempty"`
Zone string `url:"zone,omitempty"`
TemplateID string `url:"templateID,omitempty"`
}
AdminListInstancesOptions provides filtering for the admin instance list endpoint.
type AdminListInstancesResponse ¶
type AdminListInstancesResponse struct {
Pages int `json:"pages"`
Items int `json:"items"`
Instances []Instance `json:"instances"`
}
AdminListInstancesResponse is the paginated response for admin instance listing.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides access to the Compute API endpoints.
func NewClient ¶
func NewClient(d doFunc) *Client
NewClient creates a new Compute client backed by the root SDK client's do function.
func (*Client) AdminDeleteInstance ¶
AdminDeleteInstance deletes an instance by ID as admin.
func (*Client) AdminGetInstance ¶
AdminGetInstance fetches an instance by ID as admin.
func (*Client) AdminListInstances ¶
func (c *Client) AdminListInstances(ctx context.Context, opts *AdminListInstancesOptions) (*AdminListInstancesResponse, error)
AdminListInstances lists instances with optional filtering.
func (*Client) AdminResetInstance ¶
AdminResetInstance resets an instance as admin.
func (*Client) AdminRestartInstance ¶
AdminRestartInstance restarts an instance as admin.
func (*Client) AdminStartInstance ¶
AdminStartInstance starts an instance as admin.
func (*Client) AdminStopInstance ¶
AdminStopInstance stops an instance as admin.
func (*Client) CreateInstance ¶
CreateInstance creates a new compute instance.
func (*Client) DeleteInstance ¶
DeleteInstance deletes an instance by ID.
func (*Client) GetInstance ¶
GetInstance fetches a single instance by ID.
func (*Client) ListInstances ¶
ListInstances lists all instances for the current user.
func (*Client) ListTemplateZones ¶
ListTemplateZones lists all zones available for a template.
func (*Client) ListTemplates ¶
ListTemplates lists all available instance templates.
func (*Client) ResetInstance ¶
ResetInstance resets an instance to its original state.
func (*Client) RestartInstance ¶
RestartInstance restarts an instance.
func (*Client) StartInstance ¶
StartInstance starts a stopped instance.
type Instance ¶
type Instance struct {
ID string `json:"id"`
UserID string `json:"userID"`
CustomerID string `json:"customerID"`
Name string `json:"name"`
Zone string `json:"zone"`
MachineType string `json:"machineType"`
ExternalIP string `json:"externalIp"`
InternalIP string `json:"internalIp"`
Status string `json:"status"`
TemplateID string `json:"templateId"`
CreatedAt string `json:"createdAt"`
}
Instance represents a compute instance.
type InstanceCreateRequest ¶
type InstanceCreateRequest struct {
TemplateID string `json:"templateID"`
Zone string `json:"zone"`
}
InstanceCreateRequest is the body for creating a new instance.
type Template ¶
type Template struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
MachineType string `json:"machineType"`
DiskSizeGb int `json:"diskSizeGb"`
DiskType string `json:"diskType"`
Image string `json:"image"`
Region string `json:"region"`
}
Template represents a compute instance template.