Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webhosting): add "protected" field to hosting #455

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .types import NameserverStatus
from .types import OfferQuotaWarning
from .types import ControlPanel
from .types import CreateHostingRequestDomainConfiguration
from .types import DnsRecord
from .types import DnsRecords
from .types import Hosting
Expand All @@ -37,6 +38,7 @@
"NameserverStatus",
"OfferQuotaWarning",
"ControlPanel",
"CreateHostingRequestDomainConfiguration",
"DnsRecord",
"DnsRecords",
"Hosting",
Expand Down
7 changes: 7 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
ListHostingsRequestOrderBy,
ListOffersRequestOrderBy,
ControlPanel,
CreateHostingRequestDomainConfiguration,
DnsRecords,
Hosting,
ListControlPanelsResponse,
Expand Down Expand Up @@ -59,6 +60,7 @@ async def create_hosting(
email: Optional[str] = None,
tags: Optional[List[str]] = None,
option_ids: Optional[List[str]] = None,
domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None,
) -> Hosting:
"""
Order a Web Hosting plan.
Expand All @@ -71,6 +73,7 @@ async def create_hosting(
:param domain: Domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand.
:param option_ids: IDs of any selected additional options for the Web Hosting plan.
:param language: Default language for the control panel interface.
:param domain_configuration: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements.
:return: :class:`Hosting <Hosting>`

Usage:
Expand Down Expand Up @@ -100,6 +103,7 @@ async def create_hosting(
email=email,
tags=tags,
option_ids=option_ids,
domain_configuration=domain_configuration,
),
self.client,
),
Expand Down Expand Up @@ -296,6 +300,7 @@ async def update_hosting(
tags: Optional[List[str]] = None,
option_ids: Optional[List[str]] = None,
offer_id: Optional[str] = None,
protected: Optional[bool] = None,
) -> Hosting:
"""
Update a Web Hosting plan.
Expand All @@ -306,6 +311,7 @@ async def update_hosting(
:param tags: New tags for the Web Hosting plan.
:param option_ids: IDs of the new options for the Web Hosting plan.
:param offer_id: ID of the new offer for the Web Hosting plan.
:param protected: Whether the hosting is protected or not.
:return: :class:`Hosting <Hosting>`

Usage:
Expand All @@ -330,6 +336,7 @@ async def update_hosting(
tags=tags,
option_ids=option_ids,
offer_id=offer_id,
protected=protected,
),
self.client,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .types import (
LanguageCode,
ControlPanel,
CreateHostingRequestDomainConfiguration,
DnsRecord,
DnsRecords,
Hosting,
Expand Down Expand Up @@ -214,6 +215,9 @@ def unmarshal_Hosting(data: Any) -> Hosting:
field = data.get("project_id", None)
args["project_id"] = field

field = data.get("protected", None)
args["protected"] = field

field = data.get("region", None)
args["region"] = field

Expand Down Expand Up @@ -363,6 +367,27 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse:
return ListOffersResponse(**args)


def marshal_CreateHostingRequestDomainConfiguration(
request: CreateHostingRequestDomainConfiguration,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.update_all_records is not None:
output["update_all_records"] = request.update_all_records

if request.update_mail_record is not None:
output["update_mail_record"] = request.update_mail_record

if request.update_nameservers is not None:
output["update_nameservers"] = request.update_nameservers

if request.update_web_record is not None:
output["update_web_record"] = request.update_web_record

return output


def marshal_CreateHostingRequest(
request: CreateHostingRequest,
defaults: ProfileDefaults,
Expand All @@ -372,6 +397,13 @@ def marshal_CreateHostingRequest(
if request.domain is not None:
output["domain"] = request.domain

if request.domain_configuration is not None:
output["domain_configuration"] = (
marshal_CreateHostingRequestDomainConfiguration(
request.domain_configuration, defaults
)
)

if request.email is not None:
output["email"] = request.email

Expand Down Expand Up @@ -408,6 +440,9 @@ def marshal_UpdateHostingRequest(
if request.option_ids is not None:
output["option_ids"] = request.option_ids

if request.protected is not None:
output["protected"] = request.protected

if request.tags is not None:
output["tags"] = request.tags

Expand Down
26 changes: 26 additions & 0 deletions scaleway-async/scaleway_async/webhosting/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ class ControlPanel:
"""


@dataclass
class CreateHostingRequestDomainConfiguration:
update_nameservers: bool

update_web_record: bool

update_mail_record: bool

update_all_records: bool


@dataclass
class DnsRecord:
"""
Expand Down Expand Up @@ -305,6 +316,11 @@ class Hosting:
IPv6 address of the hosting's host server.
"""

protected: bool
"""
Whether the hosting is protected or not.
"""

region: Region
"""
Region where the Web Hosting plan is hosted.
Expand Down Expand Up @@ -549,6 +565,11 @@ class CreateHostingRequest:
Default language for the control panel interface.
"""

domain_configuration: Optional[CreateHostingRequestDomainConfiguration]
"""
Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements.
"""


@dataclass
class ListHostingsRequest:
Expand Down Expand Up @@ -648,6 +669,11 @@ class UpdateHostingRequest:
ID of the new offer for the Web Hosting plan.
"""

protected: Optional[bool]
"""
Whether the hosting is protected or not.
"""


@dataclass
class DeleteHostingRequest:
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/webhosting/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .types import NameserverStatus
from .types import OfferQuotaWarning
from .types import ControlPanel
from .types import CreateHostingRequestDomainConfiguration
from .types import DnsRecord
from .types import DnsRecords
from .types import Hosting
Expand All @@ -37,6 +38,7 @@
"NameserverStatus",
"OfferQuotaWarning",
"ControlPanel",
"CreateHostingRequestDomainConfiguration",
"DnsRecord",
"DnsRecords",
"Hosting",
Expand Down
7 changes: 7 additions & 0 deletions scaleway/scaleway/webhosting/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
ListHostingsRequestOrderBy,
ListOffersRequestOrderBy,
ControlPanel,
CreateHostingRequestDomainConfiguration,
DnsRecords,
Hosting,
ListControlPanelsResponse,
Expand Down Expand Up @@ -59,6 +60,7 @@ def create_hosting(
email: Optional[str] = None,
tags: Optional[List[str]] = None,
option_ids: Optional[List[str]] = None,
domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None,
) -> Hosting:
"""
Order a Web Hosting plan.
Expand All @@ -71,6 +73,7 @@ def create_hosting(
:param domain: Domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand.
:param option_ids: IDs of any selected additional options for the Web Hosting plan.
:param language: Default language for the control panel interface.
:param domain_configuration: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements.
:return: :class:`Hosting <Hosting>`

Usage:
Expand Down Expand Up @@ -100,6 +103,7 @@ def create_hosting(
email=email,
tags=tags,
option_ids=option_ids,
domain_configuration=domain_configuration,
),
self.client,
),
Expand Down Expand Up @@ -296,6 +300,7 @@ def update_hosting(
tags: Optional[List[str]] = None,
option_ids: Optional[List[str]] = None,
offer_id: Optional[str] = None,
protected: Optional[bool] = None,
) -> Hosting:
"""
Update a Web Hosting plan.
Expand All @@ -306,6 +311,7 @@ def update_hosting(
:param tags: New tags for the Web Hosting plan.
:param option_ids: IDs of the new options for the Web Hosting plan.
:param offer_id: ID of the new offer for the Web Hosting plan.
:param protected: Whether the hosting is protected or not.
:return: :class:`Hosting <Hosting>`

Usage:
Expand All @@ -330,6 +336,7 @@ def update_hosting(
tags=tags,
option_ids=option_ids,
offer_id=offer_id,
protected=protected,
),
self.client,
),
Expand Down
35 changes: 35 additions & 0 deletions scaleway/scaleway/webhosting/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .types import (
LanguageCode,
ControlPanel,
CreateHostingRequestDomainConfiguration,
DnsRecord,
DnsRecords,
Hosting,
Expand Down Expand Up @@ -214,6 +215,9 @@ def unmarshal_Hosting(data: Any) -> Hosting:
field = data.get("project_id", None)
args["project_id"] = field

field = data.get("protected", None)
args["protected"] = field

field = data.get("region", None)
args["region"] = field

Expand Down Expand Up @@ -363,6 +367,27 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse:
return ListOffersResponse(**args)


def marshal_CreateHostingRequestDomainConfiguration(
request: CreateHostingRequestDomainConfiguration,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.update_all_records is not None:
output["update_all_records"] = request.update_all_records

if request.update_mail_record is not None:
output["update_mail_record"] = request.update_mail_record

if request.update_nameservers is not None:
output["update_nameservers"] = request.update_nameservers

if request.update_web_record is not None:
output["update_web_record"] = request.update_web_record

return output


def marshal_CreateHostingRequest(
request: CreateHostingRequest,
defaults: ProfileDefaults,
Expand All @@ -372,6 +397,13 @@ def marshal_CreateHostingRequest(
if request.domain is not None:
output["domain"] = request.domain

if request.domain_configuration is not None:
output["domain_configuration"] = (
marshal_CreateHostingRequestDomainConfiguration(
request.domain_configuration, defaults
)
)

if request.email is not None:
output["email"] = request.email

Expand Down Expand Up @@ -408,6 +440,9 @@ def marshal_UpdateHostingRequest(
if request.option_ids is not None:
output["option_ids"] = request.option_ids

if request.protected is not None:
output["protected"] = request.protected

if request.tags is not None:
output["tags"] = request.tags

Expand Down
26 changes: 26 additions & 0 deletions scaleway/scaleway/webhosting/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ class ControlPanel:
"""


@dataclass
class CreateHostingRequestDomainConfiguration:
update_nameservers: bool

update_web_record: bool

update_mail_record: bool

update_all_records: bool


@dataclass
class DnsRecord:
"""
Expand Down Expand Up @@ -305,6 +316,11 @@ class Hosting:
IPv6 address of the hosting's host server.
"""

protected: bool
"""
Whether the hosting is protected or not.
"""

region: Region
"""
Region where the Web Hosting plan is hosted.
Expand Down Expand Up @@ -549,6 +565,11 @@ class CreateHostingRequest:
Default language for the control panel interface.
"""

domain_configuration: Optional[CreateHostingRequestDomainConfiguration]
"""
Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements.
"""


@dataclass
class ListHostingsRequest:
Expand Down Expand Up @@ -648,6 +669,11 @@ class UpdateHostingRequest:
ID of the new offer for the Web Hosting plan.
"""

protected: Optional[bool]
"""
Whether the hosting is protected or not.
"""


@dataclass
class DeleteHostingRequest:
Expand Down
Loading