cloudwatch

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudwatchAPI

type CloudwatchAPI interface {
	GetMetricData(ctx context.Context,
		params *cloudwatch.GetMetricDataInput,
		optFns ...func(*cloudwatch.Options)) (*cloudwatch.GetMetricDataOutput, error)
}

CloudwatchAPI defines the interface for AWS S3 SDK functions

type S3ByteCountResults

type S3ByteCountResults struct {
	Timestamps []time.Time
	Values     []float64
}

S3ByteCountResults contains the results from GetS3ByteCount()

Timestamps/values are ordered newest first at the 0th index and ordered descending

type S3ObjectCountResults

type S3ObjectCountResults struct {
	Timestamps []time.Time
	Values     []float64
}

S3ObjectCountResults contains the results from GetS3ObjectCount()

Timestamps/values are ordered newest first at the 0th index and ordered descending

type Service

type Service interface {
	// GetS3ObjectCount returns the amount of objects in an S3 bucket at the time of the last cloudwatch metric for ALL storage types
	//
	// time units:
	//   `startTimeDiff` - hours
	//   `period`        - seconds
	GetS3ObjectCount(ctx context.Context, bucketName string, startTimeDiff int, period int32) (*S3ObjectCountResults, error)

	// GetS3ByteCount returns the amount of bytes in an S3 bucket at the time of the last cloudwatch metric for a given storage type
	//
	// see StorageType constants for type
	GetS3ByteCount(ctx context.Context, bucketName string, storageType StorageType, startTimeDiff int, period int32) (*S3ByteCountResults, error)
}

Service defines functions related to Cloudwatch operations

func NewService

func NewService(opts ...ServiceOption) Service

NewService returns an initialized Cloudwatch service

type ServiceOption

type ServiceOption func(s *service)

ServiceOption is used with NewService and configures the newly created s3Service

func WithAPI

func WithAPI(client CloudwatchAPI) ServiceOption

WithAPI should be used if you want to initialize your own S3 client (such as in cases of a mock S3 client for testing) This cannot be used with WithAWSEndpoint

func WithAWSEndpoint

func WithAWSEndpoint(awsEndpoint string) ServiceOption

WithAWSEndpoint sets endpoint to be used by the AWS client This cannot be used with WithS3API

func WithRegion

func WithRegion(region string) ServiceOption

WithRegion sets the AWS client region

type StorageType

type StorageType string

StorageType defines the name of an S3 storage class

const (
	StandardStorage                StorageType = "StandardStorage"
	IntelligentTieringFAStorage    StorageType = "IntelligentTieringFAStorage"
	IntelligentTieringIAStorage    StorageType = "IntelligentTieringIAStorage"
	IntelligentTieringAAStorage    StorageType = "IntelligentTieringAAStorage"
	IntelligentTieringAIAStorage   StorageType = "IntelligentTieringAIAStorage"
	IntelligentTieringDAAStorage   StorageType = "IntelligentTieringDAAStorage"
	StandardIAStorage              StorageType = "StandardIAStorage"
	StandardIASizeOverhead         StorageType = "StandardIASizeOverhead"
	StandardIAObjectOverhead       StorageType = "StandardIAObjectOverhead"
	OneZoneIAStorage               StorageType = "OneZoneIAStorage"
	OneZoneIASizeOverhead          StorageType = "OneZoneIASizeOverhead"
	ReducedRedundancyStorage       StorageType = "ReducedRedundancyStorage"
	GlacierInstantRetrievalStorage StorageType = "GlacierInstantRetrievalStorage"
	GlacierStorage                 StorageType = "GlacierStorage"
	GlacierStagingStorage          StorageType = "GlacierStagingStorage"
	GlacierObjectOverhead          StorageType = "GlacierObjectOverhead"
	GlacierS3ObjectOverhead        StorageType = "GlacierS3ObjectOverhead"
	DeepArchiveStorage             StorageType = "DeepArchiveStorage"
	DeepArchiveObjectOverhead      StorageType = "DeepArchiveObjectOverhead"
	DeepArchiveS3ObjectOverhead    StorageType = "DeepArchiveS3ObjectOverhead"
	DeepArchiveStagingStorage      StorageType = "DeepArchiveStagingStorage"
)

Possible S3 storage types

Jump to

Keyboard shortcuts

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