types

package
Version: v0.4.0-rc.0.0...-6e78c04 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PackagePathXPCommonAPIs is the go path for the Crossplane Runtime package
	// with common APIs
	PackagePathXPCommonAPIs = "github.com/crossplane/crossplane-runtime/apis/common/v1"
)

Variables

This section is empty.

Functions

func TypePath

func TypePath(i interface{}) string

TypePath returns go package path for the input type. This is a helper function to be used whenever this information is needed, like configuring to reference to a type. Should not be used if the type is in the same package as the caller.

Types

type Builder

type Builder struct {
	Package *types.Package
	// contains filtered or unexported fields
}

Builder is used to generate Go type equivalence of given Terraform schema.

func NewBuilder

func NewBuilder(pkg *types.Package) *Builder

NewBuilder returns a new Builder.

func (*Builder) AddToBuilder

func (g *Builder) AddToBuilder(typeNames *TypeNames, r *resource) (*types.Named, *types.Named)

AddToBuilder adds fields to the Builder.

func (*Builder) Build

func (g *Builder) Build(cfg *config.Resource) (Generated, error)

Build returns parameters and observation types built out of Terraform schema.

type Field

type Field struct {
	Schema                                   *schema.Schema
	Name                                     name.Name
	Comment                                  *comments.Comment
	TFTag, JSONTag, FieldNameCamel           string
	TerraformPaths, CRDPaths, CanonicalPaths []string
	FieldType                                types.Type
	AsBlocksMode                             bool
	Reference                                *config.Reference
}

Field represents a field that is built from the Terraform schema. It contains the go field related information such as tags, field type, comment.

func NewField

func NewField(g *Builder, cfg *config.Resource, r *resource, sch *schema.Schema, snakeFieldName string, tfPath, xpPath, names []string, asBlocksMode bool) (*Field, error)

NewField returns a constructed Field object.

func NewReferenceField

func NewReferenceField(g *Builder, cfg *config.Resource, r *resource, sch *schema.Schema, ref *config.Reference, snakeFieldName string, tfPath, xpPath, names []string, asBlocksMode bool) (*Field, error)

NewReferenceField returns a constructed reference Field object.

func NewSensitiveField

func NewSensitiveField(g *Builder, cfg *config.Resource, r *resource, sch *schema.Schema, snakeFieldName string, tfPath, xpPath, names []string, asBlocksMode bool) (*Field, bool, error)

NewSensitiveField returns a constructed sensitive Field object.

func (*Field) AddToResource

func (f *Field) AddToResource(g *Builder, r *resource, typeNames *TypeNames)

AddToResource adds built field to the resource.

type Generated

type Generated struct {
	Types    []*types.Named
	Comments twtypes.Comments

	ForProviderType *types.Named
	AtProviderType  *types.Named
}

Generated is a struct that holds generated types

type TypeNames

type TypeNames struct {
	ParameterTypeName   *types.TypeName
	ObservationTypeName *types.TypeName
}

TypeNames represents the parameter and observation name of the resource.

func NewTypeNames

func NewTypeNames(fieldPaths []string, pkg *types.Package) (*TypeNames, error)

NewTypeNames returns a new TypeNames object.

Directories

Path Synopsis
conversion

Jump to

Keyboard shortcuts

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