| # | |
| # Licensed to the Apache Software Foundation (ASF) under one or more | |
| # contributor license agreements. See the NOTICE file distributed with | |
| # this work for additional information regarding copyright ownership. | |
| # The ASF licenses this file to You under the Apache License, Version 2.0 | |
| # (the "License"); you may not use this file except in compliance with | |
| # the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| get: | |
| summary: List All Upstreams | |
| description: Retrieve all configured upstreams. | |
| tags: | |
| - Upstreams | |
| parameters: | |
| - $ref: ../components/parameters/NameFilter.yaml | |
| - $ref: ../components/parameters/LabelFilter.yaml | |
| - $ref: ../components/parameters/Page.yaml | |
| - $ref: ../components/parameters/PageSize.yaml | |
| responses: | |
| "200": | |
| description: Successful response. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: ../components/schemas/UpstreamListEnvelope.yaml | |
| examples: | |
| "1": | |
| summary: Successful Example | |
| value: | |
| list: | |
| - value: | |
| timeout: | |
| send: 15 | |
| read: 15 | |
| connect: 15 | |
| desc: desc | |
| id: "1" | |
| create_time: 1684290697 | |
| retries: 1 | |
| pass_host: pass | |
| update_time: 1684291419 | |
| type: roundrobin | |
| name: upstream-for-test | |
| hash_on: vars | |
| nodes: | |
| httpbin.org:443: 1 | |
| scheme: https | |
| key: /apisix/upstreams/1 | |
| modifiedIndex: 126 | |
| createdIndex: 121 | |
| - value: | |
| timeout: | |
| send: 15 | |
| read: 15 | |
| connect: 15 | |
| desc: desc | |
| id: "2" | |
| create_time: 1684291436 | |
| retries: 1 | |
| pass_host: pass | |
| update_time: 1684291436 | |
| type: roundrobin | |
| name: upstream-for-test | |
| hash_on: vars | |
| nodes: | |
| httpbin.org:443: 1 | |
| scheme: https | |
| key: /apisix/upstreams/2 | |
| modifiedIndex: 127 | |
| createdIndex: 127 | |
| total: 2 | |
| "401": | |
| $ref: ../components/responses/Unauthorized.yaml | |
| "503": | |
| $ref: ../components/responses/BadRequest.yaml | |
| description: Storage access or write failed. | |
| operationId: listUpstreams | |
| post: | |
| summary: Create an Upstream | |
| description: Create a new upstream with an auto-generated ID. | |
| tags: | |
| - Upstreams | |
| parameters: | |
| - $ref: ../components/parameters/Ttl.yaml | |
| requestBody: | |
| $ref: ../components/requestBodies/UpstreamUpsertPostCollection.yaml | |
| responses: | |
| "201": | |
| description: Created | |
| content: | |
| application/json: | |
| schema: | |
| $ref: ../components/schemas/UpstreamEnvelope.yaml | |
| examples: | |
| "1": | |
| summary: Successful Example | |
| value: | |
| key: /apisix/upstreams/00000000000000000128 | |
| value: | |
| timeout: | |
| send: 15 | |
| read: 15 | |
| connect: 15 | |
| desc: desc | |
| id: "00000000000000000128" | |
| create_time: 1684291897 | |
| retries: 1 | |
| pass_host: pass | |
| update_time: 1684291897 | |
| type: roundrobin | |
| name: upstream-for-test | |
| hash_on: vars | |
| nodes: | |
| 127.0.0.1:1980: 1 | |
| scheme: http | |
| "400": | |
| $ref: ../components/responses/BadRequest.yaml | |
| description: Invalid configuration | |
| "401": | |
| $ref: ../components/responses/Unauthorized.yaml | |
| "503": | |
| $ref: ../components/responses/BadRequest.yaml | |
| description: Storage access or write failed. | |
| operationId: createUpstream | |
| put: | |
| summary: Create or replace upstreams using a body ID | |
| description: Equivalent to PUT on the item URL, with id required in the request body. The resource handler injects and validates this ID before persistence. | |
| tags: | |
| - Upstreams | |
| parameters: | |
| - $ref: ../components/parameters/Ttl.yaml | |
| requestBody: | |
| description: "`Upstream` configuration body for create / replace / patch." | |
| required: true | |
| content: | |
| application/json: | |
| schema: | |
| allOf: | |
| - allOf: | |
| - $ref: ../components/schemas/Upstream.yaml | |
| - not: | |
| anyOf: | |
| - required: | |
| - create_time | |
| - required: | |
| - update_time | |
| description: Wire request body. APISIX injects timestamps and, where appropriate, the path or generated resource ID. A supplied ID must agree with the path. | |
| - required: | |
| - id | |
| example: | |
| name: backend-cluster | |
| desc: Primary backend service cluster | |
| type: roundrobin | |
| nodes: | |
| 10.0.0.1:8080: 3 | |
| 10.0.0.2:8080: 2 | |
| 10.0.0.3:8080: 1 | |
| retries: 3 | |
| retry_timeout: 5 | |
| timeout: | |
| connect: 6 | |
| send: 6 | |
| read: 6 | |
| checks: | |
| active: | |
| type: http | |
| http_path: /health | |
| healthy: | |
| interval: 5 | |
| successes: 2 | |
| unhealthy: | |
| interval: 3 | |
| http_failures: 3 | |
| tcp_failures: 2 | |
| scheme: http | |
| pass_host: pass | |
| id: "1" | |
| responses: | |
| "201": | |
| description: Created | |
| content: | |
| application/json: | |
| schema: | |
| $ref: ../components/schemas/UpstreamEnvelope.yaml | |
| examples: | |
| "1": | |
| summary: Create an Upstream by ID | |
| value: | |
| key: /apisix/upstreams/1 | |
| value: | |
| timeout: | |
| send: 15 | |
| read: 15 | |
| connect: 15 | |
| desc: desc | |
| id: "1" | |
| create_time: 1684290697 | |
| retries: 1 | |
| pass_host: pass | |
| update_time: 1684290697 | |
| type: roundrobin | |
| name: upstream-for-test | |
| hash_on: vars | |
| nodes: | |
| 127.0.0.1:1980: 1 | |
| scheme: http | |
| "2": | |
| summary: Create HTTPS Upstream | |
| value: | |
| key: /apisix/upstreams/1 | |
| value: | |
| timeout: | |
| send: 15 | |
| read: 15 | |
| connect: 15 | |
| desc: desc | |
| id: "1" | |
| create_time: 1684290697 | |
| retries: 1 | |
| pass_host: pass | |
| update_time: 1684291419 | |
| type: roundrobin | |
| name: upstream-for-test | |
| hash_on: vars | |
| nodes: | |
| httpbin.org:443: 1 | |
| scheme: https | |
| "3": | |
| summary: Enable Health Check | |
| value: | |
| key: /apisix/upstreams/1 | |
| value: | |
| hash_on: vars | |
| desc: desc | |
| id: "1" | |
| create_time: 1684292372 | |
| checks: | |
| passive: | |
| type: http | |
| healthy: | |
| http_statuses: | |
| - 200 | |
| - 201 | |
| successes: 3 | |
| unhealthy: | |
| timeouts: 7 | |
| http_statuses: | |
| - 500 | |
| http_failures: 3 | |
| tcp_failures: 3 | |
| active: | |
| host: foo.com | |
| concurrency: 10 | |
| http_path: /status | |
| https_verify_certificate: true | |
| type: http | |
| req_headers: | |
| - "User-Agent: curl/7.29.0" | |
| healthy: | |
| successes: 1 | |
| http_statuses: | |
| - 200 | |
| - 302 | |
| interval: 2 | |
| timeout: 5 | |
| unhealthy: | |
| timeouts: 3 | |
| http_statuses: | |
| - 429 | |
| - 404 | |
| - 500 | |
| - 501 | |
| - 502 | |
| - 503 | |
| - 504 | |
| - 505 | |
| interval: 1 | |
| http_failures: 2 | |
| tcp_failures: 2 | |
| pass_host: pass | |
| update_time: 1684292372 | |
| type: roundrobin | |
| name: upstream-for-test | |
| retries: 1 | |
| nodes: | |
| 127.0.0.1:1980: 1 | |
| 127.0.0.1:1970: 1 | |
| scheme: http | |
| "400": | |
| $ref: ../components/responses/BadRequest.yaml | |
| description: Invalid configuration | |
| "401": | |
| $ref: ../components/responses/Unauthorized.yaml | |
| "503": | |
| $ref: ../components/responses/BadRequest.yaml | |
| description: Storage access or write failed. | |
| operationId: putUpstreamWithBodyId |