Skip to content

Commit f0a70cf

Browse files
authored
feat(mongodb): add DeleteEndpoint (#752)
1 parent 860d513 commit f0a70cf

File tree

6 files changed

+94
-0
lines changed

6 files changed

+94
-0
lines changed

scaleway-async/scaleway_async/mongodb/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from .types import CreateInstanceRequest
3232
from .types import CreateSnapshotRequest
3333
from .types import CreateUserRequest
34+
from .types import DeleteEndpointRequest
3435
from .types import DeleteInstanceRequest
3536
from .types import DeleteSnapshotRequest
3637
from .types import GetInstanceCertificateRequest
@@ -85,6 +86,7 @@
8586
"CreateInstanceRequest",
8687
"CreateSnapshotRequest",
8788
"CreateUserRequest",
89+
"DeleteEndpointRequest",
8890
"DeleteInstanceRequest",
8991
"DeleteSnapshotRequest",
9092
"GetInstanceCertificateRequest",

scaleway-async/scaleway_async/mongodb/v1alpha1/api.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,3 +1169,35 @@ async def update_user(
11691169

11701170
self._throw_on_error(res)
11711171
return unmarshal_User(res.json())
1172+
1173+
async def delete_endpoint(
1174+
self,
1175+
*,
1176+
endpoint_id: str,
1177+
region: Optional[Region] = None,
1178+
) -> None:
1179+
"""
1180+
Delete a Database Instance endpoint.
1181+
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.
1182+
:param endpoint_id: UUID of the Endpoint to delete.
1183+
:param region: Region to target. If none is passed will use default region from the config.
1184+
1185+
Usage:
1186+
::
1187+
1188+
result = await api.delete_endpoint(
1189+
endpoint_id="example",
1190+
)
1191+
"""
1192+
1193+
param_region = validate_path_param(
1194+
"region", region or self.client.default_region
1195+
)
1196+
param_endpoint_id = validate_path_param("endpoint_id", endpoint_id)
1197+
1198+
res = self._request(
1199+
"DELETE",
1200+
f"/mongodb/v1alpha1/regions/{param_region}/endpoints/{param_endpoint_id}",
1201+
)
1202+
1203+
self._throw_on_error(res)

scaleway-async/scaleway_async/mongodb/v1alpha1/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,19 @@ class CreateUserRequest:
615615
"""
616616

617617

618+
@dataclass
619+
class DeleteEndpointRequest:
620+
endpoint_id: str
621+
"""
622+
UUID of the Endpoint to delete.
623+
"""
624+
625+
region: Optional[Region]
626+
"""
627+
Region to target. If none is passed will use default region from the config.
628+
"""
629+
630+
618631
@dataclass
619632
class DeleteInstanceRequest:
620633
instance_id: str

scaleway/scaleway/mongodb/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from .types import CreateInstanceRequest
3232
from .types import CreateSnapshotRequest
3333
from .types import CreateUserRequest
34+
from .types import DeleteEndpointRequest
3435
from .types import DeleteInstanceRequest
3536
from .types import DeleteSnapshotRequest
3637
from .types import GetInstanceCertificateRequest
@@ -85,6 +86,7 @@
8586
"CreateInstanceRequest",
8687
"CreateSnapshotRequest",
8788
"CreateUserRequest",
89+
"DeleteEndpointRequest",
8890
"DeleteInstanceRequest",
8991
"DeleteSnapshotRequest",
9092
"GetInstanceCertificateRequest",

scaleway/scaleway/mongodb/v1alpha1/api.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,3 +1165,35 @@ def update_user(
11651165

11661166
self._throw_on_error(res)
11671167
return unmarshal_User(res.json())
1168+
1169+
def delete_endpoint(
1170+
self,
1171+
*,
1172+
endpoint_id: str,
1173+
region: Optional[Region] = None,
1174+
) -> None:
1175+
"""
1176+
Delete a Database Instance endpoint.
1177+
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.
1178+
:param endpoint_id: UUID of the Endpoint to delete.
1179+
:param region: Region to target. If none is passed will use default region from the config.
1180+
1181+
Usage:
1182+
::
1183+
1184+
result = api.delete_endpoint(
1185+
endpoint_id="example",
1186+
)
1187+
"""
1188+
1189+
param_region = validate_path_param(
1190+
"region", region or self.client.default_region
1191+
)
1192+
param_endpoint_id = validate_path_param("endpoint_id", endpoint_id)
1193+
1194+
res = self._request(
1195+
"DELETE",
1196+
f"/mongodb/v1alpha1/regions/{param_region}/endpoints/{param_endpoint_id}",
1197+
)
1198+
1199+
self._throw_on_error(res)

scaleway/scaleway/mongodb/v1alpha1/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,19 @@ class CreateUserRequest:
615615
"""
616616

617617

618+
@dataclass
619+
class DeleteEndpointRequest:
620+
endpoint_id: str
621+
"""
622+
UUID of the Endpoint to delete.
623+
"""
624+
625+
region: Optional[Region]
626+
"""
627+
Region to target. If none is passed will use default region from the config.
628+
"""
629+
630+
618631
@dataclass
619632
class DeleteInstanceRequest:
620633
instance_id: str

0 commit comments

Comments
 (0)