utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRequeueDelaySeconds = 900

SQS imposed maximum message delay

Variables

View Source
var (
	// TimeNowFunc directs to the TimeNow function.
	// This is intended to be overridden for testing.
	TimeNowFunc = TimeNowRFC3339
)

Functions

func DateTimeFormat

func DateTimeFormat(inputTime time.Time) *strfmt.DateTime

DateTimeFormat converts time.Time to strfmt.DateTime.

func GenerateResourceID

func GenerateResourceID(awsAccountID string, region string, schema string) string

GenerateResourceID returns a formatted custom Resource ID.

func GetRegions

func GetRegions(ec2Svc ec2iface.EC2API) (regions []*string)

GetRegions returns all the active AWS regions for a given account.

func GetServiceRegions

func GetServiceRegions(activeRegions []*string, serviceID string) (regions []*string)

GetServiceRegions returns the intersection of the active regions passed in by the poller input and the regions specific to the given service

func LogAWSError

func LogAWSError(apiCall string, err error)

LogAWSError logs an AWS error to zap in a digestable format.

func ParseTagSlice

func ParseTagSlice(slice interface{}) map[string]*string

ParseTagSlice takes a list of structs representing tags, and returns a map of key/value pairs

func ParseTimeRFC3339

func ParseTimeRFC3339(timeString string) time.Time

ParseTimeRFC3339 parses a time string into a valid RFC3339 time.

func Requeue

func Requeue(scanRequest poller.ScanMsg, delay int64)

Requeue sends a scan request back to the poller input queue

func StringToDateTime

func StringToDateTime(timeString string) *strfmt.DateTime

StringToDateTime parses a time string into a strfmt.DateTime struct

func TimeNowRFC3339

func TimeNowRFC3339() time.Time

TimeNowRFC3339 returns the current time in RFC3339 format.

func UnixTimeToDateTime

func UnixTimeToDateTime(epochTimeStamp int64) *strfmt.DateTime

UnixTimeToDateTime parses an Int64 representing an epoch timestamp to a strfmt.DateTime struct

Types

type ParsedResourceID

type ParsedResourceID struct {
	AccountID string
	Region    string
	Schema    string
}

func ParseResourceID

func ParseResourceID(resourceID string) *ParsedResourceID

Jump to

Keyboard shortcuts

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