Data Schema

provider

import "carbonaut.dev/pkg/provider"

Index

type Config

type Config struct {
    Resources   ResConfig  `json:"resources"   yaml:"resources"`
    Environment *EnvConfig `json:"environment" yaml:"environment"`
}

type Data

type Data map[resource.AccountName]resource.AccountData

type EnvConfig

type EnvConfig struct {
    DynamicEnvConfig *dynenv.Config `json:"dynamic_environment" yaml:"dynamic_environment"`
}

type Res

type Res struct {
    StaticResConfig  *staticres.Config `json:"static_resource"  yaml:"static_resource"`
    DynamicResConfig *dynres.Config    `json:"dynamic_resource" yaml:"dynamic_resource"`
}

type ResConfig

type ResConfig map[resource.AccountName]Res

environment

import "carbonaut.dev/pkg/provider/environment"

Index

type DynamicEnvData

type DynamicEnvData struct {
    SolarPercentage        float64 `json:"solar_percentage"         yaml:"solar_percentage"`
    WindPercentage         float64 `json:"wind_percentage"          yaml:"wind_percentage"`
    HydroPercentage        float64 `json:"hydro_percentage"         yaml:"hydro_percentage"`
    NuclearPercentage      float64 `json:"nuclear_percentage"       yaml:"nuclear_percentage"`
    GeothermalPercentage   float64 `json:"geothermal_percentage"    yaml:"geothermal_percentage"`
    GasPercentage          float64 `json:"gas_percentage"           yaml:"gas_percentage"`
    OilPercentage          float64 `json:"oil_percentage"           yaml:"oil_percentage"`
    BiomassPercentage      float64 `json:"biomass_percentage"       yaml:"biomass_percentage"`
    CoalPercentage         float64 `json:"coal_percentage"          yaml:"coal_percentage"`
    OtherSourcesPercentage float64 `json:"other_sources_percentage" yaml:"other_sources_percentage"`
    FossilFuelsPercentage  float64 `json:"fossil_fuels_percentage"  yaml:"fossil_fuels_percentage"`
    RenewablePercentage    float64 `json:"renewable_percentage"     yaml:"renewable_percentage"`
}

plugin

import "carbonaut.dev/pkg/provider/plugin"

Index

type Kind

type Kind string

resource

import "carbonaut.dev/pkg/provider/resource"

Index

type AccountData

type AccountData map[ProjectName]ProjectData

type AccountName

type AccountName string

type CPU

type CPU struct {
    Count        int    `json:"count"        yaml:"count"        default:"1"`
    Type         string `json:"type"         yaml:"type"         default:"Intel Xeon E-2278G 8-Core Processor @ 3.40GHz"`
    Cores        string `json:"cores"        yaml:"cores"        default:"8"`
    Threads      string `json:"threads"      yaml:"threads"      default:"16"`
    Speed        string `json:"speed"        yaml:"speed"        default:"3.40GHz"`
    Arch         string `json:"arch"         yaml:"arch"         default:"x86"`
    Model        string `json:"model"        yaml:"model"        default:"E-2278G"`
    Manufacturer string `json:"manufacturer" yaml:"manufacturer" default:"Intel"`
    Name         string `json:"name"         yaml:"name"         default:"Intel Xeon E-2278G Processor"`
}

type DRIVE

type DRIVE struct {
    Count int    `json:"count" yaml:"count" default:"2"`
    Type  string `json:"type"  yaml:"type"  default:"SSD"`
    Size  string `json:"size"  yaml:"type"  default:"480GB"`
}

type DynamicData

type DynamicData struct {
    ResData *DynamicResData             `json:"res_data" yaml:"res_data"`
    EnvData *environment.DynamicEnvData `json:"env_data" yaml:"env_data"`
}

type DynamicResData

energy and utilization data

type DynamicResData struct {
    CPUFrequency          float64 `json:"cpu_frequency"          yaml:"cpu_frequency"`
    EnergyHostMicrojoules int     `json:"energy_host_mirojoules" yaml:"energy_host_mirojoules"`
    CPULoadPercentage     float64 `json:"cpu_load_percentage"    yaml:"cpu_load_percentage"`
}

type GPU

type GPU struct {
    Count int    `json:"count" yaml:"count" default:"1"`
    Type  string `json:"type"  yaml:"type"  default:"Intel HD Graphics P630"`
}

type Location

type Location struct {
    City    string `json:"city"     yaml:"city"     default:"Frankfurt"`
    Country string `json:"country"  yaml:"country"  default:"DE"`
    Address string `json:"address"  yaml:"address"  default:"Kruppstrasse 121-127"`
    ZipCode string `json:"zip_code" yaml:"zip_code" default:"60388"`
    Code    string `json:"code"     yaml:"code"     default:"fr"`
}

type NIC

type NIC struct {
    Count int    `json:"count" yaml:"count" default:"1"`
    Type  string `json:"type"  yaml:"type"  default:"10Gbps"`
}

type OS

type OS struct {
    Version string `json:"version" yaml:"version" default:"12"`
    Distro  string `json:"distro"  yaml:"distro"  default:"debian"`
    Name    string `json:"name"    yaml:"name"    default:"Debian 12"`
}

type ProjectData

type ProjectData map[ResourceName]*ResourceData

type ProjectName

type ProjectName string

type ResourceData

type ResourceData struct {
    DynamicData *DynamicData   `json:"dynamic_data" yaml:"dynamic_data"`
    StaticData  *StaticResData `json:"static_data"  yaml:"static_data"`
}

type ResourceName

type ResourceName string

type StaticData

type StaticData struct {
    ResData *StaticResData `json:"res_data" yaml:"res_data"`
}

type StaticResData

Data represents computer hardware data.

type StaticResData struct {
    ID       string    `json:"id"        yaml:"id"        default:"0131acc3-82d8-488b-a8e2-c4a00e897145"`
    User     string    `json:"user"      yaml:"user"      default:"root"`
    OS       *OS       `json:"os"        yaml:"os"`
    IPv4     string    `json:"ipv4"      yaml:"ipv4"      default:"145.40.93.80"`
    CPUs     []*CPU    `json:"cpus"      yaml:"cpus"`
    GPUs     []*GPU    `json:"gpus"      yaml:"gpus"`
    NICs     []*NIC    `json:"nics"      yaml:"nics"`
    Drives   []*DRIVE  `json:"drives"    yaml:"drives"`
    MemoryGB string    `json:"memory_gb" yaml:"memory_gb" default:"32GB"`
    Location *Location `json:"location"  yaml:"location"`
}

topology

import "carbonaut.dev/pkg/provider/topology"

Index

Variables

var (
    AccountNotFoundID  AccountID  = -1
    ProjectNotFoundID  ProjectID  = -1
    ResourceNotFoundID ResourceID = -1
)

type AccountID

type AccountID int32

type AccountT

type AccountT struct {
    Name             *resource.AccountName `json:"name"`
    Projects         Projects              `json:"projects"`
    CreatedAt        time.Time             `json:"created_at"`
    ProjectIDCounter *int32                `json:"-"`
    Config           *staticres.Config     `json:"-"`
}

type ProjectID

type ProjectID int32

type ProjectT

type ProjectT struct {
    Name              *resource.ProjectName `json:"name"`
    Resources         Resources             `json:"resources"`
    CreatedAt         time.Time             `json:"created_at"`
    ResourceIDCounter *int32                `json:"-"`
}

type Projects

type Projects map[ProjectID]*ProjectT

type ResourceID

type ResourceID int32

type ResourceT

internal state

type ResourceT struct {
    Name       *resource.ResourceName  `json:"name"`
    StaticData *resource.StaticResData `json:"static_data"`
    CreatedAt  time.Time               `json:"created_at"`
    Plugin     *plugin.Kind            `json:"plugin"`
}

type Resources

type Resources map[ResourceID]*ResourceT

type T

type T struct {
    Accounts          map[AccountID]*AccountT `json:"accounts" yaml:"accounts"`
    AccountsIDCounter *int32                  `json:"-"`
}

dynenv

import "carbonaut.dev/pkg/provider/types/dynenv"

Index

type Config

type Config struct {
    Plugin       *plugin.Kind `json:"plugin"         yaml:"plugin"`
    AccessKeyEnv *string      `json:"access_key_env" yaml:"access_key_env"`
}

type Provider

type Provider interface {
    GetName() *plugin.Kind
    GetDynamicEnvironmentData(*resource.Location) (*environment.DynamicEnvData, error)
}

dynres

import "carbonaut.dev/pkg/provider/types/dynres"

Index

type Config

type Config struct {
    Plugin plugin.Kind `json:"plugin" yaml:"plugin"`
    // Endpoint that is accessed to collec the data.
    // The IPv4 address will be collected from the static data thats looked up.
    Endpoint string `json:"endpoint" yaml:"endpoint"`
    // Client certificate file
    Cert string `json:"cert" yaml:"cert"`
    // Client certificate's key file
    Key string `json:"key" yaml:"key"`
    // Accept any certificate during TLS handshake. Insecure, use only for testing
    AcceptInvalidCert bool `json:"accept_invalid_cert" yaml:"accept_invalid_cert"`
}

type Provider

type Provider interface {
    GetName() *plugin.Kind
    GetDynamicResourceData(*resource.StaticResData) (*resource.DynamicResData, error)
}

staticres

import "carbonaut.dev/pkg/provider/types/staticres"

Index

type Config

type Config struct {
    Plugin       *plugin.Kind `json:"plugin"         yaml:"plugin"`
    AccessKeyEnv *string      `json:"access_key_env" yaml:"access_key_env"`
}

type Provider

type Provider interface {
    GetName() *plugin.Kind
    GetStaticResourceData(*resource.ProjectName, *resource.ResourceName) (*resource.StaticResData, error)
    DiscoverStaticResourceIdentifiers(*resource.ProjectName) ([]*resource.ResourceName, error)
    DiscoverProjectIdentifiers() ([]*resource.ProjectName, error)
}

Generated by gomarkdoc