This is an automated email from the ASF dual-hosted git repository.
laskoviymishka pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git
The following commit(s) were added to refs/heads/main by this push:
new 3bdc1af7b refactor(aws)!: standardize exported AWS initialisms (#2310)
3bdc1af7b is described below
commit 3bdc1af7b39d85346c42dda52b42e7d9e328d9c2
Author: Minh Vu <[email protected]>
AuthorDate: Sun Oct 25 10:11:41 2026 +0100
refactor(aws)!: standardize exported AWS initialisms (#2310)
---
catalog/glue/glue.go | 16 ++++++++--------
catalog/glue/glue_test.go | 22 +++++++++++-----------
catalog/glue/options.go | 10 +++++-----
catalog/rest/options.go | 6 +++---
catalog/rest/rest_internal_test.go | 2 +-
catalog/rest/signer.go | 2 +-
catalog/rest/sigv4/sigv4.go | 8 ++++----
catalog/rest/sigv4/sigv4_internal_test.go | 10 +++++-----
catalog/rest/vended_creds.go | 2 +-
cmd/iceberg/args_test.go | 12 ++++++------
cmd/iceberg/main.go | 12 ++++++------
config/config.go | 2 +-
config/config_test.go | 2 +-
io/gocloud/s3/s3.go | 2 +-
io/gocloud/s3/s3_test.go | 6 +++---
utils/context.go | 8 ++++----
website/src/api.md | 2 +-
website/src/configuration.md | 6 +++---
18 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/catalog/glue/glue.go b/catalog/glue/glue.go
index c86660edc..5341340cd 100644
--- a/catalog/glue/glue.go
+++ b/catalog/glue/glue.go
@@ -101,7 +101,7 @@ func init() {
return nil, err
}
- return NewCatalog(WithAwsConfig(awsConfig),
WithAwsProperties(AwsProperties(props)))
+ return NewCatalog(WithAWSConfig(awsConfig),
WithAWSProperties(AWSProperties(props)))
}))
}
@@ -176,7 +176,7 @@ type Catalog struct {
// ...other transport options...
// })
// awsCfg.HTTPClient = client
-// catalog, err := glue.NewCatalog(glue.WithAwsConfig(awsCfg))
+// catalog, err := glue.NewCatalog(glue.WithAWSConfig(awsCfg))
func NewCatalog(opts ...Option) (*Catalog, error) {
glueOps := &options{}
@@ -186,7 +186,7 @@ func NewCatalog(opts ...Option) (*Catalog, error) {
}
if glueOps.awsProperties == nil {
- glueOps.awsProperties = AwsProperties{}
+ glueOps.awsProperties = AWSProperties{}
}
var catalogId *string
@@ -322,7 +322,7 @@ func (c *Catalog) CreateTable(ctx context.Context,
identifier table.Identifier,
}
// Use the catalog's AWS config, not the ambient chain, for the
metadata write.
- ctx = utils.WithAwsConfig(ctx, c.awsCfg)
+ ctx = utils.WithAWSConfig(ctx, c.awsCfg)
if err := internal.WriteMetadata(ctx, staged.Table); err != nil {
return nil, err
}
@@ -439,7 +439,7 @@ func (c *Catalog) createS3TablesTable(ctx context.Context,
database, tableName s
// the Glue entry; the caller reloads, so a read failure never triggers
rollback.
func (c *Catalog) commitS3TablesTable(ctx context.Context, database, tableName
string, identifier table.Identifier, schema *iceberg.Schema, opts
...catalog.CreateTableOpt) error {
// Use the catalog's AWS config for WriteMetadata and the staged.FS
cleanup below.
- ctx = utils.WithAwsConfig(ctx, c.awsCfg)
+ ctx = utils.WithAWSConfig(ctx, c.awsCfg)
allocated, err := c.glueSvc.GetTable(ctx, &glue.GetTableInput{
CatalogId: c.catalogId,
@@ -505,7 +505,7 @@ func (c *Catalog) RegisterTable(ctx context.Context,
identifier table.Identifier
}
// Load the metadata file to get table properties
- ctx = utils.WithAwsConfig(ctx, c.awsCfg)
+ ctx = utils.WithAWSConfig(ctx, c.awsCfg)
// Read the metadata file. The reporter is intentionally not wired
here: the
// tail c.LoadTable(...) re-resolves it through convertGlueToIceberg,
and the
// table built below is discarded after constructTableInput.
@@ -566,7 +566,7 @@ func (c *Catalog) CommitTable(ctx context.Context,
identifier table.Identifier,
return current.Metadata(), current.MetadataLocation(), nil
}
// Use the catalog's AWS config, not the ambient chain, for the
metadata write.
- ctx = utils.WithAwsConfig(ctx, c.awsCfg)
+ ctx = utils.WithAWSConfig(ctx, c.awsCfg)
if err := internal.WriteMetadata(ctx, staged.Table); err != nil {
return nil, "", err
}
@@ -1112,7 +1112,7 @@ func (c *Catalog) convertGlueToIceberg(ctx
context.Context, glueTable *types.Tab
}
icebergTable, err := table.NewFromLocation(
- utils.WithAwsConfig(ctx, c.awsCfg),
+ utils.WithAWSConfig(ctx, c.awsCfg),
TableIdentifier(database, tableName),
metadataLocation,
io.LoadFSFunc(c.props, metadataLocation),
diff --git a/catalog/glue/glue_test.go b/catalog/glue/glue_test.go
index 5d8bb00fe..2e20db483 100644
--- a/catalog/glue/glue_test.go
+++ b/catalog/glue/glue_test.go
@@ -1873,7 +1873,7 @@ func TestGlueListTablesIntegration(t *testing.T) {
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
iter := ctlg.ListTables(context.TODO(),
DatabaseIdentifier(os.Getenv("TEST_DATABASE_NAME")))
@@ -1906,7 +1906,7 @@ func TestGlueLoadTableIntegration(t *testing.T) {
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
tbl, err := ctlg.LoadTable(context.TODO(),
[]string{os.Getenv("TEST_DATABASE_NAME"), os.Getenv("TEST_TABLE_NAME")})
@@ -1923,7 +1923,7 @@ func TestGlueListNamespacesIntegration(t *testing.T) {
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
namespaces, err := ctlg.ListNamespaces(context.TODO(), nil)
@@ -1947,7 +1947,7 @@ func TestGlueCreateTableSuccessIntegration(t *testing.T) {
metadataLocation := os.Getenv("TEST_TABLE_LOCATION")
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
sourceTable, err := ctlg.LoadTable(context.TODO(), []string{dbName,
sourceTableName})
assert.NoError(err)
@@ -1978,7 +1978,7 @@ func TestGlueCreateTableInvalidMetadataRollback(t
*testing.T) {
sourceTableName := os.Getenv("TEST_TABLE_NAME")
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
sourceTable, err := ctlg.LoadTable(context.TODO(), []string{dbName,
sourceTableName})
assert.NoError(err)
@@ -2138,7 +2138,7 @@ func TestRegisterTableIntegration(t *testing.T) {
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
// Drop table if it exists
@@ -2174,7 +2174,7 @@ func TestAlterTableIntegration(t *testing.T) {
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
// Create a table within the input database and location
@@ -2271,7 +2271,7 @@ func TestSnapshotManagementIntegration(t *testing.T) {
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
// clean up table after test
@@ -2496,7 +2496,7 @@ func TestCommitTableOptimisticLockingIntegration(t
*testing.T) {
awsCfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithClientLogMode(aws.LogRequest|aws.LogResponse))
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg))
assert.NoError(err)
createOpts := []catalog.CreateTableOpt{
@@ -2939,7 +2939,7 @@ func TestGlueCreateTableS3TablesFederatedIntegration(t
*testing.T) {
ctx := context.Background()
awsCfg, err := config.LoadDefaultConfig(ctx)
assert.NoError(err)
- ctlg, err := NewCatalog(WithAwsConfig(awsCfg),
WithAwsProperties(AwsProperties{CatalogIdKey: catalogID}))
+ ctlg, err := NewCatalog(WithAWSConfig(awsCfg),
WithAWSProperties(AWSProperties{CatalogIdKey: catalogID}))
assert.NoError(err)
tableName := fmt.Sprintf("it_%d", time.Now().UnixNano())
@@ -3204,7 +3204,7 @@ func recordingMemFS(t *testing.T, scheme string)
(*iceio.MemFS, *[]*aws.Config)
recorded := new([]*aws.Config)
iceio.Unregister(scheme)
iceio.Register(scheme, func(ctx context.Context, _ *url.URL, _
map[string]string) (iceio.IO, error) {
- *recorded = append(*recorded, utils.GetAwsConfig(ctx))
+ *recorded = append(*recorded, utils.GetAWSConfig(ctx))
return memFS, nil
})
diff --git a/catalog/glue/options.go b/catalog/glue/options.go
index 5d4d6d00b..2ff3817c0 100644
--- a/catalog/glue/options.go
+++ b/catalog/glue/options.go
@@ -21,18 +21,18 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
)
-type AwsProperties map[string]string
+type AWSProperties map[string]string
type Option func(*options)
-// WithAwsConfig sets the AWS configuration for the catalog.
-func WithAwsConfig(cfg aws.Config) Option {
+// WithAWSConfig sets the AWS configuration for the catalog.
+func WithAWSConfig(cfg aws.Config) Option {
return func(o *options) {
o.awsConfig = cfg
}
}
-func WithAwsProperties(props AwsProperties) Option {
+func WithAWSProperties(props AWSProperties) Option {
return func(o *options) {
o.awsProperties = props
}
@@ -40,5 +40,5 @@ func WithAwsProperties(props AwsProperties) Option {
type options struct {
awsConfig aws.Config
- awsProperties AwsProperties
+ awsProperties AWSProperties
}
diff --git a/catalog/rest/options.go b/catalog/rest/options.go
index e58b2c63a..7c13f51c7 100644
--- a/catalog/rest/options.go
+++ b/catalog/rest/options.go
@@ -88,7 +88,7 @@ func WithMetadataLocation(loc string) Option {
}
// WithSigV4 enables AWS SigV4 request signing for the REST catalog. The
signing
-// identity is resolved in order: an explicit WithAwsConfig, then the s3.*
catalog
+// identity is resolved in order: an explicit WithAWSConfig, then the s3.*
catalog
// credential properties (s3.access-key-id / s3.secret-access-key /
s3.session-token),
// then the AWS default credential chain.
//
@@ -137,7 +137,7 @@ func WithPrefix(prefix string) Option {
// bypasses the SigV4 machinery entirely, taking precedence over
// WithSignerFactory, WithSigV4 / WithSigV4RegionSvc, the rest.sigv4-enabled
// property, and any server-provided signing-region / signing-name overrides.
-// Use WithSignerFactory (or, for AWS, sigv4.WithAwsConfig) instead if you want
+// Use WithSignerFactory (or, for AWS, sigv4.WithAWSConfig) instead if you want
// the region and service to stay driven by those settings.
//
// A signer only runs for requests to the catalog origin. Requests to any other
@@ -155,7 +155,7 @@ func WithSigner(signer RequestSigner) Option {
// server-provided /v1/config overrides remain the single source of the signing
// region and service: they are folded into the SignerConfig passed to the
// factory. Optional backends such as
-// github.com/apache/iceberg-go/catalog/rest/sigv4 (via sigv4.WithAwsConfig)
use
+// github.com/apache/iceberg-go/catalog/rest/sigv4 (via sigv4.WithAWSConfig)
use
// this so the AWS SDK stays out of the core package.
//
// The factory is consulted only when SigV4 signing is enabled (WithSigV4,
diff --git a/catalog/rest/rest_internal_test.go
b/catalog/rest/rest_internal_test.go
index a95ebff7f..bfe07c7d6 100644
--- a/catalog/rest/rest_internal_test.go
+++ b/catalog/rest/rest_internal_test.go
@@ -2559,7 +2559,7 @@ func TestSigV4WithoutBackendReturnsHelpfulError(t
*testing.T) {
// WithSignerFactory is handed the signing region and service resolved from
// WithSigV4RegionSvc and any server-provided /v1/config overrides, rather than
// values frozen when the option was constructed. This is the seam a pre-built
-// WithSigner (which sigv4.WithAwsConfig used before it became a factory) got
+// WithSigner (which sigv4.WithAWSConfig used before it became a factory) got
// wrong: it ignored both WithSigV4RegionSvc and server overrides.
func TestSignerFactoryReceivesResolvedRegionService(t *testing.T) {
t.Parallel()
diff --git a/catalog/rest/signer.go b/catalog/rest/signer.go
index 0d330f396..f710f3113 100644
--- a/catalog/rest/signer.go
+++ b/catalog/rest/signer.go
@@ -102,7 +102,7 @@ func lookupSigner(name string) (SignerFactory, bool) {
// bypasses the sigv4-enabled / signing-region / signing-name settings and
any
// server-provided overrides.
// - Otherwise, when SigV4 is enabled (WithSigV4 / WithSigV4RegionSvc or the
-// rest.sigv4-enabled property), a WithSignerFactory (e.g.
sigv4.WithAwsConfig)
+// rest.sigv4-enabled property), a WithSignerFactory (e.g.
sigv4.WithAWSConfig)
// builds the signer if one was supplied, else the registered "sigv4"
backend
// does. Both receive the resolved region/service, which by this point
already
// include any /v1/config overrides fetchConfig folded into opts.
diff --git a/catalog/rest/sigv4/sigv4.go b/catalog/rest/sigv4/sigv4.go
index 9e9b42e24..c0a320227 100644
--- a/catalog/rest/sigv4/sigv4.go
+++ b/catalog/rest/sigv4/sigv4.go
@@ -28,7 +28,7 @@
//
// cat, err := rest.NewCatalog(ctx, "c", uri,
rest.WithSigV4RegionSvc("us-east-1", "s3tables"))
//
-// To sign with an explicit aws.Config, pass sigv4.WithAwsConfig alongside
+// To sign with an explicit aws.Config, pass sigv4.WithAWSConfig alongside
// WithSigV4 / WithSigV4RegionSvc (no blank import needed); the option supplies
// the config while those options still drive the signing region and service.
package sigv4
@@ -101,7 +101,7 @@ func init() {
// credential chain, and an ErrIncompleteStaticCredentials error when the
chosen
// namespace is incomplete.
//
-// An explicit aws.Config supplied via WithAwsConfig bypasses this: that path
+// An explicit aws.Config supplied via WithAWSConfig bypasses this: that path
// already fully specifies the credentials, so it never consults the
properties.
func staticCredsFromProps(props iceberg.Properties) (aws.CredentialsProvider,
error) {
namespaces := [][3]string{
@@ -205,7 +205,7 @@ func (s *signer) SignRequest(r *http.Request) error {
return s.httpSigner.SignHTTP(r.Context(), creds, r, payloadHash,
s.service, s.cfg.Region, time.Now())
}
-// WithAwsConfig returns a rest.Option that signs catalog requests with AWS
+// WithAWSConfig returns a rest.Option that signs catalog requests with AWS
// SigV4 using the supplied aws.Config, without consulting the AWS default
// credential chain. It replaces the former rest.WithAwsConfig, whose AWS SDK
// dependency now lives only in this optional sub-package.
@@ -216,7 +216,7 @@ func (s *signer) SignRequest(r *http.Request) error {
// values, plus any server-provided /v1/config overrides, are applied on top of
// cfg when the signer is built (a non-empty region overrides cfg.Region; an
// empty service defaults to "execute-api").
-func WithAwsConfig(cfg aws.Config) rest.Option {
+func WithAWSConfig(cfg aws.Config) rest.Option {
return rest.WithSignerFactory(func(_ context.Context, sc
rest.SignerConfig) (rest.RequestSigner, error) {
return buildSigner(cfg, sc), nil
})
diff --git a/catalog/rest/sigv4/sigv4_internal_test.go
b/catalog/rest/sigv4/sigv4_internal_test.go
index 94c14b61d..293b416f4 100644
--- a/catalog/rest/sigv4/sigv4_internal_test.go
+++ b/catalog/rest/sigv4/sigv4_internal_test.go
@@ -221,13 +221,13 @@ func TestRegisteredBackendEnablesSigV4(t *testing.T) {
assert.NotEmpty(t, gotSHA, "request should carry x-amz-content-sha256")
}
-// TestWithAwsConfigUsesConfiguredRegionService verifies that
sigv4.WithAwsConfig
+// TestWithAWSConfigUsesConfiguredRegionService verifies that
sigv4.WithAWSConfig
// signs with the region/service from WithSigV4RegionSvc, not the aws.Config's
-// own region. Before WithAwsConfig became a signer factory it froze the scope
at
+// own region. Before WithAWSConfig became a signer factory it froze the scope
at
// option-construction time, so the natural migration (keep WithSigV4RegionSvc,
-// swap rest.WithAwsConfig for sigv4.WithAwsConfig) silently signed for the
wrong
+// swap rest.WithAwsConfig for sigv4.WithAWSConfig) silently signed for the
wrong
// scope and the server rejected it with a 403.
-func TestWithAwsConfigUsesConfiguredRegionService(t *testing.T) {
+func TestWithAWSConfigUsesConfiguredRegionService(t *testing.T) {
t.Parallel()
var gotAuth string
@@ -252,7 +252,7 @@ func TestWithAwsConfigUsesConfiguredRegionService(t
*testing.T) {
cat, err := rest.NewCatalog(context.Background(), "rest", srv.URL,
rest.WithSigV4RegionSvc("us-west-2", "s3tables"),
- WithAwsConfig(cfg))
+ WithAWSConfig(cfg))
require.NoError(t, err)
require.NotNil(t, cat)
t.Cleanup(func() { _ = cat.Close() })
diff --git a/catalog/rest/vended_creds.go b/catalog/rest/vended_creds.go
index 76737a34c..50f21ff04 100644
--- a/catalog/rest/vended_creds.go
+++ b/catalog/rest/vended_creds.go
@@ -197,7 +197,7 @@ func (v *vendedCredentialRefresher) loadFS(ctx
context.Context) (iceio.IO, error
// lifetime instead, through ioCancel. fetchCreds above still honours
ctx.
//
// WithoutCancel keeps ctx's values, and the IO depends on them: the S3
- // factory takes its base AWS config from utils.GetAwsConfig(ctx), so do
+ // factory takes its base AWS config from utils.GetAWSConfig(ctx), so do
// not replace this with context.Background(). The flip side is that the
// first caller's request-scoped values stay attached to the shared IO.
ioCtx, ioCancel := context.WithCancel(context.WithoutCancel(ctx))
diff --git a/cmd/iceberg/args_test.go b/cmd/iceberg/args_test.go
index ebc358ad1..42dda0fef 100644
--- a/cmd/iceberg/args_test.go
+++ b/cmd/iceberg/args_test.go
@@ -257,7 +257,7 @@ func TestArgsParsing(t *testing.T) {
name: "aws-profile flag",
args: []string{"--catalog", "glue", "--aws-profile",
"my-profile", "list"},
check: func(t *testing.T, a Args) {
- assert.Equal(t, "my-profile", a.AwsProfile)
+ assert.Equal(t, "my-profile", a.AWSProfile)
},
},
{
@@ -637,18 +637,18 @@ func TestMergeConfSQLOptions(t *testing.T) {
})
}
-func TestMergeConfAwsProfile(t *testing.T) {
- fileCfg := &config.CatalogConfig{AwsProfile: "file-profile"}
+func TestMergeConfAWSProfile(t *testing.T) {
+ fileCfg := &config.CatalogConfig{AWSProfile: "file-profile"}
t.Run("file value applied when flag absent", func(t *testing.T) {
var a Args
mergeConf(fileCfg, &a, map[string]bool{})
- assert.Equal(t, "file-profile", a.AwsProfile)
+ assert.Equal(t, "file-profile", a.AWSProfile)
})
t.Run("cli value preserved when flag explicit", func(t *testing.T) {
- a := Args{AwsProfile: "cli-profile"}
+ a := Args{AWSProfile: "cli-profile"}
mergeConf(fileCfg, &a, map[string]bool{"aws-profile": true})
- assert.Equal(t, "cli-profile", a.AwsProfile)
+ assert.Equal(t, "cli-profile", a.AWSProfile)
})
}
diff --git a/cmd/iceberg/main.go b/cmd/iceberg/main.go
index 15c0b2360..0e6ac1bc1 100644
--- a/cmd/iceberg/main.go
+++ b/cmd/iceberg/main.go
@@ -219,7 +219,7 @@ type Args struct {
Warehouse string `arg:"--warehouse" help:"warehouse to use"`
Scope string `arg:"--scope" default:"catalog" help:"OAuth scope"`
Config string `arg:"--config" help:"path to configuration file"`
- AwsProfile string `arg:"--aws-profile" help:"AWS profile to use (Glue
catalog)"`
+ AWSProfile string `arg:"--aws-profile" help:"AWS profile to use (Glue
catalog)"`
SQLDriver string `arg:"--sql-driver" help:"database/sql driver name
(SQL catalog; default binary includes sqliteshim only)"`
SQLDialect string `arg:"--sql-dialect" help:"SQL dialect (SQL catalog;
default binary includes sqlite via sqliteshim; other dialects need a custom
build with their drivers)"`
@@ -412,8 +412,8 @@ func initCatalog(ctx context.Context, args Args)
catalog.Catalog {
}
case catalog.Glue:
var awsLoadOpts []func(*awsconfig.LoadOptions) error
- if args.AwsProfile != "" {
- awsLoadOpts = append(awsLoadOpts,
awsconfig.WithSharedConfigProfile(args.AwsProfile))
+ if args.AWSProfile != "" {
+ awsLoadOpts = append(awsLoadOpts,
awsconfig.WithSharedConfigProfile(args.AWSProfile))
}
awscfg, err := awsconfig.LoadDefaultConfig(ctx, awsLoadOpts...)
@@ -422,7 +422,7 @@ func initCatalog(ctx context.Context, args Args)
catalog.Catalog {
}
opts := []glue.Option{
- glue.WithAwsConfig(awscfg),
+ glue.WithAWSConfig(awscfg),
}
if cat, err = glue.NewCatalog(opts...); err != nil {
logFatal(err)
@@ -943,8 +943,8 @@ func mergeConf(fileConf *config.CatalogConfig, args *Args,
explicitFlags map[str
args.Warehouse = fileConf.Warehouse
}
- if !explicitFlags["aws-profile"] && len(fileConf.AwsProfile) > 0 {
- args.AwsProfile = fileConf.AwsProfile
+ if !explicitFlags["aws-profile"] && len(fileConf.AWSProfile) > 0 {
+ args.AWSProfile = fileConf.AWSProfile
}
if !explicitFlags["sql-driver"] && len(fileConf.SQLDriver) > 0 {
diff --git a/config/config.go b/config/config.go
index af7178961..7cf92859a 100644
--- a/config/config.go
+++ b/config/config.go
@@ -49,7 +49,7 @@ type CatalogConfig struct {
Output string `yaml:"output"`
Credential string `yaml:"credential"`
Warehouse string `yaml:"warehouse"`
- AwsProfile string `yaml:"aws-profile"`
+ AWSProfile string `yaml:"aws-profile"`
SQLDriver string `yaml:"sql-driver"`
SQLDialect string `yaml:"sql-dialect"`
RestOptions *RestOptions `yaml:"rest,omitempty"`
diff --git a/config/config_test.go b/config/config_test.go
index 288e79394..40da5a6a9 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -139,7 +139,7 @@ catalog:
`), "default",
&CatalogConfig{
CatalogType: "glue",
- AwsProfile: "my-aws-profile",
+ AWSProfile: "my-aws-profile",
},
},
// sql catalog with driver/dialect
diff --git a/io/gocloud/s3/s3.go b/io/gocloud/s3/s3.go
index eb96ca0f3..52ac8ff31 100644
--- a/io/gocloud/s3/s3.go
+++ b/io/gocloud/s3/s3.go
@@ -189,7 +189,7 @@ func resolveS3AWSConfig(ctx context.Context, props
map[string]string) (*aws.Conf
base *aws.Config
err error
)
- if v := utils.GetAwsConfig(ctx); v != nil {
+ if v := utils.GetAWSConfig(ctx); v != nil {
base = v
} else if base, err = ParseAWSConfig(ctx, props); err != nil {
return nil, err
diff --git a/io/gocloud/s3/s3_test.go b/io/gocloud/s3/s3_test.go
index efd2fbd60..a0aee7e00 100644
--- a/io/gocloud/s3/s3_test.go
+++ b/io/gocloud/s3/s3_test.go
@@ -56,7 +56,7 @@ func TestResolveS3AWSConfigCredentialPrecedence(t *testing.T)
{
}
ctxCfg := aws.Config{Credentials:
credentials.NewStaticCredentialsProvider("CTX", "ctxsecret", "")}
- ctxWith := utils.WithAwsConfig(context.Background(), &ctxCfg)
+ ctxWith := utils.WithAWSConfig(context.Background(), &ctxCfg)
// Explicit s3.* creds win over an ambient context config, without
mutating it.
t.Run("explicit props override ctx config", func(t *testing.T) {
@@ -91,7 +91,7 @@ func TestResolveS3AWSConfigCredentialPrecedence(t *testing.T)
{
t.Run("never mutates the shared ctx config", func(t *testing.T) {
t.Parallel()
shared := &aws.Config{Credentials:
credentials.NewStaticCredentialsProvider("CTX", "ctxsecret", "")}
- cfg, err :=
resolveS3AWSConfig(utils.WithAwsConfig(context.Background(), shared),
map[string]string{})
+ cfg, err :=
resolveS3AWSConfig(utils.WithAWSConfig(context.Background(), shared),
map[string]string{})
require.NoError(t, err)
require.NotSame(t, shared, cfg)
@@ -111,7 +111,7 @@ func TestResolveS3AWSConfigCredentialPrecedence(t
*testing.T) {
t.Run("explicit region overrides ctx config", func(t *testing.T) {
t.Parallel()
shared := &aws.Config{Region: "ctx-region", Credentials:
credentials.NewStaticCredentialsProvider("CTX", "s", "")}
- cfg, err :=
resolveS3AWSConfig(utils.WithAwsConfig(context.Background(), shared),
map[string]string{io.S3Region: "props-region"})
+ cfg, err :=
resolveS3AWSConfig(utils.WithAWSConfig(context.Background(), shared),
map[string]string{io.S3Region: "props-region"})
require.NoError(t, err)
assert.Equal(t, "props-region", cfg.Region)
assert.Equal(t, "ctx-region", shared.Region, "shared ctx config
must not be mutated")
diff --git a/utils/context.go b/utils/context.go
index bcab851f4..407a3df94 100644
--- a/utils/context.go
+++ b/utils/context.go
@@ -25,14 +25,14 @@ import (
type awsctxkey struct{}
-// WithAwsConfig returns a new context with the given AWS config
-func WithAwsConfig(ctx context.Context, cfg *aws.Config) context.Context {
+// WithAWSConfig returns a new context with the given AWS config
+func WithAWSConfig(ctx context.Context, cfg *aws.Config) context.Context {
return context.WithValue(ctx, awsctxkey{}, cfg)
}
-// GetAwsConfig returns the AWS config from the given context. Returns
+// GetAWSConfig returns the AWS config from the given context. Returns
// nil if no config is set.
-func GetAwsConfig(ctx context.Context) *aws.Config {
+func GetAWSConfig(ctx context.Context) *aws.Config {
if v := ctx.Value(awsctxkey{}); v != nil {
return v.(*aws.Config)
}
diff --git a/website/src/api.md b/website/src/api.md
index b1c62e370..f8df5d69d 100644
--- a/website/src/api.md
+++ b/website/src/api.md
@@ -70,7 +70,7 @@ import (
awsCfg, err := config.LoadDefaultConfig(context.TODO())
// handle err
-cat := glue.NewCatalog(glue.WithAwsConfig(awsCfg))
+cat := glue.NewCatalog(glue.WithAWSConfig(awsCfg))
```
#### Hive
diff --git a/website/src/configuration.md b/website/src/configuration.md
index 8f61d8a93..d565061b2 100644
--- a/website/src/configuration.md
+++ b/website/src/configuration.md
@@ -86,7 +86,7 @@ The most option-rich surface. Source:
[`catalog/rest/options.go`](https://github
> `WithSigV4` / `WithSigV4RegionSvc` or the `rest.sigv4-enabled` property.
> The
> backend signs with the `s3.*` credential properties when set (falling back
> to
> the `rest.*` aliases), otherwise with the AWS default credential chain.
-> - Explicit config: pass `sigv4.WithAwsConfig(cfg)` to `NewCatalog` alongside
+> - Explicit config: pass `sigv4.WithAWSConfig(cfg)` to `NewCatalog` alongside
> `WithSigV4` / `WithSigV4RegionSvc` (no blank import needed). It supplies
> the
> `aws.Config`; the signing service comes from those options (or a server
> `/v1/config` override), and so does the region when one is set. Otherwise
@@ -146,8 +146,8 @@ Invalid values (non-positive waits/retries, or min ≥ max)
are ignored and the
Source:
[`catalog/glue/options.go`](https://github.com/apache/iceberg-go/blob/main/catalog/glue/options.go).
-- `WithAwsConfig(cfg aws.Config)` - AWS SDK v2 config; respects the AWS
default credential chain.
-- `WithAwsProperties(props AwsProperties)` - explicit overrides for
region/endpoint/access keys.
+- `WithAWSConfig(cfg aws.Config)` - AWS SDK v2 config; respects the AWS
default credential chain.
+- `WithAWSProperties(props AWSProperties)` - catalog properties, such as
`glue.id` and the `s3.*` FileIO keys. `NewCatalog` ignores the `glue.region`,
endpoint, credential, and retry keys; only `catalog.Load` reads them.
### SQL (`catalog/sql`)