binding

package
v0.14.34 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindingsObject

type BindingsObject struct {
	Mappings      Mapping `json:"mappings"`
	Kinds         []Kind  `json:"kinds"`
	Workspace     Target  `json:"workspace"`
	WorkspaceName string  `json:"workspace_name"`
}

type Generator

type Generator struct {
	Enabled bool
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(ctx context.Context, enabled bool, resourceType string, resourceName string,
	client *observe.Client, enabledBindings KindSet) (Generator, error)

func (*Generator) Generate

func (g *Generator) Generate(data interface{})

func (*Generator) GenerateJson

func (g *Generator) GenerateJson(jsonStr []byte) ([]byte, error)

func (*Generator) InsertBindingsObject

func (g *Generator) InsertBindingsObject(data map[string]interface{}) error

func (*Generator) InsertBindingsObjectJson

func (g *Generator) InsertBindingsObjectJson(jsonData *types.JsonObject) (*types.JsonObject, error)

func (*Generator) TryBind

func (g *Generator) TryBind(kind Kind, id string) string

lookup by kind and id, if valid and enabled then return a local variable reference, otherwise return the id (no-op)

type Kind

type Kind string
const (
	KindDataset   Kind = "dataset"
	KindWorksheet Kind = "worksheet"
	KindWorkspace Kind = "workspace"
	KindUser      Kind = "user"
)

type KindSet

type KindSet map[Kind]struct{}

func NewKindSet

func NewKindSet(kinds ...Kind) KindSet

type Mapping

type Mapping map[Ref]Target

func NewMapping

func NewMapping() Mapping

type Ref

type Ref struct {
	// contains filtered or unexported fields
}

func NewRefFromString

func NewRefFromString(s string) (Ref, bool)

func (Ref) MarshalText

func (r Ref) MarshalText() (text []byte, err error)

func (*Ref) String

func (r *Ref) String() string

func (*Ref) UnmarshalText

func (r *Ref) UnmarshalText(text []byte) error

type ResourceCache

type ResourceCache struct {
	// contains filtered or unexported fields
}

func NewResourceCache

func NewResourceCache(ctx context.Context, kinds KindSet, client *observe.Client, forResourceKind string, forResourceName string) (ResourceCache, error)

func (*ResourceCache) LookupId

func (c *ResourceCache) LookupId(kind Kind, id string) *ResourceCacheEntry

type ResourceCacheEntry

type ResourceCacheEntry struct {
	TfName string
	Label  string
}

type Target

type Target struct {
	TfLocalBindingVar string `json:"tf_local_binding_var"`
	TfName            string `json:"tf_name"`
}

Jump to

Keyboard shortcuts

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