api

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashAPI

func HashAPI(a *hubv1alpha1.API) (string, error)

HashAPI generates the hash of the API.

func HashAccess

func HashAccess(a *hubv1alpha1.APIAccess) (string, error)

HashAccess generates the hash of the APIAccess.

func HashCollection

func HashCollection(c *hubv1alpha1.APICollection) (string, error)

HashCollection generates the hash of the APICollection.

func HashGateway

func HashGateway(g *hubv1alpha1.APIGateway) (string, error)

HashGateway generates the hash of the APIGateway.

func HashPortal

func HashPortal(p *hubv1alpha1.APIPortal) (string, error)

HashPortal generates the hash of the APIPortal.

Types

type API

type API struct {
	Name       string            `json:"name"`
	Namespace  string            `json:"namespace"`
	Labels     map[string]string `json:"labels,omitempty"`
	PathPrefix string            `json:"pathPrefix"`
	Service    Service           `json:"service"`

	Version string `json:"version"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

API is an API exposed within a portal.

func (*API) Resource

func (a *API) Resource() (*hubv1alpha1.API, error)

Resource builds the v1alpha1 API resource.

type Access

type Access struct {
	Name   string            `json:"name"`
	Labels map[string]string `json:"labels,omitempty"`

	Groups                []string              `json:"groups"`
	APISelector           *metav1.LabelSelector `json:"apiSelector,omitempty"`
	APICollectionSelector *metav1.LabelSelector `json:"apiCollectionSelector,omitempty"`

	Version string `json:"version"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Access defines who can access APIs.

func (*Access) Resource

func (a *Access) Resource() (*hubv1alpha1.APIAccess, error)

Resource builds the v1alpha1 APIAccess resource.

type Collection

type Collection struct {
	Name        string               `json:"name"`
	Labels      map[string]string    `json:"labels,omitempty"`
	PathPrefix  string               `json:"pathPrefix,omitempty"`
	APISelector metav1.LabelSelector `json:"apiSelector"`

	Version string `json:"version"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Collection is a collection of APIs exposed within an APIPortal.

func (*Collection) Resource

func (c *Collection) Resource() (*hubv1alpha1.APICollection, error)

Resource builds the v1alpha1 Collection resource.

type CustomDomain

type CustomDomain struct {
	Name     string `json:"name"`
	Verified bool   `json:"verified"`
}

CustomDomain holds domain information.

type Gateway

type Gateway struct {
	WorkspaceID string            `json:"workspaceId"`
	ClusterID   string            `json:"clusterId"`
	Name        string            `json:"name"`
	Labels      map[string]string `json:"labels,omitempty"`
	Accesses    []string          `json:"accesses,omitempty"`

	Version string `json:"version"`

	HubDomain     string         `json:"hubDomain,omitempty"`
	CustomDomains []CustomDomain `json:"customDomains,omitempty"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Gateway is a gateway that exposes a set of APIs.

func (*Gateway) Resource

func (g *Gateway) Resource() (*hubv1alpha1.APIGateway, error)

Resource builds the v1alpha1 APIGateway resource.

type OpenAPISpec

type OpenAPISpec struct {
	URL string `json:"url,omitempty" bson:"url,omitempty"`

	Path string `json:"path,omitempty" bson:"path,omitempty"`
	Port int    `json:"port,omitempty" bson:"port,omitempty"`
}

OpenAPISpec is an OpenAPISpec. It can either be fetched from a URL, or Path/Port from the service or directly in the Schema field.

type PlatformClient

type PlatformClient interface {
	GetPortals(ctx context.Context) ([]Portal, error)
	GetWildcardCertificate(ctx context.Context) (edgeingress.Certificate, error)
	GetCertificateByDomains(ctx context.Context, domains []string) (edgeingress.Certificate, error)
	GetGateways(ctx context.Context) ([]Gateway, error)
	GetAPIs(ctx context.Context) ([]API, error)
	GetCollections(ctx context.Context) ([]Collection, error)
	GetAccesses(ctx context.Context) ([]Access, error)
}

PlatformClient for the API service.

type Portal

type Portal struct {
	WorkspaceID string `json:"workspaceId"`
	ClusterID   string `json:"clusterId"`
	Name        string `json:"name"`

	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Gateway     string `json:"gateway"`

	HubDomain     string         `json:"hubDomain,omitempty"`
	CustomDomains []CustomDomain `json:"customDomains,omitempty"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	Version   string    `json:"version"`
}

Portal is a WebUI that exposes a set of OpenAPI specs.

func (*Portal) Resource

func (p *Portal) Resource() (*hubv1alpha1.APIPortal, error)

Resource builds the v1alpha1 APIPortal resource.

type Service

type Service struct {
	Name string `json:"name" bson:"name"`
	Port int    `json:"port" bson:"port"`

	OpenAPISpec OpenAPISpec `json:"openApiSpec,omitempty" bson:"openApiSpec,omitempty"`
}

Service is a Kubernetes Service.

type WatcherAPI

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

WatcherAPI watches hub APIs and sync them with the cluster.

func NewWatcherAPI

func NewWatcherAPI(client PlatformClient, hubClientSet hubclientset.Interface, hubInformer hubinformer.SharedInformerFactory, apiSyncInterval time.Duration) *WatcherAPI

NewWatcherAPI returns a new WatcherAPI.

func (*WatcherAPI) Run

func (w *WatcherAPI) Run(ctx context.Context)

Run runs WatcherAPI.

type WatcherAccess

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

WatcherAccess watches hub API accesses and sync them with the cluster.

func NewWatcherAccess

func NewWatcherAccess(client PlatformClient, hubClientSet hubclientset.Interface, hubInformer hubinformer.SharedInformerFactory, accessSyncInterval time.Duration) *WatcherAccess

NewWatcherAccess returns a new WatcherAccess.

func (*WatcherAccess) Run

func (w *WatcherAccess) Run(ctx context.Context)

Run runs WatcherAccess.

type WatcherCollection

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

WatcherCollection watches hub APICollections and sync them with the cluster.

func NewWatcherCollection

func NewWatcherCollection(client PlatformClient, hubClientSet hubclientset.Interface, hubInformer hubinformer.SharedInformerFactory, collectionSyncInterval time.Duration) *WatcherCollection

NewWatcherCollection returns a new WatcherCollection.

func (*WatcherCollection) Run

func (w *WatcherCollection) Run(ctx context.Context)

Run runs WatcherCollection.

type WatcherGateway

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

WatcherGateway watches hub gateways and sync them with the cluster.

func NewWatcherGateway

func NewWatcherGateway(client PlatformClient, kubeClientSet clientset.Interface, kubeInformer informers.SharedInformerFactory, hubClientSet hubclientset.Interface, hubInformer hubinformer.SharedInformerFactory, traefikClientSet v1alpha1.TraefikV1alpha1Interface, config *WatcherGatewayConfig) *WatcherGateway

NewWatcherGateway returns a new WatcherGateway.

func (*WatcherGateway) Run

func (w *WatcherGateway) Run(ctx context.Context)

Run runs WatcherGateway.

type WatcherGatewayConfig

type WatcherGatewayConfig struct {
	IngressClassName        string
	AgentNamespace          string
	TraefikAPIEntryPoint    string
	TraefikTunnelEntryPoint string

	GatewaySyncInterval time.Duration
	CertSyncInterval    time.Duration
	CertRetryInterval   time.Duration
}

WatcherGatewayConfig holds the watcher gateway configuration.

type WatcherPortal

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

WatcherPortal watches hub portals and sync them with the cluster.

func NewWatcherPortal

func NewWatcherPortal(client PlatformClient, kubeClientSet clientset.Interface, kubeInformer informers.SharedInformerFactory, hubClientSet hubclientset.Interface, hubInformer hubinformer.SharedInformerFactory, config *WatcherPortalConfig) *WatcherPortal

NewWatcherPortal returns a new WatcherPortal.

func (*WatcherPortal) Run

func (w *WatcherPortal) Run(ctx context.Context)

Run runs WatcherPortal.

type WatcherPortalConfig

type WatcherPortalConfig struct {
	IngressClassName        string
	AgentNamespace          string
	TraefikAPIEntryPoint    string
	TraefikTunnelEntryPoint string
	DevPortalServiceName    string
	DevPortalPort           int

	PortalSyncInterval time.Duration
	CertSyncInterval   time.Duration
	CertRetryInterval  time.Duration
}

WatcherPortalConfig holds the portal watcher configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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