forked from cloudfoundry-attic/bosh-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
factory.go
55 lines (49 loc) · 1.2 KB
/
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
55
package instance
import (
biblobstore "github.com/cloudfoundry/bosh-init/blobstore"
biinstancestate "github.com/cloudfoundry/bosh-init/deployment/instance/state"
bisshtunnel "github.com/cloudfoundry/bosh-init/deployment/sshtunnel"
bivm "github.com/cloudfoundry/bosh-init/deployment/vm"
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
)
type Factory interface {
NewInstance(
jobName string,
id int,
vm bivm.VM,
vmManager bivm.Manager,
sshTunnelFactory bisshtunnel.Factory,
blobstore biblobstore.Blobstore,
logger boshlog.Logger,
) Instance
}
type factory struct {
stateBuilderFactory biinstancestate.BuilderFactory
}
func NewFactory(
stateBuilderFactory biinstancestate.BuilderFactory,
) Factory {
return &factory{
stateBuilderFactory: stateBuilderFactory,
}
}
func (f *factory) NewInstance(
jobName string,
id int,
vm bivm.VM,
vmManager bivm.Manager,
sshTunnelFactory bisshtunnel.Factory,
blobstore biblobstore.Blobstore,
logger boshlog.Logger,
) Instance {
stateBuilder := f.stateBuilderFactory.NewBuilder(blobstore, vm.AgentClient())
return NewInstance(
jobName,
id,
vm,
vmManager,
sshTunnelFactory,
stateBuilder,
logger,
)
}