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

31 lines
617 B
Go

package api
import "github.com/sacloud/libsacloud/sacloud"
// IconAPI アイコンAPI
type IconAPI struct {
*baseAPI
}
// NewIconAPI アイコンAPI作成
func NewIconAPI(client *Client) *IconAPI {
return &IconAPI{
&baseAPI{
client: client,
FuncGetResourceURL: func() string {
return "icon"
},
},
}
}
// GetImage アイコン画像データ(BASE64文字列)取得
func (api *IconAPI) GetImage(id int64, size string) (*sacloud.Image, error) {
res := &sacloud.Response{}
err := api.read(id, map[string]string{"Size": size}, res)
if err != nil {
return nil, err
}
return res.Image, nil
}