util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocumentMerge

func DocumentMerge(a, b any, opts ...func(*mergo.Config)) (map[string]interface{}, error)

DocumentMerge merges two arguments using their marshalled json representations and returns the resulting data in a `map[string]interface{}`

func GetHttpFile

func GetHttpFile(ctx context.Context, uri string) ([]byte, error)

func GetHttpFileReader

func GetHttpFileReader(ctx context.Context, uri string) (io.ReadCloser, error)

func IsFilePathExists

func IsFilePathExists(filePath string) (bool, error)

IsFilePathExists checks whether specific file path exists

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

func WriteFileWithDirFromReader

func WriteFileWithDirFromReader(path string, reader io.Reader, perm fs.FileMode) error

WriteFileWithDirFromReader writes to a file from a byte reader interface

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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