-
Notifications
You must be signed in to change notification settings - Fork 24
/
intermediate.go
33 lines (27 loc) · 933 Bytes
/
intermediate.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
package exporter
import (
"bytes"
"context"
"github.com/jetstack/preflight/pkg/packaging"
"github.com/jetstack/preflight/pkg/results"
)
// IntermediateExporter is an Exporter that outputs intermediate JSON
type IntermediateExporter struct {
}
// NewIntermediateExporter creates a new IntermediateExporter
func NewIntermediateExporter() *IntermediateExporter {
return &IntermediateExporter{}
}
// Export writes the intermediate JSON to a buffer
func (e *IntermediateExporter) Export(ctx context.Context, policyManifest *packaging.PolicyManifest, intermediateJSON []byte, rc *results.ResultCollection) (*bytes.Buffer, error) {
writer := bytes.NewBuffer([]byte{})
_, err := writer.Write(intermediateJSON)
if err != nil {
return nil, err
}
return writer, nil
}
// FileExtension returns the file extension for this exporter's format
func (e *IntermediateExporter) FileExtension() string {
return ".intermediate.json"
}