本文整理匯總了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
}