forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manager_factory.go
54 lines (49 loc) · 1.31 KB
/
manager_factory.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
42
43
44
45
46
47
48
49
50
51
52
53
54
package vm
import (
biagentclient "github.com/cloudfoundry/bosh-agent/agentclient"
bicloud "github.com/cloudfoundry/bosh-cli/cloud"
biconfig "github.com/cloudfoundry/bosh-cli/config"
boshlog "github.com/cloudfoundry/bosh-utils/logger"
boshsys "github.com/cloudfoundry/bosh-utils/system"
boshuuid "github.com/cloudfoundry/bosh-utils/uuid"
)
type ManagerFactory interface {
NewManager(cloud bicloud.Cloud, agentClient biagentclient.AgentClient) Manager
}
type managerFactory struct {
vmRepo biconfig.VMRepo
stemcellRepo biconfig.StemcellRepo
diskDeployer DiskDeployer
uuidGenerator boshuuid.Generator
fs boshsys.FileSystem
logger boshlog.Logger
}
func NewManagerFactory(
vmRepo biconfig.VMRepo,
stemcellRepo biconfig.StemcellRepo,
diskDeployer DiskDeployer,
uuidGenerator boshuuid.Generator,
fs boshsys.FileSystem,
logger boshlog.Logger,
) ManagerFactory {
return &managerFactory{
vmRepo: vmRepo,
stemcellRepo: stemcellRepo,
diskDeployer: diskDeployer,
uuidGenerator: uuidGenerator,
fs: fs,
logger: logger,
}
}
func (f *managerFactory) NewManager(cloud bicloud.Cloud, agentClient biagentclient.AgentClient) Manager {
return NewManager(
f.vmRepo,
f.stemcellRepo,
f.diskDeployer,
agentClient,
cloud,
f.uuidGenerator,
f.fs,
f.logger,
)
}