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(vpc_gw): add ability to upgrade Public Gateway to a specific commercial offer type #607

Merged
merged 1 commit into from
Jul 25, 2024
Merged
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
17 changes: 14 additions & 3 deletions scaleway-async/scaleway_async/vpcgw/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
UpdateGatewayRequest,
UpdateIPRequest,
UpdatePATRuleRequest,
UpgradeGatewayRequest,
)
from .content import (
GATEWAY_NETWORK_TRANSIENT_STATUSES,
Expand Down Expand Up @@ -93,6 +94,7 @@
marshal_UpdateGatewayRequest,
marshal_UpdateIPRequest,
marshal_UpdatePATRuleRequest,
marshal_UpgradeGatewayRequest,
)


Expand Down Expand Up @@ -448,12 +450,14 @@ async def upgrade_gateway(
*,
gateway_id: str,
zone: Optional[Zone] = None,
type_: Optional[str] = None,
) -> Gateway:
"""
Upgrade a Public Gateway to the latest version.
Upgrade a given Public Gateway to the newest software version. This applies the latest bugfixes and features to your Public Gateway, but its service will be interrupted during the update.
Upgrade a Public Gateway to the latest version and/or to a different commercial offer type.
Upgrade a given Public Gateway to the newest software version or to a different commercial offer type. This applies the latest bugfixes and features to your Public Gateway. Note that gateway service will be interrupted during the update.
:param gateway_id: ID of the gateway to upgrade.
:param zone: Zone to target. If none is passed will use default zone from the config.
:param type_: Gateway type (commercial offer).
:return: :class:`Gateway <Gateway>`

Usage:
Expand All @@ -470,7 +474,14 @@ async def upgrade_gateway(
res = self._request(
"POST",
f"/vpc-gw/v1/zones/{param_zone}/gateways/{param_gateway_id}/upgrade",
body={},
body=marshal_UpgradeGatewayRequest(
UpgradeGatewayRequest(
gateway_id=gateway_id,
zone=zone,
type_=type_,
),
self.client,
),
)

self._throw_on_error(res)
Expand Down
13 changes: 13 additions & 0 deletions scaleway-async/scaleway_async/vpcgw/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
UpdateGatewayRequest,
UpdateIPRequest,
UpdatePATRuleRequest,
UpgradeGatewayRequest,
)


Expand Down Expand Up @@ -1127,3 +1128,15 @@ def marshal_UpdatePATRuleRequest(
output["protocol"] = str(request.protocol)

return output


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

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

return output
5 changes: 5 additions & 0 deletions scaleway-async/scaleway_async/vpcgw/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1746,3 +1746,8 @@ class UpgradeGatewayRequest:
"""
Zone to target. If none is passed will use default zone from the config.
"""

type_: Optional[str]
"""
Gateway type (commercial offer).
"""
17 changes: 14 additions & 3 deletions scaleway/scaleway/vpcgw/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
UpdateGatewayRequest,
UpdateIPRequest,
UpdatePATRuleRequest,
UpgradeGatewayRequest,
)
from .content import (
GATEWAY_NETWORK_TRANSIENT_STATUSES,
Expand Down Expand Up @@ -93,6 +94,7 @@
marshal_UpdateGatewayRequest,
marshal_UpdateIPRequest,
marshal_UpdatePATRuleRequest,
marshal_UpgradeGatewayRequest,
)


Expand Down Expand Up @@ -448,12 +450,14 @@ def upgrade_gateway(
*,
gateway_id: str,
zone: Optional[Zone] = None,
type_: Optional[str] = None,
) -> Gateway:
"""
Upgrade a Public Gateway to the latest version.
Upgrade a given Public Gateway to the newest software version. This applies the latest bugfixes and features to your Public Gateway, but its service will be interrupted during the update.
Upgrade a Public Gateway to the latest version and/or to a different commercial offer type.
Upgrade a given Public Gateway to the newest software version or to a different commercial offer type. This applies the latest bugfixes and features to your Public Gateway. Note that gateway service will be interrupted during the update.
:param gateway_id: ID of the gateway to upgrade.
:param zone: Zone to target. If none is passed will use default zone from the config.
:param type_: Gateway type (commercial offer).
:return: :class:`Gateway <Gateway>`

Usage:
Expand All @@ -470,7 +474,14 @@ def upgrade_gateway(
res = self._request(
"POST",
f"/vpc-gw/v1/zones/{param_zone}/gateways/{param_gateway_id}/upgrade",
body={},
body=marshal_UpgradeGatewayRequest(
UpgradeGatewayRequest(
gateway_id=gateway_id,
zone=zone,
type_=type_,
),
self.client,
),
)

self._throw_on_error(res)
Expand Down
13 changes: 13 additions & 0 deletions scaleway/scaleway/vpcgw/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
UpdateGatewayRequest,
UpdateIPRequest,
UpdatePATRuleRequest,
UpgradeGatewayRequest,
)


Expand Down Expand Up @@ -1127,3 +1128,15 @@ def marshal_UpdatePATRuleRequest(
output["protocol"] = str(request.protocol)

return output


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

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

return output
5 changes: 5 additions & 0 deletions scaleway/scaleway/vpcgw/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1746,3 +1746,8 @@ class UpgradeGatewayRequest:
"""
Zone to target. If none is passed will use default zone from the config.
"""

type_: Optional[str]
"""
Gateway type (commercial offer).
"""