-
Notifications
You must be signed in to change notification settings - Fork 0
/
record_test.go
51 lines (42 loc) · 967 Bytes
/
record_test.go
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
51
package alidns
import (
"fmt"
"log"
"testing"
"time"
)
func TestClient_AddDomainRecord2(t *testing.T) {
cli := New(akid, akey)
RR := "tangx12223"
Type := "A"
Value := "123.231.12.11"
ValueUpdate := "111.222.33.44"
// add
resp, errResp, err := cli.AddDomainRecord("rockontrol.com", RR, Type, Value, nil)
if err != nil {
log.Fatal(errResp.Code, errResp.Message)
}
fmt.Println(resp.RecordId)
rrID := resp.RecordId
// update
time.Sleep(1 * time.Second)
resp, errResp, err = cli.UpdateDomainRecord(RR, rrID, Type, ValueUpdate, nil)
if err != nil {
log.Fatal(errResp.Message)
}
fmt.Println(resp.RecordId)
// describe
time.Sleep(1 * time.Second)
descResp, errResp, err := cli.DescribeDomainRecordInfo(rrID)
if err != nil {
log.Fatal(err)
}
fmt.Println(descResp)
// delete
time.Sleep(1 * time.Second)
resp, errResp, err = cli.DeleteDomainRecord(rrID)
if err != nil {
log.Fatal(errResp.Message)
}
fmt.Println(resp.RecordId)
}