# @mhycy/aliyun-dns

> Aliyun dns api wrapper for node.js

Latest version **1.0.0** (published 2019-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mhycy/aliyun-dns
pnpm add @mhycy/aliyun-dns
yarn add @mhycy/aliyun-dns
bun add @mhycy/aliyun-dns
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-08-19 |
| First published | 2019-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | mhycy |
| Maintainers | mhycy |
| Keywords | aliyun, dns, aliyun-dns |

## Links

- npm: https://www.npmjs.com/package/@mhycy/aliyun-dns
- Repository: https://github.com/mhycy/node-aliyun-dns
- Homepage: https://github.com/mhycy/node-aliyun-dns#readme
- Issues: https://github.com/mhycy/node-aliyun-dns/issues
- npm.io page: https://npm.io/package/@mhycy/aliyun-dns

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [@alicloud/pop-core](https://npm.io/package/@alicloud/pop-core.md) ^1.7.7

## Recent versions

- 1.0.0 (latest) — 2019-08-19

## README

# @mhycy/aliyun-dns
Aliyun dns api wrapper for node.js

## Install
```console
$ npm install @mhycy/node-aliyun-dns
```

## Usage
```js
const AliyunDNS = require('@mhycy/node-aliyun-dns');

const accessKeyId = "<accessKeyId>";
const accessKeySecret = "<accessKeySecret>";
const client = AliyunDNS.createClient(accessKeyId, accessKeySecret, true);

(async function () {
  let SubDomain = 'test.example.com';
  let Type = 'A';

  let DomainRecord = await client.DescribeSubDomainRecords({SubDomain, Type});
  console.log(DomainRecord);
})();
```

`console.log` output:
```json
{
  "PageNumber": 1,
  "TotalCount": 1,
  "PageSize": 20,
  "RequestId": "02E6E21C-1A27-446B-925F-63502A1F2C9D",
  "DomainRecords": {
    "Record": [
      {
        "RR": "test",
        "Status": "ENABLE",
        "Value": "1.2.3.4",
        "Weight": 1,
        "RecordId": "12345678901234567",
        "Type": "A",
        "DomainName": "example.com",
        "Locked": false,
        "Line": "default",
        "TTL": 600
      }
    ]
  }
}
```

## API
Official API Document see: [云解析 DNS > API文档 > API概览](https://help.aliyun.com/document_detail/29740.html)

### UpdateRecordBySubDomain
Use `SubDomain` to update dns record.

```js
client.UpdateRecordBySubDomain({
  SubDomain: String,
  Type: String|"A",
  TargetValue: String
})
```

Example:
```js
client.UpdateRecordBySubDomain({
  SubDomain: "test.example.com",
  Type: "A",
  TargetValue: "1.2.3.4"
});
```

Return:
```js
// All path
{
  Status: boolean
}

// Update Success
{
  Status: true,
  Result: {
    RecordId: "12345678901234567",
    RequestId: "D80773EC-7C22-44B7-BD34-68A4A4F68BBE"
  }
}

// Haven't update because target value equle current value
{
  Status: true,
  Message: "Target value equle current value"
}

// SubDomain infomation not found
{
  Status: false,
  Message: "SubDomain infomation not found"
}
```

---
_Source: https://npm.io/package/@mhycy/aliyun-dns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
