Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
6ef66399
Commit
6ef66399
authored
Nov 18, 2020
by
jakelamotta
Browse files
Removed spaces on empty lines
parent
b20d8f19
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_simply.sh
View file @
6ef66399
...
@@ -21,8 +21,7 @@ dns_simply_add() {
...
@@ -21,8 +21,7 @@ dns_simply_add() {
_simply_save_config
_simply_save_config
_debug
"First detect the root zone"
_debug
"First detect the root zone"
if
!
_get_root
"
$fulldomain
"
;
then
if
!
_get_root
"
$fulldomain
"
;
then
_err
"invalid domain"
_err
"invalid domain"
return
1
return
1
...
@@ -36,8 +35,7 @@ dns_simply_add() {
...
@@ -36,8 +35,7 @@ dns_simply_add() {
if
!
_simply_add_record
"
$_domain
"
"
$_sub_domain
"
"
$txtvalue
"
;
then
if
!
_simply_add_record
"
$_domain
"
"
$_sub_domain
"
"
$txtvalue
"
;
then
_err
"Could not add DNS record"
_err
"Could not add DNS record"
return
1
return
1
fi
fi
return
0
return
0
}
}
...
@@ -126,7 +124,7 @@ _simply_load_config() {
...
@@ -126,7 +124,7 @@ _simply_load_config() {
if
[
-z
"
$SIMPLY_Api
"
]
;
then
if
[
-z
"
$SIMPLY_Api
"
]
;
then
SIMPLY_Api
=
"
$SIMPLY_Api_Default
"
SIMPLY_Api
=
"
$SIMPLY_Api_Default
"
fi
fi
if
[
-z
"
$SIMPLY_AccountName
"
]
||
[
-z
"
$SIMPLY_ApiKey
"
]
;
then
if
[
-z
"
$SIMPLY_AccountName
"
]
||
[
-z
"
$SIMPLY_ApiKey
"
]
;
then
SIMPLY_AccountName
=
""
SIMPLY_AccountName
=
""
SIMPLY_ApiKey
=
""
SIMPLY_ApiKey
=
""
...
@@ -149,8 +147,8 @@ _simply_save_config() {
...
@@ -149,8 +147,8 @@ _simply_save_config() {
}
}
_simply_get_all_records
()
{
_simply_get_all_records
()
{
domain
=
$1
domain
=
$1
if
!
_simply_rest GET
"my/products/
$domain
/dns/records"
;
then
if
!
_simply_rest GET
"my/products/
$domain
/dns/records"
;
then
return
1
return
1
fi
fi
...
@@ -190,14 +188,14 @@ _simply_add_record() {
...
@@ -190,14 +188,14 @@ _simply_add_record() {
domain
=
$1
domain
=
$1
sub_domain
=
$2
sub_domain
=
$2
txtval
=
$3
txtval
=
$3
data
=
"{
\"
name
\"
:
\"
$sub_domain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
data
\"
:
\"
$txtval
\"
,
\"
priority
\"
:0,
\"
ttl
\"
: 3600}"
data
=
"{
\"
name
\"
:
\"
$sub_domain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
data
\"
:
\"
$txtval
\"
,
\"
priority
\"
:0,
\"
ttl
\"
: 3600}"
if
!
_simply_rest POST
"my/products/
$domain
/dns/records"
"
$data
"
;
then
if
!
_simply_rest POST
"my/products/
$domain
/dns/records"
"
$data
"
;
then
_err
"Adding record not successfull!"
_err
"Adding record not successfull!"
return
1
return
1
fi
fi
return
0
return
0
}
}
...
@@ -205,14 +203,14 @@ _simply_delete_record() {
...
@@ -205,14 +203,14 @@ _simply_delete_record() {
domain
=
$1
domain
=
$1
sub_domain
=
$2
sub_domain
=
$2
record_id
=
$3
record_id
=
$3
_debug record_id
"Delete record with id
$record_id
"
_debug record_id
"Delete record with id
$record_id
"
if
!
_simply_rest DELETE
"my/products/
$domain
/dns/records/
$record_id
"
;
then
if
!
_simply_rest DELETE
"my/products/
$domain
/dns/records/
$record_id
"
;
then
_err
"Deleting record not successfull!"
_err
"Deleting record not successfull!"
return
1
return
1
fi
fi
return
0
return
0
}
}
...
@@ -220,7 +218,7 @@ _simply_rest() {
...
@@ -220,7 +218,7 @@ _simply_rest() {
m
=
$1
m
=
$1
ep
=
"
$2
"
ep
=
"
$2
"
data
=
"
$3
"
data
=
"
$3
"
_debug2 data
"
$data
"
_debug2 data
"
$data
"
_debug2 ep
"
$ep
"
_debug2 ep
"
$ep
"
_debug2 m
"
$m
"
_debug2 m
"
$m
"
...
@@ -237,12 +235,13 @@ _simply_rest() {
...
@@ -237,12 +235,13 @@ _simply_rest() {
_err
"error
$ep
"
_err
"error
$ep
"
return
1
return
1
fi
fi
_debug2 response
"
$response
"
_debug2 response
"
$response
"
if
_contains
"
$response
"
"Invalid account authorization"
;
then
if
_contains
"
$response
"
"Invalid account authorization"
;
then
_err
"It seems that your api key or accountnumber is not correct."
_err
"It seems that your api key or accountnumber is not correct."
return
1
return
1
fi
fi
return
0
return
0
}
}
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