# README
client
Package client is a Go client for Ignite resources.
For example, to list running VMs (the equivalent of "ignite vm ls"), and update the VM with a new IP address:
package main
import (
"context"
"fmt"
"net"
"github.com/weaveworks/ignite/pkg/client"
)
func main() {
// List VMs managed by Ignite
vmList, err := client.VMs().List()
if err != nil {
panic(err)
}
for _, vm := range vmList {
// Modify the object
vm.Status.IPAddresses = append(vm.Status.IPAddresses, net.IP{127,0,0,1})
// Save the new VM state
if err := client.VMs().Set(vm); err != nil {
panic(err)
}
}
// Get a specific image, and print its size
myImage, err := client.Images().Get("my-image")
if err != nil {
panic(err)
}
fmt.Printf("Image my-vm size: %s\n", myImage.Spec.Source.Size.String())
// Use the dynamic client
myVM, err := client.Dynamic("VM").Get("my-vm")
if err != nil {
panic(err)
}
fmt.Printf("VM my-vm cpus: %d\n", myVM.Spec.CPUs)
}
# Functions
NewClient creates a client for the specified storage.
No description provided by the author
# Structs
Client is a struct providing high-level access to objects in a storage The resource-specific client interfaces are automatically generated based off client_resource_template.go.
No description provided by the author
# Interfaces
DynamicClient is an interface for accessing API types generically.
ImageClient is an interface for accessing Image-specific API objects.
KernelClient is an interface for accessing Kernel-specific API objects.
VMClient is an interface for accessing VM-specific API objects.