api

package
v0.0.0-...-db8f46d Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrimaryDeviceStatusOnline  = "Online"
	PrimaryDeviceStatusOffline = "Offline"
)

Variables

This section is empty.

Functions

func DeviceToDB

func DeviceToDB(device Device) database.Device

func NetworkingServiceToProto

func NetworkingServiceToProto(netServ NetworkingService) *devcfgpb.NetworkingService

func OrganisationToDB

func OrganisationToDB(org Organization) database.Organization

func StringPtrFrom

func StringPtrFrom(ns sql.NullString) *string

func StringPtrToDB

func StringPtrToDB(p *string) sql.NullString

func StudentToDB

func StudentToDB(s Student) database.Student

func UserToDB

func UserToDB(user User) database.User

Types

type AdminMessage

type AdminMessage struct {
	OrganizationID uuid.UUID              `json:"organizationId"`
	LoggedAt       NanoTime               `json:"loggedAt"`
	Severity       AdminMessageSeverity   `json:"severity"`
	Verbosity      int                    `json:"verbosity"`
	Summary        string                 `json:"summary"`
	Message        string                 `json:"message"`
	Fields         map[string]interface{} `json:"fields"`
}

type AdminMessageSeverity

type AdminMessageSeverity string
const (
	AdminMessageSeverityError AdminMessageSeverity = "error"
	AdminMessageSeverityInfo  AdminMessageSeverity = "info"
)

type CaCertType

type CaCertType string
const (
	CaCertTypePem CaCertType = "Pem"
	CaCertTypeDer CaCertType = "Der"
)

type CombinedAppointment

type CombinedAppointment struct {
	Appointment   *zermelo.Appointment
	Participation *zermelo.AppointmentParticipation
}

func (*CombinedAppointment) ToAPI

type CreateDeviceResponse

type CreateDeviceResponse struct {
	Device Device    `json:"device"`
	Token  uuid.UUID `json:"token"`
}

func CreateDeviceResponseFrom

func CreateDeviceResponseFrom(device database.Device, token uuid.UUID) CreateDeviceResponse

type Device

type Device struct {
	ID             uuid.UUID           `json:"id"`
	OrganizationID uuid.UUID           `json:"organizationId"`
	Name           string              `json:"name"`
	PrimaryStatus  PrimaryDeviceStatus `json:"primaryStatus"`
}

func DeviceFrom

func DeviceFrom(device database.Device) Device

func DevicesFrom

func DevicesFrom(dbDevices []database.Device) []Device

type Eap

type Eap string
const (
	EapTls  Eap = "Tls"
	EapTtls Eap = "Ttls"
	EapPeap Eap = "Peap"
)

type EnrollParams

type EnrollParams struct {
	UnenrollFromParticipation *int
	EnrollIntoParticipation   *int
}

func EnrollParamsFromRequest

func EnrollParamsFromRequest(r *http.Request) (EnrollParams, error)

type GenerateNATSCredentialsResponse

type GenerateNATSCredentialsResponse struct {
	Credentials string `json:"credentials"`
}

type GetZermeloAppointmentsParams

type GetZermeloAppointmentsParams struct {
	StartTime jsontypes.UnixTime `query:"startTime"`
	EndTime   jsontypes.UnixTime `query:"endTime"`
}

type Ipv4Config

type Ipv4Config struct {
	Type     Ipv4ConfigType      `json:"type,omitempty"`
	Settings *Ipv4ConfigSettings `json:"settings,omitempty"`
}

type Ipv4ConfigSettings

type Ipv4ConfigSettings struct {
	Network string `json:"network,omitempty"`
	Netmask string `json:"netmask,omitempty"`
	Gateway string `json:"gateway,omitempty"`
}

type Ipv4ConfigType

type Ipv4ConfigType string
const (
	Ipv4ConfigTypeOff    Ipv4ConfigType = "Off"
	Ipv4ConfigTypeDhcp   Ipv4ConfigType = "Dhcp"
	Ipv4ConfigTypeCustom Ipv4ConfigType = "Custom"
)

type Ipv6Config

type Ipv6Config struct {
	Type     Ipv6ConfigType      `json:"type,omitempty"`
	Settings *Ipv6ConfigSettings `json:"settings,omitempty"`
}

type Ipv6ConfigSettings

type Ipv6ConfigSettings struct {
	Network      string `json:"network,omitempty"`
	PrefixLength uint64 `json:"prefixLength,omitempty"`
	Gateway      string `json:"gateway,omitempty"`
}

type Ipv6ConfigType

type Ipv6ConfigType string
const (
	Ipv6ConfigTypeOff    Ipv6ConfigType = "Off"
	Ipv6ConfigTypeAuto   Ipv6ConfigType = "Auto"
	Ipv6ConfigTypeCustom Ipv6ConfigType = "Custom"
)

type Ipv6Privacy

type Ipv6Privacy string
const (
	Ipv6PrivacyDisabled  Ipv6Privacy = "Disabled"
	Ipv6PrivacyEnabled   Ipv6Privacy = "Enabled"
	Ipv6PrivacyPreferred Ipv6Privacy = "Preferred"
)

type NanoTime

type NanoTime time.Time

func (NanoTime) MarshalJSON

func (t NanoTime) MarshalJSON() ([]byte, error)

type NetworkingService

type NetworkingService struct {
	ID                       uuid.UUID                `json:"id,omitempty"`
	OrganizationID           uuid.UUID                `json:"organizationId,omitempty"`
	Name                     string                   `json:"name,omitempty"`
	Type                     NetworkingServiceType    `json:"type,omitempty"`
	Ipv4Config               *Ipv4Config              `json:"ipv4Config,omitempty"`
	Ipv6Config               *Ipv6Config              `json:"ipv6Config,omitempty"`
	Ipv6Privacy              Ipv6Privacy              `json:"ipv6Privacy,omitempty"`
	Mac                      string                   `json:"mac,omitempty"`
	Nameservers              []string                 `json:"nameservers,omitempty"`
	SearchDomains            []string                 `json:"searchDomains,omitempty"`
	Timeservers              []string                 `json:"timeservers,omitempty"`
	Domain                   string                   `json:"domain,omitempty"`
	NetworkName              string                   `json:"networkName,omitempty"`
	SSID                     string                   `json:"ssid,omitempty"`
	Passphrase               string                   `json:"passphrase,omitempty"`
	Security                 Security                 `json:"security,omitempty"`
	IsHidden                 bool                     `json:"isHidden,omitempty"`
	Eap                      Eap                      `json:"eap,omitempty"`
	CaCert                   []byte                   `json:"caCert,omitempty"`
	CaCertType               CaCertType               `json:"caCertType,omitempty"`
	PrivateKey               []byte                   `json:"privateKey,omitempty"`
	PrivateKeyType           PrivateKeyType           `json:"privateKeyType,omitempty"`
	PrivateKeyPassphrase     string                   `json:"privateKeyPassphrase,omitempty"`
	PrivateKeyPassphraseType PrivateKeyPassphraseType `json:"privateKeyPassphraseType,omitempty"`
	Identity                 string                   `json:"identity,omitempty"`
	AnonymousIdentity        string                   `json:"anonymousIdentify,omitempty"`
	SubjectMatch             string                   `json:"subjectMatch,omitempty"`
	AltSubjectMatch          string                   `json:"altSubjectMatch,omitempty"`
	DomainSuffixMatch        string                   `json:"domainSuffixMatch,omitempty"`
	DomainMatch              string                   `json:"domainMatch,omitempty"`
	Phase2                   Phase2Type               `json:"phase2,omitempty"`
	IsPhase2EapBased         bool                     `json:"isPhase2EapBased,omitempty"`
}

type NetworkingServiceType

type NetworkingServiceType string
const (
	NetworkingServiceTypeEthernet NetworkingServiceType = "Ethernet"
	NetworkingServiceTypeWifi     NetworkingServiceType = "Wifi"
)

type Organization

type Organization struct {
	ID      uuid.UUID               `json:"id"`
	Name    string                  `json:"name"`
	Zermelo OrganizationZermeloInfo `json:"zermelo"`
}

func OrganizationFrom

func OrganizationFrom(org database.Organization) Organization

type OrganizationZermeloInfo

type OrganizationZermeloInfo struct {
	Institution string `json:"institution"`
}

type PaginatedDevices

type PaginatedDevices struct {
	Pagination
	Data []Device `json:"data"`
}

type PaginatedNetworkingServices

type PaginatedNetworkingServices struct {
	Pagination
	Data []NetworkingService `json:"data"`
}

type PaginatedStudents

type PaginatedStudents struct {
	Pagination
	Data []Student `json:"data"`
}

type Pagination

type Pagination struct {
	Offset    uint64 `json:"offset"`
	MaxAmount uint64 `json:"maxAmount"`
	Total     uint64 `json:"total"`
}

func PaginationFrom

func PaginationFrom(p database.Pagination) Pagination

type PatchedStudent

type PatchedStudent struct {
	Student
	CardID StringPatch `json:"cardId"`
}

type Phase2Type

type Phase2Type string
const (
	Phase2TypeMschapV2 Phase2Type = "MschapV2"
	Phase2TypeGtc      Phase2Type = "Gtc"
)

type PrimaryDeviceStatus

type PrimaryDeviceStatus string

type PrivateKeyPassphraseType

type PrivateKeyPassphraseType string
const PrivateKeyPassphraseTypeFsid PrivateKeyPassphraseType = "Fsid"

type PrivateKeyType

type PrivateKeyType string
const (
	PrivateKeyTypePem PrivateKeyType = "Pem"
	PrivateKeyTypeDer PrivateKeyType = "Der"
	PrivateKeyTypePfx PrivateKeyType = "Pfx"
)

type RegistrationConfig

type RegistrationConfig struct {
	Token              uuid.UUID           `json:"token"`
	OrganizationID     uuid.UUID           `json:"organizationId"`
	NetworkingServices []NetworkingService `json:"networkingServices"`
}

type Security

type Security string
const (
	SecurityPsk       Security = "Psk"
	SecurityIeee8021x Security = "Ieee8021x"
	SecurityNone      Security = "None"
	SecurityWep       Security = "Wep"
)

type Server

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

func NewServer

func NewServer(log logr.Logger, db *database.Wrapper, secr *secrets.Wrapper) (Server, error)

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

type StringPatch

type StringPatch struct {
	ExplicitlyNull bool
	Value          *string
}

func (StringPatch) MarshalJSON

func (p StringPatch) MarshalJSON() ([]byte, error)

func (*StringPatch) UnmarshalJSON

func (p *StringPatch) UnmarshalJSON(b []byte) error

type Student

type Student struct {
	ID                uuid.UUID          `json:"id"`
	OrganizationID    uuid.UUID          `json:"organizationId"`
	Zermelo           StudentZermeloInfo `json:"zermelo"`
	HasCardAssociated bool               `json:"hasCardAssociated,omitempty"`
}

func StudentFrom

func StudentFrom(student database.Student) Student

func StudentsFrom

func StudentsFrom(dbStudents []database.Student) []Student

type StudentZermeloInfo

type StudentZermeloInfo struct {
	User *string `json:"user,omitempty"`
}

type TimeSpan

type TimeSpan struct {
	StartUnix, EndUnix int64
}

func TimeSpanFromAppointment

func TimeSpanFromAppointment(a *zermelo.Appointment) TimeSpan

type User

type User struct {
	ID             uuid.UUID `json:"id"`
	OrganizationID uuid.UUID `json:"organizationId"`
	Name           string    `json:"name"`
	Email          string    `json:"email"`
}

func UserFrom

func UserFrom(user database.User) User

type ZermeloAppointment

type ZermeloAppointment struct {
	ID                    int                   `json:"id"`
	ParticipationID       int                   `json:"participationId"`
	AppointmentInstance   int                   `json:"appointmentInstance"`
	IsOnline              *bool                 `json:"isOnline"`
	IsOptional            *bool                 `json:"isOptional"`
	IsStudentEnrolled     *bool                 `json:"isStudentEnrolled"`
	IsCanceled            *bool                 `json:"isCanceled"`
	StartTimeSlotName     string                `json:"startTimeSlotName"`
	EndTimeSlotName       string                `json:"endTimeSlotName"`
	Subjects              []string              `json:"subjects"`
	Groups                []string              `json:"groups"`
	Locations             []string              `json:"locations"`
	Teachers              []string              `json:"teachers"`
	StartTime             jsontypes.UnixTime    `json:"startTime"`
	EndTime               jsontypes.UnixTime    `json:"endTime"`
	Content               string                `json:"content"`
	AvailableSpace        *int                  `json:"availableSpace"`
	Capacity              *int                  `json:"capacity"`
	Alternatives          []*ZermeloAppointment `json:"alternatives"`
	AllowedStudentActions string                `json:"allowedStudentActions"`
}

type ZermeloAppointmentsResponse

type ZermeloAppointmentsResponse struct {
	Data []*ZermeloAppointment `json:"data"`
}

Jump to

Keyboard shortcuts

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