images

package
v1.1.34 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package images provides information and interaction with the images through the OpenStack Compute service.

This API is deprecated and will be removed from a future version of the Nova API service.

An image is a collection of files used to create or rebuild a server. Operators provide a number of pre-built OS images by default. You may also create custom images from cloud servers you have launched.

Example to List Images

listOpts := images.ListOpts{
	Limit: 2,
}

allPages, err := images.ListDetail(computeClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allImages, err := images.ExtractImages(allPages)
if err != nil {
	panic(err)
}

for _, image := range allImages {
	fmt.Printf("%+v\n", image)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListDetail

func ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

ListDetail enumerates the available images.

Types

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult is the result from a Delete operation. Call its ExtractErr method to determine if the call succeeded or failed.

func Delete

func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete deletes the specified image ID.

type GetResult

type GetResult struct {
	gophercloud.Result
}

GetResult is the response from a Get operation. Call its Extract method to interpret it as an Image.

func Get

func Get(client *gophercloud.ServiceClient, id string) (r GetResult)

Get returns data about a specific image by its ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Image, error)

Extract interprets a GetResult as an Image.

type Image

type Image struct {
	// ID is the unique ID of an image.
	ID string

	// Created is the date when the image was created.
	Created string

	// MinDisk is the minimum amount of disk a flavor must have to be able
	// to create a server based on the image, measured in GB.
	MinDisk int

	// MinRAM is the minimum amount of RAM a flavor must have to be able
	// to create a server based on the image, measured in MB.
	MinRAM int

	// Name provides a human-readable moniker for the OS image.
	Name string

	// The Progress and Status fields indicate image-creation status.
	Progress int

	// Status is the current status of the image.
	Status string

	// Update is the date when the image was updated.
	Updated string

	// Metadata provides free-form key/value pairs that further describe the
	// image.
	Metadata map[string]interface{}
}

Image represents an Image returned by the Compute API.

func ExtractImages

func ExtractImages(r pagination.Page) ([]Image, error)

ExtractImages converts a page of List results into a slice of usable Image structs.

type ImagePage

type ImagePage struct {
	pagination.LinkedPageBase
}

ImagePage contains a single page of all Images returne from a ListDetail operation. Use ExtractImages to convert it into a slice of usable structs.

func (ImagePage) IsEmpty

func (page ImagePage) IsEmpty() (bool, error)

IsEmpty returns true if an ImagePage contains no Image results.

func (ImagePage) NextPageURL

func (page ImagePage) NextPageURL() (string, error)

NextPageURL uses the response's embedded link reference to navigate to the next page of results.

type ListOpts

type ListOpts struct {
	// ChangesSince filters Images based on the last changed status (in date-time
	// format).
	ChangesSince string `q:"changes-since"`

	// Limit limits the number of Images to return.
	Limit int `q:"limit"`

	// Mark is an Image UUID at which to set a marker.
	Marker string `q:"marker"`

	// Name is the name of the Image.
	Name string `q:"name"`

	// Server is the name of the Server (in URL format).
	Server string `q:"server"`

	// Status is the current status of the Image.
	Status string `q:"status"`

	// Type is the type of image (e.g. BASE, SERVER, ALL).
	Type string `q:"type"`
}

ListOpts contain options filtering Images returned from a call to ListDetail.

func (ListOpts) ToImageListQuery

func (opts ListOpts) ToImageListQuery() (string, error)

ToImageListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToImageListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the ListDetail request.

Directories

Path Synopsis
images unit tests
images unit tests

Jump to

Keyboard shortcuts

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