openapi: 3.0.0 info: title: DigitalOcean Load Balancers API version: '2.0' description: "# Introduction\n\nThe DigitalOcean API allows you to manage Droplets and resources within the\nDigitalOcean cloud in a simple, programmatic way using conventional HTTP requests.\n\nAll of the functionality that you are familiar with in the DigitalOcean\ncontrol panel is also available through the API, allowing you to script the\ncomplex actions that your situation requires.\n\nThe API documentation will start with a general overview about the design\nand technology that has been implemented, followed by reference information\nabout specific endpoints.\n\n## Requests\n\nAny tool that is fluent in HTTP can communicate with the API simply by\nrequesting the correct URI. Requests should be made using the HTTPS protocol\nso that traffic is encrypted. The interface responds to different methods\ndepending on the action required.\n\n|Method|Usage|\n|--- |--- |\n|GET|For simple retrieval of information about your account, Droplets, or environment, you should use the GET method. The information you request will be returned to you as a JSON object. The attributes defined by the JSON object can be used to form additional requests. Any request using the GET method is read-only and will not affect any of the objects you are querying.|\n|DELETE|To destroy a resource and remove it from your account and environment, the DELETE method should be used. This will remove the specified object if it is found. If it is not found, the operation will return a response indicating that the object was not found. This idempotency means that you do not have to check for a resource's availability prior to issuing a delete command, the final state will be the same regardless of its existence.|\n|PUT|To update the information about a resource in your account, the PUT method is available. Like the DELETE Method, the PUT method is idempotent. It sets the state of the target using the provided values, regardless of their current values. Requests using the PUT method do not need to check the current attributes of the object.|\n|PATCH|Some resources support partial modification. In these cases, the PATCH method is available. Unlike PUT which generally requires a complete representation of a resource, a PATCH request is a set of instructions on how to modify a resource updating only specific attributes.|\n|POST|To create a new object, your request should specify the POST method. The POST request includes all of the attributes necessary to create a new object. When you wish to create a new object, send a POST request to the target endpoint.|\n|HEAD|Finally, to retrieve metadata information, you should use the HEAD method to get the headers. This returns only the header of what would be returned with an associated GET request. Response headers contain some useful information about your API access and the results that are available for your request. For instance, the headers contain your current rate-limit value and the amount of time available until the limit resets. It also contains metrics about the total number of objects found, pagination information, and the total content length.|\n\n\n## HTTP Statuses\n\nAlong with the HTTP methods that the API responds to, it will also return\nstandard HTTP statuses, including error codes.\n\nIn the event of a problem, the status will contain the error code, while the\nbody of the response will usually contain additional information about the\nproblem that was encountered.\n\nIn general, if the status returned is in the 200 range, it indicates that\nthe request was fulfilled successfully and that no error was encountered.\n\nReturn codes in the 400 range typically indicate that there was an issue\nwith the request that was sent. Among other things, this could mean that you\ndid not authenticate correctly, that you are requesting an action that you\ndo not have authorization for, that the object you are requesting does not\nexist, or that your request is malformed.\n\nIf you receive a status in the 500 range, this generally indicates a\nserver-side problem. This means that we are having an issue on our end and\ncannot fulfill your request currently.\n\n400 and 500 level error responses will include a JSON object in their body,\nincluding the following attributes:\n\n|Name|Type|Description|\n|--- |--- |--- |\n|id|string|A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be \"not_found.\"|\n|message|string|A message providing additional information about the error, including details to help resolve it when possible.|\n|request_id|string|Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.|\n\n### Example Error Response\n\n```\n HTTP/1.1 403 Forbidden\n {\n \"id\": \"forbidden\",\n \"message\": \"You do not have access for the attempted action.\"\n }\n```\n\n## Responses\n\nWhen a request is successful, a response body will typically be sent back in\nthe form of a JSON object. An exception to this is when a DELETE request is\nprocessed, which will result in a successful HTTP 204 status and an empty\nresponse body.\n\nInside of this JSON object, the resource root that was the target of the\nrequest will be set as the key. This will be the singular form of the word\nif the request operated on a single object, and the plural form of the word\nif a collection was processed.\n\nFor example, if you send a GET request to `/v2/droplets/$DROPLET_ID` you\nwill get back an object with a key called \"`droplet`\". However, if you send\nthe GET request to the general collection at `/v2/droplets`, you will get\nback an object with a key called \"`droplets`\".\n\nThe value of these keys will generally be a JSON object for a request on a\nsingle object and an array of objects for a request on a collection of\nobjects.\n\n### Response for a Single Object\n\n```json\n {\n \"droplet\": {\n \"name\": \"example.com\"\n . . .\n }\n }\n```\n\n### Response for an Object Collection\n\n```json\n {\n \"droplets\": [\n {\n \"name\": \"example.com\"\n . . .\n },\n {\n \"name\": \"second.com\"\n . . .\n }\n ]\n }\n```\n\n## Meta\n\nIn addition to the main resource root, the response may also contain a\n`meta` object. This object contains information about the response itself.\n\nThe `meta` object contains a `total` key that is set to the total number of\nobjects returned by the request. This has implications on the `links` object\nand pagination.\n\nThe `meta` object will only be displayed when it has a value. Currently, the\n`meta` object will have a value when a request is made on a collection (like\n`droplets` or `domains`).\n\n\n### Sample Meta Object\n\n```json\n {\n . . .\n \"meta\": {\n \"total\": 43\n }\n . . .\n }\n```\n\n## Links & Pagination\n\nThe `links` object is returned as part of the response body when pagination\nis enabled. By default, 20 objects are returned per page. If the response\ncontains 20 objects or fewer, no `links` object will be returned. If the\nresponse contains more than 20 objects, the first 20 will be returned along\nwith the `links` object.\n\nYou can request a different pagination limit or force pagination by\nappending `?per_page=` to the request with the number of items you would\nlike per page. For instance, to show only two results per page, you could\nadd `?per_page=2` to the end of your query. The maximum number of results\nper page is 200.\n\nThe `links` object contains a `pages` object. The `pages` object, in turn,\ncontains keys indicating the relationship of additional pages. The values of\nthese are the URLs of the associated pages. The keys will be one of the\nfollowing:\n\n* **first**: The URI of the first page of results.\n* **prev**: The URI of the previous sequential page of results.\n* **next**: The URI of the next sequential page of results.\n* **last**: The URI of the last page of results.\n\nThe `pages` object will only include the links that make sense. So for the\nfirst page of results, no `first` or `prev` links will ever be set. This\nconvention holds true in other situations where a link would not make sense.\n\n### Sample Links Object\n\n```json\n {\n . . .\n \"links\": {\n \"pages\": {\n \"last\": \"https://api.digitalocean.com/v2/images?page=2\",\n \"next\": \"https://api.digitalocean.com/v2/images?page=2\"\n }\n }\n . . .\n }\n```\n\n## Rate Limit\n\nRequests through the API are rate limited per OAuth token. Current rate limits:\n\n* 5,000 requests per hour\n* 250 requests per minute (5% of the hourly total)\n\nOnce you exceed either limit, you will be rate limited until the next cycle\nstarts. Space out any requests that you would otherwise issue in bursts for\nthe best results.\n\nThe rate limiting information is contained within the response headers of\neach request. The relevant headers are:\n\n* **ratelimit-limit**: The number of requests that can be made per hour.\n* **ratelimit-remaining**: The number of requests that remain before you hit your request limit. See the information below for how the request limits expire.\n* **ratelimit-reset**: This represents the time when the oldest request will expire. The value is given in [Unix epoch time](http://en.wikipedia.org/wiki/Unix_time). See below for more information about how request limits expire.\n\nMore rate limiting information is returned only within burst limit error response headers:\n* **retry-after**: The number of seconds to wait before making another request when rate limited.\n\nAs long as the `ratelimit-remaining` count is above zero, you will be able\nto make additional requests.\n\nThe way that a request expires and is removed from the current limit count\nis important to understand. Rather than counting all of the requests for an\nhour and resetting the `ratelimit-remaining` value at the end of the hour,\neach request instead has its own timer.\n\nThis means that each request contributes toward the `ratelimit-remaining`\ncount for one complete hour after the request is made. When that request's\ntimer runs out, it is no longer counted towards the request limit.\n\nThis has implications on the meaning of the `ratelimit-reset` header as\nwell. Because the entire rate limit is not reset at one time, the value of\nthis header is set to the time when the _oldest_ request will expire.\n\nKeep this in mind if you see your `ratelimit-reset` value change, but not\nmove an entire hour into the future.\n\nIf the `ratelimit-remaining` reaches zero, subsequent requests will receive\na 429 error code until the request reset has been reached. \n\n`ratelimit-remaining` reaching zero can also indicate that the \"burst limit\" of 250 \nrequests per minute limit was met, even if the 5,000 requests per hour limit was not. \nIn this case, the 429 error response will include a `retry-after` header to indicate how \nlong to wait (in seconds) until the request may be retried.\n\nYou can see the format of the response in the examples. \n\n**Note:** The following endpoints have special rate limit requirements that\nare independent of the limits defined above.\n\n* Only 12 `POST` requests to the `/v2/floating_ips` endpoint to create Floating IPs can be made per 60 seconds.\n* Only 10 `GET` requests to the `/v2/account/keys` endpoint to list SSH keys can be made per 60 seconds.\n* Only 5 requests to any and all `v2/cdn/endpoints` can be made per 10 seconds. This includes `v2/cdn/endpoints`, \n `v2/cdn/endpoints/$ENDPOINT_ID`, and `v2/cdn/endpoints/$ENDPOINT_ID/cache`.\n* Only 50 strings within the `files` json struct in the `v2/cdn/endpoints/$ENDPOINT_ID/cache` [payload](https://docs.digitalocean.com/reference/api/api-reference/#operation/cdn_purge_cache) \n can be requested every 20 seconds.\n\n### Sample Rate Limit Headers\n\n```\n . . .\n ratelimit-limit: 1200\n ratelimit-remaining: 1193\n rateLimit-reset: 1402425459\n . . .\n```\n\n ### Sample Rate Limit Headers When Burst Limit is Reached:\n\n```\n . . .\n ratelimit-limit: 5000\n ratelimit-remaining: 0\n rateLimit-reset: 1402425459\n retry-after: 29\n . . .\n```\n\n### Sample Rate Exceeded Response\n\n```\n 429 Too Many Requests\n {\n id: \"too_many_requests\",\n message: \"API Rate limit exceeded.\"\n }\n```\n\n## Curl Examples\n\nThroughout this document, some example API requests will be given using the\n`curl` command. This will allow us to demonstrate the various endpoints in a\nsimple, textual format.\n \n These examples assume that you are using a Linux or macOS command line. To run\nthese commands on a Windows machine, you can either use cmd.exe, PowerShell, or WSL:\n\n* For cmd.exe, use the `set VAR=VALUE` [syntax](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1)\nto define environment variables, call them with `%VAR%`, then replace all backslashes (`\\`) in the examples with carets (`^`).\n\n* For PowerShell, use the `$Env:VAR = \"VALUE\"` [syntax](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.2)\nto define environment variables, call them with `$Env:VAR`, then replace `curl` with `curl.exe` and all backslashes (`\\`) in the examples with backticks (`` ` ``).\n\n* WSL is a compatibility layer that allows you to emulate a Linux terminal on a Windows machine.\nInstall WSL with our [community tutorial](https://www.digitalocean.com/community/tutorials/how-to-install-the-windows-subsystem-for-linux-2-on-microsoft-windows-10), \nthen follow this API documentation normally.\n\nThe names of account-specific references (like Droplet IDs, for instance)\nwill be represented by variables. For instance, a Droplet ID may be\nrepresented by a variable called `$DROPLET_ID`. You can set the associated\nvariables in your environment if you wish to use the examples without\nmodification.\n\nThe first variable that you should set to get started is your OAuth\nauthorization token. The next section will go over the details of this, but\nyou can set an environmental variable for it now.\n\nGenerate a token by going to the [Apps & API](https://cloud.digitalocean.com/settings/applications)\nsection of the DigitalOcean control panel. Use an existing token if you have\nsaved one, or generate a new token with the \"Generate new token\" button.\nCopy the generated token and use it to set and export the TOKEN variable in\nyour environment as the example shows.\n\nYou may also wish to set some other variables now or as you go along. For\nexample, you may wish to set the `DROPLET_ID` variable to one of your\nDroplet IDs since this will be used frequently in the API.\n\nIf you are following along, make sure you use a Droplet ID that you control\nso that your commands will execute correctly.\n\nIf you need access to the headers of a response through `curl`, you can pass\nthe `-i` flag to display the header information along with the body. If you\nare only interested in the header, you can instead pass the `-I` flag, which\nwill exclude the response body entirely.\n\n\n### Set and Export your OAuth Token\n\n```\nexport DIGITALOCEAN_TOKEN=your_token_here\n```\n\n### Set and Export a Variable\n\n```\nexport DROPLET_ID=1111111\n```\n\n## Parameters\n\nThere are two different ways to pass parameters in a request with the API.\n\nWhen passing parameters to create or update an object, parameters should be\npassed as a JSON object containing the appropriate attribute names and\nvalues as key-value pairs. When you use this format, you should specify that\nyou are sending a JSON object in the header. This is done by setting the\n`Content-Type` header to `application/json`. This ensures that your request\nis interpreted correctly.\n\nWhen passing parameters to filter a response on GET requests, parameters can\nbe passed using standard query attributes. In this case, the parameters\nwould be embedded into the URI itself by appending a `?` to the end of the\nURI and then setting each attribute with an equal sign. Attributes can be\nseparated with a `&`. Tools like `curl` can create the appropriate URI when\ngiven parameters and values; this can also be done using the `-F` flag and\nthen passing the key and value as an argument. The argument should take the\nform of a quoted string with the attribute being set to a value with an\nequal sign.\n\n### Pass Parameters as a JSON Object\n\n```\n curl -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"example.com\", \"ip_address\": \"127.0.0.1\"}' \\\n -X POST \"https://api.digitalocean.com/v2/domains\"\n```\n\n### Pass Filter Parameters as a Query String\n\n```\n curl -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -X GET \\\n \"https://api.digitalocean.com/v2/images?private=true\"\n```\n\n## Cross Origin Resource Sharing\n\nIn order to make requests to the API from other domains, the API implements\nCross Origin Resource Sharing (CORS) support.\n\nCORS support is generally used to create AJAX requests outside of the domain\nthat the request originated from. This is necessary to implement projects\nlike control panels utilizing the API. This tells the browser that it can\nsend requests to an outside domain.\n\nThe procedure that the browser initiates in order to perform these actions\n(other than GET requests) begins by sending a \"preflight\" request. This sets\nthe `Origin` header and uses the `OPTIONS` method. The server will reply\nback with the methods it allows and some of the limits it imposes. The\nclient then sends the actual request if it falls within the allowed\nconstraints.\n\nThis process is usually done in the background by the browser, but you can\nuse curl to emulate this process using the example provided. The headers\nthat will be set to show the constraints are:\n\n* **Access-Control-Allow-Origin**: This is the domain that is sent by the client or browser as the origin of the request. It is set through an `Origin` header.\n* **Access-Control-Allow-Methods**: This specifies the allowed options for requests from that domain. This will generally be all available methods.\n* **Access-Control-Expose-Headers**: This will contain the headers that will be available to requests from the origin domain.\n* **Access-Control-Max-Age**: This is the length of time that the access is considered valid. After this expires, a new preflight should be sent.\n* **Access-Control-Allow-Credentials**: This will be set to `true`. It basically allows you to send your OAuth token for authentication.\n\nYou should not need to be concerned with the details of these headers,\nbecause the browser will typically do all of the work for you.\n" license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html contact: name: DigitalOcean API Team email: api-engineering@digitalocean.com termsOfService: https://www.digitalocean.com/legal/terms-of-service-agreement/ servers: - url: https://api.digitalocean.com description: production security: - bearer_auth: [] tags: - name: Load Balancers description: '[DigitalOcean Load Balancers](https://docs.digitalocean.com/products/networking/load-balancers/) provide a way to distribute traffic across multiple Droplets. By sending requests to the `/v2/load_balancers` endpoint, you can list, create, or delete load balancers as well as add or remove Droplets, forwarding rules, and other configuration details.' paths: /v2/load_balancers: post: operationId: loadBalancers_create summary: Create a New Load Balancer description: "To create a new load balancer instance, send a POST request to\n`/v2/load_balancers`.\n\nYou can specify the Droplets that will sit behind the load balancer using one\nof two methods:\n\n* Set `droplet_ids` to a list of specific Droplet IDs.\n* Set `tag` to the name of a tag. All Droplets with this tag applied will be\n assigned to the load balancer. Additional Droplets will be automatically\n assigned as they are tagged.\n\nThese methods are mutually exclusive.\n" tags: - Load Balancers requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/load_balancer_create' examples: Basic Create Request: $ref: '#/components/examples/load_balancer_basic_create_request' SSL Termination Create Request: $ref: '#/components/examples/load_balancer_ssl_termination_create_request' Create Request Using Droplet Tag: $ref: '#/components/examples/load_balancer_using_tag_create_request' Sticky Sessions and Custom Health Check: $ref: '#/components/examples/load_balancer_sticky_sessions_and_health_check_create_request' responses: '202': $ref: '#/components/responses/load_balancer_create' '401': $ref: '#/components/responses/unauthorized' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "# Create new load balancer\ncurl -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -d '{\"name\": \"example-lb-01\",\"size_unit\": 1, \"region\": \"nyc3\", \"forwarding_rules\":[{\"entry_protocol\":\"http\",\"entry_port\":80,\"target_protocol\":\"http\",\"target_port\":80,\"certificate_id\":\"\",\"tls_passthrough\":false}, {\"entry_protocol\": \"https\",\"entry_port\": 444,\"target_protocol\": \"https\",\"target_port\": 443,\"tls_passthrough\": true}], \"health_check\":{\"protocol\":\"http\",\"port\":80,\"path\":\"/\",\"check_interval_seconds\":10,\"response_timeout_seconds\":5,\"healthy_threshold\":5,\"unhealthy_threshold\":3}, \"sticky_sessions\":{\"type\":\"none\"}, \"firewall\":{\"deny\":[\"ip:1.2.3.4\",\"cidr:2.3.4.0/24\"],\"allow\":[\"cidr:1.2.0.0/16\",\"ip:2.3.4.5\"]}, \"droplet_ids\": [3164444, 3164445]}' \\\n \"https://api.digitalocean.com/v2/load_balancers\"\n\n# Create new load balancer with Droplet tag\ncurl -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -d '{\"name\": \"example-lb-01\", \"region\": \"nyc3\", \"size_unit\": 1, \"forwarding_rules\":[{\"entry_protocol\":\"http\",\"entry_port\":80,\"target_protocol\":\"http\",\"target_port\":80,\"certificate_id\":\"\",\"tls_passthrough\":false}, {\"entry_protocol\": \"https\",\"entry_port\": 444,\"target_protocol\": \"https\",\"target_port\": 443,\"tls_passthrough\": true}], \"health_check\":{\"protocol\":\"http\",\"port\":80,\"path\":\"/\",\"check_interval_seconds\":10,\"response_timeout_seconds\":5,\"healthy_threshold\":5,\"unhealthy_threshold\":3}, \"sticky_sessions\":{\"type\":\"none\"}, \"firewall\":{\"deny\":[\"ip:1.2.3.4\", \"cidr:2.3.4.0/24\"],\"allow\":[\"cidr:1.2.0.0/16\",\"ip:2.3.4.5\"]}, \"tag\": \"web:prod\"}' \\\n \"https://api.digitalocean.com/v2/load_balancers\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n createRequest := &godo.LoadBalancerRequest{\n Name: \"example-01\",\n SizeUnit: \"1\",\n Algorithm: \"round_robin\",\n Region: \"nyc3\",\n ForwardingRules: []godo.ForwardingRule{\n {\n EntryProtocol: \"http\",\n EntryPort: 80,\n TargetProtocol: \"http\",\n TargetPort: 80,\n },\n {\n EntryProtocol: \"https\",\n EntryPort: 443,\n TargetProtocol: \"https\",\n TargetPort: 443,\n TlsPassthrough: true,\n },\n },\n HealthCheck: &godo.HealthCheck{\n Protocol: \"http\",\n Port: 80,\n Path: \"/\",\n CheckIntervalSeconds: 10,\n ResponseTimeoutSeconds: 5,\n HealthyThreshold: 5,\n UnhealthyThreshold: 3,\n },\n StickySessions: &godo.StickySessions{\n Type: \"none\",\n },\n DropletIDs: []int{3164444, 3164445},\n RedirectHttpToHttps: false,\n Firewall: &godo.LBFirewall{\n Deny: []string{\"ip:1.2.3.4\", \"cidr:2.3.4.0/24\"},\n Allow: []string{\"cidr:1.2.0.0/16\", \"ip:2.3.4.5\"},\n }\n // Create new load balancer with Droplet tag\n // Tag: \"web:prod\",\n // RedirectHttpToHttps: false,\n }\n\n lb, _, err := client.LoadBalancers.Create(ctx, createRequest)" - lang: Ruby source: "require 'droplet_kit'\ntoken = ENV['DIGITALOCEAN_TOKEN']\nclient = DropletKit::Client.new(access_token: token)\n\nload_balancer = DropletKit::LoadBalancer.new(\n name: 'example-lb-01',\n size_unit: '1',\n algorithm: 'round_robin',\n# Create new load balancer with Droplet tag\n# tag: 'web:prod',\n droplet_ids: [ 3164444, 3164445],\n redirect_http_to_https: true,\n region: 'nyc3',\n forwarding_rules: [\n DropletKit::ForwardingRule.new(\n entry_protocol: 'http',\n entry_port: 80,\n target_protocol: 'http',\n target_port: 80,\n certificate_id: '',\n tls_passthrough: false\n ),\n DropletKit::ForwardingRule.new(\n entry_protocol: 'https',\n entry_port: 443,\n target_protocol: 'https',\n target_port: 443,\n certificate_id: '',\n tls_passthrough: true\n )\n ],\n sticky_sessions: DropletKit::StickySession.new(\n type: 'cookies',\n cookie_name: 'DO-LB',\n cookie_ttl_seconds: 5\n ),\n health_check: DropletKit::HealthCheck.new(\n protocol: 'http',\n port: 80,\n path: '/',\n check_interval_seconds: 10,\n response_timeout_seconds: 5,\n healthy_threshold: 5,\n unhealthy_threshold: 3\n )\n)\nclient.load_balancers.create(load_balancer)" - lang: Python source: "import os\nfrom pydo import Client\n\nclient = Client(token=os.environ.get(\"DIGITALOCEAN_TOKEN\"))\n\nreq = {\n \"name\": \"example-lb-01\",\n \"region\": \"nyc3\",\n \"forwarding_rules\": [\n {\n \"entry_protocol\": \"http\",\n \"entry_port\": 80,\n \"target_protocol\": \"http\",\n \"target_port\": 80\n },\n {\n \"entry_protocol\": \"https\",\n \"entry_port\": 443,\n \"target_protocol\": \"https\",\n \"target_port\": 443,\n \"tls_passthrough\": True\n }\n ],\n \"droplet_ids\": [\n 3164444,\n 3164445\n ],\n \"project_id\": \"9cc10173-e9ea-4176-9dbc-a4cee4c4ff30\",\n \"http_idle_timeout_seconds\": 60,\n \"firewall\": {\n \"deny\": [\n \"cidr:1.2.0.0/16\",\n \"ip:2.3.4.5\"\n ],\n \"allow\": [\n \"ip:1.2.3.4\",\n \"cidr:2.3.4.0/24\"\n ]\n }\n}\n\nresp = client.load_balancers.create(body=req)" security: - bearer_auth: - load_balancer:create get: operationId: loadBalancers_list summary: List All Load Balancers description: 'To list all of the load balancer instances on your account, send a GET request to `/v2/load_balancers`. ' tags: - Load Balancers parameters: - $ref: '#/components/parameters/per_page' - $ref: '#/components/parameters/page' responses: '200': $ref: '#/components/responses/all_load_balancers' '401': $ref: '#/components/responses/unauthorized' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "curl -X GET \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n \"https://api.digitalocean.com/v2/load_balancers\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n opt := &godo.ListOptions{\n Page: 1,\n PerPage: 200,\n }\n\n lbs, _, err := c.LoadBalancers.List(ctx, opt)\n}" - lang: Ruby source: 'require ''droplet_kit'' token = ENV[''DIGITALOCEAN_TOKEN''] client = DropletKit::Client.new(access_token: token) load_balancers = client.load_balancers.all load_balancers.each' - lang: Python source: 'import os from pydo import Client client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) resp = client.load_balancers.list()' security: - bearer_auth: - load_balancer:read /v2/load_balancers/{lb_id}: get: operationId: loadBalancers_get summary: Retrieve an Existing Load Balancer description: 'To show information about a load balancer instance, send a GET request to `/v2/load_balancers/$LOAD_BALANCER_ID`. ' tags: - Load Balancers parameters: - $ref: '#/components/parameters/load_balancer_id' responses: '200': $ref: '#/components/responses/existing_load_balancer' '401': $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "curl -X GET \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n \"https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n lb, _, err := client.LoadBalancers.Get(ctx, \"4de7ac8b-495b-4884-9a69-1050c6793cd6\")\n}" - lang: Ruby source: 'require ''droplet_kit'' token = ENV[''DIGITALOCEAN_TOKEN''] client = DropletKit::Client.new(access_token: token) client.load_balancers.find(id: ''4de7ac8b-495b-4884-9a69-1050c6793cd6'')' - lang: Python source: 'import os from pydo import Client client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) resp = client.load_balancers.get(lb_id="afda3ad")' security: - bearer_auth: - load_balancer:read put: operationId: loadBalancers_update summary: Update a Load Balancer description: 'To update a load balancer''s settings, send a PUT request to `/v2/load_balancers/$LOAD_BALANCER_ID`. The request should contain a full representation of the load balancer including existing attributes. It may contain _one of_ the `droplets_ids` or `tag` attributes as they are mutually exclusive. **Note that any attribute that is not provided will be reset to its default value.** ' tags: - Load Balancers parameters: - $ref: '#/components/parameters/load_balancer_id' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/load_balancer_create' examples: load_balancer_update_request: $ref: '#/components/examples/load_balancer_update_request' responses: '200': $ref: '#/components/responses/updated_load_balancer' '401': $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "curl -X PUT \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -d '{\"name\":\"example-lb-01\",\"size_unit\":\"2\",\"region\":\"nyc3\",\"algorithm\":\"least_connections\",\"forwarding_rules\":[{\"entry_protocol\":\"http\",\"entry_port\":80,\"target_protocol\":\"http\",\"target_port\":80},{\"entry_protocol\":\"https\",\"entry_port\":444,\"target_protocol\":\"https\",\"target_port\":443,\"tls_passthrough\":true}],\"health_check\":{\"protocol\":\"http\",\"port\":80,\"path\":\"/\",\"check_interval_seconds\":10,\"response_timeout_seconds\":5,\"healthy_threshold\":5,\"unhealthy_threshold\":3},\"sticky_sessions\":{\"type\":\"cookies\", \"cookie_name\": \"DO_LB\", \"cookie_ttl_seconds\": 300}, \"firewall\":{\"deny\":[\"ip:1.2.3.4\",\"cidr:2.3.4.0/24\"], \"allow\":[\"cidr:1.2.0.0/16\",\"ip:2.3.4.5\"]}, \"droplet_ids\": [3164444, 3164445]}' \\\n \"https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n updateRequest := &godo.LoadBalancerRequest{\n Name: \"example-01\",\n SizeUnit: \"2\",\n Algorithm: \"round_robin\",\n Region: \"nyc3\",\n ForwardingRules: []godo.ForwardingRule{\n {\n EntryProtocol: \"http\",\n EntryPort: 80,\n TargetProtocol: \"http\",\n TargetPort: 80,\n },\n {\n EntryProtocol: \"https\",\n EntryPort: 443,\n TargetProtocol: \"https\",\n TargetPort: 443,\n TlsPassthrough: true,\n },\n },\n HealthCheck: &godo.HealthCheck{\n Protocol: \"http\",\n Port: 80,\n Path: \"/\",\n CheckIntervalSeconds: 10,\n ResponseTimeoutSeconds: 5,\n HealthyThreshold: 5,\n UnhealthyThreshold: 3,\n },\n StickySessions: &godo.StickySessions{\n Type: \"cookies\",\n CookieName: \"DO_LB\",\n CookieTtlSeconds: 300,\n },\n DropletIDs: []int{3164444, 3164445},\n RedirectHttpToHttps: false,\n Firewall: &godo.LBFirewall{\n Deny: []string{\"ip:1.2.3.4\", \"cidr:2.3.4.0/24\"},\n Allow: []string{\"cidr:1.2.0.0/16\", \"ip:2.3.4.5\"},\n }\n }\n\n lb, _, err := c.LoadBalancers.Update(ctx, \"c2c97ca7-6f63-4e23-8909-906fd86efb5e\", updateRequest)\n}" - lang: Ruby source: "require 'droplet_kit'\ntoken = ENV['DIGITALOCEAN_TOKEN']\nclient = DropletKit::Client.new(access_token: token)\n\nload_balancer = DropletKit::LoadBalancer.new(\n name: 'example-lb-01',\n size_unit: '2',\n algorithm: 'round_robin',\n droplet_ids: [ 3164444, 3164445],\n redirect_http_to_https: true,\n region: 'nyc3',\n forwarding_rules: [\n DropletKit::ForwardingRule.new(\n entry_protocol: 'http',\n entry_port: 80,\n target_protocol: 'http',\n target_port: 80,\n certificate_id: '',\n tls_passthrough: false\n ),\n DropletKit::ForwardingRule.new(\n entry_protocol: 'https',\n entry_port: 443,\n target_protocol: 'https',\n target_port: 443,\n certificate_id: '',\n tls_passthrough: true\n )\n ],\n sticky_sessions: DropletKit::StickySession.new(\n type: 'cookies',\n cookie_name: 'DO-LB-COOKIE',\n cookie_ttl_seconds: 5\n ),\n health_check: DropletKit::HealthCheck.new(\n protocol: 'http',\n port: 80,\n path: '/',\n check_interval_seconds: 10,\n response_timeout_seconds: 5,\n healthy_threshold: 5,\n unhealthy_threshold: 3\n )\n)\nclient.load_balancers.update(load_balancer, id: '4de7ac8b-495b-4884-9a69-1050c6793cd6')" - lang: Python source: "import os\nfrom pydo import Client\n\nclient = Client(token=os.environ.get(\"DIGITALOCEAN_TOKEN\"))\n\nreq = {\n \"name\": \"updated-example-lb-01\",\n \"region\": \"nyc3\",\n \"droplet_ids\": [\n 3164444,\n 3164445\n ],\n \"algorithm\": \"round_robin\",\n \"forwarding_rules\": [\n {\n \"entry_protocol\": \"http\",\n \"entry_port\": 80,\n \"target_protocol\": \"http\",\n \"target_port\": 80,\n \"certificate_id\": \"\",\n \"tls_passthrough\": false\n },\n {\n \"entry_protocol\": \"https\",\n \"entry_port\": 443,\n \"target_protocol\": \"https\",\n \"target_port\": 443,\n \"certificate_id\": \"\",\n \"tls_passthrough\": true\n }\n ],\n \"health_check\": {\n \"protocol\": \"http\",\n \"port\": 80,\n \"path\": \"/\",\n \"check_interval_seconds\": 10,\n \"response_timeout_seconds\": 5,\n \"healthy_threshold\": 5,\n \"unhealthy_threshold\": 3\n },\n \"sticky_sessions\": {\n \"type\": \"none\"\n },\n \"redirect_http_to_https\": False,\n \"enable_proxy_protocol\": True,\n \"enable_backend_keepalive\": True,\n \"vpc_uuid\": \"c33931f2-a26a-4e61-b85c-4e95a2ec431b\",\n \"project_id\": \"9cc10173-e9ea-4176-9dbc-a4cee4c4ff30\",\n \"http_idle_timeout_seconds\": 60,\n \"firewall\": {\n \"deny\": [\n \"cidr:1.2.0.0/16\",\n \"ip:2.3.4.5\"\n ],\n \"allow\": [\n \"ip:1.2.3.4\",\n \"cidr:2.3.4.0/24\"\n ]\n }\n}\nresp = client.load_balancers.update(lb_id=\"fda9fda\", body=req)" security: - bearer_auth: - load_balancer:update delete: operationId: loadBalancers_delete summary: Delete a Load Balancer description: 'To delete a load balancer instance, disassociating any Droplets assigned to it and removing it from your account, send a DELETE request to `/v2/load_balancers/$LOAD_BALANCER_ID`. A successful request will receive a 204 status code with no body in response. This indicates that the request was processed successfully. ' tags: - Load Balancers parameters: - $ref: '#/components/parameters/load_balancer_id' responses: '204': $ref: '#/components/responses/no_content' '401': $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "curl -X DELETE \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n \"https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n _, err := client.LoadBalancers.Delete(ctx, \"4de7ac8b-495b-4884-9a69-1050c6793cd6\")\n}" - lang: Ruby source: 'require ''droplet_kit'' token = ENV[''DIGITALOCEAN_TOKEN''] client = DropletKit::Client.new(access_token: token) client.load_balancers.delete(id: ''4de7ac8b-495b-4884-9a69-1050c6793cd6'')' - lang: Python source: 'import os from pydo import Client client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) resp = client.load_balancers.delete(lb_id="afda3ad")' security: - bearer_auth: - load_balancer:delete /v2/load_balancers/{lb_id}/droplets: post: operationId: loadBalancers_add_droplets summary: Add Droplets to a Load Balancer description: 'To assign a Droplet to a load balancer instance, send a POST request to `/v2/load_balancers/$LOAD_BALANCER_ID/droplets`. In the body of the request, there should be a `droplet_ids` attribute containing a list of Droplet IDs. Individual Droplets can not be added to a load balancer configured with a Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity" response from the API. No response body will be sent back, but the response code will indicate success. Specifically, the response code will be a 204, which means that the action was successful with no returned body data. ' tags: - Load Balancers parameters: - $ref: '#/components/parameters/load_balancer_id' requestBody: required: true content: application/json: schema: properties: droplet_ids: type: array items: type: integer example: - 3164444 - 3164445 description: An array containing the IDs of the Droplets assigned to the load balancer. required: - droplet_ids responses: '204': $ref: '#/components/responses/no_content' '401': $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "curl -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -d '{\"droplet_ids\": [3164446, 3164447]}' \\\n \"https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6/droplets\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n droplets := []int{3164446, 3164447}\n _, err := client.LoadBalancers.AddDroplets(ctx, \"4de7ac8b-495b-4884-9a69-1050c6793cd6\", droplets...)\n}" - lang: Ruby source: 'require ''droplet_kit'' token = ENV[''DIGITALOCEAN_TOKEN''] client = DropletKit::Client.new(access_token: token) client.load_balancers.add_droplets([3164446, 3164447], id: ''4de7ac8b-495b-4884-9a69-1050c6793cd6'')' - lang: Python source: "import os\nfrom pydo import Client\n\nclient = Client(token=os.environ.get(\"DIGITALOCEAN_TOKEN\"))\n\nreq = {\n \"droplet_ids\": [\n 3164444,\n 3164445\n ]\n}\n\nresp = client.load_balancers.add_droplets(lb_id=\"1fd32a\", body=req)" security: - bearer_auth: - load_balancer:update delete: operationId: loadBalancers_remove_droplets summary: Remove Droplets from a Load Balancer description: 'To remove a Droplet from a load balancer instance, send a DELETE request to `/v2/load_balancers/$LOAD_BALANCER_ID/droplets`. In the body of the request, there should be a `droplet_ids` attribute containing a list of Droplet IDs. No response body will be sent back, but the response code will indicate success. Specifically, the response code will be a 204, which means that the action was successful with no returned body data. ' tags: - Load Balancers parameters: - $ref: '#/components/parameters/load_balancer_id' requestBody: required: true content: application/json: schema: properties: droplet_ids: type: array items: type: integer example: - 3164444 - 3164445 description: An array containing the IDs of the Droplets assigned to the load balancer. required: - droplet_ids responses: '204': $ref: '#/components/responses/no_content' '401': $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "curl -X DELETE \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -d '{\"droplet_ids\": [3164446, 3164447]}' \\\n \"https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6/droplets\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n droplets := []int{3164446, 3164447}\n _, err := client.LoadBalancers.RemoveDroplets(ctx, \"4de7ac8b-495b-4884-9a69-1050c6793cd6\", droplets...)\n}" - lang: Ruby source: 'require ''droplet_kit'' token = ENV[''DIGITALOCEAN_TOKEN''] client = DropletKit::Client.new(access_token: token) client.load_balancers.remove_droplets([3164446, 3164447], id: ''4de7ac8b-495b-4884-9a69-1050c6793cd6'')' - lang: Python source: "import os\nfrom pydo import Client\n\nclient = Client(token=os.environ.get(\"DIGITALOCEAN_TOKEN\"))\n\nreq = {\n \"droplet_ids\": [\n 3164444,\n 3164445\n ]\n}\n\nresp = client.load_balancers.remove_droplets(lb_id=\"fda9fda\", body=req)" security: - bearer_auth: - load_balancer:update /v2/load_balancers/{lb_id}/forwarding_rules: post: operationId: loadBalancers_add_forwardingRules summary: Add Forwarding Rules to a Load Balancer description: 'To add an additional forwarding rule to a load balancer instance, send a POST request to `/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules`. In the body of the request, there should be a `forwarding_rules` attribute containing an array of rules to be added. No response body will be sent back, but the response code will indicate success. Specifically, the response code will be a 204, which means that the action was successful with no returned body data. ' tags: - Load Balancers parameters: - $ref: '#/components/parameters/load_balancer_id' requestBody: required: true content: application/json: schema: properties: forwarding_rules: type: array minItems: 1 items: $ref: '#/components/schemas/forwarding_rule' required: - forwarding_rules responses: '204': $ref: '#/components/responses/no_content' '401': $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "curl -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -d '{\"forwarding_rules\": [{\"entry_protocol\": \"tcp\",\"entry_port\": 3306,\"target_protocol\": \"tcp\",\"target_port\": 3306}]}' \\\n \"https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6/forwarding_rules\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n forwardingRule := []godo.ForwardingRule{\n {\n EntryProtocol: \"tcp\",\n EntryPort: 3306,\n TargetProtocol: \"tcp\",\n TargetPort: 3306,\n },\n }\n}" - lang: Ruby source: "require 'droplet_kit'\ntoken = ENV['DIGITALOCEAN_TOKEN']\nclient = DropletKit::Client.new(access_token: token)\n\nrule = DropletKit::ForwardingRule.new(\n entry_protocol: 'tcp',\n entry_port: 3306,\n target_protocol: 'tcp',\n target_port: 3306,\n certificate_id: '',\n tls_passthrough: false\n)\nclient.load_balancers.add_forwarding_rules([rule], id: '4de7ac8b-495b-4884-9a69-1050c6793cd6')" - lang: Python source: "import os\nfrom pydo import Client\n\nclient = Client(token=os.environ.get(\"DIGITALOCEAN_TOKEN\"))\n\nreq = {\n \"forwarding_rules\": [\n {\n \"entry_protocol\": \"https\",\n \"entry_port\": 443,\n \"target_protocol\": \"http\",\n \"target_port\": 80,\n \"certificate_id\": \"892071a0-bb95-49bc-8021-3afd67a210bf\",\n \"tls_passthrough\": False\n }\n ]\n}\n\nresp = client.load_balancers.add_forwarding_rules(lb_id=\"1fd32a\", body=req)" security: - bearer_auth: - load_balancer:update delete: operationId: loadBalancers_remove_forwardingRules summary: Remove Forwarding Rules from a Load Balancer description: 'To remove forwarding rules from a load balancer instance, send a DELETE request to `/v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules`. In the body of the request, there should be a `forwarding_rules` attribute containing an array of rules to be removed. No response body will be sent back, but the response code will indicate success. Specifically, the response code will be a 204, which means that the action was successful with no returned body data. ' tags: - Load Balancers parameters: - $ref: '#/components/parameters/load_balancer_id' requestBody: required: true content: application/json: schema: properties: forwarding_rules: type: array minItems: 1 items: $ref: '#/components/schemas/forwarding_rule' required: - forwarding_rules responses: '204': $ref: '#/components/responses/no_content' '401': $ref: '#/components/responses/unauthorized' '404': $ref: '#/components/responses/not_found' '429': $ref: '#/components/responses/too_many_requests' '500': $ref: '#/components/responses/server_error' default: $ref: '#/components/responses/unexpected_error' x-codeSamples: - lang: cURL source: "curl -X DELETE \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n -d '{\"forwarding_rules\": [{\"entry_protocol\": \"tcp\",\"entry_port\": 3306,\"target_protocol\": \"tcp\",\"target_port\": 3306}]}' \\\n \"https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6/forwarding_rules\"" - lang: Go source: "import (\n \"context\"\n \"os\"\n\n \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n client := godo.NewFromToken(token)\n ctx := context.TODO()\n\n forwardingRule := []godo.ForwardingRule{\n {\n EntryProtocol: \"tcp\",\n EntryPort: 3306,\n TargetProtocol: \"tcp\",\n TargetPort: 3306,\n },\n }\n\n _, err := client.LoadBalancers.RemoveForwardingRules(ctx, \"4de7ac8b-495b-4884-9a69-1050c6793cd6\", forwardingRule...)\n}" - lang: Ruby source: "require 'droplet_kit'\ntoken = ENV['DIGITALOCEAN_TOKEN']\nclient = DropletKit::Client.new(access_token: token)\n\nrule = DropletKit::ForwardingRule.new(\n entry_protocol: 'tcp',\n entry_port: 3306,\n target_protocol: 'tcp',\n target_port: 3306,\n certificate_id: '',\n tls_passthrough: false\n)\nclient.load_balancers.remove_forwarding_rules([rule], id: '4de7ac8b-495b-4884-9a69-1050c6793cd6')" - lang: Python source: "import os\nfrom pydo import Client\n\nclient = Client(token=os.environ.get(\"DIGITALOCEAN_TOKEN\"))\n\nreq = {\n \"forwarding_rules\": [\n {\n \"entry_protocol\": \"https\",\n \"entry_port\": 443,\n \"target_protocol\": \"http\",\n \"target_port\": 80,\n \"certificate_id\": \"892071a0-bb95-49bc-8021-3afd67a210bf\",\n \"tls_passthrough\": False\n }\n ]\n}\n\nresp = client.load_balancers.remove_forwarding_rules(lb_id=\"fda9fda\", body=req)" security: - bearer_auth: - load_balancer:update components: schemas: health_check: type: object description: An object specifying health check settings for the load balancer. properties: protocol: type: string enum: - http - https - tcp default: http example: http description: The protocol used for health checks sent to the backend Droplets. The possible values are `http`, `https`, or `tcp`. port: type: integer default: 80 example: 80 description: An integer representing the port on the backend Droplets on which the health check will attempt a connection. path: type: string default: / example: / description: The path on the backend Droplets to which the load balancer instance will send a request. check_interval_seconds: type: integer default: 10 example: 10 description: The number of seconds between between two consecutive health checks. response_timeout_seconds: type: integer default: 5 example: 5 description: The number of seconds the load balancer instance will wait for a response until marking a health check as failed. unhealthy_threshold: type: integer default: 5 example: 5 description: The number of times a health check must fail for a backend Droplet to be marked "unhealthy" and be removed from the pool. healthy_threshold: type: integer default: 3 example: 3 description: The number of times a health check must pass for a backend Droplet to be marked "healthy" and be re-added to the pool. forwarding_rule: type: object description: An object specifying a forwarding rule for a load balancer. properties: entry_protocol: type: string enum: - http - https - http2 - http3 - tcp - udp example: https description: 'The protocol used for traffic to the load balancer. The possible values are: `http`, `https`, `http2`, `http3`, `tcp`, or `udp`. If you set the `entry_protocol` to `udp`, the `target_protocol` must be set to `udp`. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly. ' entry_port: type: integer example: 443 description: An integer representing the port on which the load balancer instance will listen. target_protocol: type: string enum: - http - https - http2 - tcp - udp example: http description: 'The protocol used for traffic from the load balancer to the backend Droplets. The possible values are: `http`, `https`, `http2`, `tcp`, or `udp`. If you set the `target_protocol` to `udp`, the `entry_protocol` must be set to `udp`. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly. ' target_port: type: integer example: 80 description: An integer representing the port on the backend Droplets to which the load balancer will send traffic. certificate_id: type: string example: 892071a0-bb95-49bc-8021-3afd67a210bf description: The ID of the TLS certificate used for SSL termination if enabled. tls_passthrough: type: boolean example: false description: A boolean value indicating whether SSL encrypted traffic will be passed through to the backend Droplets. required: - entry_protocol - entry_port - target_protocol - target_port link_to_prev_page: type: object properties: prev: description: URI of the previous page of the results. type: string example: https://api.digitalocean.com/v2/images?page=1 link_to_last_page: type: object properties: last: description: URI of the last page of the results. type: string example: https://api.digitalocean.com/v2/images?page=2 page_links: type: object properties: pages: anyOf: - $ref: '#/components/schemas/forward_links' - $ref: '#/components/schemas/backward_links' - {} example: pages: first: https://api.digitalocean.com/v2/account/keys?page=1 prev: https://api.digitalocean.com/v2/account/keys?page=2 load_balancer_create: oneOf: - title: Assign Droplets by ID allOf: - type: object properties: droplet_ids: type: array items: type: integer example: - 3164444 - 3164445 description: An array containing the IDs of the Droplets assigned to the load balancer. - type: object properties: region: $ref: '#/components/schemas/region_slug' - $ref: '#/components/schemas/load_balancer_base' required: - droplet_ids - region - title: Assign Droplets by Tag allOf: - type: object properties: tag: type: string example: prod:web description: The name of a Droplet tag corresponding to Droplets assigned to the load balancer. - type: object properties: region: $ref: '#/components/schemas/region_slug' - $ref: '#/components/schemas/load_balancer_base' required: - tag - region region_slug: type: string description: The slug identifier for the region where the resource will initially be available. enum: - ams1 - ams2 - ams3 - blr1 - fra1 - lon1 - nyc1 - nyc2 - nyc3 - sfo1 - sfo2 - sfo3 - sgp1 - tor1 - syd1 example: nyc3 lb_firewall: type: object description: An object specifying allow and deny rules to control traffic to the load balancer. properties: deny: type: array items: type: string example: - ip:1.2.3.4 - cidr:2.3.0.0/16 default: [] description: the rules for denying traffic to the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16') allow: type: array items: type: string example: - ip:1.2.3.4 - cidr:2.3.0.0/16 default: [] description: the rules for allowing traffic to the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16') load_balancer_base: type: object properties: id: type: string format: uuid readOnly: true example: 4de7ac8b-495b-4884-9a69-1050c6793cd6 description: A unique ID that can be used to identify and reference a load balancer. name: type: string example: example-lb-01 description: A human-readable name for a load balancer instance. project_id: type: string example: 4de7ac8b-495b-4884-9a69-1050c6793cd6 description: The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. If an invalid project ID is provided, the load balancer will not be created. ip: type: string pattern: ^$|^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ readOnly: true example: 104.131.186.241 description: An attribute containing the public-facing IP address of the load balancer. size_unit: type: integer default: 1 minimum: 1 maximum: 100 example: 3 description: How many nodes the load balancer contains. Each additional node increases the load balancer's ability to manage more connections. Load balancers can be scaled up or down, and you can change the number of nodes after creation up to once per hour. This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use the `size` field to scale load balancers that reside in these regions. size: type: string enum: - lb-small - lb-medium - lb-large deprecated: true default: lb-small example: lb-small description: 'This field has been replaced by the `size_unit` field for all regions except in AMS2, NYC2, and SFO1. Each available load balancer size now equates to the load balancer having a set number of nodes. * `lb-small` = 1 node * `lb-medium` = 3 nodes * `lb-large` = 6 nodes You can resize load balancers after creation up to once per hour. You cannot resize a load balancer within the first hour of its creation.' algorithm: type: string example: round_robin enum: - round_robin - least_connections deprecated: true default: round_robin description: This field has been deprecated. You can no longer specify an algorithm for load balancers. status: type: string example: new enum: - new - active - errored readOnly: true description: A status string indicating the current state of the load balancer. This can be `new`, `active`, or `errored`. created_at: type: string format: date-time readOnly: true example: '2017-02-01T22:22:58Z' description: A time value given in ISO8601 combined date and time format that represents when the load balancer was created. forwarding_rules: type: array minItems: 1 items: $ref: '#/components/schemas/forwarding_rule' description: An array of objects specifying the forwarding rules for a load balancer. health_check: $ref: '#/components/schemas/health_check' sticky_sessions: $ref: '#/components/schemas/sticky_sessions' redirect_http_to_https: type: boolean example: true default: false description: A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443. enable_proxy_protocol: type: boolean example: true default: false description: A boolean value indicating whether PROXY Protocol is in use. enable_backend_keepalive: type: boolean example: true default: false description: A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. http_idle_timeout_seconds: type: integer example: 90 default: 60 minimum: 30 maximum: 600 description: An integer value which configures the idle timeout for HTTP requests to the target droplets. vpc_uuid: type: string format: uuid example: c33931f2-a26a-4e61-b85c-4e95a2ec431b description: A string specifying the UUID of the VPC to which the load balancer is assigned. disable_lets_encrypt_dns_records: type: boolean example: true default: false description: A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer. firewall: $ref: '#/components/schemas/lb_firewall' network: type: string example: EXTERNAL enum: - EXTERNAL - INTERNAL default: EXTERNAL description: A string indicating whether the load balancer should be external or internal. Internal load balancers have no public IPs and are only accessible to resources on the same VPC network. This property cannot be updated after creating the load balancer. type: type: string example: REGIONAL enum: - REGIONAL - REGIONAL_NETWORK - GLOBAL default: REGIONAL description: A string indicating whether the load balancer should be a standard regional HTTP load balancer, a regional network load balancer that routes traffic at the TCP/UDP transport layer, or a global load balancer. required: - forwarding_rules load_balancer: allOf: - $ref: '#/components/schemas/load_balancer_base' - type: object properties: region: type: object allOf: - description: The region where the load balancer instance is located. When setting a region, the value should be the slug identifier for the region. When you query a load balancer, an entire region object will be returned. - $ref: '#/components/schemas/region' - type: object properties: droplet_ids: type: array items: type: integer example: - 3164444 - 3164445 description: An array containing the IDs of the Droplets assigned to the load balancer. - type: object properties: tag: type: string example: prod:web description: The name of a Droplet tag corresponding to Droplets assigned to the load balancer. forward_links: allOf: - $ref: '#/components/schemas/link_to_last_page' - $ref: '#/components/schemas/link_to_next_page' region: type: object properties: name: type: string description: The display name of the region. This will be a full name that is used in the control panel and other interfaces. example: New York 3 slug: type: string description: A human-readable string that is used as a unique identifier for each region. example: nyc3 features: items: type: string description: This attribute is set to an array which contains features available in this region example: - private_networking - backups - ipv6 - metadata - install_agent - storage - image_transfer available: type: boolean description: This is a boolean value that represents whether new Droplets can be created in this region. example: true sizes: items: type: string description: This attribute is set to an array which contains the identifying slugs for the sizes available in this region. example: - s-1vcpu-1gb - s-1vcpu-2gb - s-1vcpu-3gb - s-2vcpu-2gb - s-3vcpu-1gb - s-2vcpu-4gb - s-4vcpu-8gb - s-6vcpu-16gb - s-8vcpu-32gb - s-12vcpu-48gb - s-16vcpu-64gb - s-20vcpu-96gb - s-24vcpu-128gb - s-32vcpu-192g required: - available - features - name - sizes - slug pagination: type: object properties: links: $ref: '#/components/schemas/page_links' link_to_first_page: type: object properties: first: description: URI of the first page of the results. type: string example: https://api.digitalocean.com/v2/images?page=1 error: type: object properties: id: description: A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found." type: string example: not_found message: description: A message providing additional information about the error, including details to help resolve it when possible. type: string example: The resource you were accessing could not be found. request_id: description: Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue. type: string example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9 required: - id - message backward_links: allOf: - $ref: '#/components/schemas/link_to_first_page' - $ref: '#/components/schemas/link_to_prev_page' sticky_sessions: type: object description: An object specifying sticky sessions settings for the load balancer. properties: type: type: string enum: - cookies - none example: cookies default: none description: An attribute indicating how and if requests from a client will be persistently served by the same backend Droplet. The possible values are `cookies` or `none`. cookie_name: type: string example: DO-LB description: The name of the cookie sent to the client. This attribute is only returned when using `cookies` for the sticky sessions type. cookie_ttl_seconds: type: integer example: 300 description: The number of seconds until the cookie set by the load balancer expires. This attribute is only returned when using `cookies` for the sticky sessions type. meta_properties: type: object description: Information about the response itself. properties: total: description: Number of objects returned by the request. type: integer example: 1 meta: type: object properties: meta: allOf: - $ref: '#/components/schemas/meta_properties' - required: - total required: - meta link_to_next_page: type: object properties: next: description: URI of the next page of the results. type: string example: https://api.digitalocean.com/v2/images?page=2 examples: load_balancer_ssl_termination_create_request: description: Terminating SSL at the load balancer using a managed SSL certificate specifying Droplets using `droplet_ids`. value: name: example-lb-01 region: nyc3 forwarding_rules: - entry_protocol: https entry_port: 443 target_protocol: http target_port: 8080 certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf droplet_ids: - 3164444 - 3164445 load_balancers_all: value: load_balancers: - id: 4de7ac8b-495b-4884-9a69-1050c6793cd6 name: example-lb-01 ip: 104.131.186.241 size: lb-small algorithm: round_robin status: new created_at: '2017-02-01T22:22:58Z' forwarding_rules: - entry_protocol: http entry_port: 80 target_protocol: http target_port: 80 certificate_id: '' tls_passthrough: false - entry_protocol: https entry_port: 443 target_protocol: https target_port: 443 certificate_id: '' tls_passthrough: true health_check: protocol: http port: 80 path: / check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: none region: name: New York 3 slug: nyc3 sizes: - s-1vcpu-1gb - s-1vcpu-2gb - s-1vcpu-3gb - s-2vcpu-2gb - s-3vcpu-1gb - s-2vcpu-4gb - s-4vcpu-8gb - s-6vcpu-16gb - s-8vcpu-32gb - s-12vcpu-48gb - s-16vcpu-64gb - s-20vcpu-96gb - s-24vcpu-128gb - s-32vcpu-192gb features: - private_networking - backups - ipv6 - metadata - install_agent available: true tag: '' droplet_ids: - 3164444 - 3164445 redirect_http_to_https: false enable_proxy_protocol: false enable_backend_keepalive: false vpc_uuid: c33931f2-a26a-4e61-b85c-4e95a2ec431b disable_lets_encrypt_dns_records: false firewall: deny: - cidr:1.2.0.0/16 - ip:2.3.4.5 allow: - ip:1.2.3.4 - cidr:2.3.4.0/24 - id: 56775c3f-04ab-4fb3-a7ed-40ef9bc8eece name: prod-web-lb-01 ip: 45.55.125.24 size: lb-small algorithm: round_robin status: active created_at: '2020-09-08T18:58:04Z' forwarding_rules: - entry_protocol: https entry_port: 443 target_protocol: http target_port: 8080 certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf tls_passthrough: false health_check: protocol: https port: 443 path: / check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: cookies cookie_name: DO-LB cookie_ttl_seconds: 300 region: name: New York 3 slug: nyc3 sizes: - s-1vcpu-1gb - s-1vcpu-2gb - s-1vcpu-3gb - s-2vcpu-2gb - s-3vcpu-1gb - s-2vcpu-4gb - s-4vcpu-8gb - s-6vcpu-16gb - s-8vcpu-32gb - s-12vcpu-48gb - s-16vcpu-64gb - s-20vcpu-96gb - s-24vcpu-128gb - s-32vcpu-192gb features: - private_networking - backups - ipv6 - metadata - install_agent available: true tag: prod:web droplet_ids: - 55806512 - 55806515 - 55806524 redirect_http_to_https: true enable_proxy_protocol: false enable_backend_keepalive: false vpc_uuid: 587d698c-de84-11e8-80bc-3cfdfea9fcd1 disable_lets_encrypt_dns_records: false project_id: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30 http_idle_timeout_seconds: 60 firewall: deny: - cidr:1.2.0.0/16 - ip:2.3.4.5 allow: - ip:1.2.3.4 - cidr:2.3.4.0/24 links: {} meta: total: 2 load_balancer_basic_response: value: load_balancer: id: 4de7ac8b-495b-4884-9a69-1050c6793cd6 name: example-lb-01 ip: 104.131.186.241 size: lb-small algorithm: round_robin status: new created_at: '2017-02-01T22:22:58Z' forwarding_rules: - entry_protocol: http entry_port: 80 target_protocol: http target_port: 80 certificate_id: '' tls_passthrough: false - entry_protocol: https entry_port: 443 target_protocol: https target_port: 443 certificate_id: '' tls_passthrough: true health_check: protocol: http port: 80 path: / check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: none region: name: New York 3 slug: nyc3 sizes: - s-1vcpu-1gb - s-1vcpu-2gb - s-1vcpu-3gb - s-2vcpu-2gb - s-3vcpu-1gb - s-2vcpu-4gb - s-4vcpu-8gb - s-6vcpu-16gb - s-8vcpu-32gb - s-12vcpu-48gb - s-16vcpu-64gb - s-20vcpu-96gb - s-24vcpu-128gb - s-32vcpu-192gb features: - private_networking - backups - ipv6 - metadata - install_agent available: true tag: '' droplet_ids: - 3164444 - 3164445 redirect_http_to_https: false enable_proxy_protocol: false enable_backend_keepalive: false vpc_uuid: c33931f2-a26a-4e61-b85c-4e95a2ec431b disable_lets_encrypt_dns_records: false project_id: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30 http_idle_timeout_seconds: 60 firewall: deny: - cidr:1.2.0.0/16 - ip:2.3.4.5 allow: - ip:1.2.3.4 - cidr:2.3.4.0/24 load_balancer_sticky_sessions_and_health_check_create_request: description: Terminating SSL at the load balancer using a managed SSL certificate specifying Droplets using `tag`. value: name: example-lb-01 region: nyc3 forwarding_rules: - entry_protocol: https entry_port: 443 target_protocol: http target_port: 8080 certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf health_check: protocol: http port: 8080 path: /health check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: cookies cookie_name: LB_COOKIE cookie_ttl_seconds: 300 tag: prod:web load_balancer_basic_create_request: description: Passing requests directly through to 80 and 443. value: name: example-lb-01 region: nyc3 forwarding_rules: - entry_protocol: http entry_port: 80 target_protocol: http target_port: 80 - entry_protocol: https entry_port: 443 target_protocol: https target_port: 443 tls_passthrough: true droplet_ids: - 3164444 - 3164445 project_id: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30 http_idle_timeout_seconds: 60 firewall: deny: - cidr:1.2.0.0/16 - ip:2.3.4.5 allow: - ip:1.2.3.4 - cidr:2.3.4.0/24 load_balancer_update_response: value: load_balancer: id: 4de7ac8b-495b-4884-9a69-1050c6793cd6 name: updated-example-lb-01 ip: 104.131.186.241 size: lb-small algorithm: round_robin status: new created_at: '2017-02-01T22:22:58Z' forwarding_rules: - entry_protocol: http entry_port: 80 target_protocol: http target_port: 80 certificate_id: '' tls_passthrough: false - entry_protocol: https entry_port: 443 target_protocol: https target_port: 443 certificate_id: '' tls_passthrough: true health_check: protocol: http port: 80 path: / check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: none region: name: New York 3 slug: nyc3 sizes: - s-1vcpu-1gb - s-1vcpu-2gb - s-1vcpu-3gb - s-2vcpu-2gb - s-3vcpu-1gb - s-2vcpu-4gb - s-4vcpu-8gb - s-6vcpu-16gb - s-8vcpu-32gb - s-12vcpu-48gb - s-16vcpu-64gb - s-20vcpu-96gb - s-24vcpu-128gb - s-32vcpu-192gb features: - private_networking - backups - ipv6 - metadata - install_agent available: true tag: '' droplet_ids: - 3164444 - 3164445 redirect_http_to_https: false enable_proxy_protocol: true enable_backend_keepalive: true vpc_uuid: c33931f2-a26a-4e61-b85c-4e95a2ec431b disable_lets_encrypt_dns_records: false project_id: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30 http_idle_timeout_seconds: 60 firewall: deny: - cidr:1.2.0.0/16 - ip:2.3.4.5 allow: - ip:1.2.3.4 - cidr:2.3.4.0/24 load_balancer_using_tag_create_request: description: Terminating SSL at the load balancer using a managed SSL certificate specifying Droplets using `tag`. value: name: example-lb-01 region: nyc3 forwarding_rules: - entry_protocol: https entry_port: 443 target_protocol: http target_port: 8080 certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf tag: prod:web load_balancer_update_request: value: name: updated-example-lb-01 region: nyc3 droplet_ids: - 3164444 - 3164445 algorithm: round_robin forwarding_rules: - entry_protocol: http entry_port: 80 target_protocol: http target_port: 80 certificate_id: '' tls_passthrough: false - entry_protocol: https entry_port: 443 target_protocol: https target_port: 443 certificate_id: '' tls_passthrough: true health_check: protocol: http port: 80 path: / check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: none redirect_http_to_https: false enable_proxy_protocol: true enable_backend_keepalive: true vpc_uuid: c33931f2-a26a-4e61-b85c-4e95a2ec431b project_id: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30 http_idle_timeout_seconds: 60 firewall: deny: - cidr:1.2.0.0/16 - ip:2.3.4.5 allow: - ip:1.2.3.4 - cidr:2.3.4.0/24 load_balancer_ssl_termination_response: value: load_balancer: id: 4de7ac8b-495b-4884-9a69-1050c6793cd6 name: example-lb-01 ip: 104.131.186.241 size: lb-small algorithm: round_robin status: new created_at: '2017-02-01T22:22:58Z' forwarding_rules: - entry_protocol: https entry_port: 443 target_protocol: http target_port: 8080 certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf health_check: protocol: http port: 80 path: / check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: none region: name: New York 3 slug: nyc3 sizes: - s-1vcpu-1gb - s-1vcpu-2gb - s-1vcpu-3gb - s-2vcpu-2gb - s-3vcpu-1gb - s-2vcpu-4gb - s-4vcpu-8gb - s-6vcpu-16gb - s-8vcpu-32gb - s-12vcpu-48gb - s-16vcpu-64gb - s-20vcpu-96gb - s-24vcpu-128gb - s-32vcpu-192gb features: - private_networking - backups - ipv6 - metadata - install_agent available: true tag: '' droplet_ids: - 3164444 - 3164445 redirect_http_to_https: false enable_proxy_protocol: false enable_backend_keepalive: false vpc_uuid: c33931f2-a26a-4e61-b85c-4e95a2ec431b disable_lets_encrypt_dns_records: false load_balancer_using_tag_response: value: load_balancer: id: 4de7ac8b-495b-4884-9a69-1050c6793cd6 name: example-lb-01 ip: 104.131.186.241 size: lb-small algorithm: round_robin status: new created_at: '2017-02-01T22:22:58Z' forwarding_rules: - entry_protocol: https entry_port: 443 target_protocol: http target_port: 8080 certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf health_check: protocol: http port: 80 path: / check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: none region: name: New York 3 slug: nyc3 sizes: - s-1vcpu-1gb - s-1vcpu-2gb - s-1vcpu-3gb - s-2vcpu-2gb - s-3vcpu-1gb - s-2vcpu-4gb - s-4vcpu-8gb - s-6vcpu-16gb - s-8vcpu-32gb - s-12vcpu-48gb - s-16vcpu-64gb - s-20vcpu-96gb - s-24vcpu-128gb - s-32vcpu-192gb features: - private_networking - backups - ipv6 - metadata - install_agent available: true tag: prod:web droplet_ids: - 3164444 - 3164445 redirect_http_to_https: false enable_proxy_protocol: false enable_backend_keepalive: false vpc_uuid: c33931f2-a26a-4e61-b85c-4e95a2ec431b disable_lets_encrypt_dns_records: false project_id: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30 load_balancer_sticky_sessions_and_health_check_response: value: load_balancer: id: 4de7ac8b-495b-4884-9a69-1050c6793cd6 name: example-lb-01 ip: 104.131.186.241 size: lb-small algorithm: round_robin status: new created_at: '2017-02-01T22:22:58Z' forwarding_rules: - entry_protocol: https entry_port: 443 target_protocol: http target_port: 8080 certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf health_check: protocol: http port: 8080 path: /health check_interval_seconds: 10 response_timeout_seconds: 5 healthy_threshold: 5 unhealthy_threshold: 3 sticky_sessions: type: cookies cookie_name: LB_COOKIE cookie_ttl_seconds: 300 region: name: New York 3 slug: nyc3 sizes: - s-1vcpu-1gb - s-1vcpu-2gb - s-1vcpu-3gb - s-2vcpu-2gb - s-3vcpu-1gb - s-2vcpu-4gb - s-4vcpu-8gb - s-6vcpu-16gb - s-8vcpu-32gb - s-12vcpu-48gb - s-16vcpu-64gb - s-20vcpu-96gb - s-24vcpu-128gb - s-32vcpu-192gb features: - private_networking - backups - ipv6 - metadata - install_agent available: true tag: prod:web droplet_ids: - 3164444 - 3164445 redirect_http_to_https: false enable_proxy_protocol: false enable_backend_keepalive: false vpc_uuid: c33931f2-a26a-4e61-b85c-4e95a2ec431b disable_lets_encrypt_dns_records: false project_id: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30 responses: no_content: description: The action was successful and the response body is empty. headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' load_balancer_create: description: Accepted headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: properties: load_balancer: $ref: '#/components/schemas/load_balancer' examples: Basic Create Response: $ref: '#/components/examples/load_balancer_basic_response' SSL Termination Create Response: $ref: '#/components/examples/load_balancer_ssl_termination_response' Create Response Using Droplet Tag: $ref: '#/components/examples/load_balancer_using_tag_response' Sticky Sessions and Custom Health Check: $ref: '#/components/examples/load_balancer_sticky_sessions_and_health_check_response' server_error: description: Server error. headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: $ref: '#/components/schemas/error' example: id: server_error message: Unexpected server-side error unauthorized: description: Unauthorized headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: $ref: '#/components/schemas/error' example: id: unauthorized message: Unable to authenticate you. all_load_balancers: description: A JSON object with a key of `load_balancers`. This will be set to an array of objects, each of which will contain the standard load balancer attributes. headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: allOf: - type: object properties: load_balancers: type: array items: $ref: '#/components/schemas/load_balancer' - $ref: '#/components/schemas/pagination' - $ref: '#/components/schemas/meta' examples: All Load Balancers: $ref: '#/components/examples/load_balancers_all' updated_load_balancer: description: 'The response will be a JSON object with a key called `load_balancer`. The value of this will be an object containing the standard attributes of a load balancer. ' headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: properties: load_balancer: $ref: '#/components/schemas/load_balancer' examples: load_balancer_update_response: $ref: '#/components/examples/load_balancer_update_response' not_found: description: The resource was not found. headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: $ref: '#/components/schemas/error' example: id: not_found message: The resource you requested could not be found. too_many_requests: description: API Rate limit exceeded headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: $ref: '#/components/schemas/error' example: id: too_many_requests message: API Rate limit exceeded. existing_load_balancer: description: 'The response will be a JSON object with a key called `load_balancer`. The value of this will be an object that contains the standard attributes associated with a load balancer ' headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: properties: load_balancer: $ref: '#/components/schemas/load_balancer' examples: load_balancer_basic_response: $ref: '#/components/examples/load_balancer_basic_response' unexpected_error: description: Unexpected error headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: $ref: '#/components/schemas/error' example: id: example_error message: some error message headers: ratelimit-limit: schema: type: integer example: 5000 description: The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute. ratelimit-reset: schema: type: integer example: 1444931833 description: The time when the oldest request will expire. The value is given in Unix epoch time. See https://developers.digitalocean.com/documentation/v2/#rate-limit for information about how requests expire. ratelimit-remaining: schema: type: integer example: 4816 description: The number of requests in your hourly quota that remain before you hit your request limit. See https://developers.digitalocean.com/documentation/v2/#rate-limit for information about how requests expire. parameters: per_page: in: query name: per_page required: false description: Number of items returned per page schema: type: integer minimum: 1 default: 20 maximum: 200 example: 2 load_balancer_id: in: path name: lb_id description: A unique identifier for a load balancer. required: true schema: type: string minimum: 1 example: 4de7ac8b-495b-4884-9a69-1050c6793cd6 page: in: query name: page required: false description: Which 'page' of paginated results to return. schema: type: integer minimum: 1 default: 1 example: 1 securitySchemes: bearer_auth: type: http scheme: bearer description: '## OAuth Authentication In order to interact with the DigitalOcean API, you or your application must authenticate. The DigitalOcean API handles this through OAuth, an open standard for authorization. OAuth allows you to delegate access to your account. Scopes can be used to grant full access, read-only access, or access to a specific set of endpoints. You can generate an OAuth token by visiting the [Apps & API](https://cloud.digitalocean.com/account/api/tokens) section of the DigitalOcean control panel for your account. An OAuth token functions as a complete authentication request. In effect, it acts as a substitute for a username and password pair. Because of this, it is absolutely **essential** that you keep your OAuth tokens secure. In fact, upon generation, the web interface will only display each token a single time in order to prevent the token from being compromised. DigitalOcean access tokens begin with an identifiable prefix in order to distinguish them from other similar tokens. - `dop_v1_` for personal access tokens generated in the control panel - `doo_v1_` for tokens generated by applications using [the OAuth flow](https://docs.digitalocean.com/reference/api/oauth-api/) - `dor_v1_` for OAuth refresh tokens ### Scopes Scopes act like permissions assigned to an API token. These permissions determine what actions the token can perform. You can create API tokens that grant read-only access, full access, or limited access to specific endpoints by using custom scopes. Generally, scopes are designed to match HTTP verbs and common CRUD operations (Create, Read, Update, Delete). | HTTP Verb | CRUD Operation | Scope | |---|---|---| | GET | Read | `:read` | | POST | Create | `:create` | | PUT/PATCH | Update | `:update` | | DELETE | Delete | `:delete` | For example, creating a new Droplet by making a `POST` request to the `/v2/droplets` endpoint requires the `droplet:create` scope while listing Droplets by making a `GET` request to the `/v2/droplets` endpoint requires the `droplet:read` scope. Each endpoint below specifies which scope is required to access it when using custom scopes. ### How to Authenticate with OAuth In order to make an authenticated request, include a bearer-type `Authorization` header containing your OAuth token. All requests must be made over HTTPS. ### Authenticate with a Bearer Authorization Header ``` curl -X $HTTP_METHOD -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" "https://api.digitalocean.com/v2/$OBJECT" ``` '