forked from cloudfoundry-attic/bosh-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stemcell.go
50 lines (41 loc) · 1.02 KB
/
stemcell.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
package stemcell
import (
"fmt"
biproperty "github.com/cloudfoundry/bosh-init/common/property"
boshsys "github.com/cloudfoundry/bosh-utils/system"
)
type ExtractedStemcell interface {
Manifest() Manifest
Delete() error
fmt.Stringer
}
type extractedStemcell struct {
manifest Manifest
extractedPath string
fs boshsys.FileSystem
}
func NewExtractedStemcell(
manifest Manifest,
extractedPath string,
fs boshsys.FileSystem,
) ExtractedStemcell {
return &extractedStemcell{
manifest: manifest,
extractedPath: extractedPath,
fs: fs,
}
}
func (s *extractedStemcell) Manifest() Manifest { return s.manifest }
func (s *extractedStemcell) Delete() error {
return s.fs.RemoveAll(s.extractedPath)
}
func (s *extractedStemcell) String() string {
return fmt.Sprintf("ExtractedStemcell{name=%s version=%s}", s.manifest.Name, s.manifest.Version)
}
type Manifest struct {
ImagePath string
Name string
Version string
SHA1 string
CloudProperties biproperty.Map
}