util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 21 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

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

Append to exist xml dom

func CreateOrUpdate

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

CreateOrUpdate creates or updates the client.object

func DecodeBase64Byte

func DecodeBase64Byte(value []byte) ([]byte, error)

func Encode

func Encode(value []byte) []byte

Encode queues message

func GenerateRandomStr

func GenerateRandomStr(length int) string

GenerateRandomStr - generate random string for given length

func GenerateSecretAccessKey

func GenerateSecretAccessKey() (string, error)

GenerateSecretAccessKey - generate random base64 numeric value from a random seed.

func GetSecurityValueByKey

func GetSecurityValueByKey(secret *corev1.Secret, key string) (string, error)

GetSecurityValueByKey get security value from secret by key

func Indent2SpacesToTab

func Indent2SpacesToTab(code string) string

func Indent4SpacesToTab

func Indent4SpacesToTab(code string) string

func IndentSpacesToTab

func IndentSpacesToTab(code string, spaces int) string

func IndentTab2Spaces

func IndentTab2Spaces(code string) string

func IndentTab4Spaces

func IndentTab4Spaces(code string) string

func IndentTabToSpaces

func IndentTabToSpaces(code string, spaces int) 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 RemoveSpecialCharacter

func RemoveSpecialCharacter(str string) string

RemoveSpecialCharacter - remove special character

func ScanProperties

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

func UpdateStatus

func UpdateStatus(ctx context.Context, reconcilier client.Client, instance client.Object) error

UpdateStatus updates the status of the Server resource https://stackoverflow.com/questions/76388004/k8s-controller-update-status-and-condition

Types

type Base64

type Base64[T []byte | string] struct {
	Data T
}

func (Base64[T]) Decode

func (b Base64[T]) Decode() (T, error)

func (Base64[T]) Encode

func (b Base64[T]) Encode() T

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 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