models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package models contains shared models for the FLUIDOS environment.

Index

Constants

View Source
const (
	// RangeMinKey is the key for the identifier of the minimum value in a range.
	RangeMinKey = "min"
	// RangeMaxKey is the key for the identifier of the maximum value in a range.
	RangeMaxKey = "max"
)

Variables

This section is empty.

Functions

func MapFromFilterType added in v0.1.0

func MapFromFilterType(filterType FilterType) nodecorev1alpha1.FilterType

MapFromFilterType maps a models.FilterType to a nodecorev1alpha1.FilterType.

func MapFromFlavorTypeName added in v0.1.0

func MapFromFlavorTypeName(flavorType FlavorTypeName) nodecorev1alpha1.FlavorTypeIdentifier

MapFromFlavorTypeName maps a models.FlavorTypeName to a nodecorev1alpha1.FlavorTypeIdentifier.

func MapFromModelHostingPolicy added in v0.1.0

func MapFromModelHostingPolicy(hostingPolicy HostingPolicy) nodecorev1alpha1.HostingPolicy

MapFromModelHostingPolicy maps a models.HostingPolicy to a nodecorev1alpha1.HostingPolicy.

func MapToServiceCategory added in v0.1.0

func MapToServiceCategory(serviceCategory string) consts.ServiceCategory

MapToServiceCategory maps a string to a consts.ServiceCategory.

Types

type CIDRSelector added in v0.1.0

type CIDRSelector string

CIDRSelector represents the CIDR selector of a SourceDestination.

type CarbonFootprint added in v0.1.0

type CarbonFootprint struct {
	Embodied    int   `json:"embodied"`
	Operational []int `json:"operational"`
}

CarbonFootprint represents the carbon footprint of a Flavor, with embodied and operational values.

type Configuration added in v0.1.0

type Configuration struct {
	Type FlavorTypeName  `json:"type"`
	Data json.RawMessage `json:"data"`
}

Configuration represents the configuration properties of a Flavor.

type ConfigurationData added in v0.1.0

type ConfigurationData interface {
	GetConfigurationType() FlavorTypeName
}

ConfigurationData represents the data of a Configuration.

type Contract

type Contract struct {
	ContractID               string            `json:"contractID"`
	TransactionID            string            `json:"transactionID"`
	Flavor                   Flavor            `json:"flavor"`
	Buyer                    NodeIdentity      `json:"buyerID"`
	BuyerClusterID           string            `json:"buyerClusterID"`
	Seller                   NodeIdentity      `json:"seller"`
	PeeringTargetCredentials LiqoCredentials   `json:"peeringTargetCredentials"`
	ExpirationTime           string            `json:"expirationTime,omitempty"`
	ExtraInformation         map[string]string `json:"extraInformation,omitempty"`
	Configuration            *Configuration    `json:"configuration,omitempty"`
	NetworkRequests          string            `json:"networkAuthorizations,omitempty"`
}

Contract represents a Contract object with its characteristics.

type FilterType added in v0.1.0

type FilterType string

FilterType represents the type of a Filter.

const (
	// MatchFilter is the identifier for a match filter.
	MatchFilter FilterType = "Match"
	// RangeFilter is the identifier for a range filter.
	RangeFilter FilterType = "Range"
)

func MapToFilterType added in v0.1.0

func MapToFilterType(filterType nodecorev1alpha1.FilterType) FilterType

MapToFilterType maps a nodecorev1alpha1.FilterType to a models.FilterType.

type Flavor added in v0.1.0

type Flavor struct {
	FlavorID            string       `json:"flavorID"`
	ProviderID          string       `json:"providerID"`
	Type                FlavorType   `json:"type"`
	NetworkPropertyType string       `json:"networkPropertyType,omitempty"`
	Timestamp           time.Time    `json:"timestamp"`
	Location            *Location    `json:"location,omitempty"`
	Price               Price        `json:"price"`
	Owner               NodeIdentity `json:"owner"`
	Availability        bool         `json:"availability"`
}

Flavor represents a Flavor object with its characteristics and policies.

type FlavorType added in v0.1.0

type FlavorType struct {
	Name FlavorTypeName  `json:"name"`
	Data json.RawMessage `json:"data"`
}

FlavorType represents the type of a Flavor.

type FlavorTypeData added in v0.1.0

type FlavorTypeData interface {
	GetFlavorTypeName() FlavorTypeName
}

FlavorTypeData represents the data of a FlavorType.

type FlavorTypeName added in v0.1.0

type FlavorTypeName string

FlavorTypeName represents the name of a FlavorType.

const (
	// K8SliceNameDefault is the default name for a K8Slice Flavor.
	K8SliceNameDefault FlavorTypeName = "k8slice"
	// VMNameDefault is the default name for a VM Flavor.
	VMNameDefault FlavorTypeName = "vm"
	// ServiceNameDefault is the default name for a Service Flavor.
	ServiceNameDefault FlavorTypeName = "service"
	// SensorNameDefault is the default name for a Sensor Flavor.
	SensorNameDefault FlavorTypeName = "sensor"
)

func MapToFlavorTypeName added in v0.1.0

func MapToFlavorTypeName(flavorType nodecorev1alpha1.FlavorTypeIdentifier) FlavorTypeName

MapToFlavorTypeName maps a nodecorev1alpha1.FlavorTypeIdentifier to a models.FlavorTypeName.

type GPUMetrics added in v0.1.0

type GPUMetrics struct {
	Model           string            `json:"model"`
	CoresTotal      resource.Quantity `json:"totalCores"`
	CoresAvailable  resource.Quantity `json:"availableCores"`
	MemoryTotal     resource.Quantity `json:"totalMemory"`
	MemoryAvailable resource.Quantity `json:"availableMemory"`
}

GPUMetrics represents GPU metrics.

type GpuCharacteristics added in v0.1.0

type GpuCharacteristics struct {
	Model  string            `json:"model"`
	Cores  resource.Quantity `json:"cores"`
	Memory resource.Quantity `json:"memory"`
}

GpuCharacteristics represents the characteristics of a Gpu.

func (*GpuCharacteristics) Cmp added in v0.1.0

func (gpu *GpuCharacteristics) Cmp(other *nodecorev1alpha1.GPU) int

Cmp compares models.GpuCharacteristics with nodecorev1alpha1.GPU.

type HostingPolicy added in v0.1.0

type HostingPolicy string

HostingPolicy represents the hosting policy chosen for the service.

const (
	// HostingPolicyProvider represents the hosting policy where the service will be hosted by a provider.
	HostingPolicyProvider HostingPolicy = "Provider"
	// HostingPolicyConsumer represents the hosting policy where the service will be hosted by a consumer.
	HostingPolicyConsumer HostingPolicy = "Consumer"
	// HostingPolicyShared represents the hosting policy where the service can be hosted by both provider and consumer
	// and the exact hosting policy is not defined.
	HostingPolicyShared HostingPolicy = "Shared"
)

func MapToModelHostingPolicy added in v0.1.0

func MapToModelHostingPolicy(hostingPolicy nodecorev1alpha1.HostingPolicy) HostingPolicy

MapToModelHostingPolicy maps a nodecorev1alpha1.HostingPolicy to a models.HostingPolicy.

type K8Slice added in v0.1.0

type K8Slice struct {
	Characteristics K8SliceCharacteristics `json:"charateristics"`
	Properties      K8SliceProperties      `json:"properties"`
	Policies        K8SlicePolicies        `json:"policies"`
}

K8Slice represents a Kubernetes slice.

func (K8Slice) GetFlavorTypeName added in v0.1.0

func (K8Slice) GetFlavorTypeName() FlavorTypeName

GetFlavorTypeName returns the type of the Flavor.

type K8SliceCharacteristics added in v0.1.0

type K8SliceCharacteristics struct {
	Architecture string              `json:"architecture"`
	CPU          resource.Quantity   `json:"cpu"`
	Memory       resource.Quantity   `json:"memory"`
	Pods         resource.Quantity   `json:"pods"`
	Gpu          *GpuCharacteristics `json:"gpu,omitempty"`
	Storage      *resource.Quantity  `json:"storage,omitempty"`
}

K8SliceCharacteristics represents the characteristics of a Kubernetes slice.

type K8SliceConfiguration added in v0.1.0

type K8SliceConfiguration struct {
	CPU     resource.Quantity   `json:"cpu"`
	Memory  resource.Quantity   `json:"memory"`
	Pods    resource.Quantity   `json:"pods"`
	Gpu     *GpuCharacteristics `json:"gpu,omitempty"`
	Storage *resource.Quantity  `json:"storage,omitempty"`
}

K8SliceConfiguration represents the configuration properties of a K8Slice Flavor.

func (*K8SliceConfiguration) GetConfigurationType added in v0.1.0

func (p *K8SliceConfiguration) GetConfigurationType() FlavorTypeName

GetConfigurationType returns the type of the Configuration.

type K8SlicePartitionability added in v0.1.0

type K8SlicePartitionability struct {
	CPUMin     resource.Quantity `json:"cpuMin"`
	MemoryMin  resource.Quantity `json:"memoryMin"`
	PodsMin    resource.Quantity `json:"podsMin"`
	CPUStep    resource.Quantity `json:"cpuStep"`
	MemoryStep resource.Quantity `json:"memoryStep"`
	PodsStep   resource.Quantity `json:"podsStep"`
}

K8SlicePartitionability represents the partitionability of a Kubernetes slice.

type K8SlicePolicies added in v0.1.0

type K8SlicePolicies struct {
	Partitionability K8SlicePartitionability `json:"partitionability"`
}

K8SlicePolicies represents the policies of a Kubernetes slice.

type K8SliceProperties added in v0.1.0

type K8SliceProperties struct {
	Latency               int                        `json:"latency,omitempty"`
	SecurityStandards     []string                   `json:"securityStandards,omitempty"`
	CarbonFootprint       *CarbonFootprint           `json:"carbonFootprint,omitempty"`
	NetworkAuthorizations *NetworkAuthorizations     `json:"networkAuthorizations,omitempty"`
	AdditionalProperties  map[string]json.RawMessage `json:"additionalProperties,omitempty"`
}

K8SliceProperties represents the properties of a Kubernetes slice.

type K8SliceSelector added in v0.1.0

type K8SliceSelector struct {
	Architecture *StringFilter           `json:"architecture,omitempty"`
	CPU          *ResourceQuantityFilter `scheme:"cpu,omitempty"`
	Memory       *ResourceQuantityFilter `scheme:"memory,omitempty"`
	Pods         *ResourceQuantityFilter `scheme:"pods,omitempty"`
	Storage      *ResourceQuantityFilter `scheme:"storage,omitempty"`
}

K8SliceSelector represents the criteria for selecting a K8Slice Flavor.

func (K8SliceSelector) GetSelectorType added in v0.1.0

func (ks K8SliceSelector) GetSelectorType() FlavorTypeName

GetSelectorType returns the type of the Selector.

type LiqoCredentials

type LiqoCredentials struct {
	ClusterID   string `json:"clusterID"`
	ClusterName string `json:"clusterName"`
	Token       string `json:"token"`
	Endpoint    string `json:"endpoint"`
}

LiqoCredentials contains the credentials of a Liqo cluster to establish a peering.

type Location added in v0.1.0

type Location struct {
	Latitude        string `json:"latitude,omitempty"`
	Longitude       string `json:"longitude,omitempty"`
	Country         string `json:"altitude,omitempty"`
	City            string `json:"city,omitempty"`
	AdditionalNotes string `json:"additionalNotes,omitempty"`
}

Location represents the location of a Flavor, with latitude, longitude, altitude, and additional notes.

type NetworkAuthorizations added in v0.1.0

type NetworkAuthorizations struct {
	DeniedCommunications    []NetworkIntent `json:"deniedCommunications"`
	MandatoryCommunications []NetworkIntent `json:"mandatoryCommunications"`
}

NetworkAuthorizations represents the network authorizations of a Flavor, with denied and mandatory communications.

type NetworkIntent added in v0.1.0

type NetworkIntent struct {
	Name            string            `json:"name"`
	Source          SourceDestination `json:"source"`
	Destination     SourceDestination `json:"destination"`
	DestinationPort string            `json:"destinationPort"`
	ProtocolType    string            `json:"protocolType"`
}

NetworkIntent represents the network intent of a Flavor, with source and destination.

type NodeIdentity

type NodeIdentity struct {
	NodeID                string                      `json:"ID"`
	IP                    string                      `json:"IP"`
	Domain                string                      `json:"domain"`
	AdditionalInformation *NodeIdentityAdditionalInfo `json:"additionalInformation,omitempty"`
}

NodeIdentity represents the owner of a Flavor, with associated ID, IP, and domain name.

type NodeIdentityAdditionalInfo added in v0.1.0

type NodeIdentityAdditionalInfo struct {
	LiqoID string `json:"liqoID,omitempty"`
}

NodeIdentityAdditionalInfo represents additional information about a NodeIdentity.

type NodeInfo

type NodeInfo struct {
	UID             string          `json:"uid"`
	Name            string          `json:"name"`
	Architecture    string          `json:"architecture"`
	OperatingSystem string          `json:"os"`
	ResourceMetrics ResourceMetrics `json:"resources"`
}

NodeInfo represents a node and its resources.

type PodNamespaceSelector added in v0.1.0

type PodNamespaceSelector struct {
	Pod       []keyValuePair `json:"pod"`
	Namespace []keyValuePair `json:"namespace"`
}

PodNamespaceSelector represents the pod namespace selector of a SourceDestination.

type Price

type Price struct {
	Amount   string `json:"amount"`
	Currency string `json:"currency"`
	Period   string `json:"period"`
}

Price represents the price of a Flavor, with the amount, currency, and period associated.

type PurchaseRequest

type PurchaseRequest struct {
	// LiqoCredentials contains the Liqo credentials of the buyer.
	// This field is optional and should be used only if the buyer is the Liqo peering target cluster, based on the Flavor you are going to purchase.
	// This field may be dismissed in the future version of Liqo.
	LiqoCredentials *LiqoCredentials `json:"liqoCredentials,omitempty"`
}

PurchaseRequest is the request model for purchasing a Flavor.

type ReserveRequest

type ReserveRequest struct {
	FlavorID      string         `json:"flavorID"`
	Buyer         NodeIdentity   `json:"buyerID"`
	Configuration *Configuration `json:"configuration,omitempty"`
}

ReserveRequest is the request model for reserving a Flavor.

type ResourceMetrics

type ResourceMetrics struct {
	CPUTotal         resource.Quantity `json:"totalCPU"`
	CPUAvailable     resource.Quantity `json:"availableCPU"`
	MemoryTotal      resource.Quantity `json:"totalMemory"`
	MemoryAvailable  resource.Quantity `json:"availableMemory"`
	PodsTotal        resource.Quantity `json:"totalPods"`
	PodsAvailable    resource.Quantity `json:"availablePods"`
	EphemeralStorage resource.Quantity `json:"ephemeralStorage"`
	GPU              GPUMetrics        `json:"gpu"`
}

ResourceMetrics represents resources of a certain node.

type ResourceQuantityFilter added in v0.1.0

type ResourceQuantityFilter struct {
	Name FilterType      `scheme:"name"`
	Data json.RawMessage `scheme:"data"`
}

ResourceQuantityFilter represents a filter for a resource quantity.

type ResourceQuantityFilterData added in v0.1.0

type ResourceQuantityFilterData interface {
	GetFilterType() FilterType
}

ResourceQuantityFilterData represents the data of a ResourceQuantityFilter.

type ResourceQuantityMatchFilter added in v0.1.0

type ResourceQuantityMatchFilter struct {
	Value resource.Quantity `scheme:"value"`
}

ResourceQuantityMatchFilter represents a match filter for a resource quantity.

func (ResourceQuantityMatchFilter) GetFilterType added in v0.1.0

func (fq ResourceQuantityMatchFilter) GetFilterType() FilterType

GetFilterType returns the type of the Filter.

type ResourceQuantityRangeFilter added in v0.1.0

type ResourceQuantityRangeFilter struct {
	Min *resource.Quantity `scheme:"min,omitempty"`
	Max *resource.Quantity `scheme:"max,omitempty"`
}

ResourceQuantityRangeFilter represents a range filter for a resource quantity.

func (ResourceQuantityRangeFilter) GetFilterType added in v0.1.0

func (fq ResourceQuantityRangeFilter) GetFilterType() FilterType

GetFilterType returns the type of the Filter.

type ResourceSelector added in v0.1.0

type ResourceSelector struct {
	TypeIdentifier ResourceSelectorIdentifier `json:"typeIdentifier"`
	Selector       json.RawMessage            `json:"selector"`
}

ResourceSelector represents the resource selector of a SourceDestination.

type ResourceSelectorIdentifier added in v0.1.0

type ResourceSelectorIdentifier string

ResourceSelectorIdentifier represents the identifier of a ResourceSelector.

const (
	// PodNamespaceSelectorType is the type of a PodNamespaceSelector.
	PodNamespaceSelectorType ResourceSelectorIdentifier = "PodNamespaceSelector"
	// CIDRSelectorType is the type of a CIDRSelector.
	CIDRSelectorType ResourceSelectorIdentifier = "CIDRSelector"
)

type Selector

type Selector interface {
	GetSelectorType() FlavorTypeName
}

Selector represents the criteria for selecting Flavors.

type SensorSelector added in v0.1.0

type SensorSelector struct {
}

SensorSelector is the flavor of a Sensor.

func (SensorSelector) GetSelectorType added in v0.1.0

func (ss SensorSelector) GetSelectorType() FlavorTypeName

GetSelectorType returns the type of the Selector.

type ServiceConfiguration added in v0.1.0

type ServiceConfiguration struct {
	// HostingPolicy is the hosting policy chosen for the service, where the service will be hosted.
	HostingPolicy *HostingPolicy `json:"hostingPolicy,omitempty"`
	// ConfigurationData is the data of the specific service configuration, compliant with the ConfigurationTemplate defined in the Service Flavor.
	ConfigurationData json.RawMessage `json:"configurationData"`
}

ServiceConfiguration represents the configuration properties of a Service Flavor.

func (*ServiceConfiguration) GetConfigurationType added in v0.1.0

func (p *ServiceConfiguration) GetConfigurationType() FlavorTypeName

GetConfigurationType returns the type of the Configuration.

type ServiceFlavor added in v0.1.0

type ServiceFlavor struct {
	// Name of the Service Flavor.
	Name string `json:"name"`
	// Description of the Service Flavor.
	Description string `json:"description"`
	// Category of the Service Flavor.
	Category string `json:"category"`
	// Tags of the Service Flavor.
	Tags []string `json:"tags"`
	// HostingPolicies of the Service Flavor.
	HostingPolicies []HostingPolicy `json:"hostingPolicies"`
	// ConfigurationTemplate of the Service Flavor. JSON Schema with the parameters that can be configured.
	ConfigurationTemplate json.RawMessage `json:"configurationTemplate"`
}

ServiceFlavor represents a Service Flavor description.

type ServiceSelector added in v0.1.0

type ServiceSelector struct {
	Category *StringFilter `json:"category,omitempty"`
	Tags     *StringFilter `json:"tags,omitempty"`
}

ServiceSelector represents the criteria for selecting a Service Flavor.

func (ServiceSelector) GetSelectorType added in v0.1.0

func (ss ServiceSelector) GetSelectorType() FlavorTypeName

GetSelectorType returns the type of the Selector.

type SourceDestination added in v0.1.0

type SourceDestination struct {
	IsHotCluster     bool             `json:"isHotCluster"`
	ResourceSelector ResourceSelector `json:"resourceSelectors"`
}

SourceDestination represents the source or destination of a network intent.

type StringFilter added in v0.1.0

type StringFilter struct {
	Name FilterType      `scheme:"name"`
	Data json.RawMessage `scheme:"data"`
}

StringFilter represents a filter for a string.

type StringFilterData added in v0.1.0

type StringFilterData interface {
	GetFilterType() FilterType
}

StringFilterData represents the data of a StringFilter.

type StringMatchFilter added in v0.1.0

type StringMatchFilter struct {
	Value string `scheme:"value"`
}

StringMatchFilter represents a match filter for a string.

func (StringMatchFilter) GetFilterType added in v0.1.0

func (fq StringMatchFilter) GetFilterType() FilterType

GetFilterType returns the type of the Filter.

type StringRangeFilter added in v0.1.0

type StringRangeFilter struct {
	Regex string `scheme:"regex"`
}

StringRangeFilter represents a range filter for a string.

type Transaction

type Transaction struct {
	TransactionID  string         `json:"transactionID"`
	FlavorID       string         `json:"flavorID"`
	Configuration  *Configuration `json:"configuration,omitempty"`
	Buyer          NodeIdentity   `json:"buyer"`
	ClusterID      string         `json:"clusterID"`
	ExpirationTime string         `json:"expirationTime"`
}

Transaction contains information regarding the transaction for a flavor.

type VMSelector added in v0.1.0

type VMSelector struct {
}

VMSelector is the flavor of a VM.

func (VMSelector) GetSelectorType added in v0.1.0

func (vm VMSelector) GetSelectorType() FlavorTypeName

GetSelectorType returns the type of the Selector.

Jump to

Keyboard shortcuts

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