recipes

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Used for recipe download failures.
	RecipeDownloadFailed = "RecipeDownloadFailed"

	// Used for recipe deployment failures.
	RecipeDeploymentFailed = "RecipeDeploymentFailed"

	// Used for recipe validation failures.
	RecipeValidationFailed = "RecipeValidationFailed"

	// Used for recipe deletion failures.
	RecipeDeletionFailed = "RecipeDeletionFailed"

	// Used for errors encountered during processing recipe outputs.
	InvalidRecipeOutputs = "InvalidRecipeOutputs"

	// Used for errors encountered while reading a recipe from registry.
	RecipeLanguageFailure = "RecipeLanguageFailure"

	// Used for errors encountered while cleaning up of obsolete resources during patch operation.
	RecipeGarbageCollectionFailed = "RecipeGarbageCollectionFailed"

	// Used for errors encountered when getting recipe parameters.
	RecipeGetMetadataFailed = "RecipeGetMetadataFailed"

	// Used for errors when checking the existence of a recipe.
	RecipeNotFoundFailure = "RecipeNotFoundFailure"

	// Used for errors with recipe drivers
	RecipeDriverNotFoundFailure = "DriverNotFoundFailure"

	// Used for errors with recipe configuration
	RecipeConfigurationFailure = "RecipeConfigurationFailure"

	// Used for errors encountered while loading recipe secrets.
	LoadSecretsFailed = "LoadSecretsFailed"
)
View Source
const (
	TemplateKindBicep     = "bicep"
	TemplateKindTerraform = "terraform"

	// Recipe outputs are expected to be wrapped under an object named "result"
	ResultPropertyName = "result"
)

Variables

View Source
var (
	SupportedTemplateKind = []string{TemplateKindBicep, TemplateKindTerraform}
)

Functions

func GetEnvAppResourceNames added in v0.31.0

func GetEnvAppResourceNames(resourceMetadata *ResourceMetadata) (string, string, string, error)

GetEnvAppResourceNames returns the application, environment and resource names.

func GetErrorDetails added in v0.27.0

func GetErrorDetails(err error) *v1.ErrorDetails

GetErrorDetails is used to get ErrorDetails from different error types.

func GetGitURL added in v0.31.0

func GetGitURL(templatePath string) (*url.URL, error)

GetGitURL returns git url from generic git module source. git::https://exmaple.com/project/module -> https://exmaple.com/project/module

func GetSecretStoreID added in v0.31.0

func GetSecretStoreID(envConfig Configuration, templatePath string) (string, error)

GetSecretStoreID returns secretstore resource ID associated with git private terraform repository source.

func GetURLPrefix added in v0.31.0

func GetURLPrefix(resourceRecipe *ResourceMetadata) (string, error)

GetURLPrefix returns the url prefix to be added to the template path before adding it to the .gitconfig and terraform config.

Types

type Configuration

type Configuration struct {
	// Kubernetes Runtime configuration for the environment.
	Runtime RuntimeConfiguration
	// Cloud providers configuration for the environment
	Providers datamodel.Providers
	// Simulated represents whether the environment is simulated or not.
	Simulated bool

	RecipeConfig datamodel.RecipeConfigProperties
}

Configuration represents kubernetes runtime and cloud provider configuration, which is used by the driver while deploying recipes.

type EnvironmentDefinition

type EnvironmentDefinition struct {
	// Name represents the name of the recipe within the environment
	Name string
	// Driver represents the kind of infrastructure language used to define recipe.
	Driver string
	// ResourceType represents the type of the portable resource this recipe can be consumed by.
	ResourceType string
	// Parameters represents key/value pairs to pass into the recipe template for every resource using this recipe. Specified during recipe registration to environment. Can be overridden by the radius resource consuming this recipe.
	Parameters map[string]any
	// TemplatePath represents path to the template provided by the recipe.
	TemplatePath string
	// TemplateVersion represents the version of the terraform module provided by the recipe.
	TemplateVersion string
	// Allows insecure connections to registry without SSL check.
	PlainHTTP bool
}

EnvironmentDefinition represents the recipe configuration details.

type KubernetesRuntime

type KubernetesRuntime struct {
	// Namespace is set to the application namespace when the portable resource is application-scoped, and set to the environment namespace when it is environment scoped
	Namespace string `json:"namespace,omitempty"`
	// EnvironmentNamespace is set to environment namespace.
	EnvironmentNamespace string `json:"environmentNamespace"`
}

KubernetesRuntime represents application and environment namespaces.

type RecipeError

type RecipeError struct {
	ErrorDetails     v1.ErrorDetails
	DeploymentStatus util.RecipeDeploymentStatus
}

func NewRecipeError

func NewRecipeError(code string, message string, deploymentStatus util.RecipeDeploymentStatus, details ...*v1.ErrorDetails) *RecipeError

NewRecipeError creates a new RecipeError error with a given code, message and error details.

func (*RecipeError) Error

func (r *RecipeError) Error() string

Error returns an error string describing the error code and message.

func (*RecipeError) Is

func (e *RecipeError) Is(target error) bool

type RecipeOutput

type RecipeOutput struct {
	// Resources represents the list of output resources deployed recipe.
	Resources []string

	// Secrets represents the key/value pairs of secret values of the deployed resource.
	Secrets map[string]any

	// Values represents the key/value pairs of properties of the deployed resource.
	Values map[string]any

	// Status represents the recipe status at deployment time of resource.
	Status *rpv1.RecipeStatus
}

RecipeOutput represents recipe deployment output.

func (*RecipeOutput) PrepareRecipeResponse

func (ro *RecipeOutput) PrepareRecipeResponse(resultValue map[string]any) error

PrepareRecipeOutput populates the recipe output from the recipe deployment output stored in the "result" object. outputs map is the value of "result" output from the recipe deployment response.

type ResourceMetadata

type ResourceMetadata struct {
	// Name represents the name of the recipe within the environment
	Name string
	// ApplicationID represents fully qualified resource ID for the application that the portable resource is consumed by
	ApplicationID string
	// EnvironmentID represents fully qualified resource ID for the environment that the portable resource is linked to
	EnvironmentID string
	// ResourceID represents fully qualified resource ID for the resource the recipe is deploying
	ResourceID string
	// Parameters represents key/value pairs to pass into the recipe template. Overrides any parameters set by the environment.
	Parameters map[string]any
}

ResourceMetadata represents recipe details provided while creating a portable resource.

type RuntimeConfiguration

type RuntimeConfiguration struct {
	Kubernetes *KubernetesRuntime `json:"kubernetes,omitempty"`
}

RuntimeConfiguration represents Kubernetes Runtime configuration for the environment.

Directories

Path Synopsis
Package configloader is a generated GoMock package.
Package configloader is a generated GoMock package.
Package driver is a generated GoMock package.
Package driver is a generated GoMock package.
Package engine is a generated GoMock package.
Package engine is a generated GoMock package.
Package terraform is a generated GoMock package.
Package terraform is a generated GoMock package.
config/backends
Package backends is a generated GoMock package.
Package backends is a generated GoMock package.
config/providers
Package providers is a generated GoMock package.
Package providers is a generated GoMock package.

Jump to

Keyboard shortcuts

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