A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing/tfjsonpath below:

tfjsonpath package - github.com/hashicorp/terraform-plugin-testing/tfjsonpath - Go Packages

Package tfjsonpath implements terraform-json path functionality, which defines traversals into Terraform JSON data, for testing purposes.

This section is empty.

This section is empty.

Traverse returns the element found when traversing the given object using the specified Path. The object is an unmarshalled JSON object representing Terraform data.

Traverse returns an error if the value specified by the Path is not found in the given object or if the given object does not conform to format of Terraform JSON data.

MapStep represents a traversal for map[string]any

Path represents exact traversal steps specifying a value inside Terraform JSON data. These steps always start from a MapStep with a key specifying the name of a top-level JSON object or array.

The [terraform-json] library serves as the de facto documentation for JSON format of Terraform data.

Use the New() function to create a Path with an initial AtMapKey() step. Path functionality follows a builder pattern, which allows for chaining method calls to construct a full path. The available traversal steps after Path creation are:

For example, to represent the first element of a JSON array underneath a "some_array" property of this JSON value:

   {
     "some_array": [true]
   }

 The path code would be represented by:

	tfjsonpath.New("some_array").AtSliceIndex(0)

[terraform-json]: (https://pkg.go.dev/github.com/hashicorp/terraform-json)

New creates a new path with an initial MapStep or SliceStep.

AtMapKey returns a copied Path with a new MapStep at the end.

AtSliceIndex returns a copied Path with a new SliceStep at the end.

String returns a string representation of the Path.

SliceStep represents a traversal for []any


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4