imageimport

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: Apache-2.0 Imports: 1 Imported by: 21

Documentation

Overview

Package imageimport enables management of images import and retrieval of the Imageservice Import API information.

Example to Get an information about the Import API

importInfo, err := imageimport.Get(imagesClient).Extract()
if err != nil {
  panic(err)
}

fmt.Printf("%+v\n", importInfo)

Example to Create a new image import

opts := imageimport.CreateOpts{
  Name: imageimport.WebDownloadMethod,
  URI:  "http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img",
}
imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea"

err := imageimport.Create(imagesClient, imageID, opts).ExtractErr()
if err != nil {
  panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOpts

type CreateOpts struct {
	Name ImportMethod `json:"name"`
	URI  string       `json:"uri"`
}

CreateOpts specifies parameters of a new image import.

func (CreateOpts) ToImportCreateMap

func (opts CreateOpts) ToImportCreateMap() (map[string]interface{}, error)

ToImportCreateMap constructs a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToImportCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows to add additional parameters to the Create request.

type CreateResult

type CreateResult struct {
	gophercloud.ErrResult
}

CreateResult is the result of import Create operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Create

func Create(client *gophercloud.ServiceClient, imageID string, opts CreateOptsBuilder) (r CreateResult)

Create requests the creation of a new image import on the server.

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

GetResult represents the result of a get operation. Call its Extract method to interpret it as ImportInfo.

func Get

Get retrieves Import API information data.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts ImportInfo.

type ImportInfo

type ImportInfo struct {
	ImportMethods ImportMethods `json:"import-methods"`
}

ImportInfo represents information data for the Import API.

type ImportMethod

type ImportMethod string

ImportMethod represents valid Import API method.

const (
	// GlanceDirectMethod represents glance-direct Import API method.
	GlanceDirectMethod ImportMethod = "glance-direct"

	// WebDownloadMethod represents web-download Import API method.
	WebDownloadMethod ImportMethod = "web-download"
)

type ImportMethods

type ImportMethods struct {
	Description string   `json:"description"`
	Type        string   `json:"type"`
	Value       []string `json:"value"`
}

ImportMethods contains information about available Import API methods.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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