cdn_endpoints
Creates, updates, deletes, gets or lists a cdn_endpoints
resource.
Overview
Name | cdn_endpoints |
Type | Resource |
Id | digitalocean.compute.cdn_endpoints |
Fields
The following fields are returned by SELECT
queries:
- cdn_get_endpoint
- cdn_list_endpoints
The response will be a JSON object with an endpoint
key. This will be set to an object containing the standard CDN endpoint attributes.
Name | Datatype | Description |
---|---|---|
id | string (uuid) | A unique ID that can be used to identify and reference a CDN endpoint. (example: 892071a0-bb95-49bc-8021-3afd67a210bf) |
certificate_id | string (uuid) | The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided. (example: 892071a0-bb95-49bc-8021-3afd67a210bf) |
created_at | string (date-time) | A time value given in ISO8601 combined date and time format that represents when the CDN endpoint was created. (example: 2018-03-21T16:02:37Z) |
custom_domain | string (hostname) | The fully qualified domain name (FQDN) of the custom subdomain used with the CDN endpoint. (example: static.example.com) |
endpoint | string (hostname) | The fully qualified domain name (FQDN) from which the CDN-backed content is served. (example: static-images.nyc3.cdn.digitaloceanspaces.com) |
origin | string (hostname) | The fully qualified domain name (FQDN) for the origin server which provides the content for the CDN. This is currently restricted to a Space. (example: static-images.nyc3.digitaloceanspaces.com) |
ttl | integer | The amount of time the content is cached by the CDN's edge servers in seconds. TTL must be one of 60, 600, 3600, 86400, or 604800. Defaults to 3600 (one hour) when excluded. |
The result will be a JSON object with an endpoints
key. This will be set to an array of endpoint objects, each of which will contain the standard CDN endpoint attributes.
Name | Datatype | Description |
---|---|---|
id | string (uuid) | A unique ID that can be used to identify and reference a CDN endpoint. (example: 892071a0-bb95-49bc-8021-3afd67a210bf) |
certificate_id | string (uuid) | The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided. (example: 892071a0-bb95-49bc-8021-3afd67a210bf) |
created_at | string (date-time) | A time value given in ISO8601 combined date and time format that represents when the CDN endpoint was created. (example: 2018-03-21T16:02:37Z) |
custom_domain | string (hostname) | The fully qualified domain name (FQDN) of the custom subdomain used with the CDN endpoint. (example: static.example.com) |
endpoint | string (hostname) | The fully qualified domain name (FQDN) from which the CDN-backed content is served. (example: static-images.nyc3.cdn.digitaloceanspaces.com) |
origin | string (hostname) | The fully qualified domain name (FQDN) for the origin server which provides the content for the CDN. This is currently restricted to a Space. (example: static-images.nyc3.digitaloceanspaces.com) |
ttl | integer | The amount of time the content is cached by the CDN's edge servers in seconds. TTL must be one of 60, 600, 3600, 86400, or 604800. Defaults to 3600 (one hour) when excluded. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
cdn_get_endpoint | select | cdn_id | To show information about an existing CDN endpoint, send a GET request to /v2/cdn/endpoints/$ENDPOINT_ID . | |
cdn_list_endpoints | select | per_page , page | To list all of the CDN endpoints available on your account, send a GET request to /v2/cdn/endpoints . | |
cdn_create_endpoint | insert | data__origin | To create a new CDN endpoint, send a POST request to /v2/cdn/endpoints . Theorigin attribute must be set to the fully qualified domain name (FQDN) of a DigitalOcean Space. Optionally, the TTL may be configured by setting the ttl attribute. A custom subdomain may be configured by specifying the custom_domain andcertificate_id attributes. | |
cdn_update_endpoints | replace | cdn_id | To update the TTL, certificate ID, or the FQDN of the custom subdomain for an existing CDN endpoint, send a PUT request to /v2/cdn/endpoints/$ENDPOINT_ID . | |
cdn_delete_endpoint | delete | cdn_id | To delete a specific CDN endpoint, send a DELETE request to/v2/cdn/endpoints/$ENDPOINT_ID .A status of 204 will be given. This indicates that the request was processed successfully, but that no response body is needed. | |
cdn_purge_cache | exec | cdn_id , files | To purge cached content from a CDN endpoint, send a DELETE request to/v2/cdn/endpoints/$ENDPOINT_ID/cache . The body of the request should includea files attribute containing a list of cached file paths to be purged. Apath may be for a single file or may contain a wildcard ( * ) to recursivelypurge all files under a directory. When only a wildcard is provided, all cached files will be purged. There is a rate limit of 50 files per 20 seconds that can be purged. CDN endpoints have a rate limit of 5 requests per 10 seconds. Purging files using a wildcard path counts as a single request against the API's rate limit. Two identical purge requests cannot be sent at the same time. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
cdn_id | string (uuid) | A unique identifier for a CDN endpoint. (example: 19f06b6a-3ace-4315-b086-499a0e521b76) |
page | integer | Which 'page' of paginated results to return. (example: 1) |
per_page | integer | Number of items returned per page (example: 2) |
SELECT
examples
- cdn_get_endpoint
- cdn_list_endpoints
To show information about an existing CDN endpoint, send a GET request to /v2/cdn/endpoints/$ENDPOINT_ID
.
SELECT
id,
certificate_id,
created_at,
custom_domain,
endpoint,
origin,
ttl
FROM digitalocean.compute.cdn_endpoints
WHERE cdn_id = '{{ cdn_id }}' -- required;
To list all of the CDN endpoints available on your account, send a GET request to /v2/cdn/endpoints
.
SELECT
id,
certificate_id,
created_at,
custom_domain,
endpoint,
origin,
ttl
FROM digitalocean.compute.cdn_endpoints
WHERE per_page = '{{ per_page }}'
AND page = '{{ page }}';
INSERT
examples
- cdn_create_endpoint
- Manifest
To create a new CDN endpoint, send a POST request to /v2/cdn/endpoints
. The
origin attribute must be set to the fully qualified domain name (FQDN) of a
DigitalOcean Space. Optionally, the TTL may be configured by setting the ttl
attribute.
A custom subdomain may be configured by specifying the custom_domain
andcertificate_id
attributes.
INSERT INTO digitalocean.compute.cdn_endpoints (
data__origin,
data__ttl,
data__certificate_id,
data__custom_domain
)
SELECT
'{{ origin }}' --required,
{{ ttl }},
'{{ certificate_id }}',
'{{ custom_domain }}'
RETURNING
endpoint
;
# Description fields are for documentation purposes
- name: cdn_endpoints
props:
- name: origin
value: string
description: >
The fully qualified domain name (FQDN) for the origin server which provides the content for the CDN. This is currently restricted to a Space.
- name: ttl
value: integer
description: >
The amount of time the content is cached by the CDN's edge servers in seconds. TTL must be one of 60, 600, 3600, 86400, or 604800. Defaults to 3600 (one hour) when excluded.
valid_values: ['60', '600', '3600', '86400', '604800']
default: 3600
- name: certificate_id
value: string
description: >
The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
- name: custom_domain
value: string
description: >
The fully qualified domain name (FQDN) of the custom subdomain used with the CDN endpoint.
REPLACE
examples
- cdn_update_endpoints
To update the TTL, certificate ID, or the FQDN of the custom subdomain for
an existing CDN endpoint, send a PUT request to/v2/cdn/endpoints/$ENDPOINT_ID
.
REPLACE digitalocean.compute.cdn_endpoints
SET
data__ttl = {{ ttl }},
data__certificate_id = '{{ certificate_id }}',
data__custom_domain = '{{ custom_domain }}'
WHERE
cdn_id = '{{ cdn_id }}' --required
RETURNING
endpoint;
DELETE
examples
- cdn_delete_endpoint
To delete a specific CDN endpoint, send a DELETE request to/v2/cdn/endpoints/$ENDPOINT_ID
.
A status of 204 will be given. This indicates that the request was processed
successfully, but that no response body is needed.
DELETE FROM digitalocean.compute.cdn_endpoints
WHERE cdn_id = '{{ cdn_id }}' --required;
Lifecycle Methods
- cdn_purge_cache
To purge cached content from a CDN endpoint, send a DELETE request to/v2/cdn/endpoints/$ENDPOINT_ID/cache
. The body of the request should include
a files
attribute containing a list of cached file paths to be purged. A
path may be for a single file or may contain a wildcard (*
) to recursively
purge all files under a directory. When only a wildcard is provided, all cached
files will be purged. There is a rate limit of 50 files per 20 seconds that can
be purged. CDN endpoints have a rate limit of 5 requests per 10 seconds.
Purging files using a wildcard path counts as a single request against the API's
rate limit. Two identical purge requests cannot be sent at the same time.
EXEC digitalocean.compute.cdn_endpoints.cdn_purge_cache
@cdn_id='{{ cdn_id }}' --required
@@json=
'{
"files": "{{ files }}"
}';