utils

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CloudTypeOpenStack = "OpenStack"
)
View Source
const (
	LoadBalancerTaikun = "Taikun"
)
View Source
const NotFoundAfterCreateOrUpdateError = "notFoundAfterCreateOrUpdateError"

Variables

This section is empty.

Functions

func AddOptionalFieldsToSchema

func AddOptionalFieldsToSchema(schema map[string]*schema.Schema, keys ...string)

func AddRequiredFieldsToSchema

func AddRequiredFieldsToSchema(schema map[string]*schema.Schema, keys ...string)

func Atoi32

func Atoi32(str string) (int32, error)

func BoolPtr

func BoolPtr(s bool) *bool

func ByteToGibiByte

func ByteToGibiByte(x float64) int

func ContinentShorthand

func ContinentShorthand(continent string) string

func DataSourceSchemaFromResourceSchema

func DataSourceSchemaFromResourceSchema(rs map[string]*schema.Schema) map[string]*schema.Schema

DataSourceSchemaFromResourceSchema is a recursive func that converts an existing Resource schema to a Datasource schema. All schema elements are copied, but certain attributes are ignored or changed: - all attributes have Computed = true - all attributes have ForceNew, Required = false - Validation funcs and attributes (e.g. MaxItems) are not copied

func DateToDateTime

func DateToDateTime(date string) strfmt.DateTime

func DeleteFieldsFromSchema

func DeleteFieldsFromSchema(schema map[string]*schema.Schema, keys ...string)

func FilePathToBase64String

func FilePathToBase64String(filePath string) (string, error)

Read file contents, encode in base64 and return

func FlattenTaikunImages

func FlattenTaikunImages(rawImages ...tkcore.CommonStringBasedDropdownDto) []map[string]interface{}

func GetAlertingIntegrationType

func GetAlertingIntegrationType(integrationType string) tkcore.AlertingIntegrationType

func GetEPrometheusType

func GetEPrometheusType(prometheusType string) tkshowback.EPrometheusType

func GetKubeconfigRoleID

func GetKubeconfigRoleID(role string) int32

func GetLastCharacter

func GetLastCharacter(zoneString string) string

func GetLoadBalancingSolution

func GetLoadBalancingSolution(octaviaEnabled bool, taikunLBEnabled bool) string

func GetLockMode

func GetLockMode(locked bool) string

func GetPrometheusType

func GetPrometheusType(prometheusType string) tkcore.PrometheusType

func GetProxmoxStorageStringForServer

func GetProxmoxStorageStringForServer(projectID int32, apiClient *tk.Client) (string, error)

Proxmox storage options in kubernetes profile and Project are different from what we send while creating k8s servers

func GetReadAfterOpTimeout

func GetReadAfterOpTimeout(isUpdate bool) time.Duration

func GetSecurityGroupProtocol

func GetSecurityGroupProtocol(protocol string) tkcore.SecurityGroupProtocol

func GetShowbackType

func GetShowbackType(showbackType string) tkshowback.EShowbackType

func GibiByteToByte

func GibiByteToByte(gibiBytes int) float64

func HashAttributes

func HashAttributes(keys ...string) func(v interface{}) int

func I32toa

func I32toa(x int32) string

func IgnoreChangeFromEmpty

func IgnoreChangeFromEmpty(k string, old string, new string, d *schema.ResourceData) bool

This function is used when we have an API parameter PARAM with the following behavior - We set PARAM to "x" and API returns PARAM with "x" (there is no change) - We do not set PARAM. API figures out some value "y" and returns PARAM with value "y" (Terraform must ignore the change)

func NewNullableFloat64

func NewNullableFloat64(s float64) tkcore.NullableFloat64

func ParseLoadBalancingSolution

func ParseLoadBalancingSolution(loadBalancingSolution string) (octaviaEnabled bool, taikunLBEnabled bool)

func RandomBool

func RandomBool() bool

func RandomEmail

func RandomEmail() string

func RandomInt

func RandomInt(maxInt int) int

Return an integer in the range [0; maxInt[

func RandomString

func RandomString() string

func RandomTestName

func RandomTestName() string

func RandomURL

func RandomURL() string

func ReadAfterCreateWithRetries

func ReadAfterCreateWithRetries(readFunc schema.ReadContextFunc, ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics

func ReadAfterUpdateWithRetries

func ReadAfterUpdateWithRetries(readFunc schema.ReadContextFunc, ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics

func RemoveForceNewsFromSchema

func RemoveForceNewsFromSchema(schema map[string]*schema.Schema)

func ResourceGetStringList

func ResourceGetStringList(data interface{}) []string

func ResourceTaikunCloudCredentialDelete

func ResourceTaikunCloudCredentialDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics

func Rfc3339DateTimeToDate

func Rfc3339DateTimeToDate(date string) string

func SetFieldInSchema

func SetFieldInSchema(schema map[string]*schema.Schema, key string, value *schema.Schema)

func SetResourceDataFromMap

func SetResourceDataFromMap(d *schema.ResourceData, m map[string]interface{}) error

func SetResourceDataId

func SetResourceDataId(d *schema.ResourceData, id int32)

func SetValidateDiagFuncToSchema

func SetValidateDiagFuncToSchema(schema map[string]*schema.Schema, key string, f schema.SchemaValidateDiagFunc)

func ShortRandomTestName

func ShortRandomTestName() string

func SliceOfSTringsToSliceOfInt32

func SliceOfSTringsToSliceOfInt32(listOfStrings []interface{}) ([]int32, error)

Slice of strings to slice of int32

func StringIsCron

func StringIsCron(i interface{}, path cty.Path) diag.Diagnostics

func StringIsDate

func StringIsDate(i interface{}, path cty.Path) diag.Diagnostics

func StringIsEmail

func StringIsEmail(i interface{}, path cty.Path) diag.Diagnostics

func StringIsFilePath

func StringIsFilePath(i interface{}, path cty.Path) diag.Diagnostics

func StringIsInt

func StringIsInt(i interface{}, path cty.Path) diag.Diagnostics

func StringIsUUID

func StringIsUUID(i interface{}, path cty.Path) diag.Diagnostics

func StringLenBetween

func StringLenBetween(min int, max int) schema.SchemaValidateDiagFunc

func StringPtr

func StringPtr(s string) *string

func TimedOut

func TimedOut(err error) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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