File tree Expand file tree Collapse file tree 8 files changed +154
-0
lines changed
scaleway-async/scaleway_async/webhosting/v1alpha1
scaleway/scaleway/webhosting/v1alpha1 Expand file tree Collapse file tree 8 files changed +154
-0
lines changed Original file line number Diff line number Diff line change 2020from .types import Hosting
2121from .types import Offer
2222from .types import CreateHostingRequest
23+ from .types import CreateSessionRequest
2324from .types import DeleteHostingRequest
2425from .types import DnsRecords
2526from .types import GetDomainDnsRecordsRequest
3132from .types import ListOffersRequest
3233from .types import ListOffersResponse
3334from .types import RestoreHostingRequest
35+ from .types import Session
3436from .types import UpdateHostingRequest
3537from .api import WebhostingV1Alpha1API
3638
5557 "Hosting" ,
5658 "Offer" ,
5759 "CreateHostingRequest" ,
60+ "CreateSessionRequest" ,
5861 "DeleteHostingRequest" ,
5962 "DnsRecords" ,
6063 "GetDomainDnsRecordsRequest" ,
6669 "ListOffersRequest" ,
6770 "ListOffersResponse" ,
6871 "RestoreHostingRequest" ,
72+ "Session" ,
6973 "UpdateHostingRequest" ,
7074 "WebhostingV1Alpha1API" ,
7175]
Original file line number Diff line number Diff line change 2525 ListControlPanelsResponse ,
2626 ListHostingsResponse ,
2727 ListOffersResponse ,
28+ Session ,
2829 UpdateHostingRequest ,
2930)
3031from .content import (
3637 unmarshal_ListControlPanelsResponse ,
3738 unmarshal_ListHostingsResponse ,
3839 unmarshal_ListOffersResponse ,
40+ unmarshal_Session ,
3941 marshal_CreateHostingRequest ,
4042 marshal_UpdateHostingRequest ,
4143)
@@ -570,3 +572,37 @@ async def list_control_panels_all(
570572 "page_size" : page_size ,
571573 },
572574 )
575+
576+ async def create_session (
577+ self ,
578+ * ,
579+ hosting_id : str ,
580+ region : Optional [Region ] = None ,
581+ ) -> Session :
582+ """
583+ Create a user session.
584+ :param hosting_id: Hosting ID.
585+ :param region: Region to target. If none is passed will use default region from the config.
586+ :return: :class:`Session <Session>`
587+
588+ Usage:
589+ ::
590+
591+ result = await api.create_session(
592+ hosting_id="example",
593+ )
594+ """
595+
596+ param_region = validate_path_param (
597+ "region" , region or self .client .default_region
598+ )
599+ param_hosting_id = validate_path_param ("hosting_id" , hosting_id )
600+
601+ res = self ._request (
602+ "POST" ,
603+ f"/webhosting/v1alpha1/regions/{ param_region } /hostings/{ param_hosting_id } /sessions" ,
604+ body = {},
605+ )
606+
607+ self ._throw_on_error (res )
608+ return unmarshal_Session (res .json ())
Original file line number Diff line number Diff line change 2222 OfferProduct ,
2323 Offer ,
2424 ListOffersResponse ,
25+ Session ,
2526 CreateHostingRequestDomainConfiguration ,
2627 CreateHostingRequest ,
2728 UpdateHostingRequest ,
@@ -452,6 +453,21 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse:
452453 return ListOffersResponse (** args )
453454
454455
456+ def unmarshal_Session (data : Any ) -> Session :
457+ if not isinstance (data , dict ):
458+ raise TypeError (
459+ "Unmarshalling the type 'Session' failed as data isn't a dictionary."
460+ )
461+
462+ args : Dict [str , Any ] = {}
463+
464+ field = data .get ("url" , None )
465+ if field is not None :
466+ args ["url" ] = field
467+
468+ return Session (** args )
469+
470+
455471def marshal_CreateHostingRequestDomainConfiguration (
456472 request : CreateHostingRequestDomainConfiguration ,
457473 defaults : ProfileDefaults ,
Original file line number Diff line number Diff line change @@ -474,6 +474,19 @@ class CreateHostingRequest:
474474 """
475475
476476
477+ @dataclass
478+ class CreateSessionRequest :
479+ hosting_id : str
480+ """
481+ Hosting ID.
482+ """
483+
484+ region : Optional [Region ]
485+ """
486+ Region to target. If none is passed will use default region from the config.
487+ """
488+
489+
477490@dataclass
478491class DeleteHostingRequest :
479492 hosting_id : str
@@ -682,6 +695,14 @@ class RestoreHostingRequest:
682695 """
683696
684697
698+ @dataclass
699+ class Session :
700+ url : str
701+ """
702+ Logged user's session URL.
703+ """
704+
705+
685706@dataclass
686707class UpdateHostingRequest :
687708 hosting_id : str
Original file line number Diff line number Diff line change 2020from .types import Hosting
2121from .types import Offer
2222from .types import CreateHostingRequest
23+ from .types import CreateSessionRequest
2324from .types import DeleteHostingRequest
2425from .types import DnsRecords
2526from .types import GetDomainDnsRecordsRequest
3132from .types import ListOffersRequest
3233from .types import ListOffersResponse
3334from .types import RestoreHostingRequest
35+ from .types import Session
3436from .types import UpdateHostingRequest
3537from .api import WebhostingV1Alpha1API
3638
5557 "Hosting" ,
5658 "Offer" ,
5759 "CreateHostingRequest" ,
60+ "CreateSessionRequest" ,
5861 "DeleteHostingRequest" ,
5962 "DnsRecords" ,
6063 "GetDomainDnsRecordsRequest" ,
6669 "ListOffersRequest" ,
6770 "ListOffersResponse" ,
6871 "RestoreHostingRequest" ,
72+ "Session" ,
6973 "UpdateHostingRequest" ,
7074 "WebhostingV1Alpha1API" ,
7175]
Original file line number Diff line number Diff line change 2525 ListControlPanelsResponse ,
2626 ListHostingsResponse ,
2727 ListOffersResponse ,
28+ Session ,
2829 UpdateHostingRequest ,
2930)
3031from .content import (
3637 unmarshal_ListControlPanelsResponse ,
3738 unmarshal_ListHostingsResponse ,
3839 unmarshal_ListOffersResponse ,
40+ unmarshal_Session ,
3941 marshal_CreateHostingRequest ,
4042 marshal_UpdateHostingRequest ,
4143)
@@ -570,3 +572,37 @@ def list_control_panels_all(
570572 "page_size" : page_size ,
571573 },
572574 )
575+
576+ def create_session (
577+ self ,
578+ * ,
579+ hosting_id : str ,
580+ region : Optional [Region ] = None ,
581+ ) -> Session :
582+ """
583+ Create a user session.
584+ :param hosting_id: Hosting ID.
585+ :param region: Region to target. If none is passed will use default region from the config.
586+ :return: :class:`Session <Session>`
587+
588+ Usage:
589+ ::
590+
591+ result = api.create_session(
592+ hosting_id="example",
593+ )
594+ """
595+
596+ param_region = validate_path_param (
597+ "region" , region or self .client .default_region
598+ )
599+ param_hosting_id = validate_path_param ("hosting_id" , hosting_id )
600+
601+ res = self ._request (
602+ "POST" ,
603+ f"/webhosting/v1alpha1/regions/{ param_region } /hostings/{ param_hosting_id } /sessions" ,
604+ body = {},
605+ )
606+
607+ self ._throw_on_error (res )
608+ return unmarshal_Session (res .json ())
Original file line number Diff line number Diff line change 2222 OfferProduct ,
2323 Offer ,
2424 ListOffersResponse ,
25+ Session ,
2526 CreateHostingRequestDomainConfiguration ,
2627 CreateHostingRequest ,
2728 UpdateHostingRequest ,
@@ -452,6 +453,21 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse:
452453 return ListOffersResponse (** args )
453454
454455
456+ def unmarshal_Session (data : Any ) -> Session :
457+ if not isinstance (data , dict ):
458+ raise TypeError (
459+ "Unmarshalling the type 'Session' failed as data isn't a dictionary."
460+ )
461+
462+ args : Dict [str , Any ] = {}
463+
464+ field = data .get ("url" , None )
465+ if field is not None :
466+ args ["url" ] = field
467+
468+ return Session (** args )
469+
470+
455471def marshal_CreateHostingRequestDomainConfiguration (
456472 request : CreateHostingRequestDomainConfiguration ,
457473 defaults : ProfileDefaults ,
Original file line number Diff line number Diff line change @@ -474,6 +474,19 @@ class CreateHostingRequest:
474474 """
475475
476476
477+ @dataclass
478+ class CreateSessionRequest :
479+ hosting_id : str
480+ """
481+ Hosting ID.
482+ """
483+
484+ region : Optional [Region ]
485+ """
486+ Region to target. If none is passed will use default region from the config.
487+ """
488+
489+
477490@dataclass
478491class DeleteHostingRequest :
479492 hosting_id : str
@@ -682,6 +695,14 @@ class RestoreHostingRequest:
682695 """
683696
684697
698+ @dataclass
699+ class Session :
700+ url : str
701+ """
702+ Logged user's session URL.
703+ """
704+
705+
685706@dataclass
686707class UpdateHostingRequest :
687708 hosting_id : str
You can’t perform that action at this time.
0 commit comments