-
Notifications
You must be signed in to change notification settings - Fork 70
/
interfaces.go
73 lines (60 loc) · 2.79 KB
/
interfaces.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package install
import (
"context"
"net/url"
"github.com/newrelic/newrelic-cli/internal/install/recipes"
"github.com/newrelic/newrelic-cli/internal/install/types"
)
type ConfigValidator interface {
Validate(ctx context.Context) error
}
// Discoverer is responsible for discovering information about the host system.
type Discoverer interface {
Discover(context.Context) (*types.DiscoveryManifest, error)
}
type Prompter interface {
PromptYesNo(msg string) (bool, error)
MultiSelect(msg string, options []string) ([]string, error)
}
type RecipeFileFetcher interface {
FetchRecipeFile(recipeURL *url.URL) (*types.OpenInstallationRecipe, error)
LoadRecipeFile(filename string) (*types.OpenInstallationRecipe, error)
}
type RecipeFilterRunner interface {
RunFilterAll(ctx context.Context, r []types.OpenInstallationRecipe, m *types.DiscoveryManifest) []types.OpenInstallationRecipe
EnsureDoesNotFilter(ctx context.Context, r []types.OpenInstallationRecipe, m *types.DiscoveryManifest) error
}
// RecipeValidator validates installation of a recipe.
type RecipeValidator interface {
ValidateRecipe(context.Context, types.DiscoveryManifest, types.OpenInstallationRecipe, types.RecipeVars) (entityGUID string, err error)
}
type AgentValidator interface {
Validate(ctx context.Context, url string) (string, error)
}
type RecipeVarPreparer interface {
Prepare(m types.DiscoveryManifest, r types.OpenInstallationRecipe, assumeYes bool, licenseKey string) (types.RecipeVars, error)
}
type RecipeRepository interface {
FindAll(m types.DiscoveryManifest) []types.OpenInstallationRecipe
}
// RecipeInstaller wrapper responsible for performing recipe validation, installation, and reporting install status
type RecipeInstaller interface {
promptIfNotLatestCLIVersion(ctx context.Context) error
Install() error
install(ctx context.Context) error
assertDiscoveryValid(ctx context.Context, m *types.DiscoveryManifest) error
discover(ctx context.Context) (*types.DiscoveryManifest, error)
executeAndValidate(ctx context.Context, m *types.DiscoveryManifest, r *types.OpenInstallationRecipe, vars types.RecipeVars, assumeYes bool) (string, error)
validateRecipeViaAllMethods(ctx context.Context, r *types.OpenInstallationRecipe, m *types.DiscoveryManifest, vars types.RecipeVars, assumeYes bool) (string, error)
executeAndValidateWithProgress(ctx context.Context, m *types.DiscoveryManifest, r *types.OpenInstallationRecipe, assumeYes bool) (string, error)
}
type RecipeBundler interface {
CreateCoreBundle() *recipes.Bundle
CreateAdditionalTargetedBundle(names []string) *recipes.Bundle
CreateAdditionalGuidedBundle() *recipes.Bundle
}
type RecipeBundleInstaller interface {
InstallStopOnError(bundle *recipes.Bundle, assumeYes bool) error
InstallContinueOnError(bundle *recipes.Bundle, assumeYes bool)
InstalledRecipesCount() int
}