Skip to content

Commit

Permalink
Add missing GLB create params (#962)
Browse files Browse the repository at this point in the history
* Add missing GLB create params

Also add new endpoint supported for purging CDN cache.

* Update domains description
  • Loading branch information
asaha2 authored Jan 9, 2025
1 parent 19beba4 commit c31efb9
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 0 deletions.
4 changes: 4 additions & 0 deletions specification/DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,10 @@ paths:
delete:
$ref: 'resources/load_balancers/loadBalancers_delete.yml'

/v2/load_balancers/{lb_id}/cache:
delete:
$ref: 'resources/load_balancers/loadBalancers_delete_cache.yml'

/v2/load_balancers/{lb_id}/droplets:
post:
$ref: 'resources/load_balancers/loadBalancers_add_droplets.yml'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lang: cURL
source: |-
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6/cache"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lang: Go
source: |-
import (
"context"
"os"
"github.com/digitalocean/godo"
)
func main() {
token := os.Getenv("DIGITALOCEAN_TOKEN")
client := godo.NewFromToken(token)
ctx := context.TODO()
_, err := client.LoadBalancers.PurgeCache(ctx, "4de7ac8b-495b-4884-9a69-1050c6793cd6")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
operationId: loadBalancers_delete_cache

summary: Delete a Global Load Balancer CDN Cache

description: |
To delete a Global load balancer CDN cache, send a DELETE request to
`/v2/load_balancers/$LOAD_BALANCER_ID/cache`.
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: 'parameters.yml#/load_balancer_id'

responses:
'204':
$ref: '../../shared/responses/no_content.yml'

'401':
$ref: '../../shared/responses/unauthorized.yml'

'404':
$ref: '../../shared/responses/not_found.yml'

'429':
$ref: '../../shared/responses/too_many_requests.yml'

'500':
$ref: '../../shared/responses/server_error.yml'

default:
$ref: '../../shared/responses/unexpected_error.yml'

x-codeSamples:
- $ref: 'examples/curl/loadBalancers_delete_cache.yml'
- $ref: 'examples/go/loadBalancers_delete_cache.yml'

security:
- bearer_auth:
- 'load_balancer:delete'
21 changes: 21 additions & 0 deletions specification/resources/load_balancers/models/domains.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
type: object

description: An object specifying domain configurations for a Global load balancer.

properties:
name:
type: string
example: example.com
description: FQDN to associate with a Global load balancer.

is_managed:
type: boolean
example: true
description: A boolean value indicating if the domain is already managed
by DigitalOcean. If true, all A and AAAA records required to enable Global
load balancers will be automatically added.

certificate_id:
type: string
example: 892071a0-bb95-49bc-8021-3afd67a210bf
description: The ID of the TLS certificate used for SSL termination.
49 changes: 49 additions & 0 deletions specification/resources/load_balancers/models/glb_settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
type: object

description: An object specifying forwarding configurations for a Global load balancer.

properties:
target_protocol:
type: string
enum:
- http
- https
- http2
example: http
description: The protocol used for forwarding traffic from the load balancer to the
target backends. The possible values are `http`, `https` and `http2`.

target_port:
type: integer
example: 80
description: An integer representing the port on the target backends which the
load balancer will forward traffic to.

cdn:
type: object
properties:
is_enabled:
type: boolean
example: true
description: A boolean flag to enable CDN caching.
description: An object specifying CDN configurations for a Global load balancer.

region_priorities:
type: object
additionalProperties:
type: integer
example:
"nyc1": 1
"fra1": 2
"sgp1": 3
description: A map of region string to an integer priority value indicating preference
for which regional target a Global load balancer will forward traffic to. A lower
value indicates a higher priority.

failover_threshold:
type: integer
example: 50
description: An integer value as a percentage to indicate failure threshold to decide how
the regional priorities will take effect. A value of `50` would indicate that the Global
load balancer will choose a lower priority region to forward traffic to once this failure
threshold has been reached for the higher priority region.
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,25 @@ properties:
regional HTTP load balancer, a regional network load balancer that routes traffic
at the TCP/UDP transport layer, or a global load balancer.

domains:
type: array
items:
$ref: 'domains.yml'
description: An array of objects specifying the domain configurations for a
Global load balancer.

glb_settings:
$ref: 'glb_settings.yml'

target_load_balancer_ids:
type: array
items:
type: string
example:
- 7dbf91fe-cbdb-48dc-8290-c3a181554905
- 996fa239-fac3-42a2-b9a1-9fa822268b7a
description: An array containing the UUIDs of the Regional load balancers to be used as target
backends for a Global load balancer.

required:
- forwarding_rules

0 comments on commit c31efb9

Please sign in to comment.