2023-05-12 20:05:38 +00:00
|
|
|
"""SporeStack API supplemental models"""
|
2022-02-10 21:47:57 +00:00
|
|
|
|
2023-05-12 20:05:38 +00:00
|
|
|
import sys
|
2024-02-27 00:45:32 +00:00
|
|
|
from typing import Union
|
2022-02-10 21:47:57 +00:00
|
|
|
|
2023-05-12 20:05:38 +00:00
|
|
|
if sys.version_info >= (3, 9): # pragma: nocover
|
|
|
|
from typing import Annotated
|
|
|
|
else: # pragma: nocover
|
|
|
|
from typing_extensions import Annotated
|
2022-02-10 21:47:57 +00:00
|
|
|
|
2024-02-27 00:45:32 +00:00
|
|
|
# Re-export Currency
|
2023-05-12 20:05:38 +00:00
|
|
|
from pydantic import BaseModel, Field
|
2022-02-10 21:47:57 +00:00
|
|
|
|
2024-02-27 00:45:32 +00:00
|
|
|
from ._models import Currency as Currency
|
2022-06-14 02:40:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Flavor(BaseModel):
|
|
|
|
# Unique string to identify the flavor that's sort of human readable.
|
|
|
|
slug: str
|
|
|
|
# Number of vCPU cores the server is given.
|
|
|
|
cores: int
|
|
|
|
# Memory in Megabytes
|
|
|
|
memory: int
|
|
|
|
# Disk in Gigabytes
|
|
|
|
disk: int
|
|
|
|
# USD cents per day
|
|
|
|
price: int
|
|
|
|
# IPv4 connectivity: "/32"
|
|
|
|
ipv4: str
|
|
|
|
# IPv6 connectivity: "/128"
|
|
|
|
ipv6: str
|
2023-05-12 16:29:12 +00:00
|
|
|
"""Gigabytes of bandwidth per day."""
|
|
|
|
bandwidth_per_month: float
|
|
|
|
"""Gigabytes of bandwidth per month."""
|
2023-04-14 15:14:57 +00:00
|
|
|
|
|
|
|
|
2023-04-14 21:57:08 +00:00
|
|
|
class OperatingSystem(BaseModel):
|
|
|
|
slug: str
|
|
|
|
"""Unique string to identify the operating system."""
|
|
|
|
minimum_disk: int
|
|
|
|
"""Minimum disk storage required in GiB"""
|
|
|
|
provider_slug: str
|
|
|
|
"""Unique string to identify the operating system."""
|
|
|
|
|
|
|
|
|
2023-04-14 15:14:57 +00:00
|
|
|
class TokenInfo(BaseModel):
|
|
|
|
balance_cents: int
|
|
|
|
balance_usd: str
|
2023-04-14 21:57:08 +00:00
|
|
|
burn_rate_cents: int
|
|
|
|
burn_rate_usd: str
|
2023-04-14 15:14:57 +00:00
|
|
|
days_remaining: int
|
|
|
|
servers: int
|
2023-10-31 21:14:57 +00:00
|
|
|
autorenew_servers: int
|
|
|
|
suspended_servers: int
|
2023-05-12 14:27:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Region(BaseModel):
|
|
|
|
# Unique string to identify the region that's sort of human readable.
|
|
|
|
slug: str
|
|
|
|
# Actually human readable string describing the region.
|
|
|
|
name: str
|
2023-05-12 20:05:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Invoice(BaseModel):
|
2024-01-03 21:13:48 +00:00
|
|
|
id: str
|
2023-05-12 20:05:38 +00:00
|
|
|
payment_uri: Annotated[
|
|
|
|
str, Field(description="Cryptocurrency URI for the payment.")
|
|
|
|
]
|
|
|
|
cryptocurrency: Annotated[
|
|
|
|
Currency,
|
|
|
|
Field(description="Cryptocurrency that will be used to pay this invoice."),
|
|
|
|
]
|
|
|
|
amount: Annotated[
|
|
|
|
int,
|
|
|
|
Field(
|
|
|
|
description="Amount of cents to add to the token if this invoice is paid."
|
|
|
|
),
|
|
|
|
]
|
|
|
|
fiat_per_coin: Annotated[
|
|
|
|
str,
|
|
|
|
Field(
|
|
|
|
description="Stringified float of the price when this was made.",
|
|
|
|
example="100.00",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
created: Annotated[
|
|
|
|
int, Field(description="Timestamp of when this invoice was created.")
|
|
|
|
]
|
|
|
|
expires: Annotated[
|
|
|
|
int, Field(description="Timestamp of when this invoice will expire.")
|
|
|
|
]
|
|
|
|
paid: Annotated[
|
|
|
|
int, Field(description="Timestamp of when this invoice was paid. 0 if unpaid.")
|
|
|
|
]
|
|
|
|
txid: Annotated[
|
|
|
|
Union[str, None],
|
|
|
|
Field(
|
|
|
|
description="TXID of the transaction for this payment, if it was paid.",
|
|
|
|
min_length=64,
|
|
|
|
max_length=64,
|
2023-07-07 22:26:25 +00:00
|
|
|
pattern="^[a-f0-9]+$",
|
2023-05-12 20:05:38 +00:00
|
|
|
),
|
|
|
|
]
|
|
|
|
expired: Annotated[
|
|
|
|
bool,
|
|
|
|
Field(
|
|
|
|
description=(
|
|
|
|
"Whether or not the invoice has expired (only applicable if "
|
|
|
|
"unpaid, or payment not yet confirmed."
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]
|
2023-05-25 16:24:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ServerUpdateRequest(BaseModel):
|
|
|
|
hostname: Annotated[
|
|
|
|
Union[str, None],
|
|
|
|
Field(
|
|
|
|
min_length=0,
|
|
|
|
max_length=128,
|
|
|
|
title="Hostname",
|
|
|
|
description="Hostname to refer to your server by.",
|
|
|
|
example="web-1",
|
2023-07-07 22:26:25 +00:00
|
|
|
pattern="(^$|^[a-zA-Z0-9-_. ]+$)",
|
2023-05-25 16:24:08 +00:00
|
|
|
),
|
|
|
|
] = None
|
|
|
|
autorenew: Annotated[
|
|
|
|
Union[bool, None],
|
|
|
|
Field(
|
|
|
|
title="Autorenew",
|
|
|
|
description=(
|
|
|
|
"Automatically renew the server from the token, "
|
|
|
|
"keeping it at 1 week expiration."
|
|
|
|
),
|
|
|
|
example=True,
|
|
|
|
),
|
|
|
|
] = None
|