schema

package
v0.0.0-...-e9f4c3e Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyModeMonitor = "MONITOR"
	PolicyModeWork    = "WORK"
)
View Source
const (
	NetworkStorage    = "STORAGE"
	NetworkManagement = "MANAGEMENT"
	NetworkVM         = "VM"
	NetworkAccess     = "ACCESS"
	NetworkMigration  = "MIGRATION"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentELFCluster

type AgentELFCluster struct {
	ObjectMeta

	LocalID string `json:"local_id"`
}

type EverouteCluster

type EverouteCluster struct {
	ObjectMeta

	AgentELFClusters    []AgentELFCluster            `json:"agent_elf_clusters"`
	AgentELFVDSes       []ObjectReference            `json:"agent_elf_vdses,omitempty"`
	ControllerInstances []EverouteControllerInstance `json:"controller_instances"`
	GlobalDefaultAction GlobalPolicyAction           `json:"global_default_action"`
	GlobalWhitelist     EverouteClusterWhitelist     `json:"global_whitelist,omitempty"`
	EnableLogging       bool                         `json:"enable_logging,omitempty"`
}

EverouteCluster defines everoute cluster

func (*EverouteCluster) GetELFs

func (e *EverouteCluster) GetELFs() sets.Set[string]

type EverouteClusterWhitelist

type EverouteClusterWhitelist struct {
	Egress  []NetworkPolicyRule `json:"egress"`
	Enable  bool                `json:"enable"`
	Ingress []NetworkPolicyRule `json:"ingress"`
}

type EverouteControllerInstance

type EverouteControllerInstance struct {
	IPAddr string `json:"ipAddr"`
}

type GlobalPolicyAction

type GlobalPolicyAction string
const (
	GlobalPolicyActionAllow GlobalPolicyAction = "ALLOW"
	GlobalPolicyActionDrop  GlobalPolicyAction = "DROP"
)

type GroupMemberType

type GroupMemberType string
const (
	VMGroupType  GroupMemberType = "VM"
	PodGroupType GroupMemberType = "POD"
)

type Host

type Host struct {
	ObjectMeta

	Name string `json:"name,omitempty"`
	Nics []Nic  `json:"nics,omitempty"`
}

Host defines elf host node

type IDSystemEndpoint

type IDSystemEndpoint struct {
	Key  string `json:"key"`
	VMID string `json:"vm_id"`
}

type IPPortSystemEndpoint

type IPPortSystemEndpoint struct {
	Key  string `json:"key"`
	IP   string `json:"ip"`
	Port *int   `json:"port,omitempty"`
}

type IsolationMode

type IsolationMode string
const (
	IsolationModeAll     IsolationMode = "ALL"
	IsolationModePartial IsolationMode = "PARTIAL"
)

type IsolationPolicy

type IsolationPolicy struct {
	ObjectMeta

	EverouteCluster ObjectReference     `json:"everoute_cluster"`
	VM              ObjectReference     `json:"vm"`
	Mode            IsolationMode       `json:"mode"`
	Ingress         []NetworkPolicyRule `json:"ingress,omitempty"`
	Egress          []NetworkPolicyRule `json:"egress,omitempty"`
	EnableLogging   bool                `json:"enable_logging,omitempty"`
}

type KSCNamespacedName

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

type Label

type Label struct {
	ObjectMeta

	Key   string            `json:"key"`
	Value string            `json:"value,omitempty"`
	VMs   []ObjectReference `json:"vms,omitempty"`
}

type LabelGroup

type LabelGroup struct {
	Labels []ObjectReference `json:"labels"`
}

type LabelList

type LabelList struct {
	Labels []Label `json:"labels,omitempty"`
}

LabelList is a list of labels

type MutationEvent

type MutationEvent struct {
	Mutation       MutationType    `json:"mutation"`
	PreviousValues json.RawMessage `json:"previousValues"`
	Node           json.RawMessage `json:"node"`
}

MutationEvent is the event subscribed from tower

type MutationType

type MutationType string
const (
	CreateEvent MutationType = "CREATED"
	DeleteEvent MutationType = "DELETED"
	UpdateEvent MutationType = "UPDATED"
)

type NetworkPolicyRule

type NetworkPolicyRule struct {
	OnlyApplyToExternalTraffic bool                    `json:"only_apply_to_external_traffic"`
	Type                       NetworkPolicyRuleType   `json:"type"`
	Ports                      []NetworkPolicyRulePort `json:"ports,omitempty"`
	Services                   []ObjectReference       `json:"services,omitempty"`
	// IPBlock may be multi ip blocks, ip ranges or single ip
	IPBlock       *string           `json:"ip_block"`
	ExceptIPBlock []string          `json:"except_ip_block,omitempty"`
	Selector      []ObjectReference `json:"selector"`
	SecurityGroup *ObjectReference  `json:"security_group,omitempty"`
}

type NetworkPolicyRulePort

type NetworkPolicyRulePort struct {
	Port        *string                          `json:"port,omitempty"`
	Protocol    NetworkPolicyRulePortProtocol    `json:"protocol"`
	AlgProtocol NetworkPolicyRulePortAlgProtocol `json:"alg_protocol"`
}

type NetworkPolicyRulePortAlgProtocol

type NetworkPolicyRulePortAlgProtocol string
const (
	NetworkPolicyRulePortAlgProtocolFTP  NetworkPolicyRulePortAlgProtocol = "FTP"
	NetworkPolicyRulePortAlgProtocolTFTP NetworkPolicyRulePortAlgProtocol = "TFTP"
)

type NetworkPolicyRulePortProtocol

type NetworkPolicyRulePortProtocol string
const (
	NetworkPolicyRulePortProtocolIcmp NetworkPolicyRulePortProtocol = "ICMP"
	NetworkPolicyRulePortProtocolTCP  NetworkPolicyRulePortProtocol = "TCP"
	NetworkPolicyRulePortProtocolUDP  NetworkPolicyRulePortProtocol = "UDP"
	NetworkPolicyRulePortProtocolALG  NetworkPolicyRulePortProtocol = "ALG"
	NetworkPolicyRulePortProtocolIPIP NetworkPolicyRulePortProtocol = "IPIP"
)

type NetworkPolicyRuleService

type NetworkPolicyRuleService struct {
	ObjectMeta

	Members []NetworkPolicyRulePort `json:"members"`
}

type NetworkPolicyRuleType

type NetworkPolicyRuleType string
const (
	NetworkPolicyRuleTypeAll NetworkPolicyRuleType = "ALL"
	// NetworkPolicyRuleTypeIPBlock may be multi ip blocks, ip ranges or single ip
	NetworkPolicyRuleTypeIPBlock       NetworkPolicyRuleType = "IP_BLOCK"
	NetworkPolicyRuleTypeSelector      NetworkPolicyRuleType = "SELECTOR"
	NetworkPolicyRuleTypeSecurityGroup NetworkPolicyRuleType = "SECURITY_GROUP"
)

type NetworkType

type NetworkType string

NetworkType is enumeration of network types

type Nic

type Nic struct {
	ObjectMeta

	Physical   bool   `json:"physical"`
	Name       string `json:"name,omitempty"`
	MacAddress string `json:"mac_address,omitempty"`
	IPAddress  string `json:"ip_address,omitempty"`
}

type Object

type Object interface {
	// GetID returns the object ID.
	GetID() string
}

Object lets you work with object metadata from tower.

type ObjectMeta

type ObjectMeta struct {
	// ID is the unique in time and space value for this object
	ID string `json:"id"`
}

ObjectMeta is metadata that all tower resources must have.

func (*ObjectMeta) GetID

func (obj *ObjectMeta) GetID() string

GetID returns the object ID.

type ObjectReference

type ObjectReference ObjectMeta

ObjectReference is the reference to other object

type PodLabel

type PodLabel struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type PodLabelGroup

type PodLabelGroup struct {
	KSC        KSCNamespacedName `json:"ksc"`
	Namespaces []string          `json:"namespaces"`
	PodLabels  []PodLabel        `json:"pod_labels"`
}

type PolicyMode

type PolicyMode string

type SecurityGroup

type SecurityGroup struct {
	ObjectMeta

	MemberType      *GroupMemberType  `json:"member_type"`
	EverouteCluster ObjectReference   `json:"everoute_cluster"`
	LabelGroups     []LabelGroup      `json:"label_groups"`
	VMs             []ObjectReference `json:"vms"`
	PodLabelGroups  []PodLabelGroup   `json:"pod_label_groups"`
}

type SecurityPolicy

type SecurityPolicy struct {
	ObjectMeta

	Name            string                `json:"name"`
	EverouteCluster ObjectReference       `json:"everoute_cluster"`
	ApplyTo         []SecurityPolicyApply `json:"apply_to"`
	Ingress         []NetworkPolicyRule   `json:"ingress,omitempty"`
	Egress          []NetworkPolicyRule   `json:"egress,omitempty"`
	PolicyMode      PolicyMode            `json:"policy_mode,omitempty"`
	IsBlocklist     bool                  `json:"is_blocklist,omitempty"`
	EnableLogging   bool                  `json:"enable_logging,omitempty"`
}

type SecurityPolicyApply

type SecurityPolicyApply struct {
	Type          SecurityPolicyType `json:"type"`
	Communicable  bool               `json:"communicable"`
	Selector      []ObjectReference  `json:"selector"`
	SecurityGroup *ObjectReference   `json:"security_group,omitempty"`
}

type SecurityPolicyType

type SecurityPolicyType string
const (
	SecurityPolicyTypeSelector      SecurityPolicyType = "SELECTOR"
	SecurityPolicyTypeSecurityGroup SecurityPolicyType = "SECURITY_GROUP"
)

type SystemEndpoints

type SystemEndpoints struct {
	IDEndpoints     []IDSystemEndpoint     `json:"id_endpoints,omitempty"`
	IPPortEndpoints []IPPortSystemEndpoint `json:"ip_port_endpoints,omitempty"`
}

SystemEndpoints contains all internal system endpoints

func (*SystemEndpoints) GetID

func (*SystemEndpoints) GetID() string

GetID implements Object systemEndpoints has only one instance, we use "systemEndpoints" as its ID

func (*SystemEndpoints) GetSubscriptionRequest

func (s *SystemEndpoints) GetSubscriptionRequest(skipFields map[string][]string) string

func (*SystemEndpoints) UnmarshalEvent

func (s *SystemEndpoints) UnmarshalEvent(raw json.RawMessage, event *MutationEvent) error

func (*SystemEndpoints) UnmarshalSlice

func (s *SystemEndpoints) UnmarshalSlice(raw json.RawMessage, slice interface{}) error

type Task

type Task struct {
	ObjectMeta

	Description  string     `json:"description"`
	ErrorCode    *string    `json:"error_code"`
	ErrorMessage *string    `json:"error_message"`
	Internal     bool       `json:"internal"`
	Progress     float64    `json:"progress"`
	Snapshot     string     `json:"snapshot"`
	Status       TaskStatus `json:"status"`
}

func (*Task) GetQueryRequest

func (t *Task) GetQueryRequest(skipFields map[string][]string) string

type TaskStatus

type TaskStatus string
const (
	TaskStatusExecuting TaskStatus = "EXECUTING"
	TaskStatusFailed    TaskStatus = "FAILED"
	TaskStatusPending   TaskStatus = "PENDING"
	TaskStatusSuccessed TaskStatus = "SUCCESSED"
)

type VM

type VM struct {
	ObjectMeta

	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Vcpu        int      `json:"vcpu,omitempty"`
	Memory      float64  `json:"memory,omitempty"`
	Status      VMStatus `json:"status"`
	VMNics      []VMNic  `json:"vm_nics,omitempty"`
}

type VMList

type VMList struct {
	VMS []VM `json:"vms,omitempty"`
}

VMList is a list of vms

type VMNic

type VMNic struct {
	ObjectMeta

	Vlan        Vlan       `json:"vlan,omitempty"`
	Enabled     bool       `json:"enabled,omitempty"`
	Mirror      bool       `json:"mirror,omitempty"`
	Model       VMNicModel `json:"model,omitempty"`
	MacAddress  string     `json:"mac_address,omitempty"`
	IPAddress   string     `json:"ip_address,omitempty"`
	InterfaceID string     `json:"interface_id,omitempty"`
}

type VMNicModel

type VMNicModel string

VMNicModel is enumeration of vnic models

const (
	VMNicModelE1000  VMNicModel = "E1000"
	VMNicModelVIRTIO VMNicModel = "VIRTIO"
)

type VMStatus

type VMStatus string

VMStatus is enumeration of vm status

const (
	VMStatusRunning   VMStatus = "RUNNING"
	VMStatusSuspended VMStatus = "SUSPENDED"
	VMStatusStopped   VMStatus = "STOPPED"
	VMStatusDeleted   VMStatus = "DELETED"
	VMStatusUnknown   VMStatus = "UNKNOWN"
)

type Vlan

type Vlan struct {
	ObjectMeta

	VDS    ObjectReference `json:"vds"`
	Name   string          `json:"name,omitempty"`
	VlanID int             `json:"vlan_id"`
	Type   NetworkType     `json:"type,omitempty"`
}

Jump to

Keyboard shortcuts

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