Skip to content

Commit 135235f

Browse files
feat: Using pilot user, model for pilot creds, and documentation
1 parent 0e0a117 commit 135235f

File tree

15 files changed

+1124
-379
lines changed

15 files changed

+1124
-379
lines changed

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

Lines changed: 142 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -935,18 +935,56 @@ async def complete_authorization_flow(
935935

936936
return deserialized # type: ignore
937937

938+
@overload
939+
async def pilot_login(
940+
self,
941+
body: _models.BodyAuthPilotLogin,
942+
*,
943+
content_type: str = "application/json",
944+
**kwargs: Any,
945+
) -> _models.TokenResponse:
946+
"""Pilot Login.
947+
948+
Endpoint without policy, the pilot uses only its secret.
949+
950+
:param body: Required.
951+
:type body: ~_generated.models.BodyAuthPilotLogin
952+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
953+
Default value is "application/json".
954+
:paramtype content_type: str
955+
:return: TokenResponse
956+
:rtype: ~_generated.models.TokenResponse
957+
:raises ~azure.core.exceptions.HttpResponseError:
958+
"""
959+
960+
@overload
961+
async def pilot_login(
962+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
963+
) -> _models.TokenResponse:
964+
"""Pilot Login.
965+
966+
Endpoint without policy, the pilot uses only its secret.
967+
968+
:param body: Required.
969+
:type body: IO[bytes]
970+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
971+
Default value is "application/json".
972+
:paramtype content_type: str
973+
:return: TokenResponse
974+
:rtype: ~_generated.models.TokenResponse
975+
:raises ~azure.core.exceptions.HttpResponseError:
976+
"""
977+
938978
@distributed_trace_async
939979
async def pilot_login(
940-
self, *, pilot_job_reference: str, pilot_secret: str, **kwargs: Any
980+
self, body: Union[_models.BodyAuthPilotLogin, IO[bytes]], **kwargs: Any
941981
) -> _models.TokenResponse:
942982
"""Pilot Login.
943983
944984
Endpoint without policy, the pilot uses only its secret.
945985
946-
:keyword pilot_job_reference: Required.
947-
:paramtype pilot_job_reference: str
948-
:keyword pilot_secret: Required.
949-
:paramtype pilot_secret: str
986+
:param body: Is either a BodyAuthPilotLogin type or a IO[bytes] type. Required.
987+
:type body: ~_generated.models.BodyAuthPilotLogin or IO[bytes]
950988
:return: TokenResponse
951989
:rtype: ~_generated.models.TokenResponse
952990
:raises ~azure.core.exceptions.HttpResponseError:
@@ -959,14 +997,26 @@ async def pilot_login(
959997
}
960998
error_map.update(kwargs.pop("error_map", {}) or {})
961999

962-
_headers = kwargs.pop("headers", {}) or {}
1000+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
9631001
_params = kwargs.pop("params", {}) or {}
9641002

1003+
content_type: Optional[str] = kwargs.pop(
1004+
"content_type", _headers.pop("Content-Type", None)
1005+
)
9651006
cls: ClsType[_models.TokenResponse] = kwargs.pop("cls", None)
9661007

1008+
content_type = content_type or "application/json"
1009+
_json = None
1010+
_content = None
1011+
if isinstance(body, (IOBase, bytes)):
1012+
_content = body
1013+
else:
1014+
_json = self._serialize.body(body, "BodyAuthPilotLogin")
1015+
9671016
_request = build_auth_pilot_login_request(
968-
pilot_job_reference=pilot_job_reference,
969-
pilot_secret=pilot_secret,
1017+
content_type=content_type,
1018+
json=_json,
1019+
content=_content,
9701020
headers=_headers,
9711021
params=_params,
9721022
)
@@ -996,16 +1046,56 @@ async def pilot_login(
9961046

9971047
return deserialized # type: ignore
9981048

1049+
@overload
1050+
async def refresh_pilot_tokens(
1051+
self,
1052+
body: _models.BodyAuthRefreshPilotTokens,
1053+
*,
1054+
content_type: str = "application/json",
1055+
**kwargs: Any,
1056+
) -> _models.TokenResponse:
1057+
"""Refresh Pilot Tokens.
1058+
1059+
Endpoint where a pilot can exchange a refresh token for a token.
1060+
1061+
:param body: Required.
1062+
:type body: ~_generated.models.BodyAuthRefreshPilotTokens
1063+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
1064+
Default value is "application/json".
1065+
:paramtype content_type: str
1066+
:return: TokenResponse
1067+
:rtype: ~_generated.models.TokenResponse
1068+
:raises ~azure.core.exceptions.HttpResponseError:
1069+
"""
1070+
1071+
@overload
1072+
async def refresh_pilot_tokens(
1073+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1074+
) -> _models.TokenResponse:
1075+
"""Refresh Pilot Tokens.
1076+
1077+
Endpoint where a pilot can exchange a refresh token for a token.
1078+
1079+
:param body: Required.
1080+
:type body: IO[bytes]
1081+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1082+
Default value is "application/json".
1083+
:paramtype content_type: str
1084+
:return: TokenResponse
1085+
:rtype: ~_generated.models.TokenResponse
1086+
:raises ~azure.core.exceptions.HttpResponseError:
1087+
"""
1088+
9991089
@distributed_trace_async
10001090
async def refresh_pilot_tokens(
1001-
self, *, refresh_token: str, **kwargs: Any
1091+
self, body: Union[_models.BodyAuthRefreshPilotTokens, IO[bytes]], **kwargs: Any
10021092
) -> _models.TokenResponse:
10031093
"""Refresh Pilot Tokens.
10041094
10051095
Endpoint where a pilot can exchange a refresh token for a token.
10061096
1007-
:keyword refresh_token: Required.
1008-
:paramtype refresh_token: str
1097+
:param body: Is either a BodyAuthRefreshPilotTokens type or a IO[bytes] type. Required.
1098+
:type body: ~_generated.models.BodyAuthRefreshPilotTokens or IO[bytes]
10091099
:return: TokenResponse
10101100
:rtype: ~_generated.models.TokenResponse
10111101
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1018,13 +1108,26 @@ async def refresh_pilot_tokens(
10181108
}
10191109
error_map.update(kwargs.pop("error_map", {}) or {})
10201110

1021-
_headers = kwargs.pop("headers", {}) or {}
1111+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
10221112
_params = kwargs.pop("params", {}) or {}
10231113

1114+
content_type: Optional[str] = kwargs.pop(
1115+
"content_type", _headers.pop("Content-Type", None)
1116+
)
10241117
cls: ClsType[_models.TokenResponse] = kwargs.pop("cls", None)
10251118

1119+
content_type = content_type or "application/json"
1120+
_json = None
1121+
_content = None
1122+
if isinstance(body, (IOBase, bytes)):
1123+
_content = body
1124+
else:
1125+
_json = self._serialize.body(body, "BodyAuthRefreshPilotTokens")
1126+
10261127
_request = build_auth_refresh_pilot_tokens_request(
1027-
refresh_token=refresh_token,
1128+
content_type=content_type,
1129+
json=_json,
1130+
content=_content,
10281131
headers=_headers,
10291132
params=_params,
10301133
)
@@ -1059,78 +1162,64 @@ async def register_new_pilots_to_db(
10591162
self,
10601163
body: _models.BodyAuthRegisterNewPilotsToDb,
10611164
*,
1062-
vo: str,
1063-
grid_type: str = "Dirac",
10641165
content_type: str = "application/json",
10651166
**kwargs: Any,
1066-
) -> Any:
1167+
) -> _models.PilotCredentialsResponse:
10671168
"""Register New Pilots To Db.
10681169
1069-
Endpoint where a you can create pilots with their credentials.
1170+
Endpoint where a you can create pilots with their references.
1171+
It will return the pilot secrets as well as an expiration date.
1172+
1173+
If a pilot reference already exists, it will block the insertion.
10701174
10711175
:param body: Required.
10721176
:type body: ~_generated.models.BodyAuthRegisterNewPilotsToDb
1073-
:keyword vo: Required.
1074-
:paramtype vo: str
1075-
:keyword grid_type: Default value is "Dirac".
1076-
:paramtype grid_type: str
10771177
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
10781178
Default value is "application/json".
10791179
:paramtype content_type: str
1080-
:return: any
1081-
:rtype: any
1180+
:return: PilotCredentialsResponse
1181+
:rtype: ~_generated.models.PilotCredentialsResponse
10821182
:raises ~azure.core.exceptions.HttpResponseError:
10831183
"""
10841184

10851185
@overload
10861186
async def register_new_pilots_to_db(
1087-
self,
1088-
body: IO[bytes],
1089-
*,
1090-
vo: str,
1091-
grid_type: str = "Dirac",
1092-
content_type: str = "application/json",
1093-
**kwargs: Any,
1094-
) -> Any:
1187+
self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1188+
) -> _models.PilotCredentialsResponse:
10951189
"""Register New Pilots To Db.
10961190
1097-
Endpoint where a you can create pilots with their credentials.
1191+
Endpoint where a you can create pilots with their references.
1192+
It will return the pilot secrets as well as an expiration date.
1193+
1194+
If a pilot reference already exists, it will block the insertion.
10981195
10991196
:param body: Required.
11001197
:type body: IO[bytes]
1101-
:keyword vo: Required.
1102-
:paramtype vo: str
1103-
:keyword grid_type: Default value is "Dirac".
1104-
:paramtype grid_type: str
11051198
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
11061199
Default value is "application/json".
11071200
:paramtype content_type: str
1108-
:return: any
1109-
:rtype: any
1201+
:return: PilotCredentialsResponse
1202+
:rtype: ~_generated.models.PilotCredentialsResponse
11101203
:raises ~azure.core.exceptions.HttpResponseError:
11111204
"""
11121205

11131206
@distributed_trace_async
11141207
async def register_new_pilots_to_db(
11151208
self,
11161209
body: Union[_models.BodyAuthRegisterNewPilotsToDb, IO[bytes]],
1117-
*,
1118-
vo: str,
1119-
grid_type: str = "Dirac",
11201210
**kwargs: Any,
1121-
) -> Any:
1211+
) -> _models.PilotCredentialsResponse:
11221212
"""Register New Pilots To Db.
11231213
1124-
Endpoint where a you can create pilots with their credentials.
1214+
Endpoint where a you can create pilots with their references.
1215+
It will return the pilot secrets as well as an expiration date.
1216+
1217+
If a pilot reference already exists, it will block the insertion.
11251218
11261219
:param body: Is either a BodyAuthRegisterNewPilotsToDb type or a IO[bytes] type. Required.
11271220
:type body: ~_generated.models.BodyAuthRegisterNewPilotsToDb or IO[bytes]
1128-
:keyword vo: Required.
1129-
:paramtype vo: str
1130-
:keyword grid_type: Default value is "Dirac".
1131-
:paramtype grid_type: str
1132-
:return: any
1133-
:rtype: any
1221+
:return: PilotCredentialsResponse
1222+
:rtype: ~_generated.models.PilotCredentialsResponse
11341223
:raises ~azure.core.exceptions.HttpResponseError:
11351224
"""
11361225
error_map: MutableMapping = {
@@ -1147,7 +1236,7 @@ async def register_new_pilots_to_db(
11471236
content_type: Optional[str] = kwargs.pop(
11481237
"content_type", _headers.pop("Content-Type", None)
11491238
)
1150-
cls: ClsType[Any] = kwargs.pop("cls", None)
1239+
cls: ClsType[_models.PilotCredentialsResponse] = kwargs.pop("cls", None)
11511240

11521241
content_type = content_type or "application/json"
11531242
_json = None
@@ -1158,8 +1247,6 @@ async def register_new_pilots_to_db(
11581247
_json = self._serialize.body(body, "BodyAuthRegisterNewPilotsToDb")
11591248

11601249
_request = build_auth_register_new_pilots_to_db_request(
1161-
vo=vo,
1162-
grid_type=grid_type,
11631250
content_type=content_type,
11641251
json=_json,
11651252
content=_content,
@@ -1183,7 +1270,9 @@ async def register_new_pilots_to_db(
11831270
)
11841271
raise HttpResponseError(response=response)
11851272

1186-
deserialized = self._deserialize("object", pipeline_response.http_response)
1273+
deserialized = self._deserialize(
1274+
"PilotCredentialsResponse", pipeline_response.http_response
1275+
)
11871276

11881277
if cls:
11891278
return cls(pipeline_response, deserialized, {}) # type: ignore

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from ._models import ( # type: ignore
1515
BodyAuthGetOidcToken,
1616
BodyAuthGetOidcTokenGrantType,
17+
BodyAuthPilotLogin,
18+
BodyAuthRefreshPilotTokens,
1719
BodyAuthRegisterNewPilotsToDb,
1820
GroupInfo,
1921
HTTPValidationError,
@@ -28,6 +30,8 @@
2830
JobSummaryParamsSearchItem,
2931
Metadata,
3032
OpenIDConfiguration,
33+
PilotCredentialsInfo,
34+
PilotCredentialsResponse,
3135
SandboxDownloadResponse,
3236
SandboxInfo,
3337
SandboxUploadResponse,
@@ -62,6 +66,8 @@
6266
__all__ = [
6367
"BodyAuthGetOidcToken",
6468
"BodyAuthGetOidcTokenGrantType",
69+
"BodyAuthPilotLogin",
70+
"BodyAuthRefreshPilotTokens",
6571
"BodyAuthRegisterNewPilotsToDb",
6672
"GroupInfo",
6773
"HTTPValidationError",
@@ -76,6 +82,8 @@
7682
"JobSummaryParamsSearchItem",
7783
"Metadata",
7884
"OpenIDConfiguration",
85+
"PilotCredentialsInfo",
86+
"PilotCredentialsResponse",
7987
"SandboxDownloadResponse",
8088
"SandboxInfo",
8189
"SandboxUploadResponse",

0 commit comments

Comments
 (0)