-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
312 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# pylint: disable=too-many-lines,too-many-statements | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
from io import IOBase | ||
|
@@ -245,22 +245,25 @@ def __init__(self, *args, **kwargs) -> None: | |
) | ||
|
||
@distributed_trace_async | ||
async def do_device_flow(self, *, user_code: str, **kwargs: Any) -> Any: | ||
"""Do Device Flow. | ||
async def initiate_device_flow( | ||
self, *, client_id: str, scope: str, **kwargs: Any | ||
) -> _models.InitiateDeviceFlowResponse: | ||
"""Initiate Device Flow. | ||
This is called as the verification URI for the device flow. | ||
It will redirect to the actual OpenID server (IAM, CheckIn) to | ||
perform a authorization code flow. | ||
Initiate the device flow against DIRAC authorization Server. | ||
Scope must have exactly up to one ``group`` (otherwise default) and | ||
one or more ``property`` scope. | ||
If no property, then get default one | ||
We set the user_code obtained from the device flow in a cookie | ||
to be able to map the authorization flow with the corresponding | ||
device flow. | ||
(note: it can't be put as parameter or in the URL). | ||
Offers the user to go with the browser to | ||
``auth/<vo>/device?user_code=XYZ``. | ||
:keyword user_code: Required. | ||
:paramtype user_code: str | ||
:return: any | ||
:rtype: any | ||
:keyword client_id: Required. | ||
:paramtype client_id: str | ||
:keyword scope: Required. | ||
:paramtype scope: str | ||
:return: InitiateDeviceFlowResponse | ||
:rtype: ~client.models.InitiateDeviceFlowResponse | ||
:raises ~azure.core.exceptions.HttpResponseError: | ||
""" | ||
error_map: MutableMapping[int, Type[HttpResponseError]] = { | ||
|
@@ -274,10 +277,11 @@ async def do_device_flow(self, *, user_code: str, **kwargs: Any) -> Any: | |
_headers = kwargs.pop("headers", {}) or {} | ||
_params = kwargs.pop("params", {}) or {} | ||
|
||
cls: ClsType[Any] = kwargs.pop("cls", None) | ||
cls: ClsType[_models.InitiateDeviceFlowResponse] = kwargs.pop("cls", None) | ||
|
||
_request = build_auth_do_device_flow_request( | ||
user_code=user_code, | ||
_request = build_auth_initiate_device_flow_request( | ||
client_id=client_id, | ||
scope=scope, | ||
headers=_headers, | ||
params=_params, | ||
) | ||
|
@@ -300,33 +304,32 @@ async def do_device_flow(self, *, user_code: str, **kwargs: Any) -> Any: | |
) | ||
raise HttpResponseError(response=response) | ||
|
||
deserialized = self._deserialize("object", pipeline_response) | ||
deserialized = self._deserialize( | ||
"InitiateDeviceFlowResponse", pipeline_response | ||
) | ||
|
||
if cls: | ||
return cls(pipeline_response, deserialized, {}) # type: ignore | ||
|
||
return deserialized # type: ignore | ||
|
||
@distributed_trace_async | ||
async def initiate_device_flow( | ||
self, *, client_id: str, scope: str, **kwargs: Any | ||
) -> _models.InitiateDeviceFlowResponse: | ||
"""Initiate Device Flow. | ||
async def do_device_flow(self, *, user_code: str, **kwargs: Any) -> Any: | ||
"""Do Device Flow. | ||
Initiate the device flow against DIRAC authorization Server. | ||
Scope must have exactly up to one ``group`` (otherwise default) and | ||
one or more ``property`` scope. | ||
If no property, then get default one | ||
This is called as the verification URI for the device flow. | ||
It will redirect to the actual OpenID server (IAM, CheckIn) to | ||
perform a authorization code flow. | ||
Offers the user to go with the browser to | ||
``auth/<vo>/device?user_code=XYZ``. | ||
We set the user_code obtained from the device flow in a cookie | ||
to be able to map the authorization flow with the corresponding | ||
device flow. | ||
(note: it can't be put as parameter or in the URL). | ||
:keyword client_id: Required. | ||
:paramtype client_id: str | ||
:keyword scope: Required. | ||
:paramtype scope: str | ||
:return: InitiateDeviceFlowResponse | ||
:rtype: ~client.models.InitiateDeviceFlowResponse | ||
:keyword user_code: Required. | ||
:paramtype user_code: str | ||
:return: any | ||
:rtype: any | ||
:raises ~azure.core.exceptions.HttpResponseError: | ||
""" | ||
error_map: MutableMapping[int, Type[HttpResponseError]] = { | ||
|
@@ -340,11 +343,10 @@ async def initiate_device_flow( | |
_headers = kwargs.pop("headers", {}) or {} | ||
_params = kwargs.pop("params", {}) or {} | ||
|
||
cls: ClsType[_models.InitiateDeviceFlowResponse] = kwargs.pop("cls", None) | ||
cls: ClsType[Any] = kwargs.pop("cls", None) | ||
|
||
_request = build_auth_initiate_device_flow_request( | ||
client_id=client_id, | ||
scope=scope, | ||
_request = build_auth_do_device_flow_request( | ||
user_code=user_code, | ||
headers=_headers, | ||
params=_params, | ||
) | ||
|
@@ -367,9 +369,7 @@ async def initiate_device_flow( | |
) | ||
raise HttpResponseError(response=response) | ||
|
||
deserialized = self._deserialize( | ||
"InitiateDeviceFlowResponse", pipeline_response | ||
) | ||
deserialized = self._deserialize("object", pipeline_response) | ||
|
||
if cls: | ||
return cls(pipeline_response, deserialized, {}) # type: ignore | ||
|
@@ -939,70 +939,6 @@ def __init__(self, *args, **kwargs) -> None: | |
input_args.pop(0) if input_args else kwargs.pop("deserializer") | ||
) | ||
|
||
@distributed_trace_async | ||
async def get_sandbox_file( | ||
self, *, pfn: str, **kwargs: Any | ||
) -> _models.SandboxDownloadResponse: | ||
"""Get Sandbox File. | ||
Get a presigned URL to download a sandbox file | ||
This route cannot use a redirect response most clients will also send the | ||
authorization header when following a redirect. This is not desirable as | ||
it would leak the authorization token to the storage backend. Additionally, | ||
most storage backends return an error when they receive an authorization | ||
header for a presigned URL. | ||
:keyword pfn: Required. | ||
:paramtype pfn: str | ||
:return: SandboxDownloadResponse | ||
:rtype: ~client.models.SandboxDownloadResponse | ||
:raises ~azure.core.exceptions.HttpResponseError: | ||
""" | ||
error_map: MutableMapping[int, Type[HttpResponseError]] = { | ||
401: ClientAuthenticationError, | ||
404: ResourceNotFoundError, | ||
409: ResourceExistsError, | ||
304: ResourceNotModifiedError, | ||
} | ||
error_map.update(kwargs.pop("error_map", {}) or {}) | ||
|
||
_headers = kwargs.pop("headers", {}) or {} | ||
_params = kwargs.pop("params", {}) or {} | ||
|
||
cls: ClsType[_models.SandboxDownloadResponse] = kwargs.pop("cls", None) | ||
|
||
_request = build_jobs_get_sandbox_file_request( | ||
pfn=pfn, | ||
headers=_headers, | ||
params=_params, | ||
) | ||
_request.url = self._client.format_url(_request.url) | ||
|
||
_stream = False | ||
pipeline_response: PipelineResponse = ( | ||
await self._client._pipeline.run( # pylint: disable=protected-access | ||
_request, stream=_stream, **kwargs | ||
) | ||
) | ||
|
||
response = pipeline_response.http_response | ||
|
||
if response.status_code not in [200]: | ||
if _stream: | ||
await response.read() # Load the body in memory and close the socket | ||
map_error( | ||
status_code=response.status_code, response=response, error_map=error_map | ||
) | ||
raise HttpResponseError(response=response) | ||
|
||
deserialized = self._deserialize("SandboxDownloadResponse", pipeline_response) | ||
|
||
if cls: | ||
return cls(pipeline_response, deserialized, {}) # type: ignore | ||
|
||
return deserialized # type: ignore | ||
|
||
@overload | ||
async def initiate_sandbox_upload( | ||
self, | ||
|
@@ -1132,6 +1068,70 @@ async def initiate_sandbox_upload( | |
|
||
return deserialized # type: ignore | ||
|
||
@distributed_trace_async | ||
async def get_sandbox_file( | ||
self, *, pfn: str, **kwargs: Any | ||
) -> _models.SandboxDownloadResponse: | ||
"""Get Sandbox File. | ||
Get a presigned URL to download a sandbox file | ||
This route cannot use a redirect response most clients will also send the | ||
authorization header when following a redirect. This is not desirable as | ||
it would leak the authorization token to the storage backend. Additionally, | ||
most storage backends return an error when they receive an authorization | ||
header for a presigned URL. | ||
:keyword pfn: Required. | ||
:paramtype pfn: str | ||
:return: SandboxDownloadResponse | ||
:rtype: ~client.models.SandboxDownloadResponse | ||
:raises ~azure.core.exceptions.HttpResponseError: | ||
""" | ||
error_map: MutableMapping[int, Type[HttpResponseError]] = { | ||
401: ClientAuthenticationError, | ||
404: ResourceNotFoundError, | ||
409: ResourceExistsError, | ||
304: ResourceNotModifiedError, | ||
} | ||
error_map.update(kwargs.pop("error_map", {}) or {}) | ||
|
||
_headers = kwargs.pop("headers", {}) or {} | ||
_params = kwargs.pop("params", {}) or {} | ||
|
||
cls: ClsType[_models.SandboxDownloadResponse] = kwargs.pop("cls", None) | ||
|
||
_request = build_jobs_get_sandbox_file_request( | ||
pfn=pfn, | ||
headers=_headers, | ||
params=_params, | ||
) | ||
_request.url = self._client.format_url(_request.url) | ||
|
||
_stream = False | ||
pipeline_response: PipelineResponse = ( | ||
await self._client._pipeline.run( # pylint: disable=protected-access | ||
_request, stream=_stream, **kwargs | ||
) | ||
) | ||
|
||
response = pipeline_response.http_response | ||
|
||
if response.status_code not in [200]: | ||
if _stream: | ||
await response.read() # Load the body in memory and close the socket | ||
map_error( | ||
status_code=response.status_code, response=response, error_map=error_map | ||
) | ||
raise HttpResponseError(response=response) | ||
|
||
deserialized = self._deserialize("SandboxDownloadResponse", pipeline_response) | ||
|
||
if cls: | ||
return cls(pipeline_response, deserialized, {}) # type: ignore | ||
|
||
return deserialized # type: ignore | ||
|
||
@distributed_trace_async | ||
async def unassign_bulk_jobs_sandboxes( | ||
self, *, jobs_ids: List[int], **kwargs: Any | ||
|
@@ -1369,7 +1369,7 @@ async def get_job_sandbox( | |
async def assign_sandbox_to_job(self, job_id: int, body: str, **kwargs: Any) -> Any: | ||
"""Assign Sandbox To Job. | ||
Mapp the pfn as output sandbox to job. | ||
Map the pfn as output sandbox to job. | ||
:param job_id: Required. | ||
:type job_id: int | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].17) | ||
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].19) | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
|
Oops, something went wrong.