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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
20,800 | deis/deis | client/cmd/auth.go | Whoami | func Whoami() error {
c, err := client.New()
if err != nil {
return err
}
fmt.Printf("You are %s at %s\n", c.Username, c.ControllerURL.String())
return nil
} | go | func Whoami() error {
c, err := client.New()
if err != nil {
return err
}
fmt.Printf("You are %s at %s\n", c.Username, c.ControllerURL.String())
return nil
} | [
"func",
"Whoami",
"(",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"c",
".",
"Username",... | // Whoami prints the logged in user. | [
"Whoami",
"prints",
"the",
"logged",
"in",
"user",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/auth.go#L266-L275 |
20,801 | deis/deis | client/cmd/auth.go | Regenerate | func Regenerate(username string, all bool) error {
c, err := client.New()
if err != nil {
return err
}
token, err := auth.Regenerate(c, username, all)
if err != nil {
return err
}
if username == "" && all == false {
c.Token = token
err = c.Save()
if err != nil {
return err
}
}
fmt.Println... | go | func Regenerate(username string, all bool) error {
c, err := client.New()
if err != nil {
return err
}
token, err := auth.Regenerate(c, username, all)
if err != nil {
return err
}
if username == "" && all == false {
c.Token = token
err = c.Save()
if err != nil {
return err
}
}
fmt.Println... | [
"func",
"Regenerate",
"(",
"username",
"string",
",",
"all",
"bool",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"token",
",",
"err",
":=",
"... | // Regenerate regenenerates a user's token. | [
"Regenerate",
"regenenerates",
"a",
"user",
"s",
"token",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/auth.go#L278-L303 |
20,802 | deis/deis | client/cmd/certs.go | CertsList | func CertsList(results int) error {
c, err := client.New()
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
certList, _, err := certs.List(c, results)
if err != nil {
return err
}
if len(certList) == 0 {
fmt.Println("No certs")
return nil
}
certMap := make... | go | func CertsList(results int) error {
c, err := client.New()
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
certList, _, err := certs.List(c, results)
if err != nil {
return err
}
if len(certList) == 0 {
fmt.Println("No certs")
return nil
}
certMap := make... | [
"func",
"CertsList",
"(",
"results",
"int",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"results",
"==",
"defaultLimit",
"{",
"results",
... | // CertsList lists certs registered with the controller. | [
"CertsList",
"lists",
"certs",
"registered",
"with",
"the",
"controller",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/certs.go#L15-L72 |
20,803 | deis/deis | client/cmd/certs.go | CertAdd | func CertAdd(cert, key, commonName, sans string) error {
c, err := client.New()
if err != nil {
return err
}
fmt.Print("Adding SSL endpoint... ")
quit := progress()
err = processCertsAdd(c, cert, key, commonName, sans)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Println("done")
return nil
} | go | func CertAdd(cert, key, commonName, sans string) error {
c, err := client.New()
if err != nil {
return err
}
fmt.Print("Adding SSL endpoint... ")
quit := progress()
err = processCertsAdd(c, cert, key, commonName, sans)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Println("done")
return nil
} | [
"func",
"CertAdd",
"(",
"cert",
",",
"key",
",",
"commonName",
",",
"sans",
"string",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fmt",
".",... | // CertAdd adds a cert to the controller. | [
"CertAdd",
"adds",
"a",
"cert",
"to",
"the",
"controller",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/certs.go#L75-L94 |
20,804 | deis/deis | client/cmd/certs.go | CertRemove | func CertRemove(commonName string) error {
c, err := client.New()
if err != nil {
return err
}
fmt.Printf("Removing %s... ", commonName)
quit := progress()
certs.Delete(c, commonName)
quit <- true
<-quit
if err == nil {
fmt.Println("done")
}
return err
} | go | func CertRemove(commonName string) error {
c, err := client.New()
if err != nil {
return err
}
fmt.Printf("Removing %s... ", commonName)
quit := progress()
certs.Delete(c, commonName)
quit <- true
<-quit
if err == nil {
fmt.Println("done")
}
return err
} | [
"func",
"CertRemove",
"(",
"commonName",
"string",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
",",
"c... | // CertRemove deletes a cert from the controller. | [
"CertRemove",
"deletes",
"a",
"cert",
"from",
"the",
"controller",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/certs.go#L127-L147 |
20,805 | deis/deis | deisctl/backend/fleet/ssh.go | SSH | func (c *FleetClient) SSH(name string) error {
sshClient, _, err := c.sshConnect(name)
if err != nil {
return err
}
defer sshClient.Close()
err = ssh.Shell(sshClient)
return err
} | go | func (c *FleetClient) SSH(name string) error {
sshClient, _, err := c.sshConnect(name)
if err != nil {
return err
}
defer sshClient.Close()
err = ssh.Shell(sshClient)
return err
} | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"SSH",
"(",
"name",
"string",
")",
"error",
"{",
"sshClient",
",",
"_",
",",
"err",
":=",
"c",
".",
"sshConnect",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n"... | // SSH opens an interactive shell to a machine in the cluster | [
"SSH",
"opens",
"an",
"interactive",
"shell",
"to",
"a",
"machine",
"in",
"the",
"cluster"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/ssh.go#L16-L25 |
20,806 | deis/deis | deisctl/backend/fleet/ssh.go | findUnit | func (c *FleetClient) findUnit(name string) (machID string, err error) {
u, err := c.Fleet.Unit(name)
switch {
case err != nil:
return "", fmt.Errorf("Error retrieving Unit %s: %v", name, err)
case suToGlobal(*u):
return "", fmt.Errorf("Unable to connect to global unit %s.\n", name)
case u == nil:
return "",... | go | func (c *FleetClient) findUnit(name string) (machID string, err error) {
u, err := c.Fleet.Unit(name)
switch {
case err != nil:
return "", fmt.Errorf("Error retrieving Unit %s: %v", name, err)
case suToGlobal(*u):
return "", fmt.Errorf("Unable to connect to global unit %s.\n", name)
case u == nil:
return "",... | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"findUnit",
"(",
"name",
"string",
")",
"(",
"machID",
"string",
",",
"err",
"error",
")",
"{",
"u",
",",
"err",
":=",
"c",
".",
"Fleet",
".",
"Unit",
"(",
"name",
")",
"\n",
"switch",
"{",
"case",
"err"... | // findUnits returns the machine ID of a running unit | [
"findUnits",
"returns",
"the",
"machine",
"ID",
"of",
"a",
"running",
"unit"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/ssh.go#L152-L166 |
20,807 | deis/deis | client/cmd/perms.go | PermsList | func PermsList(appID string, admin bool, results int) error {
c, appID, err := permsLoad(appID, admin)
if err != nil {
return err
}
var users []string
var count int
if admin {
if results == defaultLimit {
results = c.ResponseLimit
}
users, count, err = perms.ListAdmins(c, results)
} else {
users,... | go | func PermsList(appID string, admin bool, results int) error {
c, appID, err := permsLoad(appID, admin)
if err != nil {
return err
}
var users []string
var count int
if admin {
if results == defaultLimit {
results = c.ResponseLimit
}
users, count, err = perms.ListAdmins(c, results)
} else {
users,... | [
"func",
"PermsList",
"(",
"appID",
"string",
",",
"admin",
"bool",
",",
"results",
"int",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"permsLoad",
"(",
"appID",
",",
"admin",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
... | // PermsList prints which users have permissions. | [
"PermsList",
"prints",
"which",
"users",
"have",
"permissions",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/perms.go#L13-L49 |
20,808 | deis/deis | client/cmd/perms.go | PermCreate | func PermCreate(appID string, username string, admin bool) error {
c, appID, err := permsLoad(appID, admin)
if err != nil {
return err
}
if admin {
fmt.Printf("Adding %s to system administrators... ", username)
err = perms.NewAdmin(c, username)
} else {
fmt.Printf("Adding %s to %s collaborators... ", us... | go | func PermCreate(appID string, username string, admin bool) error {
c, appID, err := permsLoad(appID, admin)
if err != nil {
return err
}
if admin {
fmt.Printf("Adding %s to system administrators... ", username)
err = perms.NewAdmin(c, username)
} else {
fmt.Printf("Adding %s to %s collaborators... ", us... | [
"func",
"PermCreate",
"(",
"appID",
"string",
",",
"username",
"string",
",",
"admin",
"bool",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"permsLoad",
"(",
"appID",
",",
"admin",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err... | // PermCreate adds a user to an app or makes them an administrator. | [
"PermCreate",
"adds",
"a",
"user",
"to",
"an",
"app",
"or",
"makes",
"them",
"an",
"administrator",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/perms.go#L52-L75 |
20,809 | deis/deis | client/cmd/perms.go | PermDelete | func PermDelete(appID string, username string, admin bool) error {
c, appID, err := permsLoad(appID, admin)
if err != nil {
return err
}
if admin {
fmt.Printf("Removing %s from system administrators... ", username)
err = perms.DeleteAdmin(c, username)
} else {
fmt.Printf("Removing %s from %s collaborato... | go | func PermDelete(appID string, username string, admin bool) error {
c, appID, err := permsLoad(appID, admin)
if err != nil {
return err
}
if admin {
fmt.Printf("Removing %s from system administrators... ", username)
err = perms.DeleteAdmin(c, username)
} else {
fmt.Printf("Removing %s from %s collaborato... | [
"func",
"PermDelete",
"(",
"appID",
"string",
",",
"username",
"string",
",",
"admin",
"bool",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"permsLoad",
"(",
"appID",
",",
"admin",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err... | // PermDelete removes a user from an app or revokes admin privilages. | [
"PermDelete",
"removes",
"a",
"user",
"from",
"an",
"app",
"or",
"revokes",
"admin",
"privilages",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/perms.go#L78-L101 |
20,810 | deis/deis | logger/storage/file/adapter.go | NewStorageAdapter | func NewStorageAdapter(logRoot string) (*adapter, error) {
src, err := os.Stat(logRoot)
if err != nil {
return nil, fmt.Errorf("Directory %s does not exist", logRoot)
}
if !src.IsDir() {
return nil, fmt.Errorf("%s is not a directory", logRoot)
}
return &adapter{logRoot: logRoot, files: make(map[string]*os.Fil... | go | func NewStorageAdapter(logRoot string) (*adapter, error) {
src, err := os.Stat(logRoot)
if err != nil {
return nil, fmt.Errorf("Directory %s does not exist", logRoot)
}
if !src.IsDir() {
return nil, fmt.Errorf("%s is not a directory", logRoot)
}
return &adapter{logRoot: logRoot, files: make(map[string]*os.Fil... | [
"func",
"NewStorageAdapter",
"(",
"logRoot",
"string",
")",
"(",
"*",
"adapter",
",",
"error",
")",
"{",
"src",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"logRoot",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf... | // NewStorageAdapter returns a pointer to a new instance of a file-based storage.Adapter. | [
"NewStorageAdapter",
"returns",
"a",
"pointer",
"to",
"a",
"new",
"instance",
"of",
"a",
"file",
"-",
"based",
"storage",
".",
"Adapter",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/storage/file/adapter.go#L20-L29 |
20,811 | deis/deis | logger/storage/file/adapter.go | Write | func (a *adapter) Write(app string, message string) error {
// Check first if we might actually have to add to the map of file pointers so we can avoid
// waiting for / obtaining a lock unnecessarily
f, ok := a.files[app]
if !ok {
// Ensure only one goroutine at a time can be adding a file pointer to the map of f... | go | func (a *adapter) Write(app string, message string) error {
// Check first if we might actually have to add to the map of file pointers so we can avoid
// waiting for / obtaining a lock unnecessarily
f, ok := a.files[app]
if !ok {
// Ensure only one goroutine at a time can be adding a file pointer to the map of f... | [
"func",
"(",
"a",
"*",
"adapter",
")",
"Write",
"(",
"app",
"string",
",",
"message",
"string",
")",
"error",
"{",
"// Check first if we might actually have to add to the map of file pointers so we can avoid",
"// waiting for / obtaining a lock unnecessarily",
"f",
",",
"ok",... | // Write adds a log message to to an app-specific log file | [
"Write",
"adds",
"a",
"log",
"message",
"to",
"to",
"an",
"app",
"-",
"specific",
"log",
"file"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/storage/file/adapter.go#L32-L55 |
20,812 | deis/deis | logger/storage/file/adapter.go | Read | func (a *adapter) Read(app string, lines int) ([]string, error) {
if lines <= 0 {
return []string{}, nil
}
filePath := a.getFilePath(app)
exists, err := fileExists(filePath)
if err != nil {
return nil, err
}
if !exists {
return nil, fmt.Errorf("Could not find logs for '%s'", app)
}
logBytes, err := exec.... | go | func (a *adapter) Read(app string, lines int) ([]string, error) {
if lines <= 0 {
return []string{}, nil
}
filePath := a.getFilePath(app)
exists, err := fileExists(filePath)
if err != nil {
return nil, err
}
if !exists {
return nil, fmt.Errorf("Could not find logs for '%s'", app)
}
logBytes, err := exec.... | [
"func",
"(",
"a",
"*",
"adapter",
")",
"Read",
"(",
"app",
"string",
",",
"lines",
"int",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"lines",
"<=",
"0",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n"... | // Read retrieves a specified number of log lines from an app-specific log file | [
"Read",
"retrieves",
"a",
"specified",
"number",
"of",
"log",
"lines",
"from",
"an",
"app",
"-",
"specific",
"log",
"file"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/storage/file/adapter.go#L58-L76 |
20,813 | deis/deis | client/parser/perms.go | Perms | func Perms(argv []string) error {
usage := `
Valid commands for perms:
perms:list list permissions granted on an app
perms:create create a new permission for a user
perms:delete delete a permission for a user
Use 'deis help perms:[command]' to learn more.
`
switch argv[0] {
case "perms... | go | func Perms(argv []string) error {
usage := `
Valid commands for perms:
perms:list list permissions granted on an app
perms:create create a new permission for a user
perms:delete delete a permission for a user
Use 'deis help perms:[command]' to learn more.
`
switch argv[0] {
case "perms... | [
"func",
"Perms",
"(",
"argv",
"[",
"]",
"string",
")",
"error",
"{",
"usage",
":=",
"`\nValid commands for perms:\n\nperms:list list permissions granted on an app\nperms:create create a new permission for a user\nperms:delete delete a permission for a user\n\nUse... | // Perms routes perms commands to their specific function. | [
"Perms",
"routes",
"perms",
"commands",
"to",
"their",
"specific",
"function",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/perms.go#L9-L39 |
20,814 | deis/deis | client/parser/keys.go | Keys | func Keys(argv []string) error {
usage := `
Valid commands for SSH keys:
keys:list list SSH keys for the logged in user
keys:add add an SSH key
keys:remove remove an SSH key
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "keys:list":
return keysList(argv)
case "keys:add":
... | go | func Keys(argv []string) error {
usage := `
Valid commands for SSH keys:
keys:list list SSH keys for the logged in user
keys:add add an SSH key
keys:remove remove an SSH key
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "keys:list":
return keysList(argv)
case "keys:add":
... | [
"func",
"Keys",
"(",
"argv",
"[",
"]",
"string",
")",
"error",
"{",
"usage",
":=",
"`\nValid commands for SSH keys:\n\nkeys:list list SSH keys for the logged in user\nkeys:add add an SSH key\nkeys:remove remove an SSH key\n\nUse 'deis help [command]' to learn more.\n`",
... | // Keys routes key commands to the specific function. | [
"Keys",
"routes",
"key",
"commands",
"to",
"the",
"specific",
"function",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/keys.go#L9-L40 |
20,815 | deis/deis | client/cmd/limits.go | LimitsList | func LimitsList(appID string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
config, err := config.List(c, appID)
fmt.Printf("=== %s Limits\n\n", appID)
fmt.Println("--- Memory")
if len(config.Memory) == 0 {
fmt.Println("Unlimited")
} else {
memoryMap := make(map[string]string)
f... | go | func LimitsList(appID string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
config, err := config.List(c, appID)
fmt.Printf("=== %s Limits\n\n", appID)
fmt.Println("--- Memory")
if len(config.Memory) == 0 {
fmt.Println("Unlimited")
} else {
memoryMap := make(map[string]string)
f... | [
"func",
"LimitsList",
"(",
"appID",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"config",
",",
"err",
":=",
"config",
".",
... | // LimitsList lists an app's limits. | [
"LimitsList",
"lists",
"an",
"app",
"s",
"limits",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/limits.go#L15-L53 |
20,816 | deis/deis | client/cmd/limits.go | LimitsSet | func LimitsSet(appID string, limits []string, limitType string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
limitsMap := parseLimits(limits)
fmt.Print("Applying limits... ")
quit := progress()
configObj := api.Config{}
if limitType == "cpu" {
configObj.CPU = limitsMap
} else {
... | go | func LimitsSet(appID string, limits []string, limitType string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
limitsMap := parseLimits(limits)
fmt.Print("Applying limits... ")
quit := progress()
configObj := api.Config{}
if limitType == "cpu" {
configObj.CPU = limitsMap
} else {
... | [
"func",
"LimitsSet",
"(",
"appID",
"string",
",",
"limits",
"[",
"]",
"string",
",",
"limitType",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"... | // LimitsSet sets an app's limits. | [
"LimitsSet",
"sets",
"an",
"app",
"s",
"limits",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/limits.go#L56-L88 |
20,817 | deis/deis | client/cmd/limits.go | LimitsUnset | func LimitsUnset(appID string, limits []string, limitType string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
fmt.Print("Applying limits... ")
quit := progress()
configObj := api.Config{}
valuesMap := make(map[string]interface{})
for _, limit := range limits {
valuesMap[limit] = ... | go | func LimitsUnset(appID string, limits []string, limitType string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
fmt.Print("Applying limits... ")
quit := progress()
configObj := api.Config{}
valuesMap := make(map[string]interface{})
for _, limit := range limits {
valuesMap[limit] = ... | [
"func",
"LimitsUnset",
"(",
"appID",
"string",
",",
"limits",
"[",
"]",
"string",
",",
"limitType",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
... | // LimitsUnset removes an app's limits. | [
"LimitsUnset",
"removes",
"an",
"app",
"s",
"limits",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/limits.go#L91-L128 |
20,818 | deis/deis | client/controller/models/auth/auth.go | Register | func Register(c *client.Client, username, password, email string) error {
user := api.AuthRegisterRequest{Username: username, Password: password, Email: email}
body, err := json.Marshal(user)
if err != nil {
return err
}
_, err = c.BasicRequest("POST", "/v1/auth/register/", body)
return err
} | go | func Register(c *client.Client, username, password, email string) error {
user := api.AuthRegisterRequest{Username: username, Password: password, Email: email}
body, err := json.Marshal(user)
if err != nil {
return err
}
_, err = c.BasicRequest("POST", "/v1/auth/register/", body)
return err
} | [
"func",
"Register",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"username",
",",
"password",
",",
"email",
"string",
")",
"error",
"{",
"user",
":=",
"api",
".",
"AuthRegisterRequest",
"{",
"Username",
":",
"username",
",",
"Password",
":",
"password",
... | // Register a new user with the controller. | [
"Register",
"a",
"new",
"user",
"with",
"the",
"controller",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/auth/auth.go#L11-L21 |
20,819 | deis/deis | client/controller/models/auth/auth.go | Regenerate | func Regenerate(c *client.Client, username string, all bool) (string, error) {
var reqBody []byte
var err error
if all == true {
reqBody, err = json.Marshal(api.AuthRegenerateRequest{All: all})
} else if username != "" {
reqBody, err = json.Marshal(api.AuthRegenerateRequest{Name: username})
}
if err != nil ... | go | func Regenerate(c *client.Client, username string, all bool) (string, error) {
var reqBody []byte
var err error
if all == true {
reqBody, err = json.Marshal(api.AuthRegenerateRequest{All: all})
} else if username != "" {
reqBody, err = json.Marshal(api.AuthRegenerateRequest{Name: username})
}
if err != nil ... | [
"func",
"Regenerate",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"username",
"string",
",",
"all",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"reqBody",
"[",
"]",
"byte",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"all",
"==",
"tr... | // Regenerate user's auth tokens. | [
"Regenerate",
"user",
"s",
"auth",
"tokens",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/auth/auth.go#L65-L95 |
20,820 | deis/deis | client/controller/models/apps/apps.go | List | func List(c *client.Client, results int) (api.Apps, int, error) {
body, count, err := c.LimitedRequest("/v1/apps/", results)
if err != nil {
return []api.App{}, -1, err
}
var apps []api.App
if err = json.Unmarshal([]byte(body), &apps); err != nil {
return []api.App{}, -1, err
}
return apps, count, nil
} | go | func List(c *client.Client, results int) (api.Apps, int, error) {
body, count, err := c.LimitedRequest("/v1/apps/", results)
if err != nil {
return []api.App{}, -1, err
}
var apps []api.App
if err = json.Unmarshal([]byte(body), &apps); err != nil {
return []api.App{}, -1, err
}
return apps, count, nil
} | [
"func",
"List",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"results",
"int",
")",
"(",
"api",
".",
"Apps",
",",
"int",
",",
"error",
")",
"{",
"body",
",",
"count",
",",
"err",
":=",
"c",
".",
"LimitedRequest",
"(",
"\"",
"\"",
",",
"results",
... | // List lists apps on a Deis controller. | [
"List",
"lists",
"apps",
"on",
"a",
"Deis",
"controller",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/apps/apps.go#L14-L27 |
20,821 | deis/deis | client/controller/models/apps/apps.go | New | func New(c *client.Client, id string) (api.App, error) {
body := []byte{}
var err error
if id != "" {
req := api.AppCreateRequest{ID: id}
body, err = json.Marshal(req)
if err != nil {
return api.App{}, err
}
}
resBody, err := c.BasicRequest("POST", "/v1/apps/", body)
if err != nil {
return api.Ap... | go | func New(c *client.Client, id string) (api.App, error) {
body := []byte{}
var err error
if id != "" {
req := api.AppCreateRequest{ID: id}
body, err = json.Marshal(req)
if err != nil {
return api.App{}, err
}
}
resBody, err := c.BasicRequest("POST", "/v1/apps/", body)
if err != nil {
return api.Ap... | [
"func",
"New",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"id",
"string",
")",
"(",
"api",
".",
"App",
",",
"error",
")",
"{",
"body",
":=",
"[",
"]",
"byte",
"{",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"if",
"id",
"!=",
"\"",
"\"",
"{",... | // New creates a new app. | [
"New",
"creates",
"a",
"new",
"app",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/apps/apps.go#L30-L55 |
20,822 | deis/deis | client/controller/models/apps/apps.go | Get | func Get(c *client.Client, appID string) (api.App, error) {
u := fmt.Sprintf("/v1/apps/%s/", appID)
body, err := c.BasicRequest("GET", u, nil)
if err != nil {
return api.App{}, err
}
app := api.App{}
if err = json.Unmarshal([]byte(body), &app); err != nil {
return api.App{}, err
}
return app, nil
} | go | func Get(c *client.Client, appID string) (api.App, error) {
u := fmt.Sprintf("/v1/apps/%s/", appID)
body, err := c.BasicRequest("GET", u, nil)
if err != nil {
return api.App{}, err
}
app := api.App{}
if err = json.Unmarshal([]byte(body), &app); err != nil {
return api.App{}, err
}
return app, nil
} | [
"func",
"Get",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"appID",
"string",
")",
"(",
"api",
".",
"App",
",",
"error",
")",
"{",
"u",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
")",
"\n\n",
"body",
",",
"err",
":=",
"c",
"... | // Get app details from a Deis controller. | [
"Get",
"app",
"details",
"from",
"a",
"Deis",
"controller",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/apps/apps.go#L58-L74 |
20,823 | deis/deis | client/controller/models/apps/apps.go | Logs | func Logs(c *client.Client, appID string, lines int) (string, error) {
u := fmt.Sprintf("/v1/apps/%s/logs", appID)
if lines > 0 {
u += "?log_lines=" + strconv.Itoa(lines)
}
body, err := c.BasicRequest("GET", u, nil)
if err != nil {
return "", err
}
return strings.Trim(body, `"`), nil
} | go | func Logs(c *client.Client, appID string, lines int) (string, error) {
u := fmt.Sprintf("/v1/apps/%s/logs", appID)
if lines > 0 {
u += "?log_lines=" + strconv.Itoa(lines)
}
body, err := c.BasicRequest("GET", u, nil)
if err != nil {
return "", err
}
return strings.Trim(body, `"`), nil
} | [
"func",
"Logs",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"appID",
"string",
",",
"lines",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"u",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
")",
"\n\n",
"if",
"lines",
">",
"... | // Logs retrieves logs from an app. | [
"Logs",
"retrieves",
"logs",
"from",
"an",
"app",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/apps/apps.go#L77-L91 |
20,824 | deis/deis | client/controller/models/apps/apps.go | Run | func Run(c *client.Client, appID string, command string) (api.AppRunResponse, error) {
req := api.AppRunRequest{Command: command}
body, err := json.Marshal(req)
if err != nil {
return api.AppRunResponse{}, err
}
u := fmt.Sprintf("/v1/apps/%s/run", appID)
resBody, err := c.BasicRequest("POST", u, body)
if e... | go | func Run(c *client.Client, appID string, command string) (api.AppRunResponse, error) {
req := api.AppRunRequest{Command: command}
body, err := json.Marshal(req)
if err != nil {
return api.AppRunResponse{}, err
}
u := fmt.Sprintf("/v1/apps/%s/run", appID)
resBody, err := c.BasicRequest("POST", u, body)
if e... | [
"func",
"Run",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"appID",
"string",
",",
"command",
"string",
")",
"(",
"api",
".",
"AppRunResponse",
",",
"error",
")",
"{",
"req",
":=",
"api",
".",
"AppRunRequest",
"{",
"Command",
":",
"command",
"}",
"\... | // Run one time command in an app. | [
"Run",
"one",
"time",
"command",
"in",
"an",
"app",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/apps/apps.go#L94-L117 |
20,825 | deis/deis | deisctl/backend/fleet/fleet.go | NewClient | func NewClient(cb config.Backend) (*FleetClient, error) {
client, err := getRegistryClient()
if err != nil {
return nil, err
}
// path hierarchy for finding systemd service templates
templatePaths := []string{
os.Getenv("DEISCTL_UNITS"),
path.Join(os.Getenv("HOME"), ".deis", "units"),
"/var/lib/deis/units... | go | func NewClient(cb config.Backend) (*FleetClient, error) {
client, err := getRegistryClient()
if err != nil {
return nil, err
}
// path hierarchy for finding systemd service templates
templatePaths := []string{
os.Getenv("DEISCTL_UNITS"),
path.Join(os.Getenv("HOME"), ".deis", "units"),
"/var/lib/deis/units... | [
"func",
"NewClient",
"(",
"cb",
"config",
".",
"Backend",
")",
"(",
"*",
"FleetClient",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"getRegistryClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
... | // NewClient returns a client used to communicate with Fleet
// using the Registry API | [
"NewClient",
"returns",
"a",
"client",
"used",
"to",
"communicate",
"with",
"Fleet",
"using",
"the",
"Registry",
"API"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/fleet.go#L31-L49 |
20,826 | deis/deis | publisher/server/publisher.go | New | func New(dockerClient *docker.Client, etcdClient *etcd.Client, host, logLevel string) *Server {
return &Server{
DockerClient: dockerClient,
EtcdClient: etcdClient,
host: host,
logLevel: logLevel,
}
} | go | func New(dockerClient *docker.Client, etcdClient *etcd.Client, host, logLevel string) *Server {
return &Server{
DockerClient: dockerClient,
EtcdClient: etcdClient,
host: host,
logLevel: logLevel,
}
} | [
"func",
"New",
"(",
"dockerClient",
"*",
"docker",
".",
"Client",
",",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"host",
",",
"logLevel",
"string",
")",
"*",
"Server",
"{",
"return",
"&",
"Server",
"{",
"DockerClient",
":",
"dockerClient",
",",
"Etc... | // New returns a new instance of Server. | [
"New",
"returns",
"a",
"new",
"instance",
"of",
"Server",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L37-L44 |
20,827 | deis/deis | publisher/server/publisher.go | Listen | func (s *Server) Listen(ttl time.Duration) {
listener := make(chan *docker.APIEvents)
// TODO: figure out why we need to sleep for 10 milliseconds
// https://github.com/fsouza/go-dockerclient/blob/0236a64c6c4bd563ec277ba00e370cc753e1677c/event_test.go#L43
defer func() { time.Sleep(10 * time.Millisecond); s.DockerCl... | go | func (s *Server) Listen(ttl time.Duration) {
listener := make(chan *docker.APIEvents)
// TODO: figure out why we need to sleep for 10 milliseconds
// https://github.com/fsouza/go-dockerclient/blob/0236a64c6c4bd563ec277ba00e370cc753e1677c/event_test.go#L43
defer func() { time.Sleep(10 * time.Millisecond); s.DockerCl... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Listen",
"(",
"ttl",
"time",
".",
"Duration",
")",
"{",
"listener",
":=",
"make",
"(",
"chan",
"*",
"docker",
".",
"APIEvents",
")",
"\n",
"// TODO: figure out why we need to sleep for 10 milliseconds",
"// https://github.com... | // Listen adds an event listener to the docker client and publishes containers that were started. | [
"Listen",
"adds",
"an",
"event",
"listener",
"to",
"the",
"docker",
"client",
"and",
"publishes",
"containers",
"that",
"were",
"started",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L47-L70 |
20,828 | deis/deis | publisher/server/publisher.go | Poll | func (s *Server) Poll(ttl time.Duration) {
containers, err := s.DockerClient.ListContainers(docker.ListContainersOptions{})
if err != nil {
log.Fatal(err)
}
var wg sync.WaitGroup
for _, container := range containers {
wg.Add(1)
go func(container docker.APIContainers, ttl time.Duration) {
defer wg.Done()
... | go | func (s *Server) Poll(ttl time.Duration) {
containers, err := s.DockerClient.ListContainers(docker.ListContainersOptions{})
if err != nil {
log.Fatal(err)
}
var wg sync.WaitGroup
for _, container := range containers {
wg.Add(1)
go func(container docker.APIContainers, ttl time.Duration) {
defer wg.Done()
... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Poll",
"(",
"ttl",
"time",
".",
"Duration",
")",
"{",
"containers",
",",
"err",
":=",
"s",
".",
"DockerClient",
".",
"ListContainers",
"(",
"docker",
".",
"ListContainersOptions",
"{",
"}",
")",
"\n",
"if",
"err",... | // Poll lists all containers from the docker client every time the TTL comes up and publishes them to etcd | [
"Poll",
"lists",
"all",
"containers",
"from",
"the",
"docker",
"client",
"every",
"time",
"the",
"TTL",
"comes",
"up",
"and",
"publishes",
"them",
"to",
"etcd"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L73-L89 |
20,829 | deis/deis | publisher/server/publisher.go | getContainer | func (s *Server) getContainer(id string) (*docker.APIContainers, error) {
containers, err := s.DockerClient.ListContainers(docker.ListContainersOptions{})
if err != nil {
return nil, err
}
for _, container := range containers {
// send container to channel for processing
if container.ID == id {
return &con... | go | func (s *Server) getContainer(id string) (*docker.APIContainers, error) {
containers, err := s.DockerClient.ListContainers(docker.ListContainersOptions{})
if err != nil {
return nil, err
}
for _, container := range containers {
// send container to channel for processing
if container.ID == id {
return &con... | [
"func",
"(",
"s",
"*",
"Server",
")",
"getContainer",
"(",
"id",
"string",
")",
"(",
"*",
"docker",
".",
"APIContainers",
",",
"error",
")",
"{",
"containers",
",",
"err",
":=",
"s",
".",
"DockerClient",
".",
"ListContainers",
"(",
"docker",
".",
"List... | // getContainer retrieves a container from the docker client based on id | [
"getContainer",
"retrieves",
"a",
"container",
"from",
"the",
"docker",
"client",
"based",
"on",
"id"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L92-L104 |
20,830 | deis/deis | publisher/server/publisher.go | publishContainer | func (s *Server) publishContainer(container *docker.APIContainers, ttl time.Duration) {
r := regexp.MustCompile(appNameRegex)
for _, name := range container.Names {
// HACK: remove slash from container name
// see https://github.com/docker/docker/issues/7519
containerName := name[1:]
match := r.FindStringSubm... | go | func (s *Server) publishContainer(container *docker.APIContainers, ttl time.Duration) {
r := regexp.MustCompile(appNameRegex)
for _, name := range container.Names {
// HACK: remove slash from container name
// see https://github.com/docker/docker/issues/7519
containerName := name[1:]
match := r.FindStringSubm... | [
"func",
"(",
"s",
"*",
"Server",
")",
"publishContainer",
"(",
"container",
"*",
"docker",
".",
"APIContainers",
",",
"ttl",
"time",
".",
"Duration",
")",
"{",
"r",
":=",
"regexp",
".",
"MustCompile",
"(",
"appNameRegex",
")",
"\n",
"for",
"_",
",",
"n... | // publishContainer publishes the docker container to etcd. | [
"publishContainer",
"publishes",
"the",
"docker",
"container",
"to",
"etcd",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L107-L165 |
20,831 | deis/deis | publisher/server/publisher.go | removeContainer | func (s *Server) removeContainer(event string) {
safeMap.RLock()
appPath := safeMap.data[event]
safeMap.RUnlock()
if appPath != "" {
keyPath := fmt.Sprintf("/deis/services/%s", appPath)
log.Printf("stopped %s\n", keyPath)
s.removeEtcd(keyPath, false)
}
} | go | func (s *Server) removeContainer(event string) {
safeMap.RLock()
appPath := safeMap.data[event]
safeMap.RUnlock()
if appPath != "" {
keyPath := fmt.Sprintf("/deis/services/%s", appPath)
log.Printf("stopped %s\n", keyPath)
s.removeEtcd(keyPath, false)
}
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"removeContainer",
"(",
"event",
"string",
")",
"{",
"safeMap",
".",
"RLock",
"(",
")",
"\n",
"appPath",
":=",
"safeMap",
".",
"data",
"[",
"event",
"]",
"\n",
"safeMap",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
... | // removeContainer remove a container published by this component | [
"removeContainer",
"remove",
"a",
"container",
"published",
"by",
"this",
"component"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L168-L178 |
20,832 | deis/deis | publisher/server/publisher.go | IsPublishableApp | func (s *Server) IsPublishableApp(name string) bool {
r := regexp.MustCompile(appNameRegex)
match := r.FindStringSubmatch(name)
if match == nil {
return false
}
appName := match[1]
version, err := strconv.Atoi(match[2])
if err != nil {
log.Println(err)
return false
}
if version >= latestRunningVersion(s... | go | func (s *Server) IsPublishableApp(name string) bool {
r := regexp.MustCompile(appNameRegex)
match := r.FindStringSubmatch(name)
if match == nil {
return false
}
appName := match[1]
version, err := strconv.Atoi(match[2])
if err != nil {
log.Println(err)
return false
}
if version >= latestRunningVersion(s... | [
"func",
"(",
"s",
"*",
"Server",
")",
"IsPublishableApp",
"(",
"name",
"string",
")",
"bool",
"{",
"r",
":=",
"regexp",
".",
"MustCompile",
"(",
"appNameRegex",
")",
"\n",
"match",
":=",
"r",
".",
"FindStringSubmatch",
"(",
"name",
")",
"\n",
"if",
"ma... | // IsPublishableApp determines if the application should be published to etcd. | [
"IsPublishableApp",
"determines",
"if",
"the",
"application",
"should",
"be",
"published",
"to",
"etcd",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L181-L198 |
20,833 | deis/deis | publisher/server/publisher.go | IsPortOpen | func (s *Server) IsPortOpen(hostAndPort string) bool {
portOpen := false
conn, err := net.Dial("tcp", hostAndPort)
if err == nil {
portOpen = true
defer conn.Close()
}
return portOpen
} | go | func (s *Server) IsPortOpen(hostAndPort string) bool {
portOpen := false
conn, err := net.Dial("tcp", hostAndPort)
if err == nil {
portOpen = true
defer conn.Close()
}
return portOpen
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"IsPortOpen",
"(",
"hostAndPort",
"string",
")",
"bool",
"{",
"portOpen",
":=",
"false",
"\n",
"conn",
",",
"err",
":=",
"net",
".",
"Dial",
"(",
"\"",
"\"",
",",
"hostAndPort",
")",
"\n",
"if",
"err",
"==",
"n... | // IsPortOpen checks if the given port is accepting tcp connections | [
"IsPortOpen",
"checks",
"if",
"the",
"given",
"port",
"is",
"accepting",
"tcp",
"connections"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L201-L209 |
20,834 | deis/deis | publisher/server/publisher.go | max | func max(n []int) int {
val := 0
for _, i := range n {
if i > val {
val = i
}
}
return val
} | go | func max(n []int) int {
val := 0
for _, i := range n {
if i > val {
val = i
}
}
return val
} | [
"func",
"max",
"(",
"n",
"[",
"]",
"int",
")",
"int",
"{",
"val",
":=",
"0",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"n",
"{",
"if",
"i",
">",
"val",
"{",
"val",
"=",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] | // max returns the maximum value in n | [
"max",
"returns",
"the",
"maximum",
"value",
"in",
"n"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L262-L270 |
20,835 | deis/deis | publisher/server/publisher.go | getEtcd | func (s *Server) getEtcd(key string) string {
if s.logLevel == "debug" {
log.Println("get", key)
}
resp, err := s.EtcdClient.Get(key, false, false)
if err != nil {
return ""
}
if resp != nil && resp.Node != nil {
return resp.Node.Value
}
return ""
} | go | func (s *Server) getEtcd(key string) string {
if s.logLevel == "debug" {
log.Println("get", key)
}
resp, err := s.EtcdClient.Get(key, false, false)
if err != nil {
return ""
}
if resp != nil && resp.Node != nil {
return resp.Node.Value
}
return ""
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"getEtcd",
"(",
"key",
"string",
")",
"string",
"{",
"if",
"s",
".",
"logLevel",
"==",
"\"",
"\"",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
... | // getEtcd retrieves the etcd key's value. Returns an empty string if the key was not found. | [
"getEtcd",
"retrieves",
"the",
"etcd",
"key",
"s",
"value",
".",
"Returns",
"an",
"empty",
"string",
"if",
"the",
"key",
"was",
"not",
"found",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L273-L285 |
20,836 | deis/deis | publisher/server/publisher.go | setEtcd | func (s *Server) setEtcd(key, value string, ttl uint64) {
if _, err := s.EtcdClient.Set(key, value, ttl); err != nil {
log.Println(err)
}
if s.logLevel == "debug" {
log.Println("set", key, "->", value)
}
} | go | func (s *Server) setEtcd(key, value string, ttl uint64) {
if _, err := s.EtcdClient.Set(key, value, ttl); err != nil {
log.Println(err)
}
if s.logLevel == "debug" {
log.Println("set", key, "->", value)
}
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"setEtcd",
"(",
"key",
",",
"value",
"string",
",",
"ttl",
"uint64",
")",
"{",
"if",
"_",
",",
"err",
":=",
"s",
".",
"EtcdClient",
".",
"Set",
"(",
"key",
",",
"value",
",",
"ttl",
")",
";",
"err",
"!=",
... | // setEtcd sets the corresponding etcd key with the value and ttl | [
"setEtcd",
"sets",
"the",
"corresponding",
"etcd",
"key",
"with",
"the",
"value",
"and",
"ttl"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L288-L295 |
20,837 | deis/deis | publisher/server/publisher.go | removeEtcd | func (s *Server) removeEtcd(key string, recursive bool) {
if _, err := s.EtcdClient.Delete(key, recursive); err != nil {
log.Println(err)
}
if s.logLevel == "debug" {
log.Println("del", key)
}
} | go | func (s *Server) removeEtcd(key string, recursive bool) {
if _, err := s.EtcdClient.Delete(key, recursive); err != nil {
log.Println(err)
}
if s.logLevel == "debug" {
log.Println("del", key)
}
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"removeEtcd",
"(",
"key",
"string",
",",
"recursive",
"bool",
")",
"{",
"if",
"_",
",",
"err",
":=",
"s",
".",
"EtcdClient",
".",
"Delete",
"(",
"key",
",",
"recursive",
")",
";",
"err",
"!=",
"nil",
"{",
"lo... | // removeEtcd removes the corresponding etcd key | [
"removeEtcd",
"removes",
"the",
"corresponding",
"etcd",
"key"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/publisher/server/publisher.go#L298-L305 |
20,838 | deis/deis | client/controller/models/perms/perms.go | Delete | func Delete(c *client.Client, appID string, username string) error {
return doDelete(c, fmt.Sprintf("/v1/apps/%s/perms/%s", appID, username))
} | go | func Delete(c *client.Client, appID string, username string) error {
return doDelete(c, fmt.Sprintf("/v1/apps/%s/perms/%s", appID, username))
} | [
"func",
"Delete",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"appID",
"string",
",",
"username",
"string",
")",
"error",
"{",
"return",
"doDelete",
"(",
"c",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
",",
"username",
")",
")",
"\... | // Delete removes a user from an app. | [
"Delete",
"removes",
"a",
"user",
"from",
"an",
"app",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/perms/perms.go#L78-L80 |
20,839 | deis/deis | client/controller/models/perms/perms.go | DeleteAdmin | func DeleteAdmin(c *client.Client, username string) error {
return doDelete(c, fmt.Sprintf("/v1/admin/perms/%s", username))
} | go | func DeleteAdmin(c *client.Client, username string) error {
return doDelete(c, fmt.Sprintf("/v1/admin/perms/%s", username))
} | [
"func",
"DeleteAdmin",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"username",
"string",
")",
"error",
"{",
"return",
"doDelete",
"(",
"c",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"username",
")",
")",
"\n",
"}"
] | // DeleteAdmin removes administrative privilages from a user. | [
"DeleteAdmin",
"removes",
"administrative",
"privilages",
"from",
"a",
"user",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/perms/perms.go#L83-L85 |
20,840 | deis/deis | client/cmd/utils.go | chooseColor | func chooseColor(input string) string {
var sum uint8
for _, char := range []byte(input) {
sum += uint8(char)
}
// Seven possible terminal colors
color := (sum % 7) + 1
if color == 7 {
color = 9
}
return fmt.Sprintf("\033[3%dm", color)
} | go | func chooseColor(input string) string {
var sum uint8
for _, char := range []byte(input) {
sum += uint8(char)
}
// Seven possible terminal colors
color := (sum % 7) + 1
if color == 7 {
color = 9
}
return fmt.Sprintf("\033[3%dm", color)
} | [
"func",
"chooseColor",
"(",
"input",
"string",
")",
"string",
"{",
"var",
"sum",
"uint8",
"\n\n",
"for",
"_",
",",
"char",
":=",
"range",
"[",
"]",
"byte",
"(",
"input",
")",
"{",
"sum",
"+=",
"uint8",
"(",
"char",
")",
"\n",
"}",
"\n\n",
"// Seven... | // Choose an ANSI color by converting a string to an int. | [
"Choose",
"an",
"ANSI",
"color",
"by",
"converting",
"a",
"string",
"to",
"an",
"int",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/utils.go#L39-L54 |
20,841 | deis/deis | deisctl/deisctl.go | removeGlobalArgs | func removeGlobalArgs(argv []string) []string {
var v []string
for _, a := range argv {
if !isGlobalArg(a) {
v = append(v, a)
}
}
return v
} | go | func removeGlobalArgs(argv []string) []string {
var v []string
for _, a := range argv {
if !isGlobalArg(a) {
v = append(v, a)
}
}
return v
} | [
"func",
"removeGlobalArgs",
"(",
"argv",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"v",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"argv",
"{",
"if",
"!",
"isGlobalArg",
"(",
"a",
")",
"{",
"v",
"=",
"append",
... | // removeGlobalArgs returns the given args without any global option flags, to make
// re-parsing by subcommands easier. | [
"removeGlobalArgs",
"returns",
"the",
"given",
"args",
"without",
"any",
"global",
"option",
"flags",
"to",
"make",
"re",
"-",
"parsing",
"by",
"subcommands",
"easier",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/deisctl.go#L204-L212 |
20,842 | deis/deis | deisctl/deisctl.go | setGlobalFlags | func setGlobalFlags(args map[string]interface{}, setTunnel bool) {
fleet.Flags.Endpoint = args["--endpoint"].(string)
fleet.Flags.EtcdKeyPrefix = args["--etcd-key-prefix"].(string)
fleet.Flags.EtcdKeyFile = args["--etcd-keyfile"].(string)
fleet.Flags.EtcdCertFile = args["--etcd-certfile"].(string)
fleet.Flags.Etcd... | go | func setGlobalFlags(args map[string]interface{}, setTunnel bool) {
fleet.Flags.Endpoint = args["--endpoint"].(string)
fleet.Flags.EtcdKeyPrefix = args["--etcd-key-prefix"].(string)
fleet.Flags.EtcdKeyFile = args["--etcd-keyfile"].(string)
fleet.Flags.EtcdCertFile = args["--etcd-certfile"].(string)
fleet.Flags.Etcd... | [
"func",
"setGlobalFlags",
"(",
"args",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"setTunnel",
"bool",
")",
"{",
"fleet",
".",
"Flags",
".",
"Endpoint",
"=",
"args",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"\n",
"fleet",
".",
"Fl... | // setGlobalFlags sets fleet provider options based on deisctl global flags. | [
"setGlobalFlags",
"sets",
"fleet",
"provider",
"options",
"based",
"on",
"deisctl",
"global",
"flags",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/deisctl.go#L215-L236 |
20,843 | deis/deis | deisctl/backend/fleet/utils.go | expandTargets | func (c *FleetClient) expandTargets(targets []string) (expandedTargets []string, err error) {
for _, t := range targets {
// ensure unit name starts with "deis-"
if !strings.HasPrefix(t, "deis-") {
t = "deis-" + t
}
if strings.HasSuffix(t, "@*") {
var targets []string
targets, err = c.Units(strings.Tr... | go | func (c *FleetClient) expandTargets(targets []string) (expandedTargets []string, err error) {
for _, t := range targets {
// ensure unit name starts with "deis-"
if !strings.HasPrefix(t, "deis-") {
t = "deis-" + t
}
if strings.HasSuffix(t, "@*") {
var targets []string
targets, err = c.Units(strings.Tr... | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"expandTargets",
"(",
"targets",
"[",
"]",
"string",
")",
"(",
"expandedTargets",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"for",
"_",
",",
"t",
":=",
"range",
"targets",
"{",
"// ensure unit name star... | // expand a target to all installed units | [
"expand",
"a",
"target",
"to",
"all",
"installed",
"units"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/utils.go#L89-L108 |
20,844 | deis/deis | deisctl/backend/fleet/utils.go | randomValue | func randomValue(src []string) string {
s := rand.NewSource(int64(time.Now().Unix()))
r := rand.New(s)
idx := r.Intn(len(src))
return src[idx]
} | go | func randomValue(src []string) string {
s := rand.NewSource(int64(time.Now().Unix()))
r := rand.New(s)
idx := r.Intn(len(src))
return src[idx]
} | [
"func",
"randomValue",
"(",
"src",
"[",
"]",
"string",
")",
"string",
"{",
"s",
":=",
"rand",
".",
"NewSource",
"(",
"int64",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
")",
")",
"\n",
"r",
":=",
"rand",
".",
"New",
"(",
"s",
"... | // randomValue returns a random string from a slice of string | [
"randomValue",
"returns",
"a",
"random",
"string",
"from",
"a",
"slice",
"of",
"string"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/utils.go#L111-L116 |
20,845 | deis/deis | client/pkg/webbrowser/webbrowser_darwin.go | Webbrowser | func Webbrowser(u string) (err error) {
_, err = exec.Command("open", u).Output()
return
} | go | func Webbrowser(u string) (err error) {
_, err = exec.Command("open", u).Output()
return
} | [
"func",
"Webbrowser",
"(",
"u",
"string",
")",
"(",
"err",
"error",
")",
"{",
"_",
",",
"err",
"=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"u",
")",
".",
"Output",
"(",
")",
"\n",
"return",
"\n",
"}"
] | // Webbrowser opens a url with the default browser. | [
"Webbrowser",
"opens",
"a",
"url",
"with",
"the",
"default",
"browser",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/pkg/webbrowser/webbrowser_darwin.go#L8-L11 |
20,846 | deis/deis | client/cmd/git.go | GitRemote | func GitRemote(appID, remote string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
return git.CreateRemote(c.ControllerURL.Host, remote, appID)
} | go | func GitRemote(appID, remote string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
return git.CreateRemote(c.ControllerURL.Host, remote, appID)
} | [
"func",
"GitRemote",
"(",
"appID",
",",
"remote",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"git",
".",
"CreateR... | // GitRemote creates a git remote for a deis app. | [
"GitRemote",
"creates",
"a",
"git",
"remote",
"for",
"a",
"deis",
"app",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/git.go#L8-L16 |
20,847 | deis/deis | client/cmd/ps.go | PsList | func PsList(appID string, results int) error {
c, appID, err := load(appID)
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
processes, count, err := ps.List(c, appID, results)
if err != nil {
return err
}
printProcesses(appID, processes, count)
return nil
} | go | func PsList(appID string, results int) error {
c, appID, err := load(appID)
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
processes, count, err := ps.List(c, appID, results)
if err != nil {
return err
}
printProcesses(appID, processes, count)
return nil
} | [
"func",
"PsList",
"(",
"appID",
"string",
",",
"results",
"int",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"results",
"==",
... | // PsList lists an app's processes. | [
"PsList",
"lists",
"an",
"app",
"s",
"processes",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/ps.go#L16-L36 |
20,848 | deis/deis | client/cmd/ps.go | PsScale | func PsScale(appID string, targets []string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
targetMap := make(map[string]int)
regex := regexp.MustCompile("^([A-z]+)=([0-9]+)$")
for _, target := range targets {
if regex.MatchString(target) {
captures := regex.FindStringSubmatch(target)... | go | func PsScale(appID string, targets []string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
targetMap := make(map[string]int)
regex := regexp.MustCompile("^([A-z]+)=([0-9]+)$")
for _, target := range targets {
if regex.MatchString(target) {
captures := regex.FindStringSubmatch(target)... | [
"func",
"PsScale",
"(",
"appID",
"string",
",",
"targets",
"[",
"]",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"targetMap"... | // PsScale scales an app's processes. | [
"PsScale",
"scales",
"an",
"app",
"s",
"processes",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/ps.go#L39-L85 |
20,849 | deis/deis | client/cmd/ps.go | PsRestart | func PsRestart(appID, target string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
psType := ""
psNum := -1
if target != "" {
if strings.Contains(target, ".") {
parts := strings.Split(target, ".")
psType = parts[0]
psNum, err = strconv.Atoi(parts[1])
if err != nil {
ret... | go | func PsRestart(appID, target string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
psType := ""
psNum := -1
if target != "" {
if strings.Contains(target, ".") {
parts := strings.Split(target, ".")
psType = parts[0]
psNum, err = strconv.Atoi(parts[1])
if err != nil {
ret... | [
"func",
"PsRestart",
"(",
"appID",
",",
"target",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"psType",
":=",
"\"",
"\"",
... | // PsRestart restarts an app's processes. | [
"PsRestart",
"restarts",
"an",
"app",
"s",
"processes",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/ps.go#L88-L135 |
20,850 | deis/deis | deisctl/backend/fleet/list_units.go | ListUnits | func (c *FleetClient) ListUnits() (err error) {
var states []*schema.UnitState
unitStates, err := c.Fleet.UnitStates()
if err != nil {
return err
}
for _, us := range unitStates {
for _, prefix := range units.Names {
if strings.HasPrefix(us.Name, prefix) {
states = append(states, us)
break
}
... | go | func (c *FleetClient) ListUnits() (err error) {
var states []*schema.UnitState
unitStates, err := c.Fleet.UnitStates()
if err != nil {
return err
}
for _, us := range unitStates {
for _, prefix := range units.Names {
if strings.HasPrefix(us.Name, prefix) {
states = append(states, us)
break
}
... | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"ListUnits",
"(",
")",
"(",
"err",
"error",
")",
"{",
"var",
"states",
"[",
"]",
"*",
"schema",
".",
"UnitState",
"\n\n",
"unitStates",
",",
"err",
":=",
"c",
".",
"Fleet",
".",
"UnitStates",
"(",
")",
"\n... | // ListUnits prints all Deis-related units to Stdout | [
"ListUnits",
"prints",
"all",
"Deis",
"-",
"related",
"units",
"to",
"Stdout"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/list_units.go#L68-L86 |
20,851 | deis/deis | client/controller/models/ps/ps.go | Scale | func Scale(c *client.Client, appID string, targets map[string]int) error {
u := fmt.Sprintf("/v1/apps/%s/scale/", appID)
body, err := json.Marshal(targets)
if err != nil {
return err
}
_, err = c.BasicRequest("POST", u, body)
return err
} | go | func Scale(c *client.Client, appID string, targets map[string]int) error {
u := fmt.Sprintf("/v1/apps/%s/scale/", appID)
body, err := json.Marshal(targets)
if err != nil {
return err
}
_, err = c.BasicRequest("POST", u, body)
return err
} | [
"func",
"Scale",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"appID",
"string",
",",
"targets",
"map",
"[",
"string",
"]",
"int",
")",
"error",
"{",
"u",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appID",
")",
"\n\n",
"body",
",",
"err"... | // Scale an app's processes. | [
"Scale",
"an",
"app",
"s",
"processes",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/ps/ps.go#L30-L41 |
20,852 | deis/deis | client/controller/models/ps/ps.go | Restart | func Restart(c *client.Client, appID string, procType string, num int) ([]api.Process, error) {
u := fmt.Sprintf("/v1/apps/%s/containers/", appID)
if procType == "" {
u += "restart/"
} else {
if num == -1 {
u += procType + "/restart/"
} else {
u += procType + "/" + strconv.Itoa(num) + "/restart/"
}
}... | go | func Restart(c *client.Client, appID string, procType string, num int) ([]api.Process, error) {
u := fmt.Sprintf("/v1/apps/%s/containers/", appID)
if procType == "" {
u += "restart/"
} else {
if num == -1 {
u += procType + "/restart/"
} else {
u += procType + "/" + strconv.Itoa(num) + "/restart/"
}
}... | [
"func",
"Restart",
"(",
"c",
"*",
"client",
".",
"Client",
",",
"appID",
"string",
",",
"procType",
"string",
",",
"num",
"int",
")",
"(",
"[",
"]",
"api",
".",
"Process",
",",
"error",
")",
"{",
"u",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",... | // Restart an app's processes. | [
"Restart",
"an",
"app",
"s",
"processes",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/controller/models/ps/ps.go#L44-L69 |
20,853 | deis/deis | contrib/bumpver/bump.go | Command | func Command(argv []string) (returnCode int) {
usage := `
Updates the current semantic version number to a new one in the specified
source and doc files.
Usage:
bumpver [-f <current>] <version> <files>...
Options:
-f --from=<current> An explicit version string to replace. Otherwise, use
t... | go | func Command(argv []string) (returnCode int) {
usage := `
Updates the current semantic version number to a new one in the specified
source and doc files.
Usage:
bumpver [-f <current>] <version> <files>...
Options:
-f --from=<current> An explicit version string to replace. Otherwise, use
t... | [
"func",
"Command",
"(",
"argv",
"[",
"]",
"string",
")",
"(",
"returnCode",
"int",
")",
"{",
"usage",
":=",
"`\nUpdates the current semantic version number to a new one in the specified\nsource and doc files.\n\nUsage:\n bumpver [-f <current>] <version> <files>...\n\nOptions:\n -f --... | // Command processes command-line arguments according to a usage string specification. | [
"Command",
"processes",
"command",
"-",
"line",
"arguments",
"according",
"to",
"a",
"usage",
"string",
"specification",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/contrib/bumpver/bump.go#L14-L72 |
20,854 | deis/deis | client/parser/users.go | Users | func Users(argv []string) error {
usage := `
Valid commands for users:
users:list list all registered users
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "users:list":
return usersList(argv)
default:
if printHelp(argv, usage) {
return nil
}
if argv[0] == "users" {
argv[0]... | go | func Users(argv []string) error {
usage := `
Valid commands for users:
users:list list all registered users
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "users:list":
return usersList(argv)
default:
if printHelp(argv, usage) {
return nil
}
if argv[0] == "users" {
argv[0]... | [
"func",
"Users",
"(",
"argv",
"[",
"]",
"string",
")",
"error",
"{",
"usage",
":=",
"`\nValid commands for users:\n\nusers:list list all registered users\n\nUse 'deis help [command]' to learn more.\n`",
"\n\n",
"switch",
"argv",
"[",
"0",
"]",
"{",
"case",
"\"",
"\... | // Users routes user commands to the specific function. | [
"Users",
"routes",
"user",
"commands",
"to",
"the",
"specific",
"function",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/users.go#L9-L34 |
20,855 | deis/deis | deisctl/cmd/upgrade.go | UpgradePrep | func UpgradePrep(stateless bool, b backend.Backend) error {
var wg sync.WaitGroup
b.Stop([]string{"database", "registry@*", "controller", "builder", "logger", "logspout"}, &wg, Stdout, Stderr)
wg.Wait()
b.Destroy([]string{"database", "registry@*", "controller", "builder", "logger", "logspout"}, &wg, Stdout, Stderr... | go | func UpgradePrep(stateless bool, b backend.Backend) error {
var wg sync.WaitGroup
b.Stop([]string{"database", "registry@*", "controller", "builder", "logger", "logspout"}, &wg, Stdout, Stderr)
wg.Wait()
b.Destroy([]string{"database", "registry@*", "controller", "builder", "logger", "logspout"}, &wg, Stdout, Stderr... | [
"func",
"UpgradePrep",
"(",
"stateless",
"bool",
",",
"b",
"backend",
".",
"Backend",
")",
"error",
"{",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n\n",
"b",
".",
"Stop",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
... | // UpgradePrep stops and uninstalls all components except router and publisher | [
"UpgradePrep",
"stops",
"and",
"uninstalls",
"all",
"components",
"except",
"router",
"and",
"publisher"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/upgrade.go#L15-L49 |
20,856 | deis/deis | deisctl/cmd/upgrade.go | UpgradeTakeover | func UpgradeTakeover(stateless bool, b backend.Backend, cb config.Backend) error {
if err := doUpgradeTakeOver(stateless, b, cb); err != nil {
return err
}
return nil
} | go | func UpgradeTakeover(stateless bool, b backend.Backend, cb config.Backend) error {
if err := doUpgradeTakeOver(stateless, b, cb); err != nil {
return err
}
return nil
} | [
"func",
"UpgradeTakeover",
"(",
"stateless",
"bool",
",",
"b",
"backend",
".",
"Backend",
",",
"cb",
"config",
".",
"Backend",
")",
"error",
"{",
"if",
"err",
":=",
"doUpgradeTakeOver",
"(",
"stateless",
",",
"b",
",",
"cb",
")",
";",
"err",
"!=",
"nil... | // UpgradeTakeover gracefully starts a platform stopped with UpgradePrep | [
"UpgradeTakeover",
"gracefully",
"starts",
"a",
"platform",
"stopped",
"with",
"UpgradePrep"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/upgrade.go#L72-L78 |
20,857 | deis/deis | client/parser/certs.go | Certs | func Certs(argv []string) error {
usage := `
Valid commands for certs:
certs:list list SSL certificates for an app
certs:add add an SSL certificate to an app
certs:remove remove an SSL certificate from an app
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "certs:l... | go | func Certs(argv []string) error {
usage := `
Valid commands for certs:
certs:list list SSL certificates for an app
certs:add add an SSL certificate to an app
certs:remove remove an SSL certificate from an app
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "certs:l... | [
"func",
"Certs",
"(",
"argv",
"[",
"]",
"string",
")",
"error",
"{",
"usage",
":=",
"`\nValid commands for certs:\n\ncerts:list list SSL certificates for an app\ncerts:add add an SSL certificate to an app\ncerts:remove remove an SSL certificate from an app\n\n... | // Certs routes certs commands to their specific function. | [
"Certs",
"routes",
"certs",
"commands",
"to",
"their",
"specific",
"function",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/certs.go#L9-L40 |
20,858 | deis/deis | client/deis.go | prepareCmdArgs | func prepareCmdArgs(command string, argv []string) []string {
cmdArgv := []string{extensionPrefix + command}
cmdSplit := strings.Split(argv[0], command+":")
if len(cmdSplit) > 1 {
cmdArgv = append(cmdArgv, cmdSplit[1])
}
return append(cmdArgv, argv[1:]...)
} | go | func prepareCmdArgs(command string, argv []string) []string {
cmdArgv := []string{extensionPrefix + command}
cmdSplit := strings.Split(argv[0], command+":")
if len(cmdSplit) > 1 {
cmdArgv = append(cmdArgv, cmdSplit[1])
}
return append(cmdArgv, argv[1:]...)
} | [
"func",
"prepareCmdArgs",
"(",
"command",
"string",
",",
"argv",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"cmdArgv",
":=",
"[",
"]",
"string",
"{",
"extensionPrefix",
"+",
"command",
"}",
"\n",
"cmdSplit",
":=",
"strings",
".",
"Split",
"(",
"... | // split original command and pass its first element in arguments | [
"split",
"original",
"command",
"and",
"pass",
"its",
"first",
"element",
"in",
"arguments"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/deis.go#L183-L192 |
20,859 | deis/deis | router/cmd/boot/boot.go | waitForInitialConfd | func waitForInitialConfd(etcd string, timeout time.Duration) {
for {
var buffer bytes.Buffer
output := bufio.NewWriter(&buffer)
log.Debugf("Connecting to etcd server %s", etcd)
cmd := exec.Command("confd", "-node", etcd, "-onetime", "--log-level", "error")
cmd.Stdout = output
cmd.Stderr = output
err := ... | go | func waitForInitialConfd(etcd string, timeout time.Duration) {
for {
var buffer bytes.Buffer
output := bufio.NewWriter(&buffer)
log.Debugf("Connecting to etcd server %s", etcd)
cmd := exec.Command("confd", "-node", etcd, "-onetime", "--log-level", "error")
cmd.Stdout = output
cmd.Stderr = output
err := ... | [
"func",
"waitForInitialConfd",
"(",
"etcd",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"{",
"for",
"{",
"var",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"output",
":=",
"bufio",
".",
"NewWriter",
"(",
"&",
"buffer",
")",
"\n",
"log",
".",
"D... | // Wait until the compilation of the templates | [
"Wait",
"until",
"the",
"compilation",
"of",
"the",
"templates"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/router/cmd/boot/boot.go#L108-L127 |
20,860 | deis/deis | deisctl/cmd/platform.go | InstallPlatform | func InstallPlatform(b backend.Backend, cb config.Backend, checkKeys func(config.Backend) error, stateless bool) error {
if err := checkKeys(cb); err != nil {
return err
}
if stateless {
fmt.Println("Warning: With a stateless control plane, some components require manual configuration.")
fmt.Println("See the... | go | func InstallPlatform(b backend.Backend, cb config.Backend, checkKeys func(config.Backend) error, stateless bool) error {
if err := checkKeys(cb); err != nil {
return err
}
if stateless {
fmt.Println("Warning: With a stateless control plane, some components require manual configuration.")
fmt.Println("See the... | [
"func",
"InstallPlatform",
"(",
"b",
"backend",
".",
"Backend",
",",
"cb",
"config",
".",
"Backend",
",",
"checkKeys",
"func",
"(",
"config",
".",
"Backend",
")",
"error",
",",
"stateless",
"bool",
")",
"error",
"{",
"if",
"err",
":=",
"checkKeys",
"(",
... | // InstallPlatform loads all components' definitions from local unit files.
// After InstallPlatform, all components will be available for StartPlatform. | [
"InstallPlatform",
"loads",
"all",
"components",
"definitions",
"from",
"local",
"unit",
"files",
".",
"After",
"InstallPlatform",
"all",
"components",
"will",
"be",
"available",
"for",
"StartPlatform",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/platform.go#L15-L43 |
20,861 | deis/deis | deisctl/cmd/platform.go | StartPlatform | func StartPlatform(b backend.Backend, stateless bool) error {
var wg sync.WaitGroup
io.WriteString(Stdout, prettyprint.DeisIfy("Starting Deis..."))
startDefaultServices(b, stateless, &wg, Stdout, Stderr)
wg.Wait()
fmt.Fprintln(Stdout, "Done.\n ")
fmt.Fprintln(Stdout, "Please set up an administrative account.... | go | func StartPlatform(b backend.Backend, stateless bool) error {
var wg sync.WaitGroup
io.WriteString(Stdout, prettyprint.DeisIfy("Starting Deis..."))
startDefaultServices(b, stateless, &wg, Stdout, Stderr)
wg.Wait()
fmt.Fprintln(Stdout, "Done.\n ")
fmt.Fprintln(Stdout, "Please set up an administrative account.... | [
"func",
"StartPlatform",
"(",
"b",
"backend",
".",
"Backend",
",",
"stateless",
"bool",
")",
"error",
"{",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n\n",
"io",
".",
"WriteString",
"(",
"Stdout",
",",
"prettyprint",
".",
"DeisIfy",
"(",
"\"",
"\"",
")",
... | // StartPlatform activates all components. | [
"StartPlatform",
"activates",
"all",
"components",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/cmd/platform.go#L46-L59 |
20,862 | deis/deis | client/cmd/tags.go | TagsList | func TagsList(appID string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
config, err := config.List(c, appID)
fmt.Printf("=== %s Tags\n", appID)
tagMap := make(map[string]string)
for key, value := range config.Tags {
tagMap[key] = fmt.Sprintf("%v", value)
}
fmt.Print(prettyprint.... | go | func TagsList(appID string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
config, err := config.List(c, appID)
fmt.Printf("=== %s Tags\n", appID)
tagMap := make(map[string]string)
for key, value := range config.Tags {
tagMap[key] = fmt.Sprintf("%v", value)
}
fmt.Print(prettyprint.... | [
"func",
"TagsList",
"(",
"appID",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"config",
",",
"err",
":=",
"config",
".",
"... | // TagsList lists an app's tags. | [
"TagsList",
"lists",
"an",
"app",
"s",
"tags",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/tags.go#L14-L34 |
20,863 | deis/deis | client/cmd/tags.go | TagsUnset | func TagsUnset(appID string, tags []string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
fmt.Print("Applying tags... ")
quit := progress()
configObj := api.Config{}
tagsMap := make(map[string]interface{})
for _, tag := range tags {
tagsMap[tag] = nil
}
configObj.Tags = tagsMap
... | go | func TagsUnset(appID string, tags []string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
fmt.Print("Applying tags... ")
quit := progress()
configObj := api.Config{}
tagsMap := make(map[string]interface{})
for _, tag := range tags {
tagsMap[tag] = nil
}
configObj.Tags = tagsMap
... | [
"func",
"TagsUnset",
"(",
"appID",
"string",
",",
"tags",
"[",
"]",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fmt",
"."... | // TagsUnset removes an app's tags. | [
"TagsUnset",
"removes",
"an",
"app",
"s",
"tags",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/tags.go#L67-L100 |
20,864 | deis/deis | router/logger/stdout_formatter.go | Format | func (f *StdOutFormatter) Format(entry *logrus.Entry) ([]byte, error) {
b := &bytes.Buffer{}
fmt.Fprintf(b, "[%s] - %s\n", strings.ToUpper(entry.Level.String()), entry.Message)
return b.Bytes(), nil
} | go | func (f *StdOutFormatter) Format(entry *logrus.Entry) ([]byte, error) {
b := &bytes.Buffer{}
fmt.Fprintf(b, "[%s] - %s\n", strings.ToUpper(entry.Level.String()), entry.Message)
return b.Bytes(), nil
} | [
"func",
"(",
"f",
"*",
"StdOutFormatter",
")",
"Format",
"(",
"entry",
"*",
"logrus",
".",
"Entry",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"b",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"b",
","... | // Format rewrites a log entry for stdout as a byte array. | [
"Format",
"rewrites",
"a",
"log",
"entry",
"for",
"stdout",
"as",
"a",
"byte",
"array",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/router/logger/stdout_formatter.go#L16-L20 |
20,865 | deis/deis | client/parser/version.go | Version | func Version(argv []string) error {
usage := `
Displays the client version.
Usage: deis version
Use 'deis help [command]' to learn more.
`
if _, err := docopt.Parse(usage, argv, true, "", false, true); err != nil {
return err
}
fmt.Println(version.Version)
return nil
} | go | func Version(argv []string) error {
usage := `
Displays the client version.
Usage: deis version
Use 'deis help [command]' to learn more.
`
if _, err := docopt.Parse(usage, argv, true, "", false, true); err != nil {
return err
}
fmt.Println(version.Version)
return nil
} | [
"func",
"Version",
"(",
"argv",
"[",
"]",
"string",
")",
"error",
"{",
"usage",
":=",
"`\nDisplays the client version.\n\nUsage: deis version\n\nUse 'deis help [command]' to learn more.\n`",
"\n",
"if",
"_",
",",
"err",
":=",
"docopt",
".",
"Parse",
"(",
"usage",
",",... | // Version displays the client version | [
"Version",
"displays",
"the",
"client",
"version"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/version.go#L11-L25 |
20,866 | deis/deis | deisctl/config/config.go | Config | func Config(target string, action string, key []string, cb Backend) error {
return doConfig(target, action, key, cb, os.Stdout)
} | go | func Config(target string, action string, key []string, cb Backend) error {
return doConfig(target, action, key, cb, os.Stdout)
} | [
"func",
"Config",
"(",
"target",
"string",
",",
"action",
"string",
",",
"key",
"[",
"]",
"string",
",",
"cb",
"Backend",
")",
"error",
"{",
"return",
"doConfig",
"(",
"target",
",",
"action",
",",
"key",
",",
"cb",
",",
"os",
".",
"Stdout",
")",
"... | // Config runs the config subcommand | [
"Config",
"runs",
"the",
"config",
"subcommand"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/config/config.go#L25-L27 |
20,867 | deis/deis | deisctl/config/config.go | CheckConfig | func CheckConfig(root string, k string, cb Backend) error {
_, err := doConfigGet(cb, root, []string{k})
if err != nil {
return err
}
return nil
} | go | func CheckConfig(root string, k string, cb Backend) error {
_, err := doConfigGet(cb, root, []string{k})
if err != nil {
return err
}
return nil
} | [
"func",
"CheckConfig",
"(",
"root",
"string",
",",
"k",
"string",
",",
"cb",
"Backend",
")",
"error",
"{",
"_",
",",
"err",
":=",
"doConfigGet",
"(",
"cb",
",",
"root",
",",
"[",
"]",
"string",
"{",
"k",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // CheckConfig looks for a value at a keyspace path
// and returns an error if a value is not found | [
"CheckConfig",
"looks",
"for",
"a",
"value",
"at",
"a",
"keyspace",
"path",
"and",
"returns",
"an",
"error",
"if",
"a",
"value",
"is",
"not",
"found"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/config/config.go#L31-L39 |
20,868 | deis/deis | deisctl/config/config.go | valueForPath | func valueForPath(path string, v string) (string, error) {
// check if path is part of fileKeys
for _, p := range fileKeys {
if path == p {
// read value from filesystem
bytes, err := ioutil.ReadFile(utils.ResolvePath(v))
if err != nil {
return "", err
}
// see if we should return base64 enco... | go | func valueForPath(path string, v string) (string, error) {
// check if path is part of fileKeys
for _, p := range fileKeys {
if path == p {
// read value from filesystem
bytes, err := ioutil.ReadFile(utils.ResolvePath(v))
if err != nil {
return "", err
}
// see if we should return base64 enco... | [
"func",
"valueForPath",
"(",
"path",
"string",
",",
"v",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"// check if path is part of fileKeys",
"for",
"_",
",",
"p",
":=",
"range",
"fileKeys",
"{",
"if",
"path",
"==",
"p",
"{",
"// read value from fil... | // valueForPath returns the canonical value for a user-defined path and value | [
"valueForPath",
"returns",
"the",
"canonical",
"value",
"for",
"a",
"user",
"-",
"defined",
"path",
"and",
"value"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/config/config.go#L123-L149 |
20,869 | deis/deis | deisctl/backend/fleet/status.go | printUnitStatus | func (c *FleetClient) printUnitStatus(name string) int {
u, err := c.Fleet.Unit(name)
switch {
case suToGlobal(*u):
fmt.Fprintf(c.errWriter, "Unable to get status for global unit %s. Check the status on the host using systemctl.\n", name)
return 1
case err != nil:
fmt.Fprintf(c.errWriter, "Error retrieving Un... | go | func (c *FleetClient) printUnitStatus(name string) int {
u, err := c.Fleet.Unit(name)
switch {
case suToGlobal(*u):
fmt.Fprintf(c.errWriter, "Unable to get status for global unit %s. Check the status on the host using systemctl.\n", name)
return 1
case err != nil:
fmt.Fprintf(c.errWriter, "Error retrieving Un... | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"printUnitStatus",
"(",
"name",
"string",
")",
"int",
"{",
"u",
",",
"err",
":=",
"c",
".",
"Fleet",
".",
"Unit",
"(",
"name",
")",
"\n",
"switch",
"{",
"case",
"suToGlobal",
"(",
"*",
"u",
")",
":",
"fm... | // printUnitStatus displays the systemd status for a given unit | [
"printUnitStatus",
"displays",
"the",
"systemd",
"status",
"for",
"a",
"given",
"unit"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/status.go#L21-L39 |
20,870 | deis/deis | deisctl/backend/fleet/create.go | Create | func (c *FleetClient) Create(
targets []string, wg *sync.WaitGroup, out, ew io.Writer) {
units := make([]*schema.Unit, len(targets))
for i, target := range targets {
unitName, unitFile, err := c.createUnitFile(target)
if err != nil {
fmt.Fprintf(ew, "Error creating: %s\n", err)
return
}
units[i] = &s... | go | func (c *FleetClient) Create(
targets []string, wg *sync.WaitGroup, out, ew io.Writer) {
units := make([]*schema.Unit, len(targets))
for i, target := range targets {
unitName, unitFile, err := c.createUnitFile(target)
if err != nil {
fmt.Fprintf(ew, "Error creating: %s\n", err)
return
}
units[i] = &s... | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"Create",
"(",
"targets",
"[",
"]",
"string",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
",",
"out",
",",
"ew",
"io",
".",
"Writer",
")",
"{",
"units",
":=",
"make",
"(",
"[",
"]",
"*",
"schema",
".",
"... | // Create schedules unit files for the given components. | [
"Create",
"schedules",
"unit",
"files",
"for",
"the",
"given",
"components",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/create.go#L19-L40 |
20,871 | deis/deis | deisctl/backend/fleet/create.go | createServiceUnit | func (c *FleetClient) createServiceUnit(component string, num int) (name string, uf *unit.UnitFile, err error) {
name, err = formatUnitName(component, num)
if err != nil {
return "", nil, err
}
decorateStr, err := c.configBackend.GetWithDefault("/deis/platform/enablePlacementOptions", "false")
if err != nil {
... | go | func (c *FleetClient) createServiceUnit(component string, num int) (name string, uf *unit.UnitFile, err error) {
name, err = formatUnitName(component, num)
if err != nil {
return "", nil, err
}
decorateStr, err := c.configBackend.GetWithDefault("/deis/platform/enablePlacementOptions", "false")
if err != nil {
... | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"createServiceUnit",
"(",
"component",
"string",
",",
"num",
"int",
")",
"(",
"name",
"string",
",",
"uf",
"*",
"unit",
".",
"UnitFile",
",",
"err",
"error",
")",
"{",
"name",
",",
"err",
"=",
"formatUnitName"... | // Create normal service unit | [
"Create",
"normal",
"service",
"unit"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/create.go#L95-L113 |
20,872 | deis/deis | deisctl/backend/fleet/list_machines.go | ListMachines | func (c *FleetClient) ListMachines() (err error) {
machines, err := c.Fleet.Machines()
if err != nil {
return err
}
c.printMachines(machines)
return
} | go | func (c *FleetClient) ListMachines() (err error) {
machines, err := c.Fleet.Machines()
if err != nil {
return err
}
c.printMachines(machines)
return
} | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"ListMachines",
"(",
")",
"(",
"err",
"error",
")",
"{",
"machines",
",",
"err",
":=",
"c",
".",
"Fleet",
".",
"Machines",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n... | // ListMachines prints all nodes to Stdout | [
"ListMachines",
"prints",
"all",
"nodes",
"to",
"Stdout"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/list_machines.go#L38-L46 |
20,873 | deis/deis | client/cmd/users.go | UsersList | func UsersList(results int) error {
c, err := client.New()
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
users, count, err := users.List(c, results)
if err != nil {
return err
}
fmt.Printf("=== Users%s", limitCount(len(users), count))
sort.Sort(users)
for ... | go | func UsersList(results int) error {
c, err := client.New()
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
users, count, err := users.List(c, results)
if err != nil {
return err
}
fmt.Printf("=== Users%s", limitCount(len(users), count))
sort.Sort(users)
for ... | [
"func",
"UsersList",
"(",
"results",
"int",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"results",
"==",
"defaultLimit",
"{",
"results",
... | // UsersList lists users registered with the controller. | [
"UsersList",
"lists",
"users",
"registered",
"with",
"the",
"controller",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/users.go#L12-L37 |
20,874 | deis/deis | logger/syslogish/server.go | DestroyLogs | func (s *Server) DestroyLogs(app string) error {
// Get a read lock to ensure the storage adapater pointer can't be updated by another
// goroutine in the time between we check if it's nil and the time we invoke .Destroy() upon
// it.
s.adapterMutex.RLock()
defer s.adapterMutex.RUnlock()
if s.storageAdapter == ni... | go | func (s *Server) DestroyLogs(app string) error {
// Get a read lock to ensure the storage adapater pointer can't be updated by another
// goroutine in the time between we check if it's nil and the time we invoke .Destroy() upon
// it.
s.adapterMutex.RLock()
defer s.adapterMutex.RUnlock()
if s.storageAdapter == ni... | [
"func",
"(",
"s",
"*",
"Server",
")",
"DestroyLogs",
"(",
"app",
"string",
")",
"error",
"{",
"// Get a read lock to ensure the storage adapater pointer can't be updated by another",
"// goroutine in the time between we check if it's nil and the time we invoke .Destroy() upon",
"// it.... | // DestroyLogs deletes all logs for a specified app by delegating to the server's underlying
// storage.Adapter. | [
"DestroyLogs",
"deletes",
"all",
"logs",
"for",
"a",
"specified",
"app",
"by",
"delegating",
"to",
"the",
"server",
"s",
"underlying",
"storage",
".",
"Adapter",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/syslogish/server.go#L188-L198 |
20,875 | deis/deis | logger/syslogish/server.go | ReopenLogs | func (s *Server) ReopenLogs() error {
// Get a read lock to ensure the storage adapater pointer can't be updated by another
// goroutine in the time between we check if it's nil and the time we invoke .Reopen() upon
// it.
s.adapterMutex.RLock()
defer s.adapterMutex.RUnlock()
if s.storageAdapter == nil {
return... | go | func (s *Server) ReopenLogs() error {
// Get a read lock to ensure the storage adapater pointer can't be updated by another
// goroutine in the time between we check if it's nil and the time we invoke .Reopen() upon
// it.
s.adapterMutex.RLock()
defer s.adapterMutex.RUnlock()
if s.storageAdapter == nil {
return... | [
"func",
"(",
"s",
"*",
"Server",
")",
"ReopenLogs",
"(",
")",
"error",
"{",
"// Get a read lock to ensure the storage adapater pointer can't be updated by another",
"// goroutine in the time between we check if it's nil and the time we invoke .Reopen() upon",
"// it.",
"s",
".",
"ada... | // ReopenLogs delegate to the server's underlying storage.Adapter to, if applicable, refresh
// references to underlying storage mechanisms. This is useful, for instance, to ensure logging
// continues smoothly after log rotation when file-based storage is in use. | [
"ReopenLogs",
"delegate",
"to",
"the",
"server",
"s",
"underlying",
"storage",
".",
"Adapter",
"to",
"if",
"applicable",
"refresh",
"references",
"to",
"underlying",
"storage",
"mechanisms",
".",
"This",
"is",
"useful",
"for",
"instance",
"to",
"ensure",
"loggin... | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/syslogish/server.go#L203-L213 |
20,876 | deis/deis | client/parser/limits.go | Limits | func Limits(argv []string) error {
usage := `
Valid commands for limits:
limits:list list resource limits for an app
limits:set set resource limits for an app
limits:unset unset resource limits for an app
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "limits:list":
return... | go | func Limits(argv []string) error {
usage := `
Valid commands for limits:
limits:list list resource limits for an app
limits:set set resource limits for an app
limits:unset unset resource limits for an app
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "limits:list":
return... | [
"func",
"Limits",
"(",
"argv",
"[",
"]",
"string",
")",
"error",
"{",
"usage",
":=",
"`\nValid commands for limits:\n\nlimits:list list resource limits for an app\nlimits:set set resource limits for an app\nlimits:unset unset resource limits for an app\n\nUse 'deis help ... | // Limits routes limits commands to their specific function | [
"Limits",
"routes",
"limits",
"commands",
"to",
"their",
"specific",
"function"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/limits.go#L9-L40 |
20,877 | deis/deis | client/parser/builds.go | Builds | func Builds(argv []string) error {
usage := `
Valid commands for builds:
builds:list list build history for an application
builds:create imports an image and deploys as a new release
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "builds:list":
return buildsList(argv)
case "builds... | go | func Builds(argv []string) error {
usage := `
Valid commands for builds:
builds:list list build history for an application
builds:create imports an image and deploys as a new release
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "builds:list":
return buildsList(argv)
case "builds... | [
"func",
"Builds",
"(",
"argv",
"[",
"]",
"string",
")",
"error",
"{",
"usage",
":=",
"`\nValid commands for builds:\n\nbuilds:list list build history for an application\nbuilds:create imports an image and deploys as a new release\n\nUse 'deis help [command]' to learn more.\n`",
... | // Builds routes build commands to their specific function. | [
"Builds",
"routes",
"build",
"commands",
"to",
"their",
"specific",
"function",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/builds.go#L9-L37 |
20,878 | deis/deis | deisctl/backend/fleet/rolling_restart.go | RollingRestart | func (c *FleetClient) RollingRestart(component string, wg *sync.WaitGroup, out, ew io.Writer) {
if component != "router" {
fmt.Fprint(ew, "invalid component. supported for: router")
return
}
components, err := c.Units(component)
if err != nil {
io.WriteString(ew, err.Error())
return
}
if len(components) ... | go | func (c *FleetClient) RollingRestart(component string, wg *sync.WaitGroup, out, ew io.Writer) {
if component != "router" {
fmt.Fprint(ew, "invalid component. supported for: router")
return
}
components, err := c.Units(component)
if err != nil {
io.WriteString(ew, err.Error())
return
}
if len(components) ... | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"RollingRestart",
"(",
"component",
"string",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
",",
"out",
",",
"ew",
"io",
".",
"Writer",
")",
"{",
"if",
"component",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprint",
... | // RollingRestart for instance units | [
"RollingRestart",
"for",
"instance",
"units"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/rolling_restart.go#L10-L37 |
20,879 | deis/deis | deisctl/backend/fleet/unit.go | Units | func (c *FleetClient) Units(target string) (units []string, err error) {
allUnits, err := c.Fleet.Units()
if err != nil {
return
}
// Look for units starting with the given target name first. If the given
// name starts with "deis-", this will easily locate platform components,
// but we search without canonica... | go | func (c *FleetClient) Units(target string) (units []string, err error) {
allUnits, err := c.Fleet.Units()
if err != nil {
return
}
// Look for units starting with the given target name first. If the given
// name starts with "deis-", this will easily locate platform components,
// but we search without canonica... | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"Units",
"(",
"target",
"string",
")",
"(",
"units",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"allUnits",
",",
"err",
":=",
"c",
".",
"Fleet",
".",
"Units",
"(",
")",
"\n",
"if",
"err",
"!=",
... | // Units returns a list of units filtered by target | [
"Units",
"returns",
"a",
"list",
"of",
"units",
"filtered",
"by",
"target"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/unit.go#L30-L64 |
20,880 | deis/deis | deisctl/backend/fleet/unit.go | nextUnit | func (c *FleetClient) nextUnit(component string) (num int, err error) {
units, err := c.Units(component)
if err != nil {
return
}
num, err = nextUnitNum(units)
if err != nil {
return
}
return
} | go | func (c *FleetClient) nextUnit(component string) (num int, err error) {
units, err := c.Units(component)
if err != nil {
return
}
num, err = nextUnitNum(units)
if err != nil {
return
}
return
} | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"nextUnit",
"(",
"component",
"string",
")",
"(",
"num",
"int",
",",
"err",
"error",
")",
"{",
"units",
",",
"err",
":=",
"c",
".",
"Units",
"(",
"component",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r... | // nextUnit returns the next unit number for a given component | [
"nextUnit",
"returns",
"the",
"next",
"unit",
"number",
"for",
"a",
"given",
"component"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/unit.go#L67-L77 |
20,881 | deis/deis | deisctl/backend/fleet/unit.go | lastUnit | func (c *FleetClient) lastUnit(component string) (num int, err error) {
units, err := c.Units(component)
if err != nil {
return
}
num, err = lastUnitNum(units)
if err != nil {
return
}
return
} | go | func (c *FleetClient) lastUnit(component string) (num int, err error) {
units, err := c.Units(component)
if err != nil {
return
}
num, err = lastUnitNum(units)
if err != nil {
return
}
return
} | [
"func",
"(",
"c",
"*",
"FleetClient",
")",
"lastUnit",
"(",
"component",
"string",
")",
"(",
"num",
"int",
",",
"err",
"error",
")",
"{",
"units",
",",
"err",
":=",
"c",
".",
"Units",
"(",
"component",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r... | // lastUnit returns the last unit number for a given component | [
"lastUnit",
"returns",
"the",
"last",
"unit",
"number",
"for",
"a",
"given",
"component"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/unit.go#L80-L90 |
20,882 | deis/deis | deisctl/backend/fleet/unit.go | NewUnit | func NewUnit(component string, templatePaths []string, decorate bool) (uf *unit.UnitFile, err error) {
template, err := readTemplate(component, templatePaths)
if err != nil {
return
}
if decorate {
decorator, err := readDecorator(component)
if err != nil {
return nil, err
}
uf, err = unit.NewUnitFile(s... | go | func NewUnit(component string, templatePaths []string, decorate bool) (uf *unit.UnitFile, err error) {
template, err := readTemplate(component, templatePaths)
if err != nil {
return
}
if decorate {
decorator, err := readDecorator(component)
if err != nil {
return nil, err
}
uf, err = unit.NewUnitFile(s... | [
"func",
"NewUnit",
"(",
"component",
"string",
",",
"templatePaths",
"[",
"]",
"string",
",",
"decorate",
"bool",
")",
"(",
"uf",
"*",
"unit",
".",
"UnitFile",
",",
"err",
"error",
")",
"{",
"template",
",",
"err",
":=",
"readTemplate",
"(",
"component",... | // NewUnit takes a component type and returns a Fleet unit
// that includes the relevant systemd service template | [
"NewUnit",
"takes",
"a",
"component",
"type",
"and",
"returns",
"a",
"Fleet",
"unit",
"that",
"includes",
"the",
"relevant",
"systemd",
"service",
"template"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/unit.go#L94-L109 |
20,883 | deis/deis | deisctl/backend/fleet/unit.go | formatUnitName | func formatUnitName(component string, num int) (unitName string, err error) {
component = strings.TrimPrefix(component, "deis-")
if num == 0 {
return "deis-" + component + ".service", nil
}
return "deis-" + component + "@" + strconv.Itoa(num) + ".service", nil
} | go | func formatUnitName(component string, num int) (unitName string, err error) {
component = strings.TrimPrefix(component, "deis-")
if num == 0 {
return "deis-" + component + ".service", nil
}
return "deis-" + component + "@" + strconv.Itoa(num) + ".service", nil
} | [
"func",
"formatUnitName",
"(",
"component",
"string",
",",
"num",
"int",
")",
"(",
"unitName",
"string",
",",
"err",
"error",
")",
"{",
"component",
"=",
"strings",
".",
"TrimPrefix",
"(",
"component",
",",
"\"",
"\"",
")",
"\n",
"if",
"num",
"==",
"0"... | // formatUnitName returns a properly formatted systemd service name
// using the given component type and number | [
"formatUnitName",
"returns",
"a",
"properly",
"formatted",
"systemd",
"service",
"name",
"using",
"the",
"given",
"component",
"type",
"and",
"number"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/unit.go#L113-L119 |
20,884 | deis/deis | deisctl/backend/fleet/unit.go | readTemplate | func readTemplate(component string, templatePaths []string) (out []byte, err error) {
templateName := "deis-" + component + ".service"
var templateFile string
// look in $DEISCTL_UNITS env var, then the local and global root paths
for _, p := range templatePaths {
if p == "" {
continue
}
filename := path.... | go | func readTemplate(component string, templatePaths []string) (out []byte, err error) {
templateName := "deis-" + component + ".service"
var templateFile string
// look in $DEISCTL_UNITS env var, then the local and global root paths
for _, p := range templatePaths {
if p == "" {
continue
}
filename := path.... | [
"func",
"readTemplate",
"(",
"component",
"string",
",",
"templatePaths",
"[",
"]",
"string",
")",
"(",
"out",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"templateName",
":=",
"\"",
"\"",
"+",
"component",
"+",
"\"",
"\"",
"\n",
"var",
"templateF... | // readTemplate returns the contents of a systemd template for the given component | [
"readTemplate",
"returns",
"the",
"contents",
"of",
"a",
"systemd",
"template",
"for",
"the",
"given",
"component"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/unit.go#L122-L146 |
20,885 | deis/deis | deisctl/backend/fleet/unit.go | readDecorator | func readDecorator(component string) (out []byte, err error) {
decoratorName := "deis-" + component + ".service.decorator"
var decoratorFile string
// look in $DEISCTL_UNITS env var, then the local and global root paths
for _, p := range decoratorPaths {
filename := path.Join(p, decoratorName)
if _, err := os.... | go | func readDecorator(component string) (out []byte, err error) {
decoratorName := "deis-" + component + ".service.decorator"
var decoratorFile string
// look in $DEISCTL_UNITS env var, then the local and global root paths
for _, p := range decoratorPaths {
filename := path.Join(p, decoratorName)
if _, err := os.... | [
"func",
"readDecorator",
"(",
"component",
"string",
")",
"(",
"out",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"decoratorName",
":=",
"\"",
"\"",
"+",
"component",
"+",
"\"",
"\"",
"\n",
"var",
"decoratorFile",
"string",
"\n\n",
"// look in $DEISCT... | // readDecorator returns the contents of a file containing a snippet that can
// optionally be grafted on to the end of a corresponding systemd unit to
// achieve isolation of the control plane, data plane, and router mesh | [
"readDecorator",
"returns",
"the",
"contents",
"of",
"a",
"file",
"containing",
"a",
"snippet",
"that",
"can",
"optionally",
"be",
"grafted",
"on",
"to",
"the",
"end",
"of",
"a",
"corresponding",
"systemd",
"unit",
"to",
"achieve",
"isolation",
"of",
"the",
... | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/deisctl/backend/fleet/unit.go#L151-L169 |
20,886 | deis/deis | logger/storage/ringbuffer/adapter.go | NewStorageAdapter | func NewStorageAdapter(bufferSize int) (*adapter, error) {
if bufferSize <= 0 {
return nil, fmt.Errorf("Invalid ringBuffer size: %d", bufferSize)
}
return &adapter{bufferSize: bufferSize, ringBuffers: make(map[string]*ringBuffer)}, nil
} | go | func NewStorageAdapter(bufferSize int) (*adapter, error) {
if bufferSize <= 0 {
return nil, fmt.Errorf("Invalid ringBuffer size: %d", bufferSize)
}
return &adapter{bufferSize: bufferSize, ringBuffers: make(map[string]*ringBuffer)}, nil
} | [
"func",
"NewStorageAdapter",
"(",
"bufferSize",
"int",
")",
"(",
"*",
"adapter",
",",
"error",
")",
"{",
"if",
"bufferSize",
"<=",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"bufferSize",
")",
"\n",
"}",
"\n",
"return... | // NewStorageAdapter returns a pointer to a new instance of an in-memory storage.Adapter. | [
"NewStorageAdapter",
"returns",
"a",
"pointer",
"to",
"a",
"new",
"instance",
"of",
"an",
"in",
"-",
"memory",
"storage",
".",
"Adapter",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/storage/ringbuffer/adapter.go#L58-L63 |
20,887 | deis/deis | logger/storage/ringbuffer/adapter.go | Write | func (a *adapter) Write(app string, message string) error {
// Check first if we might actually have to add to the map of ringBuffer pointers so we can avoid
// waiting for / obtaining a lock unnecessarily
rb, ok := a.ringBuffers[app]
if !ok {
// Ensure only one goroutine at a time can be adding a ringBuffer to t... | go | func (a *adapter) Write(app string, message string) error {
// Check first if we might actually have to add to the map of ringBuffer pointers so we can avoid
// waiting for / obtaining a lock unnecessarily
rb, ok := a.ringBuffers[app]
if !ok {
// Ensure only one goroutine at a time can be adding a ringBuffer to t... | [
"func",
"(",
"a",
"*",
"adapter",
")",
"Write",
"(",
"app",
"string",
",",
"message",
"string",
")",
"error",
"{",
"// Check first if we might actually have to add to the map of ringBuffer pointers so we can avoid",
"// waiting for / obtaining a lock unnecessarily",
"rb",
",",
... | // Write adds a log message to to an app-specific ringBuffer | [
"Write",
"adds",
"a",
"log",
"message",
"to",
"to",
"an",
"app",
"-",
"specific",
"ringBuffer"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/storage/ringbuffer/adapter.go#L66-L83 |
20,888 | deis/deis | logger/storage/ringbuffer/adapter.go | Read | func (a *adapter) Read(app string, lines int) ([]string, error) {
rb, ok := a.ringBuffers[app]
if ok {
return rb.read(lines), nil
}
return nil, fmt.Errorf("Could not find logs for '%s'", app)
} | go | func (a *adapter) Read(app string, lines int) ([]string, error) {
rb, ok := a.ringBuffers[app]
if ok {
return rb.read(lines), nil
}
return nil, fmt.Errorf("Could not find logs for '%s'", app)
} | [
"func",
"(",
"a",
"*",
"adapter",
")",
"Read",
"(",
"app",
"string",
",",
"lines",
"int",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"rb",
",",
"ok",
":=",
"a",
".",
"ringBuffers",
"[",
"app",
"]",
"\n",
"if",
"ok",
"{",
"return",
... | // Read retrieves a specified number of log lines from an app-specific ringBuffer | [
"Read",
"retrieves",
"a",
"specified",
"number",
"of",
"log",
"lines",
"from",
"an",
"app",
"-",
"specific",
"ringBuffer"
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/logger/storage/ringbuffer/adapter.go#L86-L92 |
20,889 | deis/deis | client/parser/config.go | Config | func Config(argv []string) error {
usage := `
Valid commands for config:
config:list list environment variables for an app
config:set set environment variables for an app
config:unset unset environment variables for an app
config:pull extract environment variables to .env
config:push ... | go | func Config(argv []string) error {
usage := `
Valid commands for config:
config:list list environment variables for an app
config:set set environment variables for an app
config:unset unset environment variables for an app
config:pull extract environment variables to .env
config:push ... | [
"func",
"Config",
"(",
"argv",
"[",
"]",
"string",
")",
"error",
"{",
"usage",
":=",
"`\nValid commands for config:\n\nconfig:list list environment variables for an app\nconfig:set set environment variables for an app\nconfig:unset unset environment variables for an app\... | // Config routes config commands to their specific function. | [
"Config",
"routes",
"config",
"commands",
"to",
"their",
"specific",
"function",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/parser/config.go#L9-L46 |
20,890 | deis/deis | Godeps/_workspace/src/gopkg.in/tomb.v1/tomb.go | Wait | func (t *Tomb) Wait() error {
t.init()
<-t.dead
t.m.Lock()
reason := t.reason
t.m.Unlock()
return reason
} | go | func (t *Tomb) Wait() error {
t.init()
<-t.dead
t.m.Lock()
reason := t.reason
t.m.Unlock()
return reason
} | [
"func",
"(",
"t",
"*",
"Tomb",
")",
"Wait",
"(",
")",
"error",
"{",
"t",
".",
"init",
"(",
")",
"\n",
"<-",
"t",
".",
"dead",
"\n",
"t",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"reason",
":=",
"t",
".",
"reason",
"\n",
"t",
".",
"m",
".",
... | // Wait blocks until the goroutine is in a dead state and returns the
// reason for its death. | [
"Wait",
"blocks",
"until",
"the",
"goroutine",
"is",
"in",
"a",
"dead",
"state",
"and",
"returns",
"the",
"reason",
"for",
"its",
"death",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/Godeps/_workspace/src/gopkg.in/tomb.v1/tomb.go#L111-L118 |
20,891 | deis/deis | Godeps/_workspace/src/gopkg.in/tomb.v1/tomb.go | Kill | func (t *Tomb) Kill(reason error) {
t.init()
t.m.Lock()
defer t.m.Unlock()
if reason == ErrDying {
if t.reason == ErrStillAlive {
panic("tomb: Kill with ErrDying while still alive")
}
return
}
if t.reason == nil || t.reason == ErrStillAlive {
t.reason = reason
}
// If the receive on t.dying succeeds,... | go | func (t *Tomb) Kill(reason error) {
t.init()
t.m.Lock()
defer t.m.Unlock()
if reason == ErrDying {
if t.reason == ErrStillAlive {
panic("tomb: Kill with ErrDying while still alive")
}
return
}
if t.reason == nil || t.reason == ErrStillAlive {
t.reason = reason
}
// If the receive on t.dying succeeds,... | [
"func",
"(",
"t",
"*",
"Tomb",
")",
"Kill",
"(",
"reason",
"error",
")",
"{",
"t",
".",
"init",
"(",
")",
"\n",
"t",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"if",
"reason",
"==",
"ErrDyi... | // Kill flags the goroutine as dying for the given reason.
// Kill may be called multiple times, but only the first
// non-nil error is recorded as the reason for termination.
//
// If reason is ErrDying, the previous reason isn't replaced
// even if it is nil. It's a runtime error to call Kill with
// ErrDying if t is... | [
"Kill",
"flags",
"the",
"goroutine",
"as",
"dying",
"for",
"the",
"given",
"reason",
".",
"Kill",
"may",
"be",
"called",
"multiple",
"times",
"but",
"only",
"the",
"first",
"non",
"-",
"nil",
"error",
"is",
"recorded",
"as",
"the",
"reason",
"for",
"term... | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/Godeps/_workspace/src/gopkg.in/tomb.v1/tomb.go#L137-L158 |
20,892 | deis/deis | Godeps/_workspace/src/gopkg.in/tomb.v1/tomb.go | Killf | func (t *Tomb) Killf(f string, a ...interface{}) error {
err := fmt.Errorf(f, a...)
t.Kill(err)
return err
} | go | func (t *Tomb) Killf(f string, a ...interface{}) error {
err := fmt.Errorf(f, a...)
t.Kill(err)
return err
} | [
"func",
"(",
"t",
"*",
"Tomb",
")",
"Killf",
"(",
"f",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"err",
":=",
"fmt",
".",
"Errorf",
"(",
"f",
",",
"a",
"...",
")",
"\n",
"t",
".",
"Kill",
"(",
"err",
")",
"\n",
"r... | // Killf works like Kill, but builds the reason providing the received
// arguments to fmt.Errorf. The generated error is also returned. | [
"Killf",
"works",
"like",
"Kill",
"but",
"builds",
"the",
"reason",
"providing",
"the",
"received",
"arguments",
"to",
"fmt",
".",
"Errorf",
".",
"The",
"generated",
"error",
"is",
"also",
"returned",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/Godeps/_workspace/src/gopkg.in/tomb.v1/tomb.go#L162-L166 |
20,893 | deis/deis | Godeps/_workspace/src/gopkg.in/tomb.v1/tomb.go | Err | func (t *Tomb) Err() (reason error) {
t.init()
t.m.Lock()
reason = t.reason
t.m.Unlock()
return
} | go | func (t *Tomb) Err() (reason error) {
t.init()
t.m.Lock()
reason = t.reason
t.m.Unlock()
return
} | [
"func",
"(",
"t",
"*",
"Tomb",
")",
"Err",
"(",
")",
"(",
"reason",
"error",
")",
"{",
"t",
".",
"init",
"(",
")",
"\n",
"t",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"reason",
"=",
"t",
".",
"reason",
"\n",
"t",
".",
"m",
".",
"Unlock",
"(... | // Err returns the reason for the goroutine death provided via Kill
// or Killf, or ErrStillAlive when the goroutine is still alive. | [
"Err",
"returns",
"the",
"reason",
"for",
"the",
"goroutine",
"death",
"provided",
"via",
"Kill",
"or",
"Killf",
"or",
"ErrStillAlive",
"when",
"the",
"goroutine",
"is",
"still",
"alive",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/Godeps/_workspace/src/gopkg.in/tomb.v1/tomb.go#L170-L176 |
20,894 | deis/deis | client/cmd/builds.go | BuildsList | func BuildsList(appID string, results int) error {
c, appID, err := load(appID)
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
builds, count, err := builds.List(c, appID, results)
if err != nil {
return err
}
fmt.Printf("=== %s Builds%s", appID, limitCount(len(... | go | func BuildsList(appID string, results int) error {
c, appID, err := load(appID)
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
builds, count, err := builds.List(c, appID, results)
if err != nil {
return err
}
fmt.Printf("=== %s Builds%s", appID, limitCount(len(... | [
"func",
"BuildsList",
"(",
"appID",
"string",
",",
"results",
"int",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"results",
"=="... | // BuildsList lists an app's builds. | [
"BuildsList",
"lists",
"an",
"app",
"s",
"builds",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/builds.go#L14-L37 |
20,895 | deis/deis | client/cmd/builds.go | BuildsCreate | func BuildsCreate(appID, image, procfile string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
procfileMap := make(map[string]string)
if procfile != "" {
if procfileMap, err = parseProcfile([]byte(procfile)); err != nil {
return err
}
} else if _, err := os.Stat("Procfile"); err ==... | go | func BuildsCreate(appID, image, procfile string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
procfileMap := make(map[string]string)
if procfile != "" {
if procfileMap, err = parseProcfile([]byte(procfile)); err != nil {
return err
}
} else if _, err := os.Stat("Procfile"); err ==... | [
"func",
"BuildsCreate",
"(",
"appID",
",",
"image",
",",
"procfile",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"procfileMap"... | // BuildsCreate creates a build for an app. | [
"BuildsCreate",
"creates",
"a",
"build",
"for",
"an",
"app",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/builds.go#L40-L77 |
20,896 | deis/deis | client/cmd/apps.go | AppCreate | func AppCreate(id string, buildpack string, remote string, noRemote bool) error {
c, err := client.New()
if err != nil {
return err
}
fmt.Print("Creating Application... ")
quit := progress()
app, err := apps.New(c, id)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Printf("done, created %s\n", ... | go | func AppCreate(id string, buildpack string, remote string, noRemote bool) error {
c, err := client.New()
if err != nil {
return err
}
fmt.Print("Creating Application... ")
quit := progress()
app, err := apps.New(c, id)
quit <- true
<-quit
if err != nil {
return err
}
fmt.Printf("done, created %s\n", ... | [
"func",
"AppCreate",
"(",
"id",
"string",
",",
"buildpack",
"string",
",",
"remote",
"string",
",",
"noRemote",
"bool",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"New",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
... | // AppCreate creates an app. | [
"AppCreate",
"creates",
"an",
"app",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L21-L64 |
20,897 | deis/deis | client/cmd/apps.go | AppsList | func AppsList(results int) error {
c, err := client.New()
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
apps, count, err := apps.List(c, results)
if err != nil {
return err
}
fmt.Printf("=== Apps%s", limitCount(len(apps), count))
sort.Sort(apps)
for _, app ... | go | func AppsList(results int) error {
c, err := client.New()
if err != nil {
return err
}
if results == defaultLimit {
results = c.ResponseLimit
}
apps, count, err := apps.List(c, results)
if err != nil {
return err
}
fmt.Printf("=== Apps%s", limitCount(len(apps), count))
sort.Sort(apps)
for _, app ... | [
"func",
"AppsList",
"(",
"results",
"int",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"results",
"==",
"defaultLimit",
"{",
"results",
"... | // AppsList lists apps on the Deis controller. | [
"AppsList",
"lists",
"apps",
"on",
"the",
"Deis",
"controller",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L67-L91 |
20,898 | deis/deis | client/cmd/apps.go | AppInfo | func AppInfo(appID string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
app, err := apps.Get(c, appID)
if err != nil {
return err
}
fmt.Printf("=== %s Application\n", app.ID)
fmt.Println("updated: ", app.Updated)
fmt.Println("uuid: ", app.UUID)
fmt.Println("created: ", app.Crea... | go | func AppInfo(appID string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
app, err := apps.Get(c, appID)
if err != nil {
return err
}
fmt.Printf("=== %s Application\n", app.ID)
fmt.Println("updated: ", app.Updated)
fmt.Println("uuid: ", app.UUID)
fmt.Println("created: ", app.Crea... | [
"func",
"AppInfo",
"(",
"appID",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"app",
",",
"err",
":=",
"apps",
".",
"Get",
... | // AppInfo prints info about app. | [
"AppInfo",
"prints",
"info",
"about",
"app",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L94-L130 |
20,899 | deis/deis | client/cmd/apps.go | AppOpen | func AppOpen(appID string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
app, err := apps.Get(c, appID)
if err != nil {
return err
}
u := app.URL
if !(strings.HasPrefix(u, "http://") || strings.HasPrefix(u, "https://")) {
u = "http://" + u
}
return webbrowser.Webbrowser(u)
} | go | func AppOpen(appID string) error {
c, appID, err := load(appID)
if err != nil {
return err
}
app, err := apps.Get(c, appID)
if err != nil {
return err
}
u := app.URL
if !(strings.HasPrefix(u, "http://") || strings.HasPrefix(u, "https://")) {
u = "http://" + u
}
return webbrowser.Webbrowser(u)
} | [
"func",
"AppOpen",
"(",
"appID",
"string",
")",
"error",
"{",
"c",
",",
"appID",
",",
"err",
":=",
"load",
"(",
"appID",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"app",
",",
"err",
":=",
"apps",
".",
"Get",
... | // AppOpen opens an app in the default webbrowser. | [
"AppOpen",
"opens",
"an",
"app",
"in",
"the",
"default",
"webbrowser",
"."
] | 1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410 | https://github.com/deis/deis/blob/1d9e59fbdbfc9d7767f77c2e0097e335b0fcd410/client/cmd/apps.go#L133-L152 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.