package jsonpatch
import "github.com/oslokommune/okctl/pkg/jsonpatch"
Package jsonpatch provides some convenience structs for building a type safe patch
Index ¶
Types ¶
type Inline ¶
type Inline struct { Data []byte `json:",inline"` }
Inline provides a convenient way of inlining pre-serialised json
func (*Inline) MarshalJSON ¶
MarshalJSON implements the json encode marshaller interface
type Operation ¶
type Operation struct { Type OperationType `json:"op"` Path string `json:"path"` Value interface{} `json:"value"` }
Operation represents a single patch operation, meaning an action on a kubernetes resource attribute
func (Operation) Equals ¶
Equals knows how to determine if two operations are equal
type OperationType ¶
type OperationType string
OperationType represents one of the json patch operation types defines in https://tools.ietf.org/html/rfc6902#section-4
const ( // OperationTypeAdd represents an add operation OperationTypeAdd OperationType = "add" // OperationTypeRemove represents a remove operation OperationTypeRemove OperationType = "remove" // OperationTypeReplace represents a replace operation OperationTypeReplace OperationType = "replace" // OperationTypeMove represents a move operation OperationTypeMove OperationType = "move" // OperationTypeCopy represents a copy operation OperationTypeCopy OperationType = "copy" // OperationTypeTest represents a test operation OperationTypeTest OperationType = "test" )
func (OperationType) String ¶
func (receiver OperationType) String() string
func (OperationType) Validate ¶
func (receiver OperationType) Validate() error
Validate ensures the OperationType is a valid JSON patch type
type Patch ¶
type Patch struct { Operations []Operation `json:",inline"` }
Patch represents a kustomize patch.json file containing a list of patch operations
func New ¶
func New() *Patch
New initializes a Patch struct
func (*Patch) Add ¶
Add adds a patch operation to the patch
func (*Patch) HasOperation ¶
HasOperation determines if a patch has a specific operation
func (*Patch) HasOperations ¶
HasOperations determines if a patch contains all the given operations
func (Patch) MarshalJSON ¶
MarshalJSON knows how to turn a Patch into a kustomize patch.json
Source Files ¶
- Version
- v0.0.106 (latest)
- Published
- Oct 21, 2022
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 18 hours ago –
Tools for package owners.