wallaroo.wallaroo_ml_ops_api_client.api.workspace.workspaces_create API documentation

# wallaroo.wallaroo_ml_ops_api_client.api.workspace.workspaces_create

View Source

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

def sync_detailed( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, json_body: wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_json_body.WorkspacesCreateJsonBody) -> wallaroo.wallaroo_ml_ops_api_client.types.Response[typing.Union[wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_200.WorkspacesCreateResponse200, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_400.WorkspacesCreateResponse400, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_401.WorkspacesCreateResponse401, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_500.WorkspacesCreateResponse500]]: View Source

     90def sync_detailed(
     91    *,
     92    client: Client,
     93    json_body: WorkspacesCreateJsonBody,
     94
     95) -> Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]:
     96    """Create a workspace
     97
     98     Create a new Workspace
     99
    100    Args:
    101        json_body (WorkspacesCreateJsonBody):  Request to create a new Workspace
    102
    103    Returns:
    104        Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]
    105    """
    106
    107
    108    kwargs = _get_kwargs(
    109        client=client,
    110json_body=json_body,
    111
    112    )
    113
    114    response = httpx.request(
    115        verify=client.verify_ssl,
    116        **kwargs,
    117    )
    118
    119    return _build_response(response=response)

Create a workspace

Create a new Workspace

Args: json_body (WorkspacesCreateJsonBody): Request to create a new Workspace

Returns: Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]

def sync( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, json_body: wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_json_body.WorkspacesCreateJsonBody) -> Union[wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_200.WorkspacesCreateResponse200, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_400.WorkspacesCreateResponse400, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_401.WorkspacesCreateResponse401, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_500.WorkspacesCreateResponse500, NoneType]: View Source

    121def sync(
    122    *,
    123    client: Client,
    124    json_body: WorkspacesCreateJsonBody,
    125
    126) -> Optional[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]:
    127    """Create a workspace
    128
    129     Create a new Workspace
    130
    131    Args:
    132        json_body (WorkspacesCreateJsonBody):  Request to create a new Workspace
    133
    134    Returns:
    135        Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]
    136    """
    137
    138
    139    return sync_detailed(
    140        client=client,
    141json_body=json_body,
    142
    143    ).parsed

Create a workspace

Create a new Workspace

Args: json_body (WorkspacesCreateJsonBody): Request to create a new Workspace

Returns: Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]

async def asyncio_detailed( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, json_body: wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_json_body.WorkspacesCreateJsonBody) -> wallaroo.wallaroo_ml_ops_api_client.types.Response[typing.Union[wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_200.WorkspacesCreateResponse200, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_400.WorkspacesCreateResponse400, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_401.WorkspacesCreateResponse401, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_500.WorkspacesCreateResponse500]]: View Source

    145async def asyncio_detailed(
    146    *,
    147    client: Client,
    148    json_body: WorkspacesCreateJsonBody,
    149
    150) -> Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]:
    151    """Create a workspace
    152
    153     Create a new Workspace
    154
    155    Args:
    156        json_body (WorkspacesCreateJsonBody):  Request to create a new Workspace
    157
    158    Returns:
    159        Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]
    160    """
    161
    162
    163    kwargs = _get_kwargs(
    164        client=client,
    165json_body=json_body,
    166
    167    )
    168
    169    async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
    170        response = await _client.request(
    171            **kwargs
    172        )
    173
    174    return _build_response(response=response)

Create a workspace

Create a new Workspace

Args: json_body (WorkspacesCreateJsonBody): Request to create a new Workspace

Returns: Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]

async def asyncio( *, client: wallaroo.wallaroo_ml_ops_api_client.client.Client, json_body: wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_json_body.WorkspacesCreateJsonBody) -> Union[wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_200.WorkspacesCreateResponse200, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_400.WorkspacesCreateResponse400, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_401.WorkspacesCreateResponse401, wallaroo.wallaroo_ml_ops_api_client.models.workspaces_create_response_500.WorkspacesCreateResponse500, NoneType]: View Source

    176async def asyncio(
    177    *,
    178    client: Client,
    179    json_body: WorkspacesCreateJsonBody,
    180
    181) -> Optional[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]:
    182    """Create a workspace
    183
    184     Create a new Workspace
    185
    186    Args:
    187        json_body (WorkspacesCreateJsonBody):  Request to create a new Workspace
    188
    189    Returns:
    190        Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]
    191    """
    192
    193
    194    return (await asyncio_detailed(
    195        client=client,
    196json_body=json_body,
    197
    198    )).parsed

Create a workspace

Create a new Workspace

Args: json_body (WorkspacesCreateJsonBody): Request to create a new Workspace

Returns: Response[Union[WorkspacesCreateResponse200, WorkspacesCreateResponse400, WorkspacesCreateResponse401, WorkspacesCreateResponse500]]