util

package
v0.0.0-...-8758b99 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT-0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFilePathExists

func IsFilePathExists(filePath string) (bool, error)

IsFilePathExists checks whether specific file path exists

func Merge

func Merge(
	dst, src any,
	marshaller func(v any) ([]byte, error),
	unmarshaller func(data []byte, v any) error,
	opts ...func(*mergo.Config),
) (map[string]interface{}, error)

Merge is a wrapper around the "Merge" from dario.cat/mergo which automatically handles repeated conversions between raw representations of data and nested key-value objects

dst and src can either both be of type []byte, or both will be marshalled into a binary representation using the provided marshaller func.

func RetryExponentialBackoff

func RetryExponentialBackoff(attempts int, initial time.Duration, f func() error) error

func WriteFileWithDir

func WriteFileWithDir(filePath string, data []byte, perm fs.FileMode) error

Wraps os.WriteFile to automatically create parent directories such that the caller does not need to ensure the existence of the file's directory

Types

type EC2API

type EC2API interface {
	DescribeInstanceTypes(ctx context.Context, params *ec2.DescribeInstanceTypesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeInstanceTypesOutput, error)
}

type EC2Client

type EC2Client struct {
	Client *ec2.Client
}

func (*EC2Client) DescribeInstanceTypes

func (c *EC2Client) DescribeInstanceTypes(ctx context.Context, params *ec2.DescribeInstanceTypesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeInstanceTypesOutput, error)

type EniInfo

type EniInfo struct {
	EniCount        int32
	PodsPerEniCount int32
}

func GetEniInfoForInstanceType

func GetEniInfoForInstanceType(ec2API EC2API, instanceType string) (EniInfo, error)

Jump to

Keyboard shortcuts

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