Skip to content

feat(secret_manager): add missing regions #353

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

Merged
merged 1 commit into from
Oct 27, 2023
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
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/secret/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .types import ListFoldersRequestOrderBy
from .types import ListSecretsRequestOrderBy
from .types import Product
from .types import SecretEphemeralAction
from .types import SecretStatus
from .types import SecretType
from .types import SecretVersionStatus
Expand All @@ -21,6 +22,7 @@
"ListFoldersRequestOrderBy",
"ListSecretsRequestOrderBy",
"Product",
"SecretEphemeralAction",
"SecretStatus",
"SecretType",
"SecretVersionStatus",
Expand Down
16 changes: 16 additions & 0 deletions scaleway-async/scaleway_async/secret/v1alpha1/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.

from datetime import datetime
from typing import List, Optional

from scaleway_core.api import API
Expand All @@ -15,6 +16,7 @@
ListFoldersRequestOrderBy,
ListSecretsRequestOrderBy,
Product,
SecretEphemeralAction,
SecretType,
SecretVersionStatus,
AccessSecretVersionResponse,
Expand Down Expand Up @@ -66,11 +68,13 @@ async def create_secret(
*,
name: str,
type_: SecretType,
ephemeral_action: SecretEphemeralAction,
region: Optional[Region] = None,
project_id: Optional[str] = None,
tags: Optional[List[str]] = None,
description: Optional[str] = None,
path: Optional[str] = None,
expires_at: Optional[datetime] = None,
) -> Secret:
"""
Create a secret.
Expand All @@ -84,6 +88,9 @@ async def create_secret(
(Optional.) See `Secret.Type` enum for description of values. If not specified, the type is `Opaque`.
:param path: Path of the secret.
(Optional.) Location of the secret in the directory structure. If not specified, the path is `/`.
:param expires_at: Expiration date of the secret.
(Optional.) Date on which the secret will be deleted or deactivated.
:param ephemeral_action: Action to be taken when the secret expires.
:return: :class:`Secret <Secret>`

Usage:
Expand All @@ -92,6 +99,7 @@ async def create_secret(
result = await api.create_secret(
name="example",
type_=unknown_secret_type,
ephemeral_action=unknown_ephemeral_action,
)
"""

Expand All @@ -106,11 +114,13 @@ async def create_secret(
CreateSecretRequest(
name=name,
type_=type_,
ephemeral_action=ephemeral_action,
region=region,
project_id=project_id,
tags=tags,
description=description,
path=path,
expires_at=expires_at,
),
self.client,
),
Expand Down Expand Up @@ -303,6 +313,7 @@ async def list_secrets(
name: Optional[str] = None,
is_managed: Optional[bool] = None,
path: Optional[str] = None,
is_ephemeral: Optional[bool] = None,
) -> ListSecretsResponse:
"""
List secrets.
Expand All @@ -317,6 +328,7 @@ async def list_secrets(
:param name: Filter by secret name (optional).
:param is_managed: Filter by managed / not managed (optional).
:param path: Filter by path (optional).
:param is_ephemeral: Filter by ephemeral / not ephemeral (optional).
:return: :class:`ListSecretsResponse <ListSecretsResponse>`

Usage:
Expand All @@ -333,6 +345,7 @@ async def list_secrets(
"GET",
f"/secret-manager/v1alpha1/regions/{param_region}/secrets",
params={
"is_ephemeral": is_ephemeral,
"is_managed": is_managed,
"name": name,
"order_by": order_by,
Expand Down Expand Up @@ -362,6 +375,7 @@ async def list_secrets_all(
name: Optional[str] = None,
is_managed: Optional[bool] = None,
path: Optional[str] = None,
is_ephemeral: Optional[bool] = None,
) -> List[Secret]:
"""
List secrets.
Expand All @@ -376,6 +390,7 @@ async def list_secrets_all(
:param name: Filter by secret name (optional).
:param is_managed: Filter by managed / not managed (optional).
:param path: Filter by path (optional).
:param is_ephemeral: Filter by ephemeral / not ephemeral (optional).
:return: :class:`List[ListSecretsResponse] <List[ListSecretsResponse]>`

Usage:
Expand All @@ -399,6 +414,7 @@ async def list_secrets_all(
"name": name,
"is_managed": is_managed,
"path": path,
"is_ephemeral": is_ephemeral,
},
)

Expand Down
16 changes: 16 additions & 0 deletions scaleway-async/scaleway_async/secret/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from dateutil import parser
from .types import (
Product,
SecretEphemeralAction,
SecretType,
AccessSecretVersionResponse,
Folder,
Expand Down Expand Up @@ -71,9 +72,18 @@ def unmarshal_Secret(data: Any) -> Secret:
field = data.get("description", None)
args["description"] = field

field = data.get("ephemeral_action", None)
args["ephemeral_action"] = field

field = data.get("expires_at", None)
args["expires_at"] = parser.isoparse(field) if type(field) is str else field

field = data.get("id", None)
args["id"] = field

field = data.get("is_ephemeral", None)
args["is_ephemeral"] = field

field = data.get("is_managed", None)
args["is_managed"] = field

Expand Down Expand Up @@ -305,6 +315,12 @@ def marshal_CreateSecretRequest(
if request.description is not None:
output["description"] = request.description

if request.ephemeral_action is not None:
output["ephemeral_action"] = SecretEphemeralAction(request.ephemeral_action)

if request.expires_at is not None:
output["expires_at"] = request.expires_at.astimezone().isoformat()

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

Expand Down
42 changes: 42 additions & 0 deletions scaleway-async/scaleway_async/secret/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ def __str__(self) -> str:
return str(self.value)


class SecretEphemeralAction(str, Enum, metaclass=StrEnumMeta):
UNKNOWN_EPHEMERAL_ACTION = "unknown_ephemeral_action"
DELETE_SECRET = "delete_secret"
DISABLE_SECRET = "disable_secret"

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


class SecretStatus(str, Enum, metaclass=StrEnumMeta):
READY = "ready"
LOCKED = "locked"
Expand Down Expand Up @@ -309,6 +318,23 @@ class Secret:
Location of the secret in the directory structure.
"""

expires_at: Optional[datetime]
"""
Expiration date of the secret.
(Optional.) Date on which the secret will be deleted or deactivated.
"""

ephemeral_action: SecretEphemeralAction
"""
Action to be taken when the secret expires.
See `Secret.EphemeralAction` enum for description of values.
"""

is_ephemeral: bool
"""
Returns `true` for secrets that are ephemeral.
"""

region: Region
"""
Region of the secret.
Expand Down Expand Up @@ -401,6 +427,17 @@ class CreateSecretRequest:
(Optional.) Location of the secret in the directory structure. If not specified, the path is `/`.
"""

expires_at: Optional[datetime]
"""
Expiration date of the secret.
(Optional.) Date on which the secret will be deleted or deactivated.
"""

ephemeral_action: SecretEphemeralAction
"""
Action to be taken when the secret expires.
"""


@dataclass
class CreateFolderRequest:
Expand Down Expand Up @@ -535,6 +572,11 @@ class ListSecretsRequest:
Filter by path (optional).
"""

is_ephemeral: Optional[bool]
"""
Filter by ephemeral / not ephemeral (optional).
"""


@dataclass
class ListFoldersRequest:
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/secret/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .types import ListFoldersRequestOrderBy
from .types import ListSecretsRequestOrderBy
from .types import Product
from .types import SecretEphemeralAction
from .types import SecretStatus
from .types import SecretType
from .types import SecretVersionStatus
Expand All @@ -21,6 +22,7 @@
"ListFoldersRequestOrderBy",
"ListSecretsRequestOrderBy",
"Product",
"SecretEphemeralAction",
"SecretStatus",
"SecretType",
"SecretVersionStatus",
Expand Down
16 changes: 16 additions & 0 deletions scaleway/scaleway/secret/v1alpha1/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.

from datetime import datetime
from typing import List, Optional

from scaleway_core.api import API
Expand All @@ -15,6 +16,7 @@
ListFoldersRequestOrderBy,
ListSecretsRequestOrderBy,
Product,
SecretEphemeralAction,
SecretType,
SecretVersionStatus,
AccessSecretVersionResponse,
Expand Down Expand Up @@ -66,11 +68,13 @@ def create_secret(
*,
name: str,
type_: SecretType,
ephemeral_action: SecretEphemeralAction,
region: Optional[Region] = None,
project_id: Optional[str] = None,
tags: Optional[List[str]] = None,
description: Optional[str] = None,
path: Optional[str] = None,
expires_at: Optional[datetime] = None,
) -> Secret:
"""
Create a secret.
Expand All @@ -84,6 +88,9 @@ def create_secret(
(Optional.) See `Secret.Type` enum for description of values. If not specified, the type is `Opaque`.
:param path: Path of the secret.
(Optional.) Location of the secret in the directory structure. If not specified, the path is `/`.
:param expires_at: Expiration date of the secret.
(Optional.) Date on which the secret will be deleted or deactivated.
:param ephemeral_action: Action to be taken when the secret expires.
:return: :class:`Secret <Secret>`

Usage:
Expand All @@ -92,6 +99,7 @@ def create_secret(
result = api.create_secret(
name="example",
type_=unknown_secret_type,
ephemeral_action=unknown_ephemeral_action,
)
"""

Expand All @@ -106,11 +114,13 @@ def create_secret(
CreateSecretRequest(
name=name,
type_=type_,
ephemeral_action=ephemeral_action,
region=region,
project_id=project_id,
tags=tags,
description=description,
path=path,
expires_at=expires_at,
),
self.client,
),
Expand Down Expand Up @@ -303,6 +313,7 @@ def list_secrets(
name: Optional[str] = None,
is_managed: Optional[bool] = None,
path: Optional[str] = None,
is_ephemeral: Optional[bool] = None,
) -> ListSecretsResponse:
"""
List secrets.
Expand All @@ -317,6 +328,7 @@ def list_secrets(
:param name: Filter by secret name (optional).
:param is_managed: Filter by managed / not managed (optional).
:param path: Filter by path (optional).
:param is_ephemeral: Filter by ephemeral / not ephemeral (optional).
:return: :class:`ListSecretsResponse <ListSecretsResponse>`

Usage:
Expand All @@ -333,6 +345,7 @@ def list_secrets(
"GET",
f"/secret-manager/v1alpha1/regions/{param_region}/secrets",
params={
"is_ephemeral": is_ephemeral,
"is_managed": is_managed,
"name": name,
"order_by": order_by,
Expand Down Expand Up @@ -362,6 +375,7 @@ def list_secrets_all(
name: Optional[str] = None,
is_managed: Optional[bool] = None,
path: Optional[str] = None,
is_ephemeral: Optional[bool] = None,
) -> List[Secret]:
"""
List secrets.
Expand All @@ -376,6 +390,7 @@ def list_secrets_all(
:param name: Filter by secret name (optional).
:param is_managed: Filter by managed / not managed (optional).
:param path: Filter by path (optional).
:param is_ephemeral: Filter by ephemeral / not ephemeral (optional).
:return: :class:`List[ListSecretsResponse] <List[ListSecretsResponse]>`

Usage:
Expand All @@ -399,6 +414,7 @@ def list_secrets_all(
"name": name,
"is_managed": is_managed,
"path": path,
"is_ephemeral": is_ephemeral,
},
)

Expand Down
Loading