| 1 | from typing import Dict |
| 2 | from typing import List |
| 3 | from typing import Optional |
| 4 | |
| 5 | from pydantic import BaseModel |
| 6 | from pydantic import Field |
| 7 | |
| 8 | |
| 9 | class Document(BaseModel): |
| 10 | count: int |
| 11 | deleted: int |
| 12 | |
| 13 | |
| 14 | class Operation(BaseModel): |
| 15 | time_seconds: int |
| 16 | total: int |
| 17 | |
| 18 | |
| 19 | class ShardInfo(BaseModel): |
| 20 | documents: Document |
| 21 | flush: Operation |
| 22 | get: Operation |
| 23 | index: Operation |
| 24 | merge: Operation |
| 25 | open_search_contexts: int |
| 26 | refresh: Operation |
| 27 | search_fetch: Operation |
| 28 | search_query: Operation |
| 29 | segments: int |
| 30 | store_size_bytes: int |
| 31 | |
| 32 | |
| 33 | class Routing(BaseModel): |
| 34 | active: bool |
| 35 | id: int |
| 36 | node_hostname: str |
| 37 | node_id: str |
| 38 | node_name: str |
| 39 | primary: bool |
| 40 | relocating_to: Optional[str] = Field(None, description="Relocating to") |
| 41 | state: str |
| 42 | |
| 43 | |
| 44 | class IndexInfo(BaseModel): |
| 45 | all_shards: ShardInfo |
| 46 | primary_shards: ShardInfo |
| 47 | reopened: bool |
| 48 | routing: List[Routing] |
| 49 | |
| 50 | |
| 51 | class GraylogIndexItem(BaseModel): |
| 52 | index_name: str |
| 53 | index_info: IndexInfo |
| 54 | |
| 55 | |
| 56 | class GraylogIndicesResponse(BaseModel): |
| 57 | indices: List[GraylogIndexItem] |
| 58 | message: str |
| 59 | success: bool |
| 60 | |
| 61 | |
| 62 | class ConfiguredInputAttributes(BaseModel): |
| 63 | recv_buffer_size: int |
| 64 | tcp_keepalive: Optional[bool] = Field(None, description="TCP keepalive") |
| 65 | use_null_delimiter: Optional[bool] = None |
| 66 | number_worker_threads: int |
| 67 | tls_client_auth_cert_file: Optional[str] = None |
| 68 | force_rdns: Optional[bool] = None |
| 69 | bind_address: str |
| 70 | tls_cert_file: Optional[str] = None |
| 71 | store_full_message: Optional[bool] = None |
| 72 | expand_structured_data: Optional[bool] = None |
| 73 | port: int |
| 74 | tls_key_file: Optional[str] = None |
| 75 | tls_enable: Optional[bool] = Field(None, description="TLS is enabled") |
| 76 | tls_key_password: Optional[str] = None |
| 77 | max_message_size: Optional[int] = None |
| 78 | tls_client_auth: Optional[str] = Field(None, description="TLS client authentication") |
| 79 | override_source: Optional[str] = None |
| 80 | charset_name: Optional[str] = None |
| 81 | allow_override_date: Optional[bool] = None |
| 82 | |
| 83 | |
| 84 | class ConfiguredInput(BaseModel): |
| 85 | title: str |
| 86 | global_field: bool = Field(alias="global") |
| 87 | name: str |
| 88 | content_pack: Optional[str] = None |
| 89 | created_at: str |
| 90 | type: str |
| 91 | creator_user_id: str |
| 92 | attributes: ConfiguredInputAttributes |
| 93 | static_fields: Dict[str, str] |
| 94 | node: Optional[str] = None |
| 95 | id: str |
| 96 | |
| 97 | |
| 98 | class MessageInputAttributes(BaseModel): |
| 99 | recv_buffer_size: int |
| 100 | tcp_keepalive: Optional[bool] = Field(None, description="TCP keepalive") |
| 101 | use_null_delimiter: Optional[bool] = None |
| 102 | number_worker_threads: int |
| 103 | tls_client_auth_cert_file: Optional[str] = None |
| 104 | bind_address: str |
| 105 | tls_cert_file: Optional[str] = None |
| 106 | port: int |
| 107 | tls_key_file: Optional[str] = None |
| 108 | tls_enable: Optional[bool] = Field(None, description="TLS is enabled") |
| 109 | tls_key_password: Optional[str] = None |
| 110 | max_message_size: Optional[int] = None |
| 111 | tls_client_auth: Optional[str] = Field(None, description="TLS client authentication") |
| 112 | |
| 113 | |
| 114 | class MessageInput(BaseModel): |
| 115 | title: str |
| 116 | global_field: bool = Field(alias="global") |
| 117 | name: str |
| 118 | content_pack: Optional[str] = None |
| 119 | created_at: str |
| 120 | type: str |
| 121 | creator_user_id: str |
| 122 | attributes: MessageInputAttributes |
| 123 | static_fields: Dict[str, str] |
| 124 | node: Optional[str] = None |
| 125 | id: str |
| 126 | |
| 127 | |
| 128 | class RunningInput(BaseModel): |
| 129 | id: str |
| 130 | state: str |
| 131 | started_at: str |
| 132 | detailed_message: Optional[str] = None |
| 133 | message_input: MessageInput |
| 134 | |
| 135 | |
| 136 | class ConfiguredInputsResponse(BaseModel): |
| 137 | configured_inputs: List[ConfiguredInput] |
| 138 | message: str |
| 139 | success: bool |
| 140 | |
| 141 | |
| 142 | class RunningInputsResponse(BaseModel): |
| 143 | running_inputs: List[RunningInput] |
| 144 | message: str |
| 145 | success: bool |
| 146 | |
| 147 | |
| 148 | class GraylogInputsResponse(BaseModel): |
| 149 | configured_inputs: List[ConfiguredInput] |
| 150 | running_inputs: List[RunningInput] |
| 151 | message: str |
| 152 | success: bool |