1
0
Fork 0
traefik/vendor/github.com/sacloud/libsacloud/sacloud/feed.go
Ludovic Fernandez 139f280f35 ACME TLS ALPN
2018-07-03 12:44:04 +02:00

36 lines
857 B
Go

package sacloud
import (
"strconv"
"time"
)
// NewsFeed メンテナンス/障害情報お知らせ
type NewsFeed struct {
StrDate string `json:"date,omitempty"`
Description string `json:"desc,omitempty"`
StrEventStart string `json:"event_start,omitempty"`
StrEventEnd string `json:"event_end,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
}
// Date 対象日時
func (f *NewsFeed) Date() time.Time {
return f.parseTime(f.StrDate)
}
// EventStart 掲載開始日時
func (f *NewsFeed) EventStart() time.Time {
return f.parseTime(f.StrEventStart)
}
// EventEnd 掲載終了日時
func (f *NewsFeed) EventEnd() time.Time {
return f.parseTime(f.StrEventEnd)
}
func (f *NewsFeed) parseTime(sec string) time.Time {
s, _ := strconv.ParseInt(sec, 10, 64)
return time.Unix(s, 0)
}