cfschemaz

package
v0.0.0-...-a8ae7ff Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Property

type Property struct {
	Name       string
	Validation *Validation
}

Property describes a property of either a top-level resource or structured type.

type Schema

type Schema struct {
	UnprocessedByFileName map[string]*UnprocessedTopLevelResource
	TopLevelResourceTypes map[string]*Type
	StructuredTypes       map[string]*Type
}

Schema describes the CloudFormation JSON schema.

func NewSchemaFromBuffer

func NewSchemaFromBuffer(buf []byte) (*Schema, error)

NewSchemaFromBuffer parses and validates a CloudFormation JSON schema from the given buffer (i.e. "CloudFormationSchema.zip" file).

type Type

type Type struct {
	IsTopLevelResourceType bool
	Name                   string
	Description            string
	Properties             map[string]*Property
}

Type describes either a top-level resource type or a structured type.

type UnprocessedDefinition

type UnprocessedDefinition struct {
	AdditionalProperties bool                              `json:"additionalProperties,omitempty"`
	AllOf                any                               `json:"allOf,omitempty"`
	AnyOf                any                               `json:"anyOf,omitempty"`
	ArrayType            string                            `json:"arrayType,omitempty"`
	Comment              string                            `json:"$comment,omitempty"`
	Const                string                            `json:"const,omitempty"`
	Default              any                               `json:"default,omitempty"` // If specified, it is a value of "type".
	Dependencies         map[string][]string               `json:"dependencies,omitempty"`
	Description          string                            `json:"description,omitempty"`
	Enum                 *UnprocessedEnum                  `json:"enum,omitempty"`
	Examples             any                               `json:"examples,omitempty"`
	Format               string                            `json:"format,omitempty"`
	InsertionOrder       *bool                             `json:"insertionOrder,omitempty"`
	Items                *UnprocessedDefinition            `json:"items,omitempty"`
	MaxItems             *int                              `json:"maxItems,omitempty"`
	MaxLength            *int                              `json:"maxLength,omitempty"`
	MaxProperties        *int                              `json:"maxProperties,omitempty"`
	Maximum              *json.Number                      `json:"maximum,omitempty"`
	MinItems             *int                              `json:"minItems,omitempty"`
	MinLength            *int                              `json:"minLength,omitempty"`
	MinProperties        *int                              `json:"minProperties,omitempty"`
	Minimum              *json.Number                      `json:"minimum,omitempty"`
	MultipleOf           *json.Number                      `json:"multipleOf,omitempty"`
	OneOf                []*UnprocessedDefinition          `json:"oneOf,omitempty"`
	Pattern              *string                           `json:"pattern,omitempty"`
	PatternProperties    map[string]*UnprocessedDefinition `json:"patternProperties,omitempty"`
	Properties           map[string]*UnprocessedDefinition `json:"properties,omitempty"`
	Ref                  *string                           `json:"$ref,omitempty"`
	RelationshipRef      *UnprocessedRelationshipRef       `json:"relationshipRef,omitempty"`
	Required             []string                          `json:"required,omitempty"`
	Title                string                            `json:"title,omitempty"`
	Type                 any                               `json:"type,omitempty"` // This can be string or []string.
	UniqueItems          *bool                             `json:"uniqueItems,omitempty"`
}

UnprocessedDefinition describes part of the CloudFormation JSON schema.

type UnprocessedEnum

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

UnprocessedEnum describes part of the CloudFormation JSON schema for a resource.

func (*UnprocessedEnum) CanBeFloat64

func (ue *UnprocessedEnum) CanBeFloat64() bool

CanBeFloat64 returns true if the enum is set and can be parsed as []float64.

func (*UnprocessedEnum) CanBeInt64

func (ue *UnprocessedEnum) CanBeInt64() bool

CanBeInt64 returns true if the enum is set and can be parsed as []int64.

func (*UnprocessedEnum) CanBeString

func (ue *UnprocessedEnum) CanBeString() bool

CanBeString returns true if the enum is set and can be parsed as []string.

func (*UnprocessedEnum) IsSet

func (ue *UnprocessedEnum) IsSet() bool

IsSet returns true if the enum was set in the schema.

func (*UnprocessedEnum) MaybeFloat64

func (ue *UnprocessedEnum) MaybeFloat64() []float64

MaybeFloat64 returns the enum as []float64 if possible.

func (*UnprocessedEnum) MaybeInt64

func (ue *UnprocessedEnum) MaybeInt64() []int64

MaybeInt64 returns the enum as []int64 if possible.

func (*UnprocessedEnum) MaybeString

func (ue *UnprocessedEnum) MaybeString() []string

MaybeString returns the enum as []string if possible.

func (*UnprocessedEnum) UnmarshalJSON

func (ue *UnprocessedEnum) UnmarshalJSON(bytes []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type UnprocessedHandlers

type UnprocessedHandlers struct {
	Create *UnprocessedHandlersOperation `json:"create,omitempty"`
	Delete *UnprocessedHandlersOperation `json:"delete,omitempty"`
	List   *UnprocessedHandlersOperation `json:"list,omitempty"`
	Read   *UnprocessedHandlersOperation `json:"read,omitempty"`
	Update *UnprocessedHandlersOperation `json:"update,omitempty"`
}

UnprocessedHandlers describes part of the CloudFormation JSON schema for a resource.

type UnprocessedHandlersOperation

type UnprocessedHandlersOperation struct {
	HandlerSchema    *UnprocessedDefinition `json:"handlerSchema,omitempty"`
	Permissions      []string               `json:"permissions,omitempty"`
	TimeoutInMinutes *int                   `json:"timeoutInMinutes,omitempty"`
}

UnprocessedHandlersOperation describes part of the CloudFormation JSON schema for a resource.

type UnprocessedRelationshipRef

type UnprocessedRelationshipRef struct {
	TypeName     string `json:"typeName,omitempty"`
	PropertyPath string `json:"propertyPath,omitempty"`
}

UnprocessedRelationshipRef describes part of the CloudFormation JSON schema.

type UnprocessedResourceLink struct {
	Mappings    map[string]string `json:"mappings,omitempty"`
	TemplateURI string            `json:"templateUri,omitempty"`
}

UnprocessedResourceLink describes part of the CloudFormation JSON schema.

type UnprocessedTagging

type UnprocessedTagging struct {
	CloudFormationSystemTags bool     `json:"cloudFormationSystemTags,omitempty"`
	Permissions              []string `json:"permissions,omitempty"`
	TagOnCreate              bool     `json:"tagOnCreate,omitempty"`
	TagProperty              string   `json:"tagProperty,omitempty"`
	TagUpdatable             bool     `json:"tagUpdatable,omitempty"`
	Taggable                 bool     `json:"taggable,omitempty"`
}

UnprocessedTagging describes part of the CloudFormation JSON schema for a resource.

type UnprocessedTopLevelResource

type UnprocessedTopLevelResource struct {
	AdditionalIdentifiers          [][]string                        `json:"additionalIdentifiers,omitempty"`
	AdditionalProperties           bool                              `json:"additionalProperties,omitempty"`
	AllOf                          any                               `json:"allOf,omitempty"` // TODO(ibrt): Type.
	AnyOf                          any                               `json:"anyOf,omitempty"` // TODO(ibrt): Type.
	Comment                        string                            `json:"$comment,omitempty"`
	ConditionalCreatOnlyProperties []string                          `json:"conditionalCreateOnlyProperties,omitempty"`
	CreateOnlyProperties           []string                          `json:"createOnlyProperties,omitempty"`
	Definitions                    map[string]*UnprocessedDefinition `json:"definitions,omitempty"`
	DeprecatedProperties           []string                          `json:"deprecatedProperties,omitempty"`
	Description                    string                            `json:"description,omitempty"`
	DocumentationURL               string                            `json:"documentationUrl,omitempty"`
	Handlers                       *UnprocessedHandlers              `json:"handlers,omitempty"`
	OneOf                          []*UnprocessedDefinition          `json:"oneOf,omitempty"`
	PrimaryIdentifier              []string                          `json:"primaryIdentifier,omitempty"`
	Properties                     map[string]*UnprocessedDefinition `json:"properties,omitempty"`
	PropertyTransform              map[string]string                 `json:"propertyTransform,omitempty"`
	ReadOnlyProperties             []string                          `json:"readOnlyProperties,omitempty"`
	ReplacementStrategy            string                            `json:"replacementStrategy,omitempty"`
	Required                       []string                          `json:"required,omitempty"`
	ResourceLink                   *UnprocessedResourceLink          `json:"resourceLink,omitempty"`
	Schema                         string                            `json:"$schema,omitempty"`
	SourceURL                      string                            `json:"sourceUrl,omitempty"`
	Taggable                       bool                              `json:"taggable,omitempty"`
	Tagging                        *UnprocessedTagging               `json:"tagging,omitempty"`
	TypeName                       string                            `json:"typeName,omitempty"`
	WriteOnlyProperties            []string                          `json:"writeOnlyProperties,omitempty"`
}

UnprocessedTopLevelResource describes part of the CloudFormation JSON schema.

type Validation

type Validation struct {
	Single *ValidationSingle
	Array  *ValidationArray
}

Validation describes a value.

type ValidationArray

type ValidationArray struct {
	MinItems       *int
	MaxItems       *int
	InsertionOrder *bool
	UniqueItems    *bool
	Items          *Validation
}

ValidationArray describes an array.

type ValidationNumber

type ValidationNumber[T float64 | int64] struct {
	Minimum    *T
	Maximum    *T
	MultipleOf *T
	Enum       []T
}

ValidationNumber describes a number value.

type ValidationSingle

type ValidationSingle struct {
	String     *ValidationString
	Int64      *ValidationNumber[int64]
	Float64    *ValidationNumber[float64]
	Structured *ValidationStructuredType
}

ValidationSingle describes a single value.

type ValidationString

type ValidationString struct {
	MinLength *int
	MaxLength *int
	Pattern   *string
	Format    *string
	Enum      []string
}

ValidationString describes a string value.

type ValidationStructuredType

type ValidationStructuredType struct {
	StructuredTypeName string
}

ValidationStructuredType describe a structured type value.

Jump to

Keyboard shortcuts

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