diff

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaskEnvVarValue

func MaskEnvVarValue(diffString string) string

Types

type Do

type Do func(a crud.Event) (crud.Arg, error)

Do is the worker function to sync the diff

type EntityChanges

type EntityChanges struct {
	Creating []EntityState `json:"creating"`
	Updating []EntityState `json:"updating"`
	Deleting []EntityState `json:"deleting"`
}

type EntityState

type EntityState struct {
	Name string `json:"name"`
	Kind string `json:"kind"`
	Body any    `json:"body"`
}

type EnvVar

type EnvVar struct {
	Key   string
	Value string
}

type JSONOutputObject

type JSONOutputObject struct {
	Changes  EntityChanges `json:"changes"`
	Summary  Summary       `json:"summary"`
	Warnings []string      `json:"warnings"`
	Errors   []string      `json:"errors"`
}

type Stats

type Stats struct {
	CreateOps *utils.AtomicInt32Counter
	UpdateOps *utils.AtomicInt32Counter
	DeleteOps *utils.AtomicInt32Counter
}

Stats holds the stats related to a Solve.

type Summary

type Summary struct {
	Creating int32 `json:"creating"`
	Updating int32 `json:"updating"`
	Deleting int32 `json:"deleting"`
	Total    int32 `json:"total"`
}

type Syncer

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

Syncer takes in a current and target state of Kong, diffs them, generating a Graph to get Kong from current to target state.

func NewSyncer

func NewSyncer(opts SyncerOpts) (*Syncer, error)

NewSyncer constructs a Syncer.

func (*Syncer) Run

func (sc *Syncer) Run(ctx context.Context, parallelism int, d Do) []error

Run starts a diff and invokes d for every diff.

func (*Syncer) Solve

func (sc *Syncer) Solve(ctx context.Context, parallelism int, dry bool, isJSONOut bool) (Stats,
	[]error, EntityChanges,
)

Solve generates a diff and walks the graph.

type SyncerOpts

type SyncerOpts struct {
	CurrentState *state.KongState
	TargetState  *state.KongState

	KongClient    *kong.Client
	KonnectClient *konnect.Client

	SilenceWarnings bool
	StageDelaySec   int

	NoMaskValues bool

	IsKonnect bool

	CreatePrintln func(a ...interface{})
	UpdatePrintln func(a ...interface{})
	DeletePrintln func(a ...interface{})
}

Jump to

Keyboard shortcuts

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