Skip to content
Open
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
29 changes: 17 additions & 12 deletions scaleway-async/scaleway_async/autoscaling/v1alpha2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@


class AutoscalingV1Alpha2API(API):
"""
Instances Autoscaling Groups management API.
"""
""" """

async def list_groups(
self,
Expand Down Expand Up @@ -101,7 +99,8 @@ async def get_group(
) -> Group:
"""
Get an autoscaling group.
Get details of a specified autoscaling group including its configuration, current size, and status.
Get details of a specified autoscaling group including its
configuration, current size, and status.
:param group_id: ID of the group to get.
:param zone: Zone to target. If none is passed will use default zone from the config.
:return: :class:`Group <Group>`
Expand Down Expand Up @@ -134,7 +133,8 @@ async def wait_for_group(
) -> Group:
"""
Get an autoscaling group.
Get details of a specified autoscaling group including its configuration, current size, and status.
Get details of a specified autoscaling group including its
configuration, current size, and status.
:param group_id: ID of the group to get.
:param zone: Zone to target. If none is passed will use default zone from the config.
:return: :class:`Group <Group>`
Expand Down Expand Up @@ -177,7 +177,9 @@ async def create_group(
) -> Group:
"""
Create an autoscaling group.
Create a new autoscaling group with the specified configuration including template, scaling policy, and optional load balancer settings.
Create a new autoscaling group with the specified configuration
including template, scaling policy, and optional load balancer
settings.
:param name: Name of the autoscaling group.
:param template_id: Template ID for instances in this group.
:param zone: Zone to target. If none is passed will use default zone from the config.
Expand Down Expand Up @@ -233,7 +235,8 @@ async def update_group(
) -> Group:
"""
Update an autoscaling group.
Update the configuration of a specified autoscaling group including name, tags, template, scaling policy, and load balancer settings.
Update the configuration of a specified autoscaling group including
name, tags, template, scaling policy, and load balancer settings.
:param group_id: ID of the group to update.
:param zone: Zone to target. If none is passed will use default zone from the config.
:param name: New name for the group.
Expand Down Expand Up @@ -282,7 +285,8 @@ async def delete_group(
) -> Group:
"""
Delete an autoscaling group.
Delete a specified autoscaling group and all its associated resources.
Delete a specified autoscaling group and all its associated
resources.
:param group_id: ID of the group to delete.
:param zone: Zone to target. If none is passed will use default zone from the config.
:return: :class:`Group <Group>`
Expand Down Expand Up @@ -317,8 +321,9 @@ async def list_logs(
end_time: Optional[datetime] = None,
) -> ListLogsResponse:
"""
List group logs.
List logs for a specified autoscaling group to view scaling events and activities.
List autoscaling group logs.
List logs for a specified autoscaling group to view scaling events
and activities.
:param group_id:
:param zone: Zone to target. If none is passed will use default zone from the config.
:param page_token:
Expand Down Expand Up @@ -361,7 +366,7 @@ async def list_servers(
page_size: Optional[int] = None,
) -> ListServersResponse:
"""
List group servers.
List autoscaling group servers.
List all Instances belonging to a specified autoscaling group.
:param group_id:
:param zone: Zone to target. If none is passed will use default zone from the config.
Expand Down Expand Up @@ -402,7 +407,7 @@ async def list_alerts(
project_id: Optional[str] = None,
) -> ListAlertsResponse:
"""
List group alerts.
List autoscaling group alerts.
List active and historical alerts for a specified autoscaling group.
:param zone: Zone to target. If none is passed will use default zone from the config.
:param group_id:
Expand Down
6 changes: 4 additions & 2 deletions scaleway-async/scaleway_async/instance/v2alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from .types import CreateServerRequestPublicNetworkInterface
from .types import CreateServerRequestServerVolume
from .types import PlacementGroup
from .types import PrivateNetworkInterface
from .types import PrivateNetworkInterfaceSummary
from .types import SecurityGroupSummary
from .types import ServerType
from .types import ServerSummary
Expand Down Expand Up @@ -108,6 +108,7 @@
from .types import ListUserDataKeysRequest
from .types import ListUserDataKeysResponse
from .types import PauseServerRequest
from .types import PrivateNetworkInterface
from .types import RebootServerRequest
from .types import ResourceCounts
from .types import Server
Expand Down Expand Up @@ -174,7 +175,7 @@
"CreateServerRequestPublicNetworkInterface",
"CreateServerRequestServerVolume",
"PlacementGroup",
"PrivateNetworkInterface",
"PrivateNetworkInterfaceSummary",
"SecurityGroupSummary",
"ServerType",
"ServerSummary",
Expand Down Expand Up @@ -239,6 +240,7 @@
"ListUserDataKeysRequest",
"ListUserDataKeysResponse",
"PauseServerRequest",
"PrivateNetworkInterface",
"RebootServerRequest",
"ResourceCounts",
"Server",
Expand Down
2 changes: 1 addition & 1 deletion scaleway-async/scaleway_async/instance/v2alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
from .marshalling import (
unmarshal_SecurityGroup,
unmarshal_PlacementGroup,
unmarshal_PrivateNetworkInterface,
unmarshal_AddSecurityGroupRulesResponse,
unmarshal_ListPlacementGroupsResponse,
unmarshal_ListPrivateNetworkInterfacesResponse,
Expand All @@ -98,6 +97,7 @@
unmarshal_ListTemplateUserDataKeysResponse,
unmarshal_ListTemplatesResponse,
unmarshal_ListUserDataKeysResponse,
unmarshal_PrivateNetworkInterface,
unmarshal_ResourceCounts,
unmarshal_Server,
unmarshal_Template,
Expand Down
206 changes: 143 additions & 63 deletions scaleway-async/scaleway_async/instance/v2alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
SecurityGroupRule,
SecurityGroup,
PlacementGroup,
PrivateNetworkInterface,
AddSecurityGroupRulesResponse,
ListPlacementGroupsResponse,
PrivateNetworkInterfaceSummary,
ListPrivateNetworkInterfacesResponse,
SecurityGroupSummary,
ListSecurityGroupsResponse,
Expand All @@ -30,6 +30,7 @@
TemplateSummary,
ListTemplatesResponse,
ListUserDataKeysResponse,
PrivateNetworkInterface,
ResourceCounts,
ServerIP,
ServerFilesystem,
Expand Down Expand Up @@ -339,10 +340,70 @@ def unmarshal_PlacementGroup(data: Any) -> PlacementGroup:
return PlacementGroup(**args)


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

args: dict[str, Any] = {}

field = data.get("added_rules", None)
if field is not None:
args["added_rules"] = (
[unmarshal_SecurityGroupRule(v) for v in field]
if field is not None
else None
)
else:
args["added_rules"] = None

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

return AddSecurityGroupRulesResponse(**args)


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

args: dict[str, Any] = {}

field = data.get("placement_groups", None)
if field is not None:
args["placement_groups"] = (
[unmarshal_PlacementGroup(v) for v in field] if field is not None else None
)
else:
args["placement_groups"] = None

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

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

return ListPlacementGroupsResponse(**args)


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

args: dict[str, Any] = {}
Expand Down Expand Up @@ -413,65 +474,7 @@ def unmarshal_PrivateNetworkInterface(data: Any) -> PrivateNetworkInterface:
else:
args["updated_at"] = None

return PrivateNetworkInterface(**args)


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

args: dict[str, Any] = {}

field = data.get("added_rules", None)
if field is not None:
args["added_rules"] = (
[unmarshal_SecurityGroupRule(v) for v in field]
if field is not None
else None
)
else:
args["added_rules"] = None

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

return AddSecurityGroupRulesResponse(**args)


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

args: dict[str, Any] = {}

field = data.get("placement_groups", None)
if field is not None:
args["placement_groups"] = (
[unmarshal_PlacementGroup(v) for v in field] if field is not None else None
)
else:
args["placement_groups"] = None

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

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

return ListPlacementGroupsResponse(**args)
return PrivateNetworkInterfaceSummary(**args)


def unmarshal_ListPrivateNetworkInterfacesResponse(
Expand All @@ -487,7 +490,7 @@ def unmarshal_ListPrivateNetworkInterfacesResponse(
field = data.get("private_network_interfaces", None)
if field is not None:
args["private_network_interfaces"] = (
[unmarshal_PrivateNetworkInterface(v) for v in field]
[unmarshal_PrivateNetworkInterfaceSummary(v) for v in field]
if field is not None
else None
)
Expand Down Expand Up @@ -1115,6 +1118,83 @@ def unmarshal_ListUserDataKeysResponse(data: Any) -> ListUserDataKeysResponse:
return ListUserDataKeysResponse(**args)


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

args: dict[str, Any] = {}

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

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

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

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

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

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

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

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

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

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("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

return PrivateNetworkInterface(**args)


def unmarshal_ResourceCounts(data: Any) -> ResourceCounts:
if not isinstance(data, dict):
raise TypeError(
Expand Down
Loading
Loading