re-uploading work
This commit is contained in:
1
tests/generated_client/api/secrets/__init__.py
Normal file
1
tests/generated_client/api/secrets/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
""" Contains endpoint functions for accessing the API """
|
||||
187
tests/generated_client/api/secrets/create_key.py
Normal file
187
tests/generated_client/api/secrets/create_key.py
Normal file
@@ -0,0 +1,187 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.create_key_request import CreateKeyRequest
|
||||
from ...models.create_key_response_201 import CreateKeyResponse201
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: CreateKeyRequest,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v1/keys",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | CreateKeyResponse201 | None:
|
||||
if response.status_code == 201:
|
||||
response_201 = CreateKeyResponse201.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 400:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
|
||||
if response.status_code == 409:
|
||||
response_409 = cast(Any, None)
|
||||
return response_409
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | CreateKeyResponse201]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreateKeyRequest,
|
||||
|
||||
) -> Response[Any | CreateKeyResponse201]:
|
||||
""" Create a new key/secret
|
||||
|
||||
Args:
|
||||
body (CreateKeyRequest): Request to create a new key/secret
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | CreateKeyResponse201]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreateKeyRequest,
|
||||
|
||||
) -> Any | CreateKeyResponse201 | None:
|
||||
""" Create a new key/secret
|
||||
|
||||
Args:
|
||||
body (CreateKeyRequest): Request to create a new key/secret
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | CreateKeyResponse201
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreateKeyRequest,
|
||||
|
||||
) -> Response[Any | CreateKeyResponse201]:
|
||||
""" Create a new key/secret
|
||||
|
||||
Args:
|
||||
body (CreateKeyRequest): Request to create a new key/secret
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | CreateKeyResponse201]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreateKeyRequest,
|
||||
|
||||
) -> Any | CreateKeyResponse201 | None:
|
||||
""" Create a new key/secret
|
||||
|
||||
Args:
|
||||
body (CreateKeyRequest): Request to create a new key/secret
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | CreateKeyResponse201
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
)).parsed
|
||||
175
tests/generated_client/api/secrets/delete_key.py
Normal file
175
tests/generated_client/api/secrets/delete_key.py
Normal file
@@ -0,0 +1,175 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.success_response import SuccessResponse
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": "/api/v1/keys/{ref}".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | SuccessResponse | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = SuccessResponse.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | SuccessResponse]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | SuccessResponse]:
|
||||
""" Delete a key/secret
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | SuccessResponse]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | SuccessResponse | None:
|
||||
""" Delete a key/secret
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | SuccessResponse
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | SuccessResponse]:
|
||||
""" Delete a key/secret
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | SuccessResponse]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | SuccessResponse | None:
|
||||
""" Delete a key/secret
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | SuccessResponse
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
175
tests/generated_client/api/secrets/get_key.py
Normal file
175
tests/generated_client/api/secrets/get_key.py
Normal file
@@ -0,0 +1,175 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.get_key_response_200 import GetKeyResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/v1/keys/{ref}".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | GetKeyResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = GetKeyResponse200.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | GetKeyResponse200]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | GetKeyResponse200]:
|
||||
""" Get a single key by reference (includes decrypted value)
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | GetKeyResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | GetKeyResponse200 | None:
|
||||
""" Get a single key by reference (includes decrypted value)
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | GetKeyResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | GetKeyResponse200]:
|
||||
""" Get a single key by reference (includes decrypted value)
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | GetKeyResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | GetKeyResponse200 | None:
|
||||
""" Get a single key by reference (includes decrypted value)
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | GetKeyResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
238
tests/generated_client/api/secrets/list_keys.py
Normal file
238
tests/generated_client/api/secrets/list_keys.py
Normal file
@@ -0,0 +1,238 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.owner_type import OwnerType
|
||||
from ...models.paginated_response_key_summary import PaginatedResponseKeySummary
|
||||
from ...types import UNSET, Unset
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
owner_type: None | OwnerType | Unset = UNSET,
|
||||
owner: None | str | Unset = UNSET,
|
||||
page: int | Unset = UNSET,
|
||||
per_page: int | Unset = UNSET,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
json_owner_type: None | str | Unset
|
||||
if isinstance(owner_type, Unset):
|
||||
json_owner_type = UNSET
|
||||
elif isinstance(owner_type, OwnerType):
|
||||
json_owner_type = owner_type.value
|
||||
else:
|
||||
json_owner_type = owner_type
|
||||
params["owner_type"] = json_owner_type
|
||||
|
||||
json_owner: None | str | Unset
|
||||
if isinstance(owner, Unset):
|
||||
json_owner = UNSET
|
||||
else:
|
||||
json_owner = owner
|
||||
params["owner"] = json_owner
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["per_page"] = per_page
|
||||
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/v1/keys",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> PaginatedResponseKeySummary | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedResponseKeySummary.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[PaginatedResponseKeySummary]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
owner_type: None | OwnerType | Unset = UNSET,
|
||||
owner: None | str | Unset = UNSET,
|
||||
page: int | Unset = UNSET,
|
||||
per_page: int | Unset = UNSET,
|
||||
|
||||
) -> Response[PaginatedResponseKeySummary]:
|
||||
""" List all keys with pagination and optional filters (values redacted)
|
||||
|
||||
Args:
|
||||
owner_type (None | OwnerType | Unset):
|
||||
owner (None | str | Unset):
|
||||
page (int | Unset):
|
||||
per_page (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PaginatedResponseKeySummary]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
owner_type=owner_type,
|
||||
owner=owner,
|
||||
page=page,
|
||||
per_page=per_page,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
owner_type: None | OwnerType | Unset = UNSET,
|
||||
owner: None | str | Unset = UNSET,
|
||||
page: int | Unset = UNSET,
|
||||
per_page: int | Unset = UNSET,
|
||||
|
||||
) -> PaginatedResponseKeySummary | None:
|
||||
""" List all keys with pagination and optional filters (values redacted)
|
||||
|
||||
Args:
|
||||
owner_type (None | OwnerType | Unset):
|
||||
owner (None | str | Unset):
|
||||
page (int | Unset):
|
||||
per_page (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedResponseKeySummary
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
owner_type=owner_type,
|
||||
owner=owner,
|
||||
page=page,
|
||||
per_page=per_page,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
owner_type: None | OwnerType | Unset = UNSET,
|
||||
owner: None | str | Unset = UNSET,
|
||||
page: int | Unset = UNSET,
|
||||
per_page: int | Unset = UNSET,
|
||||
|
||||
) -> Response[PaginatedResponseKeySummary]:
|
||||
""" List all keys with pagination and optional filters (values redacted)
|
||||
|
||||
Args:
|
||||
owner_type (None | OwnerType | Unset):
|
||||
owner (None | str | Unset):
|
||||
page (int | Unset):
|
||||
per_page (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PaginatedResponseKeySummary]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
owner_type=owner_type,
|
||||
owner=owner,
|
||||
page=page,
|
||||
per_page=per_page,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
owner_type: None | OwnerType | Unset = UNSET,
|
||||
owner: None | str | Unset = UNSET,
|
||||
page: int | Unset = UNSET,
|
||||
per_page: int | Unset = UNSET,
|
||||
|
||||
) -> PaginatedResponseKeySummary | None:
|
||||
""" List all keys with pagination and optional filters (values redacted)
|
||||
|
||||
Args:
|
||||
owner_type (None | OwnerType | Unset):
|
||||
owner (None | str | Unset):
|
||||
page (int | Unset):
|
||||
per_page (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedResponseKeySummary
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
client=client,
|
||||
owner_type=owner_type,
|
||||
owner=owner,
|
||||
page=page,
|
||||
per_page=per_page,
|
||||
|
||||
)).parsed
|
||||
200
tests/generated_client/api/secrets/update_key.py
Normal file
200
tests/generated_client/api/secrets/update_key.py
Normal file
@@ -0,0 +1,200 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.update_key_request import UpdateKeyRequest
|
||||
from ...models.update_key_response_200 import UpdateKeyResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
*,
|
||||
body: UpdateKeyRequest,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": "/api/v1/keys/{ref}".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | UpdateKeyResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = UpdateKeyResponse200.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 400:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | UpdateKeyResponse200]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdateKeyRequest,
|
||||
|
||||
) -> Response[Any | UpdateKeyResponse200]:
|
||||
""" Update an existing key/secret
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdateKeyRequest): Request to update an existing key/secret
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | UpdateKeyResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdateKeyRequest,
|
||||
|
||||
) -> Any | UpdateKeyResponse200 | None:
|
||||
""" Update an existing key/secret
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdateKeyRequest): Request to update an existing key/secret
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | UpdateKeyResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdateKeyRequest,
|
||||
|
||||
) -> Response[Any | UpdateKeyResponse200]:
|
||||
""" Update an existing key/secret
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdateKeyRequest): Request to update an existing key/secret
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | UpdateKeyResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdateKeyRequest,
|
||||
|
||||
) -> Any | UpdateKeyResponse200 | None:
|
||||
""" Update an existing key/secret
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdateKeyRequest): Request to update an existing key/secret
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | UpdateKeyResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
)).parsed
|
||||
Reference in New Issue
Block a user