Documentation ¶
Index ¶
- Constants
- func Base64Decode(str string) (string, error)
- func Base64Encode(str string) string
- func BoolPtr(b bool) *bool
- func CreateQueryStringFromMap(queryMap map[string]string) string
- func DataTypesJsonSliceToUnstructuredList(input datatypes.JSONSlice[datatypes.JSON]) ([]*unstructured.Unstructured, error)
- func DataTypesJsonToUnstructured(input *datatypes.JSON) (*unstructured.Unstructured, error)
- func DerefString(s *string) string
- func GetAge(timestamp *time.Time) *time.Duration
- func GetObjectFieldValue(object interface{}, fieldName string) (reflect.Value, error)
- func GetStringPtrValue(field reflect.Value) (string, error)
- func HyphenDelimitedString(input []string) string
- func IntPtr(i int) *int
- func IsNonNilPtr(field reflect.Value) bool
- func JsonPtr(j datatypes.JSON) *datatypes.JSON
- func MarshalJSON(mapDef map[string]interface{}) (datatypes.JSON, error)
- func MarshalObject(object interface{}) ([]byte, error)
- func NestedInt64OrFloat64(input map[string]interface{}, fields ...string) (int64, bool, error)
- func ParseImage(image string) (string, string, string, error)
- func ParseStructTag(tagString string) map[string]string
- func Ptr[T any](input T) *T
- func RandomAlphaNumericString(length int) string
- func RandomAlphaString(length int) string
- func RemoveDataTypesJsonFromDataTypesJsonSlice(name, kind string, instances *datatypes.JSONSlice[datatypes.JSON]) error
- func Retry(attemptsMax int, waitDurationSeconds int, f func() error) error
- func SqlNullInt64(input *uint) *sql.NullInt64
- func StringListContains(value string, input []string) bool
- func StringPtr(s string) *string
- func StringPtrToString(input *string) string
- func StringSliceContains(sl []string, name string, caseSensitive bool) bool
- func StringToInterfaceList(input []string) []interface{}
- func TimePtr(t time.Time) *time.Time
- func TypeName(in any) string
- func UnmarshalJSON(marshaledJson datatypes.JSON) (map[string]interface{}, error)
- func UnmarshalYAML(marshaledYaml string) (map[string]interface{}, error)
- func UnstructuredListToDatatypesJsonSlice(input []*unstructured.Unstructured) (datatypes.JSONSlice[datatypes.JSON], error)
- func UnstructuredToDatatypesJson(input *unstructured.Unstructured) (datatypes.JSON, error)
- func UnstructuredToYaml(input *unstructured.Unstructured) (string, error)
- func UpdateNamespace(jsonDef datatypes.JSON, namespace string) ([]byte, error)
- type MultiError
- type Operation
- type Operations
Constants ¶
const ( // this is used in internal/provider and pkg/threeport-installer to configure // the AWS role session name used for cross-account access to AWS resources AwsResourceManagerRoleSessionName = "threeport-control-plane" // used to query GetProviderRegionForLocation to determine the AWS region AwsProvider = "aws" // namespace used by the gateway system GatewaySystemNamespace = "nukleros-gateway-system" )
these are constants used throughout the threeport codebase, and may in some cases be placed here to avoid import cycles if placed elsewhere
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
Base64Decode base64 decodes any string.
func CreateQueryStringFromMap ¶
Given a map of key value pairs, creates a formatted http query string
func DataTypesJsonSliceToUnstructuredList ¶ added in v0.5.0
func DataTypesJsonSliceToUnstructuredList( input datatypes.JSONSlice[datatypes.JSON], ) ([]*unstructured.Unstructured, error)
DataTypesJsonSliceToUnstructuredList converts a slice of datatypes.JSON objects to a slice of unstructured objects
func DataTypesJsonToUnstructured ¶ added in v0.5.0
func DataTypesJsonToUnstructured(input *datatypes.JSON) (*unstructured.Unstructured, error)
DatatypesJsonToUnstructured converts a datatypes.JSON object to an unstructured object
func DerefString ¶ added in v0.5.2
DerefString returns the value of a string pointer or an empty string if the pointer is nil.
func GetObjectFieldValue ¶ added in v0.5.0
GetObjectFieldValue takes a struct object and a field name as a string and returns the value for that field from the struct if it exists. If the value of the field is a nil pointer, the string 'no value' will be returned.
func GetStringPtrValue ¶
GetStringPtrValue returns the string value of a pointer field.
func HyphenDelimitedString ¶ added in v0.4.0
HyphenDelimitedString takes a slice of strings and returns a hyphen delimited string.
func IsNonNilPtr ¶
IsNonNilPtr returns true if the field is a nil pointer.
func MarshalJSON ¶
MarshalJSON marshals a map[string]interface{} into a datatypes.JSON object
func MarshalObject ¶
MarshalObject takes an object interface and returns its json byte array.
func NestedInt64OrFloat64 ¶ added in v0.4.0
NestedInt64OrFloat64 returns the int64 value of the nested field in the unstructured object and gracefully handles the case where the value is a float64
func ParseImage ¶
ParseImage takes a full image and returns the registry, name and tag values.
func ParseStructTag ¶ added in v0.5.0
ParseStructTag parses a struct tag string into a map[string]string
func Ptr ¶ added in v0.5.0
func Ptr[T any](input T) *T
Ptr returns a pointer to the value passed in.
func RandomAlphaNumericString ¶
RandomAlphaNumericString returns a random string with the provided length using alpha-numeric charcaters.
func RandomAlphaString ¶
RandomAlphaString returns a random string with the provided length using alphabetic charcaters.
func RemoveDataTypesJsonFromDataTypesJsonSlice ¶ added in v0.5.0
func RemoveDataTypesJsonFromDataTypesJsonSlice( name, kind string, instances *datatypes.JSONSlice[datatypes.JSON], ) error
RemoveDataTypesJsonFromDataTypesJsonSlice removes a datatypes.JSON object from a slice of datatypes.JSON objects
func Retry ¶
Retry will retry a function until it succeeds or the maximum number of attempts is reached.
func SqlNullInt64 ¶ added in v0.5.0
SqlNullInt64 returns a pointer to a sql.NullInt64 value that represents NULL if the input pointer is nil.
func StringListContains ¶
StringListContains returns true if a string is in a list of strings.
func StringPtrToString ¶ added in v0.5.0
StringPtrToString converts a string pointer to a string.
func StringSliceContains ¶
StringSliceContains returns true if a slice contains a certain string.
func StringToInterfaceList ¶
func StringToInterfaceList(input []string) []interface{}
StringToInterfaceList converts a string slice to an interface slice.
func UnmarshalJSON ¶
UnmarshalJSON unmarshals a datatypes.JSON object into a map[string]interface{}
func UnmarshalYAML ¶
UnmarshalYAML unmarshals a YAML string into a map[string]interface{}
func UnstructuredListToDatatypesJsonSlice ¶ added in v0.5.0
func UnstructuredListToDatatypesJsonSlice(input []*unstructured.Unstructured) ( datatypes.JSONSlice[datatypes.JSON], error, )
UnstructuredListToDatatypesJsonSlice converts a slice of unstructured objects to a slice of datatypes.JSON objects
func UnstructuredToDatatypesJson ¶ added in v0.5.0
func UnstructuredToDatatypesJson(input *unstructured.Unstructured) (datatypes.JSON, error)
UnstructuredToDatatypesJson converts an unstructured object to a datatypes.JSON object
func UnstructuredToYaml ¶ added in v0.5.0
func UnstructuredToYaml(input *unstructured.Unstructured) (string, error)
UnstructuredToYaml converts an unstructured object to a yaml string
Types ¶
type MultiError ¶
type MultiError struct {
Errors []error
}
MultiError is an error type that contains multiple errors.
func (*MultiError) AppendError ¶
func (me *MultiError) AppendError(err error)
AppendError adds an error to the MultiError.
func (MultiError) Error ¶
func (me MultiError) Error() error
Error returns a string representation of the MultiError.
type Operation ¶
Operation contains a create, update and delete function for a Threeport API object.
type Operations ¶
type Operations struct {
Operations []*Operation
}
Operations contains a list of operations that have been performed on the Threeport API.
func (*Operations) AppendOperation ¶
func (r *Operations) AppendOperation(operation Operation)
AppendOperation adds a create operation to the operation stack.
func (*Operations) Create ¶
func (r *Operations) Create() error
Create executes all create operations in the operation stack.
func (*Operations) Delete ¶
func (r *Operations) Delete() error
ExecuteUpdateOperations executes all delete operations in the operation stack.