util

package
v0.0.0-...-fb363da Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VectorLogDir = "_vector"

	// File to signal that Vector should be gracefully shut down
	ShutdownFile = "shutdown"
)

Subdirectory of the log directory containing files to control the Vector instance

View Source
const CommonBashTrapFunctions = `` /* 542-byte string literal not displayed */

Variables

This section is empty.

Functions

func Append

func Append(originXml string, properties []XmlNameValuePair) string

Append to exist xml dom

func ConvertToResourceRequirements

func ConvertToResourceRequirements(resources *kafkav1alpha1.ResourcesSpec) *corev1.ResourceRequirements

func CreateOrUpdate

func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object) (bool, error)

func CreateVectorShutdownFileCommand

func CreateVectorShutdownFileCommand(logDir string) string

Command to create a shutdown file for the vector container. Please delete it before starting your application using `RemoveVectorShutdownFileCommand` .

func ImagePullPolicy

func ImagePullPolicy(imagespec *kafkav1alpha1.ImageSpec) corev1.PullPolicy

func ImageRepository

func ImageRepository(imagespec *kafkav1alpha1.ImageSpec) string

func MakeConfigFileContent

func MakeConfigFileContent(config map[string]string) string

MakeConfigFileContent returns the content of a configuration file content such as: ``` key1 value1 key2 value2 ```

func MakePropertiesFileContent

func MakePropertiesFileContent(config map[string]string) string

MakePropertiesFileContent returns the content of a properties file content such as: ```properties key1=value1 key2=value2 ```

func OverrideConfigFileContent

func OverrideConfigFileContent(current string, override string) string

func OverrideProperties

func OverrideProperties(override []NameValuePair, current *[]NameValuePair)

func OverridePropertiesFileContent

func OverridePropertiesFileContent(current string, override []NameValuePair) (string, error)

OverridePropertiesFileContent use bufio resolve properties

func OverrideXmlContent

func OverrideXmlContent(current string, overrideProperties map[string]string) string

OverrideXmlContent overrides the content of a xml file append the override properties to the current xml dom

func QuantityToMB

func QuantityToMB(quantity resource.Quantity) float64

func RemoveVectorShutdownFileCommand

func RemoveVectorShutdownFileCommand(logDir string) string

/ Use this command to remove the shutdown file (if it exists) created by [`create_vector_shutdown_file_command`]. / You should execute this command before starting your application.

func ScanProperties

func ScanProperties(current string, properties *[]NameValuePair) error

func ToProperties

func ToProperties(conf map[string]string) string

convert map to properties string

Types

type Map

type Map map[string]string

func (*Map) MapMerge

func (m *Map) MapMerge(source map[string]string, replace bool)

type NameValuePair

type NameValuePair struct {
	Name  string
	Value string
	// contains filtered or unexported fields
}

type ResourceNameGenerator

type ResourceNameGenerator struct {
	InstanceName string
	RoleName     string
	GroupName    string
}

func NewResourceNameGenerator

func NewResourceNameGenerator(instanceName, roleName, groupName string) *ResourceNameGenerator

NewResourceNameGenerator new a ResourceNameGenerator

func NewResourceNameGeneratorOneRole

func NewResourceNameGeneratorOneRole(instanceName, groupName string) *ResourceNameGenerator

NewResourceNameGeneratorOneRole new a ResourceNameGenerator without roleName

func (*ResourceNameGenerator) GenerateResourceName

func (r *ResourceNameGenerator) GenerateResourceName(extraSuffix string) string

GenerateResourceName generate resource Name

type SecretVolumeBuilder

type SecretVolumeBuilder struct {
	VolumeName string
	// contains filtered or unexported fields
}

func (*SecretVolumeBuilder) AddAnnotation

func (s *SecretVolumeBuilder) AddAnnotation(key, value string) *SecretVolumeBuilder

add annotation

func (*SecretVolumeBuilder) Build

func (s *SecretVolumeBuilder) Build() corev1.Volume

Build

func (*SecretVolumeBuilder) SetAnnotations

func (s *SecretVolumeBuilder) SetAnnotations(annotations map[string]string) *SecretVolumeBuilder

set annotaions

type XmlConfiguration

type XmlConfiguration struct {
	XMLName    xml.Name           `xml:"configuration"`
	Properties []XmlNameValuePair `xml:"property"`
}

func NewXmlConfiguration

func NewXmlConfiguration(properties []XmlNameValuePair) *XmlConfiguration

func (*XmlConfiguration) DistinctProperties

func (c *XmlConfiguration) DistinctProperties(properties []XmlNameValuePair) []XmlNameValuePair

DistinctProperties distinct properties by name,

func (*XmlConfiguration) String

func (c *XmlConfiguration) String(properties []XmlNameValuePair) string

func (*XmlConfiguration) StringWithProperties

func (c *XmlConfiguration) StringWithProperties(properties map[string]string) string

type XmlNameValuePair

type XmlNameValuePair struct {
	Name  string `xml:"name"`
	Value string `xml:"value"`
}

Jump to

Keyboard shortcuts

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