當前位置: 首頁>>代碼示例>>Golang>>正文


Golang lobster.ImageInfo類代碼示例

本文整理匯總了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
}
開發者ID:yashodhank,項目名稱:lobster,代碼行數:17,代碼來源:openstack.go

示例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
}
開發者ID:yashodhank,項目名稱:lobster,代碼行數:22,代碼來源:cloug.go

示例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
}
開發者ID:yashodhank,項目名稱:lobster,代碼行數:23,代碼來源:lobster.go


注:本文中的github.com/LunaNode/lobster.ImageInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。