imagedata

package
v1.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 92

Documentation

Overview

Package imagedata enables management of image data.

Example to Upload Image Data

imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea"

imageData, err := os.Open("/path/to/image/file")
if err != nil {
	panic(err)
}
defer imageData.Close()

err = imagedata.Upload(imageClient, imageID, imageData).ExtractErr()
if err != nil {
	panic(err)
}

Example to Stage Image Data

imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea"

imageData, err := os.Open("/path/to/image/file")
if err != nil {
  panic(err)
}
defer imageData.Close()

err = imagedata.Stage(imageClient, imageID, imageData).ExtractErr()
if err != nil {
  panic(err)
}

Example to Download Image Data

imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea"

image, err := imagedata.Download(imageClient, imageID).Extract()
if err != nil {
	panic(err)
}

// close the reader, when reading has finished
defer image.Close()

imageData, err := ioutil.ReadAll(image)
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadResult

type DownloadResult struct {
	gophercloud.Result
	Body io.ReadCloser
}

DownloadResult is the result of a download image operation. Call its Extract method to gain access to the image data.

func Download

func Download(client *gophercloud.ServiceClient, id string) (r DownloadResult)

Download retrieves an image.

func (DownloadResult) Extract

func (r DownloadResult) Extract() (io.ReadCloser, error)

Extract builds images model from io.Reader

type StageResult

type StageResult struct {
	gophercloud.ErrResult
}

StageResult is the result of a stage image operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Stage

func Stage(client *gophercloud.ServiceClient, id string, data io.Reader) (r StageResult)

Stage performs PUT call on the existing image object in the Imageservice with the provided file. Existing image object must be in the "queued" status.

type UploadResult

type UploadResult struct {
	gophercloud.ErrResult
}

UploadResult is the result of an upload image operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Upload

func Upload(client *gophercloud.ServiceClient, id string, data io.Reader) (r UploadResult)

Upload uploads an image file.

Directories

Path Synopsis
imagedata unit tests
imagedata unit tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL