本文整理汇总了Golang中github.com/LunaNode/lobster.ImageInfo类的典型用法代码示例。如果您正苦于以下问题:Golang ImageInfo类的具体用法?Golang ImageInfo怎么用?Golang ImageInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImageInfo类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ImageInfo
func (this *OpenStack) ImageInfo(imageIdentification string) (*lobster.ImageInfo, error) {
osImage, err := image.Get(this.ImageClient, imageIdentification).Extract()
if err != nil {
return nil, err
}
image := new(lobster.ImageInfo)
image.Size, _ = strconv.ParseInt(osImage.Size, 10, 64)
if osImage.Status == "active" {
image.Status = lobster.ImageActive
} else if osImage.Status == "error" || osImage.Status == "killed" {
image.Status = lobster.ImageError
} else {
image.Status = lobster.ImagePending
}
return image, nil
}
示例2: ImageInfo
func (cloug *Cloug) ImageInfo(imageIdentification string) (*lobster.ImageInfo, error) {
if cloug.imageService == nil {
return nil, fmt.Errorf("operation not supported")
}
image, err := cloug.imageService.GetImage(imageIdentification)
if err != nil {
return nil, err
}
info := lobster.ImageInfo{
Size: image.Size,
Details: image.Details,
}
if image.Status == compute.ImageAvailable {
info.Status = lobster.ImageActive
} else if image.Status == compute.ImagePending {
info.Status = lobster.ImagePending
}
return &info, nil
}
示例3: ImageInfo
func (this *Lobster) ImageInfo(imageIdentification string) (*lobster.ImageInfo, error) {
imageIdentificationInt, _ := strconv.Atoi(imageIdentification)
apiInfoResponse, err := this.client.ImageInfo(imageIdentificationInt)
if err != nil {
return nil, err
}
apiInfo := apiInfoResponse.Details
info := lobster.ImageInfo{
Size: apiInfo.Size,
Details: apiInfo.Details,
}
if apiInfo.Status == "pending" {
info.Status = lobster.ImagePending
} else if apiInfo.Status == "active" {
info.Status = lobster.ImageActive
} else if apiInfo.Status == "error" {
info.Status = lobster.ImageError
}
return &info, nil
}