4.4 Record Set 管理
4.4.1 创建 Record Set
功能介绍
创建单个Record Set。
调试
您可以在API Explorer中调试该接口。
URI
POST /v2/zones/{zone_id}/recordsets 参数说明请参见表4-73。
表4-73 URI 格式的参数说明
名称 是否必选 参数类型 说明
zone_id 是 String 所属zone ID。
公网Zone ID可以通过查询公网 Zone列表获取。
内网Zone ID可以通过查询内网 Zone列表获取。
请求
● 参数说明
表4-74 请求样例的参数说明
名称 是否必选 参数类型 说明
name 是 String 域名,后缀需以zone name
结束且为FQDN(即以“.”
号结束的完整主机名)。
域名格式不区分大小写,系 统会将输入的大写字母统一 转换为小写。
description 否 String 可选配置,对域名的描述。
长度不超过255个字符。
默认值为空。
名称 是否必选 参数类型 说明
type 是 String Record Set的类型。
取值范围:A、AAAA、MX、
CNAME、TXT、NS(仅限公 网Zone)、SRV、PTR(仅限 内网Zone)、CAA(仅限公 网Zone)。
详细信息请参见解析记录类 型。
status 否 String 解析记录的状态。
取值范围:
● ENABLE,表示创建启用 状态的解析记录。
● DISABLE,表示创建暂停 状态的解析记录。
默认值为ENABLE。
ttl 否 Integer 解析记录在本地DNS服务器
的缓存时间,以秒为单位。
如果您的服务地址经常更 换,建议TTL值设置相对小 些,反之,建议设置相对大 些。
取值范围:1~2147483647。
默认值为300s。
records 是 Array of
strings 解析记录的值。不同类型解 析记录对应的值的规则不 同。
如Type为AAAA类型,Value 是域名对应的IPv6地址列 表。
具体参见《云解析服务用户 指南》中“管理记录集”章 节的说明及请求样例。
tags 否 Array of
object 资源标签。详细信息请参见 表4-75。
默认值为空。
表4-75 tags 对象参数说明
名称 是否必选 参数类
型
说明
key 是 String 键。最大长度36个unicode字符。
key不能为空。不能包含“=”、
“*”、“<”、“>”、“\”、
“,”、“|”和“/”,且首尾字符 不能为空格。
value 否 String 值。每个值最大长度43个unicode字 符,可以为空字符串。 不能包含
“=”、“*”、“<”、“>”、
“\”、“,”、“|”和“/”,且首 尾字符不能为空格。
● 请求样例
为Zone ID为“2c9eb155587194ec01587224c9f90149”域名添加记录集。
POST https://{DNS_Endpoint}/v2/zones/2c9eb155587194ec01587224c9f90149/recordsets – A类型
{ "name": "www.example.com.",
"description": "This is an example record set.", "type": "A",
{ "name": "www.example.com.",
"description": "This is an example record set.", "type": "AAAA",
"ttl": 3600, "records": [
"fe80:0:0:0:202:b3ff:fe1e:8329", "ff03:0db8:85a3:0:0:8a2e:0370:7334"
],
{ "name": "www.example.com.",
"description": "This is an example record set.", "type": "MX",
"ttl": 3600, "records": [
"1 mail.example.com"
{ "name": "sale.example.com.",
"description": "This is an example record set.", "type": "CNAME",
{ "name": "server1.example.com.",
"description": "This is an example record set.", "type": "TXT",
{ "name": "server1.example.com.",
"description": "This is an example record set.", "type": "NS",
{ "name": "_sip._tcp.example.com.",
"description": "This is an example record set.", "type": "SRV",
"ttl": 300, "records": [
"3 60 2176 sipserver.example.com.", "10 100 2176 sipserver.example.com."
],
{ "name": "1.1.168.192.in-addr.arpa.",
"description": "This is an example record set.", "type": "PTR",
{ "name": "www.example.com.",
"description": "This is an example record set.", "type": "CAA",
"ttl": 300, "records": [
"0 issue \"example.com\"",
"0 issuewild \"www.certinomis.com\"", "0 iodef \"mailto:[email protected]\"", "0 iodef \"http://iodef.example.com\""
],
id String Record Set的ID。
name String Record Set的名称。
description String Record Set的描述信息。
zone_id String 托管该记录的zone_id。
zone_name String 托管该记录的zone_name。
名称 参数类型 说明 type String 记录类型。
取值范围:A、AAAA、MX、CNAME、TXT、
NS(仅限公网Zone)、SRV、PTR(仅限内网 Zone)、CAA(仅限公网Zone)。
详细信息请参见解析记录类型。
ttl Integer 解析记录在本地DNS服务器的缓存时间,缓存时 间越长更新生效越慢,以秒为单位。
如果您的服务地址经常更换,建议TTL值设置相 对小些,反之,建议设置相对大些。
records Array of
strings 域名解析后的值。
create_at String 创建时间。
格式:yyyy-MM-dd'T'HH:mm:ss.SSS update_at String 更新时间。
格式:yyyy-MM-dd'T'HH:mm:ss.SSS status String 资源状态。
详细信息请参见资源状态。
default Boolean 标识是否由系统默认生成,系统默认生成的 Record Set不能删除。
project_id String 该Record Set所属的项目ID。
links Object 指向当前资源或者其他资源的链接。当查询需要 分页时,需要包含一个next链接指向下一页。
详细信息请参见表4-77。
表4-77 links 参数说明
名称 参数类型 说明
self String 当前资源的链接。
next String 下一页资源的链接。
● 响应样例
{ "id": "2c9eb155587228570158722b6ac30007", "name": "www.example.com.",
"description": "This is an example record set.", "type": "A",
"ttl": 300, "records": [ "192.168.10.1", "192.168.10.2"
],
"status": "PENDING_CREATE",
"links": {
"self": "https://Endpoint/v2/zones/2c9eb155587194ec01587224c9f90149/recordsets/
2c9eb155587228570158722b6ac30007"
},
"zone_id": "2c9eb155587194ec01587224c9f90149", "zone_name": "example.com.",
"create_at": "2016-11-17T12:03:17.827", "update_at": null,
"default": false,
"project_id": "e55c6f3dc4e34c9f86353b664ae0e70c"
}
返回值
接口正常的返回值为2xx,例如200、202或者204。
返回值含义以及更多返回值请参考状态码。