Skip to content

feat(mongodb): add DeleteEndpoint #752

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
Nov 18, 2024
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/mongodb/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .types import CreateInstanceRequest
from .types import CreateSnapshotRequest
from .types import CreateUserRequest
from .types import DeleteEndpointRequest
from .types import DeleteInstanceRequest
from .types import DeleteSnapshotRequest
from .types import GetInstanceCertificateRequest
Expand Down Expand Up @@ -85,6 +86,7 @@
"CreateInstanceRequest",
"CreateSnapshotRequest",
"CreateUserRequest",
"DeleteEndpointRequest",
"DeleteInstanceRequest",
"DeleteSnapshotRequest",
"GetInstanceCertificateRequest",
Expand Down
32 changes: 32 additions & 0 deletions scaleway-async/scaleway_async/mongodb/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,3 +1169,35 @@ async def update_user(

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

async def delete_endpoint(
self,
*,
endpoint_id: str,
region: Optional[Region] = None,
) -> None:
"""
Delete a Database Instance endpoint.
Delete the endpoint of a Database Instance. You must specify the `endpoint_id` parameter of the endpoint you want to delete. Note that you might need to update any environment configurations that point to the deleted endpoint.
:param endpoint_id: UUID of the Endpoint to delete.
:param region: Region to target. If none is passed will use default region from the config.

Usage:
::

result = await api.delete_endpoint(
endpoint_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_endpoint_id = validate_path_param("endpoint_id", endpoint_id)

res = self._request(
"DELETE",
f"/mongodb/v1alpha1/regions/{param_region}/endpoints/{param_endpoint_id}",
)

self._throw_on_error(res)
13 changes: 13 additions & 0 deletions scaleway-async/scaleway_async/mongodb/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,19 @@ class CreateUserRequest:
"""


@dataclass
class DeleteEndpointRequest:
endpoint_id: str
"""
UUID of the Endpoint to delete.
"""

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


@dataclass
class DeleteInstanceRequest:
instance_id: str
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/mongodb/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .types import CreateInstanceRequest
from .types import CreateSnapshotRequest
from .types import CreateUserRequest
from .types import DeleteEndpointRequest
from .types import DeleteInstanceRequest
from .types import DeleteSnapshotRequest
from .types import GetInstanceCertificateRequest
Expand Down Expand Up @@ -85,6 +86,7 @@
"CreateInstanceRequest",
"CreateSnapshotRequest",
"CreateUserRequest",
"DeleteEndpointRequest",
"DeleteInstanceRequest",
"DeleteSnapshotRequest",
"GetInstanceCertificateRequest",
Expand Down
32 changes: 32 additions & 0 deletions scaleway/scaleway/mongodb/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,3 +1165,35 @@ def update_user(

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

def delete_endpoint(
self,
*,
endpoint_id: str,
region: Optional[Region] = None,
) -> None:
"""
Delete a Database Instance endpoint.
Delete the endpoint of a Database Instance. You must specify the `endpoint_id` parameter of the endpoint you want to delete. Note that you might need to update any environment configurations that point to the deleted endpoint.
:param endpoint_id: UUID of the Endpoint to delete.
:param region: Region to target. If none is passed will use default region from the config.

Usage:
::

result = api.delete_endpoint(
endpoint_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_endpoint_id = validate_path_param("endpoint_id", endpoint_id)

res = self._request(
"DELETE",
f"/mongodb/v1alpha1/regions/{param_region}/endpoints/{param_endpoint_id}",
)

self._throw_on_error(res)
13 changes: 13 additions & 0 deletions scaleway/scaleway/mongodb/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,19 @@ class CreateUserRequest:
"""


@dataclass
class DeleteEndpointRequest:
endpoint_id: str
"""
UUID of the Endpoint to delete.
"""

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


@dataclass
class DeleteInstanceRequest:
instance_id: str
Expand Down