@@ -42,21 +42,21 @@ class ClusterAccessRights(BaseModel):
4242
4343
4444class BaseAuthentication (BaseModel ):
45- discriminator_type : str
45+ type : str
4646
4747 model_config = ConfigDict (frozen = True , extra = "forbid" )
4848
4949
5050class SimpleAuthentication (BaseAuthentication ):
51- discriminator_type : Literal ["simple" ] = "simple"
51+ type : Literal ["simple" ] = "simple"
5252 username : str
5353 password : SecretStr
5454
5555 model_config = ConfigDict (
5656 json_schema_extra = {
5757 "examples" : [
5858 {
59- "discriminator_type " : "simple" ,
59+ "type " : "simple" ,
6060 "username" : "someuser" ,
6161 "password" : "somepassword" ,
6262 },
@@ -66,28 +66,28 @@ class SimpleAuthentication(BaseAuthentication):
6666
6767
6868class KerberosAuthentication (BaseAuthentication ):
69- discriminator_type : Literal ["kerberos" ] = "kerberos"
69+ type : Literal ["kerberos" ] = "kerberos"
7070
7171 model_config = ConfigDict (
7272 json_schema_extra = {
7373 "examples" : [
7474 {
75- "discriminator_type " : "kerberos" ,
75+ "type " : "kerberos" ,
7676 },
7777 ]
7878 }
7979 )
8080
8181
8282class JupyterHubTokenAuthentication (BaseAuthentication ):
83- discriminator_type : Literal ["jupyterhub" ] = "jupyterhub"
83+ type : Literal ["jupyterhub" ] = "jupyterhub"
8484 api_token : str
8585
8686 model_config = ConfigDict (
8787 json_schema_extra = {
8888 "examples" : [
8989 {
90- "discriminator_type " : "jupyterhub" ,
90+ "type " : "jupyterhub" ,
9191 "api_token" : "some_jupyterhub_token" ,
9292 },
9393 ]
@@ -96,15 +96,13 @@ class JupyterHubTokenAuthentication(BaseAuthentication):
9696
9797
9898class NoAuthentication (BaseAuthentication ):
99- discriminator_type : Literal ["none" ] = "none"
99+ type : Literal ["none" ] = "none"
100100
101- model_config = ConfigDict (
102- json_schema_extra = {"examples" : [{"discriminator_type" : "none" }]}
103- )
101+ model_config = ConfigDict (json_schema_extra = {"examples" : [{"type" : "none" }]})
104102
105103
106104class TLSAuthentication (BaseAuthentication ):
107- discriminator_type : Literal ["tls" ] = "tls"
105+ type : Literal ["tls" ] = "tls"
108106 tls_ca_file : Path
109107 tls_client_cert : Path
110108 tls_client_key : Path
@@ -113,7 +111,7 @@ class TLSAuthentication(BaseAuthentication):
113111 json_schema_extra = {
114112 "examples" : [
115113 {
116- "discriminator_type " : "tls" ,
114+ "type " : "tls" ,
117115 "tls_ca_file" : "/path/to/ca_file" ,
118116 "tls_client_cert" : "/path/to/cert_file" ,
119117 "tls_client_key" : "/path/to/key_file" ,
@@ -147,7 +145,7 @@ class BaseCluster(BaseModel):
147145 authentication : ClusterAuthentication = Field (
148146 ...,
149147 description = "Dask gateway authentication" ,
150- discriminator = "discriminator_type " ,
148+ discriminator = "type " ,
151149 )
152150 access_rights : dict [GroupID , ClusterAccessRights ] = Field (default_factory = dict )
153151
@@ -176,7 +174,7 @@ class Cluster(BaseCluster):
176174 "owner" : 1456 ,
177175 "endpoint" : "tcp://default-dask-scheduler:8786" ,
178176 "authentication" : {
179- "discriminator_type " : "simple" ,
177+ "type " : "simple" ,
180178 "username" : "someuser" ,
181179 "password" : "somepassword" ,
182180 },
@@ -188,7 +186,7 @@ class Cluster(BaseCluster):
188186 "owner" : 12 ,
189187 "endpoint" : "https://registry.osparc-development.fake.dev" ,
190188 "authentication" : {
191- "discriminator_type " : "simple" ,
189+ "type " : "simple" ,
192190 "username" : "someuser" ,
193191 "password" : "somepassword" ,
194192 },
@@ -200,7 +198,7 @@ class Cluster(BaseCluster):
200198 "type" : ClusterTypeInModel .AWS ,
201199 "owner" : 154 ,
202200 "endpoint" : "https://registry.osparc-development.fake.dev" ,
203- "authentication" : {"discriminator_type " : "kerberos" },
201+ "authentication" : {"type " : "kerberos" },
204202 "access_rights" : {
205203 154 : CLUSTER_ADMIN_RIGHTS , # type: ignore[dict-item]
206204 12 : CLUSTER_MANAGER_RIGHTS , # type: ignore[dict-item]
@@ -215,7 +213,7 @@ class Cluster(BaseCluster):
215213 "owner" : 2321 ,
216214 "endpoint" : "https://registry.osparc-development.fake2.dev" ,
217215 "authentication" : {
218- "discriminator_type " : "jupyterhub" ,
216+ "type " : "jupyterhub" ,
219217 "api_token" : "some_fake_token" ,
220218 },
221219 "access_rights" : {
0 commit comments