recipes

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRecipeNotFound = errors.New("recipe not found")

ErrRecipeNotFound is used when a recipe is requested by name, but does not exist for the given constraint.

Functions

func NewRecipeFile

func NewRecipeFile(recipeFileString string) (*types.OpenInstallationRecipe, error)

Types

type LocalRecipeFetcher added in v0.24.0

type LocalRecipeFetcher struct {
	Path string
}

func (*LocalRecipeFetcher) FetchRecipe added in v0.24.0

func (f *LocalRecipeFetcher) FetchRecipe(ctx context.Context, manifest *types.DiscoveryManifest, friendlyName string) (*types.OpenInstallationRecipe, error)

func (*LocalRecipeFetcher) FetchRecipes added in v0.24.0

func (*LocalRecipeFetcher) FetchRecommendations added in v0.24.0

func (f *LocalRecipeFetcher) FetchRecommendations(ctx context.Context, manifest *types.DiscoveryManifest) ([]types.OpenInstallationRecipe, error)

type MockRecipeFetcher

type MockRecipeFetcher struct {
	FetchRecipeErr                error
	FetchRecipesErr               error
	FetchRecommendationsErr       error
	FetchRecipeCallCount          int
	FetchRecipesCallCount         int
	FetchRecommendationsCallCount int
	FetchRecipeVals               []types.OpenInstallationRecipe
	FetchRecipeVal                *types.OpenInstallationRecipe
	FetchRecipesVal               []types.OpenInstallationRecipe
	FetchRecommendationsVal       []types.OpenInstallationRecipe
	FetchRecipeNameCount          map[string]int
}

func NewMockRecipeFetcher

func NewMockRecipeFetcher() *MockRecipeFetcher

func (*MockRecipeFetcher) FetchRecipe

func (f *MockRecipeFetcher) FetchRecipe(ctx context.Context, manifest *types.DiscoveryManifest, friendlyName string) (*types.OpenInstallationRecipe, error)

func (*MockRecipeFetcher) FetchRecipes

func (*MockRecipeFetcher) FetchRecommendations

func (f *MockRecipeFetcher) FetchRecommendations(ctx context.Context, manifest *types.DiscoveryManifest) ([]types.OpenInstallationRecipe, error)

type MockRecipeFileFetcher

type MockRecipeFileFetcher struct {
	FetchRecipeFileFunc func(*url.URL) (*types.OpenInstallationRecipe, error)
	LoadRecipeFileFunc  func(string) (*types.OpenInstallationRecipe, error)
}

func NewMockRecipeFileFetcher

func NewMockRecipeFileFetcher() *MockRecipeFileFetcher

func (*MockRecipeFileFetcher) FetchRecipeFile

func (f *MockRecipeFileFetcher) FetchRecipeFile(url *url.URL) (*types.OpenInstallationRecipe, error)

func (*MockRecipeFileFetcher) LoadRecipeFile

func (f *MockRecipeFileFetcher) LoadRecipeFile(filename string) (*types.OpenInstallationRecipe, error)

type NerdGraphClient

type NerdGraphClient interface {
	QueryWithResponseAndContext(context.Context, string, map[string]interface{}, interface{}) error
}

type RecipeFetcher

RecipeFetcher is responsible for retrieving recipe information.

func NewServiceRecipeFetcher

func NewServiceRecipeFetcher(client NerdGraphClient) RecipeFetcher

NewServiceRecipeFetcher returns a new instance of ServiceRecipeFetcher.

type RecipeFileFetcher

type RecipeFileFetcher interface {
	FetchRecipeFile(recipeURL *url.URL) (*types.OpenInstallationRecipe, error)
	LoadRecipeFile(filename string) (*types.OpenInstallationRecipe, error)
}

func NewRecipeFileFetcher

func NewRecipeFileFetcher() RecipeFileFetcher

type RecipeFileFetcherImpl

type RecipeFileFetcherImpl struct {
	HTTPGetFunc func(string) (*http.Response, error)
	// contains filtered or unexported fields
}

func (*RecipeFileFetcherImpl) FetchRecipeFile

func (f *RecipeFileFetcherImpl) FetchRecipeFile(recipeURL *url.URL) (*types.OpenInstallationRecipe, error)

func (*RecipeFileFetcherImpl) LoadRecipeFile

func (f *RecipeFileFetcherImpl) LoadRecipeFile(filename string) (*types.OpenInstallationRecipe, error)

type ServiceRecipeFetcher

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

ServiceRecipeFetcher is an implementation of the recipeFetcher interface that relies on the Neerdgraph-stitched recipe service to source its results.

func (*ServiceRecipeFetcher) FetchRecipe

func (f *ServiceRecipeFetcher) FetchRecipe(ctx context.Context, manifest *types.DiscoveryManifest, friendlyName string) (*types.OpenInstallationRecipe, error)

FetchRecipe gets a recipe by name from the recipe service.

func (*ServiceRecipeFetcher) FetchRecipes

FetchRecipes fetches all available recipes from the recipe service.

func (*ServiceRecipeFetcher) FetchRecommendations

func (f *ServiceRecipeFetcher) FetchRecommendations(ctx context.Context, manifest *types.DiscoveryManifest) ([]types.OpenInstallationRecipe, error)

FetchRecommendations fetches recipe recommendations from the recipe service based on the information passed in the provided DiscoveryManifest.

Jump to

Keyboard shortcuts

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