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 ( 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 { types, err := cfn.ListResourceTypes() if err != nil { panic(err) } for _, t := range types { show := false if len(args) == 1 { if strings.HasPrefix(t, args[0]) { show = true } } else { show = true } if show { output(t) } } return } if recommendFlag { recommend(args) return } if len(args) == 0 { cmd.Help() return } if showSchema { typeName := args[0] if isSAM(typeName) { schema, err := convertSAMSpec(samSpecSource, typeName) if err != nil { panic(err) } j, _ := json.MarshalIndent(schema, "", " ") output(string(j)) } else { schema, err := cfn.GetTypeSchema(typeName, noCache) if err != nil { panic(err) } output(schema) } return } if promptFlag { prompt(strings.Join(args, " ")) return } if pklClass { typeName := args[0] if err := generatePklClass(typeName); err != nil { panic(err) } return } t, err := build(args) if err != nil { panic(err) } out := format.String(t, format.Options{ JSON: buildJSON, }) output(out) }, }
Cmd is the build command's entrypoint
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.