diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index d29ec984c..74cbe7d78 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -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' diff --git a/specification/resources/load_balancers/examples/curl/loadBalancers_delete_cache.yml b/specification/resources/load_balancers/examples/curl/loadBalancers_delete_cache.yml new file mode 100644 index 000000000..672891ddc --- /dev/null +++ b/specification/resources/load_balancers/examples/curl/loadBalancers_delete_cache.yml @@ -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" diff --git a/specification/resources/load_balancers/examples/go/loadBalancers_delete_cache.yml b/specification/resources/load_balancers/examples/go/loadBalancers_delete_cache.yml new file mode 100644 index 000000000..8302b5112 --- /dev/null +++ b/specification/resources/load_balancers/examples/go/loadBalancers_delete_cache.yml @@ -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") + } diff --git a/specification/resources/load_balancers/loadBalancers_delete_cache.yml b/specification/resources/load_balancers/loadBalancers_delete_cache.yml new file mode 100644 index 000000000..2d4181ed8 --- /dev/null +++ b/specification/resources/load_balancers/loadBalancers_delete_cache.yml @@ -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' diff --git a/specification/resources/load_balancers/models/domains.yml b/specification/resources/load_balancers/models/domains.yml new file mode 100644 index 000000000..4be9d4c72 --- /dev/null +++ b/specification/resources/load_balancers/models/domains.yml @@ -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. diff --git a/specification/resources/load_balancers/models/glb_settings.yml b/specification/resources/load_balancers/models/glb_settings.yml new file mode 100644 index 000000000..f315fc41c --- /dev/null +++ b/specification/resources/load_balancers/models/glb_settings.yml @@ -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. diff --git a/specification/resources/load_balancers/models/load_balancer_base.yml b/specification/resources/load_balancers/models/load_balancer_base.yml index e5a6fb1b5..49bab79d9 100644 --- a/specification/resources/load_balancers/models/load_balancer_base.yml +++ b/specification/resources/load_balancers/models/load_balancer_base.yml @@ -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