datauploader

package
v0.0.0-...-955c50f Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 4

Documentation

Overview

Package datauploader contains routines upload inventory data to SSM - Inventory service

Package datauploader contains routines upload inventory data to SSM - Inventory service

Package datauploader contains routines upload inventory data to SSM - Inventory service

Index

Constants

View Source
const (
	// Name represents name of this component that uploads data to SSM
	Name = "InventoryUploader"
	// The maximum time window range for random back off before call PutInventory API
	Max_Time_TO_Back_Off = 30
)

Variables

This section is empty.

Functions

func ConvertToMap

func ConvertToMap(input interface{}) (res map[string]*string)

ConvertToMap converts given object to map[string]*string

func ConvertToSSMInventoryItem

func ConvertToSSMInventoryItem(item model.Item) (inventoryItem *ssm.InventoryItem, err error)

ConvertToSSMInventoryItem converts given InventoryItem to []map[string]*string

Types

type Impl

type Impl struct {
	// contains filtered or unexported fields
}

Impl implements content hash optimizations for inventory plugin

func NewOptimizerImpl

func NewOptimizerImpl(context context.T) (*Impl, error)

func NewOptimizerImplWithLocation

func NewOptimizerImplWithLocation(context context.T, rootDir string, fileName string) (*Impl, error)

func (*Impl) GetContentHash

func (i *Impl) GetContentHash(inventoryItemName string) (hash string)

func (*Impl) UpdateContentHash

func (i *Impl) UpdateContentHash(inventoryItemName, hash string) (err error)

type InventoryUploader

type InventoryUploader struct {
	// contains filtered or unexported fields
}

InventoryUploader implements functionality to upload data to SSM Inventory.

func NewInventoryUploader

func NewInventoryUploader(context context.T) (*InventoryUploader, error)

NewInventoryUploader creates a new InventoryUploader (which sends data to SSM Inventory)

func (*InventoryUploader) ConvertToSsmInventoryItems

func (u *InventoryUploader) ConvertToSsmInventoryItems(items []model.Item) (optimizedInventoryItems, nonOptimizedInventoryItems []*ssm.InventoryItem, err error)

ConvertToSsmInventoryItems converts given array of inventory.Item into an array of *ssm.InventoryItem. It returns 2 such arrays - one is optimized array which contains only contentHash for those inventory types where the dataset hasn't changed from previous collection. The other array is non-optimized array which contains both contentHash & content. This is done to avoid iterating over the inventory data twice. It throws error when it encounters error during conversion process.

func (InventoryUploader) GetDirtySsmInventoryItems

func (u InventoryUploader) GetDirtySsmInventoryItems(items []model.Item) (dirtyInventoryItems []*ssm.InventoryItem, err error)

GetDirtySsmInventoryItems get the inventory item data for items that have changes since last successful report to SSM.

func (*InventoryUploader) SendDataToSSM

func (u *InventoryUploader) SendDataToSSM(items []*ssm.InventoryItem) (err error)

SendDataToSSM uploads given inventory items to SSM

type Optimizer

type Optimizer interface {
	UpdateContentHash(inventoryItemName, hash string) (err error)
	GetContentHash(inventoryItemName string) (hash string)
}

Optimizer defines operations of content optimizer which inventory plugin makes use of

type SSMCaller

type SSMCaller interface {
	PutInventory(input *ssm.PutInventoryInput) (output *ssm.PutInventoryOutput, err error)
}

type T

type T interface {
	SendDataToSSM(items []*ssm.InventoryItem) (err error)
	ConvertToSsmInventoryItems(items []model.Item) (optimizedInventoryItems, nonOptimizedInventoryItems []*ssm.InventoryItem, err error)
	GetDirtySsmInventoryItems(items []model.Item) (dirtyInventoryItems []*ssm.InventoryItem, err error)
}

T represents contracts for SSM Inventory data uploader

Jump to

Keyboard shortcuts

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