diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/__init__.py b/scaleway-async/scaleway_async/qaas/v1alpha1/__init__.py index eb2ff39cb..6e7c77ed7 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/__init__.py @@ -1,9 +1,12 @@ # This file was automatically generated. DO NOT EDIT. # If you have any remark or suggestion do not hesitate to open an issue. from .types import ApplicationType +from .types import BookingStatus +from .content import BOOKING_TRANSIENT_STATUSES from .types import JobStatus from .content import JOB_TRANSIENT_STATUSES from .types import ListApplicationsRequestOrderBy +from .types import ListBookingsRequestOrderBy from .types import ListJobResultsRequestOrderBy from .types import ListJobsRequestOrderBy from .types import ListPlatformsRequestOrderBy @@ -20,9 +23,12 @@ from .types import SessionOriginType from .types import SessionStatus from .content import SESSION_TRANSIENT_STATUSES +from .types import PlatformBookingRequirement from .types import PlatformHardware from .types import JobCircuit +from .types import CreateSessionRequestBookingDemand from .types import Application +from .types import Booking from .types import JobResult from .types import Job from .types import Platform @@ -38,6 +44,7 @@ from .types import DeleteProcessRequest from .types import DeleteSessionRequest from .types import GetApplicationRequest +from .types import GetBookingRequest from .types import GetJobCircuitRequest from .types import GetJobRequest from .types import GetPlatformRequest @@ -45,6 +52,8 @@ from .types import GetSessionRequest from .types import ListApplicationsRequest from .types import ListApplicationsResponse +from .types import ListBookingsRequest +from .types import ListBookingsResponse from .types import ListJobResultsRequest from .types import ListJobResultsResponse from .types import ListJobsRequest @@ -60,6 +69,7 @@ from .types import ListSessionsRequest from .types import ListSessionsResponse from .types import TerminateSessionRequest +from .types import UpdateBookingRequest from .types import UpdateJobRequest from .types import UpdateProcessRequest from .types import UpdateSessionRequest @@ -67,9 +77,12 @@ __all__ = [ "ApplicationType", + "BookingStatus", + "BOOKING_TRANSIENT_STATUSES", "JobStatus", "JOB_TRANSIENT_STATUSES", "ListApplicationsRequestOrderBy", + "ListBookingsRequestOrderBy", "ListJobResultsRequestOrderBy", "ListJobsRequestOrderBy", "ListPlatformsRequestOrderBy", @@ -86,9 +99,12 @@ "SessionOriginType", "SessionStatus", "SESSION_TRANSIENT_STATUSES", + "PlatformBookingRequirement", "PlatformHardware", "JobCircuit", + "CreateSessionRequestBookingDemand", "Application", + "Booking", "JobResult", "Job", "Platform", @@ -104,6 +120,7 @@ "DeleteProcessRequest", "DeleteSessionRequest", "GetApplicationRequest", + "GetBookingRequest", "GetJobCircuitRequest", "GetJobRequest", "GetPlatformRequest", @@ -111,6 +128,8 @@ "GetSessionRequest", "ListApplicationsRequest", "ListApplicationsResponse", + "ListBookingsRequest", + "ListBookingsResponse", "ListJobResultsRequest", "ListJobResultsResponse", "ListJobsRequest", @@ -126,6 +145,7 @@ "ListSessionsRequest", "ListSessionsResponse", "TerminateSessionRequest", + "UpdateBookingRequest", "UpdateJobRequest", "UpdateProcessRequest", "UpdateSessionRequest", diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/api.py b/scaleway-async/scaleway_async/qaas/v1alpha1/api.py index 9e4d25ec2..6d8b70138 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/api.py @@ -15,6 +15,7 @@ from .types import ( ApplicationType, ListApplicationsRequestOrderBy, + ListBookingsRequestOrderBy, ListJobResultsRequestOrderBy, ListJobsRequestOrderBy, ListPlatformsRequestOrderBy, @@ -26,13 +27,16 @@ PlatformType, SessionAccess, Application, + Booking, CreateJobRequest, CreateProcessRequest, CreateSessionRequest, + CreateSessionRequestBookingDemand, Job, JobCircuit, JobResult, ListApplicationsResponse, + ListBookingsResponse, ListJobResultsResponse, ListJobsResponse, ListPlatformsResponse, @@ -44,11 +48,13 @@ Process, ProcessResult, Session, + UpdateBookingRequest, UpdateJobRequest, UpdateProcessRequest, UpdateSessionRequest, ) from .content import ( + BOOKING_TRANSIENT_STATUSES, JOB_TRANSIENT_STATUSES, PROCESS_TRANSIENT_STATUSES, SESSION_TRANSIENT_STATUSES, @@ -56,11 +62,13 @@ from .marshalling import ( unmarshal_JobCircuit, unmarshal_Application, + unmarshal_Booking, unmarshal_Job, unmarshal_Platform, unmarshal_Process, unmarshal_Session, unmarshal_ListApplicationsResponse, + unmarshal_ListBookingsResponse, unmarshal_ListJobResultsResponse, unmarshal_ListJobsResponse, unmarshal_ListPlatformsResponse, @@ -71,6 +79,7 @@ marshal_CreateJobRequest, marshal_CreateProcessRequest, marshal_CreateSessionRequest, + marshal_UpdateBookingRequest, marshal_UpdateJobRequest, marshal_UpdateProcessRequest, marshal_UpdateSessionRequest, @@ -619,7 +628,7 @@ async def get_session( session_id: str, ) -> Session: """ - Get session infrormation. + Get session information. Retrieve information about the provided **session ID**, such as name, status, and number of executed jobs. :param session_id: Unique ID of the session. :return: :class:`Session ` @@ -649,7 +658,7 @@ async def wait_for_session( options: Optional[WaitForOptions[Session, Union[bool, Awaitable[bool]]]] = None, ) -> Session: """ - Get session infrormation. + Get session information. Retrieve information about the provided **session ID**, such as name, status, and number of executed jobs. :param session_id: Unique ID of the session. :return: :class:`Session ` @@ -770,6 +779,7 @@ async def create_session( max_duration: Optional[str] = None, tags: Optional[List[str]] = None, deduplication_id: Optional[str] = None, + booking_demand: Optional[CreateSessionRequestBookingDemand] = None, ) -> Session: """ Create a session. @@ -781,6 +791,7 @@ async def create_session( :param max_duration: Maximum duration before the session ends. :param tags: Tags of the session. :param deduplication_id: Deduplication ID of the session. + :param booking_demand: A booking demand to schedule the session, only applicable if the platform is bookable. :return: :class:`Session ` Usage: @@ -803,6 +814,7 @@ async def create_session( max_duration=max_duration, tags=tags, deduplication_id=deduplication_id, + booking_demand=booking_demand, ), self.client, ), @@ -865,7 +877,7 @@ async def terminate_session( ) -> Session: """ Terminate an existing session. - Terminate a session by its unique ID and cancel all its attached jobs. + Terminate a session by its unique ID and cancel all its attached jobs and booking. :param session_id: Unique ID of the session. :return: :class:`Session ` @@ -895,7 +907,7 @@ async def delete_session( ) -> None: """ Delete an existing session. - Delete a session by its unique ID and delete all its attached jobs. + Delete a session by its unique ID and delete all its attached job and booking. :param session_id: Unique ID of the session. Usage: @@ -1042,7 +1054,7 @@ async def get_process( process_id: str, ) -> Process: """ - Get process infrormation. + Get process information. Retrieve information about the provided **process ID**, such as name, status and progress. :param process_id: Unique ID of the process. :return: :class:`Process ` @@ -1072,7 +1084,7 @@ async def wait_for_process( options: Optional[WaitForOptions[Process, Union[bool, Awaitable[bool]]]] = None, ) -> Process: """ - Get process infrormation. + Get process information. Retrieve information about the provided **process ID**, such as name, status and progress. :param process_id: Unique ID of the process. :return: :class:`Process ` @@ -1464,3 +1476,182 @@ async def list_applications_all( "order_by": order_by, }, ) + + async def get_booking( + self, + *, + booking_id: str, + ) -> Booking: + """ + Get booking information. + Retrieve information about the provided **booking ID**, such as description, status and progress message. + :param booking_id: Unique ID of the booking. + :return: :class:`Booking ` + + Usage: + :: + + result = await api.get_booking( + booking_id="example", + ) + """ + + param_booking_id = validate_path_param("booking_id", booking_id) + + res = self._request( + "GET", + f"/qaas/v1alpha1/bookings/{param_booking_id}", + ) + + self._throw_on_error(res) + return unmarshal_Booking(res.json()) + + async def wait_for_booking( + self, + *, + booking_id: str, + options: Optional[WaitForOptions[Booking, Union[bool, Awaitable[bool]]]] = None, + ) -> Booking: + """ + Get booking information. + Retrieve information about the provided **booking ID**, such as description, status and progress message. + :param booking_id: Unique ID of the booking. + :return: :class:`Booking ` + + Usage: + :: + + result = await api.get_booking( + booking_id="example", + ) + """ + + if not options: + options = WaitForOptions() + + if not options.stop: + options.stop = lambda res: res.status not in BOOKING_TRANSIENT_STATUSES + + return await wait_for_resource_async( + fetcher=self.get_booking, + options=options, + args={ + "booking_id": booking_id, + }, + ) + + async def list_bookings( + self, + *, + project_id: Optional[str] = None, + platform_id: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListBookingsRequestOrderBy] = None, + ) -> ListBookingsResponse: + """ + List all bookings according the filter. + Retrieve information about all bookings of the provided **project ID** or ** platform ID**. + :param project_id: List bookings belonging to this project ID. + :param platform_id: List bookings attached to this platform ID. + :param page: Page number. + :param page_size: Maximum number of results to return per page. + :param order_by: Sort order of the returned results. + :return: :class:`ListBookingsResponse ` + + Usage: + :: + + result = await api.list_bookings() + """ + + res = self._request( + "GET", + "/qaas/v1alpha1/bookings", + params={ + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + "platform_id": platform_id, + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListBookingsResponse(res.json()) + + async def list_bookings_all( + self, + *, + project_id: Optional[str] = None, + platform_id: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListBookingsRequestOrderBy] = None, + ) -> List[Booking]: + """ + List all bookings according the filter. + Retrieve information about all bookings of the provided **project ID** or ** platform ID**. + :param project_id: List bookings belonging to this project ID. + :param platform_id: List bookings attached to this platform ID. + :param page: Page number. + :param page_size: Maximum number of results to return per page. + :param order_by: Sort order of the returned results. + :return: :class:`List[Booking] ` + + Usage: + :: + + result = await api.list_bookings_all() + """ + + return await fetch_all_pages_async( + type=ListBookingsResponse, + key="bookings", + fetcher=self.list_bookings, + args={ + "project_id": project_id, + "platform_id": platform_id, + "page": page, + "page_size": page_size, + "order_by": order_by, + }, + ) + + async def update_booking( + self, + *, + booking_id: str, + description: Optional[str] = None, + ) -> Booking: + """ + Update booking information. + Update booking information of the provided **booking ID**. + :param booking_id: Unique ID of the booking. + :param description: Description of the booking slot. + :return: :class:`Booking ` + + Usage: + :: + + result = await api.update_booking( + booking_id="example", + ) + """ + + param_booking_id = validate_path_param("booking_id", booking_id) + + res = self._request( + "PATCH", + f"/qaas/v1alpha1/bookings/{param_booking_id}", + body=marshal_UpdateBookingRequest( + UpdateBookingRequest( + booking_id=booking_id, + description=description, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_Booking(res.json()) diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/content.py b/scaleway-async/scaleway_async/qaas/v1alpha1/content.py index 5f38325d9..545894175 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/content.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/content.py @@ -3,11 +3,20 @@ from typing import List from .types import ( + BookingStatus, JobStatus, ProcessStatus, SessionStatus, ) +BOOKING_TRANSIENT_STATUSES: List[BookingStatus] = [ + BookingStatus.WAITING, + BookingStatus.VALIDATING, + BookingStatus.CANCELLING, +] +""" +Lists transient statutes of the enum :class:`BookingStatus `. +""" JOB_TRANSIENT_STATUSES: List[JobStatus] = [ JobStatus.WAITING, JobStatus.RUNNING, diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/qaas/v1alpha1/marshalling.py index e8ad932fd..e9c93d251 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/marshalling.py @@ -16,12 +16,15 @@ SessionAccess, JobCircuit, Application, + Booking, Job, + PlatformBookingRequirement, PlatformHardware, Platform, Process, Session, ListApplicationsResponse, + ListBookingsResponse, JobResult, ListJobResultsResponse, ListJobsResponse, @@ -33,7 +36,9 @@ ListSessionsResponse, CreateJobRequest, CreateProcessRequest, + CreateSessionRequestBookingDemand, CreateSessionRequest, + UpdateBookingRequest, UpdateJobRequest, UpdateProcessRequest, UpdateSessionRequest, @@ -94,6 +99,59 @@ def unmarshal_Application(data: Any) -> Application: return Application(**args) +def unmarshal_Booking(data: Any) -> Booking: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Booking' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + + field = data.get("status", None) + if field is not None: + args["status"] = field + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("progress_message", None) + if field is not None: + args["progress_message"] = field + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("started_at", None) + if field is not None: + args["started_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["started_at"] = None + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + field = data.get("finished_at", None) + if field is not None: + args["finished_at"] = ( + parser.isoparse(field) if isinstance(field, str) else field + ) + else: + args["finished_at"] = None + + return Booking(**args) + + def unmarshal_Job(data: Any) -> Job: if not isinstance(data, dict): raise TypeError( @@ -163,6 +221,41 @@ def unmarshal_Job(data: Any) -> Job: return Job(**args) +def unmarshal_PlatformBookingRequirement(data: Any) -> PlatformBookingRequirement: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PlatformBookingRequirement' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("min_duration", None) + if field is not None: + args["min_duration"] = field + else: + args["min_duration"] = None + + field = data.get("max_duration", None) + if field is not None: + args["max_duration"] = field + else: + args["max_duration"] = None + + field = data.get("max_cancellation_duration", None) + if field is not None: + args["max_cancellation_duration"] = field + else: + args["max_cancellation_duration"] = None + + field = data.get("max_planification_duration", None) + if field is not None: + args["max_planification_duration"] = field + else: + args["max_planification_duration"] = None + + return PlatformBookingRequirement(**args) + + def unmarshal_PlatformHardware(data: Any) -> PlatformHardware: if not isinstance(data, dict): raise TypeError( @@ -254,6 +347,18 @@ def unmarshal_Platform(data: Any) -> Platform: if field is not None: args["metadata"] = field + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("documentation_url", None) + if field is not None: + args["documentation_url"] = field + + field = data.get("is_bookable", None) + if field is not None: + args["is_bookable"] = field + field = data.get("price_per_hour", None) if field is not None: args["price_per_hour"] = unmarshal_Money(field) @@ -278,6 +383,12 @@ def unmarshal_Platform(data: Any) -> Platform: else: args["hardware"] = None + field = data.get("booking_requirement", None) + if field is not None: + args["booking_requirement"] = unmarshal_PlatformBookingRequirement(field) + else: + args["booking_requirement"] = None + return Platform(**args) @@ -472,6 +583,12 @@ def unmarshal_Session(data: Any) -> Session: else: args["progress_message"] = None + field = data.get("booking_id", None) + if field is not None: + args["booking_id"] = field + else: + args["booking_id"] = None + return Session(**args) @@ -496,6 +613,27 @@ def unmarshal_ListApplicationsResponse(data: Any) -> ListApplicationsResponse: return ListApplicationsResponse(**args) +def unmarshal_ListBookingsResponse(data: Any) -> ListBookingsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListBookingsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + + field = data.get("bookings", None) + if field is not None: + args["bookings"] = ( + [unmarshal_Booking(v) for v in field] if field is not None else None + ) + + return ListBookingsResponse(**args) + + def unmarshal_JobResult(data: Any) -> JobResult: if not isinstance(data, dict): raise TypeError( @@ -765,6 +903,24 @@ def marshal_CreateProcessRequest( return output +def marshal_CreateSessionRequestBookingDemand( + request: CreateSessionRequestBookingDemand, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.started_at is not None: + output["started_at"] = request.started_at.isoformat() + + if request.finished_at is not None: + output["finished_at"] = request.finished_at.isoformat() + + if request.description is not None: + output["description"] = request.description + + return output + + def marshal_CreateSessionRequest( request: CreateSessionRequest, defaults: ProfileDefaults, @@ -792,6 +948,23 @@ def marshal_CreateSessionRequest( if request.deduplication_id is not None: output["deduplication_id"] = request.deduplication_id + if request.booking_demand is not None: + output["booking_demand"] = marshal_CreateSessionRequestBookingDemand( + request.booking_demand, defaults + ) + + return output + + +def marshal_UpdateBookingRequest( + request: UpdateBookingRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.description is not None: + output["description"] = request.description + return output diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/types.py b/scaleway-async/scaleway_async/qaas/v1alpha1/types.py index ccb14a047..f0157bba2 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/types.py @@ -23,6 +23,19 @@ def __str__(self) -> str: return str(self.value) +class BookingStatus(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_STATUS = "unknown_status" + WAITING = "waiting" + VALIDATING = "validating" + VALIDATED = "validated" + CANCELLING = "cancelling" + CANCELLED = "cancelled" + ERROR = "error" + + def __str__(self) -> str: + return str(self.value) + + class JobStatus(str, Enum, metaclass=StrEnumMeta): UNKNOWN_STATUS = "unknown_status" WAITING = "waiting" @@ -46,6 +59,16 @@ def __str__(self) -> str: return str(self.value) +class ListBookingsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_DESC = "created_at_desc" + CREATED_AT_ASC = "created_at_asc" + STARTED_AT_DESC = "started_at_desc" + STARTED_AT_ASC = "started_at_asc" + + def __str__(self) -> str: + return str(self.value) + + class ListJobResultsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): CREATED_AT_DESC = "created_at_desc" CREATED_AT_ASC = "created_at_asc" @@ -147,6 +170,7 @@ class PlatformTechnology(str, Enum, metaclass=StrEnumMeta): GENERAL_PURPOSE = "general_purpose" TRAPPED_ION = "trapped_ion" SUPERCONDUCTING = "superconducting" + NEUTRAL_ATOM = "neutral_atom" def __str__(self) -> str: return str(self.value) @@ -208,6 +232,29 @@ def __str__(self) -> str: return str(self.value) +@dataclass +class PlatformBookingRequirement: + min_duration: Optional[str] + """ + Minimal duration of any booking based on this platform. + """ + + max_duration: Optional[str] + """ + Maximal duration of any bookings based on this platform. + """ + + max_cancellation_duration: Optional[str] + """ + Allowed time to cancel a booking attached to this platform before the beginning of the session. + """ + + max_planification_duration: Optional[str] + """ + Allowed planification time from now where the platform can be booked in the future. + """ + + @dataclass class PlatformHardware: name: str @@ -248,6 +295,15 @@ class JobCircuit: qiskit_circuit: Optional[str] +@dataclass +class CreateSessionRequestBookingDemand: + started_at: Optional[datetime] + + finished_at: Optional[datetime] + + description: Optional[str] + + @dataclass class Application: id: str @@ -276,6 +332,49 @@ class Application: """ +@dataclass +class Booking: + id: str + """ + Unique ID of the booking. + """ + + status: BookingStatus + """ + Status of the booking. + """ + + description: str + """ + Description of the booking slot. + """ + + progress_message: str + """ + Any progress message of the booking. + """ + + created_at: Optional[datetime] + """ + Time at which the booking was created. + """ + + started_at: Optional[datetime] + """ + Time at which the booking starts. + """ + + updated_at: Optional[datetime] + """ + Time at which the booking was updated. + """ + + finished_at: Optional[datetime] + """ + Time at which the booking finishes. + """ + + @dataclass class JobResult: job_id: str @@ -419,6 +518,21 @@ class Platform: Metadata provided by the platform. """ + description: str + """ + English description of the platform. + """ + + documentation_url: str + """ + Documentation link to external documentation to learn more on this platform. + """ + + is_bookable: bool + """ + Specify if the platform is bookable. + """ + price_per_hour: Optional[Money] """ Price to be paid per hour (excluding free tiers). @@ -439,6 +553,11 @@ class Platform: Specifications of the underlying hardware. """ + booking_requirement: Optional[PlatformBookingRequirement] + """ + Booking constraints to fit if the platform is bookable. + """ + @dataclass class ProcessResult: @@ -502,7 +621,7 @@ class Process: created_at: Optional[datetime] """ - Tme at which the process was created. + Time at which the process was created. """ started_at: Optional[datetime] @@ -628,6 +747,11 @@ class Session: Any progress of the session. """ + booking_id: Optional[str] + """ + An optional booking unique ID of an attached booking. + """ + @dataclass class CancelJobRequest: @@ -743,6 +867,11 @@ class CreateSessionRequest: Deduplication ID of the session. """ + booking_demand: Optional[CreateSessionRequestBookingDemand] + """ + A booking demand to schedule the session, only applicable if the platform is bookable. + """ + @dataclass class DeleteJobRequest: @@ -776,6 +905,14 @@ class GetApplicationRequest: """ +@dataclass +class GetBookingRequest: + booking_id: str + """ + Unique ID of the booking. + """ + + @dataclass class GetJobCircuitRequest: job_id: str @@ -857,6 +994,47 @@ class ListApplicationsResponse: """ +@dataclass +class ListBookingsRequest: + project_id: Optional[str] + """ + List bookings belonging to this project ID. + """ + + platform_id: Optional[str] + """ + List bookings attached to this platform ID. + """ + + page: Optional[int] + """ + Page number. + """ + + page_size: Optional[int] + """ + Maximum number of results to return per page. + """ + + order_by: Optional[ListBookingsRequestOrderBy] + """ + Sort order of the returned results. + """ + + +@dataclass +class ListBookingsResponse: + total_count: int + """ + Total number of bookings. + """ + + bookings: List[Booking] + """ + List of bookings. + """ + + @dataclass class ListJobResultsRequest: job_id: str @@ -1143,6 +1321,19 @@ class TerminateSessionRequest: """ +@dataclass +class UpdateBookingRequest: + booking_id: str + """ + Unique ID of the booking. + """ + + description: Optional[str] + """ + Description of the booking slot. + """ + + @dataclass class UpdateJobRequest: job_id: str diff --git a/scaleway/scaleway/qaas/v1alpha1/__init__.py b/scaleway/scaleway/qaas/v1alpha1/__init__.py index eb2ff39cb..6e7c77ed7 100644 --- a/scaleway/scaleway/qaas/v1alpha1/__init__.py +++ b/scaleway/scaleway/qaas/v1alpha1/__init__.py @@ -1,9 +1,12 @@ # This file was automatically generated. DO NOT EDIT. # If you have any remark or suggestion do not hesitate to open an issue. from .types import ApplicationType +from .types import BookingStatus +from .content import BOOKING_TRANSIENT_STATUSES from .types import JobStatus from .content import JOB_TRANSIENT_STATUSES from .types import ListApplicationsRequestOrderBy +from .types import ListBookingsRequestOrderBy from .types import ListJobResultsRequestOrderBy from .types import ListJobsRequestOrderBy from .types import ListPlatformsRequestOrderBy @@ -20,9 +23,12 @@ from .types import SessionOriginType from .types import SessionStatus from .content import SESSION_TRANSIENT_STATUSES +from .types import PlatformBookingRequirement from .types import PlatformHardware from .types import JobCircuit +from .types import CreateSessionRequestBookingDemand from .types import Application +from .types import Booking from .types import JobResult from .types import Job from .types import Platform @@ -38,6 +44,7 @@ from .types import DeleteProcessRequest from .types import DeleteSessionRequest from .types import GetApplicationRequest +from .types import GetBookingRequest from .types import GetJobCircuitRequest from .types import GetJobRequest from .types import GetPlatformRequest @@ -45,6 +52,8 @@ from .types import GetSessionRequest from .types import ListApplicationsRequest from .types import ListApplicationsResponse +from .types import ListBookingsRequest +from .types import ListBookingsResponse from .types import ListJobResultsRequest from .types import ListJobResultsResponse from .types import ListJobsRequest @@ -60,6 +69,7 @@ from .types import ListSessionsRequest from .types import ListSessionsResponse from .types import TerminateSessionRequest +from .types import UpdateBookingRequest from .types import UpdateJobRequest from .types import UpdateProcessRequest from .types import UpdateSessionRequest @@ -67,9 +77,12 @@ __all__ = [ "ApplicationType", + "BookingStatus", + "BOOKING_TRANSIENT_STATUSES", "JobStatus", "JOB_TRANSIENT_STATUSES", "ListApplicationsRequestOrderBy", + "ListBookingsRequestOrderBy", "ListJobResultsRequestOrderBy", "ListJobsRequestOrderBy", "ListPlatformsRequestOrderBy", @@ -86,9 +99,12 @@ "SessionOriginType", "SessionStatus", "SESSION_TRANSIENT_STATUSES", + "PlatformBookingRequirement", "PlatformHardware", "JobCircuit", + "CreateSessionRequestBookingDemand", "Application", + "Booking", "JobResult", "Job", "Platform", @@ -104,6 +120,7 @@ "DeleteProcessRequest", "DeleteSessionRequest", "GetApplicationRequest", + "GetBookingRequest", "GetJobCircuitRequest", "GetJobRequest", "GetPlatformRequest", @@ -111,6 +128,8 @@ "GetSessionRequest", "ListApplicationsRequest", "ListApplicationsResponse", + "ListBookingsRequest", + "ListBookingsResponse", "ListJobResultsRequest", "ListJobResultsResponse", "ListJobsRequest", @@ -126,6 +145,7 @@ "ListSessionsRequest", "ListSessionsResponse", "TerminateSessionRequest", + "UpdateBookingRequest", "UpdateJobRequest", "UpdateProcessRequest", "UpdateSessionRequest", diff --git a/scaleway/scaleway/qaas/v1alpha1/api.py b/scaleway/scaleway/qaas/v1alpha1/api.py index e83bb033e..f750854c7 100644 --- a/scaleway/scaleway/qaas/v1alpha1/api.py +++ b/scaleway/scaleway/qaas/v1alpha1/api.py @@ -15,6 +15,7 @@ from .types import ( ApplicationType, ListApplicationsRequestOrderBy, + ListBookingsRequestOrderBy, ListJobResultsRequestOrderBy, ListJobsRequestOrderBy, ListPlatformsRequestOrderBy, @@ -26,13 +27,16 @@ PlatformType, SessionAccess, Application, + Booking, CreateJobRequest, CreateProcessRequest, CreateSessionRequest, + CreateSessionRequestBookingDemand, Job, JobCircuit, JobResult, ListApplicationsResponse, + ListBookingsResponse, ListJobResultsResponse, ListJobsResponse, ListPlatformsResponse, @@ -44,11 +48,13 @@ Process, ProcessResult, Session, + UpdateBookingRequest, UpdateJobRequest, UpdateProcessRequest, UpdateSessionRequest, ) from .content import ( + BOOKING_TRANSIENT_STATUSES, JOB_TRANSIENT_STATUSES, PROCESS_TRANSIENT_STATUSES, SESSION_TRANSIENT_STATUSES, @@ -56,11 +62,13 @@ from .marshalling import ( unmarshal_JobCircuit, unmarshal_Application, + unmarshal_Booking, unmarshal_Job, unmarshal_Platform, unmarshal_Process, unmarshal_Session, unmarshal_ListApplicationsResponse, + unmarshal_ListBookingsResponse, unmarshal_ListJobResultsResponse, unmarshal_ListJobsResponse, unmarshal_ListPlatformsResponse, @@ -71,6 +79,7 @@ marshal_CreateJobRequest, marshal_CreateProcessRequest, marshal_CreateSessionRequest, + marshal_UpdateBookingRequest, marshal_UpdateJobRequest, marshal_UpdateProcessRequest, marshal_UpdateSessionRequest, @@ -619,7 +628,7 @@ def get_session( session_id: str, ) -> Session: """ - Get session infrormation. + Get session information. Retrieve information about the provided **session ID**, such as name, status, and number of executed jobs. :param session_id: Unique ID of the session. :return: :class:`Session ` @@ -649,7 +658,7 @@ def wait_for_session( options: Optional[WaitForOptions[Session, bool]] = None, ) -> Session: """ - Get session infrormation. + Get session information. Retrieve information about the provided **session ID**, such as name, status, and number of executed jobs. :param session_id: Unique ID of the session. :return: :class:`Session ` @@ -770,6 +779,7 @@ def create_session( max_duration: Optional[str] = None, tags: Optional[List[str]] = None, deduplication_id: Optional[str] = None, + booking_demand: Optional[CreateSessionRequestBookingDemand] = None, ) -> Session: """ Create a session. @@ -781,6 +791,7 @@ def create_session( :param max_duration: Maximum duration before the session ends. :param tags: Tags of the session. :param deduplication_id: Deduplication ID of the session. + :param booking_demand: A booking demand to schedule the session, only applicable if the platform is bookable. :return: :class:`Session ` Usage: @@ -803,6 +814,7 @@ def create_session( max_duration=max_duration, tags=tags, deduplication_id=deduplication_id, + booking_demand=booking_demand, ), self.client, ), @@ -865,7 +877,7 @@ def terminate_session( ) -> Session: """ Terminate an existing session. - Terminate a session by its unique ID and cancel all its attached jobs. + Terminate a session by its unique ID and cancel all its attached jobs and booking. :param session_id: Unique ID of the session. :return: :class:`Session ` @@ -895,7 +907,7 @@ def delete_session( ) -> None: """ Delete an existing session. - Delete a session by its unique ID and delete all its attached jobs. + Delete a session by its unique ID and delete all its attached job and booking. :param session_id: Unique ID of the session. Usage: @@ -1042,7 +1054,7 @@ def get_process( process_id: str, ) -> Process: """ - Get process infrormation. + Get process information. Retrieve information about the provided **process ID**, such as name, status and progress. :param process_id: Unique ID of the process. :return: :class:`Process ` @@ -1072,7 +1084,7 @@ def wait_for_process( options: Optional[WaitForOptions[Process, bool]] = None, ) -> Process: """ - Get process infrormation. + Get process information. Retrieve information about the provided **process ID**, such as name, status and progress. :param process_id: Unique ID of the process. :return: :class:`Process ` @@ -1464,3 +1476,182 @@ def list_applications_all( "order_by": order_by, }, ) + + def get_booking( + self, + *, + booking_id: str, + ) -> Booking: + """ + Get booking information. + Retrieve information about the provided **booking ID**, such as description, status and progress message. + :param booking_id: Unique ID of the booking. + :return: :class:`Booking ` + + Usage: + :: + + result = api.get_booking( + booking_id="example", + ) + """ + + param_booking_id = validate_path_param("booking_id", booking_id) + + res = self._request( + "GET", + f"/qaas/v1alpha1/bookings/{param_booking_id}", + ) + + self._throw_on_error(res) + return unmarshal_Booking(res.json()) + + def wait_for_booking( + self, + *, + booking_id: str, + options: Optional[WaitForOptions[Booking, bool]] = None, + ) -> Booking: + """ + Get booking information. + Retrieve information about the provided **booking ID**, such as description, status and progress message. + :param booking_id: Unique ID of the booking. + :return: :class:`Booking ` + + Usage: + :: + + result = api.get_booking( + booking_id="example", + ) + """ + + if not options: + options = WaitForOptions() + + if not options.stop: + options.stop = lambda res: res.status not in BOOKING_TRANSIENT_STATUSES + + return wait_for_resource( + fetcher=self.get_booking, + options=options, + args={ + "booking_id": booking_id, + }, + ) + + def list_bookings( + self, + *, + project_id: Optional[str] = None, + platform_id: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListBookingsRequestOrderBy] = None, + ) -> ListBookingsResponse: + """ + List all bookings according the filter. + Retrieve information about all bookings of the provided **project ID** or ** platform ID**. + :param project_id: List bookings belonging to this project ID. + :param platform_id: List bookings attached to this platform ID. + :param page: Page number. + :param page_size: Maximum number of results to return per page. + :param order_by: Sort order of the returned results. + :return: :class:`ListBookingsResponse ` + + Usage: + :: + + result = api.list_bookings() + """ + + res = self._request( + "GET", + "/qaas/v1alpha1/bookings", + params={ + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + "platform_id": platform_id, + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListBookingsResponse(res.json()) + + def list_bookings_all( + self, + *, + project_id: Optional[str] = None, + platform_id: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListBookingsRequestOrderBy] = None, + ) -> List[Booking]: + """ + List all bookings according the filter. + Retrieve information about all bookings of the provided **project ID** or ** platform ID**. + :param project_id: List bookings belonging to this project ID. + :param platform_id: List bookings attached to this platform ID. + :param page: Page number. + :param page_size: Maximum number of results to return per page. + :param order_by: Sort order of the returned results. + :return: :class:`List[Booking] ` + + Usage: + :: + + result = api.list_bookings_all() + """ + + return fetch_all_pages( + type=ListBookingsResponse, + key="bookings", + fetcher=self.list_bookings, + args={ + "project_id": project_id, + "platform_id": platform_id, + "page": page, + "page_size": page_size, + "order_by": order_by, + }, + ) + + def update_booking( + self, + *, + booking_id: str, + description: Optional[str] = None, + ) -> Booking: + """ + Update booking information. + Update booking information of the provided **booking ID**. + :param booking_id: Unique ID of the booking. + :param description: Description of the booking slot. + :return: :class:`Booking ` + + Usage: + :: + + result = api.update_booking( + booking_id="example", + ) + """ + + param_booking_id = validate_path_param("booking_id", booking_id) + + res = self._request( + "PATCH", + f"/qaas/v1alpha1/bookings/{param_booking_id}", + body=marshal_UpdateBookingRequest( + UpdateBookingRequest( + booking_id=booking_id, + description=description, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_Booking(res.json()) diff --git a/scaleway/scaleway/qaas/v1alpha1/content.py b/scaleway/scaleway/qaas/v1alpha1/content.py index 5f38325d9..545894175 100644 --- a/scaleway/scaleway/qaas/v1alpha1/content.py +++ b/scaleway/scaleway/qaas/v1alpha1/content.py @@ -3,11 +3,20 @@ from typing import List from .types import ( + BookingStatus, JobStatus, ProcessStatus, SessionStatus, ) +BOOKING_TRANSIENT_STATUSES: List[BookingStatus] = [ + BookingStatus.WAITING, + BookingStatus.VALIDATING, + BookingStatus.CANCELLING, +] +""" +Lists transient statutes of the enum :class:`BookingStatus `. +""" JOB_TRANSIENT_STATUSES: List[JobStatus] = [ JobStatus.WAITING, JobStatus.RUNNING, diff --git a/scaleway/scaleway/qaas/v1alpha1/marshalling.py b/scaleway/scaleway/qaas/v1alpha1/marshalling.py index e8ad932fd..e9c93d251 100644 --- a/scaleway/scaleway/qaas/v1alpha1/marshalling.py +++ b/scaleway/scaleway/qaas/v1alpha1/marshalling.py @@ -16,12 +16,15 @@ SessionAccess, JobCircuit, Application, + Booking, Job, + PlatformBookingRequirement, PlatformHardware, Platform, Process, Session, ListApplicationsResponse, + ListBookingsResponse, JobResult, ListJobResultsResponse, ListJobsResponse, @@ -33,7 +36,9 @@ ListSessionsResponse, CreateJobRequest, CreateProcessRequest, + CreateSessionRequestBookingDemand, CreateSessionRequest, + UpdateBookingRequest, UpdateJobRequest, UpdateProcessRequest, UpdateSessionRequest, @@ -94,6 +99,59 @@ def unmarshal_Application(data: Any) -> Application: return Application(**args) +def unmarshal_Booking(data: Any) -> Booking: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Booking' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + + field = data.get("status", None) + if field is not None: + args["status"] = field + + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("progress_message", None) + if field is not None: + args["progress_message"] = field + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("started_at", None) + if field is not None: + args["started_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["started_at"] = None + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + field = data.get("finished_at", None) + if field is not None: + args["finished_at"] = ( + parser.isoparse(field) if isinstance(field, str) else field + ) + else: + args["finished_at"] = None + + return Booking(**args) + + def unmarshal_Job(data: Any) -> Job: if not isinstance(data, dict): raise TypeError( @@ -163,6 +221,41 @@ def unmarshal_Job(data: Any) -> Job: return Job(**args) +def unmarshal_PlatformBookingRequirement(data: Any) -> PlatformBookingRequirement: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PlatformBookingRequirement' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("min_duration", None) + if field is not None: + args["min_duration"] = field + else: + args["min_duration"] = None + + field = data.get("max_duration", None) + if field is not None: + args["max_duration"] = field + else: + args["max_duration"] = None + + field = data.get("max_cancellation_duration", None) + if field is not None: + args["max_cancellation_duration"] = field + else: + args["max_cancellation_duration"] = None + + field = data.get("max_planification_duration", None) + if field is not None: + args["max_planification_duration"] = field + else: + args["max_planification_duration"] = None + + return PlatformBookingRequirement(**args) + + def unmarshal_PlatformHardware(data: Any) -> PlatformHardware: if not isinstance(data, dict): raise TypeError( @@ -254,6 +347,18 @@ def unmarshal_Platform(data: Any) -> Platform: if field is not None: args["metadata"] = field + field = data.get("description", None) + if field is not None: + args["description"] = field + + field = data.get("documentation_url", None) + if field is not None: + args["documentation_url"] = field + + field = data.get("is_bookable", None) + if field is not None: + args["is_bookable"] = field + field = data.get("price_per_hour", None) if field is not None: args["price_per_hour"] = unmarshal_Money(field) @@ -278,6 +383,12 @@ def unmarshal_Platform(data: Any) -> Platform: else: args["hardware"] = None + field = data.get("booking_requirement", None) + if field is not None: + args["booking_requirement"] = unmarshal_PlatformBookingRequirement(field) + else: + args["booking_requirement"] = None + return Platform(**args) @@ -472,6 +583,12 @@ def unmarshal_Session(data: Any) -> Session: else: args["progress_message"] = None + field = data.get("booking_id", None) + if field is not None: + args["booking_id"] = field + else: + args["booking_id"] = None + return Session(**args) @@ -496,6 +613,27 @@ def unmarshal_ListApplicationsResponse(data: Any) -> ListApplicationsResponse: return ListApplicationsResponse(**args) +def unmarshal_ListBookingsResponse(data: Any) -> ListBookingsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListBookingsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + + field = data.get("bookings", None) + if field is not None: + args["bookings"] = ( + [unmarshal_Booking(v) for v in field] if field is not None else None + ) + + return ListBookingsResponse(**args) + + def unmarshal_JobResult(data: Any) -> JobResult: if not isinstance(data, dict): raise TypeError( @@ -765,6 +903,24 @@ def marshal_CreateProcessRequest( return output +def marshal_CreateSessionRequestBookingDemand( + request: CreateSessionRequestBookingDemand, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.started_at is not None: + output["started_at"] = request.started_at.isoformat() + + if request.finished_at is not None: + output["finished_at"] = request.finished_at.isoformat() + + if request.description is not None: + output["description"] = request.description + + return output + + def marshal_CreateSessionRequest( request: CreateSessionRequest, defaults: ProfileDefaults, @@ -792,6 +948,23 @@ def marshal_CreateSessionRequest( if request.deduplication_id is not None: output["deduplication_id"] = request.deduplication_id + if request.booking_demand is not None: + output["booking_demand"] = marshal_CreateSessionRequestBookingDemand( + request.booking_demand, defaults + ) + + return output + + +def marshal_UpdateBookingRequest( + request: UpdateBookingRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.description is not None: + output["description"] = request.description + return output diff --git a/scaleway/scaleway/qaas/v1alpha1/types.py b/scaleway/scaleway/qaas/v1alpha1/types.py index ccb14a047..f0157bba2 100644 --- a/scaleway/scaleway/qaas/v1alpha1/types.py +++ b/scaleway/scaleway/qaas/v1alpha1/types.py @@ -23,6 +23,19 @@ def __str__(self) -> str: return str(self.value) +class BookingStatus(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_STATUS = "unknown_status" + WAITING = "waiting" + VALIDATING = "validating" + VALIDATED = "validated" + CANCELLING = "cancelling" + CANCELLED = "cancelled" + ERROR = "error" + + def __str__(self) -> str: + return str(self.value) + + class JobStatus(str, Enum, metaclass=StrEnumMeta): UNKNOWN_STATUS = "unknown_status" WAITING = "waiting" @@ -46,6 +59,16 @@ def __str__(self) -> str: return str(self.value) +class ListBookingsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_DESC = "created_at_desc" + CREATED_AT_ASC = "created_at_asc" + STARTED_AT_DESC = "started_at_desc" + STARTED_AT_ASC = "started_at_asc" + + def __str__(self) -> str: + return str(self.value) + + class ListJobResultsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): CREATED_AT_DESC = "created_at_desc" CREATED_AT_ASC = "created_at_asc" @@ -147,6 +170,7 @@ class PlatformTechnology(str, Enum, metaclass=StrEnumMeta): GENERAL_PURPOSE = "general_purpose" TRAPPED_ION = "trapped_ion" SUPERCONDUCTING = "superconducting" + NEUTRAL_ATOM = "neutral_atom" def __str__(self) -> str: return str(self.value) @@ -208,6 +232,29 @@ def __str__(self) -> str: return str(self.value) +@dataclass +class PlatformBookingRequirement: + min_duration: Optional[str] + """ + Minimal duration of any booking based on this platform. + """ + + max_duration: Optional[str] + """ + Maximal duration of any bookings based on this platform. + """ + + max_cancellation_duration: Optional[str] + """ + Allowed time to cancel a booking attached to this platform before the beginning of the session. + """ + + max_planification_duration: Optional[str] + """ + Allowed planification time from now where the platform can be booked in the future. + """ + + @dataclass class PlatformHardware: name: str @@ -248,6 +295,15 @@ class JobCircuit: qiskit_circuit: Optional[str] +@dataclass +class CreateSessionRequestBookingDemand: + started_at: Optional[datetime] + + finished_at: Optional[datetime] + + description: Optional[str] + + @dataclass class Application: id: str @@ -276,6 +332,49 @@ class Application: """ +@dataclass +class Booking: + id: str + """ + Unique ID of the booking. + """ + + status: BookingStatus + """ + Status of the booking. + """ + + description: str + """ + Description of the booking slot. + """ + + progress_message: str + """ + Any progress message of the booking. + """ + + created_at: Optional[datetime] + """ + Time at which the booking was created. + """ + + started_at: Optional[datetime] + """ + Time at which the booking starts. + """ + + updated_at: Optional[datetime] + """ + Time at which the booking was updated. + """ + + finished_at: Optional[datetime] + """ + Time at which the booking finishes. + """ + + @dataclass class JobResult: job_id: str @@ -419,6 +518,21 @@ class Platform: Metadata provided by the platform. """ + description: str + """ + English description of the platform. + """ + + documentation_url: str + """ + Documentation link to external documentation to learn more on this platform. + """ + + is_bookable: bool + """ + Specify if the platform is bookable. + """ + price_per_hour: Optional[Money] """ Price to be paid per hour (excluding free tiers). @@ -439,6 +553,11 @@ class Platform: Specifications of the underlying hardware. """ + booking_requirement: Optional[PlatformBookingRequirement] + """ + Booking constraints to fit if the platform is bookable. + """ + @dataclass class ProcessResult: @@ -502,7 +621,7 @@ class Process: created_at: Optional[datetime] """ - Tme at which the process was created. + Time at which the process was created. """ started_at: Optional[datetime] @@ -628,6 +747,11 @@ class Session: Any progress of the session. """ + booking_id: Optional[str] + """ + An optional booking unique ID of an attached booking. + """ + @dataclass class CancelJobRequest: @@ -743,6 +867,11 @@ class CreateSessionRequest: Deduplication ID of the session. """ + booking_demand: Optional[CreateSessionRequestBookingDemand] + """ + A booking demand to schedule the session, only applicable if the platform is bookable. + """ + @dataclass class DeleteJobRequest: @@ -776,6 +905,14 @@ class GetApplicationRequest: """ +@dataclass +class GetBookingRequest: + booking_id: str + """ + Unique ID of the booking. + """ + + @dataclass class GetJobCircuitRequest: job_id: str @@ -857,6 +994,47 @@ class ListApplicationsResponse: """ +@dataclass +class ListBookingsRequest: + project_id: Optional[str] + """ + List bookings belonging to this project ID. + """ + + platform_id: Optional[str] + """ + List bookings attached to this platform ID. + """ + + page: Optional[int] + """ + Page number. + """ + + page_size: Optional[int] + """ + Maximum number of results to return per page. + """ + + order_by: Optional[ListBookingsRequestOrderBy] + """ + Sort order of the returned results. + """ + + +@dataclass +class ListBookingsResponse: + total_count: int + """ + Total number of bookings. + """ + + bookings: List[Booking] + """ + List of bookings. + """ + + @dataclass class ListJobResultsRequest: job_id: str @@ -1143,6 +1321,19 @@ class TerminateSessionRequest: """ +@dataclass +class UpdateBookingRequest: + booking_id: str + """ + Unique ID of the booking. + """ + + description: Optional[str] + """ + Description of the booking slot. + """ + + @dataclass class UpdateJobRequest: job_id: str