Skip to content
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
10 changes: 8 additions & 2 deletions scaleway-async/scaleway_async/s2s_vpn/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
from .types import CreateVpnGatewayRequestSingleIpTunnel
from .types import VpnGatewayPrivateConfig
from .types import VpnGatewayPublicConfig
from .types import ChangeConnectionPskRequestSecret
from .types import Connection
from .types import CreateConnectionRequestBgpConfig
from .types import CreateConnectionRequestSecret
from .types import Connection
from .types import CreateVpnGatewayRequestPublicConfig
from .types import CreateVpnGatewayRequestPublicTunnelConfig
from .types import CustomerGateway
from .types import RoutingPolicy
from .types import GatewayType
from .types import VpnGateway
from .types import ChangeConnectionPskRequest
from .types import ChangeConnectionPskResponse
from .types import CreateConnectionRequest
from .types import CreateConnectionResponse
from .types import CreateCustomerGatewayRequest
Expand Down Expand Up @@ -85,15 +88,18 @@
"CreateVpnGatewayRequestSingleIpTunnel",
"VpnGatewayPrivateConfig",
"VpnGatewayPublicConfig",
"ChangeConnectionPskRequestSecret",
"Connection",
"CreateConnectionRequestBgpConfig",
"CreateConnectionRequestSecret",
"Connection",
"CreateVpnGatewayRequestPublicConfig",
"CreateVpnGatewayRequestPublicTunnelConfig",
"CustomerGateway",
"RoutingPolicy",
"GatewayType",
"VpnGateway",
"ChangeConnectionPskRequest",
"ChangeConnectionPskResponse",
"CreateConnectionRequest",
"CreateConnectionResponse",
"CreateCustomerGatewayRequest",
Expand Down
63 changes: 62 additions & 1 deletion scaleway-async/scaleway_async/s2s_vpn/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
ListRoutingPoliciesRequestOrderBy,
ListVpnGatewaysRequestOrderBy,
VpnGatewayStatus,
ChangeConnectionPskRequest,
ChangeConnectionPskRequestSecret,
ChangeConnectionPskResponse,
Connection,
ConnectionCipher,
CreateConnectionRequest,
Expand All @@ -41,6 +44,7 @@
ListRoutingPoliciesResponse,
ListVpnGatewayTypesResponse,
ListVpnGatewaysResponse,
RenewConnectionPskRequest,
RenewConnectionPskResponse,
RoutingPolicy,
SetRoutingPolicyRequest,
Expand All @@ -58,18 +62,21 @@
unmarshal_CustomerGateway,
unmarshal_RoutingPolicy,
unmarshal_VpnGateway,
unmarshal_ChangeConnectionPskResponse,
unmarshal_CreateConnectionResponse,
unmarshal_ListConnectionsResponse,
unmarshal_ListCustomerGatewaysResponse,
unmarshal_ListRoutingPoliciesResponse,
unmarshal_ListVpnGatewayTypesResponse,
unmarshal_ListVpnGatewaysResponse,
unmarshal_RenewConnectionPskResponse,
marshal_ChangeConnectionPskRequest,
marshal_CreateConnectionRequest,
marshal_CreateCustomerGatewayRequest,
marshal_CreateRoutingPolicyRequest,
marshal_CreateVpnGatewayRequest,
marshal_DetachRoutingPolicyRequest,
marshal_RenewConnectionPskRequest,
marshal_SetRoutingPolicyRequest,
marshal_UpdateConnectionRequest,
marshal_UpdateCustomerGatewayRequest,
Expand Down Expand Up @@ -841,12 +848,14 @@ async def renew_connection_psk(
*,
connection_id: str,
region: Optional[ScwRegion] = None,
generate_revision: Optional[bool] = None,
) -> RenewConnectionPskResponse:
"""
Renew pre-shared key.
Renew pre-shared key for a given connection.
:param connection_id: ID of the connection to renew the PSK.
:param region: Region to target. If none is passed will use default region from the config.
:param generate_revision: Generate a new revision or update to the latest existing one.
:return: :class:`RenewConnectionPskResponse <RenewConnectionPskResponse>`

Usage:
Expand All @@ -865,12 +874,64 @@ async def renew_connection_psk(
res = self._request(
"POST",
f"/s2s-vpn/v1alpha1/regions/{param_region}/connections/{param_connection_id}/renew-psk",
body={},
body=marshal_RenewConnectionPskRequest(
RenewConnectionPskRequest(
connection_id=connection_id,
region=region,
generate_revision=generate_revision,
),
self.client,
),
)

self._throw_on_error(res)
return unmarshal_RenewConnectionPskResponse(res.json())

async def change_connection_psk(
self,
*,
connection_id: str,
secret: ChangeConnectionPskRequestSecret,
region: Optional[ScwRegion] = None,
) -> ChangeConnectionPskResponse:
"""
Change pre-shared key.
Change pre-shared key for a given connection.
:param connection_id: ID of the connection to renew the PSK.
:param secret: New PSK Secret of the connection.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`ChangeConnectionPskResponse <ChangeConnectionPskResponse>`

Usage:
::

result = await api.change_connection_psk(
connection_id="example",
secret=ChangeConnectionPskRequestSecret(),
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_connection_id = validate_path_param("connection_id", connection_id)

res = self._request(
"POST",
f"/s2s-vpn/v1alpha1/regions/{param_region}/connections/{param_connection_id}/change-psk",
body=marshal_ChangeConnectionPskRequest(
ChangeConnectionPskRequest(
connection_id=connection_id,
secret=secret,
region=region,
),
self.client,
),
)

self._throw_on_error(res)
return unmarshal_ChangeConnectionPskResponse(res.json())

async def set_routing_policy(
self,
*,
Expand Down
62 changes: 62 additions & 0 deletions scaleway-async/scaleway_async/s2s_vpn/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
VpnGatewayPrivateConfig,
VpnGatewayPublicConfig,
VpnGateway,
ChangeConnectionPskResponse,
CreateConnectionResponse,
ListConnectionsResponse,
ListCustomerGatewaysResponse,
Expand All @@ -31,6 +32,8 @@
ListVpnGatewayTypesResponse,
ListVpnGatewaysResponse,
RenewConnectionPskResponse,
ChangeConnectionPskRequestSecret,
ChangeConnectionPskRequest,
CreateConnectionRequestBgpConfig,
CreateConnectionRequestSecret,
CreateConnectionRequest,
Expand All @@ -42,6 +45,7 @@
CreateVpnGatewayRequestPublicTunnelConfig,
CreateVpnGatewayRequest,
DetachRoutingPolicyRequest,
RenewConnectionPskRequest,
SetRoutingPolicyRequest,
UpdateConnectionRequest,
UpdateCustomerGatewayRequest,
Expand Down Expand Up @@ -590,6 +594,23 @@ def unmarshal_VpnGateway(data: Any) -> VpnGateway:
return VpnGateway(**args)


def unmarshal_ChangeConnectionPskResponse(data: Any) -> ChangeConnectionPskResponse:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'ChangeConnectionPskResponse' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

field = data.get("connection", None)
if field is not None:
args["connection"] = unmarshal_Connection(field)
else:
args["connection"] = None

return ChangeConnectionPskResponse(**args)


def unmarshal_CreateConnectionResponse(data: Any) -> CreateConnectionResponse:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -802,6 +823,35 @@ def unmarshal_RenewConnectionPskResponse(data: Any) -> RenewConnectionPskRespons
return RenewConnectionPskResponse(**args)


def marshal_ChangeConnectionPskRequestSecret(
request: ChangeConnectionPskRequestSecret,
defaults: ProfileDefaults,
) -> dict[str, Any]:
output: dict[str, Any] = {}

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

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

return output


def marshal_ChangeConnectionPskRequest(
request: ChangeConnectionPskRequest,
defaults: ProfileDefaults,
) -> dict[str, Any]:
output: dict[str, Any] = {}

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

return output


def marshal_ConnectionCipher(
request: ConnectionCipher,
defaults: ProfileDefaults,
Expand Down Expand Up @@ -1119,6 +1169,18 @@ def marshal_DetachRoutingPolicyRequest(
return output


def marshal_RenewConnectionPskRequest(
request: RenewConnectionPskRequest,
defaults: ProfileDefaults,
) -> dict[str, Any]:
output: dict[str, Any] = {}

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

return output


def marshal_SetRoutingPolicyRequest(
request: SetRoutingPolicyRequest,
defaults: ProfileDefaults,
Expand Down
53 changes: 45 additions & 8 deletions scaleway-async/scaleway_async/s2s_vpn/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,7 @@ class VpnGatewayPublicConfig:


@dataclass
class CreateConnectionRequestBgpConfig:
routing_policy_id: str
private_ip: Optional[str] = None
peer_private_ip: Optional[str] = None


@dataclass
class CreateConnectionRequestSecret:
class ChangeConnectionPskRequestSecret:
id: str
revision: Optional[int] = None

Expand Down Expand Up @@ -340,6 +333,19 @@ class Connection:
"""


@dataclass
class CreateConnectionRequestBgpConfig:
routing_policy_id: str
private_ip: Optional[str] = None
peer_private_ip: Optional[str] = None


@dataclass
class CreateConnectionRequestSecret:
id: str
revision: Optional[int] = None


@dataclass
class CreateVpnGatewayRequestPublicConfig:
ipam_ipv4_id: Optional[str] = None
Expand Down Expand Up @@ -575,6 +581,32 @@ class VpnGateway:
private_config: Optional[VpnGatewayPrivateConfig] = None


@dataclass
class ChangeConnectionPskRequest:
connection_id: str
"""
ID of the connection to renew the PSK.
"""

secret: ChangeConnectionPskRequestSecret
"""
New PSK Secret of the connection.
"""

region: Optional[ScwRegion] = None
"""
Region to target. If none is passed will use default region from the config.
"""


@dataclass
class ChangeConnectionPskResponse:
connection: Optional[Connection] = None
"""
This connection.
"""


@dataclass
class CreateConnectionRequest:
name: str
Expand Down Expand Up @@ -1254,6 +1286,11 @@ class RenewConnectionPskRequest:
Region to target. If none is passed will use default region from the config.
"""

generate_revision: Optional[bool] = False
"""
Generate a new revision or update to the latest existing one.
"""


@dataclass
class RenewConnectionPskResponse:
Expand Down
10 changes: 8 additions & 2 deletions scaleway/scaleway/s2s_vpn/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
from .types import CreateVpnGatewayRequestSingleIpTunnel
from .types import VpnGatewayPrivateConfig
from .types import VpnGatewayPublicConfig
from .types import ChangeConnectionPskRequestSecret
from .types import Connection
from .types import CreateConnectionRequestBgpConfig
from .types import CreateConnectionRequestSecret
from .types import Connection
from .types import CreateVpnGatewayRequestPublicConfig
from .types import CreateVpnGatewayRequestPublicTunnelConfig
from .types import CustomerGateway
from .types import RoutingPolicy
from .types import GatewayType
from .types import VpnGateway
from .types import ChangeConnectionPskRequest
from .types import ChangeConnectionPskResponse
from .types import CreateConnectionRequest
from .types import CreateConnectionResponse
from .types import CreateCustomerGatewayRequest
Expand Down Expand Up @@ -85,15 +88,18 @@
"CreateVpnGatewayRequestSingleIpTunnel",
"VpnGatewayPrivateConfig",
"VpnGatewayPublicConfig",
"ChangeConnectionPskRequestSecret",
"Connection",
"CreateConnectionRequestBgpConfig",
"CreateConnectionRequestSecret",
"Connection",
"CreateVpnGatewayRequestPublicConfig",
"CreateVpnGatewayRequestPublicTunnelConfig",
"CustomerGateway",
"RoutingPolicy",
"GatewayType",
"VpnGateway",
"ChangeConnectionPskRequest",
"ChangeConnectionPskResponse",
"CreateConnectionRequest",
"CreateConnectionResponse",
"CreateCustomerGatewayRequest",
Expand Down
Loading
Loading