forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder_factory.go
53 lines (47 loc) · 1.74 KB
/
builder_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
package state
import (
biagentclient "github.com/cloudfoundry/bosh-agent/agentclient"
biblobstore "github.com/cloudfoundry/bosh-cli/blobstore"
bideplrel "github.com/cloudfoundry/bosh-cli/deployment/release"
bistatejob "github.com/cloudfoundry/bosh-cli/state/job"
bistatepkg "github.com/cloudfoundry/bosh-cli/state/pkg"
bitemplate "github.com/cloudfoundry/bosh-cli/templatescompiler"
boshlog "github.com/cloudfoundry/bosh-utils/logger"
)
type BuilderFactory interface {
NewBuilder(biblobstore.Blobstore, biagentclient.AgentClient) Builder
}
type builderFactory struct {
packageRepo bistatepkg.CompiledPackageRepo
releaseJobResolver bideplrel.JobResolver
jobRenderer bitemplate.JobListRenderer
renderedJobListCompressor bitemplate.RenderedJobListCompressor
logger boshlog.Logger
}
func NewBuilderFactory(
packageRepo bistatepkg.CompiledPackageRepo,
releaseJobResolver bideplrel.JobResolver,
jobRenderer bitemplate.JobListRenderer,
renderedJobListCompressor bitemplate.RenderedJobListCompressor,
logger boshlog.Logger,
) BuilderFactory {
return &builderFactory{
packageRepo: packageRepo,
releaseJobResolver: releaseJobResolver,
jobRenderer: jobRenderer,
renderedJobListCompressor: renderedJobListCompressor,
logger: logger,
}
}
func (f *builderFactory) NewBuilder(blobstore biblobstore.Blobstore, agentClient biagentclient.AgentClient) Builder {
packageCompiler := NewRemotePackageCompiler(blobstore, agentClient, f.packageRepo)
jobDependencyCompiler := bistatejob.NewDependencyCompiler(packageCompiler, f.logger)
return NewBuilder(
f.releaseJobResolver,
jobDependencyCompiler,
f.jobRenderer,
f.renderedJobListCompressor,
blobstore,
f.logger,
)
}