volatile

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package volatile drops provider-declared volatile fields from resource AttributesJSON at the store boundary, BEFORE the version-comparison in Store.UpsertResources.

Some cloud APIs return fields that change on every read independent of any real resource change — e.g. CloudWatch Logs returns a fresh, deprecated UploadSequenceToken on every DescribeLogStreams call. Storing such a field version-splits an otherwise-unchanged resource on every scan, falsely reporting it as "changed". Unlike redaction (which replaces a value with "[REDACTED]"), volatile rules REMOVE the key entirely, so stored attributes honestly reflect only the fields disco tracks — no stale value left behind.

Provider packages register per-type rules in their init() blocks (see internal/providers/aws/aws_volatile.go). Store.UpsertResources calls Apply once per row, right after redact.Apply and before the jsonEqual comparison.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(resourceType, attributesJSON string) string

Apply removes every registered volatile path from attributesJSON, returning input unchanged when no rules exist or JSON parse/marshal fails — callers never want a silently dropped row.

func HasRules

func HasRules(resourceType string) bool

HasRules reports whether any volatile path is registered for resourceType.

func Register

func Register(r TypeRules)

Register installs r in the registry. Subsequent Register calls for the same Type append paths, mirroring redact.Register.

Types

type TypeRules

type TypeRules struct {
	Type  string
	Paths []string
}

TypeRules names every volatile JSON path to drop for one resource type. Paths are dot-separated literal keys (e.g. "A.B.C"); the leaf key is deleted from its parent object. No wildcards — today's drops are flat keys; extend if a nested-array volatile field appears.

Jump to

Keyboard shortcuts

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