Documentation
¶
Index ¶
- func New(opts ...Option) func(gas.TemplateProvider, gas.ConfigProvider, gas.Logger) *Service
- func NewWithCustomProvider[T gas.TemplateProvider](opts ...Option) func(T, gas.ConfigProvider, gas.Logger) *Service
- type Config
- type Option
- type Service
- func (s *Service) CheckReady(_ context.Context) error
- func (s *Service) Client() *awsses.Client
- func (s *Service) Close() error
- func (s *Service) Init() error
- func (s *Service) Name() string
- func (s *Service) Send(ctx context.Context, msg *gas.Email) error
- func (s *Service) SendFromTemplate(ctx context.Context, msg *gas.TemplatedEmail) error
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...Option) func(gas.TemplateProvider, gas.ConfigProvider, gas.Logger) *Service
New captures options and returns a DI-injectable constructor.
func NewWithCustomProvider ¶
func NewWithCustomProvider[T gas.TemplateProvider](opts ...Option) func(T, gas.ConfigProvider, gas.Logger) *Service
NewWithCustomProvider creates a new Service instance with a custom TemplateProvider and optional configurations.
Types ¶
type Config ¶
type Config struct {
env.WithGasEnv
Email Settings
}
Config holds SES email settings.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with zero-value defaults.
type Option ¶
type Option func(*Service)
Option configures a Service.
func WithClient ¶
func WithClient(client sesClient) Option
WithClient injects a pre-configured SES client. Useful for testing or when the caller manages AWS credentials externally.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is an SES-backed email sender implementing gas.Service and gas.EmailProvider.
func (*Service) CheckReady ¶
CheckReady reports whether the service can accept Send calls. Returns email.ErrClosed once Close has been invoked so probes depool the pod during shutdown/drain.
func (*Service) Client ¶
Client returns the underlying *ses.Client for advanced operations beyond the EmailProvider interface. Returns nil if a custom sesClient was injected via WithClient that is not an *ses.Client.
func (*Service) SendFromTemplate ¶
SendFromTemplate renders email templates and sends the resulting email using AWS SES. It fetches raw template content from the TemplateProvider, parses it, and executes it with the provided data.
type Settings ¶
type Settings struct {
// Region is the AWS region for the SES service.
Region string
// Endpoint is an optional custom endpoint URL (e.g. for LocalStack).
// Empty means use the default AWS endpoint.
Endpoint string
// FromEmail is the default sender email address.
FromEmail string
// AccessKeyID is the AWS access key ID for static credentials.
// If empty, the default AWS credential chain is used.
AccessKeyID string
// SecretAccessKey is the AWS secret access key for static credentials.
// If empty, the default AWS credential chain is used.
SecretAccessKey string
}
Settings represents the configuration for the SES email service.