Files
dokploy/apps/docs/content/docs/api/reference-api/reference-postgres.mdx
2024-09-01 23:11:17 -06:00

1269 lines
18 KiB
Plaintext

---
title: postgres
full: true
---
import { Root, API, APIInfo, APIExample, Responses, Response, ResponseTypes, ExampleResponse, TypeScriptResponse, Property, ObjectCollapsible, Requests, Request } from "fumadocs-ui/components/api";
<Root>
<API>
<APIInfo method={"POST"} route={"/postgres.create"}>
## postgres-create
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"name"} type={"string"} required={true} deprecated={undefined}>
<span>Minimum length: `1`</span>
</Property>
<Property name={"appName"} type={"string"} required={true} deprecated={undefined}>
</Property>
<Property name={"databaseName"} type={"string"} required={true} deprecated={undefined}>
<span>Minimum length: `1`</span>
</Property>
<Property name={"databaseUser"} type={"string"} required={true} deprecated={undefined}>
<span>Minimum length: `1`</span>
</Property>
<Property name={"databasePassword"} type={"string"} required={true} deprecated={undefined}>
</Property>
<Property name={"dockerImage"} type={"string"} required={false} deprecated={undefined}>
<span>Default: `"postgres:15"`</span>
</Property>
<Property name={"projectId"} type={"string"} required={true} deprecated={undefined}>
</Property>
<Property name={"description"} type={"string | null"} required={false} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.create" \
-d '{
"name": "string",
"appName": "string",
"databaseName": "string",
"databaseUser": "string",
"databasePassword": "string",
"dockerImage": "postgres:15",
"projectId": "string",
"description": "string"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.create", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"GET"} route={"/postgres.one"}>
## postgres-one
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Query Parameters
<Property name={"postgresId"} type={"string"} required={true} deprecated={false}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X GET "http://localhost:3000/api/postgres.one?postgresId=string"
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.one?postgresId=string", {
method: "GET"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.start"}>
## postgres-start
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.start" \
-d '{
"postgresId": "string"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.start", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.stop"}>
## postgres-stop
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.stop" \
-d '{
"postgresId": "string"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.stop", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.saveExternalPort"}>
## postgres-saveExternalPort
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
</Property>
<Property name={"externalPort"} type={"number | null"} required={true} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.saveExternalPort" \
-d '{
"postgresId": "string",
"externalPort": 0
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.saveExternalPort", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.deploy"}>
## postgres-deploy
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.deploy" \
-d '{
"postgresId": "string"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.deploy", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.changeStatus"}>
## postgres-changeStatus
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
</Property>
<Property name={"applicationStatus"} type={"string"} required={true} deprecated={undefined}>
<span>Value in: `"idle" | "running" | "done" | "error"`</span>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.changeStatus" \
-d '{
"postgresId": "string",
"applicationStatus": "idle"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.changeStatus", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.remove"}>
## postgres-remove
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.remove" \
-d '{
"postgresId": "string"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.remove", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.saveEnvironment"}>
## postgres-saveEnvironment
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
</Property>
<Property name={"env"} type={"string | null"} required={false} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.saveEnvironment" \
-d '{
"postgresId": "string",
"env": "string"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.saveEnvironment", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.reload"}>
## postgres-reload
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
</Property>
<Property name={"appName"} type={"string"} required={true} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.reload" \
-d '{
"postgresId": "string",
"appName": "string"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.reload", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
<API>
<APIInfo method={"POST"} route={"/postgres.update"}>
## postgres-update
### Authorization
<Property name={"Authorization"} type={"Bearer <token>"} required={true}>
In: `header`
</Property>
### Request Body
<Property name={"postgresId"} type={"string"} required={true} deprecated={undefined}>
<span>Minimum length: `1`</span>
</Property>
<Property name={"name"} type={"string"} required={false} deprecated={undefined}>
<span>Minimum length: `1`</span>
</Property>
<Property name={"appName"} type={"string"} required={false} deprecated={undefined}>
</Property>
<Property name={"databaseName"} type={"string"} required={false} deprecated={undefined}>
<span>Minimum length: `1`</span>
</Property>
<Property name={"databaseUser"} type={"string"} required={false} deprecated={undefined}>
<span>Minimum length: `1`</span>
</Property>
<Property name={"databasePassword"} type={"string"} required={false} deprecated={undefined}>
</Property>
<Property name={"description"} type={"string | null"} required={false} deprecated={undefined}>
</Property>
<Property name={"dockerImage"} type={"string"} required={false} deprecated={undefined}>
<span>Default: `"postgres:15"`</span>
</Property>
<Property name={"command"} type={"string | null"} required={false} deprecated={undefined}>
</Property>
<Property name={"env"} type={"string | null"} required={false} deprecated={undefined}>
</Property>
<Property name={"memoryReservation"} type={"number | null"} required={false} deprecated={undefined}>
</Property>
<Property name={"externalPort"} type={"number | null"} required={false} deprecated={undefined}>
</Property>
<Property name={"memoryLimit"} type={"number | null"} required={false} deprecated={undefined}>
</Property>
<Property name={"cpuReservation"} type={"number | null"} required={false} deprecated={undefined}>
</Property>
<Property name={"cpuLimit"} type={"number | null"} required={false} deprecated={undefined}>
</Property>
<Property name={"applicationStatus"} type={"string"} required={false} deprecated={undefined}>
<span>Value in: `"idle" | "running" | "done" | "error"`</span>
</Property>
<Property name={"createdAt"} type={"string"} required={false} deprecated={undefined}>
</Property>
<Property name={"projectId"} type={"string"} required={false} deprecated={undefined}>
</Property>
| Status code | Description |
| ----------- | ----------- |
| `200` | Successful response |
| `default` | Error response |
</APIInfo>
<APIExample>
<Requests items={["cURL","JavaScript"]}>
<Request value={"cURL"}>
```bash
curl -X POST "http://localhost:3000/api/postgres.update" \
-d '{
"postgresId": "string",
"name": "string",
"appName": "string",
"databaseName": "string",
"databaseUser": "string",
"databasePassword": "string",
"description": "string",
"dockerImage": "postgres:15",
"command": "string",
"env": "string",
"memoryReservation": 0,
"externalPort": 0,
"memoryLimit": 0,
"cpuReservation": 0,
"cpuLimit": 0,
"applicationStatus": "idle",
"createdAt": "string",
"projectId": "string"
}'
```
</Request>
<Request value={"JavaScript"}>
```js
fetch("http://localhost:3000/api/postgres.update", {
method: "POST"
});
```
</Request>
</Requests>
<Responses items={["default"]}>
<Response value={"default"}>
<ResponseTypes>
<ExampleResponse>
```json
{
"message": "string",
"code": "string",
"issues": [
{
"message": "string"
}
]
}
```
</ExampleResponse>
<TypeScriptResponse>
```ts
export interface Response {
message: string;
code: string;
issues?: {
message: string;
}[];
}
```
</TypeScriptResponse>
</ResponseTypes>
</Response>
</Responses>
</APIExample>
</API>
</Root>