You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/07/30 06:25:19 UTC
[GitHub] [airflow] Taragolis commented on a diff in pull request #25416: Hide unused fields for Amazon Web Services connection
Taragolis commented on code in PR #25416:
URL: https://github.com/apache/airflow/pull/25416#discussion_r933760449
##########
airflow/providers/amazon/aws/hooks/base_aws.py:
##########
@@ -582,6 +582,18 @@ def decorator_f(self, *args, **kwargs):
return retry_decorator
+ @staticmethod
+ def get_ui_field_behaviour() -> Dict[str, Any]:
+ """Returns custom field behaviour."""
+ return {
+ "hidden_fields": ['host', 'schema', 'port'],
+ "relabeling": {},
+ "placeholders": {
Review Comment:
@josh-fell Oh, it my second attempt for changing UI behaviour for AWS Connection. Previous one I even did not create PR in the end. Right now I tried to make it simple as possible only to show that host, port and schema not use in connection and follow the [Amazon Web Services Connection documentation](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/connections/aws.html#configuring-the-connection).
The root issue is the fact that user could define `aws_access_key_id` and `aws_secret_access_key` in three different places.
In login/password:
```python
Connection(
conn_id="aws_conn_1",
conn_type="aws",
login="AKIAIOSFODNN7EXAMPLE",
password="login="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
)
```
In extra fields `aws_access_key_id` and `aws_secret_access_key`
```python
Connection(
conn_id="aws_conn_2",
conn_type="aws",
extra={
"aws_access_key_id": "AKIAIOSFODNN7EXAMPLE",
"aws_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
}
)
```
In extra `session_kwargs` keys `aws_access_key_id` and `aws_secret_access_key` (not directly documented but this is mentioned in boto3 documentation)
```python
Connection(
conn_id="aws_conn_3",
conn_type="aws",
extra={
"session_kwargs": {
"aws_access_key_id": "AKIAIOSFODNN7EXAMPLE",
"aws_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
}
}
)
```
I thought rename `login` and `password` to `aws_access_key_id` and `aws_secret_access_key` might confuse user more.
@eladkal The same things with extra columns in UI, such as `region_name`. Right now it is only possible add as `extra__{conn_type}__{field_name}`, which:
1. Would not work with AWS Connection right now
2. Required some changes for resolve cases such as
```python
Connection(
conn_id="aws_conn_hell",
conn_type="aws",
extra={
"region_name": "us-east-1",
"extra__aws__region_name": "eu-west-1",
"session_kwargs": {
"region_name": "cn-north-1",
}
}
)
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org