resource

package
v1.14.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnonymousBind

type AnonymousBind struct {
	Resource ResourceOrPath
	Pkg      *pkginfo.Package
}

An AnonymousBind is similar to PkgDeclBind in that it's a package declaration, but unlike PkgDeclBind it's bound to an "_" identifier so that it has no name.

func (*AnonymousBind) DescriptionForTest

func (b *AnonymousBind) DescriptionForTest() string

func (*AnonymousBind) Package

func (b *AnonymousBind) Package() *pkginfo.Package

func (*AnonymousBind) Pos

func (b *AnonymousBind) Pos() token.Pos

func (*AnonymousBind) ResourceRef

func (b *AnonymousBind) ResourceRef() ResourceOrPath

type Bind

type Bind interface {
	Pos() token.Pos
	ResourceRef() ResourceOrPath
	Package() *pkginfo.Package

	// DescriptionForTest describes the bind for testing purposes.
	DescriptionForTest() string
}

type ImplicitBind

type ImplicitBind struct {
	Resource ResourceOrPath
	Pkg      *pkginfo.Package
}

An ImplicitBind is a bind that implicitly binds to a package and its subpackages.

func (*ImplicitBind) DescriptionForTest

func (b *ImplicitBind) DescriptionForTest() string

func (*ImplicitBind) Package

func (b *ImplicitBind) Package() *pkginfo.Package

func (*ImplicitBind) Pos

func (b *ImplicitBind) Pos() token.Pos

func (*ImplicitBind) ResourceRef

func (b *ImplicitBind) ResourceRef() ResourceOrPath

type Kind

type Kind int
const (
	Unknown Kind = iota

	// Infrastructure SDK Resources
	PubSubTopic
	PubSubSubscription
	SQLDatabase
	Metric
	CronJob
	CacheCluster
	CacheKeyspace
	ConfigLoad
	Secrets

	// API Framework Resources
	APIEndpoint
	AuthHandler
	Middleware
	ServiceStruct
)

func (Kind) String

func (i Kind) String() string

type Named

type Named interface {
	Resource

	// ResourceName is the name of the resource.
	ResourceName() string
}

type Path

type Path []PathEntry

type PathEntry

type PathEntry struct {
	Kind Kind
	Name string
}

type PkgDeclBind

type PkgDeclBind struct {
	Resource ResourceOrPath
	Pkg      *pkginfo.Package

	// BoundName is the package-level identifier the bind is declared with.
	BoundName *ast.Ident
}

A PkgDeclBind is a bind consisting of a package declaration.

func (*PkgDeclBind) DescriptionForTest

func (b *PkgDeclBind) DescriptionForTest() string

func (*PkgDeclBind) Package

func (b *PkgDeclBind) Package() *pkginfo.Package

func (*PkgDeclBind) Pos

func (b *PkgDeclBind) Pos() token.Pos

func (*PkgDeclBind) QualifiedName

func (b *PkgDeclBind) QualifiedName() pkginfo.QualifiedName

QualifiedName returns the qualified name of the resource.

func (*PkgDeclBind) ResourceRef

func (b *PkgDeclBind) ResourceRef() ResourceOrPath

type Resource

type Resource interface {
	// Node is embedded so we can use the resource in a [posmap.Map].
	// The position should be the position of the resource declaration.
	ast.Node

	// Kind is the kind of resource this is.
	Kind() Kind

	// Package is the package the resource is declared in.
	Package() *pkginfo.Package
}

type ResourceOrPath

type ResourceOrPath struct {
	Resource Resource
	Path     Path
}

ResourceOrPath is a reference to a particular resource, either referencing the resource object directly or through a path.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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