api

package
v0.0.0-...-2215086 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureValidator

func ConfigureValidator(providers []string, ci types.CloudInfo, logger cloudinfo.Logger) error

ConfigureValidator configures the Gin validator with custom validator functions

func ValidatePathData

func ValidatePathData(pathParams interface{}) error

ValidatePathData explicitly calls validation on the parsed path data structs

Types

type AttributeResponse

type AttributeResponse struct {
	AttributeName   string    `json:"attributeName"`
	AttributeValues []float64 `json:"attributeValues"`
}

AttributeResponse holds attribute values swagger:model AttributeResponse

type Classifier

type Classifier interface {
	// Classify classifies the passed in struct based on arbitrary, implementation specific criteria
	Classify(in interface{}) (interface{}, error)
}

Classifier represents a contract to classify passed in structs

func NewErrorClassifier

func NewErrorClassifier() Classifier

NewErrorClassifier returns a reference to a classifier instance

type Continent

type Continent struct {
	Name    string         `json:"name"`
	Regions []types.Region `json:"regions"`
}

Continent holds continent and regions of a cloud provider

type ContinentsDataResponse

type ContinentsDataResponse []Continent

ContinentsDataResponse holds the list of available continents and regions of a cloud provider swagger:model ContinentsDataResponse

type ContinentsResponse

type ContinentsResponse []string

ContinentsResponse holds the list of available continents swagger:model ContinentsResponse

func NewContinentsResponse

func NewContinentsResponse(continents []string) ContinentsResponse

NewContinentsResponse assembles a new continents response

type GetAttributeValuesPathParams

type GetAttributeValuesPathParams struct {
	GetRegionPathParams `binding:"required" mapstructure:",squash"`
	// in:path
	Attribute string `binding:"required,attribute" json:"attribute"`
}

GetAttributeValuesPathParams is a placeholder for the get attribute values route's path parameters swagger:parameters getAttrValues

type GetImagesQueryParams

type GetImagesQueryParams struct {
	// in:query
	Gpu string `json:"gpu"`
	// in:query
	Cr string `json:"cr"`
	// in:query
	Version string `json:"version"`
	// in:query
	Os string `json:"os,omitempty"`
	// in:query
	PkeVersion string `json:"pkeVersion,omitempty"`
	// in:query
	LatestOnly string `json:"latestOnly"`
}

GetImagesQueryParams is a placeholder for the get images query parameters swagger:parameters getImages

type GetProviderPathParams

type GetProviderPathParams struct {
	// in:path
	Provider string `binding:"required,provider" json:"provider"`
}

GetProviderPathParams is a placeholder for the providers related route path parameters swagger:parameters getServices getProvider

type GetRegionPathParams

type GetRegionPathParams struct {
	GetServicesPathParams `binding:"required" mapstructure:",squash"`
	// in:path
	Region string `binding:"required,region" json:"region"`
}

GetRegionPathParams is a placeholder for the regions related route path parameters swagger:parameters getRegion getImages getProducts getVersions

type GetRegionResp

type GetRegionResp struct {
	Id    string   `json:"id"`
	Name  string   `json:"name"`
	Zones []string `json:"zones"`
}

GetRegionResp holds the detailed description of a specific region of a cloud provider swagger:model GetRegionResp

type GetServicesPathParams

type GetServicesPathParams struct {
	GetProviderPathParams `binding:"required" mapstructure:",squash"`
	// in:path
	Service string `binding:"required,service" json:"service"`
}

GetServicesPathParams is a placeholder for the services related route path parameters swagger:parameters getRegions getService getContinentsData

type ImagesResponse

type ImagesResponse []types.Image

ImagesResponse holds the list of available images swagger:model ImagesResponse

type ProductDetailsResponse

type ProductDetailsResponse struct {
	// Products represents a slice of products for a given provider (VMs with attributes and process)
	Products []types.ProductDetails `json:"products"`
	// ScrapingTime represents scraping time for a given provider in milliseconds
	ScrapingTime string `json:"scrapingTime"`
}

ProductDetailsResponse Api object to be mapped to product info response swagger:model ProductDetailsResponse

type ProviderResponse

type ProviderResponse struct {
	Provider types.Provider `json:"provider"`
}

ProviderResponse is the response used for the requested provider swagger:model ProviderResponse

type ProvidersResponse

type ProvidersResponse struct {
	Providers []types.Provider `json:"providers"`
}

ProvidersResponse is the response used for the supported providers swagger:model ProvidersResponse

type RegionsResponse

type RegionsResponse []types.Region

RegionsResponse holds the list of available regions of a cloud provider swagger:model RegionsResponse

type Responder

type Responder interface {
	// Respond implements the responding logic / it's intended to be self-contained
	Respond(ginCtx *gin.Context, err error)
}

Responder marks responders

func NewErrorResponder

func NewErrorResponder() Responder

NewErrorResponder configures a new error responder

type RouteHandler

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

RouteHandler configures the REST API routes in the gin router

func NewRouteHandler

func NewRouteHandler(p types.CloudInfo, bi buildinfo.BuildInfo, graphqlHandler http.Handler, log cloudinfo.Logger) *RouteHandler

NewRouteHandler creates a new RouteHandler and returns a reference to it

func (*RouteHandler) ConfigureRoutes

func (r *RouteHandler) ConfigureRoutes(router *gin.Engine, basePath string)

ConfigureRoutes configures the gin engine, defines the rest API for this application

func (*RouteHandler) EnableMetrics

func (r *RouteHandler) EnableMetrics(router *gin.Engine, metricsAddr string)

type ServiceResponse

type ServiceResponse struct {
	Service types.Service `json:"service"`
}

ServiceResponse holds the list of available services swagger:model ServiceResponse

func NewServiceResponse

func NewServiceResponse(sd types.Service) ServiceResponse

NewServiceResponse assembles a service response

type ServicesResponse

type ServicesResponse struct {
	Services []types.Service `json:"services"`
}

ServicesResponse holds the list of available services swagger:model ServicesResponse

func NewServicesResponse

func NewServicesResponse(sds []types.Service) ServicesResponse

NewServicesResponse assembles a new services respons

type VersionsResponse

type VersionsResponse []types.LocationVersion

VersionsResponse holds the list of available versions swagger:model VersionsResponse

Jump to

Keyboard shortcuts

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