appconfiguration

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToSpec

func AppendToSpec(resourceType models.Type, resourceID string, spec *models.Spec, resource any) error

AppendToSpec adds a Kubernetes resource to a spec's resources slice.

func CallGenerators

func CallGenerators(spec *models.Spec, newGenerators ...NewGeneratorFunc) error

CallGenerators calls the Generate method of each AppsGenerator instance returned by the given NewGeneratorFuncs.

func ForeachOrdered

func ForeachOrdered[T any](m map[string]T, f func(key string, value T) error) error

ForeachOrdered executes the given function on each item in the map in order of their keys.

func GenericPtr

func GenericPtr[T any](i T) *T

GenericPtr returns a pointer to the provided value.

func KubernetesResourceID

func KubernetesResourceID(typeMeta metav1.TypeMeta, objectMeta metav1.ObjectMeta) string

KubernetesResourceID returns the unique ID of a Kubernetes resource based on its type and metadata.

func KusionPathDependency

func KusionPathDependency(id, name string) string

KusionPathDependency returns the implicit resource dependency path based on the resource id and name with the "$kusion_path" prefix.

func MergeMaps

func MergeMaps(maps ...map[string]string) map[string]string

MergeMaps merges multiple map[string]string into one map[string]string. If a map is nil, it skips it and moves on to the next one. For each non-nil map, it iterates over its key-value pairs and adds them to the merged map. Finally, it returns the merged map.

func ProviderExtensions

func ProviderExtensions(provider *models.Provider, providerMeta map[string]any, resourceType string) map[string]interface{}

ProviderExtensions returns the extended information of provider based on the provider and type of the resource.

func TerraformResource

func TerraformResource(id string, dependsOn []string, attrs, exts map[string]interface{}) models.Resource

TerraformResource returns the Terraform resource in the form of Kusion's spec resource.

func TerraformResourceID

func TerraformResourceID(provider *models.Provider, resourceType string, resourceName string) string

TerraformResourceID returns the unique ID of a Terraform resource based on its provider, type and name.

func UniqueAppLabels

func UniqueAppLabels(projectName, appName string) map[string]string

UniqueAppLabels returns a map of labels that identify an app based on its project and name.

func UniqueAppName

func UniqueAppName(projectName, stackName, appName string) string

UniqueAppName returns a unique name for a workload based on its project and app name.

Types

type Generator

type Generator interface {
	Generate(spec *models.Spec) error
}

func CallGeneratorFuncs

func CallGeneratorFuncs(newGenerators ...NewGeneratorFunc) ([]Generator, error)

CallGeneratorFuncs calls each NewGeneratorFunc in the given slice and returns a slice of AppsGenerator instances.

type NewGeneratorFunc

type NewGeneratorFunc func() (Generator, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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