rest

package
v2.2.14 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Overview

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	ActiveProjectIdHeaderKey             = "Activeprojectid"
	ActiveProjectIdContextKey ContextKey = ActiveProjectIdHeaderKey
	ClusterNameSelectorKey               = "cluster.x-k8s.io/cluster-name"
)
View Source
const MaxClusters = math.MaxInt32 // Maximum value for int32

Variables

View Source
var JwtTokenWithM2MAdminFunc = auth.JwtTokenWithM2M

JwtTokenWithM2MAdminFunc gets admin tokens for managing token ttl settings. This is separate from the user token function so tests can track calls independently

View Source
var JwtTokenWithM2MFunc = auth.JwtTokenWithM2M

JwtTokenWithM2MFunc is used for renewing the user-facing kubeconfig token

View Source
var (
	NotImplementedError = errors.New("not implemented")
)

Functions

func WithAuth

func WithAuth(auth Authenticator) func(*Server)

WithAuth is a functional option for configuring a Server with an Authenticator

func WithConfig

func WithConfig(cfg *config.Config) func(*Server)

WithConfig is a functional option for configuring a Server with a Config

func WithInventory

func WithInventory(inv Inventory) func(*Server)

WithInventory is a functional option for configuring a Server with an InventoryClient

Types

type Authenticator

type Authenticator interface {
	Authenticate(ctx context.Context, input *openapi3filter.AuthenticationInput) error
}

Authenticator is an interface that can be used to authenticate requests

func GetAuthenticator

func GetAuthenticator(cfg *config.Config) (Authenticator, error)

type ContextKey

type ContextKey string

type Inventory

type Inventory interface {
	GetHostTrustedCompute(ctx context.Context, tenantId, hostUuid string) (bool, error)
	IsImmutable(ctx context.Context, tenantId, hostUuid string) (bool, error)
}

func GetInventory

func GetInventory(cfg *config.Config, k8sClient *k8s.Client) (Inventory, error)

type Provider

type Provider interface {
	GetSigningKey(kid string) (interface{}, error)
}

Provider is an interface that can be used with an Authenticator to verify tokens

type Server

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

func NewServer

func NewServer(k8sclient dynamic.Interface, options ...func(*Server)) *Server

NewServer creates a new Server instance

func (*Server) ConfigureHandler

func (s *Server) ConfigureHandler() (http.Handler, error)

ConfigureHandler configures the server with necessary middleware and handlers

func (*Server) DeleteV2ClustersName

(DELETE /v2/clusters/{name})

func (*Server) DeleteV2ClustersNameNodesNodeId

(DELETE /v2/clusters/{name}/nodes/{nodeId})

func (*Server) DeleteV2TemplatesNameVersion

(DELETE /v2/templates/{name}/{version})

func (*Server) GetV2Clusters

(GET /v2/clusters)

func (*Server) GetV2ClustersName

(GET /v2/clusters/{name})

func (*Server) GetV2ClustersNameKubeconfigs

(GET /v2/clusters/{name}/kubeconfigs)

func (*Server) GetV2ClustersNodeIdClusterdetail

(GET /v2/clusters/{nodeId}/clusterdetail)

func (*Server) GetV2ClustersSummary

(GET /v2/clusters/summary)

func (*Server) GetV2Healthz

(GET /v2/healthz) TODO: remove healthz from oapi code generation and implement separately to the generated server handler

func (*Server) GetV2Templates

(GET /v2/templates)

func (*Server) GetV2TemplatesNameVersion

(GET /v2/templates/{name}/{version})

func (*Server) GetV2TemplatesNameVersions

(GET /v2/templates/{name}/versions)

func (*Server) PostV2Clusters

(POST /v2/clusters)

func (*Server) PostV2Templates

(POST /v2/templates)

func (*Server) PutV2ClustersNameLabels

(PUT /v2/clusters/{name}/labels)

func (*Server) PutV2ClustersNameNodes

(PUT /v2/clusters/{name}/nodes)

func (*Server) PutV2ClustersNameTemplate

(PUT /v2/clusters/{name}/template)

func (*Server) PutV2TemplatesNameDefault

(PUT /v2/templates/{name}/default)

func (*Server) Serve

func (s *Server) Serve() error

Serve starts the server

Jump to

Keyboard shortcuts

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