Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add __get_pydantic_core_schema__
Browse files Browse the repository at this point in the history
  • Loading branch information
kagrski committed Sep 20, 2023
1 parent cf265b6 commit 060be78
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
6 changes: 3 additions & 3 deletions ENDPOINTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ PUT /admin/user/profile/password||[**AdministrationUserAndGroup.update_profile_p
PUT /admin/user/{username}||[**AdministrationUserAndGroup.update_user**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/administration_user_and_group.py#L273)|[**UserUpdateRequest**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/administration_user_and_group.py#L20)|None|
PUT /admin/usergroup/{group_name}||[**AdministrationUserAndGroup.update_user_group**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/administration_user_and_group.py#L277)|[**UserGroup**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/administration_user_and_group.py#L48)|None|
GET /setting/configuration/webserver/certificate||[**CertificateManagementVManage.show_info**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/certificate_management_vmanage.py#L43)||[**WebServerCertificateInfo**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/certificate_management_vmanage.py#L9)|
GET /client/server||[**Client.server**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L65)||[**ServerInfo**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L21)|
GET /client/server/ready||[**Client.server_ready**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L69)||[**ServerReady**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L60)|
GET /client/about||[**Client.about**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L73)||[**AboutInfo**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L49)|
GET /client/server||[**Client.server**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L67)||[**ServerInfo**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L23)|
GET /client/server/ready||[**Client.server_ready**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L71)||[**ServerReady**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L62)|
GET /client/about||[**Client.about**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L75)||[**AboutInfo**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/client.py#L51)|
GET /clusterManagement/tenancy/mode||[**ClusterManagement.get_tenancy_mode**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/cluster_management.py#L60)||[**TenancyMode**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/cluster_management.py#L16)|
GET /device/action/status/{task_id}||[**ConfigurationDashboardStatus.find_status**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_dashboard_status.py#L89)||[**TaskData**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_dashboard_status.py#L76)|
GET /device/action/status/tasks||[**ConfigurationDashboardStatus.find_running_tasks**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_dashboard_status.py#L93)||[**TasksData**](https://github.com/CiscoDevNet/vManage-client/blob/main/vmngclient/endpoints/configuration_dashboard_status.py#L84)|
Expand Down
62 changes: 32 additions & 30 deletions vmngclient/endpoints/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,53 @@

class VersionField(Version):
@classmethod
def __get_validators__(cls):
yield cls.validate
# TODO[pydantic]: Verify if that is working
# Check https://docs.pydantic.dev/latest/migration/#defining-custom-types
def __get_pydantic_core_schema__(cls) -> Version:
return cls.validate

@classmethod
def validate(cls, value):
return Version(value)


class ServerInfo(BaseModel):
server: Optional[str]
tenancy_mode: Optional[str] = Field(alias="tenancyMode")
user_mode: Optional[str] = Field(alias="userMode")
vsession_id: Optional[str] = Field(alias="VSessionId")
is_saml_user: Optional[bool] = Field(alias="isSamlUser")
is_rbac_vpn_user: Optional[bool] = Field(alias="isRbacVpnUser")
server: Optional[str] = None
tenancy_mode: Optional[str] = Field(None, alias="tenancyMode")
user_mode: Optional[str] = Field(None, alias="userMode")
vsession_id: Optional[str] = Field(None, alias="VSessionId")
is_saml_user: Optional[bool] = Field(None, alias="isSamlUser")
is_rbac_vpn_user: Optional[bool] = Field(None, alias="isRbacVpnUser")
vpns: List[Any] = []
csrf_token: Optional[str] = Field(alias="CSRFToken")
provider_domain: Optional[str] = Field(alias="providerDomain")
tenant_id: Optional[str] = Field(alias="tenantId")
provider_id: Optional[str] = Field(alias="providerId")
view_mode: Optional[str] = Field(alias="viewMode")
csrf_token: Optional[str] = Field(None, alias="CSRFToken")
provider_domain: Optional[str] = Field(None, alias="providerDomain")
tenant_id: Optional[str] = Field(None, alias="tenantId")
provider_id: Optional[str] = Field(None, alias="providerId")
view_mode: Optional[str] = Field(None, alias="viewMode")
capabilities: List[str] = []
user: Optional[str]
description: Optional[str]
locale: Optional[str]
user: Optional[str] = None
description: Optional[str] = None
locale: Optional[str] = None
roles: List[str] = []
external_user: Optional[bool] = Field(alias="externalUser")
external_user: Optional[bool] = Field(None, alias="externalUser")
platform_version: str = Field(default="", alias="platformVersion")
general_template: Optional[bool] = Field(alias="generalTemplate")
disable_full_config_push: Optional[bool] = Field(alias="disableFullConfigPush")
enable_server_events: Optional[bool] = Field(alias="enableServerEvents")
cloudx: Optional[str]
reverseproxy: Optional[str]
vmanage_mode: Optional[str] = Field(alias="vmanageMode")
general_template: Optional[bool] = Field(None, alias="generalTemplate")
disable_full_config_push: Optional[bool] = Field(None, alias="disableFullConfigPush")
enable_server_events: Optional[bool] = Field(None, alias="enableServerEvents")
cloudx: Optional[str] = None
reverseproxy: Optional[str] = None
vmanage_mode: Optional[str] = Field(None, alias="vmanageMode")


class AboutInfo(BaseModel):
title: Optional[str]
title: Optional[str] = None
version: str = Field(default="")
application_version: Optional[str] = Field(alias="applicationVersion")
application_server: Optional[str] = Field(alias="applicationServer")
copyright: Optional[str]
time: Optional[datetime]
time_zone: Optional[str] = Field(alias="timeZone")
logo: Optional[str]
application_version: Optional[str] = Field(None, alias="applicationVersion")
application_server: Optional[str] = Field(None, alias="applicationServer")
copyright: Optional[str] = None
time: Optional[datetime] = None
time_zone: Optional[str] = Field(None, alias="timeZone")
logo: Optional[str] = None


class ServerReady(BaseModel):
Expand Down

0 comments on commit 060be78

Please sign in to comment.