diff --git a/scaleway-async/scaleway_async/tem/v1alpha1/__init__.py b/scaleway-async/scaleway_async/tem/v1alpha1/__init__.py index 805d56c4a..53ba0d7cd 100644 --- a/scaleway-async/scaleway_async/tem/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/tem/v1alpha1/__init__.py @@ -14,6 +14,8 @@ from .types import ListEmailsRequestOrderBy from .types import ListWebhookEventsRequestOrderBy from .types import ListWebhooksRequestOrderBy +from .types import OfferName +from .types import PoolStatus from .types import ProjectSettingsPeriodicReportFrequency from .types import WebhookEventStatus from .types import WebhookEventType @@ -32,6 +34,9 @@ from .types import DomainLastStatusDmarcRecord from .types import DomainLastStatusSpfRecord from .types import Domain +from .types import OfferSubscription +from .types import Offer +from .types import Pool from .types import WebhookEvent from .types import Webhook from .types import ProjectSettingsPeriodicReport @@ -50,6 +55,7 @@ from .types import GetDomainLastStatusRequest from .types import GetDomainRequest from .types import GetEmailRequest +from .types import GetProjectConsumptionRequest from .types import GetProjectSettingsRequest from .types import GetStatisticsRequest from .types import GetWebhookRequest @@ -59,14 +65,22 @@ from .types import ListDomainsResponse from .types import ListEmailsRequest from .types import ListEmailsResponse +from .types import ListOfferSubscriptionsRequest +from .types import ListOfferSubscriptionsResponse +from .types import ListOffersRequest +from .types import ListOffersResponse +from .types import ListPoolsRequest +from .types import ListPoolsResponse from .types import ListWebhookEventsRequest from .types import ListWebhookEventsResponse from .types import ListWebhooksRequest from .types import ListWebhooksResponse +from .types import ProjectConsumption from .types import ProjectSettings from .types import RevokeDomainRequest from .types import Statistics from .types import UpdateDomainRequest +from .types import UpdateOfferSubscriptionRequest from .types import UpdateProjectSettingsRequest from .types import UpdateWebhookRequest from .api import TemV1Alpha1API @@ -86,6 +100,8 @@ "ListEmailsRequestOrderBy", "ListWebhookEventsRequestOrderBy", "ListWebhooksRequestOrderBy", + "OfferName", + "PoolStatus", "ProjectSettingsPeriodicReportFrequency", "WebhookEventStatus", "WebhookEventType", @@ -104,6 +120,9 @@ "DomainLastStatusDmarcRecord", "DomainLastStatusSpfRecord", "Domain", + "OfferSubscription", + "Offer", + "Pool", "WebhookEvent", "Webhook", "ProjectSettingsPeriodicReport", @@ -122,6 +141,7 @@ "GetDomainLastStatusRequest", "GetDomainRequest", "GetEmailRequest", + "GetProjectConsumptionRequest", "GetProjectSettingsRequest", "GetStatisticsRequest", "GetWebhookRequest", @@ -131,14 +151,22 @@ "ListDomainsResponse", "ListEmailsRequest", "ListEmailsResponse", + "ListOfferSubscriptionsRequest", + "ListOfferSubscriptionsResponse", + "ListOffersRequest", + "ListOffersResponse", + "ListPoolsRequest", + "ListPoolsResponse", "ListWebhookEventsRequest", "ListWebhookEventsResponse", "ListWebhooksRequest", "ListWebhooksResponse", + "ProjectConsumption", "ProjectSettings", "RevokeDomainRequest", "Statistics", "UpdateDomainRequest", + "UpdateOfferSubscriptionRequest", "UpdateProjectSettingsRequest", "UpdateWebhookRequest", "TemV1Alpha1API", diff --git a/scaleway-async/scaleway_async/tem/v1alpha1/api.py b/scaleway-async/scaleway_async/tem/v1alpha1/api.py index 30e91467b..5d2f82691 100644 --- a/scaleway-async/scaleway_async/tem/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/tem/v1alpha1/api.py @@ -23,6 +23,7 @@ ListEmailsRequestOrderBy, ListWebhookEventsRequestOrderBy, ListWebhooksRequestOrderBy, + OfferName, WebhookEventStatus, WebhookEventType, Blocklist, @@ -41,11 +42,18 @@ ListBlocklistsResponse, ListDomainsResponse, ListEmailsResponse, + ListOfferSubscriptionsResponse, + ListOffersResponse, + ListPoolsResponse, ListWebhookEventsResponse, ListWebhooksResponse, + OfferSubscription, + Pool, + ProjectConsumption, ProjectSettings, Statistics, UpdateDomainRequest, + UpdateOfferSubscriptionRequest, UpdateProjectSettingsRequest, UpdateProjectSettingsRequestUpdatePeriodicReport, UpdateWebhookRequest, @@ -59,6 +67,7 @@ from .marshalling import ( unmarshal_Email, unmarshal_Domain, + unmarshal_OfferSubscription, unmarshal_Webhook, unmarshal_BulkCreateBlocklistsResponse, unmarshal_CreateEmailResponse, @@ -66,8 +75,12 @@ unmarshal_ListBlocklistsResponse, unmarshal_ListDomainsResponse, unmarshal_ListEmailsResponse, + unmarshal_ListOfferSubscriptionsResponse, + unmarshal_ListOffersResponse, + unmarshal_ListPoolsResponse, unmarshal_ListWebhookEventsResponse, unmarshal_ListWebhooksResponse, + unmarshal_ProjectConsumption, unmarshal_ProjectSettings, unmarshal_Statistics, marshal_BulkCreateBlocklistsRequest, @@ -75,6 +88,7 @@ marshal_CreateEmailRequest, marshal_CreateWebhookRequest, marshal_UpdateDomainRequest, + marshal_UpdateOfferSubscriptionRequest, marshal_UpdateProjectSettingsRequest, marshal_UpdateWebhookRequest, ) @@ -1469,3 +1483,214 @@ async def delete_blocklist( ) self._throw_on_error(res) + + async def list_offer_subscriptions( + self, + *, + region: Optional[ScwRegion] = None, + project_id: Optional[str] = None, + ) -> ListOfferSubscriptionsResponse: + """ + Get information about subscribed offers. + Retrieve information about the offers you are subscribed to using the `project_id` and `region` parameters. + :param region: Region to target. If none is passed will use default region from the config. + :param project_id: ID of the Project. + :return: :class:`ListOfferSubscriptionsResponse ` + + Usage: + :: + + result = await api.list_offer_subscriptions() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/transactional-email/v1alpha1/regions/{param_region}/offer-subscriptions", + params={ + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListOfferSubscriptionsResponse(res.json()) + + async def update_offer_subscription( + self, + *, + region: Optional[ScwRegion] = None, + project_id: Optional[str] = None, + name: Optional[OfferName] = None, + ) -> OfferSubscription: + """ + Update a subscribed offer. + :param region: Region to target. If none is passed will use default region from the config. + :param project_id: ID of the Project. + :param name: Name of the offer-subscription. + :return: :class:`OfferSubscription ` + + Usage: + :: + + result = await api.update_offer_subscription() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "PATCH", + f"/transactional-email/v1alpha1/regions/{param_region}/offer-subscriptions", + body=marshal_UpdateOfferSubscriptionRequest( + UpdateOfferSubscriptionRequest( + region=region, + project_id=project_id, + name=name, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_OfferSubscription(res.json()) + + async def list_offers( + self, + *, + region: Optional[ScwRegion] = None, + ) -> ListOffersResponse: + """ + List the available offers. + Retrieve the list of the available and free-of-charge offers you can subscribe to. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`ListOffersResponse ` + + Usage: + :: + + result = await api.list_offers() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/transactional-email/v1alpha1/regions/{param_region}/offers", + ) + + self._throw_on_error(res) + return unmarshal_ListOffersResponse(res.json()) + + async def list_pools( + self, + *, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + project_id: Optional[str] = None, + ) -> ListPoolsResponse: + """ + Get information about a sending pool. + Retrieve information about a sending pool, including its creation status and configuration parameters. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Requested page number. Value must be greater or equal to 1. + :param page_size: Requested page size. Value must be between 1 and 1000. + :param project_id: ID of the Project. + :return: :class:`ListPoolsResponse ` + + Usage: + :: + + result = await api.list_pools() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/transactional-email/v1alpha1/regions/{param_region}/pools", + params={ + "page": page, + "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListPoolsResponse(res.json()) + + async def list_pools_all( + self, + *, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + project_id: Optional[str] = None, + ) -> List[Pool]: + """ + Get information about a sending pool. + Retrieve information about a sending pool, including its creation status and configuration parameters. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Requested page number. Value must be greater or equal to 1. + :param page_size: Requested page size. Value must be between 1 and 1000. + :param project_id: ID of the Project. + :return: :class:`List[Pool] ` + + Usage: + :: + + result = await api.list_pools_all() + """ + + return await fetch_all_pages_async( + type=ListPoolsResponse, + key="pools", + fetcher=self.list_pools, + args={ + "region": region, + "page": page, + "page_size": page_size, + "project_id": project_id, + }, + ) + + async def get_project_consumption( + self, + *, + region: Optional[ScwRegion] = None, + project_id: Optional[str] = None, + ) -> ProjectConsumption: + """ + Get project resource consumption. + :param region: Region to target. If none is passed will use default region from the config. + :param project_id: ID of the project. + :return: :class:`ProjectConsumption ` + + Usage: + :: + + result = await api.get_project_consumption() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/transactional-email/v1alpha1/regions/{param_region}/project-consumption", + params={ + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ProjectConsumption(res.json()) diff --git a/scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py index 453356bb7..522b5dec8 100644 --- a/scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py @@ -15,6 +15,7 @@ DomainReputation, DomainStatistics, Domain, + OfferSubscription, Webhook, Blocklist, BulkCreateBlocklistsResponse, @@ -27,9 +28,15 @@ ListBlocklistsResponse, ListDomainsResponse, ListEmailsResponse, + ListOfferSubscriptionsResponse, + Offer, + ListOffersResponse, + Pool, + ListPoolsResponse, WebhookEvent, ListWebhookEventsResponse, ListWebhooksResponse, + ProjectConsumption, ProjectSettingsPeriodicReport, ProjectSettings, Statistics, @@ -41,6 +48,7 @@ CreateEmailRequest, CreateWebhookRequest, UpdateDomainRequest, + UpdateOfferSubscriptionRequest, UpdateProjectSettingsRequestUpdatePeriodicReport, UpdateProjectSettingsRequest, UpdateWebhookRequest, @@ -358,6 +366,69 @@ def unmarshal_Domain(data: Any) -> Domain: return Domain(**args) +def unmarshal_OfferSubscription(data: Any) -> OfferSubscription: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'OfferSubscription' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("organization_id", None) + if field is not None: + args["organization_id"] = field + + field = data.get("project_id", None) + if field is not None: + args["project_id"] = field + + field = data.get("offer_name", None) + if field is not None: + args["offer_name"] = field + + field = data.get("sla", None) + if field is not None: + args["sla"] = field + + field = data.get("max_domains", None) + if field is not None: + args["max_domains"] = field + + field = data.get("max_dedicated_ips", None) + if field is not None: + args["max_dedicated_ips"] = field + + field = data.get("max_webhooks_per_domain", None) + if field is not None: + args["max_webhooks_per_domain"] = field + + field = data.get("max_custom_blocklists_per_domain", None) + if field is not None: + args["max_custom_blocklists_per_domain"] = field + + field = data.get("included_monthly_emails", None) + if field is not None: + args["included_monthly_emails"] = field + + field = data.get("subscribed_at", None) + if field is not None: + args["subscribed_at"] = ( + parser.isoparse(field) if isinstance(field, str) else field + ) + else: + args["subscribed_at"] = None + + field = data.get("cancellation_available_at", None) + if field is not None: + args["cancellation_available_at"] = ( + parser.isoparse(field) if isinstance(field, str) else field + ) + else: + args["cancellation_available_at"] = None + + return OfferSubscription(**args) + + def unmarshal_Webhook(data: Any) -> Webhook: if not isinstance(data, dict): raise TypeError( @@ -718,6 +789,165 @@ def unmarshal_ListEmailsResponse(data: Any) -> ListEmailsResponse: return ListEmailsResponse(**args) +def unmarshal_ListOfferSubscriptionsResponse( + data: Any, +) -> ListOfferSubscriptionsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListOfferSubscriptionsResponse' 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("offer_subscriptions", None) + if field is not None: + args["offer_subscriptions"] = ( + [unmarshal_OfferSubscription(v) for v in field] + if field is not None + else None + ) + + return ListOfferSubscriptionsResponse(**args) + + +def unmarshal_Offer(data: Any) -> Offer: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Offer' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("name", None) + if field is not None: + args["name"] = field + + field = data.get("sla", None) + if field is not None: + args["sla"] = field + + field = data.get("max_domains", None) + if field is not None: + args["max_domains"] = field + + field = data.get("max_dedicated_ips", None) + if field is not None: + args["max_dedicated_ips"] = field + + field = data.get("included_monthly_emails", None) + if field is not None: + args["included_monthly_emails"] = field + + field = data.get("max_webhooks_per_domain", None) + if field is not None: + args["max_webhooks_per_domain"] = field + + field = data.get("max_custom_blocklists_per_domain", None) + if field is not None: + args["max_custom_blocklists_per_domain"] = 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("commitment_period", None) + if field is not None: + args["commitment_period"] = field + else: + args["commitment_period"] = None + + return Offer(**args) + + +def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListOffersResponse' 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("offers", None) + if field is not None: + args["offers"] = ( + [unmarshal_Offer(v) for v in field] if field is not None else None + ) + + return ListOffersResponse(**args) + + +def unmarshal_Pool(data: Any) -> Pool: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Pool' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("project_id", None) + if field is not None: + args["project_id"] = field + + field = data.get("status", None) + if field is not None: + args["status"] = field + + field = data.get("ips", None) + if field is not None: + args["ips"] = field + + field = data.get("details", None) + if field is not None: + args["details"] = field + else: + args["details"] = None + + field = data.get("zone", None) + if field is not None: + args["zone"] = field + else: + args["zone"] = None + + field = data.get("reverse", None) + if field is not None: + args["reverse"] = field + else: + args["reverse"] = None + + return Pool(**args) + + +def unmarshal_ListPoolsResponse(data: Any) -> ListPoolsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListPoolsResponse' 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("pools", None) + if field is not None: + args["pools"] = ( + [unmarshal_Pool(v) for v in field] if field is not None else None + ) + + return ListPoolsResponse(**args) + + def unmarshal_WebhookEvent(data: Any) -> WebhookEvent: if not isinstance(data, dict): raise TypeError( @@ -821,6 +1051,41 @@ def unmarshal_ListWebhooksResponse(data: Any) -> ListWebhooksResponse: return ListWebhooksResponse(**args) +def unmarshal_ProjectConsumption(data: Any) -> ProjectConsumption: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ProjectConsumption' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("project_id", None) + if field is not None: + args["project_id"] = field + + field = data.get("domains_count", None) + if field is not None: + args["domains_count"] = field + + field = data.get("dedicated_ips_count", None) + if field is not None: + args["dedicated_ips_count"] = field + + field = data.get("monthly_emails_count", None) + if field is not None: + args["monthly_emails_count"] = field + + field = data.get("webhooks_count", None) + if field is not None: + args["webhooks_count"] = field + + field = data.get("custom_blocklists_count", None) + if field is not None: + args["custom_blocklists_count"] = field + + return ProjectConsumption(**args) + + def unmarshal_ProjectSettingsPeriodicReport(data: Any) -> ProjectSettingsPeriodicReport: if not isinstance(data, dict): raise TypeError( @@ -1080,6 +1345,21 @@ def marshal_UpdateDomainRequest( return output +def marshal_UpdateOfferSubscriptionRequest( + request: UpdateOfferSubscriptionRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.project_id is not None: + output["project_id"] = request.project_id or defaults.default_project_id + + if request.name is not None: + output["name"] = str(request.name) + + return output + + def marshal_UpdateProjectSettingsRequestUpdatePeriodicReport( request: UpdateProjectSettingsRequestUpdatePeriodicReport, defaults: ProfileDefaults, diff --git a/scaleway-async/scaleway_async/tem/v1alpha1/types.py b/scaleway-async/scaleway_async/tem/v1alpha1/types.py index dc7a8a3e3..0f40682c4 100644 --- a/scaleway-async/scaleway_async/tem/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/tem/v1alpha1/types.py @@ -9,6 +9,7 @@ from scaleway_core.bridge import ( Region as ScwRegion, + Zone as ScwZone, ) from scaleway_core.utils import ( StrEnumMeta, @@ -149,6 +150,26 @@ def __str__(self) -> str: return str(self.value) +class OfferName(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_NAME = "unknown_name" + ESSENTIAL = "essential" + SCALE = "scale" + + def __str__(self) -> str: + return str(self.value) + + +class PoolStatus(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_STATUS = "unknown_status" + DISABLED = "disabled" + CREATING = "creating" + READY = "ready" + ERROR = "error" + + def __str__(self) -> str: + return str(self.value) + + class ProjectSettingsPeriodicReportFrequency(str, Enum, metaclass=StrEnumMeta): UNKNOWN_FREQUENCY = "unknown_frequency" MONTHLY = "monthly" @@ -597,6 +618,145 @@ class Domain: """ +@dataclass +class OfferSubscription: + organization_id: str + """ + ID of the offer-subscription Organization. + """ + + project_id: str + """ + ID of the offer-subscription Project. + """ + + offer_name: OfferName + """ + Name of the offer associated with the Project. + """ + + sla: float + """ + Service Level Agreement percentage of the offer-subscription. + """ + + max_domains: int + """ + Max number of domains that can be associated with the offer-subscription for a particular Project. + """ + + max_dedicated_ips: int + """ + Max number of dedicated IPs that can be associated with the offer-subscription for a particular Project. + """ + + max_webhooks_per_domain: int + """ + Max number of webhooks that can be associated with the offer-subscription for a particular Project. + """ + + max_custom_blocklists_per_domain: int + """ + Max number of custom blocklists that can be associated with the offer-subscription for a particular Project. + """ + + included_monthly_emails: int + """ + Number of emails included in the offer-subscription per month. + """ + + subscribed_at: Optional[datetime] + """ + Date and time of the subscription. + """ + + cancellation_available_at: Optional[datetime] + """ + Date and time of the end of the offer-subscription commitment. + """ + + +@dataclass +class Offer: + name: OfferName + """ + Name of the offer. + """ + + sla: float + """ + Service Level Agreement percentage of the offer. + """ + + max_domains: int + """ + Max number of checked domains that can be associated with the offer. + """ + + max_dedicated_ips: int + """ + Max number of dedicated IPs that can be associated with the offer. + """ + + included_monthly_emails: int + """ + Number of emails included in the offer per month. + """ + + max_webhooks_per_domain: int + """ + Max number of webhooks that can be associated with the offer. + """ + + max_custom_blocklists_per_domain: int + """ + Max number of active custom blocklists that can be associated with the offer. + """ + + created_at: Optional[datetime] + """ + Date and time of the offer creation. + """ + + commitment_period: Optional[str] + """ + Period of commitment. + """ + + +@dataclass +class Pool: + project_id: str + """ + ID of the Project. + """ + + status: PoolStatus + """ + Status of the pool. + """ + + ips: List[str] + """ + IPs of the pool. + """ + + details: Optional[str] + """ + Details of the pool. + """ + + zone: Optional[ScwZone] + """ + Zone of the pool. + """ + + reverse: Optional[str] + """ + Reverse hostname of all IPs of the pool. + """ + + @dataclass class WebhookEvent: id: str @@ -1041,6 +1201,19 @@ class GetEmailRequest: """ +@dataclass +class GetProjectConsumptionRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + project_id: Optional[str] + """ + ID of the project. + """ + + @dataclass class GetProjectSettingsRequest: region: Optional[ScwRegion] @@ -1297,6 +1470,89 @@ class ListEmailsResponse: """ +@dataclass +class ListOfferSubscriptionsRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + project_id: Optional[str] + """ + ID of the Project. + """ + + +@dataclass +class ListOfferSubscriptionsResponse: + total_count: int + """ + Number of offer-subscriptions matching the requested criteria. + """ + + offer_subscriptions: List[OfferSubscription] + """ + Single page of offer-subscriptions matching the requested criteria. + """ + + +@dataclass +class ListOffersRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + +@dataclass +class ListOffersResponse: + total_count: int + """ + Number of offers matching the requested criteria. + """ + + offers: List[Offer] + """ + Single page of offers matching the requested criteria. + """ + + +@dataclass +class ListPoolsRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + page: Optional[int] + """ + Requested page number. Value must be greater or equal to 1. + """ + + page_size: Optional[int] + """ + Requested page size. Value must be between 1 and 1000. + """ + + project_id: Optional[str] + """ + ID of the Project. + """ + + +@dataclass +class ListPoolsResponse: + total_count: int + """ + Number of pools matching the requested criteria. + """ + + pools: List[Pool] + """ + Single page of pools matching the requested criteria. + """ + + @dataclass class ListWebhookEventsRequest: webhook_id: str @@ -1419,6 +1675,39 @@ class ListWebhooksResponse: """ +@dataclass +class ProjectConsumption: + project_id: str + """ + ID of the project. + """ + + domains_count: int + """ + Number of domains in the project. + """ + + dedicated_ips_count: int + """ + Number of dedicated IP in the project. + """ + + monthly_emails_count: int + """ + Number of emails sent during the current month in the project. + """ + + webhooks_count: int + """ + Number of webhooks in the project. + """ + + custom_blocklists_count: int + """ + Number of custom blocklists in the project. + """ + + @dataclass class ProjectSettings: periodic_report: Optional[ProjectSettingsPeriodicReport] @@ -1491,6 +1780,24 @@ class UpdateDomainRequest: """ +@dataclass +class UpdateOfferSubscriptionRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + project_id: Optional[str] + """ + ID of the Project. + """ + + name: Optional[OfferName] + """ + Name of the offer-subscription. + """ + + @dataclass class UpdateProjectSettingsRequest: region: Optional[ScwRegion] diff --git a/scaleway/scaleway/tem/v1alpha1/__init__.py b/scaleway/scaleway/tem/v1alpha1/__init__.py index 805d56c4a..53ba0d7cd 100644 --- a/scaleway/scaleway/tem/v1alpha1/__init__.py +++ b/scaleway/scaleway/tem/v1alpha1/__init__.py @@ -14,6 +14,8 @@ from .types import ListEmailsRequestOrderBy from .types import ListWebhookEventsRequestOrderBy from .types import ListWebhooksRequestOrderBy +from .types import OfferName +from .types import PoolStatus from .types import ProjectSettingsPeriodicReportFrequency from .types import WebhookEventStatus from .types import WebhookEventType @@ -32,6 +34,9 @@ from .types import DomainLastStatusDmarcRecord from .types import DomainLastStatusSpfRecord from .types import Domain +from .types import OfferSubscription +from .types import Offer +from .types import Pool from .types import WebhookEvent from .types import Webhook from .types import ProjectSettingsPeriodicReport @@ -50,6 +55,7 @@ from .types import GetDomainLastStatusRequest from .types import GetDomainRequest from .types import GetEmailRequest +from .types import GetProjectConsumptionRequest from .types import GetProjectSettingsRequest from .types import GetStatisticsRequest from .types import GetWebhookRequest @@ -59,14 +65,22 @@ from .types import ListDomainsResponse from .types import ListEmailsRequest from .types import ListEmailsResponse +from .types import ListOfferSubscriptionsRequest +from .types import ListOfferSubscriptionsResponse +from .types import ListOffersRequest +from .types import ListOffersResponse +from .types import ListPoolsRequest +from .types import ListPoolsResponse from .types import ListWebhookEventsRequest from .types import ListWebhookEventsResponse from .types import ListWebhooksRequest from .types import ListWebhooksResponse +from .types import ProjectConsumption from .types import ProjectSettings from .types import RevokeDomainRequest from .types import Statistics from .types import UpdateDomainRequest +from .types import UpdateOfferSubscriptionRequest from .types import UpdateProjectSettingsRequest from .types import UpdateWebhookRequest from .api import TemV1Alpha1API @@ -86,6 +100,8 @@ "ListEmailsRequestOrderBy", "ListWebhookEventsRequestOrderBy", "ListWebhooksRequestOrderBy", + "OfferName", + "PoolStatus", "ProjectSettingsPeriodicReportFrequency", "WebhookEventStatus", "WebhookEventType", @@ -104,6 +120,9 @@ "DomainLastStatusDmarcRecord", "DomainLastStatusSpfRecord", "Domain", + "OfferSubscription", + "Offer", + "Pool", "WebhookEvent", "Webhook", "ProjectSettingsPeriodicReport", @@ -122,6 +141,7 @@ "GetDomainLastStatusRequest", "GetDomainRequest", "GetEmailRequest", + "GetProjectConsumptionRequest", "GetProjectSettingsRequest", "GetStatisticsRequest", "GetWebhookRequest", @@ -131,14 +151,22 @@ "ListDomainsResponse", "ListEmailsRequest", "ListEmailsResponse", + "ListOfferSubscriptionsRequest", + "ListOfferSubscriptionsResponse", + "ListOffersRequest", + "ListOffersResponse", + "ListPoolsRequest", + "ListPoolsResponse", "ListWebhookEventsRequest", "ListWebhookEventsResponse", "ListWebhooksRequest", "ListWebhooksResponse", + "ProjectConsumption", "ProjectSettings", "RevokeDomainRequest", "Statistics", "UpdateDomainRequest", + "UpdateOfferSubscriptionRequest", "UpdateProjectSettingsRequest", "UpdateWebhookRequest", "TemV1Alpha1API", diff --git a/scaleway/scaleway/tem/v1alpha1/api.py b/scaleway/scaleway/tem/v1alpha1/api.py index b3aefea5c..3c6e7d778 100644 --- a/scaleway/scaleway/tem/v1alpha1/api.py +++ b/scaleway/scaleway/tem/v1alpha1/api.py @@ -23,6 +23,7 @@ ListEmailsRequestOrderBy, ListWebhookEventsRequestOrderBy, ListWebhooksRequestOrderBy, + OfferName, WebhookEventStatus, WebhookEventType, Blocklist, @@ -41,11 +42,18 @@ ListBlocklistsResponse, ListDomainsResponse, ListEmailsResponse, + ListOfferSubscriptionsResponse, + ListOffersResponse, + ListPoolsResponse, ListWebhookEventsResponse, ListWebhooksResponse, + OfferSubscription, + Pool, + ProjectConsumption, ProjectSettings, Statistics, UpdateDomainRequest, + UpdateOfferSubscriptionRequest, UpdateProjectSettingsRequest, UpdateProjectSettingsRequestUpdatePeriodicReport, UpdateWebhookRequest, @@ -59,6 +67,7 @@ from .marshalling import ( unmarshal_Email, unmarshal_Domain, + unmarshal_OfferSubscription, unmarshal_Webhook, unmarshal_BulkCreateBlocklistsResponse, unmarshal_CreateEmailResponse, @@ -66,8 +75,12 @@ unmarshal_ListBlocklistsResponse, unmarshal_ListDomainsResponse, unmarshal_ListEmailsResponse, + unmarshal_ListOfferSubscriptionsResponse, + unmarshal_ListOffersResponse, + unmarshal_ListPoolsResponse, unmarshal_ListWebhookEventsResponse, unmarshal_ListWebhooksResponse, + unmarshal_ProjectConsumption, unmarshal_ProjectSettings, unmarshal_Statistics, marshal_BulkCreateBlocklistsRequest, @@ -75,6 +88,7 @@ marshal_CreateEmailRequest, marshal_CreateWebhookRequest, marshal_UpdateDomainRequest, + marshal_UpdateOfferSubscriptionRequest, marshal_UpdateProjectSettingsRequest, marshal_UpdateWebhookRequest, ) @@ -1469,3 +1483,214 @@ def delete_blocklist( ) self._throw_on_error(res) + + def list_offer_subscriptions( + self, + *, + region: Optional[ScwRegion] = None, + project_id: Optional[str] = None, + ) -> ListOfferSubscriptionsResponse: + """ + Get information about subscribed offers. + Retrieve information about the offers you are subscribed to using the `project_id` and `region` parameters. + :param region: Region to target. If none is passed will use default region from the config. + :param project_id: ID of the Project. + :return: :class:`ListOfferSubscriptionsResponse ` + + Usage: + :: + + result = api.list_offer_subscriptions() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/transactional-email/v1alpha1/regions/{param_region}/offer-subscriptions", + params={ + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListOfferSubscriptionsResponse(res.json()) + + def update_offer_subscription( + self, + *, + region: Optional[ScwRegion] = None, + project_id: Optional[str] = None, + name: Optional[OfferName] = None, + ) -> OfferSubscription: + """ + Update a subscribed offer. + :param region: Region to target. If none is passed will use default region from the config. + :param project_id: ID of the Project. + :param name: Name of the offer-subscription. + :return: :class:`OfferSubscription ` + + Usage: + :: + + result = api.update_offer_subscription() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "PATCH", + f"/transactional-email/v1alpha1/regions/{param_region}/offer-subscriptions", + body=marshal_UpdateOfferSubscriptionRequest( + UpdateOfferSubscriptionRequest( + region=region, + project_id=project_id, + name=name, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_OfferSubscription(res.json()) + + def list_offers( + self, + *, + region: Optional[ScwRegion] = None, + ) -> ListOffersResponse: + """ + List the available offers. + Retrieve the list of the available and free-of-charge offers you can subscribe to. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`ListOffersResponse ` + + Usage: + :: + + result = api.list_offers() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/transactional-email/v1alpha1/regions/{param_region}/offers", + ) + + self._throw_on_error(res) + return unmarshal_ListOffersResponse(res.json()) + + def list_pools( + self, + *, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + project_id: Optional[str] = None, + ) -> ListPoolsResponse: + """ + Get information about a sending pool. + Retrieve information about a sending pool, including its creation status and configuration parameters. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Requested page number. Value must be greater or equal to 1. + :param page_size: Requested page size. Value must be between 1 and 1000. + :param project_id: ID of the Project. + :return: :class:`ListPoolsResponse ` + + Usage: + :: + + result = api.list_pools() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/transactional-email/v1alpha1/regions/{param_region}/pools", + params={ + "page": page, + "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListPoolsResponse(res.json()) + + def list_pools_all( + self, + *, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + project_id: Optional[str] = None, + ) -> List[Pool]: + """ + Get information about a sending pool. + Retrieve information about a sending pool, including its creation status and configuration parameters. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Requested page number. Value must be greater or equal to 1. + :param page_size: Requested page size. Value must be between 1 and 1000. + :param project_id: ID of the Project. + :return: :class:`List[Pool] ` + + Usage: + :: + + result = api.list_pools_all() + """ + + return fetch_all_pages( + type=ListPoolsResponse, + key="pools", + fetcher=self.list_pools, + args={ + "region": region, + "page": page, + "page_size": page_size, + "project_id": project_id, + }, + ) + + def get_project_consumption( + self, + *, + region: Optional[ScwRegion] = None, + project_id: Optional[str] = None, + ) -> ProjectConsumption: + """ + Get project resource consumption. + :param region: Region to target. If none is passed will use default region from the config. + :param project_id: ID of the project. + :return: :class:`ProjectConsumption ` + + Usage: + :: + + result = api.get_project_consumption() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/transactional-email/v1alpha1/regions/{param_region}/project-consumption", + params={ + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ProjectConsumption(res.json()) diff --git a/scaleway/scaleway/tem/v1alpha1/marshalling.py b/scaleway/scaleway/tem/v1alpha1/marshalling.py index 453356bb7..522b5dec8 100644 --- a/scaleway/scaleway/tem/v1alpha1/marshalling.py +++ b/scaleway/scaleway/tem/v1alpha1/marshalling.py @@ -15,6 +15,7 @@ DomainReputation, DomainStatistics, Domain, + OfferSubscription, Webhook, Blocklist, BulkCreateBlocklistsResponse, @@ -27,9 +28,15 @@ ListBlocklistsResponse, ListDomainsResponse, ListEmailsResponse, + ListOfferSubscriptionsResponse, + Offer, + ListOffersResponse, + Pool, + ListPoolsResponse, WebhookEvent, ListWebhookEventsResponse, ListWebhooksResponse, + ProjectConsumption, ProjectSettingsPeriodicReport, ProjectSettings, Statistics, @@ -41,6 +48,7 @@ CreateEmailRequest, CreateWebhookRequest, UpdateDomainRequest, + UpdateOfferSubscriptionRequest, UpdateProjectSettingsRequestUpdatePeriodicReport, UpdateProjectSettingsRequest, UpdateWebhookRequest, @@ -358,6 +366,69 @@ def unmarshal_Domain(data: Any) -> Domain: return Domain(**args) +def unmarshal_OfferSubscription(data: Any) -> OfferSubscription: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'OfferSubscription' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("organization_id", None) + if field is not None: + args["organization_id"] = field + + field = data.get("project_id", None) + if field is not None: + args["project_id"] = field + + field = data.get("offer_name", None) + if field is not None: + args["offer_name"] = field + + field = data.get("sla", None) + if field is not None: + args["sla"] = field + + field = data.get("max_domains", None) + if field is not None: + args["max_domains"] = field + + field = data.get("max_dedicated_ips", None) + if field is not None: + args["max_dedicated_ips"] = field + + field = data.get("max_webhooks_per_domain", None) + if field is not None: + args["max_webhooks_per_domain"] = field + + field = data.get("max_custom_blocklists_per_domain", None) + if field is not None: + args["max_custom_blocklists_per_domain"] = field + + field = data.get("included_monthly_emails", None) + if field is not None: + args["included_monthly_emails"] = field + + field = data.get("subscribed_at", None) + if field is not None: + args["subscribed_at"] = ( + parser.isoparse(field) if isinstance(field, str) else field + ) + else: + args["subscribed_at"] = None + + field = data.get("cancellation_available_at", None) + if field is not None: + args["cancellation_available_at"] = ( + parser.isoparse(field) if isinstance(field, str) else field + ) + else: + args["cancellation_available_at"] = None + + return OfferSubscription(**args) + + def unmarshal_Webhook(data: Any) -> Webhook: if not isinstance(data, dict): raise TypeError( @@ -718,6 +789,165 @@ def unmarshal_ListEmailsResponse(data: Any) -> ListEmailsResponse: return ListEmailsResponse(**args) +def unmarshal_ListOfferSubscriptionsResponse( + data: Any, +) -> ListOfferSubscriptionsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListOfferSubscriptionsResponse' 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("offer_subscriptions", None) + if field is not None: + args["offer_subscriptions"] = ( + [unmarshal_OfferSubscription(v) for v in field] + if field is not None + else None + ) + + return ListOfferSubscriptionsResponse(**args) + + +def unmarshal_Offer(data: Any) -> Offer: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Offer' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("name", None) + if field is not None: + args["name"] = field + + field = data.get("sla", None) + if field is not None: + args["sla"] = field + + field = data.get("max_domains", None) + if field is not None: + args["max_domains"] = field + + field = data.get("max_dedicated_ips", None) + if field is not None: + args["max_dedicated_ips"] = field + + field = data.get("included_monthly_emails", None) + if field is not None: + args["included_monthly_emails"] = field + + field = data.get("max_webhooks_per_domain", None) + if field is not None: + args["max_webhooks_per_domain"] = field + + field = data.get("max_custom_blocklists_per_domain", None) + if field is not None: + args["max_custom_blocklists_per_domain"] = 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("commitment_period", None) + if field is not None: + args["commitment_period"] = field + else: + args["commitment_period"] = None + + return Offer(**args) + + +def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListOffersResponse' 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("offers", None) + if field is not None: + args["offers"] = ( + [unmarshal_Offer(v) for v in field] if field is not None else None + ) + + return ListOffersResponse(**args) + + +def unmarshal_Pool(data: Any) -> Pool: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Pool' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("project_id", None) + if field is not None: + args["project_id"] = field + + field = data.get("status", None) + if field is not None: + args["status"] = field + + field = data.get("ips", None) + if field is not None: + args["ips"] = field + + field = data.get("details", None) + if field is not None: + args["details"] = field + else: + args["details"] = None + + field = data.get("zone", None) + if field is not None: + args["zone"] = field + else: + args["zone"] = None + + field = data.get("reverse", None) + if field is not None: + args["reverse"] = field + else: + args["reverse"] = None + + return Pool(**args) + + +def unmarshal_ListPoolsResponse(data: Any) -> ListPoolsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListPoolsResponse' 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("pools", None) + if field is not None: + args["pools"] = ( + [unmarshal_Pool(v) for v in field] if field is not None else None + ) + + return ListPoolsResponse(**args) + + def unmarshal_WebhookEvent(data: Any) -> WebhookEvent: if not isinstance(data, dict): raise TypeError( @@ -821,6 +1051,41 @@ def unmarshal_ListWebhooksResponse(data: Any) -> ListWebhooksResponse: return ListWebhooksResponse(**args) +def unmarshal_ProjectConsumption(data: Any) -> ProjectConsumption: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ProjectConsumption' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("project_id", None) + if field is not None: + args["project_id"] = field + + field = data.get("domains_count", None) + if field is not None: + args["domains_count"] = field + + field = data.get("dedicated_ips_count", None) + if field is not None: + args["dedicated_ips_count"] = field + + field = data.get("monthly_emails_count", None) + if field is not None: + args["monthly_emails_count"] = field + + field = data.get("webhooks_count", None) + if field is not None: + args["webhooks_count"] = field + + field = data.get("custom_blocklists_count", None) + if field is not None: + args["custom_blocklists_count"] = field + + return ProjectConsumption(**args) + + def unmarshal_ProjectSettingsPeriodicReport(data: Any) -> ProjectSettingsPeriodicReport: if not isinstance(data, dict): raise TypeError( @@ -1080,6 +1345,21 @@ def marshal_UpdateDomainRequest( return output +def marshal_UpdateOfferSubscriptionRequest( + request: UpdateOfferSubscriptionRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.project_id is not None: + output["project_id"] = request.project_id or defaults.default_project_id + + if request.name is not None: + output["name"] = str(request.name) + + return output + + def marshal_UpdateProjectSettingsRequestUpdatePeriodicReport( request: UpdateProjectSettingsRequestUpdatePeriodicReport, defaults: ProfileDefaults, diff --git a/scaleway/scaleway/tem/v1alpha1/types.py b/scaleway/scaleway/tem/v1alpha1/types.py index dc7a8a3e3..0f40682c4 100644 --- a/scaleway/scaleway/tem/v1alpha1/types.py +++ b/scaleway/scaleway/tem/v1alpha1/types.py @@ -9,6 +9,7 @@ from scaleway_core.bridge import ( Region as ScwRegion, + Zone as ScwZone, ) from scaleway_core.utils import ( StrEnumMeta, @@ -149,6 +150,26 @@ def __str__(self) -> str: return str(self.value) +class OfferName(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_NAME = "unknown_name" + ESSENTIAL = "essential" + SCALE = "scale" + + def __str__(self) -> str: + return str(self.value) + + +class PoolStatus(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_STATUS = "unknown_status" + DISABLED = "disabled" + CREATING = "creating" + READY = "ready" + ERROR = "error" + + def __str__(self) -> str: + return str(self.value) + + class ProjectSettingsPeriodicReportFrequency(str, Enum, metaclass=StrEnumMeta): UNKNOWN_FREQUENCY = "unknown_frequency" MONTHLY = "monthly" @@ -597,6 +618,145 @@ class Domain: """ +@dataclass +class OfferSubscription: + organization_id: str + """ + ID of the offer-subscription Organization. + """ + + project_id: str + """ + ID of the offer-subscription Project. + """ + + offer_name: OfferName + """ + Name of the offer associated with the Project. + """ + + sla: float + """ + Service Level Agreement percentage of the offer-subscription. + """ + + max_domains: int + """ + Max number of domains that can be associated with the offer-subscription for a particular Project. + """ + + max_dedicated_ips: int + """ + Max number of dedicated IPs that can be associated with the offer-subscription for a particular Project. + """ + + max_webhooks_per_domain: int + """ + Max number of webhooks that can be associated with the offer-subscription for a particular Project. + """ + + max_custom_blocklists_per_domain: int + """ + Max number of custom blocklists that can be associated with the offer-subscription for a particular Project. + """ + + included_monthly_emails: int + """ + Number of emails included in the offer-subscription per month. + """ + + subscribed_at: Optional[datetime] + """ + Date and time of the subscription. + """ + + cancellation_available_at: Optional[datetime] + """ + Date and time of the end of the offer-subscription commitment. + """ + + +@dataclass +class Offer: + name: OfferName + """ + Name of the offer. + """ + + sla: float + """ + Service Level Agreement percentage of the offer. + """ + + max_domains: int + """ + Max number of checked domains that can be associated with the offer. + """ + + max_dedicated_ips: int + """ + Max number of dedicated IPs that can be associated with the offer. + """ + + included_monthly_emails: int + """ + Number of emails included in the offer per month. + """ + + max_webhooks_per_domain: int + """ + Max number of webhooks that can be associated with the offer. + """ + + max_custom_blocklists_per_domain: int + """ + Max number of active custom blocklists that can be associated with the offer. + """ + + created_at: Optional[datetime] + """ + Date and time of the offer creation. + """ + + commitment_period: Optional[str] + """ + Period of commitment. + """ + + +@dataclass +class Pool: + project_id: str + """ + ID of the Project. + """ + + status: PoolStatus + """ + Status of the pool. + """ + + ips: List[str] + """ + IPs of the pool. + """ + + details: Optional[str] + """ + Details of the pool. + """ + + zone: Optional[ScwZone] + """ + Zone of the pool. + """ + + reverse: Optional[str] + """ + Reverse hostname of all IPs of the pool. + """ + + @dataclass class WebhookEvent: id: str @@ -1041,6 +1201,19 @@ class GetEmailRequest: """ +@dataclass +class GetProjectConsumptionRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + project_id: Optional[str] + """ + ID of the project. + """ + + @dataclass class GetProjectSettingsRequest: region: Optional[ScwRegion] @@ -1297,6 +1470,89 @@ class ListEmailsResponse: """ +@dataclass +class ListOfferSubscriptionsRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + project_id: Optional[str] + """ + ID of the Project. + """ + + +@dataclass +class ListOfferSubscriptionsResponse: + total_count: int + """ + Number of offer-subscriptions matching the requested criteria. + """ + + offer_subscriptions: List[OfferSubscription] + """ + Single page of offer-subscriptions matching the requested criteria. + """ + + +@dataclass +class ListOffersRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + +@dataclass +class ListOffersResponse: + total_count: int + """ + Number of offers matching the requested criteria. + """ + + offers: List[Offer] + """ + Single page of offers matching the requested criteria. + """ + + +@dataclass +class ListPoolsRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + page: Optional[int] + """ + Requested page number. Value must be greater or equal to 1. + """ + + page_size: Optional[int] + """ + Requested page size. Value must be between 1 and 1000. + """ + + project_id: Optional[str] + """ + ID of the Project. + """ + + +@dataclass +class ListPoolsResponse: + total_count: int + """ + Number of pools matching the requested criteria. + """ + + pools: List[Pool] + """ + Single page of pools matching the requested criteria. + """ + + @dataclass class ListWebhookEventsRequest: webhook_id: str @@ -1419,6 +1675,39 @@ class ListWebhooksResponse: """ +@dataclass +class ProjectConsumption: + project_id: str + """ + ID of the project. + """ + + domains_count: int + """ + Number of domains in the project. + """ + + dedicated_ips_count: int + """ + Number of dedicated IP in the project. + """ + + monthly_emails_count: int + """ + Number of emails sent during the current month in the project. + """ + + webhooks_count: int + """ + Number of webhooks in the project. + """ + + custom_blocklists_count: int + """ + Number of custom blocklists in the project. + """ + + @dataclass class ProjectSettings: periodic_report: Optional[ProjectSettingsPeriodicReport] @@ -1491,6 +1780,24 @@ class UpdateDomainRequest: """ +@dataclass +class UpdateOfferSubscriptionRequest: + region: Optional[ScwRegion] + """ + Region to target. If none is passed will use default region from the config. + """ + + project_id: Optional[str] + """ + ID of the Project. + """ + + name: Optional[OfferName] + """ + Name of the offer-subscription. + """ + + @dataclass class UpdateProjectSettingsRequest: region: Optional[ScwRegion]