zeroshade commented on code in PR #244:
URL: https://github.com/apache/iceberg-go/pull/244#discussion_r1906137219


##########
catalog/glue.go:
##########
@@ -54,6 +57,50 @@ var (
        _ Catalog = (*GlueCatalog)(nil)
 )
 
+func init() {
+       Register("glue", RegistrarFunc(func(_ string, props iceberg.Properties) 
(Catalog, error) {
+               awsConfig, err := toAwsConfig(props)
+               if err != nil {
+                       return nil, err
+               }
+
+               return NewGlueCatalog(WithAwsConfig(awsConfig), 
WithAwsProperties(AwsProperties(props))), nil
+       }))
+}
+
+func toAwsConfig(p iceberg.Properties) (aws.Config, error) {
+       opts := make([]func(*config.LoadOptions) error, 0)
+
+       for k, v := range p {
+               switch k {
+               case "glue.region":
+                       opts = append(opts, config.WithRegion(v))
+               case "glue.endpoint":
+                       opts = append(opts, config.WithBaseEndpoint(v))
+               case "glue.max-retries":
+                       maxRetry, err := strconv.Atoi(v)
+                       if err != nil {
+                               return aws.Config{}, err
+                       }
+                       opts = append(opts, 
config.WithRetryMaxAttempts(maxRetry))
+               case "glue.retry-mode":
+                       m, err := aws.ParseRetryMode(v)
+                       if err != nil {
+                               return aws.Config{}, err
+                       }
+                       opts = append(opts, config.WithRetryMode(m))
+               }
+       }
+
+       key, secret, token := p.Get("glue.access-key", ""), 
p.Get("glue.secret-access-key", ""), p.Get("glue.session-token", "")

Review Comment:
   Ah! Nice catch! thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to