Documentation ¶
Index ¶
- Constants
- Variables
- type Template
- func (t *Template) BuildNumber() (int, error)
- func (t *Template) DecodeAPIResponse(ctx context.Context, data io.Reader) error
- func (t *Template) EndpointURL(ctx context.Context) (*url.URL, error)
- func (t *Template) FilterRequestURL(ctx context.Context, url *url.URL) (*url.URL, error)
- func (o *Template) GetIdentifier(ctx context.Context) (string, error)
- func (t *Template) HasPagination(ctx context.Context) (bool, error)
- type TemplateType
Constants ¶
const (
// LatestTemplateBuild is used to find the template with the highest build number
LatestTemplateBuild = "latest"
)
Variables ¶
var ( // ErrFailedToParseTemplateBuildNumber is returned when the template build couldn't be converted to an int ErrFailedToParseTemplateBuildNumber = errors.New("failed to parse template build number") )
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) )
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 ¶
BuildNumber returns the parsed build number
func (*Template) DecodeAPIResponse ¶
DecodeAPIResponse is used to filter a single template on Get operations
func (*Template) EndpointURL ¶
EndpointURL returns the URL where to retrieve objects of type Template (only Get and List operations supported)
func (*Template) FilterRequestURL ¶
FilterRequestURL removes the Identifier from URL on Get operations (template needs to be parsed from list response)
func (*Template) GetIdentifier ¶
GetIdentifier returns the primary identifier of a Template object
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" )