Skip to content

Commit

Permalink
Update autogenerated client and config
Browse files Browse the repository at this point in the history
  • Loading branch information
ddl-s-ramirezayuso committed Feb 20, 2025
1 parent f0e1b7c commit 3ae5fda
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 38 deletions.
15 changes: 7 additions & 8 deletions datasource_api_client/api/datasource/get_datasource_by_name.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any, Dict, Optional, Union

from http import HTTPStatus
from typing import Any, Dict, Optional, Union

import httpx

Expand Down Expand Up @@ -36,27 +35,27 @@ def _get_kwargs(
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[DatasourceDto, ErrorResponse]]:
if response.status_code == HTTPStatus.OK:
if response.status_code == 200:
response_200 = DatasourceDto.from_dict(response.json())

return response_200
if response.status_code == HTTPStatus.BAD_REQUEST:
if response.status_code == 400:
response_400 = ErrorResponse.from_dict(response.json())

return response_400
if response.status_code == HTTPStatus.UNAUTHORIZED:
if response.status_code == 401:
response_401 = ErrorResponse.from_dict(response.json())

return response_401
if response.status_code == HTTPStatus.FORBIDDEN:
if response.status_code == 403:
response_403 = ErrorResponse.from_dict(response.json())

return response_403
if response.status_code == HTTPStatus.NOT_FOUND:
if response.status_code == 404:
response_404 = ErrorResponse.from_dict(response.json())

return response_404
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
if response.status_code == 500:
response_500 = ErrorResponse.from_dict(response.json())

return response_500
Expand Down
9 changes: 4 additions & 5 deletions datasource_api_client/api/proxy/get_key_url.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any, Dict, Optional, Union, cast

from http import HTTPStatus
from typing import Any, Dict, Optional, Union, cast

import httpx

Expand Down Expand Up @@ -34,14 +33,14 @@ def _get_kwargs(
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[ProxyErrorResponse, str]]:
if response.status_code == HTTPStatus.OK:
if response.status_code == 200:
response_200 = cast(str, response.json())
return response_200
if response.status_code == HTTPStatus.BAD_REQUEST:
if response.status_code == 400:
response_400 = ProxyErrorResponse.from_dict(response.json())

return response_400
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
if response.status_code == 500:
response_500 = ProxyErrorResponse.from_dict(response.json())

return response_500
Expand Down
9 changes: 4 additions & 5 deletions datasource_api_client/api/proxy/list_keys.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any, Dict, List, Optional, Union, cast

from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast

import httpx

Expand Down Expand Up @@ -34,15 +33,15 @@ def _get_kwargs(
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[List[str], ProxyErrorResponse]]:
if response.status_code == HTTPStatus.OK:
if response.status_code == 200:
response_200 = cast(List[str], response.json())

return response_200
if response.status_code == HTTPStatus.BAD_REQUEST:
if response.status_code == 400:
response_400 = ProxyErrorResponse.from_dict(response.json())

return response_400
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
if response.status_code == 500:
response_500 = ProxyErrorResponse.from_dict(response.json())

return response_500
Expand Down
5 changes: 2 additions & 3 deletions datasource_api_client/api/proxy/log_metric.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any, Dict, Optional, Union

from http import HTTPStatus
from typing import Any, Dict, Optional, Union

import httpx

Expand Down Expand Up @@ -41,7 +40,7 @@ def _get_kwargs(
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Any]:
if response.status_code == HTTPStatus.OK:
if response.status_code == 200:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
Expand Down
27 changes: 18 additions & 9 deletions datasource_api_client/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any, Dict, Optional, Union

import ssl
from typing import Any, Dict, Optional, Union

import httpx
from attrs import define, evolve, field
Expand Down Expand Up @@ -39,11 +38,15 @@ class Client:
_base_url: str = field(alias="base_url")
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
_timeout: Optional[httpx.Timeout] = field(
default=None, kw_only=True, alias="timeout"
)
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(
default=True, kw_only=True, alias="verify_ssl"
)
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
_follow_redirects: bool = field(
default=False, kw_only=True, alias="follow_redirects"
)
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
_client: Optional[httpx.Client] = field(default=None, init=False)
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
Expand Down Expand Up @@ -73,7 +76,7 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client":
return evolve(self, timeout=timeout)

def set_httpx_client(self, client: httpx.Client) -> "Client":
"""Manually the underlying httpx.Client
"""Manually set the underlying httpx.Client
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
Expand Down Expand Up @@ -171,11 +174,15 @@ class AuthenticatedClient:
_base_url: str = field(alias="base_url")
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
_timeout: Optional[httpx.Timeout] = field(
default=None, kw_only=True, alias="timeout"
)
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(
default=True, kw_only=True, alias="verify_ssl"
)
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
_follow_redirects: bool = field(
default=False, kw_only=True, alias="follow_redirects"
)
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
_client: Optional[httpx.Client] = field(default=None, init=False)
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
Expand Down Expand Up @@ -209,7 +216,7 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
return evolve(self, timeout=timeout)

def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
"""Manually the underlying httpx.Client
"""Manually set the underlying httpx.Client
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
Expand Down Expand Up @@ -242,7 +249,9 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
self.get_httpx_client().__exit__(*args, **kwargs)

def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
def set_async_httpx_client(
self, async_client: httpx.AsyncClient
) -> "AuthenticatedClient":
"""Manually the underlying httpx.AsyncClient
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
Expand Down
11 changes: 9 additions & 2 deletions datasource_api_client/types.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
"""Contains some shared types for properties"""

from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar

from http import HTTPStatus
from typing import (
BinaryIO,
Generic,
Literal,
MutableMapping,
Optional,
Tuple,
TypeVar,
)

from attrs import define

Expand Down
27 changes: 22 additions & 5 deletions domino_data/configuration_gen.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Code generated by gen.py; DO NOT EDIT.
This file was generated by robots at
2024-01-18 15:51:53.230967"""

2025-02-20 13:30:06.271414"""
from typing import Any, Dict, Optional, Union

from enum import Enum
Expand Down Expand Up @@ -80,7 +79,8 @@ class ConfigElem(Enum):
WAREHOUSE = "warehouse"
CATALOGCODE = "catalogCode"
ENVIRONMENT = "environment"
SNAPSHOPTID = "snapshotID"
SNAPSHOTID = "snapshotID"
SSLENABLED = "sslEnabled"


class CredElem(Enum):
Expand Down Expand Up @@ -150,6 +150,7 @@ class BigQueryConfig(Config):
class ClickHouseConfig(Config):
"""ClickHouseConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -168,14 +169,16 @@ class DatabricksConfig(Config):
class DatasetConfig(Config):
"""DatasetConfig datasource configuration."""

dataset_id: Optional[str] = _config(elem=ConfigElem.DATASETID)
snapshot_id: Optional[str] = _config(elem=ConfigElem.SNAPSHOPTID)
snapshot_id: Optional[str] = _config(elem=ConfigElem.SNAPSHOTID)
subfolder: Optional[str] = _config(elem=ConfigElem.SUBFOLDER)



@attr.s(auto_attribs=True)
class DB2Config(Config):
"""DB2Config datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -184,6 +187,7 @@ class DB2Config(Config):
class DruidConfig(Config):
"""DruidConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -201,6 +205,7 @@ class GCSConfig(Config):
class GenericJDBCConfig(Config):
"""GenericJDBCConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -222,6 +227,7 @@ class GenericS3Config(Config):
class GreenplumConfig(Config):
"""GreenplumConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -230,6 +236,7 @@ class GreenplumConfig(Config):
class IgniteConfig(Config):
"""IgniteConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -238,6 +245,7 @@ class IgniteConfig(Config):
class MariaDBConfig(Config):
"""MariaDBConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -246,6 +254,7 @@ class MariaDBConfig(Config):
class MongoDBConfig(Config):
"""MongoDBConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -268,6 +277,7 @@ class MySQLConfig(Config):
class NetezzaConfig(Config):
"""NetezzaConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -286,6 +296,7 @@ class OracleConfig(Config):
class PalantirConfig(Config):
"""PalantirConfig datasource configuration."""


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)
Expand Down Expand Up @@ -336,6 +347,7 @@ class S3Config(Config):
class SAPHanaConfig(Config):
"""SAPHanaConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -344,6 +356,7 @@ class SAPHanaConfig(Config):
class SingleStoreConfig(Config):
"""SingleStoreConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand Down Expand Up @@ -376,6 +389,7 @@ class SnowflakeConfig(Config):
class SynapseConfig(Config):
"""SynapseConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -388,10 +402,12 @@ class TabularS3GlueConfig(Config):
region: Optional[str] = _config(elem=ConfigElem.REGION)



@attr.s(auto_attribs=True)
class TeradataConfig(Config):
"""TeradataConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand All @@ -411,6 +427,7 @@ class TrinoConfig(Config):
class VerticaConfig(Config):
"""VerticaConfig datasource configuration."""


username: Optional[str] = _cred(elem=CredElem.USERNAME)
password: Optional[str] = _cred(elem=CredElem.PASSWORD)

Expand Down
2 changes: 2 additions & 0 deletions openapi/datasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ components:
- AWSIAMRole
- AWSIAMRoleWithUsername
- GCPBasic
- NoAuth
- OAuth
- OAuthToken
- ClientIdSecret
Expand All @@ -226,6 +227,7 @@ components:
- BigQueryConfig
- ClickHouseConfig
- DatabricksConfig
- DatasetConfig
- DB2Config
- DruidConfig
- GCSConfig
Expand Down
2 changes: 1 addition & 1 deletion services

0 comments on commit 3ae5fda

Please sign in to comment.