Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributeSchema ¶
type AttributeSchema struct {
Name string
Type string // "string", "int", "bool", "float", "list", "map", "set"
Required bool
Computed bool // server-generated (ARN, ID, timestamps)
ForceNew bool // changing requires replacement
Default any
RefTo string // references another resource (e.g., "cloudmock_vpc.id")
}
AttributeSchema describes a single attribute on a resource.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all resource schemas, keyed by TerraformType.
func BuildRegistry ¶
func BuildRegistry(tier1 []ResourceSchema, tier2 []ResourceSchema) *Registry
BuildRegistry combines Tier 1 and Tier 2 schemas into a single Registry. If both tiers contain a schema for the same TerraformType, the Tier 1 (hand-crafted) schema wins.
func (*Registry) Add ¶
func (r *Registry) Add(schemas ...ResourceSchema)
Add inserts one or more schemas into the registry. If a schema with the same TerraformType already exists, it is overwritten.
func (*Registry) All ¶
func (r *Registry) All() []ResourceSchema
All returns every schema in the registry, sorted by TerraformType.
func (*Registry) ByService ¶
func (r *Registry) ByService(serviceName string) []ResourceSchema
ByService returns all schemas for a given service name, sorted by TerraformType.
type ResourceRef ¶
ResourceRef describes a reference from one resource attribute to another.
type ResourceSchema ¶
type ResourceSchema struct {
ServiceName string
ResourceType string // e.g., "aws_s3_bucket"
TerraformType string // e.g., "cloudmock_s3_bucket"
AWSType string // e.g., "AWS::S3::Bucket"
Attributes []AttributeSchema
CreateAction string
ReadAction string
UpdateAction string
DeleteAction string
ListAction string
ImportID string // which attribute is the import key
References []ResourceRef
}
ResourceSchema describes a single cloud resource for provider code generation.
func ExtractFromActions ¶
func ExtractFromActions(svc service.Service, accountID, region string) []ResourceSchema
ExtractFromActions creates basic schemas from a service's Actions() method for Tier 1 services that haven't implemented SchemaProvider yet. It infers one resource per service by looking for Create+Describe+Delete action patterns.
func ExtractFromServices ¶
func ExtractFromServices(services []service.Service) []ResourceSchema
ExtractFromServices takes a list of service.Service instances and extracts ResourceSchemas from those that implement SchemaProvider. Services that do not implement SchemaProvider are silently skipped.
type SchemaProvider ¶
type SchemaProvider interface {
ResourceSchemas() []ResourceSchema
}
SchemaProvider is the opt-in interface for Tier 1 services that provide hand-crafted resource schemas.