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
5 changes: 2 additions & 3 deletions scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,9 +1106,8 @@ async def wait_for_server_private_network(
options = WaitForOptions()

if not options.stop:
options.stop = (
lambda res: res.status
not in SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES
options.stop = lambda res: (
res.status not in SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES
)

return await wait_for_resource_async(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ def unmarshal_OS(data: Any) -> OS:
else:
args["xcode_version"] = None

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

field = data.get("release_notes_url", None)
if field is not None:
args["release_notes_url"] = field
Expand Down Expand Up @@ -164,12 +170,6 @@ def unmarshal_OS(data: Any) -> OS:
else:
args["supported_server_types"] = []

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

return OS(**args)


Expand Down
10 changes: 5 additions & 5 deletions scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ class OS:
The current xcode version for this OS.
"""

compatible_server_types: list[str]
"""
List of compatible server types. Deprecated.
"""

release_notes_url: str
"""
Url of the release notes for the OS image or software pre-installed.
Expand All @@ -225,11 +230,6 @@ class OS:
List of server types which supports the OS configuration. Also gives information about immediate stock availability.
"""

compatible_server_types: Optional[list[str]] = field(default_factory=list)
"""
List of compatible server types. Deprecated.
"""


@dataclass
class RunnerConfiguration:
Expand Down
4 changes: 2 additions & 2 deletions scaleway-async/scaleway_async/dedibox/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,8 +1352,8 @@ async def wait_for_server_install(
options = WaitForOptions()

if not options.stop:
options.stop = (
lambda res: res.status not in SERVER_INSTALL_TRANSIENT_STATUSES
options.stop = lambda res: (
res.status not in SERVER_INSTALL_TRANSIENT_STATUSES
)

return await wait_for_resource_async(
Expand Down
10 changes: 6 additions & 4 deletions scaleway-async/scaleway_async/function/v1beta1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,32 +271,34 @@ async def wait_for_namespace(
async def create_namespace(
self,
*,
activate_vpc_integration: bool,
region: Optional[ScwRegion] = None,
name: Optional[str] = None,
environment_variables: Optional[dict[str, str]] = None,
project_id: Optional[str] = None,
description: Optional[str] = None,
secret_environment_variables: Optional[list[Secret]] = None,
tags: Optional[list[str]] = None,
activate_vpc_integration: Optional[bool] = None,
) -> Namespace:
"""
Create a new namespace.
Create a new namespace in a specified Organization or Project.
:param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future.
:param region: Region to target. If none is passed will use default region from the config.
:param name:
:param environment_variables: Environment variables of the namespace.
:param project_id: UUID of the project in which the namespace will be created.
:param description: Description of the namespace.
:param secret_environment_variables: Secret environment variables of the namespace.
:param tags: Tags of the Serverless Function Namespace.
:param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future.
:return: :class:`Namespace <Namespace>`

Usage:
::

result = await api.create_namespace()
result = await api.create_namespace(
activate_vpc_integration=False,
)
"""

param_region = validate_path_param(
Expand All @@ -308,14 +310,14 @@ async def create_namespace(
f"/functions/v1beta1/regions/{param_region}/namespaces",
body=marshal_CreateNamespaceRequest(
CreateNamespaceRequest(
activate_vpc_integration=activate_vpc_integration,
region=region,
name=name or random_name(prefix="ns"),
environment_variables=environment_variables,
project_id=project_id,
description=description,
secret_environment_variables=secret_environment_variables,
tags=tags,
activate_vpc_integration=activate_vpc_integration,
),
self.client,
),
Expand Down
30 changes: 15 additions & 15 deletions scaleway-async/scaleway_async/function/v1beta1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ def unmarshal_Namespace(data: Any) -> Namespace:
else:
args["tags"] = []

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

field = data.get("description", None)
if field is not None:
args["description"] = field
Expand All @@ -455,12 +461,6 @@ def unmarshal_Namespace(data: Any) -> Namespace:
else:
args["updated_at"] = None

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

return Namespace(**args)


Expand All @@ -484,6 +484,12 @@ def unmarshal_Token(data: Any) -> Token:
else:
args["token"] = None

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

field = data.get("status", None)
if field is not None:
args["status"] = field
Expand All @@ -502,12 +508,6 @@ def unmarshal_Token(data: Any) -> Token:
else:
args["namespace_id"] = None

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

field = data.get("description", None)
if field is not None:
args["description"] = field
Expand Down Expand Up @@ -1114,6 +1114,9 @@ def marshal_CreateNamespaceRequest(
) -> dict[str, Any]:
output: dict[str, Any] = {}

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

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

Expand All @@ -1137,9 +1140,6 @@ def marshal_CreateNamespaceRequest(
if request.tags is not None:
output["tags"] = request.tags

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

return output


Expand Down
28 changes: 14 additions & 14 deletions scaleway-async/scaleway_async/function/v1beta1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ class Namespace:
List of tags applied to the Serverless Function Namespace.
"""

vpc_integration_activated: bool
"""
The value of this field doesn't matter anymore, and will be removed in a near future.
"""

error_message: Optional[str] = None
"""
Error message if the namespace is in "error" state.
Expand All @@ -648,11 +653,6 @@ class Namespace:
Last update date of the namespace.
"""

vpc_integration_activated: Optional[bool] = False
"""
The value of this field doesn't matter anymore, and will be removed in a near future.
"""


@dataclass
class Token:
Expand All @@ -666,14 +666,14 @@ class Token:
String of the token.
"""

status: TokenStatus
public_key: str
"""
Status of the token.
Public key of the token.
"""

public_key: Optional[str] = None
status: TokenStatus
"""
Public key of the token.
Status of the token.
"""

description: Optional[str] = None
Expand Down Expand Up @@ -875,6 +875,11 @@ class CreateFunctionRequest:

@dataclass
class CreateNamespaceRequest:
activate_vpc_integration: bool
"""
Setting this field to true doesn't matter anymore. It will be removed in a near future.
"""

region: Optional[ScwRegion] = None
"""
Region to target. If none is passed will use default region from the config.
Expand Down Expand Up @@ -906,11 +911,6 @@ class CreateNamespaceRequest:
Tags of the Serverless Function Namespace.
"""

activate_vpc_integration: Optional[bool] = False
"""
Setting this field to true doesn't matter anymore. It will be removed in a near future.
"""


@dataclass
class CreateTokenRequest:
Expand Down
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/iam/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
from .types import GetPolicyRequest
from .types import GetQuotumRequest
from .types import GetSSHKeyRequest
from .types import GetSamlCertificateRequest
from .types import GetUserConnectionsRequest
from .types import GetUserConnectionsResponse
from .types import GetUserRequest
Expand Down Expand Up @@ -248,6 +249,7 @@
"GetPolicyRequest",
"GetQuotumRequest",
"GetSSHKeyRequest",
"GetSamlCertificateRequest",
"GetUserConnectionsRequest",
"GetUserConnectionsResponse",
"GetUserRequest",
Expand Down
28 changes: 28 additions & 0 deletions scaleway-async/scaleway_async/iam/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3324,6 +3324,34 @@ async def add_saml_certificate(
self._throw_on_error(res)
return unmarshal_SamlCertificate(res.json())

async def get_saml_certificate(
self,
*,
certificate_id: str,
) -> SamlCertificate:
"""
Get a SAML certificate.
:param certificate_id: ID of the certificate to get.
:return: :class:`SamlCertificate <SamlCertificate>`

Usage:
::

result = await api.get_saml_certificate(
certificate_id="example",
)
"""

param_certificate_id = validate_path_param("certificate_id", certificate_id)

res = self._request(
"GET",
f"/iam/v1alpha1/saml-certificates/{param_certificate_id}",
)

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

async def delete_saml_certificate(
self,
*,
Expand Down
24 changes: 12 additions & 12 deletions scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,18 @@ def unmarshal_User(data: Any) -> User:
else:
args["type_"] = UserType.UNKNOWN_TYPE

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

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

field = data.get("mfa", None)
if field is not None:
args["mfa"] = field
Expand All @@ -951,18 +963,6 @@ def unmarshal_User(data: Any) -> User:
else:
args["locked"] = False

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

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

return User(**args)


Expand Down
Loading
Loading