tfmapping

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package tfmapping maps Terraform/OpenTofu-shaped conversion facts to API source operations.

This package is an experimental migration adapter in Ramen v0.1; it is not a provider-runtime compatibility API.

Index

Constants

View Source
const (
	APISourceKindOpenAPI         = "openapi"
	APISourceKindAWSSmithy       = "aws-smithy"
	APISourceKindGoogleDiscovery = "google-discovery"
)

Variables

This section is empty.

Functions

func AWSQueryProtocolAction

func AWSQueryProtocolAction(operationID string) string

Types

type Diagnostic

type Diagnostic struct {
	Code     DiagnosticCode     `json:"code"`
	Severity DiagnosticSeverity `json:"severity"`
	Message  string             `json:"message"`
}

type DiagnosticCode

type DiagnosticCode string
const (
	DiagnosticCodeUnsupportedProvider DiagnosticCode = "mapping.unsupported_provider"
	DiagnosticCodeUnsupportedType     DiagnosticCode = "mapping.unsupported_type"
	DiagnosticCodeUnsupportedAction   DiagnosticCode = "mapping.unsupported_action"
	DiagnosticCodeMissingIdentity     DiagnosticCode = "mapping.missing_identity"
	DiagnosticCodeFallbackOnly        DiagnosticCode = "mapping.fallback_only"
)

type DiagnosticSeverity

type DiagnosticSeverity string
const (
	DiagnosticSeverityError   DiagnosticSeverity = "error"
	DiagnosticSeverityWarning DiagnosticSeverity = "warning"
	DiagnosticSeverityInfo    DiagnosticSeverity = "info"
)

type IdentityAttribute

type IdentityAttribute struct {
	Name          string   `json:"name"`
	TerraformPath string   `json:"terraform_path"`
	RequestKeys   []string `json:"request_keys,omitempty"`
	ResponsePaths []string `json:"response_paths,omitempty"`
	Required      bool     `json:"required,omitempty"`
}

type LifecyclePath

type LifecyclePath struct {
	Path            string `json:"path"`
	Immutable       bool   `json:"immutable,omitempty"`
	CreateOnly      bool   `json:"create_only,omitempty"`
	Updateable      bool   `json:"updateable,omitempty"`
	ReplaceOnChange bool   `json:"replace_on_change,omitempty"`
	Computed        bool   `json:"computed,omitempty"`
	Ignored         bool   `json:"ignored,omitempty"`
}

type LifecycleSemantics

type LifecycleSemantics struct {
	OperationRoles []OperationRole `json:"operation_roles,omitempty"`
	Paths          []LifecyclePath `json:"paths,omitempty"`
}

type Mapping

type Mapping struct {
	Object             Object              `json:"object"`
	Purpose            string              `json:"purpose"`
	Action             string              `json:"action"`
	Target             OperationTarget     `json:"target,omitempty"`
	IdentityAttributes []IdentityAttribute `json:"identity_attributes,omitempty"`
	Schema             []SchemaPath        `json:"schema,omitempty"`
	RequestBindings    []RequestBinding    `json:"request_bindings,omitempty"`
	ResponseBindings   []ResponseBinding   `json:"response_bindings,omitempty"`
	Normalizers        []Normalizer        `json:"normalizers,omitempty"`
	Lifecycle          *LifecycleSemantics `json:"lifecycle,omitempty"`
	Diagnostics        []Diagnostic        `json:"diagnostics,omitempty"`
}

type Normalizer

type Normalizer struct {
	Path string         `json:"path"`
	Kind NormalizerKind `json:"kind"`
}

type NormalizerKind

type NormalizerKind string
const (
	NormalizerJSONSemantic              NormalizerKind = "json_semantic"
	NormalizerUnorderedCollection       NormalizerKind = "unordered_collection"
	NormalizerEmptyNullAbsentEquivalent NormalizerKind = "empty_null_absent_equivalent"
	NormalizerCaseFold                  NormalizerKind = "case_fold"
	NormalizerSensitivePlaceholder      NormalizerKind = "sensitive_placeholder"
)

type Object

type Object struct {
	Kind     string
	Type     string
	Provider string
}

type OperationRole

type OperationRole string
const (
	OperationRoleCreate       OperationRole = "create"
	OperationRoleRead         OperationRole = "read"
	OperationRoleUpdate       OperationRole = "update"
	OperationRoleReplace      OperationRole = "replace"
	OperationRoleDelete       OperationRole = "delete"
	OperationRoleSuspend      OperationRole = "suspend"
	OperationRoleDisable      OperationRole = "disable"
	OperationRoleDetach       OperationRole = "detach"
	OperationRoleRemoveConfig OperationRole = "remove_config"
	OperationRoleNoop         OperationRole = "noop"
)

type OperationTarget

type OperationTarget struct {
	SourceKinds  []string `json:"source_kinds,omitempty"`
	SourceIDs    []string `json:"source_ids,omitempty"`
	OperationIDs []string `json:"operation_ids,omitempty"`
}

type ProviderMapper

type ProviderMapper interface {
	MapObject(obj Object, purpose, action string) Mapping
}

type Registry

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

func DefaultRegistry

func DefaultRegistry() Registry

func NewRegistry

func NewRegistry(opts ...RegistryOption) Registry

func (Registry) IsProviderLocalDataSource

func (Registry) IsProviderLocalDataSource(obj Object) bool

func (Registry) MapObject

func (r Registry) MapObject(obj Object, purpose, action string) Mapping

func (Registry) OperationTarget

func (r Registry) OperationTarget(obj Object, purpose, action string) OperationTarget

func (Registry) RequestKeys

func (Registry) RequestKeys(obj Object, sourceKind, operationID, attrPath string) []string

func (Registry) StaticRequestBindings

func (Registry) StaticRequestBindings(obj Object, sourceID, sourcePath, operationID string) map[string]string

func (Registry) SupportedTypes

func (r Registry) SupportedTypes() []SupportedType

SupportedTypes enumerates every Terraform type the registry can map, drawing from registered provider mappers that implement typeLister and from the built-in aws/google mappers for providers that are not overridden. The result is deduplicated and sorted by provider then type.

type RegistryOption

type RegistryOption func(*Registry)

func WithProviderMapper

func WithProviderMapper(provider string, mapper ProviderMapper) RegistryOption

type RequestBinding

type RequestBinding struct {
	OperationRole OperationRole `json:"operation_role"`
	OperationID   string        `json:"operation_id,omitempty"`
	Path          string        `json:"path"`
	RequestPath   string        `json:"request_path"`
	Location      string        `json:"location,omitempty"`
	Encoding      string        `json:"encoding,omitempty"`
	Required      bool          `json:"required,omitempty"`
	Identity      bool          `json:"identity,omitempty"`
}

RequestBinding maps one desired-state or identity path into one API request path for a specific operation role.

type ResponseBinding

type ResponseBinding struct {
	OperationRole           OperationRole `json:"operation_role"`
	OperationID             string        `json:"operation_id,omitempty"`
	ResponsePath            string        `json:"response_path"`
	StatePath               string        `json:"state_path"`
	Identity                bool          `json:"identity,omitempty"`
	ResponseDerivedIdentity bool          `json:"response_derived_identity,omitempty"`
	Computed                bool          `json:"computed,omitempty"`
	Observed                bool          `json:"observed,omitempty"`
	Sensitive               bool          `json:"sensitive,omitempty"`
}

ResponseBinding maps one API response path into state, identity, computed, observed, or sensitive evidence.

type SchemaPath

type SchemaPath struct {
	Path                    string   `json:"path"`
	Type                    string   `json:"type,omitempty"`
	EnumValues              []string `json:"enum_values,omitempty"`
	Required                bool     `json:"required,omitempty"`
	Optional                bool     `json:"optional,omitempty"`
	Computed                bool     `json:"computed,omitempty"`
	Sensitive               bool     `json:"sensitive,omitempty"`
	Identity                bool     `json:"identity,omitempty"`
	ResponseDerivedIdentity bool     `json:"response_derived_identity,omitempty"`
	Immutable               bool     `json:"immutable,omitempty"`
	CreateOnly              bool     `json:"create_only,omitempty"`
	Updateable              bool     `json:"updateable,omitempty"`
	ReplaceOnChange         bool     `json:"replace_on_change,omitempty"`
	ReadOnly                bool     `json:"read_only,omitempty"`
	Ignored                 bool     `json:"ignored,omitempty"`
}

SchemaPath describes provider-neutral metadata for a desired or observed resource path. Command-specific validation and planning packages consume this contract; provider SDK schemas do not.

type SupportedType

type SupportedType struct {
	Provider string   `json:"provider"`
	Type     string   `json:"type"`
	Kinds    []string `json:"kinds"`
}

SupportedType describes one Terraform type that a mapper can resolve to API source operations, and which object kinds it supports.

Jump to

Keyboard shortcuts

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