models

import "github.com/analog-substance/carbon/pkg/models"

Index

func GetImageBuildsForProvider

func GetImageBuildsForProvider(provider string) ([]types.ImageBuild, error)

func NewImage

func NewImage(imageID string, imageName string, createdAt time.Time, env types.Environment) types.Image

type BuildBlock

type BuildBlock struct {
    Name        string   `hcl:"name,optional"`
    Description string   `hcl:"description,optional"`
    FromSources []string `hcl:"sources,optional"`
    Config      hcl.Body `hcl:",remain"`
}

type Image

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

func (*Image) CreatedAt

func (i *Image) CreatedAt() string

func (*Image) Destroy

func (i *Image) Destroy() error

func (*Image) Environment

func (i *Image) Environment() types.Environment

func (*Image) ID

func (i *Image) ID() string

func (*Image) Launch

func (i *Image) Launch(imageLaunchOptions types.ImageLaunchOptions) error

func (*Image) MarshalJSON

func (i *Image) MarshalJSON() ([]byte, error)

func (*Image) Name

func (i *Image) Name() string

func (*Image) Profile

func (i *Image) Profile() types.Profile

func (*Image) Provider

func (i *Image) Provider() types.Provider

type ImageBuild

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

func NewImageBuild

func NewImageBuild(buildPath, provider, provisioner string) *ImageBuild

func (*ImageBuild) Build

func (b *ImageBuild) Build() error

func (*ImageBuild) MarshalJSON

func (b *ImageBuild) MarshalJSON() ([]byte, error)

func (*ImageBuild) Name

func (b *ImageBuild) Name() string

func (*ImageBuild) ProviderType

func (b *ImageBuild) ProviderType() string

func (*ImageBuild) Provisioner

func (b *ImageBuild) Provisioner() string

type Machine

type Machine struct {
    InstanceName       string             `json:"name"`
    InstanceID         string             `json:"id"`
    CurrentUpTime      time.Duration      `json:"up_time"`
    InstanceType       string             `json:"type"`
    PublicIPAddresses  []string           `json:"public_ip_addresses"`
    PrivateIPAddresses []string           `json:"private_ip_addresses"`
    CurrentState       types.MachineState `json:"current_state"`
    Env                types.Environment  `json:"-"`
}

func (*Machine) Cmd

func (m *Machine) Cmd(user string, privateIP bool, cmdArgs ...string) (string, error)

func (*Machine) Destroy

func (m *Machine) Destroy() error

func (*Machine) Environment

func (m *Machine) Environment() types.Environment

func (*Machine) ExecSSH

func (m *Machine) ExecSSH(user string, privateIP bool, cmdArgs ...string) error

func (*Machine) ID

func (m *Machine) ID() string

func (*Machine) IPAddress

func (m *Machine) IPAddress() string

func (*Machine) Name

func (m *Machine) Name() string

func (*Machine) NewSSHSession

func (m *Machine) NewSSHSession(user string, privateIP bool) (*ssh_util.Session, error)

func (*Machine) PrivateIPAddress

func (m *Machine) PrivateIPAddress() string

func (*Machine) Profile

func (m *Machine) Profile() types.Profile

func (*Machine) Provider

func (m *Machine) Provider() types.Provider

func (*Machine) Restart

func (m *Machine) Restart() error

func (*Machine) Start

func (m *Machine) Start() error

func (*Machine) StartRDPClient

func (m *Machine) StartRDPClient(user string, privateIP bool) error

func (*Machine) StartVNC

func (m *Machine) StartVNC(user string, privateIP bool, killVNC bool) error

StartVNC will create a VNC session on the virtual machine It accomplishes this by:

  • SSH to the VM.
  • Start VNC if it is not already running.
  • Forward a port through the SSH session.
  • VNC to the forwarded port.

Requires TigerVNC to be installed.

func (*Machine) State

func (m *Machine) State() string

func (*Machine) Stop

func (m *Machine) Stop() error

func (*Machine) Type

func (m *Machine) Type() string

func (*Machine) UpTime

func (m *Machine) UpTime() time.Duration

type PackerConfig

type PackerConfig struct {
    Source SourceBlock `hcl:"source,block"`
    Build  BuildBlock  `hcl:"build,block"`
}

type Project

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

func NewProject

func NewProject(buildPath string) *Project

func (*Project) AddMachine

func (d *Project) AddMachine(machine *types.ProjectMachine, noApply bool) error

func (*Project) GetConfig

func (d *Project) GetConfig() (*types.ProjectConfig, error)

func (*Project) MarshalJSON

func (d *Project) MarshalJSON() ([]byte, error)

func (*Project) Name

func (d *Project) Name() string

func (*Project) SaveConfig

func (d *Project) SaveConfig() error

func (*Project) TerraformApply

func (d *Project) TerraformApply() error

type SourceBlock

type SourceBlock struct {
    Type   string   `hcl:"type,label"`
    Name   string   `hcl:"name,label"`
    Config hcl.Body `hcl:",remain"`
}
Last modified March 27, 2025: Add GCP Support (#88) (dccf344)