graph

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAdmin = errors.New("you are not admin")

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func NewSchema added in v1.3.0

func NewSchema() graphql.ExecutableSchema

Types

type ACLMutationResolver added in v1.3.1

type ACLMutationResolver interface {
	TriggerUpdate(ctx context.Context, obj *model.ACLMutation) (bool, error)
}

type ComplexityRoot

type ComplexityRoot struct {
	ACLMutation struct {
		TriggerUpdate func(childComplexity int) int
	}

	HMachine struct {
		ForcedTags  func(childComplexity int) int
		GivenName   func(childComplexity int) int
		ID          func(childComplexity int) int
		IPAddresses func(childComplexity int) int
		LastSeen    func(childComplexity int) int
		Name        func(childComplexity int) int
		Online      func(childComplexity int) int
		Routes      func(childComplexity int) int
		User        func(childComplexity int) int
	}

	HMachineMutation struct {
		DeleteMachine  func(childComplexity int, machineID int) int
		MoveMachine    func(childComplexity int, machineID int, userName string) int
		RenameMachine  func(childComplexity int, machineID int, name string) int
		SetMachineTags func(childComplexity int, machineID int, tags []string) int
	}

	HRoute struct {
		Advertised func(childComplexity int) int
		CreatedAt  func(childComplexity int) int
		DeletedAt  func(childComplexity int) int
		Enabled    func(childComplexity int) int
		ID         func(childComplexity int) int
		IsPrimary  func(childComplexity int) int
		Machine    func(childComplexity int) int
		Prefix     func(childComplexity int) int
		UpdatedAt  func(childComplexity int) int
	}

	HRouteMutation struct {
		DeleteRoute func(childComplexity int, routeID int) int
		EnableRoute func(childComplexity int, routeID int, enable bool) int
	}

	HUser struct {
		CreatedAt func(childComplexity int) int
		ID        func(childComplexity int) int
		Name      func(childComplexity int) int
	}

	HUserMutation struct {
		CreateUser func(childComplexity int, name string) int
		DeleteUser func(childComplexity int, name string) int
		RenameUser func(childComplexity int, oldName string, newName string) int
	}

	HeadscaleMutation struct {
		Machine func(childComplexity int) int
		Route   func(childComplexity int) int
		User    func(childComplexity int) int
	}

	HeadscaleQuery struct {
		Machine  func(childComplexity int, machineID int) int
		Machines func(childComplexity int) int
		Users    func(childComplexity int) int
	}

	Machine struct {
		ID   func(childComplexity int) int
		Name func(childComplexity int) int
	}

	MachineMutation struct {
		DeleteMachine func(childComplexity int, id string) int
		SaveMachine   func(childComplexity int, machineInput *model.MachineInput) int
	}

	Mutation struct {
		ACL       func(childComplexity int) int
		Headscale func(childComplexity int) int
		Machine   func(childComplexity int) int
		Project   func(childComplexity int) int
		Route     func(childComplexity int) int
	}

	Project struct {
		Code       func(childComplexity int) int
		ID         func(childComplexity int) int
		Machine    func(childComplexity int) int
		MachineID  func(childComplexity int) int
		MachineIDs func(childComplexity int) int
		Machines   func(childComplexity int) int
		Name       func(childComplexity int) int
		Routes     func(childComplexity int) int
	}

	ProjectMutation struct {
		DeleteProject    func(childComplexity int, id string) int
		SaveProject      func(childComplexity int, projectInput *model.ProjectInput) int
		SyncProjectRoute func(childComplexity int, projectID *string) int
	}

	Query struct {
		Headscale func(childComplexity int) int
		Machines  func(childComplexity int) int
		Projects  func(childComplexity int) int
		Routes    func(childComplexity int) int
		UserInfo  func(childComplexity int) int
	}

	Route struct {
		Description func(childComplexity int) int
		ID          func(childComplexity int) int
		Name        func(childComplexity int) int
		Project     func(childComplexity int) int
		ProjectID   func(childComplexity int) int
	}

	RouteMutation struct {
		DeleteRoute func(childComplexity int, id string) int
		SaveRoute   func(childComplexity int, routeInput *model.RouteInput) int
	}

	SyncResult struct {
		Machine     func(childComplexity int) int
		MachineID   func(childComplexity int) int
		Project     func(childComplexity int) int
		ProjectID   func(childComplexity int) int
		Route       func(childComplexity int) int
		RouteEnable func(childComplexity int) int
		RouteID     func(childComplexity int) int
	}

	Timestamp struct {
		Nanos   func(childComplexity int) int
		Seconds func(childComplexity int) int
	}

	UserInfo struct {
		Email   func(childComplexity int) int
		Groups  func(childComplexity int) int
		IsAdmin func(childComplexity int) int
		Name    func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

func NewConfig added in v1.3.0

func NewConfig() *Config

type DirectiveRoot

type DirectiveRoot struct {
	NeedAdmin func(ctx context.Context, obj interface{}, next graphql.Resolver, quiet bool) (res interface{}, err error)
}

type HMachineMutationResolver added in v1.1.0

type HMachineMutationResolver interface {
	RenameMachine(ctx context.Context, obj *model.HMachineMutation, machineID int, name string) (*model.HMachine, error)
	DeleteMachine(ctx context.Context, obj *model.HMachineMutation, machineID int) (bool, error)
	SetMachineTags(ctx context.Context, obj *model.HMachineMutation, machineID int, tags []string) (*model.HMachine, error)
	MoveMachine(ctx context.Context, obj *model.HMachineMutation, machineID int, userName string) (*model.HMachine, error)
}

type HMachineResolver added in v1.1.0

type HMachineResolver interface {
	Routes(ctx context.Context, obj *model.HMachine) ([]*model.HRoute, error)
}

type HRouteMutationResolver added in v1.1.0

type HRouteMutationResolver interface {
	EnableRoute(ctx context.Context, obj *model.HRouteMutation, routeID int, enable bool) (bool, error)
	DeleteRoute(ctx context.Context, obj *model.HRouteMutation, routeID int) (bool, error)
}

type HRouteResolver added in v1.1.0

type HRouteResolver interface {
	Machine(ctx context.Context, obj *model.HRoute) (*model.HMachine, error)
}

type HUserMutationResolver added in v1.2.0

type HUserMutationResolver interface {
	CreateUser(ctx context.Context, obj *model.HUserMutation, name string) (*model.HUser, error)
	DeleteUser(ctx context.Context, obj *model.HUserMutation, name string) (bool, error)
	RenameUser(ctx context.Context, obj *model.HUserMutation, oldName string, newName string) (*model.HUser, error)
}

type HeadscaleQueryResolver added in v1.1.0

type HeadscaleQueryResolver interface {
	Machines(ctx context.Context, obj *model.HeadscaleQuery) ([]*model.HMachine, error)
	Machine(ctx context.Context, obj *model.HeadscaleQuery, machineID int) (*model.HMachine, error)
	Users(ctx context.Context, obj *model.HeadscaleQuery) ([]*model.HUser, error)
}

type MachineMutationResolver

type MachineMutationResolver interface {
	SaveMachine(ctx context.Context, obj *model.MachineMutation, machineInput *model.MachineInput) (*model.Machine, error)
	DeleteMachine(ctx context.Context, obj *model.MachineMutation, id string) (int, error)
}

type MutationResolver

type MutationResolver interface {
	Project(ctx context.Context) (*model.ProjectMutation, error)
	Route(ctx context.Context) (*model.RouteMutation, error)
	Machine(ctx context.Context) (*model.MachineMutation, error)
	Headscale(ctx context.Context) (*model.HeadscaleMutation, error)
	ACL(ctx context.Context) (*model.ACLMutation, error)
}

type NeedAdmind added in v1.3.0

type NeedAdmind interface {
	CheckIsAdmin(ctx context.Context) (bool, error)
}

type ProjectMutationResolver

type ProjectMutationResolver interface {
	SaveProject(ctx context.Context, obj *model.ProjectMutation, projectInput *model.ProjectInput) (*model.Project, error)
	DeleteProject(ctx context.Context, obj *model.ProjectMutation, id string) (int, error)
	SyncProjectRoute(ctx context.Context, obj *model.ProjectMutation, projectID *string) ([]*model.SyncResult, error)
}

type ProjectResolver

type ProjectResolver interface {
	Machine(ctx context.Context, obj *model.Project) (*model.Machine, error)
	Machines(ctx context.Context, obj *model.Project) ([]*model.Machine, error)

	Routes(ctx context.Context, obj *model.Project) ([]*model.Route, error)
}

type QueryResolver

type QueryResolver interface {
	UserInfo(ctx context.Context) (*model.UserInfo, error)
	Projects(ctx context.Context) ([]*model.Project, error)
	Machines(ctx context.Context) ([]*model.Machine, error)
	Routes(ctx context.Context) ([]*model.Route, error)
	Headscale(ctx context.Context) (*model.HeadscaleQuery, error)
}

type Resolver

type Resolver struct{}

func (*Resolver) ACLMutation added in v1.3.1

func (r *Resolver) ACLMutation() ACLMutationResolver

ACLMutation returns ACLMutationResolver implementation.

func (*Resolver) HMachine added in v1.1.0

func (r *Resolver) HMachine() HMachineResolver

HMachine returns HMachineResolver implementation.

func (*Resolver) HMachineMutation added in v1.1.0

func (r *Resolver) HMachineMutation() HMachineMutationResolver

HMachineMutation returns HMachineMutationResolver implementation.

func (*Resolver) HRoute added in v1.1.0

func (r *Resolver) HRoute() HRouteResolver

HRoute returns HRouteResolver implementation.

func (*Resolver) HRouteMutation added in v1.1.0

func (r *Resolver) HRouteMutation() HRouteMutationResolver

HRouteMutation returns HRouteMutationResolver implementation.

func (*Resolver) HUserMutation added in v1.2.0

func (r *Resolver) HUserMutation() HUserMutationResolver

HUserMutation returns HUserMutationResolver implementation.

func (*Resolver) HeadscaleQuery added in v1.1.0

func (r *Resolver) HeadscaleQuery() HeadscaleQueryResolver

HeadscaleQuery returns HeadscaleQueryResolver implementation.

func (*Resolver) MachineMutation

func (r *Resolver) MachineMutation() MachineMutationResolver

MachineMutation returns MachineMutationResolver implementation.

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

Mutation returns MutationResolver implementation.

func (*Resolver) Project

func (r *Resolver) Project() ProjectResolver

Project returns ProjectResolver implementation.

func (*Resolver) ProjectMutation

func (r *Resolver) ProjectMutation() ProjectMutationResolver

ProjectMutation returns ProjectMutationResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns QueryResolver implementation.

func (*Resolver) Route

func (r *Resolver) Route() RouteResolver

Route returns RouteResolver implementation.

func (*Resolver) RouteMutation

func (r *Resolver) RouteMutation() RouteMutationResolver

RouteMutation returns RouteMutationResolver implementation.

func (*Resolver) SyncResult

func (r *Resolver) SyncResult() SyncResultResolver

SyncResult returns SyncResultResolver implementation.

func (*Resolver) UserInfo added in v1.3.0

func (r *Resolver) UserInfo() UserInfoResolver

UserInfo returns UserInfoResolver implementation.

type ResolverRoot

type ResolverRoot interface {
	ACLMutation() ACLMutationResolver
	HMachine() HMachineResolver
	HMachineMutation() HMachineMutationResolver
	HRoute() HRouteResolver
	HRouteMutation() HRouteMutationResolver
	HUserMutation() HUserMutationResolver
	HeadscaleQuery() HeadscaleQueryResolver
	MachineMutation() MachineMutationResolver
	Mutation() MutationResolver
	Project() ProjectResolver
	ProjectMutation() ProjectMutationResolver
	Query() QueryResolver
	Route() RouteResolver
	RouteMutation() RouteMutationResolver
	SyncResult() SyncResultResolver
	UserInfo() UserInfoResolver
}

type RouteMutationResolver

type RouteMutationResolver interface {
	SaveRoute(ctx context.Context, obj *model.RouteMutation, routeInput *model.RouteInput) (*model.Route, error)
	DeleteRoute(ctx context.Context, obj *model.RouteMutation, id string) (int, error)
}

type RouteResolver

type RouteResolver interface {
	Project(ctx context.Context, obj *model.Route) (*model.Project, error)
}

type SyncResultResolver

type SyncResultResolver interface {
	Project(ctx context.Context, obj *model.SyncResult) (*model.Project, error)

	Route(ctx context.Context, obj *model.SyncResult) (*model.Route, error)

	Machine(ctx context.Context, obj *model.SyncResult) (*model.Machine, error)
}

type UserInfoResolver added in v1.3.0

type UserInfoResolver interface {
	IsAdmin(ctx context.Context, obj *model.UserInfo) (*bool, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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