threefold.gridproxy.model #
fn (ByteUnit) to_megabytes #
fn (u ByteUnit) to_megabytes() f64
fn (ByteUnit) to_gigabytes #
fn (u ByteUnit) to_gigabytes() f64
fn (ByteUnit) to_terabytes #
fn (u ByteUnit) to_terabytes() f64
fn (ByteUnit) str #
fn (u ByteUnit) str() string
type ContractGetter #
type ContractGetter = fn (ContractFilter) ![]Contract
fn (DropTFTUnit) to_tft #
fn (t DropTFTUnit) to_tft() f64
fn (DropTFTUnit) to_mtft #
fn (t DropTFTUnit) to_mtft() f64
fn (DropTFTUnit) to_utft #
fn (t DropTFTUnit) to_utft() f64
fn (DropTFTUnit) str #
fn (u DropTFTUnit) str() string
type FarmGetter #
type FarmGetter = fn (FarmFilter) ![]Farm
type NodeGetter #
type NodeGetter = fn (NodeFilter) ![]Node
fn (SecondUnit) to_minutes #
fn (u SecondUnit) to_minutes() f64
fn (SecondUnit) to_hours #
fn (u SecondUnit) to_hours() f64
fn (SecondUnit) to_days #
fn (u SecondUnit) to_days() f64
fn (SecondUnit) str #
fn (u SecondUnit) str() string
type TwinGetter #
type TwinGetter = fn (TwinFilter) ![]Twin
fn (UnixTime) to_time #
fn (t UnixTime) to_time() Time
fn (UnixTime) str #
fn (t UnixTime) str() string
enum NodeStatus #
enum NodeStatus {
all
online
}
struct Bill #
struct Bill {
pub:
amount_billed u64 @[json: amountBilled]
timestamp UnixTime @[json: timestamp]
discount_received string @[json: discountReceived]
}
struct Contract #
struct Contract {
pub:
contract_id u64
twin_id u64
state string @[json: state]
created_at UnixTime @[json: created_at]
contract_type string @[json: 'type']
details NodeContractDetails @[json: details]
}
struct ContractBilling #
struct ContractBilling {
pub:
amount_billed DropTFTUnit @[json: amountBilled]
discount_received string @[json: discountReceived]
timestamp UnixTime @[json: timestamp]
}
struct ContractFilter #
@[params]
struct ContractFilter {
pub mut:
page OptionU64 = EmptyOption{}
size OptionU64 = EmptyOption{}
ret_count OptionBool = EmptyOption{}
randomize OptionBool = EmptyOption{}
contract_id OptionU64 = EmptyOption{}
twin_id OptionU64 = EmptyOption{}
node_id OptionU64 = EmptyOption{}
contract_type string
state string
name string
number_of_public_ips OptionU64 = EmptyOption{}
deployment_data string
deployment_hash string
}
fn (ContractFilter) to_map #
fn (f &ContractFilter) to_map() map[string]string
serialize ContractFilter to map
struct ContractIterator #
struct ContractIterator {
pub mut:
filter ContractFilter
pub:
get_func ContractGetter @[required]
}
fn (ContractIterator) next #
fn (mut i ContractIterator) next() ?[]Contract
struct Farm #
struct Farm {
pub:
name string
farm_id u64 @[json: farmId]
twin_id u64 @[json: twinId]
pricing_policy_id u64 @[json: pricingPolicyId]
certification_type string @[json: certificationType]
stellar_address string @[json: stellarAddress]
dedicated bool
public_ips []PublicIP @[json: publicIps]
}
struct FarmFilter #
@[params]
struct FarmFilter {
pub mut:
page OptionU64 = EmptyOption{}
size OptionU64 = EmptyOption{}
ret_count OptionBool = EmptyOption{}
randomize OptionBool = EmptyOption{}
free_ips OptionU64 = EmptyOption{}
total_ips OptionU64 = EmptyOption{}
stellar_address string
pricing_policy_id OptionU64 = EmptyOption{}
farm_id OptionU64 = EmptyOption{}
twin_id OptionU64 = EmptyOption{}
name string
name_contains string
certification_type string
dedicated OptionBool = EmptyOption{}
country string
node_free_mru OptionU64 = EmptyOption{}
node_free_hru OptionU64 = EmptyOption{}
node_free_sru OptionU64 = EmptyOption{}
node_status string
node_rented_by OptionU64 = EmptyOption{}
node_available_for OptionU64 = EmptyOption{}
node_has_gpu OptionBool = EmptyOption{}
node_certified OptionBool = EmptyOption{}
}
fn (FarmFilter) to_map #
fn (f &FarmFilter) to_map() map[string]string
serialize FarmFilter to map
struct FarmIterator #
struct FarmIterator {
pub mut:
filter FarmFilter
pub:
get_func FarmGetter @[required]
}
fn (FarmIterator) next #
fn (mut i FarmIterator) next() ?[]Farm
struct GridStat #
struct GridStat {
pub:
nodes u64
farms u64
countries u64
total_cru u64 @[json: totalCru]
total_sru ByteUnit @[json: totalSru]
total_mru ByteUnit @[json: totalMru]
total_hru ByteUnit @[json: totalHru]
public_ips u64 @[json: publicIps]
access_nodes u64 @[json: accessNodes]
gateways u64
twins u64
contracts u64
nodes_distribution map[string]u64 @[json: nodesDistribution]
}
struct Node #
struct Node {
pub:
id string
node_id u64 @[json: nodeId]
farm_id u64 @[json: farmId]
twin_id u64 @[json: twinId]
grid_version u64 @[json: gridVersion]
uptime SecondUnit
created UnixTime @[json: created]
farming_policy_id u64 @[json: farmingPolicyId]
updated_at UnixTime @[json: updatedAt]
capacity NodeCapacity
location NodeLocation
public_config PublicConfig @[json: publicConfig]
certification string @[json: certificationType]
status string
dedicated bool
healthy bool
rent_contract_id u64 @[json: rentContractId]
rented_by_twin_id u64 @[json: rentedByTwinId]
}
fn (Node) calc_available_resources #
fn (n &Node) calc_available_resources() NodeResources
calc_available_resources calculate the reservable capacity of the node.
Returns: NodeResources
fn (Node) is_online #
fn (n &Node) is_online() bool
is_online returns true if the node is online, otherwise false.
struct NodeCapacity #
struct NodeCapacity {
pub:
total_resources NodeResources
used_resources NodeResources
}
struct NodeContractDetails #
struct NodeContractDetails {
pub:
node_id u64 @[json: nodeId]
deployment_data string @[json: deployment_data]
deployment_hash string @[json: deployment_hash]
number_of_public_ips u64 @[json: number_of_public_ips]
}
struct NodeFilter #
@[params]
struct NodeFilter {
pub mut:
page OptionU64 = EmptyOption{}
size OptionU64 = EmptyOption{}
ret_count OptionBool = EmptyOption{}
randomize OptionBool = EmptyOption{}
free_mru OptionU64 = EmptyOption{}
free_sru OptionU64 = EmptyOption{}
free_hru OptionU64 = EmptyOption{}
free_ips OptionU64 = EmptyOption{}
total_mru OptionU64 = EmptyOption{}
total_sru OptionU64 = EmptyOption{}
total_hru OptionU64 = EmptyOption{}
total_cru OptionU64 = EmptyOption{}
city string
city_contains string
country string
country_contains string
farm_name string
farm_name_contains string
ipv4 OptionBool = EmptyOption{}
ipv6 OptionBool = EmptyOption{}
domain OptionBool = EmptyOption{}
status string
dedicated OptionBool = EmptyOption{}
healthy OptionBool = EmptyOption{}
rentable OptionBool = EmptyOption{}
rented_by OptionU64 = EmptyOption{}
rented OptionBool = EmptyOption{}
available_for OptionU64 = EmptyOption{}
farm_ids []u64
node_id OptionU64 = EmptyOption{}
twin_id OptionU64 = EmptyOption{}
certification_type string
has_gpu OptionBool = EmptyOption{}
gpu_device_id string
gpu_device_name string
gpu_vendor_id string
gpu_vendor_name string
gpu_available OptionBool = EmptyOption{}
}
fn (NodeFilter) to_map #
fn (p &NodeFilter) to_map() map[string]string
serialize NodeFilter to map
struct NodeIterator #
struct NodeIterator {
pub mut:
filter NodeFilter
pub:
get_func NodeGetter @[required]
}
fn (NodeIterator) next #
fn (mut i NodeIterator) next() ?[]Node
struct NodeLocation #
struct NodeLocation {
pub:
country string
city string
}
struct NodeResources #
struct NodeResources {
pub:
cru u64
mru ByteUnit
sru ByteUnit
hru ByteUnit
}
struct NodeStatisticsResources #
struct NodeStatisticsResources {
pub:
cru u64
hru ByteUnit
ipv4u u64
mru ByteUnit
sru ByteUnit
}
struct NodeStatisticsUsers #
struct NodeStatisticsUsers {
pub:
deployments u64
workloads u64
}
struct NodeStats #
struct NodeStats {
pub:
system NodeStatisticsResources
total NodeStatisticsResources
used NodeStatisticsResources
users NodeStatisticsUsers
}
struct Node_ #
struct Node_ {
pub:
id string
node_id u64 @[json: nodeId]
farm_id u64 @[json: farmId]
twin_id u64 @[json: twinId]
grid_version u64 @[json: gridVersion]
uptime SecondUnit
created UnixTime @[json: created]
farming_policy_id u64 @[json: farmingPolicyId]
updated_at UnixTime @[json: updatedAt]
total_resources NodeResources
used_resources NodeResources
location NodeLocation
public_config PublicConfig @[json: publicConfig]
certification string @[json: certificationType]
status string
dedicated bool
healthy bool
rent_contract_id u64 @[json: rentContractId]
rented_by_twin_id u64 @[json: rentedByTwinId]
}
this is ugly, but it works. we need two models for Node
and reimplemnt the same fields expcept for capacity srtucture it's a hack to make the json parser work as the gridproxy API have some inconsistencies see for more context: https://github.com/threefoldtech/tfgridclient_proxy/issues/164
fn (Node_) with_nested_capacity #
fn (n &Node_) with_nested_capacity() Node
with_nested_capacity enable the client to have one representation of the node model
struct PublicConfig #
struct PublicConfig {
pub:
domain string
gw4 string
gw6 string
ipv4 string
ipv6 string
}
struct PublicIP #
struct PublicIP {
pub:
id string
ip string
farm_id string @[json: farmId]
contract_id int @[json: contractId]
gateway string
}
struct ResourceFilter #
@[params]
struct ResourceFilter {
pub mut:
free_mru_gb u64
free_sru_gb u64
free_hru_gb u64
free_cpu u64
free_ips u64
}
struct StatFilter #
@[params]
struct StatFilter {
pub mut:
status NodeStatus
}
struct Twin #
struct Twin {
pub:
twin_id u64 @[json: twinId]
account_id string @[json: accountId]
ip string
}
struct TwinFilter #
@[params]
struct TwinFilter {
pub mut:
page OptionU64 = EmptyOption{}
size OptionU64 = EmptyOption{}
ret_count OptionBool = EmptyOption{}
randomize OptionBool = EmptyOption{}
twin_id OptionU64 = EmptyOption{}
account_id string
relay string
public_key string
}
fn (TwinFilter) to_map #
fn (p &TwinFilter) to_map() map[string]string
serialize TwinFilter to map
struct TwinIterator #
struct TwinIterator {
pub mut:
filter TwinFilter
pub:
get_func TwinGetter @[required]
}
fn (TwinIterator) next #
fn (mut i TwinIterator) next() ?[]Twin
- type ByteUnit
- type ContractGetter
- type DropTFTUnit
- type FarmGetter
- type NodeGetter
- type SecondUnit
- type TwinGetter
- type UnixTime
- enum NodeStatus
- struct Bill
- struct Contract
- struct ContractBilling
- struct ContractFilter
- struct ContractIterator
- struct Farm
- struct FarmFilter
- struct FarmIterator
- struct GridStat
- struct Node
- struct NodeCapacity
- struct NodeContractDetails
- struct NodeFilter
- struct NodeIterator
- struct NodeLocation
- struct NodeResources
- struct NodeStatisticsResources
- struct NodeStatisticsUsers
- struct NodeStats
- struct Node_
- struct PublicConfig
- struct PublicIP
- struct ResourceFilter
- struct StatFilter
- struct Twin
- struct TwinFilter
- struct TwinIterator