v1

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// LatestTemplateBuild is used to find the template with the highest build number
	LatestTemplateBuild = "latest"
)

Variables

View Source
var (
	// ErrFailedToParseTemplateBuildNumber is returned when the template build couldn't be converted to an int
	ErrFailedToParseTemplateBuildNumber = errors.New("failed to parse template build number")
)
View Source
var (
	// ErrTemplateNotFound is returned when the named template was not found at a given location
	ErrTemplateNotFound = fmt.Errorf("%w: named template was not found at specified location", api.ErrNotFound)
)
View Source
var (
	// ErrTemplateOperationNotSupported is returned if operations other than Get and List are performed
	ErrTemplateOperationNotSupported = fmt.Errorf("%w: Template only supports Get and List operations", api.ErrOperationNotSupported)
)

Functions

This section is empty.

Types

type Template

type Template struct {
	Identifier string          `json:"id" anxcloud:"identifier"`
	Name       string          `json:"name"`
	Bit        string          `json:"bit"`
	Build      string          `json:"build"`
	Location   corev1.Location `json:"-"`
	Type       TemplateType    `json:"-"`
}

Template represents a vSphere template used for vm provisioning

func FindNamedTemplate

func FindNamedTemplate(ctx context.Context, a api.API, name, build string, location corev1.Location) (*Template, error)

FindNamedTemplate retrieves a template by name and build at a specified location. Empty and LatestTemplateBuild build identifier will yield the highest available build. It returns ErrTemplateNotFound if no matching template was found.

func (*Template) BuildNumber

func (t *Template) BuildNumber() (int, error)

BuildNumber returns the parsed build number

func (*Template) DecodeAPIResponse

func (t *Template) DecodeAPIResponse(ctx context.Context, data io.Reader) error

DecodeAPIResponse is used to filter a single template on Get operations

func (*Template) EndpointURL

func (t *Template) EndpointURL(ctx context.Context) (*url.URL, error)

EndpointURL returns the URL where to retrieve objects of type Template (only Get and List operations supported)

func (*Template) FilterRequestURL

func (t *Template) FilterRequestURL(ctx context.Context, url *url.URL) (*url.URL, error)

FilterRequestURL removes the Identifier from URL on Get operations (template needs to be parsed from list response)

func (*Template) GetIdentifier

func (o *Template) GetIdentifier(ctx context.Context) (string, error)

GetIdentifier returns the primary identifier of a Template object

func (*Template) HasPagination

func (t *Template) HasPagination(ctx context.Context) (bool, error)

HasPagination disables pagination for Template API (not supported by engine)

type TemplateType

type TemplateType string

TemplateType specifies the type of template

const (
	// TypeTemplate is used for prebuilt templates
	TypeTemplate TemplateType = "templates"

	// TypeFromScratch is used for custom templates
	TypeFromScratch TemplateType = "from_scratch"
)

Jump to

Keyboard shortcuts

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