1+ // Package apps provides methods for managing deis apps.
12package apps
23
34import (
@@ -44,13 +45,16 @@ func List(c *deis.Client, results int) ([]api.App, int, error) {
4445 return apps , count , nil
4546}
4647
47- // New creates a new app.
48- func New (c * deis.Client , id string ) (api.App , error ) {
48+ // New creates a new app with the given appID. Passing an empty string will result in
49+ // a randomized app name.
50+ //
51+ // If the app name already exists, the error deis.ErrDuplicateApp will be returned.
52+ func New (c * deis.Client , appID string ) (api.App , error ) {
4953 body := []byte {}
5054
5155 var err error
52- if id != "" {
53- req := api.AppCreateRequest {ID : id }
56+ if appID != "" {
57+ req := api.AppCreateRequest {ID : appID }
5458 body , err = json .Marshal (req )
5559
5660 if err != nil {
@@ -79,7 +83,7 @@ func New(c *deis.Client, id string) (api.App, error) {
7983 return app , nil
8084}
8185
82- // Get app details from a Deis controller.
86+ // Get app details from a controller.
8387func Get (c * deis.Client , appID string ) (api.App , error ) {
8488 u := fmt .Sprintf ("/v2/apps/%s/" , appID )
8589
@@ -105,7 +109,8 @@ func Get(c *deis.Client, appID string) (api.App, error) {
105109 return app , nil
106110}
107111
108- // Logs retrieves logs from an app.
112+ // Logs retrieves logs from an app. The number of log lines fetched can be set by the lines
113+ // argument. Setting lines = -1 will retrive all app logs.
109114func Logs (c * deis.Client , appID string , lines int ) (string , error ) {
110115 u := fmt .Sprintf ("/v2/apps/%s/logs" , appID )
111116
@@ -128,7 +133,8 @@ func Logs(c *deis.Client, appID string, lines int) (string, error) {
128133 return string (body [2 : len (body )- 1 ]), nil
129134}
130135
131- // Run one time command in an app.
136+ // Run a one-time command in your app. This will start a kubernetes job with the
137+ // same container image and environment as the rest of the app.
132138func Run (c * deis.Client , appID string , command string ) (api.AppRunResponse , error ) {
133139 req := api.AppRunRequest {Command : command }
134140 body , err := json .Marshal (req )
0 commit comments