platform

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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACP

type ACP struct {
	Name string `json:"name"`
}

ACP defines the ACP attached to the edge ingress.

type APIError

type APIError struct {
	StatusCode int    `json:"statusCode"`
	Message    string `json:"error"`
}

APIError represents an error returned by the API.

func (APIError) Error

func (a APIError) Error() string

type APIService added in v1.2.0

type APIService struct {
	Name        string      `json:"name"`
	Port        int         `json:"port"`
	OpenAPISpec OpenAPISpec `json:"openApiSpec"`
}

APIService is a service used in API struct.

type Client

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

Client allows interacting with the cluster service.

func NewClient

func NewClient(baseURL, token string) (*Client, error)

NewClient creates a new client for the cluster service.

func (*Client) CreateACP

func (c *Client) CreateACP(ctx context.Context, policy *hubv1alpha1.AccessControlPolicy) (*acp.ACP, error)

CreateACP creates an AccessControlPolicy.

func (*Client) CreateAPI added in v1.2.0

func (c *Client) CreateAPI(ctx context.Context, createReq *CreateAPIReq) (*api.API, error)

CreateAPI creates an API.

func (*Client) CreateAccess added in v1.2.0

func (c *Client) CreateAccess(ctx context.Context, createReq *CreateAccessReq) (*api.Access, error)

CreateAccess creates an API access.

func (*Client) CreateCollection added in v1.2.0

func (c *Client) CreateCollection(ctx context.Context, createReq *CreateCollectionReq) (*api.Collection, error)

CreateCollection creates a collection.

func (*Client) CreateEdgeIngress

func (c *Client) CreateEdgeIngress(ctx context.Context, createReq *CreateEdgeIngressReq) (*edgeingress.EdgeIngress, error)

CreateEdgeIngress creates an edge ingress.

func (*Client) CreateGateway added in v1.2.0

func (c *Client) CreateGateway(ctx context.Context, createReq *CreateGatewayReq) (*api.Gateway, error)

CreateGateway creates a gateway.

func (*Client) CreatePortal added in v1.2.0

func (c *Client) CreatePortal(ctx context.Context, createReq *CreatePortalReq) (*api.Portal, error)

CreatePortal creates a portal.

func (*Client) DeleteACP

func (c *Client) DeleteACP(ctx context.Context, oldVersion, name string) error

DeleteACP deletes an AccessControlPolicy.

func (*Client) DeleteAPI added in v1.2.0

func (c *Client) DeleteAPI(ctx context.Context, namespace, name, lastKnownVersion string) error

DeleteAPI deletes an API.

func (*Client) DeleteAccess added in v1.2.0

func (c *Client) DeleteAccess(ctx context.Context, name, lastKnownVersion string) error

DeleteAccess deletes an API access.

func (*Client) DeleteCollection added in v1.2.0

func (c *Client) DeleteCollection(ctx context.Context, name, lastKnownVersion string) error

DeleteCollection deletes a collection.

func (*Client) DeleteEdgeIngress

func (c *Client) DeleteEdgeIngress(ctx context.Context, namespace, name, lastKnownVersion string) error

DeleteEdgeIngress deletes an edge ingress.

func (*Client) DeleteGateway added in v1.2.0

func (c *Client) DeleteGateway(ctx context.Context, name, lastKnownVersion string) error

DeleteGateway deletes a gateway.

func (*Client) DeletePortal added in v1.2.0

func (c *Client) DeletePortal(ctx context.Context, name, lastKnownVersion string) error

DeletePortal deletes a portal.

func (*Client) FetchTopology added in v0.5.0

func (c *Client) FetchTopology(ctx context.Context) (topology state.Cluster, topoVersion int64, err error)

FetchTopology fetches the topology.

func (*Client) GetACPs

func (c *Client) GetACPs(ctx context.Context) ([]acp.ACP, error)

GetACPs returns the ACPs related to the agent.

func (*Client) GetAPIs added in v1.2.0

func (c *Client) GetAPIs(ctx context.Context) ([]api.API, error)

GetAPIs fetches the APIs available for this agent.

func (*Client) GetAccesses added in v1.2.0

func (c *Client) GetAccesses(ctx context.Context) ([]api.Access, error)

GetAccesses fetches the accesses available for this agent.

func (*Client) GetCertificateByDomains added in v0.5.0

func (c *Client) GetCertificateByDomains(ctx context.Context, domains []string) (edgeingress.Certificate, error)

GetCertificateByDomains gets a certificate for the given domains.

func (*Client) GetCollections added in v1.2.0

func (c *Client) GetCollections(ctx context.Context) ([]api.Collection, error)

GetCollections fetches the collections available for this agent.

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context) (Config, error)

GetConfig returns the agent configuration.

func (*Client) GetEdgeIngresses

func (c *Client) GetEdgeIngresses(ctx context.Context) ([]edgeingress.EdgeIngress, error)

GetEdgeIngresses returns the EdgeIngresses related to the agent.

func (*Client) GetGateways added in v1.2.0

func (c *Client) GetGateways(ctx context.Context) ([]api.Gateway, error)

GetGateways fetches the gateways available for this agent.

func (*Client) GetPortals added in v1.2.0

func (c *Client) GetPortals(ctx context.Context) ([]api.Portal, error)

GetPortals fetches the portals available for this agent.

func (*Client) GetWildcardCertificate added in v0.5.0

func (c *Client) GetWildcardCertificate(ctx context.Context) (edgeingress.Certificate, error)

GetWildcardCertificate gets a certificate for the workspace.

func (c *Client) Link(ctx context.Context, kubeID string) (string, error)

Link links the agent to the given Kubernetes ID.

func (*Client) ListPendingCommands added in v0.6.0

func (c *Client) ListPendingCommands(ctx context.Context) ([]Command, error)

ListPendingCommands fetches the commands to apply on the cluster.

func (*Client) ListVerifiedDomains

func (c *Client) ListVerifiedDomains(ctx context.Context) ([]string, error)

ListVerifiedDomains list verified domains.

func (*Client) PatchTopology added in v0.5.0

func (c *Client) PatchTopology(ctx context.Context, patch []byte, lastKnownVersion int64) (int64, error)

PatchTopology submits a JSON Merge Patch to the platform containing the difference in the topology since its last synchronization. The last known topology version must be provided. This version can be obtained by calling the FetchTopology method.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping sends a ping to the platform to inform that the agent is alive.

func (*Client) SetVersionStatus added in v0.6.0

func (c *Client) SetVersionStatus(ctx context.Context, status version.Status) error

SetVersionStatus sends the current version status to the platform.

func (*Client) SubmitCommandReports added in v0.6.0

func (c *Client) SubmitCommandReports(ctx context.Context, reports []CommandExecutionReport) error

SubmitCommandReports submits the given command execution reports.

func (*Client) UpdateACP

func (c *Client) UpdateACP(ctx context.Context, oldVersion string, policy *hubv1alpha1.AccessControlPolicy) (*acp.ACP, error)

UpdateACP updates an AccessControlPolicy.

func (*Client) UpdateAPI added in v1.2.0

func (c *Client) UpdateAPI(ctx context.Context, namespace, name, lastKnownVersion string, updateReq *UpdateAPIReq) (*api.API, error)

UpdateAPI updates an API.

func (*Client) UpdateAccess added in v1.2.0

func (c *Client) UpdateAccess(ctx context.Context, name, lastKnownVersion string, updateReq *UpdateAccessReq) (*api.Access, error)

UpdateAccess updates an API access.

func (*Client) UpdateCollection added in v1.2.0

func (c *Client) UpdateCollection(ctx context.Context, name, lastKnownVersion string, updateReq *UpdateCollectionReq) (*api.Collection, error)

UpdateCollection updates a collection.

func (*Client) UpdateEdgeIngress

func (c *Client) UpdateEdgeIngress(ctx context.Context, namespace, name, lastKnownVersion string, updateReq *UpdateEdgeIngressReq) (*edgeingress.EdgeIngress, error)

UpdateEdgeIngress updated an edge ingress.

func (*Client) UpdateGateway added in v1.2.0

func (c *Client) UpdateGateway(ctx context.Context, name, lastKnownVersion string, updateReq *UpdateGatewayReq) (*api.Gateway, error)

UpdateGateway updates a gateway.

func (*Client) UpdatePortal added in v1.2.0

func (c *Client) UpdatePortal(ctx context.Context, name, lastKnownVersion string, updateReq *UpdatePortalReq) (*api.Portal, error)

UpdatePortal updates a portal.

type Command added in v0.6.0

type Command struct {
	ID        string          `json:"id"`
	CreatedAt time.Time       `json:"createdAt"`
	Type      string          `json:"type"`
	Data      json.RawMessage `json:"data"`
}

Command defines patch operation to apply on the cluster.

type CommandExecutionReport added in v0.6.0

type CommandExecutionReport struct {
	ID     string                       `json:"id"`
	Status CommandExecutionStatus       `json:"status"`
	Error  *CommandExecutionReportError `json:"error,omitempty"`
}

CommandExecutionReport describes the output of a command execution.

func NewErrorCommandExecutionReport added in v0.6.0

func NewErrorCommandExecutionReport(id string, err CommandExecutionReportError) *CommandExecutionReport

NewErrorCommandExecutionReport creates a new CommandExecutionReport with a status CommandExecutionStatusFailure.

func NewSuccessCommandExecutionReport added in v0.6.0

func NewSuccessCommandExecutionReport(id string) *CommandExecutionReport

NewSuccessCommandExecutionReport creates a new CommandExecutionReport with a status CommandExecutionStatusSuccess.

type CommandExecutionReportError added in v0.6.0

type CommandExecutionReportError struct {
	// Type identifies the reason of the error.
	Type string `json:"type"`

	// Data is a freeform Type dependent value.
	Data interface{} `json:"data,omitempty"`
}

CommandExecutionReportError holds details about an execution failure.

type CommandExecutionStatus added in v0.6.0

type CommandExecutionStatus string

CommandExecutionStatus describes the execution status of a command.

const (
	CommandExecutionStatusSuccess CommandExecutionStatus = "success"
	CommandExecutionStatusFailure CommandExecutionStatus = "failure"
)

The different CommandExecutionStatus available.

type Config

type Config struct {
	Metrics  MetricsConfig `json:"metrics"`
	Features []string      `json:"features"`
}

Config holds the configuration of the offer.

type ConfigWatcher

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

ConfigWatcher watches hub agent configuration.

func NewConfigWatcher

func NewConfigWatcher(interval time.Duration, c *Client) *ConfigWatcher

NewConfigWatcher return a new ConfigWatcher.

func (*ConfigWatcher) AddListener

func (w *ConfigWatcher) AddListener(listener func(cfg Config))

AddListener adds a listeners to the ConfigWatcher.

func (*ConfigWatcher) Run

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

Run runs ConfigWatcher.

type CreateAPIReq added in v1.2.0

type CreateAPIReq struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`

	Labels map[string]string `json:"labels,omitempty"`

	PathPrefix string     `json:"pathPrefix"`
	Service    APIService `json:"service"`
}

CreateAPIReq is the request for creating an API.

type CreateAccessReq added in v1.2.0

type CreateAccessReq 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"`
}

CreateAccessReq is the request for creating an API access.

type CreateCollectionReq added in v1.2.0

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

CreateCollectionReq is the request for creating a collection.

type CreateEdgeIngressReq

type CreateEdgeIngressReq struct {
	Name          string   `json:"name"`
	Namespace     string   `json:"namespace"`
	Service       Service  `json:"service"`
	ACP           *ACP     `json:"acp,omitempty"`
	CustomDomains []string `json:"customDomains,omitempty"`
}

CreateEdgeIngressReq is the request for creating an edge ingress.

type CreateGatewayReq added in v1.2.0

type CreateGatewayReq struct {
	Name          string            `json:"name"`
	Labels        map[string]string `json:"labels"`
	Accesses      []string          `json:"accesses"`
	CustomDomains []string          `json:"customDomains"`
}

CreateGatewayReq is the request for creating a gateway.

type CreatePortalReq added in v1.2.0

type CreatePortalReq struct {
	Name          string   `json:"name"`
	Title         string   `json:"title"`
	Description   string   `json:"description"`
	Gateway       string   `json:"gateway"`
	CustomDomains []string `json:"customDomains"`
}

CreatePortalReq is the request for creating a portal.

type DomainCache

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

DomainCache caches the verified domains. It polls the domains from the platform at a given interval.

func NewDomainCache

func NewDomainCache(client *Client, ttl time.Duration) *DomainCache

NewDomainCache creates a new domain cache configured with a platform client and a polling interval.

func (*DomainCache) ListVerifiedDomains

func (d *DomainCache) ListVerifiedDomains(_ context.Context) []string

ListVerifiedDomains implements the validationwebhook.DomainLister interface.

func (*DomainCache) Run

func (d *DomainCache) Run(ctx context.Context)

Run starts polling the platform to refresh the cache. NOTE: The call is synchronous and could be start in a goroutine.

func (*DomainCache) WarmUp

func (d *DomainCache) WarmUp(ctx context.Context) error

WarmUp feeds the cache by calling the platform to get the verified domains. It returns an error for any issue with to the platform call.

type MetricsConfig

type MetricsConfig struct {
	Interval time.Duration `json:"interval"`
	Tables   []string      `json:"tables"`
}

MetricsConfig holds the metrics part of the offer config.

type OpenAPISpec added in v1.2.0

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

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

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

type Service

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

Service defines the service being exposed by the edge ingress.

type UpdateAPIReq added in v1.2.0

type UpdateAPIReq struct {
	Labels map[string]string `json:"labels,omitempty"`

	PathPrefix string     `json:"pathPrefix"`
	Service    APIService `json:"service"`
}

UpdateAPIReq is a request for updating an API.

type UpdateAccessReq added in v1.2.0

type UpdateAccessReq struct {
	Labels map[string]string `json:"labels,omitempty"`

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

UpdateAccessReq is a request for updating an API access.

type UpdateCollectionReq added in v1.2.0

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

UpdateCollectionReq is a request for updating a collection.

type UpdateEdgeIngressReq

type UpdateEdgeIngressReq struct {
	Service       Service  `json:"service"`
	ACP           *ACP     `json:"acp,omitempty"`
	CustomDomains []string `json:"customDomains,omitempty"`
}

UpdateEdgeIngressReq is a request for updating an edge ingress.

type UpdateGatewayReq added in v1.2.0

type UpdateGatewayReq struct {
	Labels        map[string]string `json:"labels"`
	Accesses      []string          `json:"accesses"`
	CustomDomains []string          `json:"customDomains"`
}

UpdateGatewayReq is a request for updating a gateway.

type UpdatePortalReq added in v1.2.0

type UpdatePortalReq struct {
	Title         string   `json:"title"`
	Description   string   `json:"description"`
	Gateway       string   `json:"gateway"`
	HubDomain     string   `json:"hubDomain"`
	CustomDomains []string `json:"customDomains"`
}

UpdatePortalReq is a request for updating a portal.

Jump to

Keyboard shortcuts

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