utils

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileSizeLimit limits the size of file to be used by the user
	FileSizeLimit = int64(20 * 1024 * 1024) // 20 MB
)

Variables

This section is empty.

Functions

func CheckAPPName added in v0.10.6

func CheckAPPName(appName string, client *civogo.Client) bool

CheckAPPName is a function to check if the app name is valid

func CheckFileSize added in v1.1.1

func CheckFileSize(path string) error

CheckFileSize function checks if the file the file size is less than the allowed limit(current: 20MB)

func GetCommaSeparatedAllowedKeys added in v0.10.12

func GetCommaSeparatedAllowedKeys(allowedKeys []string) string

GetCommaSeparatedAllowedKeys is used by "tfplugindocs" CLI to generate Markdown docs

func InPool added in v1.0.17

func InPool(id string, list []civogo.KubernetesClusterPoolConfig) bool

InPool is a utility function to check if a node pool is in a kubernetes cluster

func RandomName

func RandomName() string

RandomName generates a Heroku-style random name for instances/clusters/etc

func ResourceCommonParseID added in v0.10.6

func ResourceCommonParseID(id string) (string, string, error)

ResourceCommonParseID is a function to parse the ID of a resource

func StringToInt added in v1.0.21

func StringToInt(s string) (int, error)

StringToInt converts a string to an int

func ValidateCNIName added in v1.0.8

func ValidateCNIName(v interface{}, _ string) (ws []string, es []error)

ValidateCNIName is a function to check if the cni name is valid

func ValidateClusterType added in v1.0.48

func ValidateClusterType(v interface{}, path cty.Path) diag.Diagnostics

ValidateClusterType Validates if the user has provided a supported cluster type.

func ValidateName added in v0.10.6

func ValidateName(v interface{}, _ string) (ws []string, es []error)

ValidateName is a function to check if the name is valid

func ValidateNameOnlyContainsAlphanumericCharacters added in v1.0.17

func ValidateNameOnlyContainsAlphanumericCharacters(v interface{}, _ cty.Path) diag.Diagnostics

ValidateNameOnlyContainsAlphanumericCharacters validate name only contains alphanumeric characters, hyphens, underscores and dots

func ValidateNameSize added in v0.10.6

func ValidateNameSize(v interface{}, _ string) (ws []string, es []error)

ValidateNameSize is a function to check the size of a name

func ValidateProviderVersion added in v1.1.0

func ValidateProviderVersion(v interface{}, path cty.Path) diag.Diagnostics

ValidateProviderVersion function compares the current provider verson of the user with the threshold version and shows warning accordingly

func ValidateUUID added in v1.0.49

func ValidateUUID(v interface{}, k string) (ws []string, errors []error)

ValidateUUID checks if a given string is a UUID or not

Types

type CustomError added in v1.0.47

type CustomError struct {
	Code   string `json:"code"`
	Reason string `json:"reason"`
}

CustomError captures a specific portion of the full API error

func ParseErrorResponse added in v1.0.47

func ParseErrorResponse(errorMsg string) (*CustomError, error)

ParseErrorResponse extracts and parses the JSON error response

func (*CustomError) Error added in v1.0.47

func (e *CustomError) Error() string

Error implements the error interface

type VersionInfo added in v1.1.0

type VersionInfo struct {
	ProviderSelections map[string]string `json:"provider_selections"`
}

VersionInfo stores Provider's version Info

Jump to

Keyboard shortcuts

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