| 1 | from typing import List |
| 2 | from typing import Optional |
| 3 | from typing import Union |
| 4 | |
| 5 | from pydantic import BaseModel |
| 6 | from pydantic import Field |
| 7 | |
| 8 | |
| 9 | class ClusterHealth(BaseModel): |
| 10 | active_primary_shards: int |
| 11 | active_shards: int |
| 12 | active_shards_percent_as_number: Union[int, float] |
| 13 | cluster_name: str |
| 14 | delayed_unassigned_shards: int |
| 15 | discovered_cluster_manager: bool |
| 16 | discovered_master: bool |
| 17 | initializing_shards: int |
| 18 | number_of_data_nodes: int |
| 19 | number_of_in_flight_fetch: int |
| 20 | number_of_nodes: int |
| 21 | number_of_pending_tasks: int |
| 22 | relocating_shards: int |
| 23 | status: str |
| 24 | task_max_waiting_in_queue_millis: int |
| 25 | timed_out: bool |
| 26 | unassigned_shards: int |
| 27 | |
| 28 | |
| 29 | class ClusterHealthResponse(BaseModel): |
| 30 | cluster_health: Optional[ClusterHealth] = None |
| 31 | message: str |
| 32 | success: bool |
| 33 | |
| 34 | |
| 35 | class NodeAllocation(BaseModel): |
| 36 | disk_available: Optional[str] = Field(None, description="Disk available in bytes") |
| 37 | disk_percent: Optional[str] = Field(None, description="Disk percent") |
| 38 | disk_total: Optional[str] = Field(None, description="Disk total in bytes") |
| 39 | disk_used: Optional[str] = Field(None, description="Disk used in bytes") |
| 40 | node: str |
| 41 | |
| 42 | |
| 43 | class NodeAllocationResponse(BaseModel): |
| 44 | node_allocation: Optional[List[NodeAllocation]] = None |
| 45 | message: str |
| 46 | success: bool |
| 47 | |
| 48 | |
| 49 | class IndicesStats(BaseModel): |
| 50 | docs_count: Optional[str] = Field( |
| 51 | "Docs count not found", |
| 52 | description="Number of documents in the index", |
| 53 | ) |
| 54 | health: str |
| 55 | index: str |
| 56 | replica_count: str |
| 57 | store_size: Optional[str] = Field( |
| 58 | "Store size not found", |
| 59 | description="Number of store size in the index", |
| 60 | ) |
| 61 | |
| 62 | |
| 63 | class IndicesStatsResponse(BaseModel): |
| 64 | indices_stats: Optional[List[IndicesStats]] = None |
| 65 | message: str |
| 66 | success: bool |
| 67 | |
| 68 | |
| 69 | class Shards(BaseModel): |
| 70 | index: str |
| 71 | node: Optional[str] = Field(None, description="Node name") |
| 72 | shard: int |
| 73 | state: str |
| 74 | size: Optional[str] = Field(None, description="Shard size in bytes") |
| 75 | |
| 76 | |
| 77 | class ShardsResponse(BaseModel): |
| 78 | shards: Optional[List[Shards]] = None |
| 79 | message: str |
| 80 | success: bool |
| 81 | |
| 82 | |
| 83 | class CustomerIndicesSize(BaseModel): |
| 84 | customer: str |
| 85 | total_size_bytes: int |
| 86 | total_size_human: str |
| 87 | index_count: int |
| 88 | indices: List[str] |
| 89 | |
| 90 | |
| 91 | class CustomerIndicesSizeResponse(BaseModel): |
| 92 | customer_sizes: Optional[List[CustomerIndicesSize]] = None |
| 93 | message: str |
| 94 | success: bool |