Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
56d70e4e
Commit
56d70e4e
authored
Jan 21, 2019
by
Oliver Dick
Browse files
Update to latest API Changes
parent
0b934232
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_hostingde.sh
View file @
56d70e4e
...
@@ -59,9 +59,22 @@ _hostingde_getZoneConfig() {
...
@@ -59,9 +59,22 @@ _hostingde_getZoneConfig() {
if
_contains
"
${
curResult
}
"
'"totalEntries": 1'
;
then
if
_contains
"
${
curResult
}
"
'"totalEntries": 1'
;
then
_info
"Retrieved zone data."
_info
"Retrieved zone data."
_debug
"Zone data: '
${
curResult
}
'"
_debug
"Zone data: '
${
curResult
}
'"
# read ZoneConfigId for later update
zoneConfigId
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"id":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
zoneConfigId
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"id":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
zoneConfigName
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"name":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
zoneConfigType
=
$(
echo
"
${
curResult
}
"
|
grep
-v
"FindZoneConfigsResult"
| _egrep_o
'"type":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
zoneConfigExpire
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"expire":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2 |
cut
-d
','
-f
1
)
zoneConfigNegativeTtl
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"negativeTtl":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2 |
cut
-d
','
-f
1
)
zoneConfigRefresh
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"refresh":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2|
cut
-d
','
-f
1
)
zoneConfigRetry
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"retry":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2|
cut
-d
','
-f
1
)
zoneConfigTtl
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"ttl":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2|
cut
-d
','
-f
1
)
zoneConfigDnsServerGroupId
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"dnsServerGroupId":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
zoneConfigEmailAddress
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"emailAddress":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
zoneConfigDnsSecMode
=
$(
echo
"
${
curResult
}
"
| _egrep_o
'"dnsSecMode":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
if
[
$zoneConfigType
!=
"NATIVE"
]
;
then
_err
"Zone is not native"
returnCode
=
1
break
fi
_debug
"zoneConfigId '
${
zoneConfigId
}
'"
_debug
"zoneConfigId '
${
zoneConfigId
}
'"
returnCode
=
0
returnCode
=
0
break
break
...
@@ -94,7 +107,7 @@ _hostingde_addRecord() {
...
@@ -94,7 +107,7 @@ _hostingde_addRecord() {
_hostingde_getZoneStatus
_hostingde_getZoneStatus
_debug
"Result of zoneStatus: '
${
zoneStatus
}
'"
_debug
"Result of zoneStatus: '
${
zoneStatus
}
'"
done
done
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
\"
${
zoneConfigId
}
\"
},
\"
recordsToAdd
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
,
\"
ttl
\"
:3600}]}"
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
\"
${
zoneConfigId
}
\"
,
\"
name
\"
:
\"
${
zoneConfigName
}
\"
,
\"
type
\"
:
\"
${
zoneConfigType
}
\"
,
\"
dnsServerGroupId
\"
:
\"
${
zoneConfigDnsServerGroupId
}
\"
,
\"
dnsSecMode
\"
:
\"
${
zoneConfigDnsSecMode
}
\"
,
\"
emailAddress
\"
:
\"
${
zoneConfigEmailAddress
}
\"
,
\"
soaValues
\"
:{
\"
expire
\"
:
${
zoneConfigExpire
}
,
\"
negativeTtl
\"
:
${
zoneConfigNegativeTtl
}
,
\"
refresh
\"
:
${
zoneConfigRefresh
}
,
\"
retry
\"
:
${
zoneConfigRetry
}
,
\"
ttl
\"
:
${
zoneConfigTtl
}
}
},
\"
recordsToAdd
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
,
\"
ttl
\"
:3600}]}"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
_debug
"Calling zoneUpdate: '
${
curData
}
' '
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate'"
_debug
"Calling zoneUpdate: '
${
curData
}
' '
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate'"
_debug
"Result of zoneUpdate: '
$curResult
'"
_debug
"Result of zoneUpdate: '
$curResult
'"
...
@@ -118,7 +131,7 @@ _hostingde_removeRecord() {
...
@@ -118,7 +131,7 @@ _hostingde_removeRecord() {
_hostingde_getZoneStatus
_hostingde_getZoneStatus
_debug
"Result of zoneStatus: '
$zoneStatus
'"
_debug
"Result of zoneStatus: '
$zoneStatus
'"
done
done
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
\"
${
zoneConfigId
}
\"
},
\"
recordsToDelete
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
}]}"
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
\"
${
zoneConfigId
}
\"
,
\"
name
\"
:
\"
${
zoneConfigName
}
\"
,
\"
type
\"
:
\"
${
zoneConfigType
}
\"
,
\"
dnsServerGroupId
\"
:
\"
${
zoneConfigDnsServerGroupId
}
\"
,
\"
dnsSecMode
\"
:
\"
${
zoneConfigDnsSecMode
}
\"
,
\"
emailAddress
\"
:
\"
${
zoneConfigEmailAddress
}
\"
,
\"
soaValues
\"
:{
\"
expire
\"
:
${
zoneConfigExpire
}
,
\"
negativeTtl
\"
:
${
zoneConfigNegativeTtl
}
,
\"
refresh
\"
:
${
zoneConfigRefresh
}
,
\"
retry
\"
:
${
zoneConfigRetry
}
,
\"
ttl
\"
:
${
zoneConfigTtl
}
}
},
\"
recordsToDelete
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
}]}"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
_debug
"Calling zoneUpdate: '
${
curData
}
' '
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate'"
_debug
"Calling zoneUpdate: '
${
curData
}
' '
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate'"
_debug
"Result of zoneUpdate: '
$curResult
'"
_debug
"Result of zoneUpdate: '
$curResult
'"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment