当前位置: 首页>>代码示例>>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;未经允许,请勿转载。