Documentation
¶
Overview ¶
Package aws implements the Celerity resource interfaces against AWS.
It is selected by importing it, which is how an application picks a platform without naming one anywhere else:
import _ "github.com/newstack-cloud/celerity-go-sdk/resources/aws"
An init registers the provider, and the generated platform file writes that import for an AWS deploy target, so handler code deals only in the provider-agnostic interfaces from the resources package and an application doesn't need to name a platform at all.
What a handle resolves to ¶
A handle is taken by the name the blueprint gave a resource, and what that resource is actually called is decided when it is created. The pair is held by the deployment: the links file says which config key holds a resource, and the resources namespace holds the identifier. This package reads both through the resources.Ref it is given and never learns how either is written.
Nothing is resolved while handles are being taken. A client built here holds its Ref and resolves on the first call a handler makes, so registration costs no requests and an application declaring a resource it never reaches pays nothing for it.
Separate module ¶
aws-sdk-go-v2 is a large dependency, and on Lambda a cold start cost rather than only a disk one, so an application that never touches AWS does not compile it in.
Index ¶
- Constants
- type Provider
- func (p *Provider) Bucket(ref resources.Ref) (bucket.Store, error)
- func (p *Provider) Cache(ref resources.Ref) (cache.Client, error)
- func (p *Provider) Close(ctx context.Context) error
- func (p *Provider) Datastore(ref resources.Ref) (datastore.Client, error)
- func (p *Provider) Detect() bool
- func (p *Provider) Name() string
- func (p *Provider) Queue(ref resources.Ref) (queue.Client, error)
- func (p *Provider) SQLDatabase(ref resources.Ref) (sqldb.Client, error)
- func (p *Provider) Topic(ref resources.Ref) (topic.Client, error)
Constants ¶
const Name = "aws"
Name identifies this provider in errors and in the handler manifest.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider builds AWS clients behind the resource interfaces.
It holds no service client of its own. Each resource kind lives in its own package under resources/aws and registers what it builds when it is linked, so a build carries the AWS clients for the resources the blueprint declares and no others. `celerity-go generate` writes the imports.
func New ¶
func New() *Provider
New returns the AWS resource provider.
An application does not construct one: importing this package registers it, and it is selected at startup. It is exported for a test that drives the provider directly.
func (*Provider) Close ¶
Close gives back what the linked resource packages hold open: the connection pools of a relational database, the sockets of a cache.
Called by celerity.Run when a containerised application stops serving. Nothing calls it on Lambda, where the execution environment is frozen between invocations and torn down rather than shut down.
func (*Provider) Detect ¶
Detect reports whether this process is running on AWS.
It only decides anything when more than one provider is linked, which is not how an application is normally built: with one linked it is used whatever the environment says, including from a developer's machine where none of the platform's own variables are set.
func (*Provider) SQLDatabase ¶
SQLDatabase returns a handle to an RDS database.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cache is how a Celerity application reaches an ElastiCache cluster.
|
Package cache is how a Celerity application reaches an ElastiCache cluster. |
|
internal
|
|
|
service
Package service is what the AWS resource packages share: the ambient configuration, the Secrets Manager reads a credential needs, and the registry the provider finds each resource package through.
|
Package service is what the AWS resource packages share: the ambient configuration, the Secrets Manager reads a credential needs, and the registry the provider finds each resource package through. |