datauploader

package
v0.0.0-...-84afe80 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

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

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"
)

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 (*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(context context.T, 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) SendDataToSSM

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

SendDataToSSM uploads given inventory items to SSM

type MockOptinizer

type MockOptinizer struct {
	mock.Mock
}

Mock stands for a mocked plugin.

func NewMockDefault

func NewMockDefault() *MockOptinizer

func (*MockOptinizer) GetContentHash

func (m *MockOptinizer) GetContentHash(inventoryItemName string) (hash string)

func (*MockOptinizer) UpdateContentHash

func (m *MockOptinizer) UpdateContentHash(inventoryItemName, hash string) (err error)

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 T

type T interface {
	SendDataToSSM(context context.T, items []*ssm.InventoryItem) (err error)
	ConvertToSsmInventoryItems(context context.T, items []model.Item) (optimizedInventoryItems, nonOptimizedInventoryItems []*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