Documentation
¶
Index ¶
- type Client
- func (client *Client) ClaimTask(ctx context.Context, id int) (*ent.Task, error)
- func (client *Client) ClaimTasks(ctx context.Context, vars models.ClaimTasksRequest) ([]*ent.Task, error)
- func (client *Client) CreateTag(ctx context.Context, vars models.CreateTagRequest) (*ent.Tag, error)
- func (client *Client) CreateTags(ctx context.Context, names ...string) (map[string]*ent.Tag, error)
- func (client *Client) CreateTarget(ctx context.Context, vars models.CreateTargetRequest) (*ent.Target, error)
- func (client *Client) Do(ctx context.Context, request Request, dst interface{}) error
- func (client *Client) ListTags(ctx context.Context) (map[string]*ent.Tag, error)
- func (client *Client) SubmitTaskResult(ctx context.Context, vars models.SubmitTaskResultRequest) error
- type Error
- type MutationResolver
- type QueryResolver
- type Request
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { URL string HTTP *http.Client Service string PublicKey ed25519.PublicKey PrivateKey ed25519.PrivateKey }
A Client can be used to request GraphQL queries and mutations using HTTP.
func (*Client) ClaimTasks ¶
func (client *Client) ClaimTasks(ctx context.Context, vars models.ClaimTasksRequest) ([]*ent.Task, error)
ClaimTasks for a target that has the provided attributes, returning an array of tasks to execute. If no tasks are available, an empty task array is returned. If no target can be found, an error will be returned.
func (*Client) CreateTag ¶ added in v0.3.0
func (client *Client) CreateTag(ctx context.Context, vars models.CreateTagRequest) (*ent.Tag, error)
CreateTag will create a tag, but may error if the tag already exists.
func (*Client) CreateTags ¶ added in v0.3.0
CreateTags ensures that the provided set of tags exists and creates any that do not yet exist. If duplicate tag names are provided, the tag will only be created once.
func (*Client) CreateTarget ¶ added in v0.3.0
func (client *Client) CreateTarget(ctx context.Context, vars models.CreateTargetRequest) (*ent.Target, error)
CreateTarget creates a target, but may error if it already exists.
func (*Client) Do ¶
Do executes a GraphQL request and unmarshals the JSON result into the destination struct.
func (*Client) ListTags ¶ added in v0.3.0
ListTags provides a map of name to tag for all existing tags.
func (*Client) SubmitTaskResult ¶
func (client *Client) SubmitTaskResult(ctx context.Context, vars models.SubmitTaskResultRequest) error
SubmitTaskResult updates a task with execution output.
type MutationResolver ¶ added in v0.3.0
type MutationResolver generated.MutationResolver
MutationResolver is an alias for github.com/kcarretto/paragon/graphql/generated.MutationResolver
type QueryResolver ¶ added in v0.3.0
type QueryResolver generated.QueryResolver
QueryResolver is an alias for github.com/kcarretto/paragon/graphql/generated.QueryResolver
type Request ¶
type Request struct { Operation string `json:"operationName"` Query string `json:"query"` Variables interface{} `json:"variables,omitempty"` }
A Request stores execution properties of GraphQL queries and mutations.
type Service ¶ added in v0.3.0
type Service struct { Log *zap.Logger Graph *ent.Client Events event.Publisher Auth service.Authenticator }
Service provides HTTP handlers for the GraphQL schema.
func (*Service) HandleGraphQL ¶ added in v0.3.0
func (svc *Service) HandleGraphQL() http.HandlerFunc
HandleGraphQL initializes and returns a new GraphQL API handler.
func (*Service) HandlePlayground ¶ added in v0.3.0
func (svc *Service) HandlePlayground() http.HandlerFunc
HandlePlayground initializes and returns a new GraphQL Playground handler.