in client/client.go [25:51]
func New(ctx context.Context, logger zerolog.Logger, s specs.Source, opts source.Options) (schema.ClientMeta, error) {
var pluginSpec Spec
if err := s.UnmarshalSpec(&pluginSpec); err != nil {
return nil, fmt.Errorf("failed to unmarshal plugin spec: %w", err)
}
// Loads credentials from the default credential chain.
// Locally, set the AWS_PROFILE environment variable, or run `make serve`.
// See https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials.
cfg, err := config.LoadDefaultConfig(
ctx,
config.WithRegion("eu-west-1"),
)
if err != nil {
return nil, fmt.Errorf("unable to load AWS config, %w", err)
}
client := s3.NewFromConfig(cfg)
store := store.New(client, pluginSpec.GalaxiesBucketName, "galaxies.gutools.co.uk/data")
return &Client{
Logger: logger,
Store: store,
}, nil
}