https://github.com/caiguanhao/alidnsslim
Alidns API 阿里云 云解析
https://github.com/caiguanhao/alidnsslim
alidns
Last synced: 4 months ago
JSON representation
Alidns API 阿里云 云解析
- Host: GitHub
- URL: https://github.com/caiguanhao/alidnsslim
- Owner: caiguanhao
- License: mit
- Created: 2022-02-09T03:50:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-10T02:32:47.000Z (over 4 years ago)
- Last Synced: 2024-06-20T06:30:32.396Z (almost 2 years ago)
- Topics: alidns
- Language: Go
- Homepage: https://pkg.go.dev/github.com/caiguanhao/alidnsslim
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# alidnsslim
[Alidns Docs](https://help.aliyun.com/document_detail/29749.html)
## Usage
```go
import "github.com/caiguanhao/alidnsslim"
client := alidnsslim.NewClient(ACCESS_KEY_ID, ACCESS_KEY_SECRET)
ctx := context.Background()
// get all domains:
var domains []string
client.GetAll(ctx, alidnsslim.GetDomains(), &domains, "Domains.Domain.*.DomainName")
// get all records of a domain:
var records []struct {
Id string `json:"RecordId"`
DomainName string
RR string
Type string
Value string
}
client.GetAll(ctx, alidnsslim.GetDomainRecords("example.com", alidnsslim.PageSize(100)), &records, "DomainRecords.Record.*")
// create hello.example.com TXT record:
var recordId string
client.Do(ctx, AddDomainRecord("hello", "example.com", "TXT", "world"), &recordId, "RecordId")
// for other APIs, create your own params:
var domainId string
client.MustDo(ctx, alidnsslim.Params(
"Action", "AddDomain",
"DomainName", "foobar.com",
), &domainId, "DomainId")
// which is the same as:
params := url.Values{}
params.Set("Action", "AddDomain")
params.Set("DomainName", "foobar.com")
client.MustDo(ctx, params, &domainId, "DomainId")
```