ionet

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEnterpriseBaseURL = "https://api.io.solutions/enterprise/v1/io-cloud/caas"
	DefaultBaseURL           = "https://api.io.solutions/v1/io-cloud/caas"
	DefaultTimeout           = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Details string `json:"details,omitempty"`
}

APIError represents an API error response

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface

type AvailableReplica

type AvailableReplica struct {
	LocationID     int    `json:"location_id"`
	LocationName   string `json:"location_name"`
	HardwareID     int    `json:"hardware_id"`
	HardwareName   string `json:"hardware_name"`
	AvailableCount int    `json:"available_count"`
	MaxGPUs        int    `json:"max_gpus"`
}

AvailableReplica represents replica availability for a location

type AvailableReplicasResponse

type AvailableReplicasResponse struct {
	Replicas []AvailableReplica `json:"replicas"`
}

AvailableReplicasResponse represents the response for available replicas

type Client

type Client struct {
	BaseURL    string
	APIKey     string
	HTTPClient HTTPClient
}

Client represents the IO.NET API client

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a new IO.NET API client targeting the public API base URL.

func NewClientWithConfig

func NewClientWithConfig(apiKey, baseURL string, httpClient HTTPClient) *Client

NewClientWithConfig creates a new IO.NET API client with custom configuration

func NewEnterpriseClient

func NewEnterpriseClient(apiKey string) *Client

NewEnterpriseClient creates a new IO.NET API client targeting the enterprise API base URL.

func (*Client) CheckClusterNameAvailability

func (c *Client) CheckClusterNameAvailability(clusterName string) (bool, error)

CheckClusterNameAvailability checks if a cluster name is available

func (*Client) DeleteDeployment

func (c *Client) DeleteDeployment(deploymentID string) (*UpdateDeploymentResponse, error)

DeleteDeployment deletes an active deployment

func (*Client) DeployContainer

func (c *Client) DeployContainer(req *DeploymentRequest) (*DeploymentResponse, error)

DeployContainer deploys a new container with the specified configuration

func (*Client) ExecuteInContainer

func (c *Client) ExecuteInContainer(deploymentID, containerID string, command []string) (string, error)

ExecuteInContainer executes a command in a specific container (if supported by the API)

func (*Client) ExtendDeployment

func (c *Client) ExtendDeployment(deploymentID string, req *ExtendDurationRequest) (*DeploymentDetail, error)

ExtendDeployment extends the duration of an existing deployment

func (*Client) GetAvailableReplicas

func (c *Client) GetAvailableReplicas(hardwareID int, gpuCount int) (*AvailableReplicasResponse, error)

GetAvailableReplicas retrieves available replicas per location for specified hardware

func (*Client) GetContainerDetails

func (c *Client) GetContainerDetails(deploymentID, containerID string) (*Container, error)

GetContainerDetails retrieves detailed information about a specific container

func (*Client) GetContainerJobs

func (c *Client) GetContainerJobs(deploymentID, containerID string) (*ContainerList, error)

GetContainerJobs retrieves containers jobs for a specific container (similar to containers endpoint)

func (*Client) GetContainerLogs

func (c *Client) GetContainerLogs(deploymentID, containerID string, opts *GetLogsOptions) (*ContainerLogs, error)

GetContainerLogs retrieves logs for containers in a deployment and normalizes them

func (*Client) GetContainerLogsRaw

func (c *Client) GetContainerLogsRaw(deploymentID, containerID string, opts *GetLogsOptions) (string, error)

GetContainerLogsRaw retrieves the raw text logs for a specific container

func (*Client) GetDeployment

func (c *Client) GetDeployment(deploymentID string) (*DeploymentDetail, error)

GetDeployment retrieves detailed information about a specific deployment

func (*Client) GetHardwareType

func (c *Client) GetHardwareType(hardwareID int) (*HardwareType, error)

GetHardwareType retrieves details about a specific hardware type

func (*Client) GetLocation

func (c *Client) GetLocation(locationID int) (*Location, error)

GetLocation retrieves details about a specific location

func (*Client) GetLocationAvailability

func (c *Client) GetLocationAvailability(locationID int) (*LocationAvailability, error)

GetLocationAvailability retrieves real-time availability for a specific location

func (*Client) GetMaxGPUsPerContainer

func (c *Client) GetMaxGPUsPerContainer() (*MaxGPUResponse, error)

GetMaxGPUsPerContainer retrieves the maximum number of GPUs available per hardware type

func (*Client) GetPriceEstimation

func (c *Client) GetPriceEstimation(req *PriceEstimationRequest) (*PriceEstimationResponse, error)

GetPriceEstimation calculates the estimated cost for a deployment

func (*Client) ListContainers

func (c *Client) ListContainers(deploymentID string) (*ContainerList, error)

ListContainers retrieves all containers for a specific deployment

func (*Client) ListDeployments

func (c *Client) ListDeployments(opts *ListDeploymentsOptions) (*DeploymentList, error)

ListDeployments retrieves a list of deployments with optional filtering

func (*Client) ListHardwareTypes

func (c *Client) ListHardwareTypes() ([]HardwareType, int, error)

ListHardwareTypes retrieves available hardware types using the max GPUs endpoint

func (*Client) ListLocations

func (c *Client) ListLocations() (*LocationsResponse, error)

ListLocations retrieves available deployment locations (if supported by the API)

func (*Client) RestartContainer

func (c *Client) RestartContainer(deploymentID, containerID string) error

RestartContainer restarts a specific container (if supported by the API)

func (*Client) StopContainer

func (c *Client) StopContainer(deploymentID, containerID string) error

StopContainer stops a specific container (if supported by the API)

func (*Client) StreamContainerLogs

func (c *Client) StreamContainerLogs(deploymentID, containerID string, opts *GetLogsOptions, callback func(*LogEntry) error) error

StreamContainerLogs streams real-time logs for a specific container This method uses a callback function to handle incoming log entries

func (*Client) UpdateClusterName

func (c *Client) UpdateClusterName(clusterID string, req *UpdateClusterNameRequest) (*UpdateClusterNameResponse, error)

UpdateClusterName updates the name of an existing cluster/deployment

func (*Client) UpdateDeployment

func (c *Client) UpdateDeployment(deploymentID string, req *UpdateDeploymentRequest) (*UpdateDeploymentResponse, error)

UpdateDeployment updates the configuration of an existing deployment

type Container

type Container struct {
	DeviceID         string           `json:"device_id"`
	ContainerID      string           `json:"container_id"`
	Hardware         string           `json:"hardware"`
	BrandName        string           `json:"brand_name"`
	CreatedAt        time.Time        `json:"created_at"`
	UptimePercent    int              `json:"uptime_percent"`
	GPUsPerContainer int              `json:"gpus_per_container"`
	Status           string           `json:"status"`
	ContainerEvents  []ContainerEvent `json:"container_events"`
	PublicURL        string           `json:"public_url"`
}

Container represents a container within a deployment

type ContainerConfig

type ContainerConfig struct {
	ReplicaCount       int               `json:"replica_count"`
	EnvVariables       map[string]string `json:"env_variables,omitempty"`
	SecretEnvVariables map[string]string `json:"secret_env_variables,omitempty"`
	Entrypoint         []string          `json:"entrypoint,omitempty"`
	TrafficPort        int               `json:"traffic_port,omitempty"`
	Args               []string          `json:"args,omitempty"`
}

ContainerConfig represents container configuration

type ContainerEvent

type ContainerEvent struct {
	Time    time.Time `json:"time"`
	Message string    `json:"message"`
}

ContainerEvent represents a container event

type ContainerList

type ContainerList struct {
	Total   int         `json:"total"`
	Workers []Container `json:"workers"`
}

ContainerList represents a list of containers

type ContainerLogs

type ContainerLogs struct {
	ContainerID string     `json:"container_id"`
	Logs        []LogEntry `json:"logs"`
	HasMore     bool       `json:"has_more"`
	NextCursor  string     `json:"next_cursor,omitempty"`
}

ContainerLogs represents container log entries

type DefaultHTTPClient

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

DefaultHTTPClient is the default HTTP client implementation

func NewDefaultHTTPClient

func NewDefaultHTTPClient(timeout time.Duration) *DefaultHTTPClient

NewDefaultHTTPClient creates a new default HTTP client

func (*DefaultHTTPClient) Do

Do executes an HTTP request

type Deployment

type Deployment struct {
	ID                      string    `json:"id"`
	Status                  string    `json:"status"`
	Name                    string    `json:"name"`
	CompletedPercent        float64   `json:"completed_percent"`
	HardwareQuantity        int       `json:"hardware_quantity"`
	BrandName               string    `json:"brand_name"`
	HardwareName            string    `json:"hardware_name"`
	Served                  string    `json:"served"`
	Remaining               string    `json:"remaining"`
	ComputeMinutesServed    int       `json:"compute_minutes_served"`
	ComputeMinutesRemaining int       `json:"compute_minutes_remaining"`
	CreatedAt               time.Time `json:"created_at"`
	GPUCount                int       `json:"-"` // Derived from HardwareQuantity
	Replicas                int       `json:"-"` // Derived from HardwareQuantity
}

Deployment represents a deployment in the list

type DeploymentContainerConfig

type DeploymentContainerConfig struct {
	Entrypoint   []string               `json:"entrypoint"`
	EnvVariables map[string]interface{} `json:"env_variables"`
	TrafficPort  int                    `json:"traffic_port"`
	ImageURL     string                 `json:"image_url"`
}

DeploymentContainerConfig represents container config in deployment details

type DeploymentDetail

type DeploymentDetail struct {
	ID                      string                    `json:"id"`
	Status                  string                    `json:"status"`
	CreatedAt               time.Time                 `json:"created_at"`
	StartedAt               *time.Time                `json:"started_at,omitempty"`
	FinishedAt              *time.Time                `json:"finished_at,omitempty"`
	AmountPaid              float64                   `json:"amount_paid"`
	CompletedPercent        float64                   `json:"completed_percent"`
	TotalGPUs               int                       `json:"total_gpus"`
	GPUsPerContainer        int                       `json:"gpus_per_container"`
	TotalContainers         int                       `json:"total_containers"`
	HardwareName            string                    `json:"hardware_name"`
	HardwareID              int                       `json:"hardware_id"`
	Locations               []DeploymentLocation      `json:"locations"`
	BrandName               string                    `json:"brand_name"`
	ComputeMinutesServed    int                       `json:"compute_minutes_served"`
	ComputeMinutesRemaining int                       `json:"compute_minutes_remaining"`
	ContainerConfig         DeploymentContainerConfig `json:"container_config"`
}

DeploymentDetail represents detailed deployment information

type DeploymentList

type DeploymentList struct {
	Deployments []Deployment `json:"deployments"`
	Total       int          `json:"total"`
	Statuses    []string     `json:"statuses"`
}

DeploymentList represents a list of deployments with pagination

type DeploymentLocation

type DeploymentLocation struct {
	ID   int    `json:"id"`
	ISO2 string `json:"iso2"`
	Name string `json:"name"`
}

DeploymentLocation represents a location in deployment details

type DeploymentRequest

type DeploymentRequest struct {
	ResourcePrivateName string          `json:"resource_private_name"`
	DurationHours       int             `json:"duration_hours"`
	GPUsPerContainer    int             `json:"gpus_per_container"`
	HardwareID          int             `json:"hardware_id"`
	LocationIDs         []int           `json:"location_ids"`
	ContainerConfig     ContainerConfig `json:"container_config"`
	RegistryConfig      RegistryConfig  `json:"registry_config"`
}

DeploymentRequest represents a container deployment request

type DeploymentResponse

type DeploymentResponse struct {
	DeploymentID string `json:"deployment_id"`
	Status       string `json:"status"`
}

DeploymentResponse represents the response from deployment creation

type ExtendDurationRequest

type ExtendDurationRequest struct {
	DurationHours int `json:"duration_hours"`
}

ExtendDurationRequest represents request to extend deployment duration

type GetLogsOptions

type GetLogsOptions struct {
	StartTime *time.Time `json:"start_time,omitempty"`
	EndTime   *time.Time `json:"end_time,omitempty"`
	Level     string     `json:"level,omitempty"`  // filter by log level
	Stream    string     `json:"stream,omitempty"` // filter by stdout/stderr streams
	Limit     int        `json:"limit,omitempty"`  // max number of log entries
	Cursor    string     `json:"cursor,omitempty"` // pagination cursor
	Follow    bool       `json:"follow,omitempty"` // stream logs
}

GetLogsOptions represents options for retrieving container logs

type HTTPClient

type HTTPClient interface {
	Do(req *HTTPRequest) (*HTTPResponse, error)
}

HTTPClient interface for making HTTP requests

type HTTPRequest

type HTTPRequest struct {
	Method  string
	URL     string
	Headers map[string]string
	Body    []byte
}

HTTPRequest represents an HTTP request

type HTTPResponse

type HTTPResponse struct {
	StatusCode int
	Headers    map[string]string
	Body       []byte
}

HTTPResponse represents an HTTP response

type HardwareAvailability

type HardwareAvailability struct {
	HardwareID     int    `json:"hardware_id"`
	HardwareName   string `json:"hardware_name"`
	AvailableCount int    `json:"available_count"`
	MaxGPUs        int    `json:"max_gpus"`
}

HardwareAvailability represents availability for specific hardware at a location

type HardwareType

type HardwareType struct {
	ID             int     `json:"id"`
	Name           string  `json:"name"`
	Description    string  `json:"description,omitempty"`
	GPUType        string  `json:"gpu_type"`
	GPUMemory      int     `json:"gpu_memory"` // in GB
	MaxGPUs        int     `json:"max_gpus"`
	CPU            string  `json:"cpu,omitempty"`
	Memory         int     `json:"memory,omitempty"`  // in GB
	Storage        int     `json:"storage,omitempty"` // in GB
	HourlyRate     float64 `json:"hourly_rate"`
	Available      bool    `json:"available"`
	BrandName      string  `json:"brand_name,omitempty"`
	AvailableCount int     `json:"available_count,omitempty"`
}

HardwareType represents a hardware type available for deployment

type ListDeploymentsOptions

type ListDeploymentsOptions struct {
	Status     string `json:"status,omitempty"`      // filter by status
	LocationID int    `json:"location_id,omitempty"` // filter by location
	Page       int    `json:"page,omitempty"`        // pagination
	PageSize   int    `json:"page_size,omitempty"`   // pagination
	SortBy     string `json:"sort_by,omitempty"`     // sort field
	SortOrder  string `json:"sort_order,omitempty"`  // asc/desc
}

ListDeploymentsOptions represents options for listing deployments

type Location

type Location struct {
	ID          int     `json:"id"`
	Name        string  `json:"name"`
	ISO2        string  `json:"iso2,omitempty"`
	Region      string  `json:"region,omitempty"`
	Country     string  `json:"country,omitempty"`
	Latitude    float64 `json:"latitude,omitempty"`
	Longitude   float64 `json:"longitude,omitempty"`
	Available   int     `json:"available,omitempty"`
	Description string  `json:"description,omitempty"`
}

Location represents a deployment location

type LocationAvailability

type LocationAvailability struct {
	LocationID           int                    `json:"location_id"`
	LocationName         string                 `json:"location_name"`
	Available            bool                   `json:"available"`
	HardwareAvailability []HardwareAvailability `json:"hardware_availability"`
	UpdatedAt            time.Time              `json:"updated_at"`
}

LocationAvailability represents real-time availability for a location

type LocationsResponse

type LocationsResponse struct {
	Locations []Location `json:"locations"`
	Total     int        `json:"total"`
}

LocationsResponse represents the list of locations and aggregated metadata.

type LogEntry

type LogEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Level     string    `json:"level,omitempty"`
	Message   string    `json:"message"`
	Source    string    `json:"source,omitempty"`
}

LogEntry represents a single log entry

type MaxGPUInfo

type MaxGPUInfo struct {
	MaxGPUsPerContainer int    `json:"max_gpus_per_container"`
	Available           int    `json:"available"`
	HardwareID          int    `json:"hardware_id"`
	HardwareName        string `json:"hardware_name"`
	BrandName           string `json:"brand_name"`
}

MaxGPUInfo represents max GPU information for a hardware type

type MaxGPUResponse

type MaxGPUResponse struct {
	Hardware []MaxGPUInfo `json:"hardware"`
	Total    int          `json:"total"`
}

MaxGPUResponse represents the response for maximum GPUs per container

type PriceBreakdown

type PriceBreakdown struct {
	ComputeCost float64 `json:"compute_cost"`
	NetworkCost float64 `json:"network_cost,omitempty"`
	StorageCost float64 `json:"storage_cost,omitempty"`
	TotalCost   float64 `json:"total_cost"`
	HourlyRate  float64 `json:"hourly_rate"`
}

PriceBreakdown represents detailed cost breakdown

type PriceEstimationRequest

type PriceEstimationRequest struct {
	LocationIDs      []int  `json:"location_ids"`
	HardwareID       int    `json:"hardware_id"`
	GPUsPerContainer int    `json:"gpus_per_container"`
	DurationHours    int    `json:"duration_hours"`
	ReplicaCount     int    `json:"replica_count"`
	Currency         string `json:"currency"`
	DurationType     string `json:"duration_type"`
	DurationQty      int    `json:"duration_qty"`
	HardwareQty      int    `json:"hardware_qty"`
}

PriceEstimationRequest represents a price estimation request

type PriceEstimationResponse

type PriceEstimationResponse struct {
	EstimatedCost   float64        `json:"estimated_cost"`
	Currency        string         `json:"currency"`
	PriceBreakdown  PriceBreakdown `json:"price_breakdown"`
	EstimationValid bool           `json:"estimation_valid"`
}

PriceEstimationResponse represents the price estimation response

type RegistryConfig

type RegistryConfig struct {
	ImageURL         string `json:"image_url"`
	RegistryUsername string `json:"registry_username,omitempty"`
	RegistrySecret   string `json:"registry_secret,omitempty"`
}

RegistryConfig represents registry configuration

type UpdateClusterNameRequest

type UpdateClusterNameRequest struct {
	Name string `json:"cluster_name"`
}

UpdateClusterNameRequest represents request to update cluster name

type UpdateClusterNameResponse

type UpdateClusterNameResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

UpdateClusterNameResponse represents response from cluster name update

type UpdateDeploymentRequest

type UpdateDeploymentRequest struct {
	EnvVariables       map[string]string `json:"env_variables,omitempty"`
	SecretEnvVariables map[string]string `json:"secret_env_variables,omitempty"`
	Entrypoint         []string          `json:"entrypoint,omitempty"`
	TrafficPort        *int              `json:"traffic_port,omitempty"`
	ImageURL           string            `json:"image_url,omitempty"`
	RegistryUsername   string            `json:"registry_username,omitempty"`
	RegistrySecret     string            `json:"registry_secret,omitempty"`
	Args               []string          `json:"args,omitempty"`
	Command            string            `json:"command,omitempty"`
}

UpdateDeploymentRequest represents request to update deployment configuration

type UpdateDeploymentResponse

type UpdateDeploymentResponse struct {
	Status       string `json:"status"`
	DeploymentID string `json:"deployment_id"`
}

UpdateDeploymentResponse represents response from deployment update

Jump to

Keyboard shortcuts

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