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 list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
24,000 | huin/goupnp | dcps/internetgateway2/internetgateway2.go | NewWANPPPConnection1ClientsByURL | func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPPPConnection_1)
if err != nil {
return nil, err
}
return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil
} | go | func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPPPConnection_1)
if err != nil {
return nil, err
}
return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewWANPPPConnection1ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"WANPPPConnection1",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_WANPPPConne... | // NewWANPPPConnection1ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewWANPPPConnection1ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"pro... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/internetgateway2/internetgateway2.go#L4432-L4438 |
24,001 | huin/goupnp | cmd/goupnpdcpgen/dcp.go | extractURNParts | func extractURNParts(urn, expectedPrefix string) (*URNParts, error) {
if !strings.HasPrefix(urn, expectedPrefix) {
return nil, fmt.Errorf("%q does not have expected prefix %q", urn, expectedPrefix)
}
parts := strings.SplitN(strings.TrimPrefix(urn, expectedPrefix), ":", 2)
if len(parts) != 2 {
return nil, fmt.Er... | go | func extractURNParts(urn, expectedPrefix string) (*URNParts, error) {
if !strings.HasPrefix(urn, expectedPrefix) {
return nil, fmt.Errorf("%q does not have expected prefix %q", urn, expectedPrefix)
}
parts := strings.SplitN(strings.TrimPrefix(urn, expectedPrefix), ":", 2)
if len(parts) != 2 {
return nil, fmt.Er... | [
"func",
"extractURNParts",
"(",
"urn",
",",
"expectedPrefix",
"string",
")",
"(",
"*",
"URNParts",
",",
"error",
")",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"urn",
",",
"expectedPrefix",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
... | // extractURNParts extracts the name and version from a URN string. | [
"extractURNParts",
"extracts",
"the",
"name",
"and",
"version",
"from",
"a",
"URN",
"string",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/cmd/goupnpdcpgen/dcp.go#L212-L222 |
24,002 | huin/goupnp | httpu/serve.go | Serve | func (srv *Server) Serve(l net.PacketConn) error {
maxMessageBytes := DefaultMaxMessageBytes
if srv.MaxMessageBytes != 0 {
maxMessageBytes = srv.MaxMessageBytes
}
for {
buf := make([]byte, maxMessageBytes)
n, peerAddr, err := l.ReadFrom(buf)
if err != nil {
return err
}
buf = buf[:n]
go func(buf [... | go | func (srv *Server) Serve(l net.PacketConn) error {
maxMessageBytes := DefaultMaxMessageBytes
if srv.MaxMessageBytes != 0 {
maxMessageBytes = srv.MaxMessageBytes
}
for {
buf := make([]byte, maxMessageBytes)
n, peerAddr, err := l.ReadFrom(buf)
if err != nil {
return err
}
buf = buf[:n]
go func(buf [... | [
"func",
"(",
"srv",
"*",
"Server",
")",
"Serve",
"(",
"l",
"net",
".",
"PacketConn",
")",
"error",
"{",
"maxMessageBytes",
":=",
"DefaultMaxMessageBytes",
"\n",
"if",
"srv",
".",
"MaxMessageBytes",
"!=",
"0",
"{",
"maxMessageBytes",
"=",
"srv",
".",
"MaxMe... | // Serve messages received on the given packet listener to the srv.Handler. | [
"Serve",
"messages",
"received",
"on",
"the",
"given",
"packet",
"listener",
"to",
"the",
"srv",
".",
"Handler",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/httpu/serve.go#L71-L99 |
24,003 | huin/goupnp | httpu/serve.go | Serve | func Serve(l net.PacketConn, handler Handler) error {
srv := Server{
Handler: handler,
MaxMessageBytes: DefaultMaxMessageBytes,
}
return srv.Serve(l)
} | go | func Serve(l net.PacketConn, handler Handler) error {
srv := Server{
Handler: handler,
MaxMessageBytes: DefaultMaxMessageBytes,
}
return srv.Serve(l)
} | [
"func",
"Serve",
"(",
"l",
"net",
".",
"PacketConn",
",",
"handler",
"Handler",
")",
"error",
"{",
"srv",
":=",
"Server",
"{",
"Handler",
":",
"handler",
",",
"MaxMessageBytes",
":",
"DefaultMaxMessageBytes",
",",
"}",
"\n",
"return",
"srv",
".",
"Serve",
... | // Serve messages received on the given packet listener to the given handler. | [
"Serve",
"messages",
"received",
"on",
"the",
"given",
"packet",
"listener",
"to",
"the",
"given",
"handler",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/httpu/serve.go#L102-L108 |
24,004 | huin/goupnp | dcps/av1/av1.go | NewAVTransport1Clients | func NewAVTransport1Clients() (clients []*AVTransport1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_1); err != nil {
return
}
clients = newAVTransport1ClientsFromGenericClients(genericClients)
return
} | go | func NewAVTransport1Clients() (clients []*AVTransport1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_1); err != nil {
return
}
clients = newAVTransport1ClientsFromGenericClients(genericClients)
return
} | [
"func",
"NewAVTransport1Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"AVTransport1",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericClients",
","... | // NewAVTransport1Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry calling p... | [
"NewAVTransport1Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied",
"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L54-L61 |
24,005 | huin/goupnp | dcps/av1/av1.go | NewAVTransport1ClientsByURL | func NewAVTransport1ClientsByURL(loc *url.URL) ([]*AVTransport1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_1)
if err != nil {
return nil, err
}
return newAVTransport1ClientsFromGenericClients(genericClients), nil
} | go | func NewAVTransport1ClientsByURL(loc *url.URL) ([]*AVTransport1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_1)
if err != nil {
return nil, err
}
return newAVTransport1ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewAVTransport1ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"AVTransport1",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_AVTransport_1",
")"... | // NewAVTransport1ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewAVTransport1ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"probing"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L69-L75 |
24,006 | huin/goupnp | dcps/av1/av1.go | NewAVTransport2Clients | func NewAVTransport2Clients() (clients []*AVTransport2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_2); err != nil {
return
}
clients = newAVTransport2ClientsFromGenericClients(genericClients)
return
} | go | func NewAVTransport2Clients() (clients []*AVTransport2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_2); err != nil {
return
}
clients = newAVTransport2ClientsFromGenericClients(genericClients)
return
} | [
"func",
"NewAVTransport2Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"AVTransport2",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericClients",
","... | // NewAVTransport2Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry calling p... | [
"NewAVTransport2Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied",
"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L737-L744 |
24,007 | huin/goupnp | dcps/av1/av1.go | NewAVTransport2ClientsByURL | func NewAVTransport2ClientsByURL(loc *url.URL) ([]*AVTransport2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_2)
if err != nil {
return nil, err
}
return newAVTransport2ClientsFromGenericClients(genericClients), nil
} | go | func NewAVTransport2ClientsByURL(loc *url.URL) ([]*AVTransport2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_2)
if err != nil {
return nil, err
}
return newAVTransport2ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewAVTransport2ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"AVTransport2",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_AVTransport_2",
")"... | // NewAVTransport2ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewAVTransport2ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"probing"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L752-L758 |
24,008 | huin/goupnp | dcps/av1/av1.go | NewConnectionManager1Clients | func NewConnectionManager1Clients() (clients []*ConnectionManager1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_1); err != nil {
return
}
clients = newConnectionManager1ClientsFromGenericClients(genericClien... | go | func NewConnectionManager1Clients() (clients []*ConnectionManager1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_1); err != nil {
return
}
clients = newConnectionManager1ClientsFromGenericClients(genericClien... | [
"func",
"NewConnectionManager1Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"ConnectionManager1",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericCli... | // NewConnectionManager1Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry cal... | [
"NewConnectionManager1Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L1610-L1617 |
24,009 | huin/goupnp | dcps/av1/av1.go | NewConnectionManager1ClientsByURL | func NewConnectionManager1ClientsByURL(loc *url.URL) ([]*ConnectionManager1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_1)
if err != nil {
return nil, err
}
return newConnectionManager1ClientsFromGenericClients(genericClients), nil
} | go | func NewConnectionManager1ClientsByURL(loc *url.URL) ([]*ConnectionManager1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_1)
if err != nil {
return nil, err
}
return newConnectionManager1ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewConnectionManager1ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"ConnectionManager1",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_Connectio... | // NewConnectionManager1ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewConnectionManager1ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"pr... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L1625-L1631 |
24,010 | huin/goupnp | dcps/av1/av1.go | NewConnectionManager2Clients | func NewConnectionManager2Clients() (clients []*ConnectionManager2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_2); err != nil {
return
}
clients = newConnectionManager2ClientsFromGenericClients(genericClien... | go | func NewConnectionManager2Clients() (clients []*ConnectionManager2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_2); err != nil {
return
}
clients = newConnectionManager2ClientsFromGenericClients(genericClien... | [
"func",
"NewConnectionManager2Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"ConnectionManager2",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericCli... | // NewConnectionManager2Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry cal... | [
"NewConnectionManager2Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L1869-L1876 |
24,011 | huin/goupnp | dcps/av1/av1.go | NewConnectionManager2ClientsByURL | func NewConnectionManager2ClientsByURL(loc *url.URL) ([]*ConnectionManager2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_2)
if err != nil {
return nil, err
}
return newConnectionManager2ClientsFromGenericClients(genericClients), nil
} | go | func NewConnectionManager2ClientsByURL(loc *url.URL) ([]*ConnectionManager2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_2)
if err != nil {
return nil, err
}
return newConnectionManager2ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewConnectionManager2ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"ConnectionManager2",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_Connectio... | // NewConnectionManager2ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewConnectionManager2ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"pr... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L1884-L1890 |
24,012 | huin/goupnp | dcps/av1/av1.go | NewContentDirectory1Clients | func NewContentDirectory1Clients() (clients []*ContentDirectory1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_1); err != nil {
return
}
clients = newContentDirectory1ClientsFromGenericClients(genericClients)
... | go | func NewContentDirectory1Clients() (clients []*ContentDirectory1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_1); err != nil {
return
}
clients = newContentDirectory1ClientsFromGenericClients(genericClients)
... | [
"func",
"NewContentDirectory1Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"ContentDirectory1",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericClien... | // NewContentDirectory1Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry call... | [
"NewContentDirectory1Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L2128-L2135 |
24,013 | huin/goupnp | dcps/av1/av1.go | NewContentDirectory1ClientsByURL | func NewContentDirectory1ClientsByURL(loc *url.URL) ([]*ContentDirectory1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_1)
if err != nil {
return nil, err
}
return newContentDirectory1ClientsFromGenericClients(genericClients), nil
} | go | func NewContentDirectory1ClientsByURL(loc *url.URL) ([]*ContentDirectory1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_1)
if err != nil {
return nil, err
}
return newContentDirectory1ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewContentDirectory1ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"ContentDirectory1",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_ContentDire... | // NewContentDirectory1ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewContentDirectory1ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"pro... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L2143-L2149 |
24,014 | huin/goupnp | dcps/av1/av1.go | NewContentDirectory2Clients | func NewContentDirectory2Clients() (clients []*ContentDirectory2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_2); err != nil {
return
}
clients = newContentDirectory2ClientsFromGenericClients(genericClients)
... | go | func NewContentDirectory2Clients() (clients []*ContentDirectory2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_2); err != nil {
return
}
clients = newContentDirectory2ClientsFromGenericClients(genericClients)
... | [
"func",
"NewContentDirectory2Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"ContentDirectory2",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericClien... | // NewContentDirectory2Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry call... | [
"NewContentDirectory2Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L2696-L2703 |
24,015 | huin/goupnp | dcps/av1/av1.go | NewContentDirectory2ClientsByURL | func NewContentDirectory2ClientsByURL(loc *url.URL) ([]*ContentDirectory2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_2)
if err != nil {
return nil, err
}
return newContentDirectory2ClientsFromGenericClients(genericClients), nil
} | go | func NewContentDirectory2ClientsByURL(loc *url.URL) ([]*ContentDirectory2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_2)
if err != nil {
return nil, err
}
return newContentDirectory2ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewContentDirectory2ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"ContentDirectory2",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_ContentDire... | // NewContentDirectory2ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewContentDirectory2ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"pro... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L2711-L2717 |
24,016 | huin/goupnp | dcps/av1/av1.go | NewContentDirectory3Clients | func NewContentDirectory3Clients() (clients []*ContentDirectory3, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_3); err != nil {
return
}
clients = newContentDirectory3ClientsFromGenericClients(genericClients)
... | go | func NewContentDirectory3Clients() (clients []*ContentDirectory3, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_3); err != nil {
return
}
clients = newContentDirectory3ClientsFromGenericClients(genericClients)
... | [
"func",
"NewContentDirectory3Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"ContentDirectory3",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericClien... | // NewContentDirectory3Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry call... | [
"NewContentDirectory3Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L3351-L3358 |
24,017 | huin/goupnp | dcps/av1/av1.go | NewContentDirectory3ClientsByURL | func NewContentDirectory3ClientsByURL(loc *url.URL) ([]*ContentDirectory3, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_3)
if err != nil {
return nil, err
}
return newContentDirectory3ClientsFromGenericClients(genericClients), nil
} | go | func NewContentDirectory3ClientsByURL(loc *url.URL) ([]*ContentDirectory3, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_3)
if err != nil {
return nil, err
}
return newContentDirectory3ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewContentDirectory3ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"ContentDirectory3",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_ContentDire... | // NewContentDirectory3ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewContentDirectory3ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"pro... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L3366-L3372 |
24,018 | huin/goupnp | dcps/av1/av1.go | NewRenderingControl1Clients | func NewRenderingControl1Clients() (clients []*RenderingControl1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_1); err != nil {
return
}
clients = newRenderingControl1ClientsFromGenericClients(genericClients)
... | go | func NewRenderingControl1Clients() (clients []*RenderingControl1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_1); err != nil {
return
}
clients = newRenderingControl1ClientsFromGenericClients(genericClients)
... | [
"func",
"NewRenderingControl1Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"RenderingControl1",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericClien... | // NewRenderingControl1Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry call... | [
"NewRenderingControl1Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L4101-L4108 |
24,019 | huin/goupnp | dcps/av1/av1.go | NewRenderingControl1ClientsByURL | func NewRenderingControl1ClientsByURL(loc *url.URL) ([]*RenderingControl1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_1)
if err != nil {
return nil, err
}
return newRenderingControl1ClientsFromGenericClients(genericClients), nil
} | go | func NewRenderingControl1ClientsByURL(loc *url.URL) ([]*RenderingControl1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_1)
if err != nil {
return nil, err
}
return newRenderingControl1ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewRenderingControl1ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"RenderingControl1",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_RenderingCo... | // NewRenderingControl1ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewRenderingControl1ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"pro... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L4116-L4122 |
24,020 | huin/goupnp | dcps/av1/av1.go | NewRenderingControl2Clients | func NewRenderingControl2Clients() (clients []*RenderingControl2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_2); err != nil {
return
}
clients = newRenderingControl2ClientsFromGenericClients(genericClients)
... | go | func NewRenderingControl2Clients() (clients []*RenderingControl2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_2); err != nil {
return
}
clients = newRenderingControl2ClientsFromGenericClients(genericClients)
... | [
"func",
"NewRenderingControl2Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"RenderingControl2",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericClien... | // NewRenderingControl2Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry call... | [
"NewRenderingControl2Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replied"... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L5424-L5431 |
24,021 | huin/goupnp | dcps/av1/av1.go | NewRenderingControl2ClientsByURL | func NewRenderingControl2ClientsByURL(loc *url.URL) ([]*RenderingControl2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_2)
if err != nil {
return nil, err
}
return newRenderingControl2ClientsFromGenericClients(genericClients), nil
} | go | func NewRenderingControl2ClientsByURL(loc *url.URL) ([]*RenderingControl2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_2)
if err != nil {
return nil, err
}
return newRenderingControl2ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewRenderingControl2ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"RenderingControl2",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_RenderingCo... | // NewRenderingControl2ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewRenderingControl2ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"pro... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L5439-L5445 |
24,022 | huin/goupnp | dcps/av1/av1.go | NewScheduledRecording1Clients | func NewScheduledRecording1Clients() (clients []*ScheduledRecording1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_1); err != nil {
return
}
clients = newScheduledRecording1ClientsFromGenericClients(genericC... | go | func NewScheduledRecording1Clients() (clients []*ScheduledRecording1, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_1); err != nil {
return
}
clients = newScheduledRecording1ClientsFromGenericClients(genericC... | [
"func",
"NewScheduledRecording1Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"ScheduledRecording1",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericC... | // NewScheduledRecording1Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry ca... | [
"NewScheduledRecording1Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replie... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L6838-L6845 |
24,023 | huin/goupnp | dcps/av1/av1.go | NewScheduledRecording1ClientsByURL | func NewScheduledRecording1ClientsByURL(loc *url.URL) ([]*ScheduledRecording1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_1)
if err != nil {
return nil, err
}
return newScheduledRecording1ClientsFromGenericClients(genericClients), nil
} | go | func NewScheduledRecording1ClientsByURL(loc *url.URL) ([]*ScheduledRecording1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_1)
if err != nil {
return nil, err
}
return newScheduledRecording1ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewScheduledRecording1ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"ScheduledRecording1",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_Schedul... | // NewScheduledRecording1ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewScheduledRecording1ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"p... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L6853-L6859 |
24,024 | huin/goupnp | dcps/av1/av1.go | NewScheduledRecording2Clients | func NewScheduledRecording2Clients() (clients []*ScheduledRecording2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_2); err != nil {
return
}
clients = newScheduledRecording2ClientsFromGenericClients(genericC... | go | func NewScheduledRecording2Clients() (clients []*ScheduledRecording2, errors []error, err error) {
var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_2); err != nil {
return
}
clients = newScheduledRecording2ClientsFromGenericClients(genericC... | [
"func",
"NewScheduledRecording2Clients",
"(",
")",
"(",
"clients",
"[",
"]",
"*",
"ScheduledRecording2",
",",
"errors",
"[",
"]",
"error",
",",
"err",
"error",
")",
"{",
"var",
"genericClients",
"[",
"]",
"goupnp",
".",
"ServiceClient",
"\n",
"if",
"genericC... | // NewScheduledRecording2Clients discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright.
//
// This is a typical entry ca... | [
"NewScheduledRecording2Clients",
"discovers",
"instances",
"of",
"the",
"service",
"on",
"the",
"network",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"errors",
"will",
"contain",
"an",
"error",
"for",
"any",
"devices",
"that",
"replie... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L7513-L7520 |
24,025 | huin/goupnp | dcps/av1/av1.go | NewScheduledRecording2ClientsByURL | func NewScheduledRecording2ClientsByURL(loc *url.URL) ([]*ScheduledRecording2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_2)
if err != nil {
return nil, err
}
return newScheduledRecording2ClientsFromGenericClients(genericClients), nil
} | go | func NewScheduledRecording2ClientsByURL(loc *url.URL) ([]*ScheduledRecording2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_2)
if err != nil {
return nil, err
}
return newScheduledRecording2ClientsFromGenericClients(genericClients), nil
} | [
"func",
"NewScheduledRecording2ClientsByURL",
"(",
"loc",
"*",
"url",
".",
"URL",
")",
"(",
"[",
"]",
"*",
"ScheduledRecording2",
",",
"error",
")",
"{",
"genericClients",
",",
"err",
":=",
"goupnp",
".",
"NewServiceClientsByURL",
"(",
"loc",
",",
"URN_Schedul... | // NewScheduledRecording2ClientsByURL discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service.
//
// This is a typical entry calling point into this package when reusing an
// previously discovered service URL. | [
"NewScheduledRecording2ClientsByURL",
"discovers",
"instances",
"of",
"the",
"service",
"at",
"the",
"given",
"URL",
"and",
"returns",
"clients",
"to",
"any",
"that",
"are",
"found",
".",
"An",
"error",
"is",
"returned",
"if",
"there",
"was",
"an",
"error",
"p... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/dcps/av1/av1.go#L7528-L7534 |
24,026 | huin/goupnp | ssdp/registry.go | NewServerAndRegistry | func NewServerAndRegistry() (*httpu.Server, *Registry) {
reg := NewRegistry()
srv := &httpu.Server{
Addr: ssdpUDP4Addr,
Multicast: true,
Handler: reg,
}
return srv, reg
} | go | func NewServerAndRegistry() (*httpu.Server, *Registry) {
reg := NewRegistry()
srv := &httpu.Server{
Addr: ssdpUDP4Addr,
Multicast: true,
Handler: reg,
}
return srv, reg
} | [
"func",
"NewServerAndRegistry",
"(",
")",
"(",
"*",
"httpu",
".",
"Server",
",",
"*",
"Registry",
")",
"{",
"reg",
":=",
"NewRegistry",
"(",
")",
"\n",
"srv",
":=",
"&",
"httpu",
".",
"Server",
"{",
"Addr",
":",
"ssdpUDP4Addr",
",",
"Multicast",
":",
... | // NewServerAndRegistry is a convenience function to create a registry, and an
// httpu server to pass it messages. Call ListenAndServe on the server for
// messages to be processed. | [
"NewServerAndRegistry",
"is",
"a",
"convenience",
"function",
"to",
"create",
"a",
"registry",
"and",
"an",
"httpu",
"server",
"to",
"pass",
"it",
"messages",
".",
"Call",
"ListenAndServe",
"on",
"the",
"server",
"for",
"messages",
"to",
"be",
"processed",
"."... | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/ssdp/registry.go#L183-L191 |
24,027 | huin/goupnp | device.go | SetURLBase | func (root *RootDevice) SetURLBase(urlBase *url.URL) {
root.URLBase = *urlBase
root.URLBaseStr = urlBase.String()
root.Device.SetURLBase(urlBase)
} | go | func (root *RootDevice) SetURLBase(urlBase *url.URL) {
root.URLBase = *urlBase
root.URLBaseStr = urlBase.String()
root.Device.SetURLBase(urlBase)
} | [
"func",
"(",
"root",
"*",
"RootDevice",
")",
"SetURLBase",
"(",
"urlBase",
"*",
"url",
".",
"URL",
")",
"{",
"root",
".",
"URLBase",
"=",
"*",
"urlBase",
"\n",
"root",
".",
"URLBaseStr",
"=",
"urlBase",
".",
"String",
"(",
")",
"\n",
"root",
".",
"... | // SetURLBase sets the URLBase for the RootDevice and its underlying components. | [
"SetURLBase",
"sets",
"the",
"URLBase",
"for",
"the",
"RootDevice",
"and",
"its",
"underlying",
"components",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/device.go#L31-L35 |
24,028 | huin/goupnp | device.go | VisitDevices | func (device *Device) VisitDevices(visitor func(*Device)) {
visitor(device)
for i := range device.Devices {
device.Devices[i].VisitDevices(visitor)
}
} | go | func (device *Device) VisitDevices(visitor func(*Device)) {
visitor(device)
for i := range device.Devices {
device.Devices[i].VisitDevices(visitor)
}
} | [
"func",
"(",
"device",
"*",
"Device",
")",
"VisitDevices",
"(",
"visitor",
"func",
"(",
"*",
"Device",
")",
")",
"{",
"visitor",
"(",
"device",
")",
"\n",
"for",
"i",
":=",
"range",
"device",
".",
"Devices",
"{",
"device",
".",
"Devices",
"[",
"i",
... | // VisitDevices calls visitor for the device, and all its descendent devices. | [
"VisitDevices",
"calls",
"visitor",
"for",
"the",
"device",
"and",
"all",
"its",
"descendent",
"devices",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/device.go#L66-L71 |
24,029 | huin/goupnp | device.go | VisitServices | func (device *Device) VisitServices(visitor func(*Service)) {
device.VisitDevices(func(d *Device) {
for i := range d.Services {
visitor(&d.Services[i])
}
})
} | go | func (device *Device) VisitServices(visitor func(*Service)) {
device.VisitDevices(func(d *Device) {
for i := range d.Services {
visitor(&d.Services[i])
}
})
} | [
"func",
"(",
"device",
"*",
"Device",
")",
"VisitServices",
"(",
"visitor",
"func",
"(",
"*",
"Service",
")",
")",
"{",
"device",
".",
"VisitDevices",
"(",
"func",
"(",
"d",
"*",
"Device",
")",
"{",
"for",
"i",
":=",
"range",
"d",
".",
"Services",
... | // VisitServices calls visitor for all Services under the device and all its
// descendent devices. | [
"VisitServices",
"calls",
"visitor",
"for",
"all",
"Services",
"under",
"the",
"device",
"and",
"all",
"its",
"descendent",
"devices",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/device.go#L75-L81 |
24,030 | huin/goupnp | device.go | SetURLBase | func (device *Device) SetURLBase(urlBase *url.URL) {
device.ManufacturerURL.SetURLBase(urlBase)
device.ModelURL.SetURLBase(urlBase)
device.PresentationURL.SetURLBase(urlBase)
for i := range device.Icons {
device.Icons[i].SetURLBase(urlBase)
}
for i := range device.Services {
device.Services[i].SetURLBase(urlB... | go | func (device *Device) SetURLBase(urlBase *url.URL) {
device.ManufacturerURL.SetURLBase(urlBase)
device.ModelURL.SetURLBase(urlBase)
device.PresentationURL.SetURLBase(urlBase)
for i := range device.Icons {
device.Icons[i].SetURLBase(urlBase)
}
for i := range device.Services {
device.Services[i].SetURLBase(urlB... | [
"func",
"(",
"device",
"*",
"Device",
")",
"SetURLBase",
"(",
"urlBase",
"*",
"url",
".",
"URL",
")",
"{",
"device",
".",
"ManufacturerURL",
".",
"SetURLBase",
"(",
"urlBase",
")",
"\n",
"device",
".",
"ModelURL",
".",
"SetURLBase",
"(",
"urlBase",
")",
... | // SetURLBase sets the URLBase for the Device and its underlying components. | [
"SetURLBase",
"sets",
"the",
"URLBase",
"for",
"the",
"Device",
"and",
"its",
"underlying",
"components",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/device.go#L96-L109 |
24,031 | huin/goupnp | device.go | SetURLBase | func (icon *Icon) SetURLBase(url *url.URL) {
icon.URL.SetURLBase(url)
} | go | func (icon *Icon) SetURLBase(url *url.URL) {
icon.URL.SetURLBase(url)
} | [
"func",
"(",
"icon",
"*",
"Icon",
")",
"SetURLBase",
"(",
"url",
"*",
"url",
".",
"URL",
")",
"{",
"icon",
".",
"URL",
".",
"SetURLBase",
"(",
"url",
")",
"\n",
"}"
] | // SetURLBase sets the URLBase for the Icon. | [
"SetURLBase",
"sets",
"the",
"URLBase",
"for",
"the",
"Icon",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/device.go#L126-L128 |
24,032 | huin/goupnp | device.go | SetURLBase | func (srv *Service) SetURLBase(urlBase *url.URL) {
srv.SCPDURL.SetURLBase(urlBase)
srv.ControlURL.SetURLBase(urlBase)
srv.EventSubURL.SetURLBase(urlBase)
} | go | func (srv *Service) SetURLBase(urlBase *url.URL) {
srv.SCPDURL.SetURLBase(urlBase)
srv.ControlURL.SetURLBase(urlBase)
srv.EventSubURL.SetURLBase(urlBase)
} | [
"func",
"(",
"srv",
"*",
"Service",
")",
"SetURLBase",
"(",
"urlBase",
"*",
"url",
".",
"URL",
")",
"{",
"srv",
".",
"SCPDURL",
".",
"SetURLBase",
"(",
"urlBase",
")",
"\n",
"srv",
".",
"ControlURL",
".",
"SetURLBase",
"(",
"urlBase",
")",
"\n",
"srv... | // SetURLBase sets the URLBase for the Service. | [
"SetURLBase",
"sets",
"the",
"URLBase",
"for",
"the",
"Service",
"."
] | 656e61dfadd241c7cbdd22a023fa81ecb6860ea8 | https://github.com/huin/goupnp/blob/656e61dfadd241c7cbdd22a023fa81ecb6860ea8/device.go#L140-L144 |
24,033 | apcera/libretto | virtualmachine/vsphere/util.go | GetDatacenter | func GetDatacenter(vm *VM) (*mo.Datacenter, error) {
dcList, err := vm.finder.DatacenterList(vm.ctx, "*")
if err != nil {
return nil, NewErrorObjectNotFound(err, vm.Datacenter)
}
for _, dc := range dcList {
dcMo := mo.Datacenter{}
ps := []string{"name", "hostFolder", "vmFolder", "datastore"}
err := vm.colle... | go | func GetDatacenter(vm *VM) (*mo.Datacenter, error) {
dcList, err := vm.finder.DatacenterList(vm.ctx, "*")
if err != nil {
return nil, NewErrorObjectNotFound(err, vm.Datacenter)
}
for _, dc := range dcList {
dcMo := mo.Datacenter{}
ps := []string{"name", "hostFolder", "vmFolder", "datastore"}
err := vm.colle... | [
"func",
"GetDatacenter",
"(",
"vm",
"*",
"VM",
")",
"(",
"*",
"mo",
".",
"Datacenter",
",",
"error",
")",
"{",
"dcList",
",",
"err",
":=",
"vm",
".",
"finder",
".",
"DatacenterList",
"(",
"vm",
".",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",... | // GetDatacenter retrieves the datacenter that the provisioner was configured
// against. | [
"GetDatacenter",
"retrieves",
"the",
"datacenter",
"that",
"the",
"provisioner",
"was",
"configured",
"against",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/util.go#L84-L101 |
24,034 | apcera/libretto | virtualmachine/vsphere/util.go | validateHost | func validateHost(vm *VM, hsMor types.ManagedObjectReference) (bool, error) {
nwValid := true
dsValid := false
// Fetch the managed object for the host system to populate the datastore and the network folders
hsMo := mo.HostSystem{}
err := vm.collector.RetrieveOne(vm.ctx, hsMor, []string{"network", "datastore"}, &... | go | func validateHost(vm *VM, hsMor types.ManagedObjectReference) (bool, error) {
nwValid := true
dsValid := false
// Fetch the managed object for the host system to populate the datastore and the network folders
hsMo := mo.HostSystem{}
err := vm.collector.RetrieveOne(vm.ctx, hsMor, []string{"network", "datastore"}, &... | [
"func",
"validateHost",
"(",
"vm",
"*",
"VM",
",",
"hsMor",
"types",
".",
"ManagedObjectReference",
")",
"(",
"bool",
",",
"error",
")",
"{",
"nwValid",
":=",
"true",
"\n",
"dsValid",
":=",
"false",
"\n",
"// Fetch the managed object for the host system to populat... | // validateHost validates that the host-system contains the network and the datastore passed in | [
"validateHost",
"validates",
"that",
"the",
"host",
"-",
"system",
"contains",
"the",
"network",
"and",
"the",
"datastore",
"passed",
"in"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/util.go#L736-L775 |
24,035 | apcera/libretto | virtualmachine/vsphere/util.go | answerQuestion | func (vm *VM) answerQuestion(vmMo *mo.VirtualMachine) error {
q := vmMo.Runtime.Question
if q == nil {
return nil
}
for qre, ans := range vm.QuestionResponses {
if match, err := regexp.MatchString(qre, q.Text); err != nil {
return fmt.Errorf("error while parsing automated responses: %v", err)
} else if ma... | go | func (vm *VM) answerQuestion(vmMo *mo.VirtualMachine) error {
q := vmMo.Runtime.Question
if q == nil {
return nil
}
for qre, ans := range vm.QuestionResponses {
if match, err := regexp.MatchString(qre, q.Text); err != nil {
return fmt.Errorf("error while parsing automated responses: %v", err)
} else if ma... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"answerQuestion",
"(",
"vmMo",
"*",
"mo",
".",
"VirtualMachine",
")",
"error",
"{",
"q",
":=",
"vmMo",
".",
"Runtime",
".",
"Question",
"\n",
"if",
"q",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",... | // answerQuestion checks to see if there are currently pending questions on the
// VM which prevent further actions. If so, it automatically responds to the
// question based on the the vm.QuestionResponses map. If there is a problem
// responding to the question, the error is returned. If there are no pending
// quest... | [
"answerQuestion",
"checks",
"to",
"see",
"if",
"there",
"are",
"currently",
"pending",
"questions",
"on",
"the",
"VM",
"which",
"prevent",
"further",
"actions",
".",
"If",
"so",
"it",
"automatically",
"responds",
"to",
"the",
"question",
"based",
"on",
"the",
... | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/vsphere/util.go#L796-L815 |
24,036 | apcera/libretto | virtualmachine/exoscale/util.go | WaitVMCreation | func (vm *VM) WaitVMCreation(timeoutSeconds int, pollIntervalSeconds int) error {
if vm.JobID == "" {
return fmt.Errorf("No JobID informed. Cannot poll machine creation state")
}
jobCh := make(chan *egoscale.QueryAsyncJobResultResponse, 1)
errCh := make(chan error, 1)
go func() {
params := url.Values{}
pa... | go | func (vm *VM) WaitVMCreation(timeoutSeconds int, pollIntervalSeconds int) error {
if vm.JobID == "" {
return fmt.Errorf("No JobID informed. Cannot poll machine creation state")
}
jobCh := make(chan *egoscale.QueryAsyncJobResultResponse, 1)
errCh := make(chan error, 1)
go func() {
params := url.Values{}
pa... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"WaitVMCreation",
"(",
"timeoutSeconds",
"int",
",",
"pollIntervalSeconds",
"int",
")",
"error",
"{",
"if",
"vm",
".",
"JobID",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",... | // WaitVMCreation waits for the virtual machine to be created, and stores the virtual machine ID
// VM structure must contain a valid JobID. | [
"WaitVMCreation",
"waits",
"for",
"the",
"virtual",
"machine",
"to",
"be",
"created",
"and",
"stores",
"the",
"virtual",
"machine",
"ID",
"VM",
"structure",
"must",
"contain",
"a",
"valid",
"JobID",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/util.go#L20-L68 |
24,037 | apcera/libretto | virtualmachine/exoscale/util.go | fillTemplateID | func (vm *VM) fillTemplateID() error {
params := url.Values{}
params.Set("Name", vm.Template.Name)
params.Set("templatefilter", "featured")
client := vm.getExoClient()
resp, err := client.Request("listTemplates", params)
if err != nil {
return fmt.Errorf("Getting template ID for '%s/%d/%s': %s", vm.Template.N... | go | func (vm *VM) fillTemplateID() error {
params := url.Values{}
params.Set("Name", vm.Template.Name)
params.Set("templatefilter", "featured")
client := vm.getExoClient()
resp, err := client.Request("listTemplates", params)
if err != nil {
return fmt.Errorf("Getting template ID for '%s/%d/%s': %s", vm.Template.N... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"fillTemplateID",
"(",
")",
"error",
"{",
"params",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"params",
".",
"Set",
"(",
"\"",
"\"",
",",
"vm",
".",
"Template",
".",
"Name",
")",
"\n",
"params",
".",
"Set",
... | // fillTemplateID fills the template identifier based on name, storage and zone name.
// If no matching template is found, ID remains unchanged and an error is returned. | [
"fillTemplateID",
"fills",
"the",
"template",
"identifier",
"based",
"on",
"name",
"storage",
"and",
"zone",
"name",
".",
"If",
"no",
"matching",
"template",
"is",
"found",
"ID",
"remains",
"unchanged",
"and",
"an",
"error",
"is",
"returned",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/util.go#L72-L103 |
24,038 | apcera/libretto | virtualmachine/exoscale/util.go | fillServiceOfferingID | func (vm *VM) fillServiceOfferingID() error {
params := url.Values{}
params.Set("name", strings.ToLower(string(vm.ServiceOffering.Name)))
client := vm.getExoClient()
resp, err := client.Request("listServiceOfferings", params)
if err != nil {
return fmt.Errorf("Getting service offering ID for %q: %s", vm.Servic... | go | func (vm *VM) fillServiceOfferingID() error {
params := url.Values{}
params.Set("name", strings.ToLower(string(vm.ServiceOffering.Name)))
client := vm.getExoClient()
resp, err := client.Request("listServiceOfferings", params)
if err != nil {
return fmt.Errorf("Getting service offering ID for %q: %s", vm.Servic... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"fillServiceOfferingID",
"(",
")",
"error",
"{",
"params",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"params",
".",
"Set",
"(",
"\"",
"\"",
",",
"strings",
".",
"ToLower",
"(",
"string",
"(",
"vm",
".",
"Service... | // fillServiceOfferingID fills the service offering identifier based on name.
// If no matching service offering is found, ID remains unchanged and an error is returned. | [
"fillServiceOfferingID",
"fills",
"the",
"service",
"offering",
"identifier",
"based",
"on",
"name",
".",
"If",
"no",
"matching",
"service",
"offering",
"is",
"found",
"ID",
"remains",
"unchanged",
"and",
"an",
"error",
"is",
"returned",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/util.go#L107-L130 |
24,039 | apcera/libretto | virtualmachine/exoscale/util.go | fillSecurityGroupsID | func (vm *VM) fillSecurityGroupsID() error {
params := url.Values{}
client := vm.getExoClient()
resp, err := client.Request("listSecurityGroups", params)
if err != nil {
return fmt.Errorf("Getting security groups: %s", err)
}
sgRemotes := &egoscale.ListSecurityGroupsResponse{}
if err := json.Unmarshal(resp,... | go | func (vm *VM) fillSecurityGroupsID() error {
params := url.Values{}
client := vm.getExoClient()
resp, err := client.Request("listSecurityGroups", params)
if err != nil {
return fmt.Errorf("Getting security groups: %s", err)
}
sgRemotes := &egoscale.ListSecurityGroupsResponse{}
if err := json.Unmarshal(resp,... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"fillSecurityGroupsID",
"(",
")",
"error",
"{",
"params",
":=",
"url",
".",
"Values",
"{",
"}",
"\n\n",
"client",
":=",
"vm",
".",
"getExoClient",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"client",
".",
"Request",
... | // fillSecurityGroupsID fills the security group identifiers based on name.
// If a security group already has the ID, it will remain unchanged.
// If any of the security groups is not founds error is returned. | [
"fillSecurityGroupsID",
"fills",
"the",
"security",
"group",
"identifiers",
"based",
"on",
"name",
".",
"If",
"a",
"security",
"group",
"already",
"has",
"the",
"ID",
"it",
"will",
"remain",
"unchanged",
".",
"If",
"any",
"of",
"the",
"security",
"groups",
"... | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/util.go#L135-L171 |
24,040 | apcera/libretto | virtualmachine/exoscale/util.go | fillZoneID | func (vm *VM) fillZoneID() error {
params := url.Values{}
params.Set("name", strings.ToLower(string(vm.Zone.Name)))
client := vm.getExoClient()
resp, err := client.Request("listZones", params)
if err != nil {
return fmt.Errorf("Getting zones ID for %q: %s", vm.ServiceOffering.Name, err)
}
zones := &egoscale... | go | func (vm *VM) fillZoneID() error {
params := url.Values{}
params.Set("name", strings.ToLower(string(vm.Zone.Name)))
client := vm.getExoClient()
resp, err := client.Request("listZones", params)
if err != nil {
return fmt.Errorf("Getting zones ID for %q: %s", vm.ServiceOffering.Name, err)
}
zones := &egoscale... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"fillZoneID",
"(",
")",
"error",
"{",
"params",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"params",
".",
"Set",
"(",
"\"",
"\"",
",",
"strings",
".",
"ToLower",
"(",
"string",
"(",
"vm",
".",
"Zone",
".",
"N... | // fillZoneID fills the zone identifier based on name.
// If no matching zone is found, ID remains unchanged and an error is returned. | [
"fillZoneID",
"fills",
"the",
"zone",
"identifier",
"based",
"on",
"name",
".",
"If",
"no",
"matching",
"zone",
"is",
"found",
"ID",
"remains",
"unchanged",
"and",
"an",
"error",
"is",
"returned",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/exoscale/util.go#L175-L199 |
24,041 | apcera/libretto | virtualmachine/gcp/vm.go | Provision | func (vm *VM) Provision() error {
s, err := vm.getService()
if err != nil {
return err
}
return s.provision()
} | go | func (vm *VM) Provision() error {
s, err := vm.getService()
if err != nil {
return err
}
return s.provision()
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"Provision",
"(",
")",
"error",
"{",
"s",
",",
"err",
":=",
"vm",
".",
"getService",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"provision",
"(",
")"... | // Provision creates a virtual machine on GCE. It returns an error if
// there was a problem during creation. | [
"Provision",
"creates",
"a",
"virtual",
"machine",
"on",
"GCE",
".",
"It",
"returns",
"an",
"error",
"if",
"there",
"was",
"a",
"problem",
"during",
"creation",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/vm.go#L79-L86 |
24,042 | apcera/libretto | virtualmachine/gcp/vm.go | GetIPs | func (vm *VM) GetIPs() ([]net.IP, error) {
s, err := vm.getService()
if err != nil {
return nil, err
}
return s.getIPs()
} | go | func (vm *VM) GetIPs() ([]net.IP, error) {
s, err := vm.getService()
if err != nil {
return nil, err
}
return s.getIPs()
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"GetIPs",
"(",
")",
"(",
"[",
"]",
"net",
".",
"IP",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"vm",
".",
"getService",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n"... | // GetIPs returns a slice of IP addresses assigned to the VM. | [
"GetIPs",
"returns",
"a",
"slice",
"of",
"IP",
"addresses",
"assigned",
"to",
"the",
"VM",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/vm.go#L89-L96 |
24,043 | apcera/libretto | virtualmachine/gcp/vm.go | Destroy | func (vm *VM) Destroy() error {
s, err := vm.getService()
if err != nil {
return err
}
return s.delete()
} | go | func (vm *VM) Destroy() error {
s, err := vm.getService()
if err != nil {
return err
}
return s.delete()
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"Destroy",
"(",
")",
"error",
"{",
"s",
",",
"err",
":=",
"vm",
".",
"getService",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"delete",
"(",
")",
"... | // Destroy deletes the VM on GCE. | [
"Destroy",
"deletes",
"the",
"VM",
"on",
"GCE",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/vm.go#L99-L106 |
24,044 | apcera/libretto | virtualmachine/gcp/vm.go | GetState | func (vm *VM) GetState() (string, error) {
s, err := vm.getService()
if err != nil {
return "", err
}
instance, err := s.getInstance()
if err != nil {
return "", err
}
switch instance.Status {
case "PROVISIONING", "STAGING":
return virtualmachine.VMStarting, nil
case "RUNNING":
return virtualmachine.... | go | func (vm *VM) GetState() (string, error) {
s, err := vm.getService()
if err != nil {
return "", err
}
instance, err := s.getInstance()
if err != nil {
return "", err
}
switch instance.Status {
case "PROVISIONING", "STAGING":
return virtualmachine.VMStarting, nil
case "RUNNING":
return virtualmachine.... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"GetState",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"vm",
".",
"getService",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n"... | // GetState retrieve the instance status. | [
"GetState",
"retrieve",
"the",
"instance",
"status",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/vm.go#L109-L130 |
24,045 | apcera/libretto | virtualmachine/gcp/vm.go | Halt | func (vm *VM) Halt() error {
s, err := vm.getService()
if err != nil {
return err
}
return s.stop()
} | go | func (vm *VM) Halt() error {
s, err := vm.getService()
if err != nil {
return err
}
return s.stop()
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"Halt",
"(",
")",
"error",
"{",
"s",
",",
"err",
":=",
"vm",
".",
"getService",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"stop",
"(",
")",
"\n",
... | // Halt stops a GCE instance. | [
"Halt",
"stops",
"a",
"GCE",
"instance",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/vm.go#L143-L150 |
24,046 | apcera/libretto | virtualmachine/gcp/vm.go | Start | func (vm *VM) Start() error {
s, err := vm.getService()
if err != nil {
return err
}
return s.start()
} | go | func (vm *VM) Start() error {
s, err := vm.getService()
if err != nil {
return err
}
return s.start()
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"Start",
"(",
")",
"error",
"{",
"s",
",",
"err",
":=",
"vm",
".",
"getService",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"start",
"(",
")",
"\n"... | // Start a stopped GCE instance. | [
"Start",
"a",
"stopped",
"GCE",
"instance",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/vm.go#L153-L160 |
24,047 | apcera/libretto | virtualmachine/gcp/vm.go | InsertSSHKey | func (vm *VM) InsertSSHKey(publicKey string) error {
s, err := vm.getService()
if err != nil {
return err
}
return s.insertSSHKey()
} | go | func (vm *VM) InsertSSHKey(publicKey string) error {
s, err := vm.getService()
if err != nil {
return err
}
return s.insertSSHKey()
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"InsertSSHKey",
"(",
"publicKey",
"string",
")",
"error",
"{",
"s",
",",
"err",
":=",
"vm",
".",
"getService",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".... | // InsertSSHKey uploads new ssh key into the GCE instance. | [
"InsertSSHKey",
"uploads",
"new",
"ssh",
"key",
"into",
"the",
"GCE",
"instance",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/vm.go#L184-L191 |
24,048 | apcera/libretto | virtualmachine/gcp/vm.go | DeleteDisks | func (vm *VM) DeleteDisks() error {
s, err := vm.getService()
if err != nil {
return err
}
errs := s.deleteDisks()
if len(errs) > 0 {
err = util.CombineErrors(": ", errs...)
return err
}
return nil
} | go | func (vm *VM) DeleteDisks() error {
s, err := vm.getService()
if err != nil {
return err
}
errs := s.deleteDisks()
if len(errs) > 0 {
err = util.CombineErrors(": ", errs...)
return err
}
return nil
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"DeleteDisks",
"(",
")",
"error",
"{",
"s",
",",
"err",
":=",
"vm",
".",
"getService",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"errs",
":=",
"s",
".",
"deleteDisks",
... | // DeleteDisks cleans up all the disks attached to the GCE instance. | [
"DeleteDisks",
"cleans",
"up",
"all",
"the",
"disks",
"attached",
"to",
"the",
"GCE",
"instance",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/gcp/vm.go#L194-L207 |
24,049 | apcera/libretto | virtualmachine/azure/arm/util.go | getServicePrincipalToken | func getServicePrincipalToken(creds *OAuthCredentials, scope string) (*adal.ServicePrincipalToken, error) {
oauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, creds.TenantID)
if err != nil {
return nil, err
}
return adal.NewServicePrincipalToken(*oauthConfig, creds.ClientID, creds.... | go | func getServicePrincipalToken(creds *OAuthCredentials, scope string) (*adal.ServicePrincipalToken, error) {
oauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, creds.TenantID)
if err != nil {
return nil, err
}
return adal.NewServicePrincipalToken(*oauthConfig, creds.ClientID, creds.... | [
"func",
"getServicePrincipalToken",
"(",
"creds",
"*",
"OAuthCredentials",
",",
"scope",
"string",
")",
"(",
"*",
"adal",
".",
"ServicePrincipalToken",
",",
"error",
")",
"{",
"oauthConfig",
",",
"err",
":=",
"adal",
".",
"NewOAuthConfig",
"(",
"azure",
".",
... | // getServicePrincipalToken retrieves a new ServicePrincipalToken using values of the
// passed credentials map. | [
"getServicePrincipalToken",
"retrieves",
"a",
"new",
"ServicePrincipalToken",
"using",
"values",
"of",
"the",
"passed",
"credentials",
"map",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L26-L32 |
24,050 | apcera/libretto | virtualmachine/azure/arm/util.go | toARMParameters | func (vm *VM) toARMParameters() *armParameters {
out := &armParameters{
AdminUsername: &armParameter{vm.SSHCreds.SSHUser},
AdminPassword: &armParameter{vm.SSHCreds.SSHPassword},
ImageOffer: &armParameter{vm.ImageOffer},
ImagePublisher: &armParameter{vm.ImagePublisher},
ImageSku:... | go | func (vm *VM) toARMParameters() *armParameters {
out := &armParameters{
AdminUsername: &armParameter{vm.SSHCreds.SSHUser},
AdminPassword: &armParameter{vm.SSHCreds.SSHPassword},
ImageOffer: &armParameter{vm.ImageOffer},
ImagePublisher: &armParameter{vm.ImagePublisher},
ImageSku:... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"toARMParameters",
"(",
")",
"*",
"armParameters",
"{",
"out",
":=",
"&",
"armParameters",
"{",
"AdminUsername",
":",
"&",
"armParameter",
"{",
"vm",
".",
"SSHCreds",
".",
"SSHUser",
"}",
",",
"AdminPassword",
":",
"&",... | // Translates the given VM to arm parameters | [
"Translates",
"the",
"given",
"VM",
"to",
"arm",
"parameters"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L61-L89 |
24,051 | apcera/libretto | virtualmachine/azure/arm/util.go | validateVM | func validateVM(vm *VM) error {
// Validate the OAUTH Credentials
if vm.Creds.ClientID == "" {
return fmt.Errorf("a client id must be specified")
}
if vm.Creds.ClientSecret == "" {
return fmt.Errorf("a client secret must be specified")
}
if vm.Creds.TenantID == "" {
return fmt.Errorf("a tenant id must be ... | go | func validateVM(vm *VM) error {
// Validate the OAUTH Credentials
if vm.Creds.ClientID == "" {
return fmt.Errorf("a client id must be specified")
}
if vm.Creds.ClientSecret == "" {
return fmt.Errorf("a client secret must be specified")
}
if vm.Creds.TenantID == "" {
return fmt.Errorf("a tenant id must be ... | [
"func",
"validateVM",
"(",
"vm",
"*",
"VM",
")",
"error",
"{",
"// Validate the OAUTH Credentials",
"if",
"vm",
".",
"Creds",
".",
"ClientID",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"vm",
... | // validateVM validates the members of given VM object | [
"validateVM",
"validates",
"the",
"members",
"of",
"given",
"VM",
"object"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L92-L146 |
24,052 | apcera/libretto | virtualmachine/azure/arm/util.go | deploy | func (vm *VM) deploy() error {
// Get the auth token.
tok, err := getServicePrincipalToken(&vm.Creds, azure.PublicCloud.ResourceManagerEndpoint)
if err != nil {
return err
}
// Pass the parameters to the arm templacte
vmParams := vm.toARMParameters()
deployment, err := createDeployment(Linux, *vmParams)
if e... | go | func (vm *VM) deploy() error {
// Get the auth token.
tok, err := getServicePrincipalToken(&vm.Creds, azure.PublicCloud.ResourceManagerEndpoint)
if err != nil {
return err
}
// Pass the parameters to the arm templacte
vmParams := vm.toARMParameters()
deployment, err := createDeployment(Linux, *vmParams)
if e... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"deploy",
"(",
")",
"error",
"{",
"// Get the auth token.",
"tok",
",",
"err",
":=",
"getServicePrincipalToken",
"(",
"&",
"vm",
".",
"Creds",
",",
"azure",
".",
"PublicCloud",
".",
"ResourceManagerEndpoint",
")",
"\n",
"... | // deploy deploys the given VM based on the default Linux arm template over the
// VM's resource group. | [
"deploy",
"deploys",
"the",
"given",
"VM",
"based",
"on",
"the",
"default",
"Linux",
"arm",
"template",
"over",
"the",
"VM",
"s",
"resource",
"group",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L150-L189 |
24,053 | apcera/libretto | virtualmachine/azure/arm/util.go | getPublicIP | func (vm *VM) getPublicIP(authorizer autorest.Authorizer) (net.IP, error) {
publicIPAddressesClient := network.NewPublicIPAddressesClient(vm.Creds.SubscriptionID)
publicIPAddressesClient.Authorizer = authorizer
resPublicIP, err := publicIPAddressesClient.Get(vm.ResourceGroup, vm.PublicIP, "")
if err != nil {
ret... | go | func (vm *VM) getPublicIP(authorizer autorest.Authorizer) (net.IP, error) {
publicIPAddressesClient := network.NewPublicIPAddressesClient(vm.Creds.SubscriptionID)
publicIPAddressesClient.Authorizer = authorizer
resPublicIP, err := publicIPAddressesClient.Get(vm.ResourceGroup, vm.PublicIP, "")
if err != nil {
ret... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"getPublicIP",
"(",
"authorizer",
"autorest",
".",
"Authorizer",
")",
"(",
"net",
".",
"IP",
",",
"error",
")",
"{",
"publicIPAddressesClient",
":=",
"network",
".",
"NewPublicIPAddressesClient",
"(",
"vm",
".",
"Creds",
... | // getPublicIP returns the public IP of the given VM, if exists one. | [
"getPublicIP",
"returns",
"the",
"public",
"IP",
"of",
"the",
"given",
"VM",
"if",
"exists",
"one",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L192-L206 |
24,054 | apcera/libretto | virtualmachine/azure/arm/util.go | getPrivateIP | func (vm *VM) getPrivateIP(authorizer autorest.Authorizer) (net.IP, error) {
interfaceClient := network.NewInterfacesClient(vm.Creds.SubscriptionID)
interfaceClient.Authorizer = authorizer
iface, err := interfaceClient.Get(vm.ResourceGroup, vm.Nic, "")
if err != nil {
return nil, err
}
if iface.InterfacePrope... | go | func (vm *VM) getPrivateIP(authorizer autorest.Authorizer) (net.IP, error) {
interfaceClient := network.NewInterfacesClient(vm.Creds.SubscriptionID)
interfaceClient.Authorizer = authorizer
iface, err := interfaceClient.Get(vm.ResourceGroup, vm.Nic, "")
if err != nil {
return nil, err
}
if iface.InterfacePrope... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"getPrivateIP",
"(",
"authorizer",
"autorest",
".",
"Authorizer",
")",
"(",
"net",
".",
"IP",
",",
"error",
")",
"{",
"interfaceClient",
":=",
"network",
".",
"NewInterfacesClient",
"(",
"vm",
".",
"Creds",
".",
"Subscr... | // getPrivateIP returns the private IP of the given VM, if exists one. | [
"getPrivateIP",
"returns",
"the",
"private",
"IP",
"of",
"the",
"given",
"VM",
"if",
"exists",
"one",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L209-L227 |
24,055 | apcera/libretto | virtualmachine/azure/arm/util.go | deleteVMFiles | func (vm *VM) deleteVMFiles(authorizer autorest.Authorizer) error {
storageAccountsClient := armStorage.NewAccountsClient(vm.Creds.SubscriptionID)
storageAccountsClient.Authorizer = authorizer
result, err := storageAccountsClient.ListKeys(vm.ResourceGroup, vm.StorageAccount)
if err != nil {
return err
}
accou... | go | func (vm *VM) deleteVMFiles(authorizer autorest.Authorizer) error {
storageAccountsClient := armStorage.NewAccountsClient(vm.Creds.SubscriptionID)
storageAccountsClient.Authorizer = authorizer
result, err := storageAccountsClient.ListKeys(vm.ResourceGroup, vm.StorageAccount)
if err != nil {
return err
}
accou... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"deleteVMFiles",
"(",
"authorizer",
"autorest",
".",
"Authorizer",
")",
"error",
"{",
"storageAccountsClient",
":=",
"armStorage",
".",
"NewAccountsClient",
"(",
"vm",
".",
"Creds",
".",
"SubscriptionID",
")",
"\n",
"storageA... | // deleteOSFile deletes the OS file from the VM's storage account, returns an error if the operation
// does not succeed. | [
"deleteOSFile",
"deletes",
"the",
"OS",
"file",
"from",
"the",
"VM",
"s",
"storage",
"account",
"returns",
"an",
"error",
"if",
"the",
"operation",
"does",
"not",
"succeed",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L231-L272 |
24,056 | apcera/libretto | virtualmachine/azure/arm/util.go | deleteNic | func (vm *VM) deleteNic(authorizer autorest.Authorizer) error {
interfaceClient := network.NewInterfacesClient(vm.Creds.SubscriptionID)
interfaceClient.Authorizer = authorizer
_, errc := interfaceClient.Delete(vm.ResourceGroup, vm.Nic, nil)
return <-errc
} | go | func (vm *VM) deleteNic(authorizer autorest.Authorizer) error {
interfaceClient := network.NewInterfacesClient(vm.Creds.SubscriptionID)
interfaceClient.Authorizer = authorizer
_, errc := interfaceClient.Delete(vm.ResourceGroup, vm.Nic, nil)
return <-errc
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"deleteNic",
"(",
"authorizer",
"autorest",
".",
"Authorizer",
")",
"error",
"{",
"interfaceClient",
":=",
"network",
".",
"NewInterfacesClient",
"(",
"vm",
".",
"Creds",
".",
"SubscriptionID",
")",
"\n",
"interfaceClient",
... | // deleteNic deletes the network interface for the given VM from the VM's resource group, returns an error
// if the operation does not succeed. | [
"deleteNic",
"deletes",
"the",
"network",
"interface",
"for",
"the",
"given",
"VM",
"from",
"the",
"VM",
"s",
"resource",
"group",
"returns",
"an",
"error",
"if",
"the",
"operation",
"does",
"not",
"succeed",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L276-L282 |
24,057 | apcera/libretto | virtualmachine/azure/arm/util.go | deletePublicIP | func (vm *VM) deletePublicIP(authorizer autorest.Authorizer) error {
// Delete the Public IP of this VM
publicIPAddressesClient := network.NewPublicIPAddressesClient(vm.Creds.SubscriptionID)
publicIPAddressesClient.Authorizer = authorizer
_, errc := publicIPAddressesClient.Delete(vm.ResourceGroup, vm.PublicIP, nil... | go | func (vm *VM) deletePublicIP(authorizer autorest.Authorizer) error {
// Delete the Public IP of this VM
publicIPAddressesClient := network.NewPublicIPAddressesClient(vm.Creds.SubscriptionID)
publicIPAddressesClient.Authorizer = authorizer
_, errc := publicIPAddressesClient.Delete(vm.ResourceGroup, vm.PublicIP, nil... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"deletePublicIP",
"(",
"authorizer",
"autorest",
".",
"Authorizer",
")",
"error",
"{",
"// Delete the Public IP of this VM",
"publicIPAddressesClient",
":=",
"network",
".",
"NewPublicIPAddressesClient",
"(",
"vm",
".",
"Creds",
".... | // deletePublicIP deletes the reserved Public IP of the given VM from the VM's resource group, returns an error
// if the operation does not succeed. | [
"deletePublicIP",
"deletes",
"the",
"reserved",
"Public",
"IP",
"of",
"the",
"given",
"VM",
"from",
"the",
"VM",
"s",
"resource",
"group",
"returns",
"an",
"error",
"if",
"the",
"operation",
"does",
"not",
"succeed",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L286-L293 |
24,058 | apcera/libretto | virtualmachine/azure/arm/util.go | deleteDeployment | func (vm *VM) deleteDeployment(authorizer autorest.Authorizer) error {
// Get the deployments client
deploymentsClient := resources.NewDeploymentsClient(vm.Creds.SubscriptionID)
deploymentsClient.Authorizer = authorizer
// Delete the deployment
_, errc := deploymentsClient.Delete(vm.ResourceGroup, vm.DeploymentNa... | go | func (vm *VM) deleteDeployment(authorizer autorest.Authorizer) error {
// Get the deployments client
deploymentsClient := resources.NewDeploymentsClient(vm.Creds.SubscriptionID)
deploymentsClient.Authorizer = authorizer
// Delete the deployment
_, errc := deploymentsClient.Delete(vm.ResourceGroup, vm.DeploymentNa... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"deleteDeployment",
"(",
"authorizer",
"autorest",
".",
"Authorizer",
")",
"error",
"{",
"// Get the deployments client",
"deploymentsClient",
":=",
"resources",
".",
"NewDeploymentsClient",
"(",
"vm",
".",
"Creds",
".",
"Subscri... | // deleteDeployment deletes the deployed azure arm template for this vm. | [
"deleteDeployment",
"deletes",
"the",
"deployed",
"azure",
"arm",
"template",
"for",
"this",
"vm",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/azure/arm/util.go#L296-L304 |
24,059 | apcera/libretto | virtualmachine/virtualbox/vm.go | GetIPs | func (vm *VM) GetIPs() ([]net.IP, error) {
vm.waitUntilReady()
return vm.ips, nil
} | go | func (vm *VM) GetIPs() ([]net.IP, error) {
vm.waitUntilReady()
return vm.ips, nil
} | [
"func",
"(",
"vm",
"*",
"VM",
")",
"GetIPs",
"(",
")",
"(",
"[",
"]",
"net",
".",
"IP",
",",
"error",
")",
"{",
"vm",
".",
"waitUntilReady",
"(",
")",
"\n\n",
"return",
"vm",
".",
"ips",
",",
"nil",
"\n",
"}"
] | // GetIPs returns a list of ip addresses associated with the vm through VBox Guest Additions. | [
"GetIPs",
"returns",
"a",
"list",
"of",
"ip",
"addresses",
"associated",
"with",
"the",
"vm",
"through",
"VBox",
"Guest",
"Additions",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/vm.go#L168-L172 |
24,060 | apcera/libretto | virtualmachine/virtualbox/vm.go | GetState | func (vm *VM) GetState() (string, error) {
stdout, err := runner.RunCombinedError("showvminfo", vm.Name)
if err != nil {
return "", lvm.WrapErrors(lvm.ErrVMInfoFailed, err)
}
for _, line := range strings.Split(stdout, "\n") {
// See if this is a NIC
if match := stateRegexp.FindStringSubmatch(line); match != n... | go | func (vm *VM) GetState() (string, error) {
stdout, err := runner.RunCombinedError("showvminfo", vm.Name)
if err != nil {
return "", lvm.WrapErrors(lvm.ErrVMInfoFailed, err)
}
for _, line := range strings.Split(stdout, "\n") {
// See if this is a NIC
if match := stateRegexp.FindStringSubmatch(line); match != n... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"GetState",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"stdout",
",",
"err",
":=",
"runner",
".",
"RunCombinedError",
"(",
"\"",
"\"",
",",
"vm",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r... | // GetState gets the power state of the VM being serviced by this driver. | [
"GetState",
"gets",
"the",
"power",
"state",
"of",
"the",
"VM",
"being",
"serviced",
"by",
"this",
"driver",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/vm.go#L175-L190 |
24,061 | apcera/libretto | virtualmachine/virtualbox/vm.go | GetInterfaces | func (vm *VM) GetInterfaces() ([]NIC, error) {
nics := []NIC{}
stdout, err := runner.RunCombinedError("showvminfo", vm.Name)
if err != nil {
return nil, err
}
for _, line := range strings.Split(stdout, "\n") {
// See if this is a NIC
if match := nicRegexp.FindStringSubmatch(line); match != nil {
var nic ... | go | func (vm *VM) GetInterfaces() ([]NIC, error) {
nics := []NIC{}
stdout, err := runner.RunCombinedError("showvminfo", vm.Name)
if err != nil {
return nil, err
}
for _, line := range strings.Split(stdout, "\n") {
// See if this is a NIC
if match := nicRegexp.FindStringSubmatch(line); match != nil {
var nic ... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"GetInterfaces",
"(",
")",
"(",
"[",
"]",
"NIC",
",",
"error",
")",
"{",
"nics",
":=",
"[",
"]",
"NIC",
"{",
"}",
"\n",
"stdout",
",",
"err",
":=",
"runner",
".",
"RunCombinedError",
"(",
"\"",
"\"",
",",
"vm"... | // GetInterfaces gets all the network cards attached to this VM | [
"GetInterfaces",
"gets",
"all",
"the",
"network",
"cards",
"attached",
"to",
"this",
"VM"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/vm.go#L193-L224 |
24,062 | apcera/libretto | virtualmachine/virtualbox/vm.go | Provision | func (vm *VM) Provision() error {
var name string
if vm.Name == "" {
name = fmt.Sprintf("vm-%s", uuid.Variant4())
vm.Name = name
}
src := vm.Src
if src == "" {
return lvm.ErrSourceNotSpecified
}
ovaPath, err := filepath.Abs(src)
if err != nil {
return err
}
vm.Src = ovaPath
// See comment on mutex ... | go | func (vm *VM) Provision() error {
var name string
if vm.Name == "" {
name = fmt.Sprintf("vm-%s", uuid.Variant4())
vm.Name = name
}
src := vm.Src
if src == "" {
return lvm.ErrSourceNotSpecified
}
ovaPath, err := filepath.Abs(src)
if err != nil {
return err
}
vm.Src = ovaPath
// See comment on mutex ... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"Provision",
"(",
")",
"error",
"{",
"var",
"name",
"string",
"\n",
"if",
"vm",
".",
"Name",
"==",
"\"",
"\"",
"{",
"name",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"uuid",
".",
"Variant4",
"(",
")",
... | // Provision imports the VM and waits until it is booted up. | [
"Provision",
"imports",
"the",
"VM",
"and",
"waits",
"until",
"it",
"is",
"booted",
"up",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/vm.go#L227-L258 |
24,063 | apcera/libretto | virtualmachine/virtualbox/vm.go | Run | func (f vboxRunner) Run(args ...string) (string, string, error) {
var vboxManagePath string
// If vBoxManage is not found in the system path, fall back to the
// hard coded path.
if path, err := exec.LookPath("VBoxManage"); err == nil {
vboxManagePath = path
} else {
vboxManagePath = VBOXMANAGE
}
cmd := exec... | go | func (f vboxRunner) Run(args ...string) (string, string, error) {
var vboxManagePath string
// If vBoxManage is not found in the system path, fall back to the
// hard coded path.
if path, err := exec.LookPath("VBoxManage"); err == nil {
vboxManagePath = path
} else {
vboxManagePath = VBOXMANAGE
}
cmd := exec... | [
"func",
"(",
"f",
"vboxRunner",
")",
"Run",
"(",
"args",
"...",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"var",
"vboxManagePath",
"string",
"\n",
"// If vBoxManage is not found in the system path, fall back to the",
"// hard coded path.",
... | // Run runs a VBoxManage command. | [
"Run",
"runs",
"a",
"VBoxManage",
"command",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/vm.go#L261-L279 |
24,064 | apcera/libretto | virtualmachine/digitalocean/vm.go | Provision | func (vm *VM) Provision() error {
b, err := json.Marshal(vm.Config)
if err != nil {
return err
}
client := &http.Client{}
req, err := BuildRequest(vm.APIToken, "POST", apiBaseURL+apiDropletURL, bytes.NewReader(b))
if err != nil {
return err
}
rsp, err := client.Do(req)
if err != nil {
return err
}
def... | go | func (vm *VM) Provision() error {
b, err := json.Marshal(vm.Config)
if err != nil {
return err
}
client := &http.Client{}
req, err := BuildRequest(vm.APIToken, "POST", apiBaseURL+apiDropletURL, bytes.NewReader(b))
if err != nil {
return err
}
rsp, err := client.Do(req)
if err != nil {
return err
}
def... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"Provision",
"(",
")",
"error",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"vm",
".",
"Config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"client",
":=",
"&",
... | // Provision creates a new VM | [
"Provision",
"creates",
"a",
"new",
"VM"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/digitalocean/vm.go#L165-L197 |
24,065 | apcera/libretto | virtualmachine/digitalocean/vm.go | GetIPs | func (vm *VM) GetIPs() ([]net.IP, error) {
var ips []net.IP
if err := vm.Update(); err != nil {
return nil, err
}
for _, ip := range vm.Droplet.Networks.V4 {
ips = append(ips, net.ParseIP(ip.IPAddress))
}
for _, ip := range vm.Droplet.Networks.V6 {
ips = append(ips, net.ParseIP(ip.IPAddress))
}
return ips... | go | func (vm *VM) GetIPs() ([]net.IP, error) {
var ips []net.IP
if err := vm.Update(); err != nil {
return nil, err
}
for _, ip := range vm.Droplet.Networks.V4 {
ips = append(ips, net.ParseIP(ip.IPAddress))
}
for _, ip := range vm.Droplet.Networks.V6 {
ips = append(ips, net.ParseIP(ip.IPAddress))
}
return ips... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"GetIPs",
"(",
")",
"(",
"[",
"]",
"net",
".",
"IP",
",",
"error",
")",
"{",
"var",
"ips",
"[",
"]",
"net",
".",
"IP",
"\n",
"if",
"err",
":=",
"vm",
".",
"Update",
"(",
")",
";",
"err",
"!=",
"nil",
"{"... | // GetIPs returns a list of ip addresses associated with the VM | [
"GetIPs",
"returns",
"a",
"list",
"of",
"ip",
"addresses",
"associated",
"with",
"the",
"VM"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/digitalocean/vm.go#L200-L212 |
24,066 | apcera/libretto | virtualmachine/digitalocean/vm.go | GetState | func (vm *VM) GetState() (string, error) {
id := fmt.Sprintf("%v", vm.Droplet.ID)
if id == "" {
return "", ErrNoInstanceID
}
client := &http.Client{}
req, err := BuildRequest(vm.APIToken, "GET", apiBaseURL+apiDropletURL+"/"+id, nil)
if err != nil {
return "", err
}
rsp, err := client.Do(req)
if err != nil... | go | func (vm *VM) GetState() (string, error) {
id := fmt.Sprintf("%v", vm.Droplet.ID)
if id == "" {
return "", ErrNoInstanceID
}
client := &http.Client{}
req, err := BuildRequest(vm.APIToken, "GET", apiBaseURL+apiDropletURL+"/"+id, nil)
if err != nil {
return "", err
}
rsp, err := client.Do(req)
if err != nil... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"GetState",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"id",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"vm",
".",
"Droplet",
".",
"ID",
")",
"\n",
"if",
"id",
"==",
"\"",
"\"",
"{",
"return",
... | // GetState gets the running state of the VM through the DigitalOcean API
// Returns droplet state if available and 'not_found' if ID could not be located. | [
"GetState",
"gets",
"the",
"running",
"state",
"of",
"the",
"VM",
"through",
"the",
"DigitalOcean",
"API",
"Returns",
"droplet",
"state",
"if",
"available",
"and",
"not_found",
"if",
"ID",
"could",
"not",
"be",
"located",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/digitalocean/vm.go#L255-L290 |
24,067 | apcera/libretto | virtualmachine/openstack/util.go | findImageAPIVersion | func findImageAPIVersion(tokenID string, imageEndpoint string) (int, error) {
// Try to fetch image API version from the imageEndpoint
if strings.HasSuffix(imageEndpoint, "/v1/") {
return 1, nil
}
if strings.HasSuffix(imageEndpoint, "/v2/") {
return 2, nil
}
// Try to fetch version number using the endpoint
... | go | func findImageAPIVersion(tokenID string, imageEndpoint string) (int, error) {
// Try to fetch image API version from the imageEndpoint
if strings.HasSuffix(imageEndpoint, "/v1/") {
return 1, nil
}
if strings.HasSuffix(imageEndpoint, "/v2/") {
return 2, nil
}
// Try to fetch version number using the endpoint
... | [
"func",
"findImageAPIVersion",
"(",
"tokenID",
"string",
",",
"imageEndpoint",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"// Try to fetch image API version from the imageEndpoint",
"if",
"strings",
".",
"HasSuffix",
"(",
"imageEndpoint",
",",
"\"",
"\"",
")... | // findImageAPIVersion finds the Image API version number. It first checks whether the given
// imageEndpoint has version info. If it is not, then a Get request is sent to imageEndpoint to
// fetch supported APIs. If any V2 api is supported then it returns 2, else If any V1 api is
// supported then it returns 1. Otherw... | [
"findImageAPIVersion",
"finds",
"the",
"Image",
"API",
"version",
"number",
".",
"It",
"first",
"checks",
"whether",
"the",
"given",
"imageEndpoint",
"has",
"version",
"info",
".",
"If",
"it",
"is",
"not",
"then",
"a",
"Get",
"request",
"is",
"sent",
"to",
... | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L117-L157 |
24,068 | apcera/libretto | virtualmachine/openstack/util.go | reserveImage | func reserveImage(tokenID string, imageEndpoint string, imageMetadata ImageMetadata, imageApiVersion int) (string, error) {
// Form the URI to create the image
imagesURI := ""
if imageVersionEncoded(imageEndpoint) {
imagesURI = fmt.Sprintf("%simages", imageEndpoint)
} else {
imagesURI = fmt.Sprintf("%sv%d/image... | go | func reserveImage(tokenID string, imageEndpoint string, imageMetadata ImageMetadata, imageApiVersion int) (string, error) {
// Form the URI to create the image
imagesURI := ""
if imageVersionEncoded(imageEndpoint) {
imagesURI = fmt.Sprintf("%simages", imageEndpoint)
} else {
imagesURI = fmt.Sprintf("%sv%d/image... | [
"func",
"reserveImage",
"(",
"tokenID",
"string",
",",
"imageEndpoint",
"string",
",",
"imageMetadata",
"ImageMetadata",
",",
"imageApiVersion",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Form the URI to create the image",
"imagesURI",
":=",
"\"",
"\"",
... | // Reserves an Image ID at the specified image endpoint using the information in given imageMetadata
// Returns the reserved Image ID if reservation is successful, otherwise returns an error.
// Requires client's token to reserve the image. | [
"Reserves",
"an",
"Image",
"ID",
"at",
"the",
"specified",
"image",
"endpoint",
"using",
"the",
"information",
"in",
"given",
"imageMetadata",
"Returns",
"the",
"reserved",
"Image",
"ID",
"if",
"reservation",
"is",
"successful",
"otherwise",
"returns",
"an",
"er... | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L169-L241 |
24,069 | apcera/libretto | virtualmachine/openstack/util.go | uploadImage | func uploadImage(tokenID string, imageEndpoint string, imageID string, imagePath string, imageApiVersion int) error {
// Read the image file
file, err := os.Open(imagePath)
if err != nil {
return fmt.Errorf("unable to open image file")
}
defer file.Close()
stat, err := file.Stat()
if err != nil {
return fmt... | go | func uploadImage(tokenID string, imageEndpoint string, imageID string, imagePath string, imageApiVersion int) error {
// Read the image file
file, err := os.Open(imagePath)
if err != nil {
return fmt.Errorf("unable to open image file")
}
defer file.Close()
stat, err := file.Stat()
if err != nil {
return fmt... | [
"func",
"uploadImage",
"(",
"tokenID",
"string",
",",
"imageEndpoint",
"string",
",",
"imageID",
"string",
",",
"imagePath",
"string",
",",
"imageApiVersion",
"int",
")",
"error",
"{",
"// Read the image file",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",... | // Uploads the image to an reserved image location at the imageEndpoint using the reserved image ID and imageMetadata.
// Returns nil error if the upload is successful, otherwise returns an error.
// Requires client's token to upload the image. | [
"Uploads",
"the",
"image",
"to",
"an",
"reserved",
"image",
"location",
"at",
"the",
"imageEndpoint",
"using",
"the",
"reserved",
"image",
"ID",
"and",
"imageMetadata",
".",
"Returns",
"nil",
"error",
"if",
"the",
"upload",
"is",
"successful",
"otherwise",
"re... | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L246-L296 |
24,070 | apcera/libretto | virtualmachine/openstack/util.go | createImage | func createImage(vm *VM) (string, error) {
// Get the openstack provider
provider, err := getProviderClient(vm)
if err != nil {
return "", ErrAuthenticatingClient
}
endpointOpts := gophercloud.EndpointOpts{
Region: vm.Region,
}
// Find the Image Endpoint to upload the image
imageEndpoint, err := findImageE... | go | func createImage(vm *VM) (string, error) {
// Get the openstack provider
provider, err := getProviderClient(vm)
if err != nil {
return "", ErrAuthenticatingClient
}
endpointOpts := gophercloud.EndpointOpts{
Region: vm.Region,
}
// Find the Image Endpoint to upload the image
imageEndpoint, err := findImageE... | [
"func",
"createImage",
"(",
"vm",
"*",
"VM",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Get the openstack provider",
"provider",
",",
"err",
":=",
"getProviderClient",
"(",
"vm",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
... | // Creates an Image based on the given FilePath and returns the UUID of the image | [
"Creates",
"an",
"Image",
"based",
"on",
"the",
"given",
"FilePath",
"and",
"returns",
"the",
"UUID",
"of",
"the",
"image"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L299-L334 |
24,071 | apcera/libretto | virtualmachine/openstack/util.go | getServer | func getServer(vm *VM) (*servers.Server, error) {
if vm.InstanceID == "" {
// Probably need to call Provision first.
return nil, ErrNoInstanceID
}
client, err := getComputeClient(vm)
if err != nil {
return nil, err
}
status, err := servers.Get(client, vm.InstanceID).Extract()
if status != nil && err != n... | go | func getServer(vm *VM) (*servers.Server, error) {
if vm.InstanceID == "" {
// Probably need to call Provision first.
return nil, ErrNoInstanceID
}
client, err := getComputeClient(vm)
if err != nil {
return nil, err
}
status, err := servers.Get(client, vm.InstanceID).Extract()
if status != nil && err != n... | [
"func",
"getServer",
"(",
"vm",
"*",
"VM",
")",
"(",
"*",
"servers",
".",
"Server",
",",
"error",
")",
"{",
"if",
"vm",
".",
"InstanceID",
"==",
"\"",
"\"",
"{",
"// Probably need to call Provision first.",
"return",
"nil",
",",
"ErrNoInstanceID",
"\n",
"}... | // getServer returns the Openstack server object for the VM. An error is returned
// if the instance ID is missing, if there was a problem querying Openstack, or if
// there is no instances with the given VM ID. | [
"getServer",
"returns",
"the",
"Openstack",
"server",
"object",
"for",
"the",
"VM",
".",
"An",
"error",
"is",
"returned",
"if",
"the",
"instance",
"ID",
"is",
"missing",
"if",
"there",
"was",
"a",
"problem",
"querying",
"Openstack",
"or",
"if",
"there",
"i... | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L339-L356 |
24,072 | apcera/libretto | virtualmachine/openstack/util.go | findImageEndpoint | func findImageEndpoint(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (string, error) {
eo.ApplyDefaults("image")
url, err := client.EndpointLocator(eo)
if err != nil {
return "", fmt.Errorf("error on locating image endpoint")
}
return url, nil
} | go | func findImageEndpoint(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (string, error) {
eo.ApplyDefaults("image")
url, err := client.EndpointLocator(eo)
if err != nil {
return "", fmt.Errorf("error on locating image endpoint")
}
return url, nil
} | [
"func",
"findImageEndpoint",
"(",
"client",
"*",
"gophercloud",
".",
"ProviderClient",
",",
"eo",
"gophercloud",
".",
"EndpointOpts",
")",
"(",
"string",
",",
"error",
")",
"{",
"eo",
".",
"ApplyDefaults",
"(",
"\"",
"\"",
")",
"\n",
"url",
",",
"err",
"... | // Finds the image endpoint in the given openstack Region. Region is passed within gophercloud.EndpointOpts | [
"Finds",
"the",
"image",
"endpoint",
"in",
"the",
"given",
"openstack",
"Region",
".",
"Region",
"is",
"passed",
"within",
"gophercloud",
".",
"EndpointOpts"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L359-L366 |
24,073 | apcera/libretto | virtualmachine/openstack/util.go | waitUntil | func waitUntil(vm *VM, state string) error {
var curState string
var err error
for i := 0; i < ActionTimeout; i++ {
curState, err = vm.GetState()
if err != nil {
return err
}
if curState == state {
break
}
if curState == lvm.VMError {
return fmt.Errorf("failed to bring the VM to state: %s", st... | go | func waitUntil(vm *VM, state string) error {
var curState string
var err error
for i := 0; i < ActionTimeout; i++ {
curState, err = vm.GetState()
if err != nil {
return err
}
if curState == state {
break
}
if curState == lvm.VMError {
return fmt.Errorf("failed to bring the VM to state: %s", st... | [
"func",
"waitUntil",
"(",
"vm",
"*",
"VM",
",",
"state",
"string",
")",
"error",
"{",
"var",
"curState",
"string",
"\n",
"var",
"err",
"error",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"ActionTimeout",
";",
"i",
"++",
"{",
"curState",
",",
"err"... | // Waits until the given VM becomes in requested state in given ActionTimeout seconds | [
"Waits",
"until",
"the",
"given",
"VM",
"becomes",
"in",
"requested",
"state",
"in",
"given",
"ActionTimeout",
"seconds"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L369-L392 |
24,074 | apcera/libretto | virtualmachine/openstack/util.go | waitUntilSSHReady | func waitUntilSSHReady(vm *VM) error {
client, err := vm.GetSSH(ssh.Options{})
if err != nil {
return err
}
return client.WaitForSSH(SSHTimeout)
} | go | func waitUntilSSHReady(vm *VM) error {
client, err := vm.GetSSH(ssh.Options{})
if err != nil {
return err
}
return client.WaitForSSH(SSHTimeout)
} | [
"func",
"waitUntilSSHReady",
"(",
"vm",
"*",
"VM",
")",
"error",
"{",
"client",
",",
"err",
":=",
"vm",
".",
"GetSSH",
"(",
"ssh",
".",
"Options",
"{",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"cl... | // Waits until the given VM becomes ready. Basically, waits until vm can be sshed. | [
"Waits",
"until",
"the",
"given",
"VM",
"becomes",
"ready",
".",
"Basically",
"waits",
"until",
"vm",
"can",
"be",
"sshed",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L395-L401 |
24,075 | apcera/libretto | virtualmachine/openstack/util.go | createAndAttachVolume | func createAndAttachVolume(vm *VM) error {
if vm.InstanceID == "" {
// Probably need to call Provision first.
return ErrNoInstanceID
}
cClient, err := getComputeClient(vm)
if err != nil {
return fmt.Errorf("compute client is not set for the VM, %s", err)
}
bsClient, err := getBlockStorageClient(vm)
if er... | go | func createAndAttachVolume(vm *VM) error {
if vm.InstanceID == "" {
// Probably need to call Provision first.
return ErrNoInstanceID
}
cClient, err := getComputeClient(vm)
if err != nil {
return fmt.Errorf("compute client is not set for the VM, %s", err)
}
bsClient, err := getBlockStorageClient(vm)
if er... | [
"func",
"createAndAttachVolume",
"(",
"vm",
"*",
"VM",
")",
"error",
"{",
"if",
"vm",
".",
"InstanceID",
"==",
"\"",
"\"",
"{",
"// Probably need to call Provision first.",
"return",
"ErrNoInstanceID",
"\n",
"}",
"\n\n",
"cClient",
",",
"err",
":=",
"getComputeC... | // createAndAttachVolume creates a new volume with the given volume specs and then attaches this volume to the given VM. | [
"createAndAttachVolume",
"creates",
"a",
"new",
"volume",
"with",
"the",
"given",
"volume",
"specs",
"and",
"then",
"attaches",
"this",
"volume",
"to",
"the",
"given",
"VM",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L404-L462 |
24,076 | apcera/libretto | virtualmachine/openstack/util.go | deattachAndDeleteVolume | func deattachAndDeleteVolume(vm *VM) error {
if vm.InstanceID == "" {
// Probably need to call Provision first.
return ErrNoInstanceID
}
cClient, err := getComputeClient(vm)
if err != nil {
return fmt.Errorf("compute client is not set for the VM, %s", err)
}
bsClient, err := getBlockStorageClient(vm)
if ... | go | func deattachAndDeleteVolume(vm *VM) error {
if vm.InstanceID == "" {
// Probably need to call Provision first.
return ErrNoInstanceID
}
cClient, err := getComputeClient(vm)
if err != nil {
return fmt.Errorf("compute client is not set for the VM, %s", err)
}
bsClient, err := getBlockStorageClient(vm)
if ... | [
"func",
"deattachAndDeleteVolume",
"(",
"vm",
"*",
"VM",
")",
"error",
"{",
"if",
"vm",
".",
"InstanceID",
"==",
"\"",
"\"",
"{",
"// Probably need to call Provision first.",
"return",
"ErrNoInstanceID",
"\n",
"}",
"\n\n",
"cClient",
",",
"err",
":=",
"getComput... | // deattachAndDeleteVolume deattaches the volume from the given VM and then completely deletes the volume. | [
"deattachAndDeleteVolume",
"deattaches",
"the",
"volume",
"from",
"the",
"given",
"VM",
"and",
"then",
"completely",
"deletes",
"the",
"volume",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L465-L506 |
24,077 | apcera/libretto | virtualmachine/openstack/util.go | deleteVM | func deleteVM(client *gophercloud.ServiceClient, vmID string) error {
err := servers.Delete(client, vmID).ExtractErr()
if err != nil {
return fmt.Errorf("failed to destroy vm %s: %s", vmID, err)
}
return nil
} | go | func deleteVM(client *gophercloud.ServiceClient, vmID string) error {
err := servers.Delete(client, vmID).ExtractErr()
if err != nil {
return fmt.Errorf("failed to destroy vm %s: %s", vmID, err)
}
return nil
} | [
"func",
"deleteVM",
"(",
"client",
"*",
"gophercloud",
".",
"ServiceClient",
",",
"vmID",
"string",
")",
"error",
"{",
"err",
":=",
"servers",
".",
"Delete",
"(",
"client",
",",
"vmID",
")",
".",
"ExtractErr",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // deleteVM deletes the instance. | [
"deleteVM",
"deletes",
"the",
"instance",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L509-L515 |
24,078 | apcera/libretto | virtualmachine/openstack/util.go | findImageIDByName | func findImageIDByName(client *gophercloud.ServiceClient, imageName string) (string, error) {
if imageName == "" {
return "", fmt.Errorf("empty image name")
}
// We have the option of filtering the image list. If we want the full
// collection, leave it as an empty struct
opts := images.ListOpts{Name: imageName... | go | func findImageIDByName(client *gophercloud.ServiceClient, imageName string) (string, error) {
if imageName == "" {
return "", fmt.Errorf("empty image name")
}
// We have the option of filtering the image list. If we want the full
// collection, leave it as an empty struct
opts := images.ListOpts{Name: imageName... | [
"func",
"findImageIDByName",
"(",
"client",
"*",
"gophercloud",
".",
"ServiceClient",
",",
"imageName",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"imageName",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
... | // findImageIDByName finds the ImageID for the given imageName, returns an error if there is
// no image or more than one image with the given Image Name. | [
"findImageIDByName",
"finds",
"the",
"ImageID",
"for",
"the",
"given",
"imageName",
"returns",
"an",
"error",
"if",
"there",
"is",
"no",
"image",
"or",
"more",
"than",
"one",
"image",
"with",
"the",
"given",
"Image",
"Name",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L519-L548 |
24,079 | apcera/libretto | virtualmachine/openstack/util.go | waitUntilVolume | func waitUntilVolume(blockStorateClient *gophercloud.ServiceClient, volumeID string, state string) error {
for i := 0; i < VolumeActionTimeout; i++ {
vol, err := volumes.Get(blockStorateClient, volumeID).Extract()
switch {
case vol == nil && state == "nil":
return nil
case vol == nil || err != nil:
retur... | go | func waitUntilVolume(blockStorateClient *gophercloud.ServiceClient, volumeID string, state string) error {
for i := 0; i < VolumeActionTimeout; i++ {
vol, err := volumes.Get(blockStorateClient, volumeID).Extract()
switch {
case vol == nil && state == "nil":
return nil
case vol == nil || err != nil:
retur... | [
"func",
"waitUntilVolume",
"(",
"blockStorateClient",
"*",
"gophercloud",
".",
"ServiceClient",
",",
"volumeID",
"string",
",",
"state",
"string",
")",
"error",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"VolumeActionTimeout",
";",
"i",
"++",
"{",
"vol",
"... | // waitUntilVolume waits until the given volume turns into given state under given VolumeActionTimeout seconds | [
"waitUntilVolume",
"waits",
"until",
"the",
"given",
"volume",
"turns",
"into",
"given",
"state",
"under",
"given",
"VolumeActionTimeout",
"seconds"
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/openstack/util.go#L551-L567 |
24,080 | apcera/libretto | virtualmachine/aws/util.go | ValidCredentials | func ValidCredentials(region string) error {
svc, err := getService(region)
if err != nil {
return fmt.Errorf("failed to get AWS service: %v", err)
}
_, err = svc.DescribeInstances(nil)
awsErr, isAWS := err.(awserr.Error)
if !isAWS {
return err
}
switch awsErr.Code() {
case noCredsCode:
return ErrNoCre... | go | func ValidCredentials(region string) error {
svc, err := getService(region)
if err != nil {
return fmt.Errorf("failed to get AWS service: %v", err)
}
_, err = svc.DescribeInstances(nil)
awsErr, isAWS := err.(awserr.Error)
if !isAWS {
return err
}
switch awsErr.Code() {
case noCredsCode:
return ErrNoCre... | [
"func",
"ValidCredentials",
"(",
"region",
"string",
")",
"error",
"{",
"svc",
",",
"err",
":=",
"getService",
"(",
"region",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n... | // ValidCredentials sends a dummy request to AWS to check if credentials are
// valid. An error is returned if credentials are missing or region is missing. | [
"ValidCredentials",
"sends",
"a",
"dummy",
"request",
"to",
"AWS",
"to",
"check",
"if",
"credentials",
"are",
"valid",
".",
"An",
"error",
"is",
"returned",
"if",
"credentials",
"are",
"missing",
"or",
"region",
"is",
"missing",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/util.go#L36-L56 |
24,081 | apcera/libretto | virtualmachine/aws/util.go | UploadKeyPair | func UploadKeyPair(publicKey []byte, name string, region string) error {
svc, err := getService(region)
if err != nil {
return fmt.Errorf("failed to get AWS service: %v", err)
}
_, err = svc.ImportKeyPair(&ec2.ImportKeyPairInput{
KeyName: aws.String(name),
PublicKeyMaterial: publicKey,
DryRun: ... | go | func UploadKeyPair(publicKey []byte, name string, region string) error {
svc, err := getService(region)
if err != nil {
return fmt.Errorf("failed to get AWS service: %v", err)
}
_, err = svc.ImportKeyPair(&ec2.ImportKeyPairInput{
KeyName: aws.String(name),
PublicKeyMaterial: publicKey,
DryRun: ... | [
"func",
"UploadKeyPair",
"(",
"publicKey",
"[",
"]",
"byte",
",",
"name",
"string",
",",
"region",
"string",
")",
"error",
"{",
"svc",
",",
"err",
":=",
"getService",
"(",
"region",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Err... | // UploadKeyPair uploads the public key to AWS with a given name.
// If the public key already exists, then no error is returned. | [
"UploadKeyPair",
"uploads",
"the",
"public",
"key",
"to",
"AWS",
"with",
"a",
"given",
"name",
".",
"If",
"the",
"public",
"key",
"already",
"exists",
"then",
"no",
"error",
"is",
"returned",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/util.go#L247-L267 |
24,082 | apcera/libretto | virtualmachine/aws/util.go | DeleteKeyPair | func DeleteKeyPair(name string, region string) error {
svc, err := getService(region)
if err != nil {
return fmt.Errorf("failed to get AWS service: %v", err)
}
if name == "" {
return errors.New("Missing key pair name")
}
_, err = svc.DeleteKeyPair(&ec2.DeleteKeyPairInput{
KeyName: aws.String(name),
DryR... | go | func DeleteKeyPair(name string, region string) error {
svc, err := getService(region)
if err != nil {
return fmt.Errorf("failed to get AWS service: %v", err)
}
if name == "" {
return errors.New("Missing key pair name")
}
_, err = svc.DeleteKeyPair(&ec2.DeleteKeyPairInput{
KeyName: aws.String(name),
DryR... | [
"func",
"DeleteKeyPair",
"(",
"name",
"string",
",",
"region",
"string",
")",
"error",
"{",
"svc",
",",
"err",
":=",
"getService",
"(",
"region",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
... | // DeleteKeyPair deletes the given key pair from the given region. | [
"DeleteKeyPair",
"deletes",
"the",
"given",
"key",
"pair",
"from",
"the",
"given",
"region",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/aws/util.go#L270-L289 |
24,083 | apcera/libretto | virtualmachine/virtualbox/util.go | getBridgedDeviceKV | func getBridgedDeviceKV(keyname, propname string) ([]ifKeyValue, error) {
kvs := []ifKeyValue{}
if keyname == "" || propname == "" {
return kvs, nil
}
stdout, _, err := runner.Run("list", "bridgedifs")
if err != nil {
return kvs, err
}
matches := networkRegexp.FindAllString(stdout, -1)
if len(matches) < 1 ... | go | func getBridgedDeviceKV(keyname, propname string) ([]ifKeyValue, error) {
kvs := []ifKeyValue{}
if keyname == "" || propname == "" {
return kvs, nil
}
stdout, _, err := runner.Run("list", "bridgedifs")
if err != nil {
return kvs, err
}
matches := networkRegexp.FindAllString(stdout, -1)
if len(matches) < 1 ... | [
"func",
"getBridgedDeviceKV",
"(",
"keyname",
",",
"propname",
"string",
")",
"(",
"[",
"]",
"ifKeyValue",
",",
"error",
")",
"{",
"kvs",
":=",
"[",
"]",
"ifKeyValue",
"{",
"}",
"\n",
"if",
"keyname",
"==",
"\"",
"\"",
"||",
"propname",
"==",
"\"",
"... | // getBridgedDeviceKV returns a list of key and value pairs of chosen key and value names
// from VBoxManage list bridgedifs results. | [
"getBridgedDeviceKV",
"returns",
"a",
"list",
"of",
"key",
"and",
"value",
"pairs",
"of",
"chosen",
"key",
"and",
"value",
"names",
"from",
"VBoxManage",
"list",
"bridgedifs",
"results",
"."
] | 3178799fbb1e39c74b02e3ecf46330b3ef0ed486 | https://github.com/apcera/libretto/blob/3178799fbb1e39c74b02e3ecf46330b3ef0ed486/virtualmachine/virtualbox/util.go#L21-L55 |
24,084 | 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 |
24,085 | 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 |
24,086 | 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 |
24,087 | 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 |
24,088 | 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 |
24,089 | 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 |
24,090 | 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 |
24,091 | 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 |
24,092 | 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 |
24,093 | 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 |
24,094 | 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 |
24,095 | 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 |
24,096 | 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 |
24,097 | 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 |
24,098 | 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 |
24,099 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.