ip-allocator-client 0.2.0

Rust API client for ip-allocator-webserver
Documentation
{
  "openapi": "3.0.0",
  "info": {
    "title": "ip-allocator-webserver",
    "version": "0.2.0"
  },
  "paths": {
    "/borrow": {
      "get": {
        "description": "Borrow an item from the freelist\n\nReturns an item along with a borrow_token that must be provided when returning the item. Optional query parameter `wait` specifies the maximum number of seconds to wait for an item to become available. If not specified, returns immediately. If specified, the request will block until an item becomes available or the timeout is reached.",
        "operationId": "handlers_ip_borrow",
        "parameters": [
          {
            "name": "wait",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "uint64",
              "minimum": 0.0,
              "nullable": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BorrowOutput"
                }
              }
            }
          },
          "400": {
            "description": "# [400 Bad Request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400)\nThe request given is wrongly formatted or data asked could not be fulfilled. "
          },
          "404": {
            "description": "# [404 Not Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404)\nThis response is given when you request a page that does not exists."
          },
          "422": {
            "description": "# [422 Unprocessable Entity](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422)\nThis response is given when you request body is not correctly formatted. "
          },
          "403": {
            "description": "# [403 Forbidden](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403)\nThis response is given when you don't have permission to access the requested resource. For example, when trying to return an item that you don't own."
          },
          "500": {
            "description": "# [500 Internal Server Error](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500)\nThis response is given when something wend wrong on the server. "
          },
          "503": {
            "description": "# [503 Service Unavailable](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503)\nThis response is given when the requested resource is temporarily unavailable. For example, when trying to borrow an IP but none are currently available in the freelist. Clients should retry after a delay."
          }
        }
      }
    },
    "/return": {
      "post": {
        "description": "Return an item to the freelist\n\nRequires the borrow_token that was provided when the item was borrowed. This prevents accidentally returning an item currently borrowed by someone else.",
        "operationId": "handlers_ip_return_item",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReturnInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationRef"
                }
              }
            }
          },
          "400": {
            "description": "# [400 Bad Request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400)\nThe request given is wrongly formatted or data asked could not be fulfilled. "
          },
          "404": {
            "description": "# [404 Not Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404)\nThis response is given when you request a page that does not exists."
          },
          "422": {
            "description": "# [422 Unprocessable Entity](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422)\nThis response is given when you request body is not correctly formatted. "
          },
          "403": {
            "description": "# [403 Forbidden](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403)\nThis response is given when you don't have permission to access the requested resource. For example, when trying to return an item that you don't own."
          },
          "500": {
            "description": "# [500 Internal Server Error](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500)\nThis response is given when something wend wrong on the server. "
          },
          "503": {
            "description": "# [503 Service Unavailable](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503)\nThis response is given when the requested resource is temporarily unavailable. For example, when trying to borrow an IP but none are currently available in the freelist. Clients should retry after a delay."
          }
        }
      }
    },
    "/operations/{id}": {
      "get": {
        "description": "Poll the status of an async operation",
        "operationId": "handlers_ip_get_operation_status",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationStatusOutput"
                }
              }
            }
          },
          "400": {
            "description": "# [400 Bad Request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400)\nThe request given is wrongly formatted or data asked could not be fulfilled. "
          },
          "404": {
            "description": "# [404 Not Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404)\nThis response is given when you request a page that does not exists."
          },
          "422": {
            "description": "# [422 Unprocessable Entity](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422)\nThis response is given when you request body is not correctly formatted. "
          },
          "403": {
            "description": "# [403 Forbidden](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403)\nThis response is given when you don't have permission to access the requested resource. For example, when trying to return an item that you don't own."
          },
          "500": {
            "description": "# [500 Internal Server Error](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500)\nThis response is given when something wend wrong on the server. "
          },
          "503": {
            "description": "# [503 Service Unavailable](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503)\nThis response is given when the requested resource is temporarily unavailable. For example, when trying to borrow an IP but none are currently available in the freelist. Clients should retry after a delay."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BorrowOutput": {
        "type": "object",
        "required": [
          "borrow_token",
          "item"
        ],
        "properties": {
          "item": {},
          "borrow_token": {
            "type": "string"
          }
        }
      },
      "OperationRef": {
        "type": "object",
        "required": [
          "operation_id",
          "status"
        ],
        "properties": {
          "operation_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "ReturnInput": {
        "type": "object",
        "required": [
          "borrow_token",
          "item"
        ],
        "properties": {
          "item": {},
          "borrow_token": {
            "type": "string"
          }
        }
      },
      "OperationStatusOutput": {
        "type": "object",
        "required": [
          "operation_id",
          "status"
        ],
        "properties": {
          "operation_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        }
      }
    }
  }
}