Help us shape the future of Go! Take the 2026 Go Developer Survey

composition

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempDir added in v0.4.3

func CreateTempDir() (string, error)

CreateTempDir creates a temporary directory to store the composed OSCAL models

Types

type Composer added in v0.9.0

type Composer struct {
	// contains filtered or unexported fields
}

func New added in v0.9.0

func New(opts ...Option) (*Composer, error)

func (*Composer) ComposeComponentDefinitions added in v0.9.0

func (c *Composer) ComposeComponentDefinitions(ctx context.Context, compDef *oscalTypes.ComponentDefinition, baseDir string) error

ComposeComponentDefinitions composes an OSCAL component definition by adding the remote resources to the back matter and updating with back matter links.

func (*Composer) ComposeComponentValidations added in v0.9.0

func (c *Composer) ComposeComponentValidations(ctx context.Context, compDef *oscalTypes.ComponentDefinition, baseDir string) error

ComposeComponentValidations compiles the component validations by adding the remote resources to the back matter and updating with back matter links.

func (*Composer) ComposeFromPath added in v0.9.0

func (c *Composer) ComposeFromPath(ctx context.Context, path string) (model *oscalTypes.OscalCompleteSchema, err error)

ComposeFromPath composes an OSCAL model from a file path

type Option added in v0.9.0

type Option func(*Composer) error

func WithModelFromLocalPath added in v0.9.0

func WithModelFromLocalPath(path string) Option

TODO: add remote option?

func WithRenderSettings added in v0.9.0

func WithRenderSettings(renderTypeString string, renderValidations bool) Option

func WithTemplateRenderer added in v0.9.0

func WithTemplateRenderer(renderTypeString string, constants map[string]interface{}, variables []template.VariableConfig, setOpts []string) Option

type RenderedContent added in v0.9.0

type RenderedContent string

type ResourceStore

type ResourceStore struct {
	// contains filtered or unexported fields
}

ResourceStore is a store of resources.

func NewResourceStoreFromBackMatter

func NewResourceStoreFromBackMatter(composer *Composer, backMatter *oscalTypes.BackMatter) *ResourceStore

NewResourceStoreFromBackMatter creates a new resource store from the back matter of a component definition.

func (*ResourceStore) AddExisting

func (s *ResourceStore) AddExisting(resource *oscalTypes.Resource)

AddExisting adds a resource to the store that is already in the back matter.

func (*ResourceStore) AddFetched

func (s *ResourceStore) AddFetched(resource *oscalTypes.Resource)

AddFetched adds a resource to the store that was fetched from a remote source.

func (s *ResourceStore) AddFromLink(link *oscalTypes.Link, baseDir string) (ids []string, err error)

AddFromLink adds resources from a link to the store.

func (*ResourceStore) AllFetched

func (s *ResourceStore) AllFetched() []oscalTypes.Resource

AllFetched returns all the resources that were fetched from a remote source.

func (*ResourceStore) Get

func (s *ResourceStore) Get(id string) (*oscalTypes.Resource, bool)

Get returns the resource with the given ID, if it exists.

func (*ResourceStore) GetExisting

func (s *ResourceStore) GetExisting(id string) (*oscalTypes.Resource, bool)

GetExisting returns the resource with the given ID, if it exists.

func (*ResourceStore) GetFetched

func (s *ResourceStore) GetFetched(id string) (*oscalTypes.Resource, bool)

GetFetched returns the resource that was fetched from a remote source with the given ID, if it exists.

func (*ResourceStore) GetHrefIds

func (s *ResourceStore) GetHrefIds(href string) (ids []string, err error)

GetHrefIds gets the resource ids for a given href

func (*ResourceStore) Has

func (s *ResourceStore) Has(id string) bool

Has returns true if the resource store has a resource with the given ID.

func (*ResourceStore) SetHrefIds

func (s *ResourceStore) SetHrefIds(href string, ids []string)

SetHrefIds sets the resource ids for a given href

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL