resource

package
v1.43.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MPL-2.0 Imports: 5 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
	File     *pkginfo.File
}

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) DeclaredIn added in v1.16.3

func (b *AnonymousBind) DeclaredIn() option.Option[*pkginfo.File]

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
	DeclaredIn() option.Option[*pkginfo.File]

	// 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) DeclaredIn added in v1.16.3

func (b *ImplicitBind) DeclaredIn() option.Option[*pkginfo.File]

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
	File     *pkginfo.File

	// 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) DeclaredIn added in v1.16.3

func (b *PkgDeclBind) DeclaredIn() option.Option[*pkginfo.File]

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

	// SortKey is a string that can be used to sort resources.
	// The sort key's value is arbitrary but should provide a
	// consistent sort order regardless of the parsing order.
	// The sort key only matters between resources of the same Kind.
	SortKey() string
}

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