aws

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

View Source
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) Bucket

func (p *Provider) Bucket(ref resources.Ref) (bucket.Store, error)

Bucket returns a handle to an S3 bucket.

func (*Provider) Cache

func (p *Provider) Cache(ref resources.Ref) (cache.Client, error)

Cache returns a handle to an ElastiCache instance or cluster.

func (*Provider) Close

func (p *Provider) Close(ctx context.Context) error

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) Datastore

func (p *Provider) Datastore(ref resources.Ref) (datastore.Client, error)

Datastore returns a handle to a DynamoDB table.

func (*Provider) Detect

func (p *Provider) Detect() bool

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) Name

func (p *Provider) Name() string

Name identifies the provider.

func (*Provider) Queue

func (p *Provider) Queue(ref resources.Ref) (queue.Client, error)

Queue returns a handle to an SQS queue.

func (*Provider) SQLDatabase

func (p *Provider) SQLDatabase(ref resources.Ref) (sqldb.Client, error)

SQLDatabase returns a handle to an RDS database.

func (*Provider) Topic

func (p *Provider) Topic(ref resources.Ref) (topic.Client, error)

Topic returns a handle to an SNS topic.

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.

Jump to

Keyboard shortcuts

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