id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
146,100
apcera/libretto
virtualmachine/virtualbox/util.go
GetBridgedDeviceNameIPMap
func GetBridgedDeviceNameIPMap() (map[string]string, error) { m := map[string]string{} kvs, err := getBridgedDeviceKV("Name", "IPAddress") if err != nil { return m, err } for _, kv := range kvs { if kv.k != "" { m[kv.k] = kv.v } } return m, nil }
go
func GetBridgedDeviceNameIPMap() (map[string]string, error) { m := map[string]string{} kvs, err := getBridgedDeviceKV("Name", "IPAddress") if err != nil { return m, err } for _, kv := range kvs { if kv.k != "" { m[kv.k] = kv.v } } return m, nil }
[ "func", "GetBridgedDeviceNameIPMap", "(", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "m", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "kvs", ",", "err", ":=", "getBridgedDeviceKV", "(", "\"", "\"", ",", "\""...
// GetBridgedDeviceNameIPMap returns a map of network device // name and its IP address from the list of bridgedifs reported // by VirtualBox manager.
[ "GetBridgedDeviceNameIPMap", "returns", "a", "map", "of", "network", "device", "name", "and", "its", "IP", "address", "from", "the", "list", "of", "bridgedifs", "reported", "by", "VirtualBox", "manager", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/util.go#L60-L72
146,101
apcera/libretto
virtualmachine/virtualbox/util.go
GetBridgedDeviceName
func GetBridgedDeviceName(macAddr string) (string, error) { stdout, _, err := runner.Run("list", "bridgedifs") if err != nil { return "", err } if matches := networkRegexp.FindAllString(stdout, -1); len(matches) > 0 { // Each match is a device for _, device := range matches { var mac, name string // Fin...
go
func GetBridgedDeviceName(macAddr string) (string, error) { stdout, _, err := runner.Run("list", "bridgedifs") if err != nil { return "", err } if matches := networkRegexp.FindAllString(stdout, -1); len(matches) > 0 { // Each match is a device for _, device := range matches { var mac, name string // Fin...
[ "func", "GetBridgedDeviceName", "(", "macAddr", "string", ")", "(", "string", ",", "error", ")", "{", "stdout", ",", "_", ",", "err", ":=", "runner", ".", "Run", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// GetBridgedDeviceName takes the mac address of a network device as a string // and returns the name of the network device corresponding to it as seen by // Virtualbox
[ "GetBridgedDeviceName", "takes", "the", "mac", "address", "of", "a", "network", "device", "as", "a", "string", "and", "returns", "the", "name", "of", "the", "network", "device", "corresponding", "to", "it", "as", "seen", "by", "Virtualbox" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/util.go#L77-L101
146,102
apcera/libretto
virtualmachine/virtualbox/util.go
GetBridgedDevices
func GetBridgedDevices() ([]string, error) { deviceNames := []string{} ifAndMac, err := getBridgedDeviceKV("Name", "HardwareAddress") if err != nil { return deviceNames, err } for _, kv := range ifAndMac { if kv.k != "" && kv.v != "" { deviceNames = append(deviceNames, kv.k) } } return deviceNames, nil ...
go
func GetBridgedDevices() ([]string, error) { deviceNames := []string{} ifAndMac, err := getBridgedDeviceKV("Name", "HardwareAddress") if err != nil { return deviceNames, err } for _, kv := range ifAndMac { if kv.k != "" && kv.v != "" { deviceNames = append(deviceNames, kv.k) } } return deviceNames, nil ...
[ "func", "GetBridgedDevices", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "deviceNames", ":=", "[", "]", "string", "{", "}", "\n", "ifAndMac", ",", "err", ":=", "getBridgedDeviceKV", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", ...
// GetBridgedDevices returns a slice of network devices that can be connected to VMs in bridged mode
[ "GetBridgedDevices", "returns", "a", "slice", "of", "network", "devices", "that", "can", "be", "connected", "to", "VMs", "in", "bridged", "mode" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/util.go#L104-L116
146,103
apcera/libretto
virtualmachine/virtualbox/util.go
DeleteNIC
func DeleteNIC(vm *VM, nic NIC) error { if nic.Backing == Disabled { return lvm.ErrNICAlreadyDisabled } _, _, err := runner.Run("modifyvm", vm.Name, fmt.Sprintf("--nic%d", nic.Idx), "null") return err }
go
func DeleteNIC(vm *VM, nic NIC) error { if nic.Backing == Disabled { return lvm.ErrNICAlreadyDisabled } _, _, err := runner.Run("modifyvm", vm.Name, fmt.Sprintf("--nic%d", nic.Idx), "null") return err }
[ "func", "DeleteNIC", "(", "vm", "*", "VM", ",", "nic", "NIC", ")", "error", "{", "if", "nic", ".", "Backing", "==", "Disabled", "{", "return", "lvm", ".", "ErrNICAlreadyDisabled", "\n", "}", "\n", "_", ",", "_", ",", "err", ":=", "runner", ".", "Ru...
// DeleteNIC deletes the specified network interface on the vm.
[ "DeleteNIC", "deletes", "the", "specified", "network", "interface", "on", "the", "vm", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/util.go#L228-L234
146,104
apcera/libretto
virtualmachine/virtualbox/util.go
AddNIC
func AddNIC(vm *VM, nic NIC) error { var err error switch nic.Backing { case Nat: _, _, err = runner.Run("modifyvm", vm.Name, fmt.Sprintf("--nic%d", nic.Idx), getStringFromBacking(nic.Backing)) case Bridged: _, _, err = runner.Run("modifyvm", vm.Name, fmt.Sprintf("--nic%d", nic.Idx), getStringFromBacking(nic.Ba...
go
func AddNIC(vm *VM, nic NIC) error { var err error switch nic.Backing { case Nat: _, _, err = runner.Run("modifyvm", vm.Name, fmt.Sprintf("--nic%d", nic.Idx), getStringFromBacking(nic.Backing)) case Bridged: _, _, err = runner.Run("modifyvm", vm.Name, fmt.Sprintf("--nic%d", nic.Idx), getStringFromBacking(nic.Ba...
[ "func", "AddNIC", "(", "vm", "*", "VM", ",", "nic", "NIC", ")", "error", "{", "var", "err", "error", "\n", "switch", "nic", ".", "Backing", "{", "case", "Nat", ":", "_", ",", "_", ",", "err", "=", "runner", ".", "Run", "(", "\"", "\"", ",", "...
// AddNIC adds a NIC to the VM.
[ "AddNIC", "adds", "a", "NIC", "to", "the", "VM", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/util.go#L247-L256
146,105
apcera/libretto
virtualmachine/virtualbox/util.go
DeleteNICs
func DeleteNICs(vm *VM) error { nics, err := vm.GetInterfaces() if err != nil { return lvm.ErrFailedToGetNICS } for _, nic := range nics { if nic.Backing != Disabled { err := DeleteNIC(vm, nic) if err != nil { return err } } } return nil }
go
func DeleteNICs(vm *VM) error { nics, err := vm.GetInterfaces() if err != nil { return lvm.ErrFailedToGetNICS } for _, nic := range nics { if nic.Backing != Disabled { err := DeleteNIC(vm, nic) if err != nil { return err } } } return nil }
[ "func", "DeleteNICs", "(", "vm", "*", "VM", ")", "error", "{", "nics", ",", "err", ":=", "vm", ".", "GetInterfaces", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "lvm", ".", "ErrFailedToGetNICS", "\n", "}", "\n", "for", "_", ",", "nic",...
// DeleteNICs disables all the network interfaces on the vm.
[ "DeleteNICs", "disables", "all", "the", "network", "interfaces", "on", "the", "vm", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/util.go#L259-L273
146,106
apcera/libretto
ssh/keys.go
NewKeyPair
func NewKeyPair() (keyPair *KeyPair, err error) { priv, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { return nil, ErrKeyGeneration } if err := priv.Validate(); err != nil { return nil, ErrValidation } privDer := x509.MarshalPKCS1PrivateKey(priv) privateKey := pem.EncodeToMemory(&pem.Block{Type:...
go
func NewKeyPair() (keyPair *KeyPair, err error) { priv, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { return nil, ErrKeyGeneration } if err := priv.Validate(); err != nil { return nil, ErrValidation } privDer := x509.MarshalPKCS1PrivateKey(priv) privateKey := pem.EncodeToMemory(&pem.Block{Type:...
[ "func", "NewKeyPair", "(", ")", "(", "keyPair", "*", "KeyPair", ",", "err", "error", ")", "{", "priv", ",", "err", ":=", "rsa", ".", "GenerateKey", "(", "rand", ".", "Reader", ",", "2048", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ...
// NewKeyPair generates a new SSH keypair. This will return a private & public key encoded as DER.
[ "NewKeyPair", "generates", "a", "new", "SSH", "keypair", ".", "This", "will", "return", "a", "private", "&", "public", "key", "encoded", "as", "DER", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/keys.go#L22-L43
146,107
apcera/libretto
ssh/keys.go
ReadFromFile
func (kp *KeyPair) ReadFromFile(privateKeyPath string, publicKeyPath string) error { b, err := ioutil.ReadFile(privateKeyPath) if err != nil { return err } kp.PrivateKey = b b, err = ioutil.ReadFile(publicKeyPath) if err != nil { return err } kp.PublicKey = b return nil }
go
func (kp *KeyPair) ReadFromFile(privateKeyPath string, publicKeyPath string) error { b, err := ioutil.ReadFile(privateKeyPath) if err != nil { return err } kp.PrivateKey = b b, err = ioutil.ReadFile(publicKeyPath) if err != nil { return err } kp.PublicKey = b return nil }
[ "func", "(", "kp", "*", "KeyPair", ")", "ReadFromFile", "(", "privateKeyPath", "string", ",", "publicKeyPath", "string", ")", "error", "{", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "privateKeyPath", ")", "\n", "if", "err", "!=", "nil", "{",...
// ReadFromFile reads a keypair from files.
[ "ReadFromFile", "reads", "a", "keypair", "from", "files", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/keys.go#L52-L66
146,108
apcera/libretto
ssh/keys.go
WriteToFile
func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) error { files := []struct { File string Type string Value []byte }{ { File: privateKeyPath, Value: kp.PrivateKey, }, { File: publicKeyPath, Value: kp.PublicKey, }, } for _, v := range files { f, err := os.Cr...
go
func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) error { files := []struct { File string Type string Value []byte }{ { File: privateKeyPath, Value: kp.PrivateKey, }, { File: publicKeyPath, Value: kp.PublicKey, }, } for _, v := range files { f, err := os.Cr...
[ "func", "(", "kp", "*", "KeyPair", ")", "WriteToFile", "(", "privateKeyPath", "string", ",", "publicKeyPath", "string", ")", "error", "{", "files", ":=", "[", "]", "struct", "{", "File", "string", "\n", "Type", "string", "\n", "Value", "[", "]", "byte", ...
// WriteToFile writes a keypair to files
[ "WriteToFile", "writes", "a", "keypair", "to", "files" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/keys.go#L69-L105
146,109
apcera/libretto
virtualmachine/aws/wait.go
Error
func (e ReadyError) Error() string { return fmt.Sprintf( "failed waiting for instance (%s) to be ready, reason was: %s", e.InstanceID, e.StateReason, ) }
go
func (e ReadyError) Error() string { return fmt.Sprintf( "failed waiting for instance (%s) to be ready, reason was: %s", e.InstanceID, e.StateReason, ) }
[ "func", "(", "e", "ReadyError", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "InstanceID", ",", "e", ".", "StateReason", ",", ")", "\n", "}" ]
// Error returns a summarized string version of ReadyError. More details about // the failed instance can be accessed through the struct.
[ "Error", "returns", "a", "summarized", "string", "version", "of", "ReadyError", ".", "More", "details", "about", "the", "failed", "instance", "can", "be", "accessed", "through", "the", "struct", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/wait.go#L31-L37
146,110
apcera/libretto
util/util.go
Random
func Random(min, max int) int { if min == max { return min } if max < min { panic("max cannot be less than min") } rand.Seed(time.Now().UTC().UnixNano()) return rand.Intn(max-min+1) + min }
go
func Random(min, max int) int { if min == max { return min } if max < min { panic("max cannot be less than min") } rand.Seed(time.Now().UTC().UnixNano()) return rand.Intn(max-min+1) + min }
[ "func", "Random", "(", "min", ",", "max", "int", ")", "int", "{", "if", "min", "==", "max", "{", "return", "min", "\n", "}", "\n", "if", "max", "<", "min", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "rand", ".", "Seed", "(", "time",...
// Random generates a random number in between min and max // If min equals max then min is returned. If max is less than min // then the function panics.
[ "Random", "generates", "a", "random", "number", "in", "between", "min", "and", "max", "If", "min", "equals", "max", "then", "min", "is", "returned", ".", "If", "max", "is", "less", "than", "min", "then", "the", "function", "panics", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/util/util.go#L19-L28
146,111
apcera/libretto
util/util.go
GetVMIPs
func GetVMIPs(vm lvm.VirtualMachine, options ssh.Options) ([]net.IP, error) { ips := options.IPs if len(ips) == 0 { var err error ips, err = vm.GetIPs() if err != nil { return nil, fmt.Errorf("Error getting IPs for the VM: %s", err) } if len(ips) == 0 { return nil, lvm.ErrVMNoIP } } return ips, ni...
go
func GetVMIPs(vm lvm.VirtualMachine, options ssh.Options) ([]net.IP, error) { ips := options.IPs if len(ips) == 0 { var err error ips, err = vm.GetIPs() if err != nil { return nil, fmt.Errorf("Error getting IPs for the VM: %s", err) } if len(ips) == 0 { return nil, lvm.ErrVMNoIP } } return ips, ni...
[ "func", "GetVMIPs", "(", "vm", "lvm", ".", "VirtualMachine", ",", "options", "ssh", ".", "Options", ")", "(", "[", "]", "net", ".", "IP", ",", "error", ")", "{", "ips", ":=", "options", ".", "IPs", "\n", "if", "len", "(", "ips", ")", "==", "0", ...
// GetVMIPs returns the IPs associated with the given VM. If the IPs are present // in options, they will be returned. Otherwise, an API call will be made to // get the list of IPs. An error is returned if the API call fails or returns // nothing.
[ "GetVMIPs", "returns", "the", "IPs", "associated", "with", "the", "given", "VM", ".", "If", "the", "IPs", "are", "present", "in", "options", "they", "will", "be", "returned", ".", "Otherwise", "an", "API", "call", "will", "be", "made", "to", "get", "the"...
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/util/util.go#L34-L47
146,112
apcera/libretto
util/util.go
CombineErrors
func CombineErrors(delimiter string, errs ...error) error { var formatStrs = []string{} for _, e := range errs { if e == nil { continue } formatStrs = append(formatStrs, e.Error()) } return fmt.Errorf(strings.Join(formatStrs, delimiter)) }
go
func CombineErrors(delimiter string, errs ...error) error { var formatStrs = []string{} for _, e := range errs { if e == nil { continue } formatStrs = append(formatStrs, e.Error()) } return fmt.Errorf(strings.Join(formatStrs, delimiter)) }
[ "func", "CombineErrors", "(", "delimiter", "string", ",", "errs", "...", "error", ")", "error", "{", "var", "formatStrs", "=", "[", "]", "string", "{", "}", "\n\n", "for", "_", ",", "e", ":=", "range", "errs", "{", "if", "e", "==", "nil", "{", "con...
// CombineErrors converts all the errors from slice into a single error
[ "CombineErrors", "converts", "all", "the", "errors", "from", "slice", "into", "a", "single", "error" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/util/util.go#L50-L61
146,113
apcera/libretto
virtualmachine/vsphere/vm.go
Progress
func (v VMwareLease) Progress(p int) { v.Lease.Progress(v.Ctx, int32(p)) }
go
func (v VMwareLease) Progress(p int) { v.Lease.Progress(v.Ctx, int32(p)) }
[ "func", "(", "v", "VMwareLease", ")", "Progress", "(", "p", "int", ")", "{", "v", ".", "Lease", ".", "Progress", "(", "v", ".", "Ctx", ",", "int32", "(", "p", ")", ")", "\n", "}" ]
// Progress takes a percentage as an int and sets that percentage as the // completed percent.
[ "Progress", "takes", "a", "percentage", "as", "an", "int", "and", "sets", "that", "percentage", "as", "the", "completed", "percent", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L51-L53
146,114
apcera/libretto
virtualmachine/vsphere/vm.go
Wait
func (v VMwareLease) Wait() (*nfc.LeaseInfo, error) { return v.Lease.Wait(v.Ctx, nil) }
go
func (v VMwareLease) Wait() (*nfc.LeaseInfo, error) { return v.Lease.Wait(v.Ctx, nil) }
[ "func", "(", "v", "VMwareLease", ")", "Wait", "(", ")", "(", "*", "nfc", ".", "LeaseInfo", ",", "error", ")", "{", "return", "v", ".", "Lease", ".", "Wait", "(", "v", ".", "Ctx", ",", "nil", ")", "\n", "}" ]
// Wait waits for the underlying lease to finish.
[ "Wait", "waits", "for", "the", "underlying", "lease", "to", "finish", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L56-L58
146,115
apcera/libretto
virtualmachine/vsphere/vm.go
Read
func (r ReadProgress) Read(p []byte) (n int, err error) { n, err = r.Reader.Read(p) if err != nil { return } r.ch <- int64(n) return }
go
func (r ReadProgress) Read(p []byte) (n int, err error) { n, err = r.Reader.Read(p) if err != nil { return } r.ch <- int64(n) return }
[ "func", "(", "r", "ReadProgress", ")", "Read", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "n", ",", "err", "=", "r", ".", "Reader", ".", "Read", "(", "p", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// Read implements the Reader interface.
[ "Read", "implements", "the", "Reader", "interface", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L96-L103
146,116
apcera/libretto
virtualmachine/vsphere/vm.go
StartProgress
func (r ReadProgress) StartProgress() { r.wg.Add(1) go func() { var bytesReceived int64 var percent int tick := time.NewTicker(5 * time.Second) defer tick.Stop() defer r.wg.Done() for { select { case b := <-r.ch: bytesReceived += b percent = int((float32(bytesReceived) / float32(r.TotalBytes...
go
func (r ReadProgress) StartProgress() { r.wg.Add(1) go func() { var bytesReceived int64 var percent int tick := time.NewTicker(5 * time.Second) defer tick.Stop() defer r.wg.Done() for { select { case b := <-r.ch: bytesReceived += b percent = int((float32(bytesReceived) / float32(r.TotalBytes...
[ "func", "(", "r", "ReadProgress", ")", "StartProgress", "(", ")", "{", "r", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "func", "(", ")", "{", "var", "bytesReceived", "int64", "\n", "var", "percent", "int", "\n", "tick", ":=", "time", ".", ...
// StartProgress starts a goroutine that updates local progress on the lease as // well as pass it down to the underlying lease.
[ "StartProgress", "starts", "a", "goroutine", "that", "updates", "local", "progress", "on", "the", "lease", "as", "well", "as", "pass", "it", "down", "to", "the", "underlying", "lease", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L107-L129
146,117
apcera/libretto
virtualmachine/vsphere/vm.go
NewErrorParsingURL
func NewErrorParsingURL(u string, e error) ErrorParsingURL { return ErrorParsingURL{uri: u, err: e} }
go
func NewErrorParsingURL(u string, e error) ErrorParsingURL { return ErrorParsingURL{uri: u, err: e} }
[ "func", "NewErrorParsingURL", "(", "u", "string", ",", "e", "error", ")", "ErrorParsingURL", "{", "return", "ErrorParsingURL", "{", "uri", ":", "u", ",", "err", ":", "e", "}", "\n", "}" ]
// NewErrorParsingURL returns an ErrorParsingURL error.
[ "NewErrorParsingURL", "returns", "an", "ErrorParsingURL", "error", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L216-L218
146,118
apcera/libretto
virtualmachine/vsphere/vm.go
NewErrorInvalidHost
func NewErrorInvalidHost(h string, d string, n map[string]string) ErrorInvalidHost { return ErrorInvalidHost{host: h, ds: d, nw: n} }
go
func NewErrorInvalidHost(h string, d string, n map[string]string) ErrorInvalidHost { return ErrorInvalidHost{host: h, ds: d, nw: n} }
[ "func", "NewErrorInvalidHost", "(", "h", "string", ",", "d", "string", ",", "n", "map", "[", "string", "]", "string", ")", "ErrorInvalidHost", "{", "return", "ErrorInvalidHost", "{", "host", ":", "h", ",", "ds", ":", "d", ",", "nw", ":", "n", "}", "\...
// NewErrorInvalidHost returns an ErrorInvalidHost error.
[ "NewErrorInvalidHost", "returns", "an", "ErrorInvalidHost", "error", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L221-L223
146,119
apcera/libretto
virtualmachine/vsphere/vm.go
NewErrorObjectNotFound
func NewErrorObjectNotFound(e error, o string) ErrorObjectNotFound { return ErrorObjectNotFound{err: e, obj: o} }
go
func NewErrorObjectNotFound(e error, o string) ErrorObjectNotFound { return ErrorObjectNotFound{err: e, obj: o} }
[ "func", "NewErrorObjectNotFound", "(", "e", "error", ",", "o", "string", ")", "ErrorObjectNotFound", "{", "return", "ErrorObjectNotFound", "{", "err", ":", "e", ",", "obj", ":", "o", "}", "\n", "}" ]
// NewErrorObjectNotFound returns an ErrorObjectNotFound error.
[ "NewErrorObjectNotFound", "returns", "an", "ErrorObjectNotFound", "error", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L231-L233
146,120
apcera/libretto
virtualmachine/vsphere/vm.go
NewErrorPropertyRetrieval
func NewErrorPropertyRetrieval(m types.ManagedObjectReference, p []string, e error) ErrorPropertyRetrieval { return ErrorPropertyRetrieval{err: e, mor: m, ps: p} }
go
func NewErrorPropertyRetrieval(m types.ManagedObjectReference, p []string, e error) ErrorPropertyRetrieval { return ErrorPropertyRetrieval{err: e, mor: m, ps: p} }
[ "func", "NewErrorPropertyRetrieval", "(", "m", "types", ".", "ManagedObjectReference", ",", "p", "[", "]", "string", ",", "e", "error", ")", "ErrorPropertyRetrieval", "{", "return", "ErrorPropertyRetrieval", "{", "err", ":", "e", ",", "mor", ":", "m", ",", "...
// NewErrorPropertyRetrieval returns an ErrorPropertyRetrieval error.
[ "NewErrorPropertyRetrieval", "returns", "an", "ErrorPropertyRetrieval", "error", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L236-L238
146,121
apcera/libretto
virtualmachine/vsphere/vm.go
Provision
func (vm *VM) Provision() (err error) { if err := SetupSession(vm); err != nil { return fmt.Errorf("Error setting up vSphere session: %s", err) } // Cancel the sdk context defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() // Get a reference to the datacenter with host and vm folders populated dcMo,...
go
func (vm *VM) Provision() (err error) { if err := SetupSession(vm); err != nil { return fmt.Errorf("Error setting up vSphere session: %s", err) } // Cancel the sdk context defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() // Get a reference to the datacenter with host and vm folders populated dcMo,...
[ "func", "(", "vm", "*", "VM", ")", "Provision", "(", ")", "(", "err", "error", ")", "{", "if", "err", ":=", "SetupSession", "(", "vm", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", ...
// Provision provisions this VM.
[ "Provision", "provisions", "this", "VM", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L355-L419
146,122
apcera/libretto
virtualmachine/vsphere/vm.go
GetIPs
func (vm *VM) GetIPs() ([]net.IP, error) { if err := SetupSession(vm); err != nil { return nil, err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() // Get a reference to the datacenter with host and vm folders populated dcMo, err := GetDatacenter(vm) if err != nil { return nil, err } vmMo, e...
go
func (vm *VM) GetIPs() ([]net.IP, error) { if err := SetupSession(vm); err != nil { return nil, err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() // Get a reference to the datacenter with host and vm folders populated dcMo, err := GetDatacenter(vm) if err != nil { return nil, err } vmMo, e...
[ "func", "(", "vm", "*", "VM", ")", "GetIPs", "(", ")", "(", "[", "]", "net", ".", "IP", ",", "error", ")", "{", "if", "err", ":=", "SetupSession", "(", "vm", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "...
// GetIPs returns the IPs of this VM. Returns all the IPs known to the API for // the different network cards for this VM. Includes IPV4 and IPV6 addresses.
[ "GetIPs", "returns", "the", "IPs", "of", "this", "VM", ".", "Returns", "all", "the", "IPs", "known", "to", "the", "API", "for", "the", "different", "network", "cards", "for", "this", "VM", ".", "Includes", "IPV4", "and", "IPV6", "addresses", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L428-L467
146,123
apcera/libretto
virtualmachine/vsphere/vm.go
Destroy
func (vm *VM) Destroy() (err error) { if err := SetupSession(vm); err != nil { return err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() state, err := getState(vm) if err != nil { return err } // Can't destroy a suspended VM, power it on and update the state if state == "standby" { err =...
go
func (vm *VM) Destroy() (err error) { if err := SetupSession(vm); err != nil { return err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() state, err := getState(vm) if err != nil { return err } // Can't destroy a suspended VM, power it on and update the state if state == "standby" { err =...
[ "func", "(", "vm", "*", "VM", ")", "Destroy", "(", ")", "(", "err", "error", ")", "{", "if", "err", ":=", "SetupSession", "(", "vm", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "vm", "....
// Destroy deletes this VM from vSphere.
[ "Destroy", "deletes", "this", "VM", "from", "vSphere", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L470-L558
146,124
apcera/libretto
virtualmachine/vsphere/vm.go
GetState
func (vm *VM) GetState() (state string, err error) { if err := SetupSession(vm); err != nil { return "", lvm.ErrVMInfoFailed } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() state, err = getState(vm) if err != nil { return "", err } if state == "running" { return lvm.VMRunning, nil } else i...
go
func (vm *VM) GetState() (state string, err error) { if err := SetupSession(vm); err != nil { return "", lvm.ErrVMInfoFailed } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() state, err = getState(vm) if err != nil { return "", err } if state == "running" { return lvm.VMRunning, nil } else i...
[ "func", "(", "vm", "*", "VM", ")", "GetState", "(", ")", "(", "state", "string", ",", "err", "error", ")", "{", "if", "err", ":=", "SetupSession", "(", "vm", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "lvm", ".", "ErrVMInfoFail...
// GetState returns the power state of this VM.
[ "GetState", "returns", "the", "power", "state", "of", "this", "VM", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L561-L583
146,125
apcera/libretto
virtualmachine/vsphere/vm.go
Suspend
func (vm *VM) Suspend() (err error) { if err := SetupSession(vm); err != nil { return err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() // Get a reference to the datacenter with host and vm folders populated dcMo, err := GetDatacenter(vm) if err != nil { return err } vmMo, err := findVM(v...
go
func (vm *VM) Suspend() (err error) { if err := SetupSession(vm); err != nil { return err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() // Get a reference to the datacenter with host and vm folders populated dcMo, err := GetDatacenter(vm) if err != nil { return err } vmMo, err := findVM(v...
[ "func", "(", "vm", "*", "VM", ")", "Suspend", "(", ")", "(", "err", "error", ")", "{", "if", "err", ":=", "SetupSession", "(", "vm", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "defer", "func", "(", ")", "{", "vm", ...
// Suspend suspends this VM.
[ "Suspend", "suspends", "this", "VM", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L586-L618
146,126
apcera/libretto
virtualmachine/vsphere/vm.go
Halt
func (vm *VM) Halt() (err error) { if err := SetupSession(vm); err != nil { return err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() return halt(vm) }
go
func (vm *VM) Halt() (err error) { if err := SetupSession(vm); err != nil { return err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() return halt(vm) }
[ "func", "(", "vm", "*", "VM", ")", "Halt", "(", ")", "(", "err", "error", ")", "{", "if", "err", ":=", "SetupSession", "(", "vm", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "vm", ".", ...
// Halt halts this VM.
[ "Halt", "halts", "this", "VM", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L621-L631
146,127
apcera/libretto
virtualmachine/vsphere/vm.go
Start
func (vm *VM) Start() (err error) { if err := SetupSession(vm); err != nil { return err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() return start(vm) }
go
func (vm *VM) Start() (err error) { if err := SetupSession(vm); err != nil { return err } defer func() { vm.client.Logout(vm.ctx) vm.cancel() }() return start(vm) }
[ "func", "(", "vm", "*", "VM", ")", "Start", "(", ")", "(", "err", "error", ")", "{", "if", "err", ":=", "SetupSession", "(", "vm", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "vm", ".",...
// Start powers on this VM.
[ "Start", "powers", "on", "this", "VM", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/vm.go#L634-L644
146,128
apcera/libretto
virtualmachine/mockprovider/vm.go
GetSSH
func (vm *VM) GetSSH(options libssh.Options) (libssh.Client, error) { if vm.MockGetSSH != nil { return vm.MockGetSSH(options) } return nil, lvm.ErrNotImplemented }
go
func (vm *VM) GetSSH(options libssh.Options) (libssh.Client, error) { if vm.MockGetSSH != nil { return vm.MockGetSSH(options) } return nil, lvm.ErrNotImplemented }
[ "func", "(", "vm", "*", "VM", ")", "GetSSH", "(", "options", "libssh", ".", "Options", ")", "(", "libssh", ".", "Client", ",", "error", ")", "{", "if", "vm", ".", "MockGetSSH", "!=", "nil", "{", "return", "vm", ".", "MockGetSSH", "(", "options", ")...
// GetSSH returns an ssh client for the the vm.
[ "GetSSH", "returns", "an", "ssh", "client", "for", "the", "the", "vm", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/mockprovider/vm.go#L37-L42
146,129
apcera/libretto
virtualmachine/mockprovider/vm.go
Resume
func (vm *VM) Resume() error { if vm.MockResume != nil { return vm.MockResume() } return lvm.ErrNotImplemented }
go
func (vm *VM) Resume() error { if vm.MockResume != nil { return vm.MockResume() } return lvm.ErrNotImplemented }
[ "func", "(", "vm", "*", "VM", ")", "Resume", "(", ")", "error", "{", "if", "vm", ".", "MockResume", "!=", "nil", "{", "return", "vm", ".", "MockResume", "(", ")", "\n", "}", "\n", "return", "lvm", ".", "ErrNotImplemented", "\n", "}" ]
// Resume suspends the active state of the VM.
[ "Resume", "suspends", "the", "active", "state", "of", "the", "VM", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/mockprovider/vm.go#L69-L74
146,130
apcera/libretto
virtualmachine/mockprovider/vm.go
GetIPs
func (vm *VM) GetIPs() ([]net.IP, error) { if vm.MockGetIPs != nil { return vm.MockGetIPs() } return []net.IP{}, nil }
go
func (vm *VM) GetIPs() ([]net.IP, error) { if vm.MockGetIPs != nil { return vm.MockGetIPs() } return []net.IP{}, nil }
[ "func", "(", "vm", "*", "VM", ")", "GetIPs", "(", ")", "(", "[", "]", "net", ".", "IP", ",", "error", ")", "{", "if", "vm", ".", "MockGetIPs", "!=", "nil", "{", "return", "vm", ".", "MockGetIPs", "(", ")", "\n", "}", "\n", "return", "[", "]",...
// GetIPs returns a list of ip addresses associated with the vm through VMware tools
[ "GetIPs", "returns", "a", "list", "of", "ip", "addresses", "associated", "with", "the", "vm", "through", "VMware", "tools" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/mockprovider/vm.go#L85-L90
146,131
apcera/libretto
virtualmachine/mockprovider/vm.go
Provision
func (vm *VM) Provision() error { if vm.MockProvision != nil { return vm.MockProvision() } return lvm.ErrNotImplemented }
go
func (vm *VM) Provision() error { if vm.MockProvision != nil { return vm.MockProvision() } return lvm.ErrNotImplemented }
[ "func", "(", "vm", "*", "VM", ")", "Provision", "(", ")", "error", "{", "if", "vm", ".", "MockProvision", "!=", "nil", "{", "return", "vm", ".", "MockProvision", "(", ")", "\n", "}", "\n", "return", "lvm", ".", "ErrNotImplemented", "\n", "}" ]
// Provision clones this VM and powers it on, while waiting for it to get an IP address.
[ "Provision", "clones", "this", "VM", "and", "powers", "it", "on", "while", "waiting", "for", "it", "to", "get", "an", "IP", "address", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/mockprovider/vm.go#L101-L106
146,132
apcera/libretto
ssh/ssh.go
Connect
func (client *SSHClient) Connect() error { var ( auth cssh.AuthMethod err error ) if err = client.Validate(); err != nil { return err } if client.Creds.SSHPrivateKey != "" { auth, err = getAuth(client.Creds, KeyAuth) if err != nil { return err } } else { auth, err = getAuth(client.Creds, Passw...
go
func (client *SSHClient) Connect() error { var ( auth cssh.AuthMethod err error ) if err = client.Validate(); err != nil { return err } if client.Creds.SSHPrivateKey != "" { auth, err = getAuth(client.Creds, KeyAuth) if err != nil { return err } } else { auth, err = getAuth(client.Creds, Passw...
[ "func", "(", "client", "*", "SSHClient", ")", "Connect", "(", ")", "error", "{", "var", "(", "auth", "cssh", ".", "AuthMethod", "\n", "err", "error", "\n", ")", "\n\n", "if", "err", "=", "client", ".", "Validate", "(", ")", ";", "err", "!=", "nil",...
// Connect connects to a machine using SSH.
[ "Connect", "connects", "to", "a", "machine", "using", "SSH", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/ssh.go#L98-L146
146,133
apcera/libretto
ssh/ssh.go
Run
func (client *SSHClient) Run(command string, stdout io.Writer, stderr io.Writer) error { session, err := client.cryptoClient.NewSession() if err != nil { return err } defer session.Close() session.Stdout = stdout session.Stderr = stderr if client.Options.Pty { modes := cssh.TerminalModes{ cssh.ECHO: ...
go
func (client *SSHClient) Run(command string, stdout io.Writer, stderr io.Writer) error { session, err := client.cryptoClient.NewSession() if err != nil { return err } defer session.Close() session.Stdout = stdout session.Stderr = stderr if client.Options.Pty { modes := cssh.TerminalModes{ cssh.ECHO: ...
[ "func", "(", "client", "*", "SSHClient", ")", "Run", "(", "command", "string", ",", "stdout", "io", ".", "Writer", ",", "stderr", "io", ".", "Writer", ")", "error", "{", "session", ",", "err", ":=", "client", ".", "cryptoClient", ".", "NewSession", "("...
// Run runs a command via SSH.
[ "Run", "runs", "a", "command", "via", "SSH", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/ssh.go#L265-L289
146,134
apcera/libretto
ssh/ssh.go
Validate
func (client *SSHClient) Validate() error { if client.Creds.SSHUser == "" { return ErrInvalidUsername } if client.Creds.SSHPrivateKey == "" && client.Creds.SSHPassword == "" { return ErrInvalidAuth } return nil }
go
func (client *SSHClient) Validate() error { if client.Creds.SSHUser == "" { return ErrInvalidUsername } if client.Creds.SSHPrivateKey == "" && client.Creds.SSHPassword == "" { return ErrInvalidAuth } return nil }
[ "func", "(", "client", "*", "SSHClient", ")", "Validate", "(", ")", "error", "{", "if", "client", ".", "Creds", ".", "SSHUser", "==", "\"", "\"", "{", "return", "ErrInvalidUsername", "\n", "}", "\n\n", "if", "client", ".", "Creds", ".", "SSHPrivateKey", ...
// Validate verifies that SSH connection credentials were properly configured.
[ "Validate", "verifies", "that", "SSH", "connection", "credentials", "were", "properly", "configured", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/ssh.go#L350-L360
146,135
apcera/libretto
ssh/ssh.go
WaitForSSH
func (client *SSHClient) WaitForSSH(maxWait time.Duration) error { start := time.Now() for { if err := client.Connect(); err == nil { defer client.Disconnect() return nil } timePassed := time.Since(start) if timePassed >= maxWait { break } time.Sleep(5 * time.Second) } return ErrTimeout }
go
func (client *SSHClient) WaitForSSH(maxWait time.Duration) error { start := time.Now() for { if err := client.Connect(); err == nil { defer client.Disconnect() return nil } timePassed := time.Since(start) if timePassed >= maxWait { break } time.Sleep(5 * time.Second) } return ErrTimeout }
[ "func", "(", "client", "*", "SSHClient", ")", "WaitForSSH", "(", "maxWait", "time", ".", "Duration", ")", "error", "{", "start", ":=", "time", ".", "Now", "(", ")", "\n\n", "for", "{", "if", "err", ":=", "client", ".", "Connect", "(", ")", ";", "er...
// WaitForSSH will try to connect to an SSH server. If it fails, then it'll // sleep for 5 seconds.
[ "WaitForSSH", "will", "try", "to", "connect", "to", "an", "SSH", "server", ".", "If", "it", "fails", "then", "it", "ll", "sleep", "for", "5", "seconds", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/ssh.go#L364-L382
146,136
apcera/libretto
ssh/ssh.go
SetSSHPrivateKey
func (client *SSHClient) SetSSHPrivateKey(s string) { client.Creds.mu.Lock() client.Creds.SSHPrivateKey = s client.Creds.mu.Unlock() }
go
func (client *SSHClient) SetSSHPrivateKey(s string) { client.Creds.mu.Lock() client.Creds.SSHPrivateKey = s client.Creds.mu.Unlock() }
[ "func", "(", "client", "*", "SSHClient", ")", "SetSSHPrivateKey", "(", "s", "string", ")", "{", "client", ".", "Creds", ".", "mu", ".", "Lock", "(", ")", "\n", "client", ".", "Creds", ".", "SSHPrivateKey", "=", "s", "\n", "client", ".", "Creds", ".",...
// SetSSHPrivateKey sets the private key on the clients credentials.
[ "SetSSHPrivateKey", "sets", "the", "private", "key", "on", "the", "clients", "credentials", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/ssh.go#L385-L389
146,137
apcera/libretto
ssh/ssh.go
GetSSHPrivateKey
func (client *SSHClient) GetSSHPrivateKey() string { client.Creds.mu.Lock() defer client.Creds.mu.Unlock() return client.Creds.SSHPrivateKey }
go
func (client *SSHClient) GetSSHPrivateKey() string { client.Creds.mu.Lock() defer client.Creds.mu.Unlock() return client.Creds.SSHPrivateKey }
[ "func", "(", "client", "*", "SSHClient", ")", "GetSSHPrivateKey", "(", ")", "string", "{", "client", ".", "Creds", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "client", ".", "Creds", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "client", ...
// GetSSHPrivateKey gets the private key on the clients credentials.
[ "GetSSHPrivateKey", "gets", "the", "private", "key", "on", "the", "clients", "credentials", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/ssh.go#L392-L396
146,138
apcera/libretto
ssh/ssh.go
SetSSHPassword
func (client *SSHClient) SetSSHPassword(s string) { client.Creds.mu.Lock() client.Creds.SSHPassword = s client.Creds.mu.Unlock() }
go
func (client *SSHClient) SetSSHPassword(s string) { client.Creds.mu.Lock() client.Creds.SSHPassword = s client.Creds.mu.Unlock() }
[ "func", "(", "client", "*", "SSHClient", ")", "SetSSHPassword", "(", "s", "string", ")", "{", "client", ".", "Creds", ".", "mu", ".", "Lock", "(", ")", "\n", "client", ".", "Creds", ".", "SSHPassword", "=", "s", "\n", "client", ".", "Creds", ".", "...
// SetSSHPassword sets the SSH password on the clients credentials.
[ "SetSSHPassword", "sets", "the", "SSH", "password", "on", "the", "clients", "credentials", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/ssh.go#L399-L403
146,139
apcera/libretto
ssh/ssh.go
GetSSHPassword
func (client *SSHClient) GetSSHPassword() string { client.Creds.mu.Lock() defer client.Creds.mu.Unlock() return client.Creds.SSHPassword }
go
func (client *SSHClient) GetSSHPassword() string { client.Creds.mu.Lock() defer client.Creds.mu.Unlock() return client.Creds.SSHPassword }
[ "func", "(", "client", "*", "SSHClient", ")", "GetSSHPassword", "(", ")", "string", "{", "client", ".", "Creds", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "client", ".", "Creds", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "client", ...
// GetSSHPassword gets the SSH password on the clients credentials.
[ "GetSSHPassword", "gets", "the", "SSH", "password", "on", "the", "clients", "credentials", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/ssh.go#L406-L410
146,140
apcera/libretto
virtualmachine/azure/management/util.go
getClient
func (vm *VM) getClient() (management.Client, error) { mu.Lock() defer mu.Unlock() if client != nil { return client, nil } var err error client, err = management.ClientFromPublishSettingsFile(vm.PublishSettings, "") if err != nil { return nil, err } return client, nil }
go
func (vm *VM) getClient() (management.Client, error) { mu.Lock() defer mu.Unlock() if client != nil { return client, nil } var err error client, err = management.ClientFromPublishSettingsFile(vm.PublishSettings, "") if err != nil { return nil, err } return client, nil }
[ "func", "(", "vm", "*", "VM", ")", "getClient", "(", ")", "(", "management", ".", "Client", ",", "error", ")", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n", "if", "client", "!=", "nil", "{", "return", "cl...
// getClient instantiates an Azure client if necessary and returns a copy of the // client. It returns an error if there is a problem reading or unmarshaling the // .publishSettings file.
[ "getClient", "instantiates", "an", "Azure", "client", "if", "necessary", "and", "returns", "a", "copy", "of", "the", "client", ".", "It", "returns", "an", "error", "if", "there", "is", "a", "problem", "reading", "or", "unmarshaling", "the", ".", "publishSett...
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L27-L41
146,141
apcera/libretto
virtualmachine/azure/management/util.go
getVMClient
func (vm *VM) getVMClient() (virtualmachine.VirtualMachineClient, error) { c, err := vm.getClient() if err != nil { return virtualmachine.VirtualMachineClient{}, err } return virtualmachine.NewClient(c), nil }
go
func (vm *VM) getVMClient() (virtualmachine.VirtualMachineClient, error) { c, err := vm.getClient() if err != nil { return virtualmachine.VirtualMachineClient{}, err } return virtualmachine.NewClient(c), nil }
[ "func", "(", "vm", "*", "VM", ")", "getVMClient", "(", ")", "(", "virtualmachine", ".", "VirtualMachineClient", ",", "error", ")", "{", "c", ",", "err", ":=", "vm", ".", "getClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "virtualma...
// getVMClient returns a new Azure virtual machine client.
[ "getVMClient", "returns", "a", "new", "Azure", "virtual", "machine", "client", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L44-L51
146,142
apcera/libretto
virtualmachine/azure/management/util.go
getServiceClient
func (vm *VM) getServiceClient() (hostedservice.HostedServiceClient, error) { c, err := vm.getClient() if err != nil { return hostedservice.HostedServiceClient{}, err } return hostedservice.NewClient(c), nil }
go
func (vm *VM) getServiceClient() (hostedservice.HostedServiceClient, error) { c, err := vm.getClient() if err != nil { return hostedservice.HostedServiceClient{}, err } return hostedservice.NewClient(c), nil }
[ "func", "(", "vm", "*", "VM", ")", "getServiceClient", "(", ")", "(", "hostedservice", ".", "HostedServiceClient", ",", "error", ")", "{", "c", ",", "err", ":=", "vm", ".", "getClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "hosted...
// getServiceClient returns a new Azure hosted service client.
[ "getServiceClient", "returns", "a", "new", "Azure", "hosted", "service", "client", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L54-L61
146,143
apcera/libretto
virtualmachine/azure/management/util.go
getVirtualNetworkClient
func (vm *VM) getVirtualNetworkClient() (virtualnetwork.VirtualNetworkClient, error) { c, err := vm.getClient() if err != nil { return virtualnetwork.VirtualNetworkClient{}, err } return virtualnetwork.NewClient(c), nil }
go
func (vm *VM) getVirtualNetworkClient() (virtualnetwork.VirtualNetworkClient, error) { c, err := vm.getClient() if err != nil { return virtualnetwork.VirtualNetworkClient{}, err } return virtualnetwork.NewClient(c), nil }
[ "func", "(", "vm", "*", "VM", ")", "getVirtualNetworkClient", "(", ")", "(", "virtualnetwork", ".", "VirtualNetworkClient", ",", "error", ")", "{", "c", ",", "err", ":=", "vm", ".", "getClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// getVirtualNetworkClient returns a new virtual network client.
[ "getVirtualNetworkClient", "returns", "a", "new", "virtual", "network", "client", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L64-L71
146,144
apcera/libretto
virtualmachine/azure/management/util.go
createHostedService
func (vm *VM) createHostedService() error { sc, err := vm.getServiceClient() if err != nil { return fmt.Errorf(errGetClient, err) } // create hosted service if err := sc.CreateHostedService(hostedservice.CreateHostedServiceParameters{ ServiceName: vm.ServiceName, Location: vm.Location, Label: bas...
go
func (vm *VM) createHostedService() error { sc, err := vm.getServiceClient() if err != nil { return fmt.Errorf(errGetClient, err) } // create hosted service if err := sc.CreateHostedService(hostedservice.CreateHostedServiceParameters{ ServiceName: vm.ServiceName, Location: vm.Location, Label: bas...
[ "func", "(", "vm", "*", "VM", ")", "createHostedService", "(", ")", "error", "{", "sc", ",", "err", ":=", "vm", ".", "getServiceClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "errGetClient", ",", "err", ...
// createHostedService creates a hosted service on Azure.
[ "createHostedService", "creates", "a", "hosted", "service", "on", "Azure", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L74-L97
146,145
apcera/libretto
virtualmachine/azure/management/util.go
deleteHostedService
func (vm *VM) deleteHostedService() error { sc, err := vm.getServiceClient() if err != nil { return fmt.Errorf(errGetClient, err) } // Delete hosted service _, err = sc.DeleteHostedService(vm.ServiceName, true) return err }
go
func (vm *VM) deleteHostedService() error { sc, err := vm.getServiceClient() if err != nil { return fmt.Errorf(errGetClient, err) } // Delete hosted service _, err = sc.DeleteHostedService(vm.ServiceName, true) return err }
[ "func", "(", "vm", "*", "VM", ")", "deleteHostedService", "(", ")", "error", "{", "sc", ",", "err", ":=", "vm", ".", "getServiceClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "errGetClient", ",", "err", ...
// deleteHostedService deletes a hosted service on Azure.
[ "deleteHostedService", "deletes", "a", "hosted", "service", "on", "Azure", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L100-L109
146,146
apcera/libretto
virtualmachine/azure/management/util.go
listHostedServices
func (vm *VM) listHostedServices() ([]hostedservice.HostedService, error) { sc, err := vm.getServiceClient() if err != nil { return nil, fmt.Errorf(errGetClient, err) } resp, err := sc.ListHostedServices() if err != nil { return nil, err } return resp.HostedServices, nil }
go
func (vm *VM) listHostedServices() ([]hostedservice.HostedService, error) { sc, err := vm.getServiceClient() if err != nil { return nil, fmt.Errorf(errGetClient, err) } resp, err := sc.ListHostedServices() if err != nil { return nil, err } return resp.HostedServices, nil }
[ "func", "(", "vm", "*", "VM", ")", "listHostedServices", "(", ")", "(", "[", "]", "hostedservice", ".", "HostedService", ",", "error", ")", "{", "sc", ",", "err", ":=", "vm", ".", "getServiceClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "...
// listHostedServices lists all the hosted services under the current account.
[ "listHostedServices", "lists", "all", "the", "hosted", "services", "under", "the", "current", "account", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L112-L124
146,147
apcera/libretto
virtualmachine/azure/management/util.go
addAddCertificate
func (vm *VM) addAddCertificate() error { sc, err := vm.getServiceClient() if err != nil { return fmt.Errorf(errGetClient, err) } _, err = sc.AddCertificate(vm.Name, vm.Cert.Data, hostedservice.CertificateFormat(vm.Cert.Format), vm.SSHCreds.SSHPassword) return err }
go
func (vm *VM) addAddCertificate() error { sc, err := vm.getServiceClient() if err != nil { return fmt.Errorf(errGetClient, err) } _, err = sc.AddCertificate(vm.Name, vm.Cert.Data, hostedservice.CertificateFormat(vm.Cert.Format), vm.SSHCreds.SSHPassword) return err }
[ "func", "(", "vm", "*", "VM", ")", "addAddCertificate", "(", ")", "error", "{", "sc", ",", "err", ":=", "vm", ".", "getServiceClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "errGetClient", ",", "err", "...
// addAddCertificate adds certs to a hosted service.
[ "addAddCertificate", "adds", "certs", "to", "a", "hosted", "service", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L127-L135
146,148
apcera/libretto
virtualmachine/azure/management/util.go
serviceExist
func (vm *VM) serviceExist(services []hostedservice.HostedService) bool { for _, srv := range services { if srv.ServiceName == vm.ServiceName { return true } } return false }
go
func (vm *VM) serviceExist(services []hostedservice.HostedService) bool { for _, srv := range services { if srv.ServiceName == vm.ServiceName { return true } } return false }
[ "func", "(", "vm", "*", "VM", ")", "serviceExist", "(", "services", "[", "]", "hostedservice", ".", "HostedService", ")", "bool", "{", "for", "_", ",", "srv", ":=", "range", "services", "{", "if", "srv", ".", "ServiceName", "==", "vm", ".", "ServiceNam...
// serviceExist checks if the desired service name already exists.
[ "serviceExist", "checks", "if", "the", "desired", "service", "name", "already", "exists", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L138-L146
146,149
apcera/libretto
virtualmachine/azure/management/util.go
getFirstSubnet
func (vm *VM) getFirstSubnet() (string, error) { vc, err := vm.getVirtualNetworkClient() if err != nil { return "", fmt.Errorf(errGetClient, err) } nc, err := vc.GetVirtualNetworkConfiguration() if err != nil { return "", fmt.Errorf("Error to get VirtualNetwork Configuration : %s", err) } for _, vns := ran...
go
func (vm *VM) getFirstSubnet() (string, error) { vc, err := vm.getVirtualNetworkClient() if err != nil { return "", fmt.Errorf(errGetClient, err) } nc, err := vc.GetVirtualNetworkConfiguration() if err != nil { return "", fmt.Errorf("Error to get VirtualNetwork Configuration : %s", err) } for _, vns := ran...
[ "func", "(", "vm", "*", "VM", ")", "getFirstSubnet", "(", ")", "(", "string", ",", "error", ")", "{", "vc", ",", "err", ":=", "vm", ".", "getVirtualNetworkClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", "...
// getFirstSubnet gets the name of the first subnet within the VM's virtual // network.
[ "getFirstSubnet", "gets", "the", "name", "of", "the", "first", "subnet", "within", "the", "VM", "s", "virtual", "network", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/management/util.go#L158-L180
146,150
apcera/libretto
virtualmachine/digitalocean/util.go
BuildRequest
func BuildRequest(token, method, url string, body io.Reader) (*http.Request, error) { req, err := http.NewRequest(method, url, body) if err != nil { return nil, err } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+token) return req, nil }
go
func BuildRequest(token, method, url string, body io.Reader) (*http.Request, error) { req, err := http.NewRequest(method, url, body) if err != nil { return nil, err } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+token) return req, nil }
[ "func", "BuildRequest", "(", "token", ",", "method", ",", "url", "string", ",", "body", "io", ".", "Reader", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "method", ",", "url...
// BuildRequest builds an http request for this provider.
[ "BuildRequest", "builds", "an", "http", "request", "for", "this", "provider", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/digitalocean/util.go#L14-L23
146,151
apcera/libretto
virtualmachine/digitalocean/util.go
GetDroplets
func GetDroplets(token string) (*DropletsResponse, error) { client := &http.Client{} req, err := BuildRequest(token, "GET", apiBaseURL+apiDropletURL, nil) if err != nil { return nil, err } rsp, err := client.Do(req) if err != nil { return nil, err } defer rsp.Body.Close() b, err := ioutil.ReadAll(rsp.Body)...
go
func GetDroplets(token string) (*DropletsResponse, error) { client := &http.Client{} req, err := BuildRequest(token, "GET", apiBaseURL+apiDropletURL, nil) if err != nil { return nil, err } rsp, err := client.Do(req) if err != nil { return nil, err } defer rsp.Body.Close() b, err := ioutil.ReadAll(rsp.Body)...
[ "func", "GetDroplets", "(", "token", "string", ")", "(", "*", "DropletsResponse", ",", "error", ")", "{", "client", ":=", "&", "http", ".", "Client", "{", "}", "\n", "req", ",", "err", ":=", "BuildRequest", "(", "token", ",", "\"", "\"", ",", "apiBas...
// GetDroplets returns and array of droplets
[ "GetDroplets", "returns", "and", "array", "of", "droplets" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/digitalocean/util.go#L61-L86
146,152
apcera/libretto
virtualmachine/digitalocean/util.go
PrintDroplet
func PrintDroplet(droplet *Droplet) { fmt.Println("ID:", droplet.ID) fmt.Println("Name:", droplet.Name) fmt.Println("Status:", droplet.Status) fmt.Println("Locked:", fmt.Sprintf("%t", droplet.Locked)) fmt.Println("CreatedAt:", droplet.CreatedAt.Format("2006-01-02 15:04:05")) fmt.Println("SizeSlug:", droplet.Size....
go
func PrintDroplet(droplet *Droplet) { fmt.Println("ID:", droplet.ID) fmt.Println("Name:", droplet.Name) fmt.Println("Status:", droplet.Status) fmt.Println("Locked:", fmt.Sprintf("%t", droplet.Locked)) fmt.Println("CreatedAt:", droplet.CreatedAt.Format("2006-01-02 15:04:05")) fmt.Println("SizeSlug:", droplet.Size....
[ "func", "PrintDroplet", "(", "droplet", "*", "Droplet", ")", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "droplet", ".", "ID", ")", "\n", "fmt", ".", "Println", "(", "\"", "\"", ",", "droplet", ".", "Name", ")", "\n", "fmt", ".", "Println", ...
// PrintDroplet prints the basic droplet values
[ "PrintDroplet", "prints", "the", "basic", "droplet", "values" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/digitalocean/util.go#L89-L104
146,153
apcera/libretto
virtualmachine/aws/vm.go
SetTag
func (vm *VM) SetTag(key, value string) error { svc, err := getService(vm.Region) if err != nil { return fmt.Errorf("failed to get AWS service: %v", err) } if vm.InstanceID == "" { return ErrNoInstanceID } volIDs, err := getInstanceVolumeIDs(svc, vm.InstanceID) if err != nil { return fmt.Errorf("Failed t...
go
func (vm *VM) SetTag(key, value string) error { svc, err := getService(vm.Region) if err != nil { return fmt.Errorf("failed to get AWS service: %v", err) } if vm.InstanceID == "" { return ErrNoInstanceID } volIDs, err := getInstanceVolumeIDs(svc, vm.InstanceID) if err != nil { return fmt.Errorf("Failed t...
[ "func", "(", "vm", "*", "VM", ")", "SetTag", "(", "key", ",", "value", "string", ")", "error", "{", "svc", ",", "err", ":=", "getService", "(", "vm", ".", "Region", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", ...
// SetTag adds a tag to the VM and its attached volumes.
[ "SetTag", "adds", "a", "tag", "to", "the", "VM", "and", "its", "attached", "volumes", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/vm.go#L109-L142
146,154
apcera/libretto
virtualmachine/aws/vm.go
SetTags
func (vm *VM) SetTags(tags map[string]string) error { for k, v := range tags { if err := vm.SetTag(k, v); err != nil { return err } } return nil }
go
func (vm *VM) SetTags(tags map[string]string) error { for k, v := range tags { if err := vm.SetTag(k, v); err != nil { return err } } return nil }
[ "func", "(", "vm", "*", "VM", ")", "SetTags", "(", "tags", "map", "[", "string", "]", "string", ")", "error", "{", "for", "k", ",", "v", ":=", "range", "tags", "{", "if", "err", ":=", "vm", ".", "SetTag", "(", "k", ",", "v", ")", ";", "err", ...
// SetTags takes in a map of tags to set to the provisioned instance. This is // essentially a shorter way than calling SetTag many times.
[ "SetTags", "takes", "in", "a", "map", "of", "tags", "to", "set", "to", "the", "provisioned", "instance", ".", "This", "is", "essentially", "a", "shorter", "way", "than", "calling", "SetTag", "many", "times", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/vm.go#L146-L153
146,155
apcera/libretto
virtualmachine/aws/vm.go
Provision
func (vm *VM) Provision() error { wait() // Avoid the AWS rate limit. svc, err := getService(vm.Region) if err != nil { return fmt.Errorf("failed to get AWS service: %v", err) } resp, err := svc.RunInstances(instanceInfo(vm)) if err != nil { return fmt.Errorf("Failed to create instance: %v", err) } if ha...
go
func (vm *VM) Provision() error { wait() // Avoid the AWS rate limit. svc, err := getService(vm.Region) if err != nil { return fmt.Errorf("failed to get AWS service: %v", err) } resp, err := svc.RunInstances(instanceInfo(vm)) if err != nil { return fmt.Errorf("Failed to create instance: %v", err) } if ha...
[ "func", "(", "vm", "*", "VM", ")", "Provision", "(", ")", "error", "{", "wait", "(", ")", "// Avoid the AWS rate limit.", "\n\n", "svc", ",", "err", ":=", "getService", "(", "vm", ".", "Region", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fm...
// Provision creates a virtual machine on AWS. It returns an error if // there was a problem during creation, if there was a problem adding a tag, or // if the VM takes too long to enter "running" state.
[ "Provision", "creates", "a", "virtual", "machine", "on", "AWS", ".", "It", "returns", "an", "error", "if", "there", "was", "a", "problem", "during", "creation", "if", "there", "was", "a", "problem", "adding", "a", "tag", "or", "if", "the", "VM", "takes",...
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/vm.go#L158-L192
146,156
apcera/libretto
virtualmachine/aws/vm.go
wait
func wait() { const maxWait = 1 * time.Minute now := time.Now().UTC() mu.Lock() wait := getWaitTime(now, maxWait) mu.Unlock() time.Sleep(wait) interval := 500 * time.Millisecond if wait == maxWait { interval = maxWait } mu.Lock() defer mu.Unlock() if now.Before(nextProvision) { nextProvision = nextP...
go
func wait() { const maxWait = 1 * time.Minute now := time.Now().UTC() mu.Lock() wait := getWaitTime(now, maxWait) mu.Unlock() time.Sleep(wait) interval := 500 * time.Millisecond if wait == maxWait { interval = maxWait } mu.Lock() defer mu.Unlock() if now.Before(nextProvision) { nextProvision = nextP...
[ "func", "wait", "(", ")", "{", "const", "maxWait", "=", "1", "*", "time", ".", "Minute", "\n\n", "now", ":=", "time", ".", "Now", "(", ")", ".", "UTC", "(", ")", "\n", "mu", ".", "Lock", "(", ")", "\n", "wait", ":=", "getWaitTime", "(", "now", ...
// wait implements a rate limiter that prevents more than one call every // 0.5s. The maximum time that the caller can be delayed is 1m.
[ "wait", "implements", "a", "rate", "limiter", "that", "prevents", "more", "than", "one", "call", "every", "0", ".", "5s", ".", "The", "maximum", "time", "that", "the", "caller", "can", "be", "delayed", "is", "1m", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/vm.go#L196-L219
146,157
apcera/libretto
virtualmachine/aws/vm.go
Destroy
func (vm *VM) Destroy() error { svc, err := getService(vm.Region) if err != nil { return fmt.Errorf("failed to get AWS service: %v", err) } if vm.InstanceID == "" { // Probably need to call Provision first. return ErrNoInstanceID } _, err = svc.TerminateInstances(&ec2.TerminateInstancesInput{ InstanceIds...
go
func (vm *VM) Destroy() error { svc, err := getService(vm.Region) if err != nil { return fmt.Errorf("failed to get AWS service: %v", err) } if vm.InstanceID == "" { // Probably need to call Provision first. return ErrNoInstanceID } _, err = svc.TerminateInstances(&ec2.TerminateInstancesInput{ InstanceIds...
[ "func", "(", "vm", "*", "VM", ")", "Destroy", "(", ")", "error", "{", "svc", ",", "err", ":=", "getService", "(", "vm", ".", "Region", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", ...
// Destroy terminates the VM on AWS. It returns an error if AWS credentials are // missing or if there is no instance ID.
[ "Destroy", "terminates", "the", "VM", "on", "AWS", ".", "It", "returns", "an", "error", "if", "AWS", "credentials", "are", "missing", "or", "if", "there", "is", "no", "instance", "ID", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/vm.go#L281-L306
146,158
apcera/libretto
virtualmachine/aws/vm.go
GetState
func (vm *VM) GetState() (string, error) { svc, err := getService(vm.Region) if err != nil { return "", fmt.Errorf("failed to get AWS service: %v", err) } if vm.InstanceID == "" { // Probably need to call Provision first. return "", ErrNoInstanceID } stat, err := svc.DescribeInstances(&ec2.DescribeInstanc...
go
func (vm *VM) GetState() (string, error) { svc, err := getService(vm.Region) if err != nil { return "", fmt.Errorf("failed to get AWS service: %v", err) } if vm.InstanceID == "" { // Probably need to call Provision first. return "", ErrNoInstanceID } stat, err := svc.DescribeInstances(&ec2.DescribeInstanc...
[ "func", "(", "vm", "*", "VM", ")", "GetState", "(", ")", "(", "string", ",", "error", ")", "{", "svc", ",", "err", ":=", "getService", "(", "vm", ".", "Region", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", ...
// GetState returns the state of the VM, such as "running". An error is // returned if the instance ID is missing, if there was a problem querying AWS, // or if there are no instances.
[ "GetState", "returns", "the", "state", "of", "the", "VM", "such", "as", "running", ".", "An", "error", "is", "returned", "if", "the", "instance", "ID", "is", "missing", "if", "there", "was", "a", "problem", "querying", "AWS", "or", "if", "there", "are", ...
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/vm.go#L331-L359
146,159
apcera/libretto
virtualmachine/aws/vm.go
Halt
func (vm *VM) Halt() error { svc, err := getService(vm.Region) if err != nil { return fmt.Errorf("failed to get AWS service: %v", err) } if vm.InstanceID == "" { // Probably need to call Provision first. return ErrNoInstanceID } _, err = svc.StopInstances(&ec2.StopInstancesInput{ InstanceIds: []*string{...
go
func (vm *VM) Halt() error { svc, err := getService(vm.Region) if err != nil { return fmt.Errorf("failed to get AWS service: %v", err) } if vm.InstanceID == "" { // Probably need to call Provision first. return ErrNoInstanceID } _, err = svc.StopInstances(&ec2.StopInstancesInput{ InstanceIds: []*string{...
[ "func", "(", "vm", "*", "VM", ")", "Halt", "(", ")", "error", "{", "svc", ",", "err", ":=", "getService", "(", "vm", ".", "Region", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\...
// Halt shuts down the VM on AWS.
[ "Halt", "shuts", "down", "the", "VM", "on", "AWS", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/vm.go#L362-L385
146,160
apcera/libretto
virtualmachine/aws/vm.go
SetKeyPair
func (vm *VM) SetKeyPair(privateKey string, name string) { vm.SSHCreds.SSHPrivateKey = privateKey vm.KeyPair = name }
go
func (vm *VM) SetKeyPair(privateKey string, name string) { vm.SSHCreds.SSHPrivateKey = privateKey vm.KeyPair = name }
[ "func", "(", "vm", "*", "VM", ")", "SetKeyPair", "(", "privateKey", "string", ",", "name", "string", ")", "{", "vm", ".", "SSHCreds", ".", "SSHPrivateKey", "=", "privateKey", "\n", "vm", ".", "KeyPair", "=", "name", "\n", "}" ]
// SetKeyPair sets the given private key and AWS key name for this vm
[ "SetKeyPair", "sets", "the", "given", "private", "key", "and", "AWS", "key", "name", "for", "this", "vm" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/vm.go#L423-L426
146,161
apcera/libretto
virtualmachine/openstack/vm.go
Destroy
func (vm *VM) Destroy() error { if vm.InstanceID == "" { // Probably need to call Provision first. return ErrNoInstanceID } client, err := getComputeClient(vm) if err != nil { return fmt.Errorf("compute client is not set for the VM, %s", err) } // Delete the floating IP first before destroying the VM va...
go
func (vm *VM) Destroy() error { if vm.InstanceID == "" { // Probably need to call Provision first. return ErrNoInstanceID } client, err := getComputeClient(vm) if err != nil { return fmt.Errorf("compute client is not set for the VM, %s", err) } // Delete the floating IP first before destroying the VM va...
[ "func", "(", "vm", "*", "VM", ")", "Destroy", "(", ")", "error", "{", "if", "vm", ".", "InstanceID", "==", "\"", "\"", "{", "// Probably need to call Provision first.", "return", "ErrNoInstanceID", "\n", "}", "\n\n", "client", ",", "err", ":=", "getComputeCl...
// Destroy terminates the VM on Openstack. It returns an error if there is no instance ID.
[ "Destroy", "terminates", "the", "VM", "on", "Openstack", ".", "It", "returns", "an", "error", "if", "there", "is", "no", "instance", "ID", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/vm.go#L425-L480
146,162
apcera/libretto
virtualmachine/openstack/vm.go
GetState
func (vm *VM) GetState() (string, error) { server, err := getServer(vm) if err != nil { return "", err } if server == nil { // VM state "unknown" return "", lvm.ErrVMInfoFailed } if server.Status == StateActive { return lvm.VMRunning, nil } else if server.Status == StateShutOff { return lvm.VMHalted,...
go
func (vm *VM) GetState() (string, error) { server, err := getServer(vm) if err != nil { return "", err } if server == nil { // VM state "unknown" return "", lvm.ErrVMInfoFailed } if server.Status == StateActive { return lvm.VMRunning, nil } else if server.Status == StateShutOff { return lvm.VMHalted,...
[ "func", "(", "vm", "*", "VM", ")", "GetState", "(", ")", "(", "string", ",", "error", ")", "{", "server", ",", "err", ":=", "getServer", "(", "vm", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", ...
// GetState returns the state of the VM, such as "ACTIVE". An error is returned // if the instance ID is missing, if there was a problem querying Openstack, or if // there are no instances.
[ "GetState", "returns", "the", "state", "of", "the", "VM", "such", "as", "ACTIVE", ".", "An", "error", "is", "returned", "if", "the", "instance", "ID", "is", "missing", "if", "there", "was", "a", "problem", "querying", "Openstack", "or", "if", "there", "a...
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/vm.go#L497-L516
146,163
apcera/libretto
virtualmachine/openstack/vm.go
Halt
func (vm *VM) Halt() error { if vm.InstanceID == "" { // Probably need to call Provision first. return ErrNoInstanceID } client, err := getComputeClient(vm) if err != nil { return fmt.Errorf("compute client is not set for the VM, %s", err) } // Take a look at the initial state of the VM. Make sure it is i...
go
func (vm *VM) Halt() error { if vm.InstanceID == "" { // Probably need to call Provision first. return ErrNoInstanceID } client, err := getComputeClient(vm) if err != nil { return fmt.Errorf("compute client is not set for the VM, %s", err) } // Take a look at the initial state of the VM. Make sure it is i...
[ "func", "(", "vm", "*", "VM", ")", "Halt", "(", ")", "error", "{", "if", "vm", ".", "InstanceID", "==", "\"", "\"", "{", "// Probably need to call Provision first.", "return", "ErrNoInstanceID", "\n", "}", "\n\n", "client", ",", "err", ":=", "getComputeClien...
// Halt shuts down the insance on Openstack.
[ "Halt", "shuts", "down", "the", "insance", "on", "Openstack", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/vm.go#L519-L548
146,164
apcera/libretto
virtualmachine/gcp/util.go
getInstance
func (svc *googleService) getInstance() (*googlecloud.Instance, error) { return svc.service.Instances.Get(svc.vm.Project, svc.vm.Zone, svc.vm.Name).Do() }
go
func (svc *googleService) getInstance() (*googlecloud.Instance, error) { return svc.service.Instances.Get(svc.vm.Project, svc.vm.Zone, svc.vm.Name).Do() }
[ "func", "(", "svc", "*", "googleService", ")", "getInstance", "(", ")", "(", "*", "googlecloud", ".", "Instance", ",", "error", ")", "{", "return", "svc", ".", "service", ".", "Instances", ".", "Get", "(", "svc", ".", "vm", ".", "Project", ",", "svc"...
// get instance from current VM definition.
[ "get", "instance", "from", "current", "VM", "definition", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L76-L78
146,165
apcera/libretto
virtualmachine/gcp/util.go
waitForOperation
func waitForOperation(timeout int, funcOperation func() (*googlecloud.Operation, error)) error { var op *googlecloud.Operation var err error for i := 0; i < timeout; i++ { op, err = funcOperation() if err != nil { return err } if op.Status == "DONE" { if op.Error != nil { return fmt.Errorf("opera...
go
func waitForOperation(timeout int, funcOperation func() (*googlecloud.Operation, error)) error { var op *googlecloud.Operation var err error for i := 0; i < timeout; i++ { op, err = funcOperation() if err != nil { return err } if op.Status == "DONE" { if op.Error != nil { return fmt.Errorf("opera...
[ "func", "waitForOperation", "(", "timeout", "int", ",", "funcOperation", "func", "(", ")", "(", "*", "googlecloud", ".", "Operation", ",", "error", ")", ")", "error", "{", "var", "op", "*", "googlecloud", ".", "Operation", "\n", "var", "err", "error", "\...
// waitForOperation pulls to wait for the operation to finish.
[ "waitForOperation", "pulls", "to", "wait", "for", "the", "operation", "to", "finish", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L81-L101
146,166
apcera/libretto
virtualmachine/gcp/util.go
waitForOperationReady
func (svc *googleService) waitForOperationReady(operation string) error { return waitForOperation(OperationTimeout, func() (*googlecloud.Operation, error) { return svc.service.ZoneOperations.Get(svc.vm.Project, svc.vm.Zone, operation).Do() }) }
go
func (svc *googleService) waitForOperationReady(operation string) error { return waitForOperation(OperationTimeout, func() (*googlecloud.Operation, error) { return svc.service.ZoneOperations.Get(svc.vm.Project, svc.vm.Zone, operation).Do() }) }
[ "func", "(", "svc", "*", "googleService", ")", "waitForOperationReady", "(", "operation", "string", ")", "error", "{", "return", "waitForOperation", "(", "OperationTimeout", ",", "func", "(", ")", "(", "*", "googlecloud", ".", "Operation", ",", "error", ")", ...
// waitForOperationReady waits for the regional operation to finish.
[ "waitForOperationReady", "waits", "for", "the", "regional", "operation", "to", "finish", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L104-L108
146,167
apcera/libretto
virtualmachine/gcp/util.go
createDisks
func (svc *googleService) createDisks() (disks []*googlecloud.AttachedDisk, err error) { if len(svc.vm.Disks) == 0 { return nil, errors.New("no disks were found") } image, err := svc.getImage() if err != nil { return nil, err } for i, disk := range svc.vm.Disks { if i == 0 { // First one is booted devi...
go
func (svc *googleService) createDisks() (disks []*googlecloud.AttachedDisk, err error) { if len(svc.vm.Disks) == 0 { return nil, errors.New("no disks were found") } image, err := svc.getImage() if err != nil { return nil, err } for i, disk := range svc.vm.Disks { if i == 0 { // First one is booted devi...
[ "func", "(", "svc", "*", "googleService", ")", "createDisks", "(", ")", "(", "disks", "[", "]", "*", "googlecloud", ".", "AttachedDisk", ",", "err", "error", ")", "{", "if", "len", "(", "svc", ".", "vm", ".", "Disks", ")", "==", "0", "{", "return",...
// createDisks creates non-booted disk.
[ "createDisks", "creates", "non", "-", "booted", "disk", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L124-L183
146,168
apcera/libretto
virtualmachine/gcp/util.go
getDisk
func (svc *googleService) getDisk(name string) (*googlecloud.Disk, error) { return svc.service.Disks.Get(svc.vm.Project, svc.vm.Zone, name).Do() }
go
func (svc *googleService) getDisk(name string) (*googlecloud.Disk, error) { return svc.service.Disks.Get(svc.vm.Project, svc.vm.Zone, name).Do() }
[ "func", "(", "svc", "*", "googleService", ")", "getDisk", "(", "name", "string", ")", "(", "*", "googlecloud", ".", "Disk", ",", "error", ")", "{", "return", "svc", ".", "service", ".", "Disks", ".", "Get", "(", "svc", ".", "vm", ".", "Project", ",...
// getDisk retrieves the Disk object.
[ "getDisk", "retrieves", "the", "Disk", "object", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L186-L188
146,169
apcera/libretto
virtualmachine/gcp/util.go
deleteDisk
func (svc *googleService) deleteDisk(name string) error { op, err := svc.service.Disks.Delete(svc.vm.Project, svc.vm.Zone, name).Do() if err != nil { return err } return svc.waitForOperationReady(op.Name) }
go
func (svc *googleService) deleteDisk(name string) error { op, err := svc.service.Disks.Delete(svc.vm.Project, svc.vm.Zone, name).Do() if err != nil { return err } return svc.waitForOperationReady(op.Name) }
[ "func", "(", "svc", "*", "googleService", ")", "deleteDisk", "(", "name", "string", ")", "error", "{", "op", ",", "err", ":=", "svc", ".", "service", ".", "Disks", ".", "Delete", "(", "svc", ".", "vm", ".", "Project", ",", "svc", ".", "vm", ".", ...
// deleteDisk deletes the persistent disk.
[ "deleteDisk", "deletes", "the", "persistent", "disk", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L191-L198
146,170
apcera/libretto
virtualmachine/gcp/util.go
deleteDisks
func (svc *googleService) deleteDisks() (errs []error) { for _, disk := range svc.vm.Disks { err := svc.deleteDisk(disk.Name) if err != nil { errs = append(errs, err) } } return errs }
go
func (svc *googleService) deleteDisks() (errs []error) { for _, disk := range svc.vm.Disks { err := svc.deleteDisk(disk.Name) if err != nil { errs = append(errs, err) } } return errs }
[ "func", "(", "svc", "*", "googleService", ")", "deleteDisks", "(", ")", "(", "errs", "[", "]", "error", ")", "{", "for", "_", ",", "disk", ":=", "range", "svc", ".", "vm", ".", "Disks", "{", "err", ":=", "svc", ".", "deleteDisk", "(", "disk", "."...
// deleteDisks deletes all the persistent disk.
[ "deleteDisks", "deletes", "all", "the", "persistent", "disk", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L201-L209
146,171
apcera/libretto
virtualmachine/gcp/util.go
getIPs
func (svc *googleService) getIPs() ([]net.IP, error) { instance, err := svc.service.Instances.Get(svc.vm.Project, svc.vm.Zone, svc.vm.Name).Do() if err != nil { return nil, err } ips := make([]net.IP, 2) nic := instance.NetworkInterfaces[0] publicIP := nic.AccessConfigs[0].NatIP if publicIP == "" { return ...
go
func (svc *googleService) getIPs() ([]net.IP, error) { instance, err := svc.service.Instances.Get(svc.vm.Project, svc.vm.Zone, svc.vm.Name).Do() if err != nil { return nil, err } ips := make([]net.IP, 2) nic := instance.NetworkInterfaces[0] publicIP := nic.AccessConfigs[0].NatIP if publicIP == "" { return ...
[ "func", "(", "svc", "*", "googleService", ")", "getIPs", "(", ")", "(", "[", "]", "net", ".", "IP", ",", "error", ")", "{", "instance", ",", "err", ":=", "svc", ".", "service", ".", "Instances", ".", "Get", "(", "svc", ".", "vm", ".", "Project", ...
// getIPs returns the IP addresses of the GCE instance.
[ "getIPs", "returns", "the", "IP", "addresses", "of", "the", "GCE", "instance", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L212-L235
146,172
apcera/libretto
virtualmachine/gcp/util.go
start
func (svc *googleService) start() error { instance, err := svc.getInstance() if err != nil { if !strings.Contains(err.Error(), "no instance found") { return err } } if instance == nil { return errors.New("no instance found") } op, err := svc.service.Instances.Start(svc.vm.Project, svc.vm.Zone, svc.vm.N...
go
func (svc *googleService) start() error { instance, err := svc.getInstance() if err != nil { if !strings.Contains(err.Error(), "no instance found") { return err } } if instance == nil { return errors.New("no instance found") } op, err := svc.service.Instances.Start(svc.vm.Project, svc.vm.Zone, svc.vm.N...
[ "func", "(", "svc", "*", "googleService", ")", "start", "(", ")", "error", "{", "instance", ",", "err", ":=", "svc", ".", "getInstance", "(", ")", "\n", "if", "err", "!=", "nil", "{", "if", "!", "strings", ".", "Contains", "(", "err", ".", "Error",...
// start starts a stopped GCE instance.
[ "start", "starts", "a", "stopped", "GCE", "instance", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L335-L353
146,173
apcera/libretto
virtualmachine/gcp/util.go
stop
func (svc *googleService) stop() error { _, err := svc.getInstance() if err != nil { if !strings.Contains(err.Error(), "no instance found") { return err } return fmt.Errorf("no instance found, %v", err) } op, err := svc.service.Instances.Stop(svc.vm.Project, svc.vm.Zone, svc.vm.Name).Do() if err != nil {...
go
func (svc *googleService) stop() error { _, err := svc.getInstance() if err != nil { if !strings.Contains(err.Error(), "no instance found") { return err } return fmt.Errorf("no instance found, %v", err) } op, err := svc.service.Instances.Stop(svc.vm.Project, svc.vm.Zone, svc.vm.Name).Do() if err != nil {...
[ "func", "(", "svc", "*", "googleService", ")", "stop", "(", ")", "error", "{", "_", ",", "err", ":=", "svc", ".", "getInstance", "(", ")", "\n", "if", "err", "!=", "nil", "{", "if", "!", "strings", ".", "Contains", "(", "err", ".", "Error", "(", ...
// stop halts a GCE instance.
[ "stop", "halts", "a", "GCE", "instance", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L356-L371
146,174
apcera/libretto
virtualmachine/gcp/util.go
delete
func (svc *googleService) delete() error { op, err := svc.service.Instances.Delete(svc.vm.Project, svc.vm.Zone, svc.vm.Name).Do() if err != nil { return err } return svc.waitForOperationReady(op.Name) }
go
func (svc *googleService) delete() error { op, err := svc.service.Instances.Delete(svc.vm.Project, svc.vm.Zone, svc.vm.Name).Do() if err != nil { return err } return svc.waitForOperationReady(op.Name) }
[ "func", "(", "svc", "*", "googleService", ")", "delete", "(", ")", "error", "{", "op", ",", "err", ":=", "svc", ".", "service", ".", "Instances", ".", "Delete", "(", "svc", ".", "vm", ".", "Project", ",", "svc", ".", "vm", ".", "Zone", ",", "svc"...
// deletes the GCE instance.
[ "deletes", "the", "GCE", "instance", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/util.go#L374-L381
146,175
apcera/libretto
virtualmachine/vmrun/vm.go
Run
func (f vmrunRunner) Run(args ...string) (string, string, error) { var vmrunPath string // If vmrun is not found in the system path, fall back to the // hard coded path (VMRunPath). path, err := exec.LookPath("vmrun") if err == nil { vmrunPath = path } else { vmrunPath = VMRunPath } if vmrunPath == "" { ...
go
func (f vmrunRunner) Run(args ...string) (string, string, error) { var vmrunPath string // If vmrun is not found in the system path, fall back to the // hard coded path (VMRunPath). path, err := exec.LookPath("vmrun") if err == nil { vmrunPath = path } else { vmrunPath = VMRunPath } if vmrunPath == "" { ...
[ "func", "(", "f", "vmrunRunner", ")", "Run", "(", "args", "...", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "var", "vmrunPath", "string", "\n\n", "// If vmrun is not found in the system path, fall back to the", "// hard coded path (VMRunPath)...
// Run runs a vmrun command.
[ "Run", "runs", "a", "vmrun", "command", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vmrun/vm.go#L80-L117
146,176
apcera/libretto
virtualmachine/exoscale/vm.go
GetName
func (vm *VM) GetName() string { if err := vm.updateInfo(); err != nil { return "" } return vm.Name }
go
func (vm *VM) GetName() string { if err := vm.updateInfo(); err != nil { return "" } return vm.Name }
[ "func", "(", "vm", "*", "VM", ")", "GetName", "(", ")", "string", "{", "if", "err", ":=", "vm", ".", "updateInfo", "(", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "return", "vm", ".", "Name", "\n", "}" ]
// GetName returns the name of the virtual machine // If an error occurs, an empty string is returned
[ "GetName", "returns", "the", "name", "of", "the", "virtual", "machine", "If", "an", "error", "occurs", "an", "empty", "string", "is", "returned" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/vm.go#L95-L102
146,177
apcera/libretto
virtualmachine/exoscale/vm.go
GetIPs
func (vm *VM) GetIPs() ([]net.IP, error) { if err := vm.updateInfo(); err != nil { return nil, err } return vm.ips, nil }
go
func (vm *VM) GetIPs() ([]net.IP, error) { if err := vm.updateInfo(); err != nil { return nil, err } return vm.ips, nil }
[ "func", "(", "vm", "*", "VM", ")", "GetIPs", "(", ")", "(", "[", "]", "net", ".", "IP", ",", "error", ")", "{", "if", "err", ":=", "vm", ".", "updateInfo", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\...
// GetIPs returns the list of ip addresses associated with the VM
[ "GetIPs", "returns", "the", "list", "of", "ip", "addresses", "associated", "with", "the", "VM" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/vm.go#L160-L167
146,178
apcera/libretto
virtualmachine/exoscale/vm.go
Destroy
func (vm *VM) Destroy() error { if vm.ID == "" { return fmt.Errorf("Need an ID to destroy the virtual machine") } params := url.Values{} params.Set("id", vm.ID) client := vm.getExoClient() resp, err := client.Request("destroyVirtualMachine", params) if err != nil { return fmt.Errorf("Destroying virtual ma...
go
func (vm *VM) Destroy() error { if vm.ID == "" { return fmt.Errorf("Need an ID to destroy the virtual machine") } params := url.Values{} params.Set("id", vm.ID) client := vm.getExoClient() resp, err := client.Request("destroyVirtualMachine", params) if err != nil { return fmt.Errorf("Destroying virtual ma...
[ "func", "(", "vm", "*", "VM", ")", "Destroy", "(", ")", "error", "{", "if", "vm", ".", "ID", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "params", ":=", "url", ".", "Values", "{", "}", "\n",...
// Destroy removes virtual machine and all storage associated
[ "Destroy", "removes", "virtual", "machine", "and", "all", "storage", "associated" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/vm.go#L170-L193
146,179
apcera/libretto
virtualmachine/exoscale/vm.go
GetState
func (vm *VM) GetState() (string, error) { if vm.ID == "" { return "", fmt.Errorf("Need an ID to get virtual machine state") } if err := vm.updateInfo(); err != nil { return "", err } return vm.state, nil }
go
func (vm *VM) GetState() (string, error) { if vm.ID == "" { return "", fmt.Errorf("Need an ID to get virtual machine state") } if err := vm.updateInfo(); err != nil { return "", err } return vm.state, nil }
[ "func", "(", "vm", "*", "VM", ")", "GetState", "(", ")", "(", "string", ",", "error", ")", "{", "if", "vm", ".", "ID", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "e...
// GetState returns virtual machine state
[ "GetState", "returns", "virtual", "machine", "state" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/vm.go#L196-L207
146,180
apcera/libretto
virtualmachine/exoscale/vm.go
Halt
func (vm *VM) Halt() error { if vm.ID == "" { return fmt.Errorf("Need an ID to stop the virtual machine") } params := url.Values{} params.Set("id", vm.ID) client := vm.getExoClient() resp, err := client.Request("stopVirtualMachine", params) if err != nil { return fmt.Errorf("Stopping virtual machine %q: %...
go
func (vm *VM) Halt() error { if vm.ID == "" { return fmt.Errorf("Need an ID to stop the virtual machine") } params := url.Values{} params.Set("id", vm.ID) client := vm.getExoClient() resp, err := client.Request("stopVirtualMachine", params) if err != nil { return fmt.Errorf("Stopping virtual machine %q: %...
[ "func", "(", "vm", "*", "VM", ")", "Halt", "(", ")", "error", "{", "if", "vm", ".", "ID", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "params", ":=", "url", ".", "Values", "{", "}", "\n", ...
// Halt stop a virtual machine
[ "Halt", "stop", "a", "virtual", "machine" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/vm.go#L220-L244
146,181
apcera/libretto
virtualmachine/exoscale/vm.go
Start
func (vm *VM) Start() error { if vm.ID == "" { return fmt.Errorf("Need an ID to start the virtual machine") } params := url.Values{} params.Set("id", vm.ID) client := vm.getExoClient() resp, err := client.Request("startVirtualMachine", params) if err != nil { return fmt.Errorf("Starting virtual machine %q...
go
func (vm *VM) Start() error { if vm.ID == "" { return fmt.Errorf("Need an ID to start the virtual machine") } params := url.Values{} params.Set("id", vm.ID) client := vm.getExoClient() resp, err := client.Request("startVirtualMachine", params) if err != nil { return fmt.Errorf("Starting virtual machine %q...
[ "func", "(", "vm", "*", "VM", ")", "Start", "(", ")", "error", "{", "if", "vm", ".", "ID", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "params", ":=", "url", ".", "Values", "{", "}", "\n", ...
// Start starts virtual machine
[ "Start", "starts", "virtual", "machine" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/vm.go#L247-L270
146,182
apcera/libretto
virtualmachine/exoscale/vm.go
GetSSH
func (vm *VM) GetSSH(options ssh.Options) (ssh.Client, error) { ips, err := util.GetVMIPs(vm, options) if err != nil { return nil, err } client := &ssh.SSHClient{ Creds: &vm.SSHCreds, IP: ips[0], // public IP Options: options, Port: 22, } if err := client.WaitForSSH(SSHTimeout); err != nil {...
go
func (vm *VM) GetSSH(options ssh.Options) (ssh.Client, error) { ips, err := util.GetVMIPs(vm, options) if err != nil { return nil, err } client := &ssh.SSHClient{ Creds: &vm.SSHCreds, IP: ips[0], // public IP Options: options, Port: 22, } if err := client.WaitForSSH(SSHTimeout); err != nil {...
[ "func", "(", "vm", "*", "VM", ")", "GetSSH", "(", "options", "ssh", ".", "Options", ")", "(", "ssh", ".", "Client", ",", "error", ")", "{", "ips", ",", "err", ":=", "util", ".", "GetVMIPs", "(", "vm", ",", "options", ")", "\n", "if", "err", "!=...
// GetSSH returns SSH keys to access the virtual machine
[ "GetSSH", "returns", "SSH", "keys", "to", "access", "the", "virtual", "machine" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/vm.go#L273-L292
146,183
apcera/libretto
ssh/mock_ssh.go
Connect
func (c *MockSSHClient) Connect() error { if c.MockConnect != nil { return c.MockConnect() } return ErrNotImplemented }
go
func (c *MockSSHClient) Connect() error { if c.MockConnect != nil { return c.MockConnect() } return ErrNotImplemented }
[ "func", "(", "c", "*", "MockSSHClient", ")", "Connect", "(", ")", "error", "{", "if", "c", ".", "MockConnect", "!=", "nil", "{", "return", "c", ".", "MockConnect", "(", ")", "\n", "}", "\n", "return", "ErrNotImplemented", "\n", "}" ]
// Connect calls the mocked connect.
[ "Connect", "calls", "the", "mocked", "connect", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/mock_ssh.go#L27-L32
146,184
apcera/libretto
ssh/mock_ssh.go
Download
func (c *MockSSHClient) Download(src io.WriteCloser, dst string) error { if c.MockDownload != nil { return c.MockDownload(src, dst) } return ErrNotImplemented }
go
func (c *MockSSHClient) Download(src io.WriteCloser, dst string) error { if c.MockDownload != nil { return c.MockDownload(src, dst) } return ErrNotImplemented }
[ "func", "(", "c", "*", "MockSSHClient", ")", "Download", "(", "src", "io", ".", "WriteCloser", ",", "dst", "string", ")", "error", "{", "if", "c", ".", "MockDownload", "!=", "nil", "{", "return", "c", ".", "MockDownload", "(", "src", ",", "dst", ")",...
// Download calls the mocked download.
[ "Download", "calls", "the", "mocked", "download", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/mock_ssh.go#L42-L47
146,185
apcera/libretto
ssh/mock_ssh.go
Run
func (c *MockSSHClient) Run(command string, stdout io.Writer, stderr io.Writer) error { if c.MockRun != nil { return c.MockRun(command, stdout, stderr) } return ErrNotImplemented }
go
func (c *MockSSHClient) Run(command string, stdout io.Writer, stderr io.Writer) error { if c.MockRun != nil { return c.MockRun(command, stdout, stderr) } return ErrNotImplemented }
[ "func", "(", "c", "*", "MockSSHClient", ")", "Run", "(", "command", "string", ",", "stdout", "io", ".", "Writer", ",", "stderr", "io", ".", "Writer", ")", "error", "{", "if", "c", ".", "MockRun", "!=", "nil", "{", "return", "c", ".", "MockRun", "("...
// Run calls the mocked run
[ "Run", "calls", "the", "mocked", "run" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/mock_ssh.go#L50-L55
146,186
apcera/libretto
ssh/mock_ssh.go
Upload
func (c *MockSSHClient) Upload(src io.Reader, dst string, size int, mode uint32) error { if c.MockUpload != nil { return c.MockUpload(src, dst, size, mode) } return ErrNotImplemented }
go
func (c *MockSSHClient) Upload(src io.Reader, dst string, size int, mode uint32) error { if c.MockUpload != nil { return c.MockUpload(src, dst, size, mode) } return ErrNotImplemented }
[ "func", "(", "c", "*", "MockSSHClient", ")", "Upload", "(", "src", "io", ".", "Reader", ",", "dst", "string", ",", "size", "int", ",", "mode", "uint32", ")", "error", "{", "if", "c", ".", "MockUpload", "!=", "nil", "{", "return", "c", ".", "MockUpl...
// Upload calls the mocked upload
[ "Upload", "calls", "the", "mocked", "upload" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/mock_ssh.go#L58-L63
146,187
apcera/libretto
ssh/mock_ssh.go
Validate
func (c *MockSSHClient) Validate() error { if c.MockValidate != nil { return c.MockValidate() } return ErrNotImplemented }
go
func (c *MockSSHClient) Validate() error { if c.MockValidate != nil { return c.MockValidate() } return ErrNotImplemented }
[ "func", "(", "c", "*", "MockSSHClient", ")", "Validate", "(", ")", "error", "{", "if", "c", ".", "MockValidate", "!=", "nil", "{", "return", "c", ".", "MockValidate", "(", ")", "\n", "}", "\n", "return", "ErrNotImplemented", "\n", "}" ]
// Validate calls the mocked validate.
[ "Validate", "calls", "the", "mocked", "validate", "." ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/mock_ssh.go#L66-L71
146,188
apcera/libretto
ssh/mock_ssh.go
WaitForSSH
func (c *MockSSHClient) WaitForSSH(maxWait time.Duration) error { if c.MockWaitForSSH != nil { return c.MockWaitForSSH(maxWait) } return ErrNotImplemented }
go
func (c *MockSSHClient) WaitForSSH(maxWait time.Duration) error { if c.MockWaitForSSH != nil { return c.MockWaitForSSH(maxWait) } return ErrNotImplemented }
[ "func", "(", "c", "*", "MockSSHClient", ")", "WaitForSSH", "(", "maxWait", "time", ".", "Duration", ")", "error", "{", "if", "c", ".", "MockWaitForSSH", "!=", "nil", "{", "return", "c", ".", "MockWaitForSSH", "(", "maxWait", ")", "\n", "}", "\n", "retu...
// WaitForSSH calls the mocked WaitForSSH
[ "WaitForSSH", "calls", "the", "mocked", "WaitForSSH" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/mock_ssh.go#L74-L79
146,189
apcera/libretto
ssh/mock_ssh.go
SetSSHPrivateKey
func (c *MockSSHClient) SetSSHPrivateKey(s string) { if c.MockSetSSHPrivateKey != nil { c.MockSetSSHPrivateKey(s) } }
go
func (c *MockSSHClient) SetSSHPrivateKey(s string) { if c.MockSetSSHPrivateKey != nil { c.MockSetSSHPrivateKey(s) } }
[ "func", "(", "c", "*", "MockSSHClient", ")", "SetSSHPrivateKey", "(", "s", "string", ")", "{", "if", "c", ".", "MockSetSSHPrivateKey", "!=", "nil", "{", "c", ".", "MockSetSSHPrivateKey", "(", "s", ")", "\n", "}", "\n", "}" ]
// SetSSHPrivateKey calls the mocked SetSSHPrivateKey
[ "SetSSHPrivateKey", "calls", "the", "mocked", "SetSSHPrivateKey" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/mock_ssh.go#L82-L86
146,190
apcera/libretto
ssh/mock_ssh.go
SetSSHPassword
func (c *MockSSHClient) SetSSHPassword(s string) { if c.MockSetSSHPassword != nil { c.MockSetSSHPassword(s) } }
go
func (c *MockSSHClient) SetSSHPassword(s string) { if c.MockSetSSHPassword != nil { c.MockSetSSHPassword(s) } }
[ "func", "(", "c", "*", "MockSSHClient", ")", "SetSSHPassword", "(", "s", "string", ")", "{", "if", "c", ".", "MockSetSSHPassword", "!=", "nil", "{", "c", ".", "MockSetSSHPassword", "(", "s", ")", "\n", "}", "\n", "}" ]
// SetSSHPassword calls the mocked SetSSHPassword
[ "SetSSHPassword", "calls", "the", "mocked", "SetSSHPassword" ]
3178799fbb1e39c74b02e3ecf46330b3ef0ed486
https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/ssh/mock_ssh.go#L97-L101
146,191
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/definition.go
InitializeFields
func (s *Definitions) InitializeFields(d *Definition) { for fieldName, property := range d.schema.Properties { des := strings.Replace(property.Description, "\n", " ", -1) f := &Field{ Name: fieldName, Type: GetTypeName(property), Description: EscapeAsterisks(des), } if len(property.Exten...
go
func (s *Definitions) InitializeFields(d *Definition) { for fieldName, property := range d.schema.Properties { des := strings.Replace(property.Description, "\n", " ", -1) f := &Field{ Name: fieldName, Type: GetTypeName(property), Description: EscapeAsterisks(des), } if len(property.Exten...
[ "func", "(", "s", "*", "Definitions", ")", "InitializeFields", "(", "d", "*", "Definition", ")", "{", "for", "fieldName", ",", "property", ":=", "range", "d", ".", "schema", ".", "Properties", "{", "des", ":=", "strings", ".", "Replace", "(", "property",...
// Initializes the fields for a definition
[ "Initializes", "the", "fields", "for", "a", "definition" ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/definition.go#L163-L185
146,192
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/util.go
GetDefinitionVersionKind
func GetDefinitionVersionKind(s spec.Schema) (string, string, string) { // Get the reference for complex types if IsDefinition(s) { s := fmt.Sprintf("%s", s.SchemaProps.Ref.GetPointer()) s = strings.Replace(s, "/definitions/", "", -1) name := strings.Split(s, ".") var group, version, kind string if name[le...
go
func GetDefinitionVersionKind(s spec.Schema) (string, string, string) { // Get the reference for complex types if IsDefinition(s) { s := fmt.Sprintf("%s", s.SchemaProps.Ref.GetPointer()) s = strings.Replace(s, "/definitions/", "", -1) name := strings.Split(s, ".") var group, version, kind string if name[le...
[ "func", "GetDefinitionVersionKind", "(", "s", "spec", ".", "Schema", ")", "(", "string", ",", "string", ",", "string", ")", "{", "// Get the reference for complex types", "if", "IsDefinition", "(", "s", ")", "{", "s", ":=", "fmt", ".", "Sprintf", "(", "\"", ...
// GetDefinitionVersionKind returns the api version and kind for the spec. This is the primary key of a Definition.
[ "GetDefinitionVersionKind", "returns", "the", "api", "version", "and", "kind", "for", "the", "spec", ".", "This", "is", "the", "primary", "key", "of", "a", "Definition", "." ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/util.go#L39-L76
146,193
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/util.go
GetTypeName
func GetTypeName(s spec.Schema) string { // Get the reference for complex types if IsDefinition(s) { _, _, name := GetDefinitionVersionKind(s) return name } // Recurse if type is array if IsArray(s) { return fmt.Sprintf("%s array", GetTypeName(*s.Items.Schema)) } // Get the value for primitive types if le...
go
func GetTypeName(s spec.Schema) string { // Get the reference for complex types if IsDefinition(s) { _, _, name := GetDefinitionVersionKind(s) return name } // Recurse if type is array if IsArray(s) { return fmt.Sprintf("%s array", GetTypeName(*s.Items.Schema)) } // Get the value for primitive types if le...
[ "func", "GetTypeName", "(", "s", "spec", ".", "Schema", ")", "string", "{", "// Get the reference for complex types", "if", "IsDefinition", "(", "s", ")", "{", "_", ",", "_", ",", "name", ":=", "GetDefinitionVersionKind", "(", "s", ")", "\n", "return", "name...
// GetTypeName returns the display name of a Schema. This is the api kind for definitions and the type for // primitive types. Arrays of objects have "array" appended.
[ "GetTypeName", "returns", "the", "display", "name", "of", "a", "Schema", ".", "This", "is", "the", "api", "kind", "for", "definitions", "and", "the", "type", "for", "primitive", "types", ".", "Arrays", "of", "objects", "have", "array", "appended", "." ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/util.go#L80-L95
146,194
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/util.go
IsArray
func IsArray(s spec.Schema) bool { return len(s.Type) > 0 && s.Type[0] == "array" }
go
func IsArray(s spec.Schema) bool { return len(s.Type) > 0 && s.Type[0] == "array" }
[ "func", "IsArray", "(", "s", "spec", ".", "Schema", ")", "bool", "{", "return", "len", "(", "s", ".", "Type", ")", ">", "0", "&&", "s", ".", "Type", "[", "0", "]", "==", "\"", "\"", "\n", "}" ]
// IsArray returns true if the type is an array type.
[ "IsArray", "returns", "true", "if", "the", "type", "is", "an", "array", "type", "." ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/util.go#L98-L100
146,195
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/util.go
IsDefinition
func IsDefinition(s spec.Schema) bool { return len(s.SchemaProps.Ref.GetPointer().String()) > 0 }
go
func IsDefinition(s spec.Schema) bool { return len(s.SchemaProps.Ref.GetPointer().String()) > 0 }
[ "func", "IsDefinition", "(", "s", "spec", ".", "Schema", ")", "bool", "{", "return", "len", "(", "s", ".", "SchemaProps", ".", "Ref", ".", "GetPointer", "(", ")", ".", "String", "(", ")", ")", ">", "0", "\n", "}" ]
// IsDefinition returns true if Schema is a complex type that should have a Definition.
[ "IsDefinition", "returns", "true", "if", "Schema", "is", "a", "complex", "type", "that", "should", "have", "a", "Definition", "." ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/util.go#L103-L105
146,196
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/config.go
initOperations
func (c *Config) initOperations(specs []*loads.Document) { ops := Operations{} c.GroupMap = map[string]string{} VisitOperations(specs, func(op Operation) { ops[op.ID] = &op // Build a map of the group names to the group name appearing in operation ids // This is necessary because the group will appear withou...
go
func (c *Config) initOperations(specs []*loads.Document) { ops := Operations{} c.GroupMap = map[string]string{} VisitOperations(specs, func(op Operation) { ops[op.ID] = &op // Build a map of the group names to the group name appearing in operation ids // This is necessary because the group will appear withou...
[ "func", "(", "c", "*", "Config", ")", "initOperations", "(", "specs", "[", "]", "*", "loads", ".", "Document", ")", "{", "ops", ":=", "Operations", "{", "}", "\n\n", "c", ".", "GroupMap", "=", "map", "[", "string", "]", "string", "{", "}", "\n", ...
// initOperations returns all Operations found in the Documents
[ "initOperations", "returns", "all", "Operations", "found", "in", "the", "Documents" ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/config.go#L195-L244
146,197
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/config.go
CleanUp
func (c *Config) CleanUp() { for _, d := range c.Definitions.All { sort.Sort(d.AppearsIn) sort.Sort(d.Fields) dedup := SortDefinitionsByName{} var last *Definition for _, i := range d.AppearsIn { if last != nil && i.Name == last.Name && i.Group.String() == last.Group.String() && i.Version.Stri...
go
func (c *Config) CleanUp() { for _, d := range c.Definitions.All { sort.Sort(d.AppearsIn) sort.Sort(d.Fields) dedup := SortDefinitionsByName{} var last *Definition for _, i := range d.AppearsIn { if last != nil && i.Name == last.Name && i.Group.String() == last.Group.String() && i.Version.Stri...
[ "func", "(", "c", "*", "Config", ")", "CleanUp", "(", ")", "{", "for", "_", ",", "d", ":=", "range", "c", ".", "Definitions", ".", "All", "{", "sort", ".", "Sort", "(", "d", ".", "AppearsIn", ")", "\n", "sort", ".", "Sort", "(", "d", ".", "Fi...
// CleanUp sorts and dedups fields
[ "CleanUp", "sorts", "and", "dedups", "fields" ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/config.go#L247-L265
146,198
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/config.go
LoadConfigFromYAML
func LoadConfigFromYAML() *Config { f := filepath.Join(*ConfigDir, "config.yaml") config := &Config{} contents, err := ioutil.ReadFile(f) if err != nil { if !*UseTags { fmt.Printf("Failed to read yaml file %s: %v", f, err) os.Exit(2) } } else { err = yaml.Unmarshal(contents, config) if err != nil { ...
go
func LoadConfigFromYAML() *Config { f := filepath.Join(*ConfigDir, "config.yaml") config := &Config{} contents, err := ioutil.ReadFile(f) if err != nil { if !*UseTags { fmt.Printf("Failed to read yaml file %s: %v", f, err) os.Exit(2) } } else { err = yaml.Unmarshal(contents, config) if err != nil { ...
[ "func", "LoadConfigFromYAML", "(", ")", "*", "Config", "{", "f", ":=", "filepath", ".", "Join", "(", "*", "ConfigDir", ",", "\"", "\"", ")", "\n\n", "config", ":=", "&", "Config", "{", "}", "\n", "contents", ",", "err", ":=", "ioutil", ".", "ReadFile...
// LoadConfigFromYAML reads the config yaml file into a struct
[ "LoadConfigFromYAML", "reads", "the", "config", "yaml", "file", "into", "a", "struct" ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/config.go#L268-L367
146,199
kubernetes-incubator/reference-docs
gen-apidocs/generators/api/config.go
mapOperationsToDefinitions
func (c *Config) mapOperationsToDefinitions() { for _, d := range c.Definitions.All { if d.IsInlined { continue } for i := range c.OperationCategories { oc := c.OperationCategories[i] for j := range oc.OperationTypes { ot := oc.OperationTypes[j] operationId := c.getOperationId(ot.Match, d.GetOp...
go
func (c *Config) mapOperationsToDefinitions() { for _, d := range c.Definitions.All { if d.IsInlined { continue } for i := range c.OperationCategories { oc := c.OperationCategories[i] for j := range oc.OperationTypes { ot := oc.OperationTypes[j] operationId := c.getOperationId(ot.Match, d.GetOp...
[ "func", "(", "c", "*", "Config", ")", "mapOperationsToDefinitions", "(", ")", "{", "for", "_", ",", "d", ":=", "range", "c", ".", "Definitions", ".", "All", "{", "if", "d", ".", "IsInlined", "{", "continue", "\n", "}", "\n\n", "for", "i", ":=", "ra...
// mapOperationsToDefinitions adds operations to the definitions they operate
[ "mapOperationsToDefinitions", "adds", "operations", "to", "the", "definitions", "they", "operate" ]
9642bd3f4de59e831d66fecfeb3b465681ba5711
https://github.com/kubernetes-incubator/reference-docs/blob/9642bd3f4de59e831d66fecfeb3b465681ba5711/gen-apidocs/generators/api/config.go#L471-L491