1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
|