helper

package
v0.0.0-...-f99fb5f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateName

func CreateName(identifier string, suffix string) string

CreateName creates a name for resources created with CSP Connector to help identifying these resources.

The form of the name is as follows: ausm-csp-<CRC-64 hashed identified>[-suffix] Example names: ausm-csp-982CE62C7BA91558 ausm-csp-982CE62C7BA91558-mysuffix

func CreateNameWithRand

func CreateNameWithRand(identifier string, suffix string) string

CreateNameWithRand follows the same pattern as CreateName but additionally adds 6 random alphanumerical characters at the end to decrease the chance of name conflict after a dash character.

func Int64PointerToString

func Int64PointerToString(value *int64) string

If the value is nil, returns empty string, otherwise converts the int64 to a string number.

func NameCreatedByScript

func NameCreatedByScript(name string) bool

NameCreatedByScript is a check if the generated name was actually generated by the script.

It just checks if the name has our name prefix.

func NameCreatedForIdentifier

func NameCreatedForIdentifier(name, identifier string) bool

NameCreatedForIdentifier is a check if the generated name was actually generated for the provided identifier.

func SliceStringPointersToSliceStrings

func SliceStringPointersToSliceStrings(s []*string) []string

Takes a slice of pointers to strings and returns a slice of regular strings (empty strings for nil pointers).

func StringPointerToString

func StringPointerToString(s *string) string

Returns dereferenced string - if the pointer is a nil, returns empty string.

func StringToInt64Pointer

func StringToInt64Pointer(value string) *int64

If string is empty, returns nil, otherwise returns a pointer to int64 variable casted from a given string.

func StringToStringPointer

func StringToStringPointer(s string) *string

If string is empty, returns nil, otherwise returns a pointer to that particular string.

func StringToUInt32Pointer

func StringToUInt32Pointer(value string) *uint32

If string is empty, returns nil, otherwise returns a pointer to uint32 variable casted from a given string.

func StringToUInt64Pointer

func StringToUInt64Pointer(value string) *uint64

If string is empty, returns nil, otherwise returns a pointer to uint64 variable casted from a given string.

func UInt32PointerToString

func UInt32PointerToString(value *uint32) string

If the value is nil, returns empty string, otherwise converts the uint32 to a string number.

Types

type Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

func SetFromSlice

func SetFromSlice[T comparable](s []T) Set[T]

func (*Set[T]) Has

func (s *Set[T]) Has(v T) bool

Jump to

Keyboard shortcuts

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