This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdns-orb.yml
50 lines (49 loc) · 2.01 KB
/
dns-orb.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
version: 2.1
description: Adds a new dns record on DNSimple
commands:
create_dns_record:
description: Create a dnsnimple record for the project
parameters:
token:
description: api token, can be retrieved from dnsnimple's automation page, or here https://support.dnsimple.com/articles/api-access-token/
type: string
account_id:
description: DNSimple's account id
type: string
zone_id:
description: Zone id or the domain you want to manage
type: string
subdomain:
description: name of the new record. For more information, please see dnsimple documentation
type: string
content:
description: content of the new record, to which to point to
type: string
steps:
- run:
name: DNSimple - sending request
command: |
shopt -s expand_aliases
status_code=$(curl --write-out %{http_code} --silent --output /dev/null --request POST "https://api.dnsimple.com/v2/<< parameters.account_id >>/zones/<< parameters.zone_id >>/records" \
--header "Authorization: Bearer << parameters.token >>" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data "{\"name\": \"<< parameters.subdomain >>\",\"type\": \"CNAME\",\"content\": \"<< parameters.content >>\",\"ttl\": \"600\"}")
case "$status_code" in
"201")
echo "New record was successfully added to your domain";
exit 0;
;;
"400")
echo "ERROR: A required parameter or the request is invalid";
exit 1;
;;
"401")
echo "ERROR: Unauthenticated. Please make sure to add the required keys";
exit 1;
;;
"500" | "502" | "503" | "504")
echo "Uh oh, something went wrong on DNSimple’s end";
exit 1;
;;
esac