From f0f96f83c2630e890a2cbcab53f77fd4c37e1684 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Thu, 19 Feb 2026 02:43:23 -0500 Subject: Models, Project files, some pytests, requirements.. etc --- jb/models/__init__.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 jb/models/__init__.py (limited to 'jb/models/__init__.py') diff --git a/jb/models/__init__.py b/jb/models/__init__.py new file mode 100644 index 0000000..0aeae14 --- /dev/null +++ b/jb/models/__init__.py @@ -0,0 +1,40 @@ +from decimal import Decimal +from typing import Optional + +from pydantic import BaseModel, Field, ConfigDict + + +class HTTPHeaders(BaseModel): + request_id: str = Field(alias="x-amzn-requestid", min_length=36, max_length=36) + content_type: str = Field(alias="content-type", min_length=26, max_length=26) + # 'content-length': '1255', + content_length: str = Field(alias="content-length", min_length=2) + # 'Mon, 15 Jan 2024 23:40:32 GMT' + date: str = Field() + + connection: Optional[str] = Field(default=None) # 'close' + + +class ResponseMetadata(BaseModel): + model_config = ConfigDict(extra="forbid", validate_assignment=True) + + request_id: str = Field(alias="RequestId", min_length=36, max_length=36) + status_code: int = Field(alias="HTTPStatusCode", ge=200, le=599) + headers: HTTPHeaders = Field(alias="HTTPHeaders") + retry_attempts: int = Field(alias="RetryAttempts", ge=0) + + +class AMTAccount(BaseModel): + model_config = ConfigDict(extra="ignore", validate_assignment=True) + + # Remaining available AWS Billing usage if you have enabled AWS Billing. + available_balance: Decimal = Field() + onhold_balance: Decimal = Field(default=Decimal(0)) + + # --- Properties --- + + @property + def is_healthy(self) -> bool: + # A healthy account is one with at least $2,500 worth of + # credit available to it + return self.available_balance >= 2_500 -- cgit v1.2.3