# Backend

> API reference for Backends (core.apoxy.dev/v1alpha2)

**API Group:** `core.apoxy.dev/v1alpha2`

## Operations

### List Backends

<APIEndpoint method="GET" path="/apis/core.apoxy.dev/v1alpha2/backends" />

List Backend

**Response**

- `200`: OK

---

### Create Backend

<APIEndpoint method="POST" path="/apis/core.apoxy.dev/v1alpha2/backends" />

Create a Backend

**Request Body**

Spec fields (`BackendSpec`):

| Field | Type | Description |
| --- | --- | --- |
| `dynamicProxy` | [DynamicProxySpec](#dynamicproxyspec) | Specifies whether the backend should be dynamically proxied. If specified, Envoy's HTTP Dynamic Forward Proxy will be used to proxy requests to the backend. See: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/http/http_proxy#arch-overview-http-dynamic-forward-proxy |
| `endpoints` | [BackendEndpoint](#backendendpoint)[] | List of endpoints to connect to. **(required)** |
| `protocol` | string | Protocol defines a protocol to use for the backend. **(required)** |

**Response**

- `200`: OK
- `201`: Created
- `202`: Accepted

---

### Delete All Backends

<APIEndpoint method="DELETE" path="/apis/core.apoxy.dev/v1alpha2/backends" />

Delete collection of Backend

**Response**

- `200`: OK

---

### Get Backend

<APIEndpoint method="GET" path="/apis/core.apoxy.dev/v1alpha2/backends/{name}" />

Get the specified Backend

**Response**

- `200`: OK

---

### Replace Backend

<APIEndpoint method="PUT" path="/apis/core.apoxy.dev/v1alpha2/backends/{name}" />

Replace the specified Backend

**Request Body**

Spec fields (`BackendSpec`):

| Field | Type | Description |
| --- | --- | --- |
| `dynamicProxy` | [DynamicProxySpec](#dynamicproxyspec) | Specifies whether the backend should be dynamically proxied. If specified, Envoy's HTTP Dynamic Forward Proxy will be used to proxy requests to the backend. See: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/http/http_proxy#arch-overview-http-dynamic-forward-proxy |
| `endpoints` | [BackendEndpoint](#backendendpoint)[] | List of endpoints to connect to. **(required)** |
| `protocol` | string | Protocol defines a protocol to use for the backend. **(required)** |

**Response**

- `200`: OK
- `201`: Created

---

### Update Backend

<APIEndpoint method="PATCH" path="/apis/core.apoxy.dev/v1alpha2/backends/{name}" />

Partially update the specified Backend

**Response**

- `200`: OK
- `201`: Created

---

### Delete Backend

<APIEndpoint method="DELETE" path="/apis/core.apoxy.dev/v1alpha2/backends/{name}" />

Delete a Backend

**Response**

- `200`: OK
- `202`: Accepted

---

## Schema Reference

### DynamicProxySpec

| Field | Type | Description |
| --- | --- | --- |
| `dnsCacheConfig` | [DynamicProxyDnsCacheConfig](#dynamicproxydnscacheconfig) |  |

### DynamicProxyDnsCacheConfig

| Field | Type | Description |
| --- | --- | --- |
| `dnsLookupFamily` | string | Specifies the DNS lookup family to use for the dynamic proxy. Default is "auto". |
| `dnsMinRefreshRate` | [Duration](#duration) | Specifies the minimum refresh rate for DNS hosts. If a host is resolved and the TTL is less than this value, the host will be refreshed at this rate. Default is 5s and must be at least 1s. |
| `dnsQueryTimeout` | [Duration](#duration) | Specifies the timeout for DNS queries. Default is 5s. |
| `dnsRefreshRate` | [Duration](#duration) | Specifies the refresh rate for *unresolved* DNS hosts. Once a host is resolved, the TTL from the DNS response is used. If the TTL is not present, the resolved host is cached for 60s by default. Must be at least 1ms, and defaults to 60s. |
| `hostTTL` | [Duration](#duration) | TTL for unused hosts. Hosts that have not been used for this duration will be removed from the cache. Default is 5m. |
| `maxHosts` | integer (int64) | Maximum number of hosts to cache. Default is 1024. |
