rambleraptor commented on code in PR #3507:
URL: https://github.com/apache/iceberg-python/pull/3507#discussion_r3415053808


##########
pyiceberg/io/__init__.py:
##########
@@ -291,6 +296,13 @@ def delete(self, location: str | InputFile | OutputFile) 
-> None:
             FileNotFoundError: When the file at the provided location does not 
exist.
         """
 
+    def set_credentials_provider(self, provider: VendedCredentialsProvider) -> 
None:  # noqa: B027
+        """Inject a credentials provider for refreshing vended storage 
credentials.
+
+        Args:
+            provider (VendedCredentialsProvider): A concrete type of 
VendedCredentialsProvider (e.g S3VendedCredentialsProvider)
+        """
+

Review Comment:
   Can we put a TODO and a pass in here? That should be enough to get rid of 
the noqa: B027. I believe that will be enough to get rid of that type exception.
   
   I actually have no issues with assigning the provider to an internal 
variable (that isn't yet used)



##########
pyiceberg/catalog/rest/credentials_provider.py:
##########
@@ -0,0 +1,126 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+#
+from datetime import datetime
+
+from pydantic import Field
+from requests import HTTPError, Session
+
+from pyiceberg.catalog import URI
+from pyiceberg.catalog.rest.response import _handle_non_200_response
+from pyiceberg.catalog.rest.scan_planning import StorageCredential
+from pyiceberg.exceptions import ValidationException
+from pyiceberg.io import (
+    AWS_ACCESS_KEY_ID,
+    AWS_SECRET_ACCESS_KEY,
+    AWS_SESSION_TOKEN,
+    S3_ACCESS_KEY_ID,
+    S3_SECRET_ACCESS_KEY,
+    S3_SESSION_TOKEN,
+    S3_SESSION_TOKEN_EXPIRES_AT_MS,
+)
+from pyiceberg.typedef import IcebergBaseModel, Properties
+from pyiceberg.utils.properties import get_first_property_value
+
+CREDENTIALS_ENDPOINT = "client.refresh-credentials-endpoint"
+REFRESH_CREDENTIALS_ENABLED = "client.refresh-credentials-enabled"
+
+
+class LoadCredentialsResponse(IcebergBaseModel):
+    credentials: list[StorageCredential] = Field(alias="storage-credentials")
+
+
+class VendedCredentialsProvider:

Review Comment:
   This class seems to be handling two different situations:
   
   - A generic provider for handling vended credentials
   - An implementation that handles for S3.
   
   Can we split up the first part into a ABC and then the second part as an 
implementation? 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to