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
4 changes: 4 additions & 0 deletions scaleway-async/scaleway_async/lb/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import AclActionRedirectRedirectType
from .types import AclActionType
from .types import AclHttpFilter
from .types import BackendServerStatsHealthCheckStatus
Expand All @@ -26,6 +27,7 @@
from .types import StickySessionsType
from .types import Acl
from .types import AclAction
from .types import AclActionRedirect
from .types import AclMatch
from .types import AclSpec
from .types import Backend
Expand Down Expand Up @@ -75,6 +77,7 @@
from .api import LbZonedV1API

__all__ = [
"AclActionRedirectRedirectType",
"AclActionType",
"AclHttpFilter",
"BackendServerStatsHealthCheckStatus",
Expand All @@ -101,6 +104,7 @@
"StickySessionsType",
"Acl",
"AclAction",
"AclActionRedirect",
"AclMatch",
"AclSpec",
"Backend",
Expand Down
39 changes: 39 additions & 0 deletions scaleway-async/scaleway_async/lb/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
)
from dateutil import parser
from .types import (
AclActionRedirectRedirectType,
AclActionType,
AclHttpFilter,
ForwardPortAlgorithm,
Expand All @@ -20,6 +21,7 @@
StickySessionsType,
Acl,
AclAction,
AclActionRedirect,
AclMatch,
AclSpec,
Backend,
Expand Down Expand Up @@ -475,6 +477,26 @@ def unmarshal_Lb(data: Any) -> Lb:
return Lb(**args)


def unmarshal_AclActionRedirect(data: Any) -> AclActionRedirect:
if type(data) is not dict:
raise TypeError(
f"Unmarshalling the type 'AclActionRedirect' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("code")
args["code"] = field

field = data.get("target")
args["target"] = field

field = data.get("type_")
args["type_"] = field

return AclActionRedirect(**args)


def unmarshal_Backend(data: Any) -> Backend:
if type(data) is not dict:
raise TypeError(
Expand Down Expand Up @@ -607,6 +629,9 @@ def unmarshal_AclAction(data: Any) -> AclAction:

args: Dict[str, Any] = {}

field = data.get("redirect")
args["redirect"] = unmarshal_AclActionRedirect(field) if field is not None else None

field = data.get("type_")
args["type_"] = field

Expand Down Expand Up @@ -1109,11 +1134,25 @@ def unmarshal_SetAclsResponse(data: Any) -> SetAclsResponse:
return SetAclsResponse(**args)


def marshal_AclActionRedirect(
request: AclActionRedirect,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
return {
"code": request.code,
"target": request.target,
"type": AclActionRedirectRedirectType(request.type_),
}


def marshal_AclAction(
request: AclAction,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
return {
"redirect": marshal_AclActionRedirect(request.redirect, defaults)
if request.redirect is not None
else None,
"type": AclActionType(request.type_),
}

Expand Down
43 changes: 43 additions & 0 deletions scaleway-async/scaleway_async/lb/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@
)


class AclActionRedirectRedirectType(str, Enum):
LOCATION = "location"
SCHEME = "scheme"

def __str__(self) -> str:
return str(self.value)


class AclActionType(str, Enum):
ALLOW = "allow"
DENY = "deny"
REDIRECT = "redirect"

def __str__(self) -> str:
return str(self.value)
Expand Down Expand Up @@ -326,6 +335,40 @@ class AclAction:
The action type
"""

redirect: Optional[AclActionRedirect]
"""
Redirect parameters when using an ACL with `redirect` action
"""


@dataclass
class AclActionRedirect:
"""
Acl action redirect
"""

type_: AclActionRedirectRedirectType
"""
Redirect type
"""

target: str
"""
An URL can be used in case of a location redirect (e.g. `https://scaleway.com` will redirect to this same URL).
A scheme name (e.g. `https`, `http`, `ftp`, `git`) will replace the request's original scheme. This can be useful to implement HTTP to HTTPS redirects.
Placeholders can be used when using a `location` redirect in order to insert original request's parts, these are:
- `{{ host }}` for the current request's Host header
- `{{ query }}` for the current request's query string
- `{{ path }}` for the current request's URL path
- `{{ scheme }}` for the current request's scheme

"""

code: Optional[int]
"""
HTTP redirect code to use. Valid values are 301, 302, 303, 307 and 308. Default value is 302
"""


@dataclass
class AclMatch:
Expand Down
4 changes: 4 additions & 0 deletions scaleway/scaleway/lb/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import AclActionRedirectRedirectType
from .types import AclActionType
from .types import AclHttpFilter
from .types import BackendServerStatsHealthCheckStatus
Expand All @@ -26,6 +27,7 @@
from .types import StickySessionsType
from .types import Acl
from .types import AclAction
from .types import AclActionRedirect
from .types import AclMatch
from .types import AclSpec
from .types import Backend
Expand Down Expand Up @@ -75,6 +77,7 @@
from .api import LbZonedV1API

__all__ = [
"AclActionRedirectRedirectType",
"AclActionType",
"AclHttpFilter",
"BackendServerStatsHealthCheckStatus",
Expand All @@ -101,6 +104,7 @@
"StickySessionsType",
"Acl",
"AclAction",
"AclActionRedirect",
"AclMatch",
"AclSpec",
"Backend",
Expand Down
39 changes: 39 additions & 0 deletions scaleway/scaleway/lb/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
)
from dateutil import parser
from .types import (
AclActionRedirectRedirectType,
AclActionType,
AclHttpFilter,
ForwardPortAlgorithm,
Expand All @@ -20,6 +21,7 @@
StickySessionsType,
Acl,
AclAction,
AclActionRedirect,
AclMatch,
AclSpec,
Backend,
Expand Down Expand Up @@ -475,6 +477,26 @@ def unmarshal_Lb(data: Any) -> Lb:
return Lb(**args)


def unmarshal_AclActionRedirect(data: Any) -> AclActionRedirect:
if type(data) is not dict:
raise TypeError(
f"Unmarshalling the type 'AclActionRedirect' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("code")
args["code"] = field

field = data.get("target")
args["target"] = field

field = data.get("type_")
args["type_"] = field

return AclActionRedirect(**args)


def unmarshal_Backend(data: Any) -> Backend:
if type(data) is not dict:
raise TypeError(
Expand Down Expand Up @@ -607,6 +629,9 @@ def unmarshal_AclAction(data: Any) -> AclAction:

args: Dict[str, Any] = {}

field = data.get("redirect")
args["redirect"] = unmarshal_AclActionRedirect(field) if field is not None else None

field = data.get("type_")
args["type_"] = field

Expand Down Expand Up @@ -1109,11 +1134,25 @@ def unmarshal_SetAclsResponse(data: Any) -> SetAclsResponse:
return SetAclsResponse(**args)


def marshal_AclActionRedirect(
request: AclActionRedirect,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
return {
"code": request.code,
"target": request.target,
"type": AclActionRedirectRedirectType(request.type_),
}


def marshal_AclAction(
request: AclAction,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
return {
"redirect": marshal_AclActionRedirect(request.redirect, defaults)
if request.redirect is not None
else None,
"type": AclActionType(request.type_),
}

Expand Down
43 changes: 43 additions & 0 deletions scaleway/scaleway/lb/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@
)


class AclActionRedirectRedirectType(str, Enum):
LOCATION = "location"
SCHEME = "scheme"

def __str__(self) -> str:
return str(self.value)


class AclActionType(str, Enum):
ALLOW = "allow"
DENY = "deny"
REDIRECT = "redirect"

def __str__(self) -> str:
return str(self.value)
Expand Down Expand Up @@ -326,6 +335,40 @@ class AclAction:
The action type
"""

redirect: Optional[AclActionRedirect]
"""
Redirect parameters when using an ACL with `redirect` action
"""


@dataclass
class AclActionRedirect:
"""
Acl action redirect
"""

type_: AclActionRedirectRedirectType
"""
Redirect type
"""

target: str
"""
An URL can be used in case of a location redirect (e.g. `https://scaleway.com` will redirect to this same URL).
A scheme name (e.g. `https`, `http`, `ftp`, `git`) will replace the request's original scheme. This can be useful to implement HTTP to HTTPS redirects.
Placeholders can be used when using a `location` redirect in order to insert original request's parts, these are:
- `{{ host }}` for the current request's Host header
- `{{ query }}` for the current request's query string
- `{{ path }}` for the current request's URL path
- `{{ scheme }}` for the current request's scheme

"""

code: Optional[int]
"""
HTTP redirect code to use. Valid values are 301, 302, 303, 307 and 308. Default value is 302
"""


@dataclass
class AclMatch:
Expand Down