domains
Creates, updates, deletes, gets or lists a domains
resource.
Overview
Name | domains |
Type | Resource |
Id | digitalocean.compute.domains |
Fields
The following fields are returned by SELECT
queries:
- domains_get
- domains_list
The response will be a JSON object with a key called domain
. The value of this will be an object that contains the standard attributes defined for a domain.
Name | Datatype | Description |
---|---|---|
name | string | The name of the domain itself. This should follow the standard domain format of domain.TLD. For instance, example.com is a valid domain name. (example: example.com) |
ip_address | string | This optional attribute may contain an IP address. When provided, an A record will be automatically created pointing to the apex domain. (example: 192.0.2.1) |
ttl | integer | This value is the time to live for the records on this domain, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested. |
zone_file | string | This attribute contains the complete contents of the zone file for the selected domain. Individual domain record resources should be used to get more granular control over records. However, this attribute can also be used to get information about the SOA record, which is created automatically and is not accessible as an individual record resource. (example: $ORIGIN example.com. $TTL 1800 example.com. IN SOA ns1.digitalocean.com. hostmaster.example.com. 1415982609 10800 3600 604800 1800 example.com. 1800 IN NS ns1.digitalocean.com. example.com. 1800 IN NS ns2.digitalocean.com. example.com. 1800 IN NS ns3.digitalocean.com. example.com. 1800 IN A 1.2.3.4 ) |
The response will be a JSON object with a key called domains
. The value of this will be an array of Domain objects, each of which contain the standard domain attributes.
Name | Datatype | Description |
---|---|---|
name | string | The name of the domain itself. This should follow the standard domain format of domain.TLD. For instance, example.com is a valid domain name. (example: example.com) |
ip_address | string | This optional attribute may contain an IP address. When provided, an A record will be automatically created pointing to the apex domain. (example: 192.0.2.1) |
ttl | integer | This value is the time to live for the records on this domain, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested. |
zone_file | string | This attribute contains the complete contents of the zone file for the selected domain. Individual domain record resources should be used to get more granular control over records. However, this attribute can also be used to get information about the SOA record, which is created automatically and is not accessible as an individual record resource. (example: $ORIGIN example.com. $TTL 1800 example.com. IN SOA ns1.digitalocean.com. hostmaster.example.com. 1415982609 10800 3600 604800 1800 example.com. 1800 IN NS ns1.digitalocean.com. example.com. 1800 IN NS ns2.digitalocean.com. example.com. 1800 IN NS ns3.digitalocean.com. example.com. 1800 IN A 1.2.3.4 ) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
domains_get | select | domain_name | To get details about a specific domain, send a GET request to /v2/domains/$DOMAIN_NAME . | |
domains_list | select | per_page , page | To retrieve a list of all of the domains in your account, send a GET request to /v2/domains . | |
domains_create | insert | To create a new domain, send a POST request to /v2/domains . Set the "name"attribute to the domain name you are adding. Optionally, you may set the "ip_address" attribute, and an A record will be automatically created pointing to the apex domain. | ||
domains_delete | delete | domain_name | To delete a domain, send a DELETE request to /v2/domains/$DOMAIN_NAME . |
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 |
---|---|---|
domain_name | string | The name of the domain itself. (example: example.com) |
page | integer | Which 'page' of paginated results to return. (example: 1) |
per_page | integer | Number of items returned per page (example: 2) |
SELECT
examples
- domains_get
- domains_list
To get details about a specific domain, send a GET request to /v2/domains/$DOMAIN_NAME
.
SELECT
name,
ip_address,
ttl,
zone_file
FROM digitalocean.compute.domains
WHERE domain_name = '{{ domain_name }}' -- required;
To retrieve a list of all of the domains in your account, send a GET request to /v2/domains
.
SELECT
name,
ip_address,
ttl,
zone_file
FROM digitalocean.compute.domains
WHERE per_page = '{{ per_page }}'
AND page = '{{ page }}';
INSERT
examples
- domains_create
- Manifest
To create a new domain, send a POST request to /v2/domains
. Set the "name"
attribute to the domain name you are adding. Optionally, you may set the
"ip_address" attribute, and an A record will be automatically created pointing
to the apex domain.
INSERT INTO digitalocean.compute.domains (
data__name,
data__ip_address
)
SELECT
'{{ name }}',
'{{ ip_address }}'
RETURNING
domain
;
# Description fields are for documentation purposes
- name: domains
props:
- name: name
value: string
description: >
The name of the domain itself. This should follow the standard domain format of domain.TLD. For instance, `example.com` is a valid domain name.
- name: ip_address
value: string
description: >
This optional attribute may contain an IP address. When provided, an A record will be automatically created pointing to the apex domain.
DELETE
examples
- domains_delete
To delete a domain, send a DELETE request to /v2/domains/$DOMAIN_NAME
.
DELETE FROM digitalocean.compute.domains
WHERE domain_name = '{{ domain_name }}' --required;