Documentation ¶
Overview ¶
Package graphapi provides the graph api handler and resolver for ipam api
Index ¶
- Variables
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type ComplexityRoot
- type Config
- type DirectiveRoot
- type EntityResolver
- type Handler
- type IPAddressCreatePayload
- type IPAddressDeletePayload
- type IPAddressResolver
- type IPAddressUpdatePayload
- type IPAddressable
- type IPAddressableResolver
- type IPBlockCreatePayload
- type IPBlockDeletePayload
- type IPBlockTypeCreatePayload
- type IPBlockTypeDeletePayload
- type IPBlockTypeResolver
- type IPBlockTypeUpdatePayload
- type IPBlockUpdatePayload
- type MutationResolver
- type QueryResolver
- type Resolver
- func (r *Resolver) Entity() EntityResolver
- func (r *Resolver) Handler(withPlayground bool, middleware ...echo.MiddlewareFunc) *Handler
- func (r *Resolver) IPAddress() IPAddressResolver
- func (r *Resolver) IPAddressable() IPAddressableResolver
- func (r *Resolver) IPBlockType() IPBlockTypeResolver
- func (r *Resolver) Mutation() MutationResolver
- func (r *Resolver) Query() QueryResolver
- func (r *Resolver) ResourceOwner() ResourceOwnerResolver
- type ResolverRoot
- type ResourceOwner
- type ResourceOwnerResolver
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownType = errors.New("unknown type") ErrTypeNotFound = errors.New("type not found") )
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type ComplexityRoot ¶
type ComplexityRoot struct { Entity struct { FindIPAddressByID func(childComplexity int, id gidx.PrefixedID) int FindIPAddressableByID func(childComplexity int, id gidx.PrefixedID) int FindIPBlockByID func(childComplexity int, id gidx.PrefixedID) int FindIPBlockTypeByID func(childComplexity int, id gidx.PrefixedID) int FindResourceOwnerByID func(childComplexity int, id gidx.PrefixedID) int } IPAddress struct { CreatedAt func(childComplexity int) int ID func(childComplexity int) int IP func(childComplexity int) int IPBlock func(childComplexity int) int Node func(childComplexity int) int Reserved func(childComplexity int) int UpdatedAt func(childComplexity int) int } IPAddressConnection struct { Edges func(childComplexity int) int PageInfo func(childComplexity int) int TotalCount func(childComplexity int) int } IPAddressCreatePayload struct { IPAddress func(childComplexity int) int } IPAddressDeletePayload struct { DeletedID func(childComplexity int) int } IPAddressEdge struct { Cursor func(childComplexity int) int Node func(childComplexity int) int } IPAddressUpdatePayload struct { IPAddress func(childComplexity int) int } IPAddressable struct { ID func(childComplexity int) int IPAddresses func(childComplexity int) int } IPBlock struct { AllowAutoAllocate func(childComplexity int) int AllowAutoSubnet func(childComplexity int) int CreatedAt func(childComplexity int) int ID func(childComplexity int) int IPAddress func(childComplexity int, after *entgql.Cursor[gidx.PrefixedID], first *int, before *entgql.Cursor[gidx.PrefixedID], last *int, orderBy *generated.IPAddressOrder, where *generated.IPAddressWhereInput) int IPBlockType func(childComplexity int) int Prefix func(childComplexity int) int UpdatedAt func(childComplexity int) int } IPBlockConnection struct { Edges func(childComplexity int) int PageInfo func(childComplexity int) int TotalCount func(childComplexity int) int } IPBlockCreatePayload struct { IPBlock func(childComplexity int) int } IPBlockDeletePayload struct { DeletedID func(childComplexity int) int } IPBlockEdge struct { Cursor func(childComplexity int) int Node func(childComplexity int) int } IPBlockType struct { CreatedAt func(childComplexity int) int ID func(childComplexity int) int IPBlock func(childComplexity int, after *entgql.Cursor[gidx.PrefixedID], first *int, before *entgql.Cursor[gidx.PrefixedID], last *int, orderBy *generated.IPBlockOrder, where *generated.IPBlockWhereInput) int Name func(childComplexity int) int Owner func(childComplexity int) int UpdatedAt func(childComplexity int) int } IPBlockTypeConnection struct { Edges func(childComplexity int) int PageInfo func(childComplexity int) int TotalCount func(childComplexity int) int } IPBlockTypeCreatePayload struct { IPBlockType func(childComplexity int) int } IPBlockTypeDeletePayload struct { DeletedID func(childComplexity int) int } IPBlockTypeEdge struct { Cursor func(childComplexity int) int Node func(childComplexity int) int } IPBlockTypeUpdatePayload struct { IPBlockType func(childComplexity int) int } IPBlockUpdatePayload struct { IPBlock func(childComplexity int) int } Mutation struct { CreateIPAddress func(childComplexity int, input generated.CreateIPAddressInput) int CreateIPBlock func(childComplexity int, input generated.CreateIPBlockInput) int CreateIPBlockType func(childComplexity int, input generated.CreateIPBlockTypeInput) int DeleteIPAddress func(childComplexity int, id gidx.PrefixedID) int DeleteIPBlock func(childComplexity int, id gidx.PrefixedID) int DeleteIPBlockType func(childComplexity int, id gidx.PrefixedID) int UpdateIPAddress func(childComplexity int, id gidx.PrefixedID, input generated.UpdateIPAddressInput) int UpdateIPBlock func(childComplexity int, id gidx.PrefixedID, input generated.UpdateIPBlockInput) int UpdateIPBlockType func(childComplexity int, id gidx.PrefixedID, input generated.UpdateIPBlockTypeInput) int } PageInfo struct { EndCursor func(childComplexity int) int HasNextPage func(childComplexity int) int HasPreviousPage func(childComplexity int) int StartCursor func(childComplexity int) int } Query struct { IPAddress func(childComplexity int, id gidx.PrefixedID) int IPBlock func(childComplexity int, id gidx.PrefixedID) int IPBlockType func(childComplexity int, id gidx.PrefixedID) int // contains filtered or unexported fields } ResourceOwner struct { ID func(childComplexity int) int IPBlockType func(childComplexity int, after *entgql.Cursor[gidx.PrefixedID], first *int, before *entgql.Cursor[gidx.PrefixedID], last *int, orderBy *generated.IPBlockTypeOrder, where *generated.IPBlockTypeWhereInput) int } // contains filtered or unexported fields }
type Config ¶
type Config struct { Resolvers ResolverRoot Directives DirectiveRoot Complexity ComplexityRoot }
type DirectiveRoot ¶
type EntityResolver ¶
type EntityResolver interface { FindIPAddressByID(ctx context.Context, id gidx.PrefixedID) (*generated.IPAddress, error) FindIPAddressableByID(ctx context.Context, id gidx.PrefixedID) (*IPAddressable, error) FindIPBlockByID(ctx context.Context, id gidx.PrefixedID) (*generated.IPBlock, error) FindIPBlockTypeByID(ctx context.Context, id gidx.PrefixedID) (*generated.IPBlockType, error) FindResourceOwnerByID(ctx context.Context, id gidx.PrefixedID) (*ResourceOwner, error) }
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is an http handler wrapping a Resolver
func (*Handler) Handler ¶
func (h *Handler) Handler() http.HandlerFunc
Handler returns the http.HandlerFunc for the GraphAPI
type IPAddressCreatePayload ¶
type IPAddressCreatePayload struct { // Created ip address IPAddress *generated.IPAddress `json:"ipAddress"` }
Return response for createIPAddress mutation
type IPAddressDeletePayload ¶
type IPAddressDeletePayload struct { // Deleted ip address ID DeletedID gidx.PrefixedID `json:"deletedID"` }
Return response for deleteIPAddress mutation
type IPAddressResolver ¶
type IPAddressUpdatePayload ¶
type IPAddressUpdatePayload struct { // Updated ip address IPAddress *generated.IPAddress `json:"ipAddress"` }
Return response for updateIPAddress mutation
type IPAddressable ¶
type IPAddressable struct { ID gidx.PrefixedID `json:"id"` // IPAddressable describes IP addresses attached to a node IPAddresses []*generated.IPAddress `json:"IPAddresses"` }
IPAddressable provides an interface for describing IP addresses attached to a node
func (IPAddressable) IsEntity ¶
func (IPAddressable) IsEntity()
type IPAddressableResolver ¶
type IPBlockCreatePayload ¶
type IPBlockCreatePayload struct { // Created ip block IPBlock *generated.IPBlock `json:"ipBlock"` }
Return response for createIPBlock mutation
type IPBlockDeletePayload ¶
type IPBlockDeletePayload struct { // Deleted ip block DeletedID gidx.PrefixedID `json:"deletedID"` }
Return response for deleteIPBlock mutation
type IPBlockTypeCreatePayload ¶
type IPBlockTypeCreatePayload struct { // Created ip block type IPBlockType *generated.IPBlockType `json:"ipBlockType"` }
Return response for createIPBlockType mutation
type IPBlockTypeDeletePayload ¶
type IPBlockTypeDeletePayload struct { // Deleted ip block type DeletedID gidx.PrefixedID `json:"deletedID"` }
Return response for deleteIPBlockType mutation
type IPBlockTypeResolver ¶
type IPBlockTypeResolver interface {
Owner(ctx context.Context, obj *generated.IPBlockType) (*ResourceOwner, error)
}
type IPBlockTypeUpdatePayload ¶
type IPBlockTypeUpdatePayload struct { // Updated ip block type IPBlockType *generated.IPBlockType `json:"ipBlockType"` }
Return response for updateIPBlockType mutation
type IPBlockUpdatePayload ¶
type IPBlockUpdatePayload struct { // Updated ip block IPBlock *generated.IPBlock `json:"ipBlock"` }
Return response for updateIPBlock mutation
type MutationResolver ¶
type MutationResolver interface { CreateIPAddress(ctx context.Context, input generated.CreateIPAddressInput) (*IPAddressCreatePayload, error) UpdateIPAddress(ctx context.Context, id gidx.PrefixedID, input generated.UpdateIPAddressInput) (*IPAddressUpdatePayload, error) DeleteIPAddress(ctx context.Context, id gidx.PrefixedID) (*IPAddressDeletePayload, error) CreateIPBlock(ctx context.Context, input generated.CreateIPBlockInput) (*IPBlockCreatePayload, error) UpdateIPBlock(ctx context.Context, id gidx.PrefixedID, input generated.UpdateIPBlockInput) (*IPBlockUpdatePayload, error) DeleteIPBlock(ctx context.Context, id gidx.PrefixedID) (*IPBlockDeletePayload, error) CreateIPBlockType(ctx context.Context, input generated.CreateIPBlockTypeInput) (*IPBlockTypeCreatePayload, error) UpdateIPBlockType(ctx context.Context, id gidx.PrefixedID, input generated.UpdateIPBlockTypeInput) (*IPBlockTypeUpdatePayload, error) DeleteIPBlockType(ctx context.Context, id gidx.PrefixedID) (*IPBlockTypeDeletePayload, error) }
type QueryResolver ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver provides a graph response resolver
func NewResolver ¶
func NewResolver(client *ent.Client, logger *zap.SugaredLogger) *Resolver
NewResolver returns a resolver configured with the given ent client
func (*Resolver) Entity ¶
func (r *Resolver) Entity() EntityResolver
Entity returns EntityResolver implementation.
func (*Resolver) IPAddress ¶
func (r *Resolver) IPAddress() IPAddressResolver
IPAddress returns IPAddressResolver implementation.
func (*Resolver) IPAddressable ¶
func (r *Resolver) IPAddressable() IPAddressableResolver
IPAddressable returns IPAddressableResolver implementation.
func (*Resolver) IPBlockType ¶
func (r *Resolver) IPBlockType() IPBlockTypeResolver
IPBlockType returns IPBlockTypeResolver implementation.
func (*Resolver) Mutation ¶
func (r *Resolver) Mutation() MutationResolver
Mutation returns MutationResolver implementation.
func (*Resolver) Query ¶
func (r *Resolver) Query() QueryResolver
Query returns QueryResolver implementation.
func (*Resolver) ResourceOwner ¶ added in v0.0.3
func (r *Resolver) ResourceOwner() ResourceOwnerResolver
ResourceOwner returns ResourceOwnerResolver implementation.
type ResolverRoot ¶
type ResolverRoot interface { Entity() EntityResolver IPAddress() IPAddressResolver IPAddressable() IPAddressableResolver IPBlockType() IPBlockTypeResolver Mutation() MutationResolver Query() QueryResolver ResourceOwner() ResourceOwnerResolver }
type ResourceOwner ¶ added in v0.0.3
type ResourceOwner struct { ID gidx.PrefixedID `json:"id"` IPBlockType *generated.IPBlockTypeConnection `json:"ipBlockType"` }
func (ResourceOwner) IsEntity ¶ added in v0.0.3
func (ResourceOwner) IsEntity()
type ResourceOwnerResolver ¶ added in v0.0.3
type ResourceOwnerResolver interface {
IPBlockType(ctx context.Context, obj *ResourceOwner, after *entgql.Cursor[gidx.PrefixedID], first *int, before *entgql.Cursor[gidx.PrefixedID], last *int, orderBy *generated.IPBlockTypeOrder, where *generated.IPBlockTypeWhereInput) (*generated.IPBlockTypeConnection, error)
}