Documentation
¶
Index ¶
- func Extract(input []byte) any
- func IsMapSubset[K, V comparable](m, sub map[K]V) bool
- func JSONToTerraformDynamicValue(b []byte) (types.Dynamic, error)
- func ProcessString(input string) (output string)
- func TFTypesToBytes(d types.Dynamic) ([]byte, error)
- func TFTypesToJSON(d types.Dynamic) (map[string]interface{}, error)
- type DefaultResponse
- type MustBeMapOfString
- type UpdateOperations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMapSubset ¶ added in v0.6.0
func IsMapSubset[K, V comparable](m, sub map[K]V) bool
func JSONToTerraformDynamicValue ¶ added in v0.5.0
Converts a json marshaled byte array into a Terraform Data with Dynamic Type
Adapted from https://github.com/magodo/terraform-provider-restful/blob/ eb875adeb0967a0a3cd7393d8eb2016a2642ac0f/internal/dynamic/dynamic.go#L284
func ProcessString ¶
Process string according to RFC6902 standard 1. "~0" will be converted back to "~" 2. "~1" will be converted back to "/"
Types ¶
type DefaultResponse ¶
type DefaultResponse struct { Message []string `json:"msg"` Error interface{} `binding:"required" form:"err" json:"err"` }
type MustBeMapOfString ¶ added in v0.3.0
type MustBeMapOfString struct{}
func (MustBeMapOfString) Description ¶ added in v0.3.0
func (v MustBeMapOfString) Description(_ context.Context) string
func (MustBeMapOfString) MarkdownDescription ¶ added in v0.3.0
func (v MustBeMapOfString) MarkdownDescription(ctx context.Context) string
func (MustBeMapOfString) ValidateString ¶ added in v0.3.0
func (v MustBeMapOfString) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
type UpdateOperations ¶
type UpdateOperations struct { Create map[string]jsonpatch.Operation Update map[string]jsonpatch.Operation Delete map[string]jsonpatch.Operation }
func JSONDiffToTerraformOperations ¶
func JSONDiffToTerraformOperations(state, plan []byte) (UpdateOperations, error)
Calculates the diff between state and plan objects. The output of this function is arrays of jsondiff.Ops that has been modified to suit the needs of Terraform CRUD operation. The following modifications are: Updating a JSON object can be classified into three distinct operations.
- Creating a new key value pair at the root.
- Updating a root value. Creating a new key value pair in a nested path will be considered as updating a root value.
- Deleting an existing key value pair from the root.
- Values inside the jsondiff.Operation are discarded and disregarded.
- Only the paths are important.
- It is considered a root key if the path contains only one slash "/xxx"
Click to show internal directories.
Click to hide internal directories.