Skip to content

Commit

Permalink
Update the code generation (#132)
Browse files Browse the repository at this point in the history
* Update the code generation

* Pulled the latest data-services
  • Loading branch information
ddl-joyce-zhao authored Jan 18, 2024
1 parent d53ccfe commit 062b365
Show file tree
Hide file tree
Showing 7 changed files with 772 additions and 723 deletions.
1 change: 1 addition & 0 deletions datasource_api_client/models/datasource_dto_auth_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class DatasourceDtoAuthType(str, Enum):
AWSIAMROLEWITHUSERNAME = "AWSIAMRoleWithUsername"
GCPBASIC = "GCPBasic"
OAUTH = "OAuth"
OAUTHTOKEN = "OAuthToken"
CLIENTIDSECRET = "ClientIdSecret"
PERSONALTOKEN = "PersonalToken"

Expand Down
11 changes: 8 additions & 3 deletions domino_data/configuration_gen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Code generated by gen.py; DO NOT EDIT.
This file was generated by robots at
2023-09-27 17:47:39.546325"""
2024-01-18 15:51:53.230967"""
from typing import Any, Dict, Optional, Union

from enum import Enum
Expand Down Expand Up @@ -74,9 +74,10 @@ class ConfigElem(Enum):
REGION = "region"
ROLE = "role"
SCHEMA = "schema"
QUERYTIMEOUT = "queryTimeout"
SUBFOLDER = "subfolder"
WAREHOUSE = "warehouse"
CATALOGCODE = "catalogCode"
ENVIRONMENT = "environment"


class CredElem(Enum):
Expand All @@ -93,6 +94,8 @@ class CredElem(Enum):
CLIENTID = "clientId"
CLIENTSECRET = "clientSecret"
PERSONALACCESSTOKEN = "personalAccessToken"
APIKEY = "apiKey"
OAUTHTOKEN = "oAuthToken"


def _cred(elem: CredElem) -> Any:
Expand Down Expand Up @@ -154,7 +157,6 @@ class DatabricksConfig(Config):

catalog: Optional[str] = _config(elem=ConfigElem.CATALOG)
schema: Optional[str] = _config(elem=ConfigElem.SCHEMA)
query_timeout: Optional[str] = _config(elem=ConfigElem.QUERYTIMEOUT)

personal_access_token: Optional[str] = _cred(elem=CredElem.PERSONALACCESSTOKEN)

Expand Down Expand Up @@ -197,6 +199,7 @@ class GenericS3Config(Config):
"""GenericS3Config datasource configuration."""

bucket: Optional[str] = _config(elem=ConfigElem.BUCKET)
subfolder: Optional[str] = _config(elem=ConfigElem.SUBFOLDER)
host: Optional[str] = _config(elem=ConfigElem.HOST)
region: Optional[str] = _config(elem=ConfigElem.REGION)

Expand Down Expand Up @@ -274,6 +277,7 @@ class PalantirConfig(Config):

client_id: Optional[str] = _cred(elem=CredElem.CLIENTID)
client_secret: Optional[str] = _cred(elem=CredElem.CLIENTSECRET)
o_auth_token: Optional[str] = _cred(elem=CredElem.OAUTHTOKEN)


@attr.s(auto_attribs=True)
Expand Down Expand Up @@ -309,6 +313,7 @@ class S3Config(Config):
"""S3Config datasource configuration."""

bucket: Optional[str] = _config(elem=ConfigElem.BUCKET)
subfolder: Optional[str] = _config(elem=ConfigElem.SUBFOLDER)
region: Optional[str] = _config(elem=ConfigElem.REGION)

aws_access_key_id: Optional[str] = _cred(elem=CredElem.ACCESSKEYID)
Expand Down
1 change: 1 addition & 0 deletions openapi/datasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ components:
- AWSIAMRoleWithUsername
- GCPBasic
- OAuth
- OAuthToken
- ClientIdSecret
- PersonalToken
config:
Expand Down
1,465 changes: 751 additions & 714 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
anyio==4.1.0 ; python_version >= "3.8" and python_version < "4.0"
attrs==23.1.0 ; python_version >= "3.8" and python_version < "4.0"
anyio==4.2.0 ; python_version >= "3.8" and python_version < "4.0"
attrs==23.2.0 ; python_version >= "3.8" and python_version < "4.0"
backoff==1.11.1 ; python_version >= "3.8" and python_version < "4.0"
bson==0.5.10 ; python_version >= "3.8" and python_version < "4.0"
certifi==2023.11.17 ; python_version >= "3.8" and python_version < "4.0"
Expand All @@ -18,5 +18,6 @@ pytz==2023.3.post1 ; python_version >= "3.8" and python_version < "4.0"
rfc3986[idna2008]==1.5.0 ; python_version >= "3.8" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.8" and python_version < "4.0"
sniffio==1.3.0 ; python_version >= "3.8" and python_version < "4.0"
typing-extensions==4.9.0 ; python_version >= "3.8" and python_version < "3.11"
urllib3==1.26.18 ; python_version >= "3.8" and python_version < "4.0"
win32-setctime==1.1.0 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "win32"
10 changes: 7 additions & 3 deletions scripts/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ def main(args: Any) -> None:
with open(args.config, encoding="ascii") as config_file:
configs = yaml.load(config_file, Loader=yaml.FullLoader)

datasource_configs = configs["datasource_configs"]
datasource_configs = {
k: v
for k, v in configs["datasource_configs"].items()
if v.get("connectorGroup", "Native") != "ReverseProxy"
}
auth_configs = configs["auth_configs"]

datasource_names: Dict[str, Any] = {}
Expand Down Expand Up @@ -220,12 +224,12 @@ def main(args: Any) -> None:
)
gen.write(
env.get_template(Configs).render(
datasource_configs=configs["datasource_configs"],
datasource_configs=datasource_configs,
datasource_names=datasource_names,
auth_names=auth_names,
),
)
gen.write(env.get_template(Storages).render(datasources=configs["datasource_configs"]))
gen.write(env.get_template(Storages).render(datasources=datasource_configs))


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion services

0 comments on commit 062b365

Please sign in to comment.