Documentation ¶
Overview ¶
In this file, we convert a version of the SAM spec that has been simplified to the old CloudFormation spec format into the new registry schema format. This allows us to build boilerplate templates for SAM resource types using the same code that we use for normal registry resource types. Ideally we would parse the actual SAM spec, but the file is huge and complex, and SAM transforms are relatively stable, so we shouldn't have issues with the output being out of date.
Index ¶
Constants ¶
View Source
const ( LANG_CFN = "cfn" LANG_GUARD = "guard" LANG_REGO = "rego" )
View Source
const ( LIST = "list" SCHEMA = "schema" TEMPLATE = "template" POLICY = "policy" ALL = "all" REQUIRED = "required" RECOMMEND = "recommend" PROMPT = "prompt" CLAUDE2 = "claude2" OPUS = "claude3opus" SONNET = "claude3sonnet" HAIKU = "claude3haiku" GUARD = "guard" OPA = "opa" GENERIC = "generic" YES = "yes" NO = "no" )
View Source
const ( MAP = iota LISTING STRINGS TYPES PRIMITIVE )
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "build [<resource type>] or <prompt>", Short: "Create CloudFormation templates", Long: "The build command interacts with the CloudFormation registry to list types, output schema files, and build starter CloudFormation templates containing the named resource types.", DisableFlagsInUseLine: true, Run: func(cmd *cobra.Command, args []string) { if buildListFlag { prefix := "" if len(args) > 0 { prefix = args[0] } list(prefix) return } if recommendFlag { recommend(args) return } if showSchema { if len(args) == 0 { panic("provide a resource type name") } schema(args[0]) return } if promptFlag { validLangs := []string{LANG_CFN, LANG_GUARD, LANG_REGO} if !slices.Contains(validLangs, promptLanguage) { panic(fmt.Sprintf("provide a valid --prompt-lang: %v", validLangs)) } if len(args) == 0 { panic("provide a prompt") } runPrompt(strings.Join(args, " ")) return } if pklClass { if len(args) == 0 { panic("provide a type name") } typeName := args[0] if err := generatePklClass(typeName); err != nil { panic(err) } return } if len(args) == 0 { interactive() } else { basicBuild(args) } }, }
Cmd is the build command's entrypoint
View Source
var NoBellStdout = &noBellStdout{}
Functions ¶
This section is empty.
Types ¶
type SamProp ¶ added in v1.8.0
type SamProp struct { Documentation string Required bool PrimitiveType string PrimitiveItemType string UpdateType string PrimitiveTypes []string Type string Types []string ItemType string InclusivePrimitiveItemTypes []string InclusiveItemTypes []string }
SamProp represents the old cfn spec types, which are... odd
Click to show internal directories.
Click to hide internal directories.