wallaroo.wallaroo_ml_ops_api_client.api.model.models_upload API documentation

# wallaroo.wallaroo_ml_ops_api_client.api.model.models_upload

View Source

      1from typing import Any, Dict, Optional, Union
      2
      3import httpx
      4
      5from ...client import Client
      6from ...models.models_upload_multipart_data import ModelsUploadMultipartData
      7from ...models.models_upload_response_200 import ModelsUploadResponse200
      8from ...models.models_upload_response_400 import ModelsUploadResponse400
      9from ...models.models_upload_response_401 import ModelsUploadResponse401
     10from ...models.models_upload_response_500 import ModelsUploadResponse500
     11from ...types import Response
     12
     13
     14def _get_kwargs(
     15    *,
     16    client: Client,
     17    multipart_data: ModelsUploadMultipartData,
     18
     19) -> Dict[str, Any]:
     20    url = "{}/v1/api/models/upload".format(
     21        client.base_url)
     22
     23    headers: Dict[str, str] = client.get_headers()
     24    cookies: Dict[str, Any] = client.get_cookies()
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34    multipart_multipart_data = multipart_data.to_multipart()
     35
     36
     37
     38
     39    return {
     40	    "method": "post",
     41        "url": url,
     42        "headers": headers,
     43        "cookies": cookies,
     44        "timeout": client.get_timeout(),
     45        "files": multipart_multipart_data,
     46    }
     47
     48
     49def _parse_response(*, response: httpx.Response) -> Optional[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
     50    if response.status_code == 500:
     51        response_500 = ModelsUploadResponse500.from_dict(response.json())
     52
     53
     54
     55        return response_500
     56    if response.status_code == 400:
     57        response_400 = ModelsUploadResponse400.from_dict(response.json())
     58
     59
     60
     61        return response_400
     62    if response.status_code == 401:
     63        response_401 = ModelsUploadResponse401.from_dict(response.json())
     64
     65
     66
     67        return response_401
     68    if response.status_code == 200:
     69        response_200 = ModelsUploadResponse200.from_dict(response.json())
     70
     71
     72
     73        return response_200
     74    return None
     75
     76
     77def _build_response(*, response: httpx.Response) -> Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
     78    return Response(
     79        status_code=response.status_code,
     80        content=response.content,
     81        headers=response.headers,
     82        parsed=_parse_response(response=response),
     83    )
     84
     85
     86def sync_detailed(
     87    *,
     88    client: Client,
     89    multipart_data: ModelsUploadMultipartData,
     90
     91) -> Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
     92    """Uploads a model to storage
     93
     94     Uploads a model to storage.
     95
     96    Args:
     97        multipart_data (ModelsUploadMultipartData):  Model upload request.
     98
     99    Returns:
    100        Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]
    101    """
    102
    103
    104    kwargs = _get_kwargs(
    105        client=client,
    106multipart_data=multipart_data,
    107
    108    )
    109
    110    response = httpx.request(
    111        verify=client.verify_ssl,
    112        **kwargs,
    113    )
    114
    115    return _build_response(response=response)
    116
    117def sync(
    118    *,
    119    client: Client,
    120    multipart_data: ModelsUploadMultipartData,
    121
    122) -> Optional[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
    123    """Uploads a model to storage
    124
    125     Uploads a model to storage.
    126
    127    Args:
    128        multipart_data (ModelsUploadMultipartData):  Model upload request.
    129
    130    Returns:
    131        Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]
    132    """
    133
    134
    135    return sync_detailed(
    136        client=client,
    137multipart_data=multipart_data,
    138
    139    ).parsed
    140
    141async def asyncio_detailed(
    142    *,
    143    client: Client,
    144    multipart_data: ModelsUploadMultipartData,
    145
    146) -> Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
    147    """Uploads a model to storage
    148
    149     Uploads a model to storage.
    150
    151    Args:
    152        multipart_data (ModelsUploadMultipartData):  Model upload request.
    153
    154    Returns:
    155        Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]
    156    """
    157
    158
    159    kwargs = _get_kwargs(
    160        client=client,
    161multipart_data=multipart_data,
    162
    163    )
    164
    165    async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
    166        response = await _client.request(
    167            **kwargs
    168        )
    169
    170    return _build_response(response=response)
    171
    172async def asyncio(
    173    *,
    174    client: Client,
    175    multipart_data: ModelsUploadMultipartData,
    176
    177) -> Optional[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
    178    """Uploads a model to storage
    179
    180     Uploads a model to storage.
    181
    182    Args:
    183        multipart_data (ModelsUploadMultipartData):  Model upload request.
    184
    185    Returns:
    186        Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]
    187    """
    188
    189
    190    return (await asyncio_detailed(
    191        client=client,
    192multipart_data=multipart_data,
    193
    194    )).parsed

def sync_detailed( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, multipart_data: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_multipart_data.ModelsUploadMultipartData) -> wallaroo.wallaroo_ml_ops_api_client.types.Response[typing.Union[wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_200.ModelsUploadResponse200, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_400.ModelsUploadResponse400, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_401.ModelsUploadResponse401, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_500.ModelsUploadResponse500]]: View Source

     87def sync_detailed(
     88    *,
     89    client: Client,
     90    multipart_data: ModelsUploadMultipartData,
     91
     92) -> Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
     93    """Uploads a model to storage
     94
     95     Uploads a model to storage.
     96
     97    Args:
     98        multipart_data (ModelsUploadMultipartData):  Model upload request.
     99
    100    Returns:
    101        Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]
    102    """
    103
    104
    105    kwargs = _get_kwargs(
    106        client=client,
    107multipart_data=multipart_data,
    108
    109    )
    110
    111    response = httpx.request(
    112        verify=client.verify_ssl,
    113        **kwargs,
    114    )
    115
    116    return _build_response(response=response)

Uploads a model to storage

Uploads a model to storage.

Args: multipart_data (ModelsUploadMultipartData): Model upload request.

Returns: Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]

def sync( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, multipart_data: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_multipart_data.ModelsUploadMultipartData) -> Union[wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_200.ModelsUploadResponse200, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_400.ModelsUploadResponse400, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_401.ModelsUploadResponse401, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_500.ModelsUploadResponse500, NoneType]: View Source

    118def sync(
    119    *,
    120    client: Client,
    121    multipart_data: ModelsUploadMultipartData,
    122
    123) -> Optional[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
    124    """Uploads a model to storage
    125
    126     Uploads a model to storage.
    127
    128    Args:
    129        multipart_data (ModelsUploadMultipartData):  Model upload request.
    130
    131    Returns:
    132        Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]
    133    """
    134
    135
    136    return sync_detailed(
    137        client=client,
    138multipart_data=multipart_data,
    139
    140    ).parsed

Uploads a model to storage

Uploads a model to storage.

Args: multipart_data (ModelsUploadMultipartData): Model upload request.

Returns: Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]

async def asyncio_detailed( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, multipart_data: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_multipart_data.ModelsUploadMultipartData) -> wallaroo.wallaroo_ml_ops_api_client.types.Response[typing.Union[wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_200.ModelsUploadResponse200, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_400.ModelsUploadResponse400, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_401.ModelsUploadResponse401, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_500.ModelsUploadResponse500]]: View Source

    142async def asyncio_detailed(
    143    *,
    144    client: Client,
    145    multipart_data: ModelsUploadMultipartData,
    146
    147) -> Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
    148    """Uploads a model to storage
    149
    150     Uploads a model to storage.
    151
    152    Args:
    153        multipart_data (ModelsUploadMultipartData):  Model upload request.
    154
    155    Returns:
    156        Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]
    157    """
    158
    159
    160    kwargs = _get_kwargs(
    161        client=client,
    162multipart_data=multipart_data,
    163
    164    )
    165
    166    async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
    167        response = await _client.request(
    168            **kwargs
    169        )
    170
    171    return _build_response(response=response)

Uploads a model to storage

Uploads a model to storage.

Args: multipart_data (ModelsUploadMultipartData): Model upload request.

Returns: Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]

async def asyncio( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, multipart_data: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_multipart_data.ModelsUploadMultipartData) -> Union[wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_200.ModelsUploadResponse200, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_400.ModelsUploadResponse400, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_401.ModelsUploadResponse401, wallaroo.wallaroo_ml_ops_api_client.models.models_upload_response_500.ModelsUploadResponse500, NoneType]: View Source

    173async def asyncio(
    174    *,
    175    client: Client,
    176    multipart_data: ModelsUploadMultipartData,
    177
    178) -> Optional[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]:
    179    """Uploads a model to storage
    180
    181     Uploads a model to storage.
    182
    183    Args:
    184        multipart_data (ModelsUploadMultipartData):  Model upload request.
    185
    186    Returns:
    187        Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]
    188    """
    189
    190
    191    return (await asyncio_detailed(
    192        client=client,
    193multipart_data=multipart_data,
    194
    195    )).parsed

Uploads a model to storage

Uploads a model to storage.

Args: multipart_data (ModelsUploadMultipartData): Model upload request.

Returns: Response[Union[ModelsUploadResponse200, ModelsUploadResponse400, ModelsUploadResponse401, ModelsUploadResponse500]]