refactor: Refactor the extension schemas
1. remove prefix ext 2. update the swagger file 3. add more detailed info for schemas field Change-Id: I08f30087e8889d772db3da09a92f1e9390d10dbe
This commit is contained in:
parent
4d9b577007
commit
6ca007c1d0
File diff suppressed because it is too large
Load Diff
@ -49,13 +49,13 @@ List Servers.
|
|||||||
- The `name` is to support for fuzzy queries.
|
- The `name` is to support for fuzzy queries.
|
||||||
""",
|
""",
|
||||||
responses={
|
responses={
|
||||||
200: {"model": schemas.ExtListServersResponse},
|
200: {"model": schemas.ServersResponse},
|
||||||
400: {"model": schemas.BadRequestMessage},
|
400: {"model": schemas.BadRequestMessage},
|
||||||
401: {"model": schemas.UnauthorizedMessage},
|
401: {"model": schemas.UnauthorizedMessage},
|
||||||
403: {"model": schemas.ForbiddenMessage},
|
403: {"model": schemas.ForbiddenMessage},
|
||||||
500: {"model": schemas.InternalServerErrorMessage},
|
500: {"model": schemas.InternalServerErrorMessage},
|
||||||
},
|
},
|
||||||
response_model=schemas.ExtListServersResponse,
|
response_model=schemas.ServersResponse,
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
response_description="OK",
|
response_description="OK",
|
||||||
)
|
)
|
||||||
@ -68,8 +68,8 @@ async def list_servers(
|
|||||||
),
|
),
|
||||||
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
||||||
marker: str = None,
|
marker: str = None,
|
||||||
sort_dirs: schemas.ExtSortDir = None,
|
sort_dirs: schemas.SortDir = None,
|
||||||
sort_keys: List[schemas.ExtServerSortKey] = Query(None),
|
sort_keys: List[schemas.ServerSortKey] = Query(None),
|
||||||
all_projects: bool = None,
|
all_projects: bool = None,
|
||||||
project_id: str = Query(
|
project_id: str = Query(
|
||||||
None,
|
None,
|
||||||
@ -80,11 +80,11 @@ async def list_servers(
|
|||||||
description="Only works when the all_projects filter is also specified.",
|
description="Only works when the all_projects filter is also specified.",
|
||||||
),
|
),
|
||||||
name: str = None,
|
name: str = None,
|
||||||
status: schemas.ExtServerStatus = None,
|
status: schemas.ServerStatus = None,
|
||||||
host: str = Query(None, description="It will be ignored for non-admin user."),
|
host: str = Query(None, description="It will be ignored for non-admin user."),
|
||||||
flavor_id: str = None,
|
flavor_id: str = None,
|
||||||
uuid: str = Query(None, description="UUID of server."),
|
uuid: str = Query(None, description="UUID of server."),
|
||||||
) -> schemas.ExtListServersResponse:
|
) -> schemas.ServersResponse:
|
||||||
"""Extension List Servers.
|
"""Extension List Servers.
|
||||||
|
|
||||||
:param profile: Profile object include token, role and so on,
|
:param profile: Profile object include token, role and so on,
|
||||||
@ -96,9 +96,9 @@ async def list_servers(
|
|||||||
:param marker: Marker object to fetch, defaults to None
|
:param marker: Marker object to fetch, defaults to None
|
||||||
:type marker: str, optional
|
:type marker: str, optional
|
||||||
:param sort_dirs: Sort order, defaults to None
|
:param sort_dirs: Sort order, defaults to None
|
||||||
:type sort_dirs: schemas.ExtSortDir, optional
|
:type sort_dirs: schemas.SortDir, optional
|
||||||
:param sort_keys: Sort keys, defaults to Query(None)
|
:param sort_keys: Sort keys, defaults to Query(None)
|
||||||
:type sort_keys: List[schemas.ExtServerSortKey], optional
|
:type sort_keys: List[schemas.ServerSortKey], optional
|
||||||
:param all_projects: All projects to fetch, defaults to None
|
:param all_projects: All projects to fetch, defaults to None
|
||||||
:type all_projects: bool, optional
|
:type all_projects: bool, optional
|
||||||
:param project_id: Filter by id of project which server belongs to,
|
:param project_id: Filter by id of project which server belongs to,
|
||||||
@ -112,7 +112,7 @@ async def list_servers(
|
|||||||
:param name: Filter by server name, defaults to None
|
:param name: Filter by server name, defaults to None
|
||||||
:type name: str, optional
|
:type name: str, optional
|
||||||
:param status: Filter by server status, defaults to None
|
:param status: Filter by server status, defaults to None
|
||||||
:type status: schemas.ExtServerStatus, optional
|
:type status: schemas.ServerStatus, optional
|
||||||
:param host: Filter by host which server is located at,
|
:param host: Filter by host which server is located at,
|
||||||
defaults to Query(None, description="It will be ignored for non-admin user.")
|
defaults to Query(None, description="It will be ignored for non-admin user.")
|
||||||
:type host: str, optional
|
:type host: str, optional
|
||||||
@ -122,7 +122,7 @@ async def list_servers(
|
|||||||
:type uuid: str, optional
|
:type uuid: str, optional
|
||||||
:raises HTTPException: HTTP Exception
|
:raises HTTPException: HTTP Exception
|
||||||
:return: Server List
|
:return: Server List
|
||||||
:rtype: schemas.ExtListServersResponse
|
:rtype: schemas.ServersResponse
|
||||||
"""
|
"""
|
||||||
if all_projects:
|
if all_projects:
|
||||||
assert_system_admin_or_reader(
|
assert_system_admin_or_reader(
|
||||||
@ -280,13 +280,13 @@ List Recycle Servers.
|
|||||||
- The `name` is to support for fuzzy queries.
|
- The `name` is to support for fuzzy queries.
|
||||||
""",
|
""",
|
||||||
responses={
|
responses={
|
||||||
200: {"model": schemas.ExtListRecycleServersResponse},
|
200: {"model": schemas.RecycleServersResponse},
|
||||||
400: {"model": schemas.BadRequestMessage},
|
400: {"model": schemas.BadRequestMessage},
|
||||||
401: {"model": schemas.UnauthorizedMessage},
|
401: {"model": schemas.UnauthorizedMessage},
|
||||||
403: {"model": schemas.ForbiddenMessage},
|
403: {"model": schemas.ForbiddenMessage},
|
||||||
500: {"model": schemas.InternalServerErrorMessage},
|
500: {"model": schemas.InternalServerErrorMessage},
|
||||||
},
|
},
|
||||||
response_model=schemas.ExtListRecycleServersResponse,
|
response_model=schemas.RecycleServersResponse,
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
response_description="OK",
|
response_description="OK",
|
||||||
)
|
)
|
||||||
@ -299,8 +299,8 @@ async def list_recycle_servers(
|
|||||||
),
|
),
|
||||||
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
||||||
marker: str = None,
|
marker: str = None,
|
||||||
sort_dirs: schemas.ExtSortDir = None,
|
sort_dirs: schemas.SortDir = None,
|
||||||
sort_keys: List[schemas.ExtRecycleServerSortKey] = Query(None),
|
sort_keys: List[schemas.RecycleServerSortKey] = Query(None),
|
||||||
all_projects: bool = None,
|
all_projects: bool = None,
|
||||||
project_id: str = Query(
|
project_id: str = Query(
|
||||||
None,
|
None,
|
||||||
@ -312,7 +312,7 @@ async def list_recycle_servers(
|
|||||||
),
|
),
|
||||||
name: str = None,
|
name: str = None,
|
||||||
uuid: str = Query(None, description="UUID of recycle server."),
|
uuid: str = Query(None, description="UUID of recycle server."),
|
||||||
) -> schemas.ExtListRecycleServersResponse:
|
) -> schemas.RecycleServersResponse:
|
||||||
"""Extension List Recycle Servers.
|
"""Extension List Recycle Servers.
|
||||||
|
|
||||||
:param profile: Profile object include token, role and so on,
|
:param profile: Profile object include token, role and so on,
|
||||||
@ -324,9 +324,9 @@ async def list_recycle_servers(
|
|||||||
:param marker: Marker object to fetch, defaults to None
|
:param marker: Marker object to fetch, defaults to None
|
||||||
:type marker: str, optional
|
:type marker: str, optional
|
||||||
:param sort_dirs: Sort order, defaults to None
|
:param sort_dirs: Sort order, defaults to None
|
||||||
:type sort_dirs: schemas.ExtSortDir, optional
|
:type sort_dirs: schemas.SortDir, optional
|
||||||
:param sort_keys: Sort keys, defaults to Query(None)
|
:param sort_keys: Sort keys, defaults to Query(None)
|
||||||
:type sort_keys: List[schemas.ExtServerSortKey], optional
|
:type sort_keys: List[schemas.RecycleServerSortKey], optional
|
||||||
:param all_projects: All projects to fetch, defaults to None
|
:param all_projects: All projects to fetch, defaults to None
|
||||||
:type all_projects: bool, optional
|
:type all_projects: bool, optional
|
||||||
:param project_id: Filter by id of project which recycle server belongs to,
|
:param project_id: Filter by id of project which recycle server belongs to,
|
||||||
@ -344,7 +344,7 @@ async def list_recycle_servers(
|
|||||||
:type uuid: str, optional
|
:type uuid: str, optional
|
||||||
:raises HTTPException: HTTP Exception
|
:raises HTTPException: HTTP Exception
|
||||||
:return: Recycle server list
|
:return: Recycle server list
|
||||||
:rtype: schemas.ExtListRecycleServersResponse
|
:rtype: schemas.RecycleServersResponse
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if all_projects:
|
if all_projects:
|
||||||
@ -503,12 +503,12 @@ async def list_recycle_servers(
|
|||||||
"/extension/volumes",
|
"/extension/volumes",
|
||||||
description="List Volumes.",
|
description="List Volumes.",
|
||||||
responses={
|
responses={
|
||||||
200: {"model": schemas.ExtListVolumesResponse},
|
200: {"model": schemas.VolumesResponse},
|
||||||
401: {"model": schemas.UnauthorizedMessage},
|
401: {"model": schemas.UnauthorizedMessage},
|
||||||
403: {"model": schemas.ForbiddenMessage},
|
403: {"model": schemas.ForbiddenMessage},
|
||||||
500: {"model": schemas.InternalServerErrorMessage},
|
500: {"model": schemas.InternalServerErrorMessage},
|
||||||
},
|
},
|
||||||
response_model=schemas.ExtListVolumesResponse,
|
response_model=schemas.VolumesResponse,
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
response_description="OK",
|
response_description="OK",
|
||||||
)
|
)
|
||||||
@ -521,16 +521,16 @@ async def list_volumes(
|
|||||||
),
|
),
|
||||||
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
||||||
marker: str = None,
|
marker: str = None,
|
||||||
sort_dirs: schemas.ExtSortDir = None,
|
sort_dirs: schemas.SortDir = None,
|
||||||
sort_keys: List[schemas.ExtVolumeSortKey] = Query(None),
|
sort_keys: List[schemas.VolumeSortKey] = Query(None),
|
||||||
all_projects: bool = None,
|
all_projects: bool = None,
|
||||||
project_id: str = None,
|
project_id: str = None,
|
||||||
name: str = None,
|
name: str = None,
|
||||||
multiattach: bool = None,
|
multiattach: bool = None,
|
||||||
status: schemas.ExtVolumeStatus = None,
|
status: schemas.VolumeStatus = None,
|
||||||
bootable: bool = None,
|
bootable: bool = None,
|
||||||
uuid: List[str] = Query(None, description="UUID of volume."),
|
uuid: List[str] = Query(None, description="UUID of volume."),
|
||||||
) -> schemas.ExtListVolumesResponse:
|
) -> schemas.VolumesResponse:
|
||||||
"""Extension List Volumes.
|
"""Extension List Volumes.
|
||||||
|
|
||||||
:param profile: Profile object include token, role and so on,
|
:param profile: Profile object include token, role and so on,
|
||||||
@ -542,9 +542,9 @@ async def list_volumes(
|
|||||||
:param marker: Marker object to fetch, defaults to None
|
:param marker: Marker object to fetch, defaults to None
|
||||||
:type marker: str, optional
|
:type marker: str, optional
|
||||||
:param sort_dirs: Sort order, defaults to None
|
:param sort_dirs: Sort order, defaults to None
|
||||||
:type sort_dirs: schemas.ExtSortDir, optional
|
:type sort_dirs: schemas.SortDir, optional
|
||||||
:param sort_keys: Sort keys, defaults to Query(None)
|
:param sort_keys: Sort keys, defaults to Query(None)
|
||||||
:type sort_keys: List[schemas.ExtServerSortKey], optional
|
:type sort_keys: List[schemas.VolumeSortKey], optional
|
||||||
:param all_projects: All projects to fetch, defaults to None
|
:param all_projects: All projects to fetch, defaults to None
|
||||||
:type all_projects: bool, optional
|
:type all_projects: bool, optional
|
||||||
:param project_id: Filter by id of project which volume belongs to,
|
:param project_id: Filter by id of project which volume belongs to,
|
||||||
@ -556,14 +556,14 @@ async def list_volumes(
|
|||||||
defaults to None
|
defaults to None
|
||||||
:type multiattach: bool, optional
|
:type multiattach: bool, optional
|
||||||
:param status: Filter by volume status, defaults to None
|
:param status: Filter by volume status, defaults to None
|
||||||
:type status: schemas.ExtVolumeStatus, optional
|
:type status: schemas.VolumeStatus, optional
|
||||||
:type bootable: Filter by bootable that server be used to create an instance quickly.
|
:type bootable: Filter by bootable that server be used to create an instance quickly.
|
||||||
:type bootable: bool, optional
|
:type bootable: bool, optional
|
||||||
:param uuid: Filter by list uuid,
|
:param uuid: Filter by list uuid,
|
||||||
defaults to Query(None, description="UUID of volume.")
|
defaults to Query(None, description="UUID of volume.")
|
||||||
:type uuid: List[str], optional
|
:type uuid: List[str], optional
|
||||||
:return: Volume list
|
:return: Volume list
|
||||||
:rtype: schemas.ExtListVolumesResponse
|
:rtype: schemas.VolumesResponse
|
||||||
"""
|
"""
|
||||||
if all_projects:
|
if all_projects:
|
||||||
assert_system_admin_or_reader(
|
assert_system_admin_or_reader(
|
||||||
@ -699,12 +699,12 @@ async def list_volumes(
|
|||||||
"/extension/volume_snapshots",
|
"/extension/volume_snapshots",
|
||||||
description="List Volume Snapshots.",
|
description="List Volume Snapshots.",
|
||||||
responses={
|
responses={
|
||||||
200: {"model": schemas.ExtListVolumeSnapshotsResponse},
|
200: {"model": schemas.VolumeSnapshotsResponse},
|
||||||
401: {"model": schemas.UnauthorizedMessage},
|
401: {"model": schemas.UnauthorizedMessage},
|
||||||
403: {"model": schemas.ForbiddenMessage},
|
403: {"model": schemas.ForbiddenMessage},
|
||||||
500: {"model": schemas.InternalServerErrorMessage},
|
500: {"model": schemas.InternalServerErrorMessage},
|
||||||
},
|
},
|
||||||
response_model=schemas.ExtListVolumeSnapshotsResponse,
|
response_model=schemas.VolumeSnapshotsResponse,
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
response_description="OK",
|
response_description="OK",
|
||||||
)
|
)
|
||||||
@ -717,14 +717,14 @@ async def list_volume_snapshots(
|
|||||||
),
|
),
|
||||||
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
||||||
marker: str = None,
|
marker: str = None,
|
||||||
sort_dirs: schemas.ExtSortDir = None,
|
sort_dirs: schemas.SortDir = None,
|
||||||
sort_keys: List[schemas.ExtVolumeSnapshotSortKey] = Query(None),
|
sort_keys: List[schemas.VolumeSnapshotSortKey] = Query(None),
|
||||||
all_projects: bool = None,
|
all_projects: bool = None,
|
||||||
project_id: str = None,
|
project_id: str = None,
|
||||||
name: str = None,
|
name: str = None,
|
||||||
status: schemas.ExtVolumeSnapshotStatus = None,
|
status: schemas.VolumeSnapshotStatus = None,
|
||||||
volume_id: str = None,
|
volume_id: str = None,
|
||||||
) -> schemas.ExtListVolumeSnapshotsResponse:
|
) -> schemas.VolumeSnapshotsResponse:
|
||||||
"""Extension List Volume Snapshots.
|
"""Extension List Volume Snapshots.
|
||||||
|
|
||||||
:param profile: Profile object include token, role and so on,
|
:param profile: Profile object include token, role and so on,
|
||||||
@ -736,9 +736,9 @@ async def list_volume_snapshots(
|
|||||||
:param marker: Marker object to fetch, defaults to None
|
:param marker: Marker object to fetch, defaults to None
|
||||||
:type marker: str, optional
|
:type marker: str, optional
|
||||||
:param sort_dirs: Sort order, defaults to None
|
:param sort_dirs: Sort order, defaults to None
|
||||||
:type sort_dirs: schemas.ExtSortDir, optional
|
:type sort_dirs: schemas.SortDir, optional
|
||||||
:param sort_keys: Sort keys, defaults to Query(None)
|
:param sort_keys: Sort keys, defaults to Query(None)
|
||||||
:type sort_keys: List[schemas.ExtServerSortKey], optional
|
:type sort_keys: List[schemas.VolumeSnapshotSortKey], optional
|
||||||
:param all_projects: All projects to fetch, defaults to None
|
:param all_projects: All projects to fetch, defaults to None
|
||||||
:type all_projects: bool, optional
|
:type all_projects: bool, optional
|
||||||
:param project_id: Filter by id of project which volume snapshots belongs to,
|
:param project_id: Filter by id of project which volume snapshots belongs to,
|
||||||
@ -747,11 +747,11 @@ async def list_volume_snapshots(
|
|||||||
:param name: Filter by volume snapshot name, defaults to None
|
:param name: Filter by volume snapshot name, defaults to None
|
||||||
:type name: str, optional
|
:type name: str, optional
|
||||||
:param status: Filter by volume snapshot status, defaults to None
|
:param status: Filter by volume snapshot status, defaults to None
|
||||||
:type status: schemas.ExtVolumeSnapshotStatus, optional
|
:type status: schemas.VolumeSnapshotStatus, optional
|
||||||
:param volume_id: Filter by volume id, defaults to None
|
:param volume_id: Filter by volume id, defaults to None
|
||||||
:type volume_id: str, optional
|
:type volume_id: str, optional
|
||||||
:return: Volume snapshot list
|
:return: Volume snapshot list
|
||||||
:rtype: schemas.ExtListVolumeSnapshotsResponse
|
:rtype: schemas.VolumeSnapshotsResponse
|
||||||
"""
|
"""
|
||||||
if all_projects:
|
if all_projects:
|
||||||
assert_system_admin_or_reader(
|
assert_system_admin_or_reader(
|
||||||
@ -877,7 +877,7 @@ async def list_volume_snapshots(
|
|||||||
403: {"model": schemas.ForbiddenMessage},
|
403: {"model": schemas.ForbiddenMessage},
|
||||||
500: {"model": schemas.InternalServerErrorMessage},
|
500: {"model": schemas.InternalServerErrorMessage},
|
||||||
},
|
},
|
||||||
response_model=schemas.ExtListPortsResponse,
|
response_model=schemas.PortsResponse,
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
response_description="OK",
|
response_description="OK",
|
||||||
)
|
)
|
||||||
@ -890,18 +890,18 @@ async def list_ports(
|
|||||||
),
|
),
|
||||||
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT),
|
||||||
marker: str = None,
|
marker: str = None,
|
||||||
sort_dirs: schemas.ExtSortDir = None,
|
sort_dirs: schemas.SortDir = None,
|
||||||
sort_keys: List[schemas.ExtPortSortKey] = Query(None),
|
sort_keys: List[schemas.PortSortKey] = Query(None),
|
||||||
all_projects: bool = None,
|
all_projects: bool = None,
|
||||||
project_id: str = None,
|
project_id: str = None,
|
||||||
name: str = None,
|
name: str = None,
|
||||||
status: schemas.ExtPortStatus = None,
|
status: schemas.PortStatus = None,
|
||||||
network_name: str = None,
|
network_name: str = None,
|
||||||
network_id: str = None,
|
network_id: str = None,
|
||||||
device_id: str = None,
|
device_id: str = None,
|
||||||
device_owner: List[schemas.ExtPortDeviceOwner] = Query(None),
|
device_owner: List[schemas.PortDeviceOwner] = Query(None),
|
||||||
uuid: List[str] = Query(None, description="UUID of port."),
|
uuid: List[str] = Query(None, description="UUID of port."),
|
||||||
) -> schemas.ExtListPortsResponse:
|
) -> schemas.PortsResponse:
|
||||||
"""Extension List Ports.
|
"""Extension List Ports.
|
||||||
|
|
||||||
:param profile: Profile object include token, role and so on,
|
:param profile: Profile object include token, role and so on,
|
||||||
@ -913,7 +913,7 @@ async def list_ports(
|
|||||||
:param marker: Marker object to fetch, defaults to None
|
:param marker: Marker object to fetch, defaults to None
|
||||||
:type marker: str, optional
|
:type marker: str, optional
|
||||||
:param sort_dirs: Sort order, defaults to None
|
:param sort_dirs: Sort order, defaults to None
|
||||||
:type sort_dirs: schemas.ExtSortDir, optional
|
:type sort_dirs: schemas.SortDir, optional
|
||||||
:param sort_keys: Sort keys, defaults to Query(None)
|
:param sort_keys: Sort keys, defaults to Query(None)
|
||||||
:type sort_keys: List[schemas.ExtServerSortKey], optional
|
:type sort_keys: List[schemas.ExtServerSortKey], optional
|
||||||
:param all_projects: All projects to fetch, defaults to None
|
:param all_projects: All projects to fetch, defaults to None
|
||||||
@ -924,7 +924,7 @@ async def list_ports(
|
|||||||
:param name: Filter by port name, defaults to None
|
:param name: Filter by port name, defaults to None
|
||||||
:type name: str, optional
|
:type name: str, optional
|
||||||
:param status: Filter by port status, defaults to None
|
:param status: Filter by port status, defaults to None
|
||||||
:type status: schemas.ExtPortStatus, optional
|
:type status: schemas.PortStatus, optional
|
||||||
:param network_name: Filter by name of network, defaults to None
|
:param network_name: Filter by name of network, defaults to None
|
||||||
:type network_name: str, optional
|
:type network_name: str, optional
|
||||||
:param network_id: Filter by id of network, defaults to None
|
:param network_id: Filter by id of network, defaults to None
|
||||||
@ -932,12 +932,12 @@ async def list_ports(
|
|||||||
:param device_id: Filter by id of device, defaults to None
|
:param device_id: Filter by id of device, defaults to None
|
||||||
:type device_id: str, optional
|
:type device_id: str, optional
|
||||||
:param device_owner: Filter by device owner, defaults to Query(None)
|
:param device_owner: Filter by device owner, defaults to Query(None)
|
||||||
:type device_owner: List[schemas.ExtPortDeviceOwner], optional
|
:type device_owner: List[schemas.PortDeviceOwner], optional
|
||||||
:param uuid: Filter by list uuid,
|
:param uuid: Filter by list uuid,
|
||||||
defaults to Query(None, description="UUID of port.")
|
defaults to Query(None, description="UUID of port.")
|
||||||
:type uuid: List[str], optional
|
:type uuid: List[str], optional
|
||||||
:return: Port list
|
:return: Port list
|
||||||
:rtype: schemas.ExtListPortsResponse
|
:rtype: schemas.PortsResponse
|
||||||
"""
|
"""
|
||||||
current_session = await generate_session(profile=profile)
|
current_session = await generate_session(profile=profile)
|
||||||
|
|
||||||
@ -1062,11 +1062,11 @@ async def list_ports(
|
|||||||
"/extension/compute-services",
|
"/extension/compute-services",
|
||||||
description="List compute services.",
|
description="List compute services.",
|
||||||
responses={
|
responses={
|
||||||
200: {"model": schemas.ExtListComputeServicesResponse},
|
200: {"model": schemas.ComputeServicesResponse},
|
||||||
401: {"model": schemas.UnauthorizedMessage},
|
401: {"model": schemas.UnauthorizedMessage},
|
||||||
500: {"model": schemas.InternalServerErrorMessage},
|
500: {"model": schemas.InternalServerErrorMessage},
|
||||||
},
|
},
|
||||||
response_model=schemas.ExtListComputeServicesResponse,
|
response_model=schemas.ComputeServicesResponse,
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
response_description="OK",
|
response_description="OK",
|
||||||
response_model_exclude_none=True,
|
response_model_exclude_none=True,
|
||||||
@ -1080,7 +1080,7 @@ async def compute_services(
|
|||||||
),
|
),
|
||||||
binary: str = None,
|
binary: str = None,
|
||||||
host: str = None,
|
host: str = None,
|
||||||
) -> schemas.ExtListComputeServicesResponse:
|
) -> schemas.ComputeServicesResponse:
|
||||||
"""Extension List Compute Services.
|
"""Extension List Compute Services.
|
||||||
|
|
||||||
:param profile: Profile object include token, role and so on,
|
:param profile: Profile object include token, role and so on,
|
||||||
@ -1091,7 +1091,7 @@ async def compute_services(
|
|||||||
:param host: Filter by host name, defaults to None
|
:param host: Filter by host name, defaults to None
|
||||||
:type host: str, optional
|
:type host: str, optional
|
||||||
:return: Compute service list
|
:return: Compute service list
|
||||||
:rtype: schemas.ExtListComputeServicesResponse
|
:rtype: schemas.ComputeServicesResponse
|
||||||
"""
|
"""
|
||||||
assert_system_admin_or_reader(
|
assert_system_admin_or_reader(
|
||||||
profile=profile,
|
profile=profile,
|
||||||
|
@ -24,23 +24,23 @@ from .common import (
|
|||||||
)
|
)
|
||||||
from .contrib import KeystoneEndpoints
|
from .contrib import KeystoneEndpoints
|
||||||
from .extension import (
|
from .extension import (
|
||||||
ExtListComputeServicesResponse,
|
ComputeServicesResponse,
|
||||||
ExtListPortsResponse,
|
PortDeviceOwner,
|
||||||
ExtListRecycleServersResponse,
|
PortSortKey,
|
||||||
ExtListServersResponse,
|
PortsResponse,
|
||||||
ExtListVolumeSnapshotsResponse,
|
PortStatus,
|
||||||
ExtListVolumesResponse,
|
RecycleServerSortKey,
|
||||||
ExtPortDeviceOwner,
|
RecycleServersResponse,
|
||||||
ExtPortSortKey,
|
ServerSortKey,
|
||||||
ExtPortStatus,
|
ServersResponse,
|
||||||
ExtRecycleServerSortKey,
|
ServerStatus,
|
||||||
ExtServerSortKey,
|
SortDir,
|
||||||
ExtServerStatus,
|
VolumeSnapshotSortKey,
|
||||||
ExtSortDir,
|
VolumeSnapshotsResponse,
|
||||||
ExtVolumeSnapshotSortKey,
|
VolumeSnapshotStatus,
|
||||||
ExtVolumeSnapshotStatus,
|
VolumeSortKey,
|
||||||
ExtVolumeSortKey,
|
VolumesResponse,
|
||||||
ExtVolumeStatus,
|
VolumeStatus,
|
||||||
)
|
)
|
||||||
from .login import Credential, Payload, Profile
|
from .login import Credential, Payload, Profile
|
||||||
from .policy import Policies, PoliciesRules
|
from .policy import Policies, PoliciesRules
|
||||||
|
@ -26,7 +26,7 @@ VOLUME_SNAPSHOTS_LIST_DOCS_LINKS = "https://docs.openstack.org/api-ref/block-sto
|
|||||||
PORTS_LIST_DOCS_LINKS = "https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-ports-detail#list-ports" # noqa
|
PORTS_LIST_DOCS_LINKS = "https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-ports-detail#list-ports" # noqa
|
||||||
|
|
||||||
|
|
||||||
class ExtServerStatus(str, Enum):
|
class ServerStatus(str, Enum):
|
||||||
ACTIVE = "ACTIVE"
|
ACTIVE = "ACTIVE"
|
||||||
BUILD = "BUILD"
|
BUILD = "BUILD"
|
||||||
# DELETED = "DELETED"
|
# DELETED = "DELETED"
|
||||||
@ -52,7 +52,7 @@ class ExtServerStatus(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtVolumeStatus(str, Enum):
|
class VolumeStatus(str, Enum):
|
||||||
creating = "creating"
|
creating = "creating"
|
||||||
available = "available"
|
available = "available"
|
||||||
reserved = "reserved"
|
reserved = "reserved"
|
||||||
@ -78,7 +78,7 @@ class ExtVolumeStatus(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtVolumeSnapshotStatus(str, Enum):
|
class VolumeSnapshotStatus(str, Enum):
|
||||||
CREATING = "CREATING"
|
CREATING = "CREATING"
|
||||||
AVAILABLE = "AVAILABLE"
|
AVAILABLE = "AVAILABLE"
|
||||||
# BACKING_UP = "BACKING_UP"
|
# BACKING_UP = "BACKING_UP"
|
||||||
@ -93,7 +93,7 @@ class ExtVolumeSnapshotStatus(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtPortStatus(str, Enum):
|
class PortStatus(str, Enum):
|
||||||
ACTIVE = "ACTIVE"
|
ACTIVE = "ACTIVE"
|
||||||
DOWN = "DOWN"
|
DOWN = "DOWN"
|
||||||
BUILD = "BUILD"
|
BUILD = "BUILD"
|
||||||
@ -104,7 +104,7 @@ class ExtPortStatus(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtPortDeviceOwner(str, Enum):
|
class PortDeviceOwner(str, Enum):
|
||||||
null = ""
|
null = ""
|
||||||
# prefix compute
|
# prefix compute
|
||||||
compute_nova = "compute:nova"
|
compute_nova = "compute:nova"
|
||||||
@ -126,7 +126,7 @@ class ExtPortDeviceOwner(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtSortDir(str, Enum):
|
class SortDir(str, Enum):
|
||||||
desc = "desc"
|
desc = "desc"
|
||||||
asc = "asc"
|
asc = "asc"
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ class ExtSortDir(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtServerSortKey(str, Enum):
|
class ServerSortKey(str, Enum):
|
||||||
uuid = "uuid"
|
uuid = "uuid"
|
||||||
display_name = "display_name"
|
display_name = "display_name"
|
||||||
vm_state = "vm_state"
|
vm_state = "vm_state"
|
||||||
@ -147,7 +147,7 @@ class ExtServerSortKey(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtRecycleServerSortKey(str, Enum):
|
class RecycleServerSortKey(str, Enum):
|
||||||
uuid = "uuid"
|
uuid = "uuid"
|
||||||
display_name = "display_name"
|
display_name = "display_name"
|
||||||
updated_at = "updated_at"
|
updated_at = "updated_at"
|
||||||
@ -157,7 +157,7 @@ class ExtRecycleServerSortKey(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtVolumeSortKey(str, Enum):
|
class VolumeSortKey(str, Enum):
|
||||||
id = "id"
|
id = "id"
|
||||||
name = "name"
|
name = "name"
|
||||||
size = "size"
|
size = "size"
|
||||||
@ -169,7 +169,7 @@ class ExtVolumeSortKey(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtVolumeSnapshotSortKey(str, Enum):
|
class VolumeSnapshotSortKey(str, Enum):
|
||||||
id = "id"
|
id = "id"
|
||||||
name = "name"
|
name = "name"
|
||||||
status = "status"
|
status = "status"
|
||||||
@ -179,7 +179,7 @@ class ExtVolumeSnapshotSortKey(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtPortSortKey(str, Enum):
|
class PortSortKey(str, Enum):
|
||||||
id = "id"
|
id = "id"
|
||||||
name = "name"
|
name = "name"
|
||||||
mac_address = "mac_address"
|
mac_address = "mac_address"
|
||||||
@ -190,27 +190,27 @@ class ExtPortSortKey(str, Enum):
|
|||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
class ExtFlavor(BaseModel):
|
class FlavorInServer(BaseModel):
|
||||||
ephemeral: Optional[int]
|
ephemeral: Optional[int] = Field(None, description="Ephemeral disk size in GB")
|
||||||
ram: Optional[int]
|
ram: Optional[int] = Field(None, description="RAM size in MB")
|
||||||
original_name: Optional[str]
|
original_name: Optional[str] = Field(None, description="Original flavor name")
|
||||||
vcpus: Optional[int]
|
vcpus: Optional[int] = Field(None, description="Number of vCPUs")
|
||||||
extra_specs: Optional[Dict[str, Any]]
|
extra_specs: Optional[Dict[str, Any]] = Field(None, description="Extra specs")
|
||||||
swap: Optional[int]
|
swap: Optional[int] = Field(None, description="Swap size in MB")
|
||||||
disk: Optional[int]
|
disk: Optional[int] = Field(None, description="Disk size in GB")
|
||||||
|
|
||||||
|
|
||||||
class ExtListServersBaseResponse(BaseModel):
|
class ServersResponseBase(BaseModel):
|
||||||
id: UUID4
|
id: UUID4 = Field(..., alias="Server ID")
|
||||||
origin_data: Dict[str, Any] = Field(
|
origin_data: Dict[str, Any] = Field(
|
||||||
description=f"The origin_data is the same like the response of {SERVERS_LIST_DOCS_LINKS}",
|
description=f"The origin_data is the same like the response of {SERVERS_LIST_DOCS_LINKS}",
|
||||||
)
|
)
|
||||||
project_name: Optional[str]
|
project_name: Optional[str] = Field(None, description="Project name")
|
||||||
image: Optional[UUID4]
|
image: Optional[UUID4] = Field(None, description="Image ID")
|
||||||
image_name: Optional[str]
|
image_name: Optional[str] = Field(None, description="Image name")
|
||||||
image_os_distro: Optional[str]
|
image_os_distro: Optional[str] = Field(None, description="Image OS distro")
|
||||||
fixed_addresses: Optional[List]
|
fixed_addresses: Optional[List] = Field(None, description="Fixed addresses")
|
||||||
floating_addresses: Optional[List]
|
floating_addresses: Optional[List] = Field(None, description="Floating addresses")
|
||||||
|
|
||||||
name: Optional[str] = Field(
|
name: Optional[str] = Field(
|
||||||
description="Will be removed, please use origin_data[name]",
|
description="Will be removed, please use origin_data[name]",
|
||||||
@ -232,7 +232,7 @@ class ExtListServersBaseResponse(BaseModel):
|
|||||||
description="Will be removed, please use origin_data[flavor][original_name]",
|
description="Will be removed, please use origin_data[flavor][original_name]",
|
||||||
deprecated=True,
|
deprecated=True,
|
||||||
)
|
)
|
||||||
flavor_info: Optional[ExtFlavor] = Field(
|
flavor_info: Optional[FlavorInServer] = Field(
|
||||||
description="Will be removed, please use origin_data[flavor]",
|
description="Will be removed, please use origin_data[flavor]",
|
||||||
deprecated=True,
|
deprecated=True,
|
||||||
)
|
)
|
||||||
@ -270,23 +270,23 @@ class ExtListServersBaseResponse(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExtListServersResponse(BaseModel):
|
class ServersResponse(BaseModel):
|
||||||
servers: List[ExtListServersBaseResponse]
|
servers: List[ServersResponseBase] = Field(..., description="Servers list")
|
||||||
|
|
||||||
|
|
||||||
class ExtListRecycleServersBaseResponse(BaseModel):
|
class RecycleServersResponseBase(BaseModel):
|
||||||
id: UUID4
|
id: UUID4 = Field(..., description="Recycle server id")
|
||||||
origin_data: Dict[str, Any] = Field(
|
origin_data: Dict[str, Any] = Field(
|
||||||
description=f"The origin_data is the same like the response of {SERVERS_LIST_DOCS_LINKS}",
|
description=f"The origin_data is the same like the response of {SERVERS_LIST_DOCS_LINKS}",
|
||||||
)
|
)
|
||||||
project_name: Optional[str]
|
project_name: Optional[str] = Field(None, description="Project name")
|
||||||
image: Optional[UUID4]
|
image: Optional[UUID4] = Field(None, description="Image id")
|
||||||
image_name: Optional[str]
|
image_name: Optional[str] = Field(None, description="Image name")
|
||||||
image_os_distro: Optional[str]
|
image_os_distro: Optional[str] = Field(None, description="Image os distro")
|
||||||
fixed_addresses: Optional[List]
|
fixed_addresses: Optional[List] = Field(None, description="Fixed addresses")
|
||||||
floating_addresses: Optional[List]
|
floating_addresses: Optional[List] = Field(None, description="Floating addresses")
|
||||||
deleted_at: Optional[str]
|
deleted_at: Optional[str] = Field(None, description="Deleted at")
|
||||||
reclaim_timestamp: float
|
reclaim_timestamp: float = Field(..., description="Reclaim timestamp")
|
||||||
|
|
||||||
name: Optional[str] = Field(
|
name: Optional[str] = Field(
|
||||||
description="Will be removed, please use origin_data[name]",
|
description="Will be removed, please use origin_data[name]",
|
||||||
@ -308,7 +308,7 @@ class ExtListRecycleServersBaseResponse(BaseModel):
|
|||||||
description="Will be removed, please use origin_data[flavor][original_name]",
|
description="Will be removed, please use origin_data[flavor][original_name]",
|
||||||
deprecated=True,
|
deprecated=True,
|
||||||
)
|
)
|
||||||
flavor_info: Optional[ExtFlavor] = Field(
|
flavor_info: Optional[FlavorInServer] = Field(
|
||||||
description="Will be removed, please use origin_data[flavor]",
|
description="Will be removed, please use origin_data[flavor]",
|
||||||
deprecated=True,
|
deprecated=True,
|
||||||
)
|
)
|
||||||
@ -318,24 +318,26 @@ class ExtListRecycleServersBaseResponse(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExtListRecycleServersResponse(BaseModel):
|
class RecycleServersResponse(BaseModel):
|
||||||
recycle_servers: List[ExtListRecycleServersBaseResponse]
|
recycle_servers: List[RecycleServersResponseBase] = Field(
|
||||||
|
..., description="Recycle servers list"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class VolumeAttachment(BaseModel):
|
class VolumeAttachment(BaseModel):
|
||||||
id: str
|
id: str = Field(..., description="Volume attachment id")
|
||||||
device: Optional[str]
|
device: Optional[str] = Field(None, description="Device name")
|
||||||
server_id: Optional[str]
|
server_id: Optional[str] = Field(None, description="Server id")
|
||||||
server_name: Optional[str]
|
server_name: Optional[str] = Field(None, description="Server name")
|
||||||
|
|
||||||
|
|
||||||
class ExtListVolumesBaseResponse(BaseModel):
|
class VolumesResponseBase(BaseModel):
|
||||||
id: UUID4
|
id: UUID4 = Field(..., description="Volume ID")
|
||||||
origin_data: Dict[str, Any] = Field(
|
origin_data: Dict[str, Any] = Field(
|
||||||
description=f"The origin_data is the same like the response of {VOLUMES_LIST_DOCS_LINKS}",
|
description=f"The origin_data is the same like the response of {VOLUMES_LIST_DOCS_LINKS}",
|
||||||
)
|
)
|
||||||
project_name: Optional[str]
|
project_name: Optional[str] = Field(None, description="Project name")
|
||||||
attachments: Optional[List[VolumeAttachment]]
|
attachments: Optional[List[VolumeAttachment]] = Field(None, description="Volume attachments")
|
||||||
|
|
||||||
name: Optional[str] = Field(
|
name: Optional[str] = Field(
|
||||||
description="Will be removed, please use origin_data[name]",
|
description="Will be removed, please use origin_data[name]",
|
||||||
@ -391,20 +393,20 @@ class ExtListVolumesBaseResponse(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExtListVolumesResponse(BaseModel):
|
class VolumesResponse(BaseModel):
|
||||||
count: int = 0
|
count: Optional[int] = Field(0, description="Count of volumes")
|
||||||
volumes: List[ExtListVolumesBaseResponse]
|
volumes: List[VolumesResponseBase] = Field(..., description="Volumes list")
|
||||||
|
|
||||||
|
|
||||||
class ExtListVolumeSnapshotsBaseResponse(BaseModel):
|
class VolumeSnapshotsResponseBase(BaseModel):
|
||||||
id: str
|
id: str = Field(..., description="Snapshot ID")
|
||||||
origin_data: Dict[str, Any] = Field(
|
origin_data: Dict[str, Any] = Field(
|
||||||
description=f"The origin_data is the same like the response of {VOLUME_SNAPSHOTS_LIST_DOCS_LINKS}", # noqa
|
description=f"The origin_data is the same like the response of {VOLUME_SNAPSHOTS_LIST_DOCS_LINKS}", # noqa
|
||||||
)
|
)
|
||||||
project_name: Optional[str]
|
project_name: Optional[str] = Field(None, description="Project name")
|
||||||
host: Optional[str]
|
host: Optional[str] = Field(None, description="Host name")
|
||||||
volume_name: Optional[str]
|
volume_name: Optional[str] = Field(None, description="Volume name")
|
||||||
child_volumes: Optional[List]
|
child_volumes: Optional[List] = Field(None, description="Child volumes")
|
||||||
|
|
||||||
name: Optional[str] = Field(
|
name: Optional[str] = Field(
|
||||||
description="Will be removed, please use origin_data[name]",
|
description="Will be removed, please use origin_data[name]",
|
||||||
@ -436,20 +438,22 @@ class ExtListVolumeSnapshotsBaseResponse(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExtListVolumeSnapshotsResponse(BaseModel):
|
class VolumeSnapshotsResponse(BaseModel):
|
||||||
count: int = 0
|
count: Optional[int] = Field(0, description="Count of volume snapshots")
|
||||||
volume_snapshots: List[ExtListVolumeSnapshotsBaseResponse]
|
volume_snapshots: List[VolumeSnapshotsResponseBase] = Field(
|
||||||
|
..., description="Volume snapshots list"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExtListPortsBaseResponse(BaseModel):
|
class PortsResponseBase(BaseModel):
|
||||||
id: str
|
id: str = Field(..., description="Port ID")
|
||||||
origin_data: Dict[str, Any] = Field(
|
origin_data: Dict[str, Any] = Field(
|
||||||
description=f"The origin_data is the same like the response of {PORTS_LIST_DOCS_LINKS}", # noqa
|
description=f"The origin_data is the same like the response of {PORTS_LIST_DOCS_LINKS}", # noqa
|
||||||
)
|
)
|
||||||
server_name: Optional[str]
|
server_name: Optional[str] = Field(None, description="Server name")
|
||||||
network_name: Optional[str]
|
network_name: Optional[str] = Field(None, description="Network name")
|
||||||
ipv4: Optional[List]
|
ipv4: Optional[List] = Field(None, description="IPv4 addresses")
|
||||||
ipv6: Optional[List]
|
ipv6: Optional[List] = Field(None, description="IPv6 addresses")
|
||||||
|
|
||||||
name: Optional[str] = Field(
|
name: Optional[str] = Field(
|
||||||
description="Will be removed, please use origin_data[name]",
|
description="Will be removed, please use origin_data[name]",
|
||||||
@ -505,21 +509,21 @@ class ExtListPortsBaseResponse(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExtListPortsResponse(BaseModel):
|
class PortsResponse(BaseModel):
|
||||||
ports: List[ExtListPortsBaseResponse]
|
ports: List[PortsResponseBase] = Field(..., description="Ports list")
|
||||||
|
|
||||||
|
|
||||||
class ExtListComputeServicesBaseResponse(BaseModel):
|
class ComputeServicesResponseBase(BaseModel):
|
||||||
id: Optional[str]
|
id: Optional[str] = Field(None, description="Service id")
|
||||||
binary: str
|
binary: str = Field(..., description="Service binary")
|
||||||
disabled_reason: Optional[str]
|
disabled_reason: Optional[str] = Field(None, description="Disabled reason")
|
||||||
host: str
|
host: str = Field(..., description="Host name")
|
||||||
state: Optional[str]
|
state: Optional[str] = Field(None, description="Service state")
|
||||||
status: str
|
status: str = Field(..., description="Service status")
|
||||||
updated_at: Optional[str]
|
updated_at: Optional[str] = Field(None, description="Updated at")
|
||||||
forced_down: Optional[bool]
|
forced_down: Optional[bool] = Field(None, description="Forced down")
|
||||||
zone: Optional[str]
|
zone: Optional[str] = Field(None, description="Zone")
|
||||||
|
|
||||||
|
|
||||||
class ExtListComputeServicesResponse(BaseModel):
|
class ComputeServicesResponse(BaseModel):
|
||||||
services: List[ExtListComputeServicesBaseResponse]
|
services: List[ComputeServicesResponseBase] = Field(..., description="Services list")
|
||||||
|
Loading…
Reference in New Issue
Block a user