Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/handlers/descriptors/adapters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ edit:
#############################################################################
# Import/Export commands
#############################################################################

import:
use: adapter <name>
group: admin-essentials
Expand Down
17 changes: 17 additions & 0 deletions internal/handlers/descriptors/applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,20 @@ inspect:
use: applications
description: |
Show application status

start:
use: application <name>
description: |
Start a stopped application

stop:
use: application <name>
description: |
Stop a running application

restart:
use: application <name>
description: |
Restart an application


42 changes: 42 additions & 0 deletions internal/runners/applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,48 @@ func NewApplicationRunner(c client.Client, cfg *config.Config) *ApplicationRunne
}
}

func (r *ApplicationRunner) Start(in Request) (*Response, error) {
logger.Trace()

name := in.Args[0]

if err := r.service.Start(name); err != nil {
return nil, err
}

return NewResponse(
fmt.Sprintf("Successfully started application `%s`", name),
), nil
}

func (r *ApplicationRunner) Stop(in Request) (*Response, error) {
logger.Trace()

name := in.Args[0]

if err := r.service.Stop(name); err != nil {
return nil, err
}

return NewResponse(
fmt.Sprintf("Successfully stopped application `%s`", name),
), nil
}

func (r *ApplicationRunner) Restart(in Request) (*Response, error) {
logger.Trace()

name := in.Args[0]

if err := r.service.Restart(name); err != nil {
return nil, err
}

return NewResponse(
fmt.Sprintf("Successfully restarted application `%s`", name),
), nil
}

func (r *ApplicationRunner) Inspect(in Request) (*Response, error) {
logger.Trace()

Expand Down