Skip to content

Commit

Permalink
fix: fix describe domain request
Browse files Browse the repository at this point in the history
  • Loading branch information
gitsang committed May 25, 2023
1 parent 40bf331 commit 89655f9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
7 changes: 3 additions & 4 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ func FindRecord(client *alidns20150109.Client, domainName, rr, typ string) (
*alidns20150109.DescribeDomainRecordsResponseBodyDomainRecordsRecord, error) {

describeDomainRecordsRequest := &alidns20150109.DescribeDomainRecordsRequest{
DomainName: tea.String(domainName),
RRKeyWord: tea.String(rr),
TypeKeyWord: tea.String(typ),
SearchMode: tea.String("EXACT"),
DomainName: tea.String(domainName),
RRKeyWord: tea.String(rr),
Type: tea.String(typ),
}
resp, err := client.DescribeDomainRecords(describeDomainRecordsRequest)
if err != nil {
Expand Down
45 changes: 34 additions & 11 deletions pkg/api/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ import (
)

const (
AccessKeyId = "*"
AccessKeySecret = "*"
)
AccessKeyId = ""
AccessKeySecret = ""

func main() {
client, err := api.CreateClient(AccessKeyId, AccessKeySecret)
if err != nil {
panic(err)
}
Domain = "home.c8g.top"
RR = "@"
Type = "AAAA"
)

func Describe(client *alidns20150109.Client) {
describeDomainRecordsRequest := &alidns20150109.DescribeDomainRecordsRequest{
DomainName: tea.String("home.c8g.top"),
RRKeyWord: tea.String("@"),
TypeKeyWord: tea.String("A"),
DomainName: tea.String(Domain),
RRKeyWord: tea.String(RR),
Type: tea.String(Type),
}
resp, err := client.DescribeDomainRecords(describeDomainRecordsRequest)
if err != nil {
Expand All @@ -37,3 +36,27 @@ func main() {

fmt.Println("resp", string(respBytes))
}

func Find(client *alidns20150109.Client) {
rec, err := api.FindRecord(client, Domain, RR, Type)
if err != nil {
panic(err)
}
recBytes, err := json.MarshalIndent(rec, "", " ")
if err != nil {
panic(err)
}

fmt.Println("rec", string(recBytes))
}

func main() {
client, err := api.CreateClient(AccessKeyId, AccessKeySecret)
if err != nil {
panic(err)
}

Describe(client)

Find(client)
}

0 comments on commit 89655f9

Please sign in to comment.