mock

package
v0.0.0-...-7cac148 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

This Mock backend is a very simple model of how a backend client should look like when implementing the `backend.Client` interface

func New

func New() Backend

Initialize the Mock backend client

Normally you would like to inject its own config parameters coming from the `config.Service` and also if there is a client you need to initialize, here is the place to do it since this struct will be available for you in all the func you need to implement from the `backend.Client` interface

func (Backend) GetAttribute

func (m Backend) GetAttribute(nodeID string) (backend.NodeAttribute, error)

func (Backend) GetCheckinCountsTimeSeries

func (m Backend) GetCheckinCountsTimeSeries(time.Time, time.Time,
	map[string][]string) ([]backend.CountPeroid, error)

func (Backend) GetCreateCountsTimeSeries

func (es Backend) GetCreateCountsTimeSeries(startTime, endTime time.Time,
	filters map[string][]string) ([]backend.CountPeroid, error)

func (Backend) GetDateOfOldestConvergeIndices

func (es Backend) GetDateOfOldestConvergeIndices() (time.Time, bool, error)

func (Backend) GetDeletedCountsTimeSeries

func (es Backend) GetDeletedCountsTimeSeries(startTime, endTime time.Time,
	filters map[string][]string) ([]backend.CountPeroid, error)

func (Backend) GetErrors

func (m Backend) GetErrors(int32, map[string][]string) ([]*backend.ChefErrorCount, error)

func (Backend) GetInventoryNodes

func (m Backend) GetInventoryNodes(ctx context.Context, start time.Time,
	end time.Time, filters map[string][]string, cursorDate time.Time,
	cursorID string, pageSize int, sortField string,
	ascending bool) ([]backend.InventoryNode, error)

func (Backend) GetLatestRunRolloutBreakdownCounts

func (es Backend) GetLatestRunRolloutBreakdownCounts() (*backend.NodeSegmentRolloutProgress, error)

func (Backend) GetListForField

func (m Backend) GetListForField(searchTerm string, filters map[string][]string) ([]string, error)

func (Backend) GetMissingNodeDurationCounts

func (m Backend) GetMissingNodeDurationCounts(durations []string) ([]backend.CountedDuration, error)

func (Backend) GetNodeMetadataCounts

func (m Backend) GetNodeMetadataCounts(filters map[string][]string, types []string, startDate,
	endDate string) ([]backend.TypeCount, error)

func (Backend) GetNodeRunsDailyStatusTimeSeries

func (m Backend) GetNodeRunsDailyStatusTimeSeries(nodeID string, startTime,
	endTime time.Time) ([]backend.RunDurationStatus, error)

func (Backend) GetNodes

func (m Backend) GetNodes(page int, perPage int, sf string,
	asc bool, filters map[string][]string, startDate, endDate string) ([]backend.Node, error)

func (Backend) GetNodesCounts

func (m Backend) GetNodesCounts(filters map[string][]string,
	startDate string, endDate string) (backend.NodesCounts, error)

func (Backend) GetNodesPageByCursor

func (m Backend) GetNodesPageByCursor(context.Context, time.Time,
	time.Time, map[string][]string, interface{},
	string, int, string, bool) ([]backend.Node, error)

func (Backend) GetPolicyCookbooks

func (m Backend) GetPolicyCookbooks(revisionID string) (backend.PolicyCookbooks, error)

func (Backend) GetRun

func (m Backend) GetRun(run_id string, lastCcr time.Time) (backend.Run, error)

func (Backend) GetRuns

func (m Backend) GetRuns(n string, page int, perPage int, filters map[string][]string, start string, end string) ([]backend.AbridgedConverge, error)

func (Backend) GetRunsCounts

func (m Backend) GetRunsCounts(filters map[string][]string, nodeID string, start string, end string) (backend.RunsCounts, error)

func (Backend) GetRunsPageByCursor

func (m Backend) GetRunsPageByCursor(context.Context, string, time.Time,
	time.Time, map[string][]string, time.Time,
	string, int, bool) ([]backend.Run, error)

func (Backend) GetSuggestions

func (m Backend) GetSuggestions(term string, text string, filters map[string][]string) ([]backend.Suggestion, error)

func (Backend) GetUniqueNodesCount

func (es Backend) GetUniqueNodesCount(int64, time.Time) (int64, error)

func (Backend) NodeExists

func (m Backend) NodeExists(id string, filters map[string][]string) (bool, error)

Implement the backend.Client interface

In order to be a proper backend you have to implement all the contracts that the Client interface has setup, this will ensure that the endpoints we have defined will always be able to get the data from any backend we configure

Jump to

Keyboard shortcuts

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