Documentation
¶
Index ¶
- Constants
- Variables
- type Metadata
- type Options
- type ParseOptions
- type Snapper
- type SnapperImplementation
- type Snapshot
- func (s *Snapshot) AsStatement() attestation.Statement
- func (s *Snapshot) GetData() []byte
- func (s *Snapshot) GetOrigin() attestation.Subject
- func (s *Snapshot) GetParsed() any
- func (s *Snapshot) GetSource() attestation.Subject
- func (s *Snapshot) GetType() attestation.PredicateType
- func (s *Snapshot) GetVerification() attestation.Verification
- func (s *Snapshot) SetOrigin(attestation.Subject)
- func (s *Snapshot) SetSource(attestation.Subject)
- func (s *Snapshot) SetType(t attestation.PredicateType) error
- func (s *Snapshot) SetVerification(attestation.Verification)
- type Spec
- type SpecParser
Constants ¶
View Source
const ( PayloadTypeStruct = "struct" PayloadTypeArray = "array" )
Variables ¶
View Source
var PayloadTypes = []string{PayloadTypeStruct, PayloadTypeArray}
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// ResponseHeaders is the list of response headers the snapper will record
ResponseHeaders []string
// Platform is the explicitly selected platform (optional, auto-detected if not set)
Platform platform.Type
// SpecPath is the path to the spec file (used for auto-detection)
SpecPath string
}
type ParseOptions ¶
type SnapperImplementation ¶
type SnapperImplementation interface {
ValidateSpec(*Spec) error
GetClient(platform.Type) (platform.Client, error)
CallAPI(context.Context, platform.Client, *Spec) (*http.Response, error)
ParseResponse(*Options, *Spec, *http.Response) (*Snapshot, error)
ApplyFieldMask(*Snapshot, []string) (*Snapshot, error)
}
type Snapshot ¶
type Snapshot struct {
ID string `json:"id"`
Name string `json:"name"`
Url string `json:"url"`
Type string `json:"type"`
Metadata Metadata `json:"metadata"`
Headers map[string]string `json:"headers"`
Values any `json:"values"`
}
func (*Snapshot) AsStatement ¶
func (s *Snapshot) AsStatement() attestation.Statement
AsStatement converts the snapshot to an intoto attestation
func (*Snapshot) GetOrigin ¶ added in v0.2.0
func (s *Snapshot) GetOrigin() attestation.Subject
func (*Snapshot) GetSource ¶ added in v0.1.1
func (s *Snapshot) GetSource() attestation.Subject
func (*Snapshot) GetType ¶
func (s *Snapshot) GetType() attestation.PredicateType
func (*Snapshot) GetVerification ¶ added in v0.2.0
func (s *Snapshot) GetVerification() attestation.Verification
func (*Snapshot) SetOrigin ¶ added in v0.2.0
func (s *Snapshot) SetOrigin(attestation.Subject)
func (*Snapshot) SetSource ¶ added in v0.1.1
func (s *Snapshot) SetSource(attestation.Subject)
func (*Snapshot) SetType ¶
func (s *Snapshot) SetType(t attestation.PredicateType) error
func (*Snapshot) SetVerification ¶ added in v0.2.0
func (s *Snapshot) SetVerification(attestation.Verification)
type Spec ¶
type Spec struct {
// ID is the string that will be used to generate the subject's
// hash when generating an attestation. It should identify the
// object described by the data returned by the API call. This
// ID MUST be unique for each instance the API returns.
ID string `json:"id"`
Name string `json:"name"`
Url string `json:"url"`
Type string `json:"type"`
Endpoint string `json:"endpoint"`
Method string `json:"method"`
PayloadType string `json:"payload" yaml:"payload"` //nolint:tagalign
Mask []string `json:"mask"`
Data string `json:"data"`
TrimNL bool `json:"trimNL" yaml:"trimNL"`
}
type SpecParser ¶
type SpecParser struct{}
func (*SpecParser) ParseWithOptions ¶
func (sp *SpecParser) ParseWithOptions(r io.Reader, opts *ParseOptions) (*Spec, error)
ParseWithOptions parses a spec yaml definition.
Click to show internal directories.
Click to hide internal directories.