Skip to content

Commit 2fd5e1d

Browse files
feat: Add pilot auth
1 parent d50e34c commit 2fd5e1d

File tree

32 files changed

+4767
-264
lines changed

32 files changed

+4767
-264
lines changed

diracx-client/src/diracx/client/_generated/aio/operations/_operations.py

Lines changed: 462 additions & 11 deletions
Large diffs are not rendered by default.

diracx-client/src/diracx/client/_generated/models/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
BodyAuthGetOidcTokenGrantType,
1717
BodyPilotsAddPilotStamps,
1818
BodyPilotsAssociatePilotWithJobs,
19+
BodyPilotsCreatePilotSecrets,
20+
BodyPilotsPilotLogin,
21+
BodyPilotsRefreshPilotTokens,
1922
BodyPilotsUpdatePilotFields,
2023
GroupInfo,
2124
HTTPValidationError,
@@ -28,7 +31,11 @@
2831
JobSummaryParamsSearchItem,
2932
Metadata,
3033
OpenIDConfiguration,
34+
PilotCredentialsInfo,
3135
PilotFieldsMapping,
36+
PilotInfo,
37+
PilotSecretConstraints,
38+
PilotSecretsInfo,
3239
SandboxDownloadResponse,
3340
SandboxInfo,
3441
SandboxUploadResponse,
@@ -67,6 +74,9 @@
6774
"BodyAuthGetOidcTokenGrantType",
6875
"BodyPilotsAddPilotStamps",
6976
"BodyPilotsAssociatePilotWithJobs",
77+
"BodyPilotsCreatePilotSecrets",
78+
"BodyPilotsPilotLogin",
79+
"BodyPilotsRefreshPilotTokens",
7080
"BodyPilotsUpdatePilotFields",
7181
"GroupInfo",
7282
"HTTPValidationError",
@@ -79,7 +89,11 @@
7989
"JobSummaryParamsSearchItem",
8090
"Metadata",
8191
"OpenIDConfiguration",
92+
"PilotCredentialsInfo",
8293
"PilotFieldsMapping",
94+
"PilotInfo",
95+
"PilotSecretConstraints",
96+
"PilotSecretsInfo",
8397
"SandboxDownloadResponse",
8498
"SandboxInfo",
8599
"SandboxUploadResponse",

diracx-client/src/diracx/client/_generated/models/_models.py

Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ class BodyPilotsAddPilotStamps(_serialization.Model):
107107
:vartype grid_type: str
108108
:ivar pilot_references: Association of a pilot reference with a pilot stamp.
109109
:vartype pilot_references: dict[str, str]
110+
:ivar generate_secrets: If we want to create secrets with the pilots.
111+
:vartype generate_secrets: bool
112+
:ivar pilot_secret_use_count_max: How much time can a secret be used.
113+
:vartype pilot_secret_use_count_max: int
110114
"""
111115

112116
_validation = {
@@ -119,6 +123,8 @@ class BodyPilotsAddPilotStamps(_serialization.Model):
119123
"vo": {"key": "vo", "type": "str"},
120124
"grid_type": {"key": "grid_type", "type": "str"},
121125
"pilot_references": {"key": "pilot_references", "type": "{str}"},
126+
"generate_secrets": {"key": "generate_secrets", "type": "bool"},
127+
"pilot_secret_use_count_max": {"key": "pilot_secret_use_count_max", "type": "int"},
122128
}
123129

124130
def __init__(
@@ -128,6 +134,8 @@ def __init__(
128134
vo: str,
129135
grid_type: str = "Dirac",
130136
pilot_references: Optional[Dict[str, str]] = None,
137+
generate_secrets: bool = True,
138+
pilot_secret_use_count_max: int = 1,
131139
**kwargs: Any
132140
) -> None:
133141
"""
@@ -139,12 +147,18 @@ def __init__(
139147
:paramtype grid_type: str
140148
:keyword pilot_references: Association of a pilot reference with a pilot stamp.
141149
:paramtype pilot_references: dict[str, str]
150+
:keyword generate_secrets: If we want to create secrets with the pilots.
151+
:paramtype generate_secrets: bool
152+
:keyword pilot_secret_use_count_max: How much time can a secret be used.
153+
:paramtype pilot_secret_use_count_max: int
142154
"""
143155
super().__init__(**kwargs)
144156
self.pilot_stamps = pilot_stamps
145157
self.vo = vo
146158
self.grid_type = grid_type
147159
self.pilot_references = pilot_references
160+
self.generate_secrets = generate_secrets
161+
self.pilot_secret_use_count_max = pilot_secret_use_count_max
148162

149163

150164
class BodyPilotsAssociatePilotWithJobs(_serialization.Model):
@@ -180,6 +194,112 @@ def __init__(self, *, pilot_stamp: str, pilot_jobs_ids: List[int], **kwargs: Any
180194
self.pilot_jobs_ids = pilot_jobs_ids
181195

182196

197+
class BodyPilotsCreatePilotSecrets(_serialization.Model):
198+
"""Body_pilots_create_pilot_secrets.
199+
200+
All required parameters must be populated in order to send to server.
201+
202+
:ivar n: Number of secrets to create. Required.
203+
:vartype n: int
204+
:ivar expiration_minutes: Time in minutes before expiring. Required.
205+
:vartype expiration_minutes: int
206+
:ivar pilot_secret_use_count_max: Number of times that we can use a secret. Required.
207+
:vartype pilot_secret_use_count_max: int
208+
"""
209+
210+
_validation = {
211+
"n": {"required": True},
212+
"expiration_minutes": {"required": True},
213+
"pilot_secret_use_count_max": {"required": True},
214+
}
215+
216+
_attribute_map = {
217+
"n": {"key": "n", "type": "int"},
218+
"expiration_minutes": {"key": "expiration_minutes", "type": "int"},
219+
"pilot_secret_use_count_max": {"key": "pilot_secret_use_count_max", "type": "int"},
220+
}
221+
222+
def __init__(self, *, n: int, expiration_minutes: int, pilot_secret_use_count_max: int, **kwargs: Any) -> None:
223+
"""
224+
:keyword n: Number of secrets to create. Required.
225+
:paramtype n: int
226+
:keyword expiration_minutes: Time in minutes before expiring. Required.
227+
:paramtype expiration_minutes: int
228+
:keyword pilot_secret_use_count_max: Number of times that we can use a secret. Required.
229+
:paramtype pilot_secret_use_count_max: int
230+
"""
231+
super().__init__(**kwargs)
232+
self.n = n
233+
self.expiration_minutes = expiration_minutes
234+
self.pilot_secret_use_count_max = pilot_secret_use_count_max
235+
236+
237+
class BodyPilotsPilotLogin(_serialization.Model):
238+
"""Body_pilots_pilot_login.
239+
240+
All required parameters must be populated in order to send to server.
241+
242+
:ivar pilot_stamp: Stamp used by a pilot to login. Required.
243+
:vartype pilot_stamp: str
244+
:ivar pilot_secret: Pilot secret given by Dirac/DiracX. Required.
245+
:vartype pilot_secret: str
246+
"""
247+
248+
_validation = {
249+
"pilot_stamp": {"required": True},
250+
"pilot_secret": {"required": True},
251+
}
252+
253+
_attribute_map = {
254+
"pilot_stamp": {"key": "pilot_stamp", "type": "str"},
255+
"pilot_secret": {"key": "pilot_secret", "type": "str"},
256+
}
257+
258+
def __init__(self, *, pilot_stamp: str, pilot_secret: str, **kwargs: Any) -> None:
259+
"""
260+
:keyword pilot_stamp: Stamp used by a pilot to login. Required.
261+
:paramtype pilot_stamp: str
262+
:keyword pilot_secret: Pilot secret given by Dirac/DiracX. Required.
263+
:paramtype pilot_secret: str
264+
"""
265+
super().__init__(**kwargs)
266+
self.pilot_stamp = pilot_stamp
267+
self.pilot_secret = pilot_secret
268+
269+
270+
class BodyPilotsRefreshPilotTokens(_serialization.Model):
271+
"""Body_pilots_refresh_pilot_tokens.
272+
273+
All required parameters must be populated in order to send to server.
274+
275+
:ivar refresh_token: Refresh Token given at login by DiracX. Required.
276+
:vartype refresh_token: str
277+
:ivar pilot_stamp: Pilot stamp. Required.
278+
:vartype pilot_stamp: str
279+
"""
280+
281+
_validation = {
282+
"refresh_token": {"required": True},
283+
"pilot_stamp": {"required": True},
284+
}
285+
286+
_attribute_map = {
287+
"refresh_token": {"key": "refresh_token", "type": "str"},
288+
"pilot_stamp": {"key": "pilot_stamp", "type": "str"},
289+
}
290+
291+
def __init__(self, *, refresh_token: str, pilot_stamp: str, **kwargs: Any) -> None:
292+
"""
293+
:keyword refresh_token: Refresh Token given at login by DiracX. Required.
294+
:paramtype refresh_token: str
295+
:keyword pilot_stamp: Pilot stamp. Required.
296+
:paramtype pilot_stamp: str
297+
"""
298+
super().__init__(**kwargs)
299+
self.refresh_token = refresh_token
300+
self.pilot_stamp = pilot_stamp
301+
302+
183303
class BodyPilotsUpdatePilotFields(_serialization.Model):
184304
"""Body_pilots_update_pilot_fields.
185305
@@ -718,6 +838,46 @@ def __init__(
718838
self.code_challenge_methods_supported = code_challenge_methods_supported
719839

720840

841+
class PilotCredentialsInfo(_serialization.Model):
842+
"""PilotCredentialsInfo.
843+
844+
All required parameters must be populated in order to send to server.
845+
846+
:ivar pilot_secret: Pilot Secret. Required.
847+
:vartype pilot_secret: str
848+
:ivar pilot_secret_expires_in: Pilot Secret Expires In. Required.
849+
:vartype pilot_secret_expires_in: int
850+
:ivar pilot_stamp: Pilot Stamp. Required.
851+
:vartype pilot_stamp: str
852+
"""
853+
854+
_validation = {
855+
"pilot_secret": {"required": True},
856+
"pilot_secret_expires_in": {"required": True},
857+
"pilot_stamp": {"required": True},
858+
}
859+
860+
_attribute_map = {
861+
"pilot_secret": {"key": "pilot_secret", "type": "str"},
862+
"pilot_secret_expires_in": {"key": "pilot_secret_expires_in", "type": "int"},
863+
"pilot_stamp": {"key": "pilot_stamp", "type": "str"},
864+
}
865+
866+
def __init__(self, *, pilot_secret: str, pilot_secret_expires_in: int, pilot_stamp: str, **kwargs: Any) -> None:
867+
"""
868+
:keyword pilot_secret: Pilot Secret. Required.
869+
:paramtype pilot_secret: str
870+
:keyword pilot_secret_expires_in: Pilot Secret Expires In. Required.
871+
:paramtype pilot_secret_expires_in: int
872+
:keyword pilot_stamp: Pilot Stamp. Required.
873+
:paramtype pilot_stamp: str
874+
"""
875+
super().__init__(**kwargs)
876+
self.pilot_secret = pilot_secret
877+
self.pilot_secret_expires_in = pilot_secret_expires_in
878+
self.pilot_stamp = pilot_stamp
879+
880+
721881
class PilotFieldsMapping(_serialization.Model):
722882
"""All the fields that a user can modify on a Pilot (except PilotStamp).
723883
@@ -812,6 +972,118 @@ def __init__(
812972
self.current_job_id = current_job_id
813973

814974

975+
class PilotInfo(_serialization.Model):
976+
"""PilotInfo.
977+
978+
All required parameters must be populated in order to send to server.
979+
980+
:ivar pilot_stamp: Pilot Stamp. Required.
981+
:vartype pilot_stamp: str
982+
:ivar vo: Vo. Required.
983+
:vartype vo: str
984+
:ivar sub: Sub. Required.
985+
:vartype sub: str
986+
"""
987+
988+
_validation = {
989+
"pilot_stamp": {"required": True},
990+
"vo": {"required": True},
991+
"sub": {"required": True},
992+
}
993+
994+
_attribute_map = {
995+
"pilot_stamp": {"key": "pilot_stamp", "type": "str"},
996+
"vo": {"key": "vo", "type": "str"},
997+
"sub": {"key": "sub", "type": "str"},
998+
}
999+
1000+
def __init__(self, *, pilot_stamp: str, vo: str, sub: str, **kwargs: Any) -> None:
1001+
"""
1002+
:keyword pilot_stamp: Pilot Stamp. Required.
1003+
:paramtype pilot_stamp: str
1004+
:keyword vo: Vo. Required.
1005+
:paramtype vo: str
1006+
:keyword sub: Sub. Required.
1007+
:paramtype sub: str
1008+
"""
1009+
super().__init__(**kwargs)
1010+
self.pilot_stamp = pilot_stamp
1011+
self.vo = vo
1012+
self.sub = sub
1013+
1014+
1015+
class PilotSecretConstraints(_serialization.Model):
1016+
"""PilotSecretConstraints.
1017+
1018+
:ivar v_os: Vos.
1019+
:vartype v_os: list[str]
1020+
:ivar pilot_stamps: Pilotstamps.
1021+
:vartype pilot_stamps: list[str]
1022+
:ivar sites: Sites.
1023+
:vartype sites: list[str]
1024+
"""
1025+
1026+
_attribute_map = {
1027+
"v_os": {"key": "VOs", "type": "[str]"},
1028+
"pilot_stamps": {"key": "PilotStamps", "type": "[str]"},
1029+
"sites": {"key": "Sites", "type": "[str]"},
1030+
}
1031+
1032+
def __init__(
1033+
self,
1034+
*,
1035+
v_os: Optional[List[str]] = None,
1036+
pilot_stamps: Optional[List[str]] = None,
1037+
sites: Optional[List[str]] = None,
1038+
**kwargs: Any
1039+
) -> None:
1040+
"""
1041+
:keyword v_os: Vos.
1042+
:paramtype v_os: list[str]
1043+
:keyword pilot_stamps: Pilotstamps.
1044+
:paramtype pilot_stamps: list[str]
1045+
:keyword sites: Sites.
1046+
:paramtype sites: list[str]
1047+
"""
1048+
super().__init__(**kwargs)
1049+
self.v_os = v_os
1050+
self.pilot_stamps = pilot_stamps
1051+
self.sites = sites
1052+
1053+
1054+
class PilotSecretsInfo(_serialization.Model):
1055+
"""PilotSecretsInfo.
1056+
1057+
All required parameters must be populated in order to send to server.
1058+
1059+
:ivar pilot_secret: Pilot Secret. Required.
1060+
:vartype pilot_secret: str
1061+
:ivar pilot_secret_expires_in: Pilot Secret Expires In. Required.
1062+
:vartype pilot_secret_expires_in: int
1063+
"""
1064+
1065+
_validation = {
1066+
"pilot_secret": {"required": True},
1067+
"pilot_secret_expires_in": {"required": True},
1068+
}
1069+
1070+
_attribute_map = {
1071+
"pilot_secret": {"key": "pilot_secret", "type": "str"},
1072+
"pilot_secret_expires_in": {"key": "pilot_secret_expires_in", "type": "int"},
1073+
}
1074+
1075+
def __init__(self, *, pilot_secret: str, pilot_secret_expires_in: int, **kwargs: Any) -> None:
1076+
"""
1077+
:keyword pilot_secret: Pilot Secret. Required.
1078+
:paramtype pilot_secret: str
1079+
:keyword pilot_secret_expires_in: Pilot Secret Expires In. Required.
1080+
:paramtype pilot_secret_expires_in: int
1081+
"""
1082+
super().__init__(**kwargs)
1083+
self.pilot_secret = pilot_secret
1084+
self.pilot_secret_expires_in = pilot_secret_expires_in
1085+
1086+
8151087
class SandboxDownloadResponse(_serialization.Model):
8161088
"""SandboxDownloadResponse.
8171089

0 commit comments

Comments
 (0)