forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.go
41 lines (32 loc) · 875 Bytes
/
application.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package requirements
import (
"code.cloudfoundry.org/cli/cf/api/applications"
"code.cloudfoundry.org/cli/cf/models"
)
//go:generate counterfeiter . ApplicationRequirement
type ApplicationRequirement interface {
Requirement
GetApplication() models.Application
}
type applicationAPIRequirement struct {
name string
appRepo applications.Repository
application models.Application
}
func NewApplicationRequirement(name string, aR applications.Repository) *applicationAPIRequirement {
req := &applicationAPIRequirement{}
req.name = name
req.appRepo = aR
return req
}
func (req *applicationAPIRequirement) Execute() error {
var apiErr error
req.application, apiErr = req.appRepo.Read(req.name)
if apiErr != nil {
return apiErr
}
return nil
}
func (req *applicationAPIRequirement) GetApplication() models.Application {
return req.application
}