api

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Prefix   = "/elemental"
	PrefixV1 = "/v1"
)

Prefixes.

Variables

This section is empty.

Functions

func WithDecoration

func WithDecoration(description string, contentType string, httpStatus int) func(cu *openapi.ContentUnit)

func WriteResponse

func WriteResponse(logger logr.Logger, writer http.ResponseWriter, response string)

WriteResponse is the same wrapper as WriteResponseBytes, but accepts []byte as input.

func WriteResponseBytes

func WriteResponseBytes(logger logr.Logger, writer http.ResponseWriter, response []byte)

WriteResponseBytes is a wrapper to handle HTTP response writing errors with logging.

Types

type BootstrapGetRequest

type BootstrapGetRequest struct {
	Namespace        string `path:"namespace"`
	RegistrationName string `path:"registrationName"`
	HostName         string `path:"hostName"`
}

type BootstrapResponse

type BootstrapResponse struct {
	Files    []WriteFile `json:"write_files" yaml:"write_files"` //nolint:tagliatelle //Matching cloud-init schema
	Commands []string    `json:"runcmd" yaml:"runcmd"`
}

type DeleteElementalHostHandler

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

func NewDeleteElementalHostHandler

func NewDeleteElementalHostHandler(logger logr.Logger, k8sClient client.Client) *DeleteElementalHostHandler

func (*DeleteElementalHostHandler) ServeHTTP

func (h *DeleteElementalHostHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*DeleteElementalHostHandler) SetupOpenAPIOperation

func (h *DeleteElementalHostHandler) SetupOpenAPIOperation(oc openapi.OperationContext) error

type GetElementalHostBootstrapHandler

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

func NewGetElementalHostBootstrapHandler

func NewGetElementalHostBootstrapHandler(logger logr.Logger, k8sClient client.Client) *GetElementalHostBootstrapHandler

func (*GetElementalHostBootstrapHandler) ServeHTTP

func (h *GetElementalHostBootstrapHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*GetElementalHostBootstrapHandler) SetupOpenAPIOperation

func (h *GetElementalHostBootstrapHandler) SetupOpenAPIOperation(oc openapi.OperationContext) error

type GetElementalRegistrationHandler

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

func NewGetElementalRegistrationHandler

func NewGetElementalRegistrationHandler(logger logr.Logger, k8sClient client.Client) *GetElementalRegistrationHandler

func (*GetElementalRegistrationHandler) ServeHTTP

func (h *GetElementalRegistrationHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*GetElementalRegistrationHandler) SetupOpenAPIOperation

func (h *GetElementalRegistrationHandler) SetupOpenAPIOperation(oc openapi.OperationContext) error

type HostCreateRequest

type HostCreateRequest struct {
	Namespace        string `path:"namespace"`
	RegistrationName string `path:"registrationName"`

	Name        string            `json:"name,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
}

type HostDeleteRequest

type HostDeleteRequest struct {
	Namespace        string `path:"namespace"`
	RegistrationName string `path:"registrationName"`
	HostName         string `path:"hostName"`
}

type HostPatchRequest

type HostPatchRequest struct {
	Namespace        string `path:"namespace"`
	RegistrationName string `path:"registrationName"`
	HostName         string `path:"hostName"`

	Annotations  map[string]string `json:"annotations,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
	Bootstrapped *bool             `json:"bootstrapped,omitempty"`
	Installed    *bool             `json:"installed,omitempty"`
	Reset        *bool             `json:"reset,omitempty"`
}

type HostResponse

type HostResponse struct {
	Name           string            `json:"name,omitempty"`
	Annotations    map[string]string `json:"annotations,omitempty"`
	Labels         map[string]string `json:"labels,omitempty"`
	BootstrapReady bool              `json:"bootstrapReady,omitempty"`
	Bootstrapped   bool              `json:"bootstrapped,omitempty"`
	Installed      bool              `json:"installed,omitempty"`
	NeedsReset     bool              `json:"needsReset,omitempty"`
}

type OpenAPIDecoratedHandler

type OpenAPIDecoratedHandler interface {
	SetupOpenAPIOperation(oc openapi.OperationContext) error
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

type PatchElementalHostHandler

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

func NewPatchElementalHostHandler

func NewPatchElementalHostHandler(logger logr.Logger, k8sClient client.Client) *PatchElementalHostHandler

func (*PatchElementalHostHandler) ServeHTTP

func (h *PatchElementalHostHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*PatchElementalHostHandler) SetupOpenAPIOperation

func (h *PatchElementalHostHandler) SetupOpenAPIOperation(oc openapi.OperationContext) error

type PostElementalHostHandler

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

func NewPostElementalHostHandler

func NewPostElementalHostHandler(logger logr.Logger, k8sClient client.Client) *PostElementalHostHandler

func (*PostElementalHostHandler) ServeHTTP

func (h *PostElementalHostHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*PostElementalHostHandler) SetupOpenAPIOperation

func (h *PostElementalHostHandler) SetupOpenAPIOperation(oc openapi.OperationContext) error

type RegistrationGetRequest

type RegistrationGetRequest struct {
	Namespace        string `path:"namespace"`
	RegistrationName string `path:"registrationName"`
}

type RegistrationResponse

type RegistrationResponse struct {
	// HostLabels are labels propagated to each ElementalHost object linked to this registration.
	// +optional
	HostLabels map[string]string `json:"hostLabels,omitempty"`
	// HostAnnotations are labels propagated to each ElementalHost object linked to this registration.
	// +optional
	HostAnnotations map[string]string `json:"hostAnnotations,omitempty"`
	// Config points to Elemental machine configuration.
	// +optional
	Config infrastructurev1beta1.Config `json:"config,omitempty"`
}

type Server

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

func NewServer

func NewServer(ctx context.Context, k8sClient client.Client, port uint) *Server

func (*Server) NewRouter

func (s *Server) NewRouter() *mux.Router

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

type WriteFile

type WriteFile struct {
	Path        string `json:"path" yaml:"path"`
	Owner       string `json:"owner" yaml:"owner"`
	Permissions string `json:"permissions" yaml:"permissions"`
	Content     string `json:"content" yaml:"content"`
}

Jump to

Keyboard shortcuts

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