json

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 1,209

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSParser = jsoniter.Config{
	TagKey: "json",

	SortMapKeys: true,
}.Froze()

JSParser is a json parser to marshal/unmarshal using "json" tag.

View Source
var TFParser = jsoniter.Config{TagKey: "tf"}.Froze()

TFParser is a json parser to marshal/unmarshal using "tf" tag.

Functions

func Canonicalize added in v1.1.1

func Canonicalize(json string) (string, error)

Canonicalize minifies and orders the keys of the specified JSON document to return a canonical form of it, along with any errors encountered during the process.

Types

type InstanceObjectStateV4

type InstanceObjectStateV4 struct {
	IndexKey any    `json:"index_key,omitempty"`
	Status   string `json:"status,omitempty"`
	Deposed  string `json:"deposed,omitempty"`

	SchemaVersion           uint64              `json:"schema_version"`
	AttributesRaw           jsoniter.RawMessage `json:"attributes,omitempty"`
	AttributesFlat          map[string]string   `json:"attributes_flat,omitempty"`
	AttributeSensitivePaths jsoniter.RawMessage `json:"sensitive_attributes,omitempty"`

	PrivateRaw []byte `json:"private,omitempty"`

	Dependencies []string `json:"dependencies,omitempty"`

	CreateBeforeDestroy bool `json:"create_before_destroy,omitempty"`
}

InstanceObjectStateV4 represents a version 4 instance object state

type OutputStateV4

type OutputStateV4 struct {
	ValueRaw     jsoniter.RawMessage `json:"value"`
	ValueTypeRaw jsoniter.RawMessage `json:"type"`
	Sensitive    bool                `json:"sensitive,omitempty"`
}

OutputStateV4 represents a version 4 output state

type ResourceStateV4

type ResourceStateV4 struct {
	Module         string                  `json:"module,omitempty"`
	Mode           string                  `json:"mode"`
	Type           string                  `json:"type"`
	Name           string                  `json:"name"`
	EachMode       string                  `json:"each,omitempty"`
	ProviderConfig string                  `json:"provider"`
	Instances      []InstanceObjectStateV4 `json:"instances"`
}

ResourceStateV4 represents a version 4 resource state

type StateV4

type StateV4 struct {
	Version          uint64                   `json:"version"`
	TerraformVersion string                   `json:"terraform_version"`
	Serial           uint64                   `json:"serial"`
	Lineage          string                   `json:"lineage"`
	RootOutputs      map[string]OutputStateV4 `json:"outputs"`
	Resources        []ResourceStateV4        `json:"resources"`
}

StateV4 represents a version 4 terraform state

func NewStateV4

func NewStateV4() *StateV4

NewStateV4 returns a new base StateV4 object.

func (*StateV4) GetAttributes

func (st *StateV4) GetAttributes() jsoniter.RawMessage

GetAttributes returns attributes of the Terraform managed resource (i.e. first instance of first resource)

func (*StateV4) GetPrivateRaw

func (st *StateV4) GetPrivateRaw() []byte

GetPrivateRaw returns private attribute of the Terraform managed resource that is used as metadata by the Terraform provider

func (*StateV4) GetSensitiveAttributes

func (st *StateV4) GetSensitiveAttributes() jsoniter.RawMessage

GetSensitiveAttributes returns sensitive attributes of the Terraform managed resource (i.e. first instance of first resource)

Jump to

Keyboard shortcuts

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