diff --git a/Gopkg.lock b/Gopkg.lock index 383b46f8..b365a457 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -223,14 +223,14 @@ [[projects]] branch = "master" - digest = "1:fed64c975620bacb8b3e531e31974149eef07fa0c4bc99185d35c4beaa6bd98a" + digest = "1:c45e4f1755487478216e06437e161d56299d963282ce109555091bc4c7a57343" name = "github.com/iij/doapi" packages = [ ".", "protocol", ] pruneopts = "NUT" - revision = "afe9fa11fb27e5e8ab2dfc1675e91387aa63eaa2" + revision = "8803795a9b7b938fa88ddbd63a77893beee14cd8" [[projects]] digest = "1:ac6d01547ec4f7f673311b4663909269bfb8249952de3279799289467837c3cc" diff --git a/vendor/github.com/iij/doapi/api.go b/vendor/github.com/iij/doapi/api.go index 28e29a80..796e0668 100644 --- a/vendor/github.com/iij/doapi/api.go +++ b/vendor/github.com/iij/doapi/api.go @@ -22,11 +22,11 @@ import ( ) const ( - HmacSHA1 = "HmacSHA1" - HmacSHA256 = "HmacSHA256" - SignatureVersion2 = "2" - APIVersion = "20140601" - EndpointJSON = "https://do.api.iij.jp/" + HmacSHA1 = "HmacSHA1" + HmacSHA256 = "HmacSHA256" + SignatureVersion2 = "2" + APIVersion = "20140601" + EndpointJSON = "https://do.api.iij.jp/" // EndpointJSON = "http://localhost:9999/" TimeLayout = "2006-01-02T15:04:05Z" PostContentType = "application/json" @@ -140,6 +140,9 @@ func (a API) PostSome(method string, param url.URL, body interface{}) (resp *htt if body != nil { var bufb []byte bufb, err = json.Marshal(body) + if err != nil { + return nil, err + } if len(bufb) > 2 { log.Debug("call with body", method, string(bufb)) buf = bytes.NewBuffer(bufb) @@ -154,6 +157,9 @@ func (a API) PostSome(method string, param url.URL, body interface{}) (resp *htt buf = bytes.NewBufferString("") } req, err := http.NewRequest(method, param.String(), buf) + if err != nil { + return nil, err + } if body != nil { req.Header.Add("content-type", PostContentType) } diff --git a/vendor/github.com/iij/doapi/protocol/Commit.go b/vendor/github.com/iij/doapi/protocol/Commit.go index d7c7fef2..2b23bb85 100644 --- a/vendor/github.com/iij/doapi/protocol/Commit.go +++ b/vendor/github.com/iij/doapi/protocol/Commit.go @@ -1,44 +1,44 @@ -package protocol - -import ( - "reflect" -) - -// Commit -type Commit struct { - DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) -} - -// URI /{{.DoServiceCode}}/commit.json -func (t Commit) URI() string { - return "/{{.DoServiceCode}}/commit.json" -} - -// APIName Commit -func (t Commit) APIName() string { - return "Commit" -} - -// Method PUT -func (t Commit) Method() string { - return "PUT" -} - -// http://manual.iij.jp/dns/doapi/754632.html -func (t Commit) Document() string { - return "http://manual.iij.jp/dns/doapi/754632.html" -} - -// JPName PUT Commit -func (t Commit) JPName() string { - return "PUT commit" -} -func init() { - APIlist = append(APIlist, Commit{}) - TypeMap["Commit"] = reflect.TypeOf(Commit{}) -} - -// CommitResponse PUT Commitのレスポンス -type CommitResponse struct { - *CommonResponse -} +package protocol + +import ( + "reflect" +) + +// Commit +type Commit struct { + DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) +} + +// URI /{{.DoServiceCode}}/commit.json +func (t Commit) URI() string { + return "/{{.DoServiceCode}}/commit.json" +} + +// APIName Commit +func (t Commit) APIName() string { + return "Commit" +} + +// Method PUT +func (t Commit) Method() string { + return "PUT" +} + +// http://manual.iij.jp/dns/doapi/754632.html +func (t Commit) Document() string { + return "http://manual.iij.jp/dns/doapi/754632.html" +} + +// JPName PUT Commit +func (t Commit) JPName() string { + return "PUT commit" +} +func init() { + APIlist = append(APIlist, Commit{}) + TypeMap["Commit"] = reflect.TypeOf(Commit{}) +} + +// CommitResponse PUT Commitのレスポンス +type CommitResponse struct { + *CommonResponse +} diff --git a/vendor/github.com/iij/doapi/protocol/RecordAdd.go b/vendor/github.com/iij/doapi/protocol/RecordAdd.go index f35cd303..0f165b09 100644 --- a/vendor/github.com/iij/doapi/protocol/RecordAdd.go +++ b/vendor/github.com/iij/doapi/protocol/RecordAdd.go @@ -1,51 +1,51 @@ -package protocol - -import ( - "reflect" -) - -// RecordAdd POST record (同期) -// http://manual.iij.jp/dns/doapi/754517.html -type RecordAdd struct { - DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) - ZoneName string `json:"-"` // Zone Name - Owner string // owner of record - TTL string // TTL of record - RecordType string // type of record - RData string // data of record -} - -// URI /:GisServiceCode/fw-lbs/:IflServiceCode/filters/:IpVersion/:Direction.json -func (t RecordAdd) URI() string { - return "/{{.DoServiceCode}}/{{.ZoneName}}/record.json" -} - -// APIName RecordAdd -func (t RecordAdd) APIName() string { - return "RecordAdd" -} - -// Method POST -func (t RecordAdd) Method() string { - return "POST" -} - -// http://manual.iij.jp/dns/doapi/754517.html -func (t RecordAdd) Document() string { - return "http://manual.iij.jp/dns/doapi/754517.html" -} - -// JPName POST record -func (t RecordAdd) JPName() string { - return "POST record" -} -func init() { - APIlist = append(APIlist, RecordAdd{}) - TypeMap["RecordAdd"] = reflect.TypeOf(RecordAdd{}) -} - -// RecordAddResponse POST recordのレスポンス -type RecordAddResponse struct { - *CommonResponse - Record ResourceRecord -} +package protocol + +import ( + "reflect" +) + +// RecordAdd POST record (同期) +// http://manual.iij.jp/dns/doapi/754517.html +type RecordAdd struct { + DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) + ZoneName string `json:"-"` // Zone Name + Owner string // owner of record + TTL string // TTL of record + RecordType string // type of record + RData string // data of record +} + +// URI /:GisServiceCode/fw-lbs/:IflServiceCode/filters/:IpVersion/:Direction.json +func (t RecordAdd) URI() string { + return "/{{.DoServiceCode}}/{{.ZoneName}}/record.json" +} + +// APIName RecordAdd +func (t RecordAdd) APIName() string { + return "RecordAdd" +} + +// Method POST +func (t RecordAdd) Method() string { + return "POST" +} + +// http://manual.iij.jp/dns/doapi/754517.html +func (t RecordAdd) Document() string { + return "http://manual.iij.jp/dns/doapi/754517.html" +} + +// JPName POST record +func (t RecordAdd) JPName() string { + return "POST record" +} +func init() { + APIlist = append(APIlist, RecordAdd{}) + TypeMap["RecordAdd"] = reflect.TypeOf(RecordAdd{}) +} + +// RecordAddResponse POST recordのレスポンス +type RecordAddResponse struct { + *CommonResponse + Record ResourceRecord +} diff --git a/vendor/github.com/iij/doapi/protocol/RecordDelete.go b/vendor/github.com/iij/doapi/protocol/RecordDelete.go index cf3aa520..5d087df3 100644 --- a/vendor/github.com/iij/doapi/protocol/RecordDelete.go +++ b/vendor/github.com/iij/doapi/protocol/RecordDelete.go @@ -1,47 +1,47 @@ -package protocol - -import ( - "reflect" -) - -// RecordDelete DELETE record -// http://manual.iij.jp/dns/doapi/754525.html -type RecordDelete struct { - DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) - ZoneName string `json:"-"` // Zone Name - RecordID string `json:"-"` // Record ID -} - -// URI /{{.DoServiceCode}}/{{.ZoneName}}/record/{{.RecordID}}.json -func (t RecordDelete) URI() string { - return "/{{.DoServiceCode}}/{{.ZoneName}}/record/{{.RecordID}}.json" -} - -// APIName RecordDelete -func (t RecordDelete) APIName() string { - return "RecordDelete" -} - -// Method DELETE -func (t RecordDelete) Method() string { - return "DELETE" -} - -// http://manual.iij.jp/dns/doapi/754525.html -func (t RecordDelete) Document() string { - return "http://manual.iij.jp/dns/doapi/754525.html" -} - -// JPName DELETE record -func (t RecordDelete) JPName() string { - return "DELETE record" -} -func init() { - APIlist = append(APIlist, RecordDelete{}) - TypeMap["RecordDelete"] = reflect.TypeOf(RecordDelete{}) -} - -// RecordDeleteResponse DELETE recordのレスポンス -type RecordDeleteResponse struct { - *CommonResponse -} +package protocol + +import ( + "reflect" +) + +// RecordDelete DELETE record +// http://manual.iij.jp/dns/doapi/754525.html +type RecordDelete struct { + DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) + ZoneName string `json:"-"` // Zone Name + RecordID string `json:"-"` // Record ID +} + +// URI /{{.DoServiceCode}}/{{.ZoneName}}/record/{{.RecordID}}.json +func (t RecordDelete) URI() string { + return "/{{.DoServiceCode}}/{{.ZoneName}}/record/{{.RecordID}}.json" +} + +// APIName RecordDelete +func (t RecordDelete) APIName() string { + return "RecordDelete" +} + +// Method DELETE +func (t RecordDelete) Method() string { + return "DELETE" +} + +// http://manual.iij.jp/dns/doapi/754525.html +func (t RecordDelete) Document() string { + return "http://manual.iij.jp/dns/doapi/754525.html" +} + +// JPName DELETE record +func (t RecordDelete) JPName() string { + return "DELETE record" +} +func init() { + APIlist = append(APIlist, RecordDelete{}) + TypeMap["RecordDelete"] = reflect.TypeOf(RecordDelete{}) +} + +// RecordDeleteResponse DELETE recordのレスポンス +type RecordDeleteResponse struct { + *CommonResponse +} diff --git a/vendor/github.com/iij/doapi/protocol/RecordGet.go b/vendor/github.com/iij/doapi/protocol/RecordGet.go index 1da14920..051bb659 100644 --- a/vendor/github.com/iij/doapi/protocol/RecordGet.go +++ b/vendor/github.com/iij/doapi/protocol/RecordGet.go @@ -1,48 +1,48 @@ -package protocol - -import ( - "reflect" -) - -// GET records -// http://manual.iij.jp/dns/doapi/754619.html -type RecordGet struct { - DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) - ZoneName string `json:"-"` // ゾーン名 - RecordID string `json:"-"` // -} - -// URI /{{.DoServiceCode}}/{{.ZoneName}}/record/{{.RecordID}}.json -func (t RecordGet) URI() string { - return "/{{.DoServiceCode}}/{{.ZoneName}}/record/{{.RecordID}}.json" -} - -// APIName RecordGet -func (t RecordGet) APIName() string { - return "RecordGet" -} - -// Method GET -func (t RecordGet) Method() string { - return "GET" -} - -// http://manual.iij.jp/dns/doapi/754503.html -func (t RecordGet) Document() string { - return "http://manual.iij.jp/dns/doapi/754503.html" -} - -// JPName GET record -func (t RecordGet) JPName() string { - return "GET record" -} -func init() { - APIlist = append(APIlist, RecordGet{}) - TypeMap["RecordGet"] = reflect.TypeOf(RecordGet{}) -} - -// RecordGetResponse フィルタリングルール情報取得のレスポンス -type RecordGetResponse struct { - *CommonResponse - Record ResourceRecord -} +package protocol + +import ( + "reflect" +) + +// GET records +// http://manual.iij.jp/dns/doapi/754619.html +type RecordGet struct { + DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) + ZoneName string `json:"-"` // ゾーン名 + RecordID string `json:"-"` // +} + +// URI /{{.DoServiceCode}}/{{.ZoneName}}/record/{{.RecordID}}.json +func (t RecordGet) URI() string { + return "/{{.DoServiceCode}}/{{.ZoneName}}/record/{{.RecordID}}.json" +} + +// APIName RecordGet +func (t RecordGet) APIName() string { + return "RecordGet" +} + +// Method GET +func (t RecordGet) Method() string { + return "GET" +} + +// http://manual.iij.jp/dns/doapi/754503.html +func (t RecordGet) Document() string { + return "http://manual.iij.jp/dns/doapi/754503.html" +} + +// JPName GET record +func (t RecordGet) JPName() string { + return "GET record" +} +func init() { + APIlist = append(APIlist, RecordGet{}) + TypeMap["RecordGet"] = reflect.TypeOf(RecordGet{}) +} + +// RecordGetResponse フィルタリングルール情報取得のレスポンス +type RecordGetResponse struct { + *CommonResponse + Record ResourceRecord +} diff --git a/vendor/github.com/iij/doapi/protocol/RecordListGet.go b/vendor/github.com/iij/doapi/protocol/RecordListGet.go index c60b819b..3e4b9d63 100644 --- a/vendor/github.com/iij/doapi/protocol/RecordListGet.go +++ b/vendor/github.com/iij/doapi/protocol/RecordListGet.go @@ -1,47 +1,47 @@ -package protocol - -import ( - "reflect" -) - -// GET records -type RecordListGet struct { - DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) - ZoneName string `json:"-"` // ゾーン名 -} - -// URI /{{.DoServiceCode}}/{{.ZoneName}}/records/DETAIL.json -func (t RecordListGet) URI() string { - return "/{{.DoServiceCode}}/{{.ZoneName}}/records/DETAIL.json" -} - -// APIName RecordListGet -func (t RecordListGet) APIName() string { - return "RecordListGet" -} - -// Method GET -func (t RecordListGet) Method() string { - return "GET" -} - -// http://manual.iij.jp/dns/doapi/754619.html -func (t RecordListGet) Document() string { - return "http://manual.iij.jp/dns/doapi/754619.html" -} - -// JPName GET records -func (t RecordListGet) JPName() string { - return "GET records" -} -func init() { - APIlist = append(APIlist, RecordListGet{}) - TypeMap["RecordListGet"] = reflect.TypeOf(RecordListGet{}) -} - -// RecordListGetResponse GET recordsのレスポンス -type RecordListGetResponse struct { - *CommonResponse - RecordList []ResourceRecord - StaticRecordList []ResourceRecord -} +package protocol + +import ( + "reflect" +) + +// GET records +type RecordListGet struct { + DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) + ZoneName string `json:"-"` // ゾーン名 +} + +// URI /{{.DoServiceCode}}/{{.ZoneName}}/records/DETAIL.json +func (t RecordListGet) URI() string { + return "/{{.DoServiceCode}}/{{.ZoneName}}/records/DETAIL.json" +} + +// APIName RecordListGet +func (t RecordListGet) APIName() string { + return "RecordListGet" +} + +// Method GET +func (t RecordListGet) Method() string { + return "GET" +} + +// http://manual.iij.jp/dns/doapi/754619.html +func (t RecordListGet) Document() string { + return "http://manual.iij.jp/dns/doapi/754619.html" +} + +// JPName GET records +func (t RecordListGet) JPName() string { + return "GET records" +} +func init() { + APIlist = append(APIlist, RecordListGet{}) + TypeMap["RecordListGet"] = reflect.TypeOf(RecordListGet{}) +} + +// RecordListGetResponse GET recordsのレスポンス +type RecordListGetResponse struct { + *CommonResponse + RecordList []ResourceRecord + StaticRecordList []ResourceRecord +} diff --git a/vendor/github.com/iij/doapi/protocol/Reset.go b/vendor/github.com/iij/doapi/protocol/Reset.go index 5a95158b..0a26056f 100644 --- a/vendor/github.com/iij/doapi/protocol/Reset.go +++ b/vendor/github.com/iij/doapi/protocol/Reset.go @@ -1,45 +1,45 @@ -package protocol - -import ( - "reflect" -) - -// Reset PUT reset (同期) -type Reset struct { - DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) - ZoneName string `json:"-"` // Zone name -} - -// URI /{{.DoServiceCode}}/{{.ZoneName}}/reset.json -func (t Reset) URI() string { - return "/{{.DoServiceCode}}/{{.ZoneName}}/reset.json" -} - -// APIName Reset -func (t Reset) APIName() string { - return "Reset" -} - -// Method PUT -func (t Reset) Method() string { - return "PUT" -} - -// http://manual.iij.jp/dns/doapi/754610.html -func (t Reset) Document() string { - return "http://manual.iij.jp/dns/doapi/754610.html" -} - -// JPName PUT reset -func (t Reset) JPName() string { - return "PUT Reset" -} -func init() { - APIlist = append(APIlist, Reset{}) - TypeMap["Reset"] = reflect.TypeOf(Reset{}) -} - -// ResetResponse PUT resetのレスポンス -type ResetResponse struct { - *CommonResponse -} +package protocol + +import ( + "reflect" +) + +// Reset PUT reset (同期) +type Reset struct { + DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) + ZoneName string `json:"-"` // Zone name +} + +// URI /{{.DoServiceCode}}/{{.ZoneName}}/reset.json +func (t Reset) URI() string { + return "/{{.DoServiceCode}}/{{.ZoneName}}/reset.json" +} + +// APIName Reset +func (t Reset) APIName() string { + return "Reset" +} + +// Method PUT +func (t Reset) Method() string { + return "PUT" +} + +// http://manual.iij.jp/dns/doapi/754610.html +func (t Reset) Document() string { + return "http://manual.iij.jp/dns/doapi/754610.html" +} + +// JPName PUT reset +func (t Reset) JPName() string { + return "PUT Reset" +} +func init() { + APIlist = append(APIlist, Reset{}) + TypeMap["Reset"] = reflect.TypeOf(Reset{}) +} + +// ResetResponse PUT resetのレスポンス +type ResetResponse struct { + *CommonResponse +} diff --git a/vendor/github.com/iij/doapi/protocol/ZoneListGet.go b/vendor/github.com/iij/doapi/protocol/ZoneListGet.go index 1ddf1bad..20258a4d 100644 --- a/vendor/github.com/iij/doapi/protocol/ZoneListGet.go +++ b/vendor/github.com/iij/doapi/protocol/ZoneListGet.go @@ -1,45 +1,45 @@ -package protocol - -import ( - "reflect" -) - -// GET zones -type ZoneListGet struct { - DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) -} - -// URI /{{.DoServiceCode}}/zones.json -func (t ZoneListGet) URI() string { - return "/{{.DoServiceCode}}/zones.json" -} - -// APIName ZoneListGet -func (t ZoneListGet) APIName() string { - return "ZoneListGet" -} - -// Method GET -func (t ZoneListGet) Method() string { - return "GET" -} - -// http://manual.iij.jp/dns/doapi/754466.html -func (t ZoneListGet) Document() string { - return "http://manual.iij.jp/dns/doapi/754466.html" -} - -// JPName GET zones -func (t ZoneListGet) JPName() string { - return "GET zones" -} -func init() { - APIlist = append(APIlist, ZoneListGet{}) - TypeMap["ZoneListGet"] = reflect.TypeOf(ZoneListGet{}) -} - -// ZoneListGetResponse GET zonesのレスポンス -type ZoneListGetResponse struct { - *CommonResponse - ZoneList []string -} +package protocol + +import ( + "reflect" +) + +// GET zones +type ZoneListGet struct { + DoServiceCode string `json:"-"` // DO契約のサービスコード(do########) +} + +// URI /{{.DoServiceCode}}/zones.json +func (t ZoneListGet) URI() string { + return "/{{.DoServiceCode}}/zones.json" +} + +// APIName ZoneListGet +func (t ZoneListGet) APIName() string { + return "ZoneListGet" +} + +// Method GET +func (t ZoneListGet) Method() string { + return "GET" +} + +// http://manual.iij.jp/dns/doapi/754466.html +func (t ZoneListGet) Document() string { + return "http://manual.iij.jp/dns/doapi/754466.html" +} + +// JPName GET zones +func (t ZoneListGet) JPName() string { + return "GET zones" +} +func init() { + APIlist = append(APIlist, ZoneListGet{}) + TypeMap["ZoneListGet"] = reflect.TypeOf(ZoneListGet{}) +} + +// ZoneListGetResponse GET zonesのレスポンス +type ZoneListGetResponse struct { + *CommonResponse + ZoneList []string +}