cloudcontrol

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 29 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CCDataSource

func CCDataSource(
	config CCDataSourceConfig,
	cloudControlServiceFactory pluginutils.ServiceFactory[*aws.Config, cloudcontrolservice.Service],
	awsConfigStore pluginutils.ServiceConfigStore[*aws.Config],
) provider.DataSource

CCDataSource builds a provider.DataSource backed by the generic Cloud Control engine. The fetch reads the resource via GetResource (fast path for an exact identifier/ARN filter) or ListResources + client-side filtering, then translates the CFN properties into typed, flattened exports.

func CCResource

func CCResource(
	config CCResourceConfig,
	cloudControlServiceFactory pluginutils.ServiceFactory[*aws.Config, cloudcontrolservice.Service],
	resourceGroupTaggingServiceFactory pluginutils.ServiceFactory[*aws.Config, resgrouptagservice.Service],
	awsConfigStore pluginutils.ServiceConfigStore[*aws.Config],
) provider.Resource

CCResource builds a provider.Resource backed by the generic Cloud Control engine, with all CRUD funcs parameterised by the resource type's CFN name and metadata.

func CFNToSpec

CFNToSpec translates a CloudFormation property node into the typed spec shape, translating the CloudFormation property names to the provider's resource field names.

func FlattenForDataSource

func FlattenForDataSource(
	node *core.MappingNode,
	schema *provider.ResourceDefinitionsSchema,
) map[string]*core.MappingNode

FlattenForDataSource flattens a typed spec node into the data source export shape, guided by the schema (the export contract is flat, scalars + arrays-of-primitives):

  • nested objects -> dot-notation scalar keys (e.g. "provisionedThroughput.readCapacityUnits")
  • arrays (of scalars or objects) -> kept whole under a single key
  • maps -> serialised to a JSON string (the export contract has no map/object type)
  • scalars -> mapped directly

It is schema-aware so a map (dynamic keys) is not mistaken for an object and dot-flattened by its data; the codegen derives export fields by the same rules.

func IsCCPropagationFailure added in v0.5.0

func IsCCPropagationFailure(statusMessage string) bool

IsCCPropagationFailure reports whether a failed Cloud Control operation failed for a reason that clears on its own, so the deployment can be retried rather than abandoned.

func MatchesFilters

func MatchesFilters(
	filters *provider.ResolvedDataSourceFilters,
	fields map[string]*core.MappingNode,
) bool

MatchesFilters reports whether a resource (its flattened export fields) satisfies every resolved filter. Cloud Control offers no server-side filtering, so the engine lists resources and evaluates the framework's filter operators here. All filters are combined with logical AND.

func SpecToCFN

SpecToCFN translates a typed spec node into the CloudFormation property shape, translating the resource field names to the CloudFormation property names.

Types

type CCDataSourceConfig

type CCDataSourceConfig struct {
	// BlueprintType is the Bluelink data source type, e.g. "aws/dynamodb/table".
	BlueprintType string
	// CFNType is the CloudFormation type name, e.g. "AWS::DynamoDB::Table".
	CFNType string
	Label   string
	// PlainTextSummary and FormattedDescription document the data source type.
	PlainTextSummary     string
	FormattedDescription string
	// Schema is the typed resource schema, reused to translate the
	// fetched Cloud Control properties into typed exports.
	// (overlays can make alterations to the schema)
	Schema *provider.ResourceDefinitionsSchema
	// Meta carries the per-type information the engine needs for identifier resolution
	// and CFN<->spec name translation.
	Meta CCResourceMeta
	// FilterFields declares the filterable fields exposed to practitioners.
	FilterFields map[string]*provider.DataSourceFilterSchema
	// ExportFields declares the (flattened) exportable fields.
	ExportFields map[string]*provider.DataSourceSpecSchema
	// DeriveIdentifierFromARN enables a fast path where a single `arn` equality filter
	// is resolved to the primary identifier by taking the ARN's final segment. Set for
	// name-style identifiers (e.g. eventBus name, table name); leave false where the
	// identifier is the ARN itself or a non-derivable form (e.g. an SQS queue URL).
	DeriveIdentifierFromARN bool
	// FormattedExamples holds rendered example markdown for the data source type.
	FormattedExamples []string
}

CCDataSourceConfig is the per-type configuration for a Cloud Control–backed data source. Codegen emits one of these per included CloudFormation type.

type CCResourceConfig

type CCResourceConfig struct {
	// BlueprintType is the Bluelink resource type, e.g. "aws/sqs/queue".
	BlueprintType string
	// CFNType is the CloudFormation type name, e.g. "AWS::SQS::Queue".
	CFNType              string
	Label                string
	PlainTextSummary     string
	FormattedDescription string
	// Schema is the generated resource spec schema (the engine augments it with
	// internal Cloud Control bookkeeping fields).
	Schema *provider.ResourceDefinitionsSchema
	// Meta carries per-type information the generic engine cannot infer at runtime.
	Meta CCResourceMeta
	// FormattedExamples holds rendered example markdown for the resource type.
	FormattedExamples []string
	// CommonTerminal hints whether the resource is not expected to link out.
	CommonTerminal bool
}

CCResourceConfig is the per-type configuration for a Cloud Control–backed resource. Codegen emits one of these per included CloudFormation type.

type CCResourceMeta

type CCResourceMeta struct {
	// PrimaryIdentifierField is the user-facing spec field that mirrors the CFN
	// primaryIdentifier which is also used as the resource definition's IDField.
	// For composite identifiers it holds the first component.
	PrimaryIdentifierField string
	// PrimaryIdentifierFields holds all components of a composite CFN
	// primaryIdentifier, in order. When set (length > 1), the engine joins the
	// component spec values with "|" to form Cloud Control's composite identifier
	// if no stored identifier is available. Empty for single-identifier types.
	PrimaryIdentifierFields []string
	// ComputedFields lists spec field paths (without the "spec." prefix) that map
	// to CFN readOnlyProperties. They are stripped from desired state and update patches.
	ComputedFields []string
	// CreateOnlyFields lists spec field paths mapping to CFN createOnlyProperties.
	// Changes to these route through MustRecreate, never an update patch.
	CreateOnlyFields []string
	// WriteOnlyFields lists spec field paths mapping to CFN writeOnlyProperties.
	// Cloud Control never returns these, so they are excluded from update diffs
	// and external state reconciliation.
	WriteOnlyFields []string
	// TagPropertyName is the spec/CFN property holding tags, or "" when untaggable.
	TagPropertyName string
	// TagShape describes how TagPropertyName encodes tags.
	TagShape TagShape
	// FieldNameOverrides maps a camelCase field path (with "*" for array/map
	// descent) to its CloudFormation property name. This is for fields where a simple
	// first-character flip does not round-trip, such as
	// "sseSpecification" <-> "SSESpecification".
	// Absent paths fall back to flipping the first character of the last path segment.
	FieldNameOverrides map[string]string
	// JSONStringFields lists camelCase field paths (with "*" for array/map descent)
	// that hold a CloudFormation free-form object encoded as a JSON string. The
	// engine parses the string into a JSON object when building Cloud Control
	// desired state and serialises the object back to a string when reading
	// external state.
	JSONStringFields []string
}

CCResourceMeta carries the per-type information the generic engine cannot infer from a resource spec at runtime. It is supplied by codegen from the CloudFormation resource type schema.

func (CCResourceMeta) IsTaggable

func (m CCResourceMeta) IsTaggable() bool

IsTaggable reports whether the resource type exposes a tag property.

type TagShape

type TagShape int

TagShape describes how a Cloud Control resource type models its tag property, since CloudFormation tag shapes are not uniform across types.

const (
	// TagShapeNone indicates the resource type is not taggable.
	TagShapeNone TagShape = iota
	// TagShapeKeyValueList models tags as a list of {"Key": k, "Value": v} objects.
	TagShapeKeyValueList
	// TagShapeStringMap models tags as a {k: v} string map.
	TagShapeStringMap
)

Directories

Path Synopsis
Package overlays holds hand-written, per-type adjustments applied to generated Cloud Control resource schemas.
Package overlays holds hand-written, per-type adjustments applied to generated Cloud Control resource schemas.

Jump to

Keyboard shortcuts

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