mirror of
https://github.com/remnawave/python-sdk.git
synced 2026-05-13 12:16:42 +00:00
feat: add nodes bulk actions and revoke-only-passwords support
This commit is contained in:
parent
93987d7452
commit
34595a5e5b
5 changed files with 39 additions and 4 deletions
|
|
@ -17,11 +17,13 @@ from remnawave.models import (
|
|||
RestartNodeResponseDto,
|
||||
UpdateNodeRequestDto,
|
||||
UpdateNodeResponseDto,
|
||||
RestartAllNodesRequestBodyDto,
|
||||
RestartAllNodesRequestBodyDto,
|
||||
ResetNodeTrafficRequestDto,
|
||||
ResetNodeTrafficResponseDto,
|
||||
ProfileModificationRequestDto,
|
||||
ProfileModificationResponseDto,
|
||||
NodesBulkActionsRequestDto,
|
||||
NodesBulkActionsResponseDto,
|
||||
)
|
||||
from remnawave.rapid import BaseController, delete, get, patch, post
|
||||
|
||||
|
|
@ -120,4 +122,12 @@ class NodesController(BaseController):
|
|||
body: Annotated[ProfileModificationRequestDto, PydanticBody()],
|
||||
) -> ProfileModificationResponseDto:
|
||||
"""Modify Inbounds & Profile for many nodes"""
|
||||
...
|
||||
|
||||
@post("/nodes/bulk-actions", response_class=NodesBulkActionsResponseDto)
|
||||
async def nodes_bulk_actions(
|
||||
self,
|
||||
body: Annotated[NodesBulkActionsRequestDto, PydanticBody()],
|
||||
) -> NodesBulkActionsResponseDto:
|
||||
"""Perform actions for many nodes (ENABLE, DISABLE, RESTART, RESET_TRAFFIC)"""
|
||||
...
|
||||
|
|
@ -35,6 +35,7 @@ TServiceEvents = Literal[
|
|||
"service.panel_started",
|
||||
"service.login_attempt_failed",
|
||||
"service.login_attempt_success",
|
||||
"service.subpage_config_changed",
|
||||
]
|
||||
|
||||
TErrorsEvents = Literal[
|
||||
|
|
|
|||
|
|
@ -196,6 +196,9 @@ from .nodes import (
|
|||
ResetNodeTrafficResponseDto,
|
||||
ProfileModificationRequestDto,
|
||||
ProfileModificationResponseDto,
|
||||
NodeBulkActionType,
|
||||
NodesBulkActionsRequestDto,
|
||||
NodesBulkActionsResponseDto,
|
||||
)
|
||||
from .nodes_usage_history import (
|
||||
GetNodeUserUsageByRangeResponseDto,
|
||||
|
|
@ -488,6 +491,9 @@ __all__ = [
|
|||
"ResetNodeTrafficResponseDto",
|
||||
"ProfileModificationRequestDto",
|
||||
"ProfileModificationResponseDto",
|
||||
"NodeBulkActionType",
|
||||
"NodesBulkActionsRequestDto",
|
||||
"NodesBulkActionsResponseDto",
|
||||
# Hosts models
|
||||
"CreateHostRequestDto",
|
||||
"CreateHostResponseDto",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from datetime import datetime
|
||||
from typing import Annotated, List, Optional, Union
|
||||
from typing import Annotated, List, Optional, Union, Literal
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field, StringConstraints, RootModel
|
||||
|
|
@ -253,4 +253,18 @@ class ProfileModificationResponseDto(ProfileModificationResponseData):
|
|||
|
||||
# Для обратной совместимости
|
||||
RestartAllNodesRequestDto = RestartAllNodesRequestBodyDto
|
||||
NodesResponseDto = NodeResponseDto
|
||||
NodesResponseDto = NodeResponseDto
|
||||
|
||||
|
||||
NodeBulkActionType = Literal["ENABLE", "DISABLE", "RESTART", "RESET_TRAFFIC"]
|
||||
|
||||
|
||||
class NodesBulkActionsRequestDto(BaseModel):
|
||||
"""Request for performing bulk actions on nodes"""
|
||||
uuids: List[UUID] = Field(min_length=1)
|
||||
action: NodeBulkActionType = Field(description="Action to perform on nodes")
|
||||
|
||||
|
||||
class NodesBulkActionsResponseDto(BaseModel):
|
||||
"""Response after performing bulk actions on nodes"""
|
||||
event_sent: bool = Field(alias="eventSent")
|
||||
|
|
@ -196,7 +196,11 @@ class RevokeUserRequestDto(BaseModel):
|
|||
max_length=48,
|
||||
pattern=r"^[a-zA-Z0-9_-]+$",
|
||||
)
|
||||
|
||||
revoke_only_passwords: Optional[bool] = Field(
|
||||
None,
|
||||
serialization_alias="revokeOnlyPasswords",
|
||||
description="Optional. If true, only passwords will be revoked without changing the short UUID.",
|
||||
)
|
||||
|
||||
class SubscriptionRequestRecord(BaseModel):
|
||||
"""Subscription request history record"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue