mirror of
https://github.com/kennethreitz/neon-api-python.git
synced 2026-06-05 22:50:18 +00:00
1078 lines
42 KiB
Python
1078 lines
42 KiB
Python
# generated by datamodel-codegen:
|
|
# filename: v2.json
|
|
# timestamp: 2024-01-17T17:45:44+00:00
|
|
|
|
from __future__ import annotations
|
|
|
|
from enum import Enum
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
|
|
from pydantic import (
|
|
AwareDatetime,
|
|
BaseModel,
|
|
ConfigDict,
|
|
Field,
|
|
RootModel,
|
|
confloat,
|
|
conint,
|
|
constr,
|
|
)
|
|
|
|
|
|
class Provisioner(Enum):
|
|
k8s_pod = "k8s-pod"
|
|
k8s_neonvm = "k8s-neonvm"
|
|
|
|
|
|
class Pagination(BaseModel):
|
|
cursor: constr(min_length=1)
|
|
|
|
|
|
class EmptyResponse(BaseModel):
|
|
pass
|
|
|
|
|
|
class ApiKeyCreateRequest(BaseModel):
|
|
key_name: str = Field(
|
|
...,
|
|
description="A user-specified API key name. This value is required when creating an API key.",
|
|
)
|
|
|
|
|
|
class ApiKeyCreateResponse(BaseModel):
|
|
id: int = Field(..., description="The API key ID")
|
|
key: str = Field(
|
|
..., description="The generated 64-bit token required to access the Neon API"
|
|
)
|
|
name: str = Field(..., description="The user-specified API key name")
|
|
created_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the API key was created"
|
|
)
|
|
|
|
|
|
class ApiKeyRevokeResponse(BaseModel):
|
|
id: int = Field(..., description="The API key ID")
|
|
name: str = Field(..., description="The user-specified API key name")
|
|
revoked: bool = Field(
|
|
...,
|
|
description="A `true` or `false` value indicating whether the API key is revoked",
|
|
)
|
|
last_used_at: Optional[AwareDatetime] = Field(
|
|
None, description="A timestamp indicating when the API was last used"
|
|
)
|
|
last_used_from_addr: str = Field(
|
|
..., description="The IP address from which the API key was last used"
|
|
)
|
|
|
|
|
|
class ApiKeysListResponseItem(BaseModel):
|
|
id: int = Field(..., description="The API key ID")
|
|
name: str = Field(..., description="The user-specified API key name")
|
|
created_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the API key was created"
|
|
)
|
|
last_used_at: Optional[AwareDatetime] = Field(
|
|
None, description="A timestamp indicating when the API was last used"
|
|
)
|
|
last_used_from_addr: str = Field(
|
|
..., description="The IP address from which the API key was last used"
|
|
)
|
|
|
|
|
|
class OperationAction(Enum):
|
|
create_compute = "create_compute"
|
|
create_timeline = "create_timeline"
|
|
start_compute = "start_compute"
|
|
suspend_compute = "suspend_compute"
|
|
apply_config = "apply_config"
|
|
check_availability = "check_availability"
|
|
delete_timeline = "delete_timeline"
|
|
create_branch = "create_branch"
|
|
tenant_ignore = "tenant_ignore"
|
|
tenant_attach = "tenant_attach"
|
|
tenant_detach = "tenant_detach"
|
|
tenant_reattach = "tenant_reattach"
|
|
replace_safekeeper = "replace_safekeeper"
|
|
disable_maintenance = "disable_maintenance"
|
|
apply_storage_config = "apply_storage_config"
|
|
|
|
|
|
class OperationStatus(Enum):
|
|
running = "running"
|
|
finished = "finished"
|
|
failed = "failed"
|
|
scheduling = "scheduling"
|
|
|
|
|
|
class BranchUpdateItem(BaseModel):
|
|
name: Optional[str] = Field(
|
|
None,
|
|
description="The branch name. If not specified, the default branch name will be used.\n",
|
|
)
|
|
role_name: Optional[str] = Field(
|
|
None,
|
|
description="The role name. If not specified, the default role name will be used.\n",
|
|
)
|
|
database_name: Optional[str] = Field(
|
|
None,
|
|
description="The database name. If not specified, the default database name will be used.\n",
|
|
)
|
|
|
|
|
|
class ProjectConsumption(BaseModel):
|
|
project_id: str = Field(..., description="The project ID")
|
|
period_id: UUID = Field(
|
|
...,
|
|
description="The Id of the consumption period, used to reference the `previous_period_id` field.\n",
|
|
)
|
|
data_storage_bytes_hour: conint(ge=0) = Field(
|
|
...,
|
|
description="Bytes-Hour. The amount of storage the project consumed during the billing period. Expect some lag in the reported value.\nThe value is reset at the beginning of each billing period.\n",
|
|
)
|
|
data_storage_bytes_hour_updated_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="The timestamp of the last update of the `data_storage_bytes_hour` field.\n",
|
|
)
|
|
synthetic_storage_size: conint(ge=0) = Field(
|
|
...,
|
|
description="Bytes. The current space occupied by project in storage. Expect some lag in the reported value.\n",
|
|
)
|
|
synthetic_storage_size_updated_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="The timestamp of the last update of the `synthetic_storage_size` field.\n",
|
|
)
|
|
data_transfer_bytes: conint(ge=0) = Field(
|
|
...,
|
|
description="Bytes. The egress traffic from the Neon cloud to the client for the project over the billing period.\nIncludes egress traffic for deleted endpoints. Expect some lag in the reported value. The value is reset at the beginning of each billing period.\n",
|
|
)
|
|
data_transfer_bytes_updated_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="Timestamp of the last update of `data_transfer_bytes` field\n",
|
|
)
|
|
written_data_bytes: conint(ge=0) = Field(
|
|
...,
|
|
description="Bytes. The Amount of WAL that travelled through storage for given project for all branches.\nExpect some lag in the reported value. The value is reset at the beginning of each billing period.\n",
|
|
)
|
|
written_data_bytes_updated_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="The timestamp of the last update of `written_data_bytes` field.\n",
|
|
)
|
|
compute_time_seconds: conint(ge=0) = Field(
|
|
...,
|
|
description="Seconds. The number of CPU seconds used by the project's compute endpoints, including compute endpoints that have been deleted.\nExpect some lag in the reported value. The value is reset at the beginning of each billing period.\nExamples:\n1. An endpoint that uses 1 CPU for 1 second is equal to `compute_time=1`.\n2. An endpoint that uses 2 CPUs simultaneously for 1 second is equal to `compute_time=2`.\n",
|
|
)
|
|
compute_time_seconds_updated_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="The timestamp of the last update of `compute_time_seconds` field.\n",
|
|
)
|
|
active_time_seconds: conint(ge=0) = Field(
|
|
...,
|
|
description="Seconds. The amount of time that compute endpoints in this project have been active.\nExpect some lag in the reported value.\n\nThe value is reset at the beginning of each billing period.\n",
|
|
)
|
|
active_time_seconds_updated_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="The timestamp of the last update of the `active_time_seconds` field.\n",
|
|
)
|
|
updated_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the period was last updated.\n"
|
|
)
|
|
period_start: AwareDatetime = Field(
|
|
..., description="The start of the consumption period.\n"
|
|
)
|
|
period_end: AwareDatetime = Field(
|
|
..., description="The end of the consumption period.\n"
|
|
)
|
|
previous_period_id: UUID = Field(
|
|
..., description="The `period_id` of the previous consumption period.\n"
|
|
)
|
|
|
|
|
|
class Limits(BaseModel):
|
|
active_time: int
|
|
max_projects: int
|
|
max_branches: int
|
|
max_autoscaling_cu: float
|
|
cpu_seconds: int
|
|
max_active_endpoints: int
|
|
max_read_only_endpoints: int
|
|
max_allowed_ips: int
|
|
|
|
|
|
class ProjectLimits(BaseModel):
|
|
model_config = ConfigDict(
|
|
extra="allow",
|
|
)
|
|
limits: Limits
|
|
|
|
|
|
class BranchState(Enum):
|
|
init = "init"
|
|
ready = "ready"
|
|
|
|
|
|
class Branch2(BaseModel):
|
|
parent_id: Optional[str] = Field(
|
|
None,
|
|
description="The `branch_id` of the parent branch. If omitted or empty, the branch will be created from the project's primary branch.\n",
|
|
)
|
|
name: Optional[str] = Field(None, description="The branch name\n")
|
|
parent_lsn: Optional[str] = Field(
|
|
None,
|
|
description="A Log Sequence Number (LSN) on the parent branch. The branch will be created with data from this LSN.\n",
|
|
)
|
|
parent_timestamp: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="A timestamp identifying a point in time on the parent branch. The branch will be created with data starting from this point in time.\n",
|
|
)
|
|
|
|
|
|
class Branch3(BaseModel):
|
|
name: Optional[str] = None
|
|
|
|
|
|
class BranchUpdateRequest(BaseModel):
|
|
branch: Branch3
|
|
|
|
|
|
class ConnectionParameters(BaseModel):
|
|
database: str = Field(..., description="Database name.\n")
|
|
password: str = Field(..., description="Password for the role.\n")
|
|
role: str = Field(..., description="Role name.\n")
|
|
host: str = Field(..., description="Host name.\n")
|
|
pooler_host: str = Field(..., description="Pooler host name.\n")
|
|
|
|
|
|
class ConnectionDetails(BaseModel):
|
|
connection_uri: str = Field(
|
|
...,
|
|
description="Connection URI is same as specified in https://www.postgresql.org/docs/current/libpq-connect.html#id-1.7.3.8.3.6\nIt is a ready to use string for psql or for DATABASE_URL environment variable.\n",
|
|
)
|
|
connection_parameters: ConnectionParameters
|
|
|
|
|
|
class EndpointState(Enum):
|
|
init = "init"
|
|
active = "active"
|
|
idle = "idle"
|
|
|
|
|
|
class EndpointType(Enum):
|
|
read_only = "read_only"
|
|
read_write = "read_write"
|
|
|
|
|
|
class EndpointPoolerMode(Enum):
|
|
transaction = "transaction"
|
|
|
|
|
|
class AllowedIps(BaseModel):
|
|
ips: list[str] = Field(
|
|
...,
|
|
description="A list of IP addresses that are allowed to connect to the endpoint.",
|
|
)
|
|
primary_branch_only: bool = Field(
|
|
..., description="If true, the list will be applied only to the primary branch."
|
|
)
|
|
|
|
|
|
class ConnectionURIsResponse(BaseModel):
|
|
connection_uris: list[ConnectionDetails]
|
|
|
|
|
|
class ConnectionURIsOptionalResponse(BaseModel):
|
|
connection_uris: Optional[list[ConnectionDetails]] = None
|
|
|
|
|
|
class EndpointPasswordlessSessionAuthRequest(BaseModel):
|
|
session_id: str
|
|
|
|
|
|
class Duration(RootModel[int]):
|
|
root: int = Field(
|
|
...,
|
|
description="A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.",
|
|
)
|
|
|
|
|
|
class StatementData(BaseModel):
|
|
fields: Optional[list[str]] = None
|
|
rows: Optional[list[list[str]]] = None
|
|
truncated: bool
|
|
|
|
|
|
class ExplainData(BaseModel):
|
|
QUERY_PLAN: str = Field(..., alias="QUERY PLAN")
|
|
|
|
|
|
class Role(BaseModel):
|
|
branch_id: str = Field(
|
|
..., description="The ID of the branch to which the role belongs\n"
|
|
)
|
|
name: str = Field(..., description="The role name\n")
|
|
password: Optional[str] = Field(None, description="The role password\n")
|
|
protected: Optional[bool] = Field(
|
|
None, description="Whether or not the role is system-protected\n"
|
|
)
|
|
created_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the role was created\n"
|
|
)
|
|
updated_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the role was last updated\n"
|
|
)
|
|
|
|
|
|
class Role1(BaseModel):
|
|
name: str = Field(
|
|
..., description="The role name. Cannot exceed 63 bytes in length.\n"
|
|
)
|
|
|
|
|
|
class RoleCreateRequest(BaseModel):
|
|
role: Role1
|
|
|
|
|
|
class RoleResponse(BaseModel):
|
|
role: Role
|
|
|
|
|
|
class RolesResponse(BaseModel):
|
|
roles: list[Role]
|
|
|
|
|
|
class RolePasswordResponse(BaseModel):
|
|
password: str = Field(..., description="The role password\n")
|
|
|
|
|
|
class Brand(Enum):
|
|
amex = "amex"
|
|
diners = "diners"
|
|
discover = "discover"
|
|
jcb = "jcb"
|
|
mastercard = "mastercard"
|
|
unionpay = "unionpay"
|
|
unknown = "unknown"
|
|
visa = "visa"
|
|
|
|
|
|
class PaymentSourceBankCard(BaseModel):
|
|
last4: str = Field(..., description="Last 4 digits of the card.\n")
|
|
brand: Optional[Brand] = Field(None, description="Brand of credit card.\n")
|
|
exp_month: Optional[int] = Field(None, description="Credit card expiration month\n")
|
|
exp_year: Optional[int] = Field(None, description="Credit card expiration year\n")
|
|
|
|
|
|
class PaymentSource(BaseModel):
|
|
type: str = Field(..., description='Type of payment source. E.g. "card".\n')
|
|
card: Optional[PaymentSourceBankCard] = None
|
|
|
|
|
|
class BillingAccountUpdateItem(BaseModel):
|
|
email: Optional[str] = Field(
|
|
None,
|
|
description="Billing email, to receive emails related to invoices and subscriptions.\n",
|
|
)
|
|
|
|
|
|
class BillingAccountUpdateRequest(BaseModel):
|
|
billing_account: BillingAccountUpdateItem
|
|
|
|
|
|
class BillingSubscriptionType(Enum):
|
|
UNKNOWN = "UNKNOWN"
|
|
free = "free"
|
|
pro = "pro"
|
|
direct_sales = "direct_sales"
|
|
aws_marketplace = "aws_marketplace"
|
|
|
|
|
|
class Database(BaseModel):
|
|
id: int = Field(..., description="The database ID\n")
|
|
branch_id: str = Field(
|
|
..., description="The ID of the branch to which the database belongs\n"
|
|
)
|
|
name: str = Field(..., description="The database name\n")
|
|
owner_name: str = Field(
|
|
..., description="The name of role that owns the database\n"
|
|
)
|
|
created_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the database was created\n"
|
|
)
|
|
updated_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the database was last updated\n"
|
|
)
|
|
|
|
|
|
class DatabaseCreateItem(BaseModel):
|
|
name: str = Field(..., description="The name of the datbase\n")
|
|
owner_name: str = Field(
|
|
..., description="The name of the role that owns the database\n"
|
|
)
|
|
|
|
|
|
class DatabaseCreateRequest(BaseModel):
|
|
database: DatabaseCreateItem
|
|
|
|
|
|
class DatabaseUpdateItem(BaseModel):
|
|
name: Optional[str] = Field(None, description="The name of the database\n")
|
|
owner_name: Optional[str] = Field(
|
|
None, description="The name of the role that owns the database\n"
|
|
)
|
|
|
|
|
|
class DatabaseUpdateRequest(BaseModel):
|
|
database: DatabaseUpdateItem
|
|
|
|
|
|
class DatabaseResponse(BaseModel):
|
|
database: Database
|
|
|
|
|
|
class DatabasesResponse(BaseModel):
|
|
databases: list[Database]
|
|
|
|
|
|
class CurrentUserAuthAccount(BaseModel):
|
|
email: str
|
|
image: str
|
|
login: str
|
|
name: str
|
|
provider: str
|
|
|
|
|
|
class UpdateUserInfoRequest(BaseModel):
|
|
email: str
|
|
id: UUID
|
|
image: Optional[str] = None
|
|
first_name: Optional[str] = None
|
|
last_name: Optional[str] = None
|
|
|
|
|
|
class ProjectQuota(BaseModel):
|
|
active_time_seconds: Optional[conint(ge=0)] = Field(
|
|
None,
|
|
description="The total amount of wall-clock time allowed to be spent by the project's compute endpoints.\n",
|
|
)
|
|
compute_time_seconds: Optional[conint(ge=0)] = Field(
|
|
None,
|
|
description="The total amount of CPU seconds allowed to be spent by the project's compute endpoints.\n",
|
|
)
|
|
written_data_bytes: Optional[conint(ge=0)] = Field(
|
|
None,
|
|
description="Total amount of data written to all of a project's branches.\n",
|
|
)
|
|
data_transfer_bytes: Optional[conint(ge=0)] = Field(
|
|
None,
|
|
description="Total amount of data transferred from all of a project's branches using the proxy.\n",
|
|
)
|
|
logical_size_bytes: Optional[conint(ge=0)] = Field(
|
|
None, description="Limit on the logical size of every project's branch.\n"
|
|
)
|
|
|
|
|
|
class HealthCheck(BaseModel):
|
|
status: str = Field(..., description="Service status")
|
|
|
|
|
|
class ProjectOwnerData(BaseModel):
|
|
email: str
|
|
branches_limit: int
|
|
subscription_type: BillingSubscriptionType
|
|
|
|
|
|
class SupportTicketSeverity(Enum):
|
|
low = "low"
|
|
normal = "normal"
|
|
high = "high"
|
|
critical = "critical"
|
|
|
|
|
|
class PaginationResponse(BaseModel):
|
|
pagination: Optional[Pagination] = None
|
|
|
|
|
|
class Operation(BaseModel):
|
|
id: UUID = Field(..., description="The operation ID")
|
|
project_id: str = Field(..., description="The Neon project ID")
|
|
branch_id: Optional[str] = Field(None, description="The branch ID")
|
|
endpoint_id: Optional[str] = Field(None, description="The endpoint ID")
|
|
action: OperationAction
|
|
status: OperationStatus
|
|
error: Optional[str] = Field(None, description="The error that occured")
|
|
failures_count: int = Field(
|
|
..., description="The number of times the operation failed"
|
|
)
|
|
retry_at: Optional[AwareDatetime] = Field(
|
|
None, description="A timestamp indicating when the operation was last retried"
|
|
)
|
|
created_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the operation was created"
|
|
)
|
|
updated_at: AwareDatetime = Field(
|
|
...,
|
|
description="A timestamp indicating when the operation status was last updated",
|
|
)
|
|
total_duration_ms: int = Field(
|
|
..., description="The total duration of the operation in milliseconds"
|
|
)
|
|
|
|
|
|
class OperationResponse(BaseModel):
|
|
operation: Operation
|
|
|
|
|
|
class OperationsResponse(BaseModel):
|
|
operations: list[Operation]
|
|
|
|
|
|
class ProjectSettingsData(BaseModel):
|
|
quota: Optional[ProjectQuota] = None
|
|
allowed_ips: Optional[AllowedIps] = None
|
|
enable_logical_replication: Optional[bool] = Field(
|
|
None,
|
|
description="Sets wal_level=logical for all compute endpoints in this project.\nAll active endpoints will be suspended.\nOnce enabled, logical replication cannot be disabled.\n",
|
|
)
|
|
|
|
|
|
class ProjectsConsumptionResponse(BaseModel):
|
|
projects: list[ProjectConsumption]
|
|
periods_in_response: int
|
|
|
|
|
|
class Branch(BaseModel):
|
|
id: str = Field(
|
|
...,
|
|
description="The branch ID. This value is generated when a branch is created. A `branch_id` value has a `br` prefix. For example: `br-small-term-683261`.\n",
|
|
)
|
|
project_id: str = Field(
|
|
..., description="The ID of the project to which the branch belongs\n"
|
|
)
|
|
parent_id: Optional[str] = Field(
|
|
None, description="The `branch_id` of the parent branch\n"
|
|
)
|
|
parent_lsn: Optional[str] = Field(
|
|
None,
|
|
description="The Log Sequence Number (LSN) on the parent branch from which this branch was created\n",
|
|
)
|
|
parent_timestamp: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="The point in time on the parent branch from which this branch was created\n",
|
|
)
|
|
name: str = Field(..., description="The branch name\n")
|
|
current_state: BranchState
|
|
pending_state: Optional[BranchState] = None
|
|
logical_size: Optional[int] = Field(
|
|
None, description="The logical size of the branch, in bytes\n"
|
|
)
|
|
creation_source: str = Field(..., description="The branch creation source\n")
|
|
primary: bool = Field(
|
|
..., description="Whether the branch is the project's primary branch\n"
|
|
)
|
|
cpu_used_sec: int = Field(
|
|
...,
|
|
description="CPU seconds used by all the endpoints of the branch, including deleted ones.\nThis value is reset at the beginning of each billing period.\nExamples:\n1. A branch that uses 1 CPU for 1 second is equal to `cpu_used_sec=1`.\n2. A branch that uses 2 CPUs simultaneously for 1 second is equal to `cpu_used_sec=2`.\n",
|
|
)
|
|
compute_time_seconds: int
|
|
active_time_seconds: int
|
|
written_data_bytes: int
|
|
data_transfer_bytes: int
|
|
created_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the branch was created\n"
|
|
)
|
|
updated_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the branch was last updated\n"
|
|
)
|
|
last_reset_at: Optional[AwareDatetime] = Field(
|
|
None, description="A timestamp indicating when the branch was last reset\n"
|
|
)
|
|
|
|
|
|
class BranchCreateRequestEndpointOptions(BaseModel):
|
|
type: EndpointType
|
|
autoscaling_limit_min_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="The minimum number of Compute Units. The minimum value is `0.25`.\n See [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\n for more information.\n",
|
|
)
|
|
autoscaling_limit_max_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="The maximum number of Compute Units.\n See [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\n for more information.\n",
|
|
)
|
|
provisioner: Optional[Provisioner] = None
|
|
suspend_timeout_seconds: Optional[conint(ge=-1, le=604800)] = Field(
|
|
None,
|
|
description="Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
)
|
|
|
|
|
|
class BranchCreateRequest(BaseModel):
|
|
endpoints: Optional[list[BranchCreateRequestEndpointOptions]] = None
|
|
branch: Optional[Branch2] = None
|
|
|
|
|
|
class BranchResponse(BaseModel):
|
|
branch: Branch
|
|
|
|
|
|
class BranchesResponse(BaseModel):
|
|
branches: list[Branch]
|
|
|
|
|
|
class StatementResult(BaseModel):
|
|
data: Optional[StatementData] = None
|
|
error: Optional[str] = None
|
|
explain_data: Optional[list[ExplainData]] = None
|
|
query: str
|
|
|
|
|
|
class BillingAccount(BaseModel):
|
|
payment_source: PaymentSource
|
|
subscription_type: BillingSubscriptionType
|
|
quota_reset_at_last: AwareDatetime = Field(
|
|
...,
|
|
description="The last time the quota was reset. Defaults to the date-time the account is created.\n",
|
|
)
|
|
email: str = Field(
|
|
...,
|
|
description="Billing email, to receive emails related to invoices and subscriptions.\n",
|
|
)
|
|
address_city: str = Field(..., description="Billing address city.\n")
|
|
address_country: str = Field(..., description="Billing address country.\n")
|
|
address_line1: str = Field(..., description="Billing address line 1.\n")
|
|
address_line2: str = Field(..., description="Billing address line 2.\n")
|
|
address_postal_code: str = Field(..., description="Billing address postal code.\n")
|
|
address_state: str = Field(..., description="Billing address state or region.\n")
|
|
orb_portal_url: Optional[str] = Field(None, description="Orb user portal url\n")
|
|
|
|
|
|
class BillingAccountResponse(BaseModel):
|
|
billing_account: BillingAccount
|
|
|
|
|
|
class CurrentUserInfoResponse(BaseModel):
|
|
active_seconds_limit: int = Field(
|
|
...,
|
|
description="Control plane observes active endpoints of a user this amount of wall-clock time.\n",
|
|
)
|
|
billing_account: BillingAccount
|
|
auth_accounts: list[CurrentUserAuthAccount]
|
|
email: str
|
|
id: str
|
|
image: str
|
|
login: str
|
|
name: str
|
|
last_name: str
|
|
projects_limit: int
|
|
branches_limit: int
|
|
max_autoscaling_limit: confloat()
|
|
compute_seconds_limit: Optional[int] = None
|
|
plan: str
|
|
|
|
|
|
class EndpointSettingsData(BaseModel):
|
|
pg_settings: Optional[dict[str, str]] = None
|
|
pgbouncer_settings: Optional[dict[str, str]] = None
|
|
|
|
|
|
class DefaultEndpointSettings(BaseModel):
|
|
pg_settings: Optional[dict[str, str]] = None
|
|
pgbouncer_settings: Optional[dict[str, str]] = None
|
|
autoscaling_limit_min_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="The minimum number of Compute Units. The minimum value is `0.25`.\nSee [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\nfor more information.\n",
|
|
)
|
|
autoscaling_limit_max_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="The maximum number of Compute Units. See [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\nfor more information.\n",
|
|
)
|
|
suspend_timeout_seconds: Optional[conint(ge=-1, le=604800)] = Field(
|
|
None,
|
|
description="Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
)
|
|
|
|
|
|
class GeneralError(BaseModel):
|
|
code: str
|
|
message: str = Field(..., description="Error message")
|
|
|
|
|
|
class BranchOperations(BranchResponse, OperationsResponse):
|
|
pass
|
|
|
|
|
|
class DatabaseOperations(DatabaseResponse, OperationsResponse):
|
|
pass
|
|
|
|
|
|
class RoleOperations(RoleResponse, OperationsResponse):
|
|
pass
|
|
|
|
|
|
class ProjectListItem(BaseModel):
|
|
id: str = Field(..., description="The project ID\n")
|
|
platform_id: str = Field(
|
|
...,
|
|
description="The cloud platform identifier. Currently, only AWS is supported, for which the identifier is `aws`.\n",
|
|
)
|
|
region_id: str = Field(..., description="The region identifier\n")
|
|
name: str = Field(..., description="The project name\n")
|
|
provisioner: Provisioner
|
|
default_endpoint_settings: Optional[DefaultEndpointSettings] = None
|
|
settings: Optional[ProjectSettingsData] = None
|
|
pg_version: conint(ge=14, le=16) = Field(
|
|
...,
|
|
description="The major PostgreSQL version number. Currently supported versions are `14`, `15` and `16`.",
|
|
)
|
|
proxy_host: str = Field(
|
|
...,
|
|
description="The proxy host for the project. This value combines the `region_id`, the `platform_id`, and the Neon domain (`neon.tech`).\n",
|
|
)
|
|
branch_logical_size_limit: int = Field(
|
|
..., description="The logical size limit for a branch. The value is in MiB.\n"
|
|
)
|
|
branch_logical_size_limit_bytes: int = Field(
|
|
..., description="The logical size limit for a branch. The value is in B.\n"
|
|
)
|
|
store_passwords: bool = Field(
|
|
...,
|
|
description="Whether or not passwords are stored for roles in the Neon project. Storing passwords facilitates access to Neon features that require authorization.\n",
|
|
)
|
|
active_time: conint(ge=0) = Field(
|
|
...,
|
|
description="Control plane observed endpoints of this project being active this amount of wall-clock time.\n",
|
|
)
|
|
cpu_used_sec: int = Field(
|
|
..., description="DEPRECATED. Use data from the getProject endpoint instead.\n"
|
|
)
|
|
maintenance_starts_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="A timestamp indicating when project maintenance begins. If set, the project is placed into maintenance mode at this time.\n",
|
|
)
|
|
creation_source: str = Field(..., description="The project creation source\n")
|
|
created_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the project was created\n"
|
|
)
|
|
updated_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the project was last updated\n"
|
|
)
|
|
synthetic_storage_size: Optional[int] = Field(
|
|
None,
|
|
description="The current space occupied by the project in storage, in bytes. Synthetic storage size combines the logical data size and Write-Ahead Log (WAL) size for all branches in a project.\n",
|
|
)
|
|
quota_reset_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="DEPRECATED. Use `consumption_period_end` from the getProject endpoint instead.\nA timestamp indicating when the project quota resets\n",
|
|
)
|
|
owner_id: str
|
|
compute_last_active_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="The most recent time when any endpoint of this project was active.\n\nOmitted when observed no actitivy for endpoints of this project.\n",
|
|
)
|
|
|
|
|
|
class Project(BaseModel):
|
|
data_storage_bytes_hour: conint(ge=0) = Field(
|
|
...,
|
|
description="Bytes-Hour. Project consumed that much storage hourly during the billing period. The value has some lag.\nThe value is reset at the beginning of each billing period.\n",
|
|
)
|
|
data_transfer_bytes: conint(ge=0) = Field(
|
|
...,
|
|
description="Bytes. Egress traffic from the Neon cloud to the client for given project over the billing period.\nIncludes deleted endpoints. The value has some lag. The value is reset at the beginning of each billing period.\n",
|
|
)
|
|
written_data_bytes: conint(ge=0) = Field(
|
|
...,
|
|
description="Bytes. Amount of WAL that travelled through storage for given project across all branches.\nThe value has some lag. The value is reset at the beginning of each billing period.\n",
|
|
)
|
|
compute_time_seconds: conint(ge=0) = Field(
|
|
...,
|
|
description="Seconds. The number of CPU seconds used by the project's compute endpoints, including compute endpoints that have been deleted.\nThe value has some lag. The value is reset at the beginning of each billing period.\nExamples:\n1. An endpoint that uses 1 CPU for 1 second is equal to `compute_time=1`.\n2. An endpoint that uses 2 CPUs simultaneously for 1 second is equal to `compute_time=2`.\n",
|
|
)
|
|
active_time_seconds: conint(ge=0) = Field(
|
|
...,
|
|
description="Seconds. Control plane observed endpoints of this project being active this amount of wall-clock time.\nThe value has some lag.\nThe value is reset at the beginning of each billing period.\n",
|
|
)
|
|
cpu_used_sec: int = Field(
|
|
..., description="DEPRECATED, use compute_time instead.\n"
|
|
)
|
|
id: str = Field(..., description="The project ID\n")
|
|
platform_id: str = Field(
|
|
...,
|
|
description="The cloud platform identifier. Currently, only AWS is supported, for which the identifier is `aws`.\n",
|
|
)
|
|
region_id: str = Field(..., description="The region identifier\n")
|
|
name: str = Field(..., description="The project name\n")
|
|
provisioner: Provisioner
|
|
default_endpoint_settings: Optional[DefaultEndpointSettings] = None
|
|
settings: Optional[ProjectSettingsData] = None
|
|
pg_version: conint(ge=14, le=16) = Field(
|
|
...,
|
|
description="The major PostgreSQL version number. Currently supported versions are `14`, `15` and `16`.",
|
|
)
|
|
proxy_host: str = Field(
|
|
...,
|
|
description="The proxy host for the project. This value combines the `region_id`, the `platform_id`, and the Neon domain (`neon.tech`).\n",
|
|
)
|
|
branch_logical_size_limit: int = Field(
|
|
..., description="The logical size limit for a branch. The value is in MiB.\n"
|
|
)
|
|
branch_logical_size_limit_bytes: int = Field(
|
|
..., description="The logical size limit for a branch. The value is in B.\n"
|
|
)
|
|
store_passwords: bool = Field(
|
|
...,
|
|
description="Whether or not passwords are stored for roles in the Neon project. Storing passwords facilitates access to Neon features that require authorization.\n",
|
|
)
|
|
maintenance_starts_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="A timestamp indicating when project maintenance begins. If set, the project is placed into maintenance mode at this time.\n",
|
|
)
|
|
creation_source: str = Field(..., description="The project creation source\n")
|
|
history_retention_seconds: int = Field(
|
|
...,
|
|
description="The number of seconds to retain point-in-time restore (PITR) backup history for this project.\n",
|
|
)
|
|
created_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the project was created\n"
|
|
)
|
|
updated_at: AwareDatetime = Field(
|
|
..., description="A timestamp indicating when the project was last updated\n"
|
|
)
|
|
synthetic_storage_size: Optional[int] = Field(
|
|
None,
|
|
description="The current space occupied by the project in storage, in bytes. Synthetic storage size combines the logical data size and Write-Ahead Log (WAL) size for all branches in a project.\n",
|
|
)
|
|
consumption_period_start: AwareDatetime = Field(
|
|
...,
|
|
description="A date-time indicating when Neon Cloud started measuring consumption for current consumption period.\n",
|
|
)
|
|
consumption_period_end: AwareDatetime = Field(
|
|
...,
|
|
description="A date-time indicating when Neon Cloud plans to stop measuring consumption for current consumption period.\n",
|
|
)
|
|
quota_reset_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="DEPRECATED. Use `consumption_period_end` from the getProject endpoint instead.\nA timestamp indicating when the project quota resets.\n",
|
|
)
|
|
owner_id: str
|
|
owner: Optional[ProjectOwnerData] = None
|
|
compute_last_active_at: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="The most recent time when any endpoint of this project was active.\n\nOmitted when observed no actitivy for endpoints of this project.\n",
|
|
)
|
|
|
|
|
|
class ProjectCreateItem(BaseModel):
|
|
settings: Optional[ProjectSettingsData] = None
|
|
name: Optional[str] = Field(None, description="The project name")
|
|
branch: Optional[BranchUpdateItem] = None
|
|
autoscaling_limit_min_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="DEPRECATED, use default_endpoint_settings.autoscaling_limit_min_cu instead.\n\nThe minimum number of Compute Units. The minimum value is `0.25`.\nSee [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\nfor more information.\n",
|
|
)
|
|
autoscaling_limit_max_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="DEPRECATED, use default_endpoint_settings.autoscaling_limit_max_cu instead.\n\nThe maximum number of Compute Units. See [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\nfor more information.\n",
|
|
)
|
|
provisioner: Optional[Provisioner] = None
|
|
region_id: Optional[str] = Field(
|
|
None,
|
|
description="The region identifier. Refer to our [Regions](https://neon.tech/docs/introduction/regions) documentation for supported regions. Values are specified in this format: `aws-us-east-1`\n",
|
|
)
|
|
default_endpoint_settings: Optional[DefaultEndpointSettings] = None
|
|
pg_version: Optional[conint(ge=14, le=16)] = Field(
|
|
None,
|
|
description="The major PostgreSQL version number. Currently supported versions are `14`, `15` and `16`.",
|
|
)
|
|
store_passwords: Optional[bool] = Field(
|
|
None,
|
|
description="Whether or not passwords are stored for roles in the Neon project. Storing passwords facilitates access to Neon features that require authorization.\n",
|
|
)
|
|
history_retention_seconds: Optional[conint(ge=0, le=2592000)] = Field(
|
|
None,
|
|
description="The number of seconds to retain the point-in-time restore (PITR) backup history for this project.\nThe default is 604800 seconds (7 days).\n",
|
|
)
|
|
|
|
|
|
class ProjectCreateRequest(BaseModel):
|
|
project: ProjectCreateItem
|
|
|
|
|
|
class ProjectUpdateItem(BaseModel):
|
|
settings: Optional[ProjectSettingsData] = None
|
|
name: Optional[str] = Field(None, description="The project name")
|
|
default_endpoint_settings: Optional[DefaultEndpointSettings] = None
|
|
history_retention_seconds: Optional[conint(ge=0, le=2592000)] = Field(
|
|
None,
|
|
description="The number of seconds to retain the point-in-time restore (PITR) backup history for this project.\nThe default is 604800 seconds (7 days).\n",
|
|
)
|
|
|
|
|
|
class ProjectUpdateRequest(BaseModel):
|
|
project: ProjectUpdateItem
|
|
|
|
|
|
class ProjectResponse(BaseModel):
|
|
project: Project
|
|
|
|
|
|
class ProjectsResponse(BaseModel):
|
|
projects: list[ProjectListItem]
|
|
|
|
|
|
class Endpoint(BaseModel):
|
|
host: str = Field(
|
|
...,
|
|
description="The hostname of the compute endpoint. This is the hostname specified when connecting to a Neon database.\n",
|
|
)
|
|
id: str = Field(
|
|
...,
|
|
description="The compute endpoint ID. Compute endpoint IDs have an `ep-` prefix. For example: `ep-little-smoke-851426`\n",
|
|
)
|
|
project_id: str = Field(
|
|
..., description="The ID of the project to which the compute endpoint belongs\n"
|
|
)
|
|
branch_id: str = Field(
|
|
...,
|
|
description="The ID of the branch that the compute endpoint is associated with\n",
|
|
)
|
|
autoscaling_limit_min_cu: confloat() = Field(
|
|
..., description="The minimum number of Compute Units\n"
|
|
)
|
|
autoscaling_limit_max_cu: confloat() = Field(
|
|
..., description="The maximum number of Compute Units\n"
|
|
)
|
|
region_id: str = Field(..., description="The region identifier\n")
|
|
type: EndpointType
|
|
current_state: EndpointState
|
|
pending_state: Optional[EndpointState] = None
|
|
settings: EndpointSettingsData
|
|
pooler_enabled: bool = Field(
|
|
...,
|
|
description="Whether connection pooling is enabled for the compute endpoint\n",
|
|
)
|
|
pooler_mode: EndpointPoolerMode
|
|
disabled: bool = Field(
|
|
...,
|
|
description="Whether to restrict connections to the compute endpoint.\nEnabling this option schedules a suspend compute operation.\nA disabled compute endpoint cannot be enabled by a connection or\nconsole action. However, the compute endpoint is periodically\nenabled by check_availability operations.\n",
|
|
)
|
|
passwordless_access: bool = Field(
|
|
...,
|
|
description="Whether to permit passwordless access to the compute endpoint\n",
|
|
)
|
|
last_active: Optional[AwareDatetime] = Field(
|
|
None,
|
|
description="A timestamp indicating when the compute endpoint was last active\n",
|
|
)
|
|
creation_source: str = Field(
|
|
..., description="The compute endpoint creation source\n"
|
|
)
|
|
created_at: AwareDatetime = Field(
|
|
...,
|
|
description="A timestamp indicating when the compute endpoint was created\n",
|
|
)
|
|
updated_at: AwareDatetime = Field(
|
|
...,
|
|
description="A timestamp indicating when the compute endpoint was last updated\n",
|
|
)
|
|
proxy_host: str = Field(
|
|
..., description='DEPRECATED. Use the "host" property instead.\n'
|
|
)
|
|
suspend_timeout_seconds: conint(ge=-1, le=604800) = Field(
|
|
...,
|
|
description="Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
)
|
|
provisioner: Provisioner
|
|
|
|
|
|
class EndpointCreateItem(BaseModel):
|
|
branch_id: str = Field(
|
|
...,
|
|
description="The ID of the branch the compute endpoint will be associated with\n",
|
|
)
|
|
region_id: Optional[str] = Field(
|
|
None,
|
|
description="The region where the compute endpoint will be created. Only the project's `region_id` is permitted.\n",
|
|
)
|
|
type: EndpointType
|
|
settings: Optional[EndpointSettingsData] = None
|
|
autoscaling_limit_min_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="The minimum number of Compute Units. The minimum value is `0.25`.\nSee [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\nfor more information.\n",
|
|
)
|
|
autoscaling_limit_max_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="The maximum number of Compute Units.\nSee [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\nfor more information.\n",
|
|
)
|
|
provisioner: Optional[Provisioner] = None
|
|
pooler_enabled: Optional[bool] = Field(
|
|
None,
|
|
description="Whether to enable connection pooling for the compute endpoint\n",
|
|
)
|
|
pooler_mode: Optional[EndpointPoolerMode] = None
|
|
disabled: Optional[bool] = Field(
|
|
None,
|
|
description="Whether to restrict connections to the compute endpoint.\nEnabling this option schedules a suspend compute operation.\nA disabled compute endpoint cannot be enabled by a connection or\nconsole action. However, the compute endpoint is periodically\nenabled by check_availability operations.\n",
|
|
)
|
|
passwordless_access: Optional[bool] = Field(
|
|
None,
|
|
description="NOT YET IMPLEMENTED. Whether to permit passwordless access to the compute endpoint.\n",
|
|
)
|
|
suspend_timeout_seconds: Optional[conint(ge=-1, le=604800)] = Field(
|
|
None,
|
|
description="Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
)
|
|
|
|
|
|
class EndpointCreateRequest(BaseModel):
|
|
endpoint: EndpointCreateItem
|
|
|
|
|
|
class Endpoint2(BaseModel):
|
|
branch_id: Optional[str] = Field(
|
|
None,
|
|
description="The destination branch ID. The destination branch must not have an exsiting read-write endpoint.\n",
|
|
)
|
|
autoscaling_limit_min_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="The minimum number of Compute Units. The minimum value is `0.25`.\nSee [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\nfor more information.\n",
|
|
)
|
|
autoscaling_limit_max_cu: Optional[confloat()] = Field(
|
|
None,
|
|
description="The maximum number of Compute Units.\nSee [Compute size and Autoscaling configuration](https://neon.tech/docs/manage/endpoints#compute-size-and-autoscaling-configuration)\nfor more information.\n",
|
|
)
|
|
provisioner: Optional[Provisioner] = None
|
|
settings: Optional[EndpointSettingsData] = None
|
|
pooler_enabled: Optional[bool] = Field(
|
|
None,
|
|
description="Whether to enable connection pooling for the compute endpoint\n",
|
|
)
|
|
pooler_mode: Optional[EndpointPoolerMode] = None
|
|
disabled: Optional[bool] = Field(
|
|
None,
|
|
description="Whether to restrict connections to the compute endpoint.\nEnabling this option schedules a suspend compute operation.\nA disabled compute endpoint cannot be enabled by a connection or\nconsole action. However, the compute endpoint is periodically\nenabled by check_availability operations.\n",
|
|
)
|
|
passwordless_access: Optional[bool] = Field(
|
|
None,
|
|
description="NOT YET IMPLEMENTED. Whether to permit passwordless access to the compute endpoint.\n",
|
|
)
|
|
suspend_timeout_seconds: Optional[conint(ge=-1, le=604800)] = Field(
|
|
None,
|
|
description="Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
)
|
|
|
|
|
|
class EndpointUpdateRequest(BaseModel):
|
|
endpoint: Endpoint2
|
|
|
|
|
|
class EndpointResponse(BaseModel):
|
|
endpoint: Endpoint
|
|
|
|
|
|
class EndpointsResponse(BaseModel):
|
|
endpoints: list[Endpoint]
|
|
|
|
|
|
class EndpointOperations(EndpointResponse, OperationsResponse):
|
|
pass
|