Documentation
¶
Index ¶
- Constants
- type AddSshKey
- type AdditionalResources
- type AdditionalStorage
- type AdditionalSupply
- type AvailableHardware
- type Client
- func (c *Client) CreateSshKey(key AddSshKey) (*SshKey, error)
- func (c *Client) CreateVmV3(reqBody CreateVmV3) ([]CreatedVm, error)
- func (c *Client) EstimateDeposit(reqBody EstimateDepositRequestV3) (*EstimatedDepositV3DTO, error)
- func (c *Client) GetAvailableCountries() ([]string, error)
- func (c *Client) GetAvailableHardware() (*AvailableHardware, error)
- func (c *Client) GetBasicConfigurations() ([]string, error)
- func (c *Client) GetMarketplaceOffers(constraints *OfferConstraints) ([]MarketOffering, error)
- func (c *Client) ListSshKeys() ([]SshKey, error)
- func (c *Client) ListVmsV3() ([]RunningInstanceV3, error)
- func (c *Client) RemoveSshKey(fingerprint string) error
- func (c *Client) RemoveVms(vmIds []string) (*VmsRemoved, error)
- func (c *Client) UpdateVms(updates []UpdateVm) error
- type ConfigurationPrice
- type CpuHardware
- type CreateVmV3
- type CreatedVm
- type Datacenter
- type DatacenterConstraint
- type DefaultImageDTO
- type ErrorBody
- type EstimateDepositRequestV3
- type EstimatedDepositV3DTO
- type HardwareConstraints
- type MarketOffering
- type MemoryHardware
- type OfferConstraints
- type OpenPorts
- type PortSpec
- type RemoveSshKey
- type RemoveVms
- type Resource
- type ResourceMetadata
- type RunningInstanceV3
- type ServerOffering
- type SshKey
- type StorageHardware
- type String
- type Supply
- type UpdateVm
- type UpdateVms
- type VmConfiguration
- type VmResource
- type VmsRemoved
Constants ¶
const HostURL string = "https://api.fluence.dev"
HostURL - Default Fluence API URL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalResources ¶
type AdditionalResources struct {
Storage []AdditionalStorage `json:"storage,omitempty"`
}
AdditionalResources represents additional resources (currently only storage)
type AdditionalStorage ¶
type AdditionalStorage struct { Supply uint64 `json:"supply"` Units string `json:"units"` Type string `json:"type"` }
AdditionalStorage represents additional storage resources
type AdditionalSupply ¶
AdditionalSupply represents additional supply for a resource
type AvailableHardware ¶
type AvailableHardware struct { Cpu []CpuHardware `json:"cpu"` Memory []MemoryHardware `json:"memory"` Storage []StorageHardware `json:"storage"` }
AvailableHardware represents the response for available hardware.
type Client ¶
Client -
func (*Client) CreateSshKey ¶
CreateSshKey creates a new SSH key.
func (*Client) CreateVmV3 ¶
func (c *Client) CreateVmV3(reqBody CreateVmV3) ([]CreatedVm, error)
CreateVmV3 creates new VM(s) with the given configuration and constraints.
func (*Client) EstimateDeposit ¶
func (c *Client) EstimateDeposit(reqBody EstimateDepositRequestV3) (*EstimatedDepositV3DTO, error)
EstimateDeposit estimates the deposit required for a VM configuration.
func (*Client) GetAvailableCountries ¶
GetAvailableCountries fetches a list of available countries on the marketplace.
func (*Client) GetAvailableHardware ¶
func (c *Client) GetAvailableHardware() (*AvailableHardware, error)
GetAvailableHardware fetches a list of available hardware on the marketplace.
func (*Client) GetBasicConfigurations ¶
GetBasicConfigurations fetches a list of basic configurations from the marketplace.
func (*Client) GetMarketplaceOffers ¶
func (c *Client) GetMarketplaceOffers(constraints *OfferConstraints) ([]MarketOffering, error)
GetMarketplaceOffers fetches a list of offers that match the given constraints.
func (*Client) ListSshKeys ¶
ListSshKeys fetches all SSH keys.
func (*Client) ListVmsV3 ¶
func (c *Client) ListVmsV3() ([]RunningInstanceV3, error)
ListVmsV3 fetches all running VM instances (v3).
func (*Client) RemoveSshKey ¶
RemoveSshKey removes an SSH key by fingerprint.
type ConfigurationPrice ¶
ConfigurationPrice represents a configuration and its price
type CpuHardware ¶
type CpuHardware struct { Architecture string `json:"architecture"` Manufacturer string `json:"manufacturer"` }
CpuHardware represents CPU hardware constraints
type CreateVmV3 ¶
type CreateVmV3 struct { Constraints *OfferConstraints `json:"constraints,omitempty"` Instances int `json:"instances"` VmConfiguration VmConfiguration `json:"vmConfiguration"` }
CreateVmV3 represents the request body for creating VMs
type Datacenter ¶
type Datacenter struct { CountryCode string `json:"countryCode"` CityCode string `json:"cityCode"` CityIndex uint32 `json:"cityIndex"` Tier uint32 `json:"tier"` Certifications []string `json:"certifications"` }
Datacenter represents a datacenter object
type DatacenterConstraint ¶
type DatacenterConstraint struct {
Countries []string `json:"countries"`
}
DatacenterConstraint represents a constraint on datacenter countries
type DefaultImageDTO ¶
type DefaultImageDTO struct { Id string `json:"id"` Name string `json:"name"` Distribution string `json:"distribution"` Slug string `json:"slug"` DownloadUrl string `json:"downloadUrl"` Username string `json:"username"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` }
DefaultImageDTO represents a default OS image
type ErrorBody ¶
type ErrorBody struct {
Error string `json:"error"`
}
ErrorBody represents the error response format
type EstimateDepositRequestV3 ¶
type EstimateDepositRequestV3 struct { Constraints *OfferConstraints `json:"constraints,omitempty"` Instances int `json:"instances"` }
EstimateDepositRequestV3 represents the request for deposit estimation
type EstimatedDepositV3DTO ¶
type EstimatedDepositV3DTO struct { DepositAmountUsdc string `json:"depositAmountUsdc"` DepositEpochs uint64 `json:"depositEpochs"` TotalPricePerEpoch string `json:"totalPricePerEpoch"` MaxPricePerEpoch string `json:"maxPricePerEpoch"` Instances int `json:"instances"` }
EstimatedDepositV3DTO represents the estimated deposit response
type HardwareConstraints ¶
type HardwareConstraints struct { Cpu []CpuHardware `json:"cpu,omitempty"` Memory []MemoryHardware `json:"memory,omitempty"` Storage []StorageHardware `json:"storage,omitempty"` }
HardwareConstraints represents hardware constraints for offers
type MarketOffering ¶
type MarketOffering struct { Configuration ConfigurationPrice `json:"configuration"` Resources []Resource `json:"resources"` Datacenter Datacenter `json:"datacenter"` Servers []ServerOffering `json:"servers"` MaxAdditionalSupply []AdditionalSupply `json:"maxAdditionalSupply"` }
MarketOffering represents a market offering
type MemoryHardware ¶
MemoryHardware represents memory hardware constraints
type OfferConstraints ¶
type OfferConstraints struct { AdditionalResources *AdditionalResources `json:"additionalResources,omitempty"` BasicConfiguration *string `json:"basicConfiguration,omitempty"` Datacenter *DatacenterConstraint `json:"datacenter,omitempty"` Hardware *HardwareConstraints `json:"hardware,omitempty"` MaxTotalPricePerEpochUsd *string `json:"maxTotalPricePerEpochUsd,omitempty"` }
OfferConstraints represents constraints for marketplace offers
type RemoveSshKey ¶
type RemoveSshKey struct {
Fingerprint string `json:"fingerprint"`
}
RemoveSshKey represents the request body for removing an SSH key
type RemoveVms ¶
type RemoveVms struct {
VmIds []string `json:"vmIds"`
}
RemoveVms represents the request body for removing VMs
type Resource ¶
type Resource struct { Type string `json:"type"` Metadata ResourceMetadata `json:"metadata"` Price string `json:"price"` }
Resource represents a resource object
type ResourceMetadata ¶
type ResourceMetadata map[string]interface{}
ResourceMetadata is a generic map for metadata (use interface{} for flexibility)
type RunningInstanceV3 ¶
type RunningInstanceV3 struct { Id string `json:"id"` Status string `json:"status"` PricePerEpoch string `json:"pricePerEpoch"` Resources []VmResource `json:"resources"` CreatedAt string `json:"createdAt"` NextBillingAt string `json:"nextBillingAt"` ReservedBalance string `json:"reservedBalance"` TotalSpent string `json:"totalSpent"` Datacenter *Datacenter `json:"datacenter,omitempty"` OsImage *string `json:"osImage,omitempty"` Ports *[]PortSpec `json:"ports,omitempty"` PublicIp *string `json:"publicIp,omitempty"` VmName *string `json:"vmName,omitempty"` }
RunningInstanceV3 represents a running VM instance
type ServerOffering ¶
type ServerOffering struct { AvailableBasicInstances uint64 `json:"availableBasicInstances"` AdditionalResources []AdditionalSupply `json:"additionalResources"` }
ServerOffering represents a server offering
type SshKey ¶
type SshKey struct { Name string `json:"name"` Fingerprint string `json:"fingerprint"` Algorithm string `json:"algorithm"` Comment string `json:"comment"` PublicKey string `json:"publicKey"` Active bool `json:"active"` CreatedAt string `json:"createdAt"` }
SshKey represents an SSH key object
type StorageHardware ¶
type StorageHardware struct {
Type string `json:"type"`
}
StorageHardware represents storage hardware constraints
type UpdateVm ¶
type UpdateVm struct { Id string `json:"id"` OpenPorts *[]OpenPorts `json:"openPorts,omitempty"` VmName *string `json:"vmName,omitempty"` }
UpdateVm represents a patch update for a VM
type UpdateVms ¶
type UpdateVms struct {
Updates []UpdateVm `json:"updates"`
}
UpdateVms represents a patch update for multiple VMs
type VmConfiguration ¶
type VmConfiguration struct { Hostname *string `json:"hostname,omitempty"` Name string `json:"name"` OpenPorts []OpenPorts `json:"openPorts"` OsImage string `json:"osImage"` SshKeys []string `json:"sshKeys"` }
VmConfiguration represents a VM configuration
type VmResource ¶
type VmResource struct { Supply Type string `json:"type"` Details interface{} `json:"details"` Metadata ResourceMetadata `json:"metadata"` }
VmResource represents a VM resource
type VmsRemoved ¶
type VmsRemoved struct {
Transactions []string `json:"transactions"`
}
VmsRemoved represents the response for removed VMs