utils

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractObject

func ExtractObject(old interface{}, path string) interface{}

ExtractObject is used to extract object from old for a json path

func GetAzureResourceTypeApiVersion

func GetAzureResourceTypeApiVersion(resourceType string) (string, string, error)

func GetId

func GetId(resource interface{}) *string

func GetName

func GetName(id string) string

func GetParentId

func GetParentId(id string) string

func GetParentType

func GetParentType(resourceType string) string

func GetResourceType

func GetResourceType(id string) string

func GetScopeType

func GetScopeType(id string) types.ScopeType

func IsTopLevelResourceType

func IsTopLevelResourceType(resourceType string) bool

func MergeObject added in v1.9.0

func MergeObject(old interface{}, new interface{}) interface{}

MergeObject is used to merge object old and new, if overlaps, use new value

func NormalizeJson

func NormalizeJson(jsonString interface{}) string

func NormalizeObject

func NormalizeObject(input interface{}) interface{}

NormalizeObject is used to remove customized type and replaced with builtin type

func OverrideWithPaths added in v1.9.0

func OverrideWithPaths(old interface{}, new interface{}, path string, pathSet map[string]bool) (interface{}, error)

OverrideWithPaths is used to override old object with new object for specific paths

func ResponseErrorWasNotFound

func ResponseErrorWasNotFound(err error) bool

func ResponseErrorWasStatusCode

func ResponseErrorWasStatusCode(err error, statusCode int) bool

func UpdateObject added in v1.9.0

func UpdateObject(old interface{}, new interface{}, option UpdateJsonOption) interface{}

UpdateObject is used to get an updated object which has same schema as old, but with new value

Types

type UpdateJsonOption

type UpdateJsonOption struct {
	IgnoreCasing          bool
	IgnoreMissingProperty bool
}

Jump to

Keyboard shortcuts

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