querysvc

package
v0.4.23 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const APIName = "lfx-v2-query-service"

APIName is the name of the API as defined in the design.

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the API as defined in the design.

View Source
const ServiceName = "query-svc"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [6]string{"query-resources", "query-resources-count", "query-orgs", "suggest-orgs", "readyz", "livez"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeNotReady

func MakeNotReady(err error) *goa.ServiceError

MakeNotReady builds a goa.ServiceError from an error.

func NewLivezEndpoint

func NewLivezEndpoint(s Service) goa.Endpoint

NewLivezEndpoint returns an endpoint function that calls the method "livez" of service "query-svc".

func NewQueryOrgsEndpoint added in v0.4.0

func NewQueryOrgsEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewQueryOrgsEndpoint returns an endpoint function that calls the method "query-orgs" of service "query-svc".

func NewQueryResourcesCountEndpoint added in v0.4.5

func NewQueryResourcesCountEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewQueryResourcesCountEndpoint returns an endpoint function that calls the method "query-resources-count" of service "query-svc".

func NewQueryResourcesEndpoint

func NewQueryResourcesEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewQueryResourcesEndpoint returns an endpoint function that calls the method "query-resources" of service "query-svc".

func NewReadyzEndpoint

func NewReadyzEndpoint(s Service) goa.Endpoint

NewReadyzEndpoint returns an endpoint function that calls the method "readyz" of service "query-svc".

func NewSuggestOrgsEndpoint added in v0.4.1

func NewSuggestOrgsEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewSuggestOrgsEndpoint returns an endpoint function that calls the method "suggest-orgs" of service "query-svc".

Types

type Auther

type Auther interface {
	// JWTAuth implements the authorization logic for the JWT security scheme.
	JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type BadRequestError

type BadRequestError struct {
	// Error message
	Message string
}

func (*BadRequestError) Error

func (e *BadRequestError) Error() string

Error returns an error description.

func (*BadRequestError) ErrorName deprecated

func (e *BadRequestError) ErrorName() string

ErrorName returns "BadRequestError".

Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105

func (*BadRequestError) GoaErrorName

func (e *BadRequestError) GoaErrorName() string

GoaErrorName returns "BadRequestError".

type Client

type Client struct {
	QueryResourcesEndpoint      goa.Endpoint
	QueryResourcesCountEndpoint goa.Endpoint
	QueryOrgsEndpoint           goa.Endpoint
	SuggestOrgsEndpoint         goa.Endpoint
	ReadyzEndpoint              goa.Endpoint
	LivezEndpoint               goa.Endpoint
}

Client is the "query-svc" service client.

func NewClient

func NewClient(queryResources, queryResourcesCount, queryOrgs, suggestOrgs, readyz, livez goa.Endpoint) *Client

NewClient initializes a "query-svc" service client given the endpoints.

func (*Client) Livez

func (c *Client) Livez(ctx context.Context) (res []byte, err error)

Livez calls the "livez" endpoint of the "query-svc" service. Livez may return the following errors:

  • "BadRequest" (type *BadRequestError): Bad request
  • "NotFound" (type *NotFoundError): Not found
  • "InternalServerError" (type *InternalServerError): Internal server error
  • "ServiceUnavailable" (type *ServiceUnavailableError): Service unavailable
  • error: internal error

func (*Client) QueryOrgs added in v0.4.0

func (c *Client) QueryOrgs(ctx context.Context, p *QueryOrgsPayload) (res *Organization, err error)

QueryOrgs calls the "query-orgs" endpoint of the "query-svc" service. QueryOrgs may return the following errors:

  • "BadRequest" (type *BadRequestError): Bad request
  • "NotFound" (type *NotFoundError): Not found
  • "InternalServerError" (type *InternalServerError): Internal server error
  • "ServiceUnavailable" (type *ServiceUnavailableError): Service unavailable
  • error: internal error

func (*Client) QueryResources

func (c *Client) QueryResources(ctx context.Context, p *QueryResourcesPayload) (res *QueryResourcesResult, err error)

QueryResources calls the "query-resources" endpoint of the "query-svc" service. QueryResources may return the following errors:

  • "BadRequest" (type *BadRequestError): Bad request
  • "NotFound" (type *NotFoundError): Not found
  • "InternalServerError" (type *InternalServerError): Internal server error
  • "ServiceUnavailable" (type *ServiceUnavailableError): Service unavailable
  • error: internal error

func (*Client) QueryResourcesCount added in v0.4.5

func (c *Client) QueryResourcesCount(ctx context.Context, p *QueryResourcesCountPayload) (res *QueryResourcesCountResult, err error)

QueryResourcesCount calls the "query-resources-count" endpoint of the "query-svc" service. QueryResourcesCount may return the following errors:

  • "BadRequest" (type *BadRequestError): Bad request
  • "NotFound" (type *NotFoundError): Not found
  • "InternalServerError" (type *InternalServerError): Internal server error
  • "ServiceUnavailable" (type *ServiceUnavailableError): Service unavailable
  • error: internal error

func (*Client) Readyz

func (c *Client) Readyz(ctx context.Context) (res []byte, err error)

Readyz calls the "readyz" endpoint of the "query-svc" service. Readyz may return the following errors:

  • "NotReady" (type *goa.ServiceError): Service is not ready yet
  • "BadRequest" (type *BadRequestError): Bad request
  • "NotFound" (type *NotFoundError): Not found
  • "InternalServerError" (type *InternalServerError): Internal server error
  • "ServiceUnavailable" (type *ServiceUnavailableError): Service unavailable
  • error: internal error

func (*Client) SuggestOrgs added in v0.4.1

func (c *Client) SuggestOrgs(ctx context.Context, p *SuggestOrgsPayload) (res *SuggestOrgsResult, err error)

SuggestOrgs calls the "suggest-orgs" endpoint of the "query-svc" service. SuggestOrgs may return the following errors:

  • "BadRequest" (type *BadRequestError): Bad request
  • "NotFound" (type *NotFoundError): Not found
  • "InternalServerError" (type *InternalServerError): Internal server error
  • "ServiceUnavailable" (type *ServiceUnavailableError): Service unavailable
  • error: internal error

type Endpoints

type Endpoints struct {
	QueryResources      goa.Endpoint
	QueryResourcesCount goa.Endpoint
	QueryOrgs           goa.Endpoint
	SuggestOrgs         goa.Endpoint
	Readyz              goa.Endpoint
	Livez               goa.Endpoint
}

Endpoints wraps the "query-svc" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "query-svc" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "query-svc" service endpoints.

type InternalServerError

type InternalServerError struct {
	// Error message
	Message string
}

func (*InternalServerError) Error

func (e *InternalServerError) Error() string

Error returns an error description.

func (*InternalServerError) ErrorName deprecated

func (e *InternalServerError) ErrorName() string

ErrorName returns "InternalServerError".

Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105

func (*InternalServerError) GoaErrorName

func (e *InternalServerError) GoaErrorName() string

GoaErrorName returns "InternalServerError".

type NotFoundError added in v0.4.0

type NotFoundError struct {
	// Error message
	Message string
}

func (*NotFoundError) Error added in v0.4.0

func (e *NotFoundError) Error() string

Error returns an error description.

func (*NotFoundError) ErrorName deprecated added in v0.4.0

func (e *NotFoundError) ErrorName() string

ErrorName returns "NotFoundError".

Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105

func (*NotFoundError) GoaErrorName added in v0.4.0

func (e *NotFoundError) GoaErrorName() string

GoaErrorName returns "NotFoundError".

type Organization added in v0.4.0

type Organization struct {
	// Organization name
	Name *string
	// Organization domain
	Domain *string
	// Organization industry classification
	Industry *string
	// Business sector classification
	Sector *string
	// Employee count or range
	Employees *string
}

Organization is the result type of the query-svc service query-orgs method.

type OrganizationSuggestion added in v0.4.1

type OrganizationSuggestion struct {
	// Organization name
	Name string
	// Organization domain
	Domain string
	Logo *string
}

An organization suggestion for the search.

type QueryOrgsPayload added in v0.4.0

type QueryOrgsPayload struct {
	// Token
	BearerToken string
	// Version of the API
	Version string
	// Organization name
	Name *string
	// Organization domain or website URL
	Domain *string
}

QueryOrgsPayload is the payload type of the query-svc service query-orgs method.

type QueryResourcesCountPayload added in v0.4.5

type QueryResourcesCountPayload struct {
	// JWT token issued by Heimdall
	BearerToken string
	// Version of the API
	Version string
	// Resource name or alias; supports typeahead
	Name *string
	// Parent (for navigation; varies by object type)
	Parent *string
	// Resource type to search
	Type *string
	// Tags to search with OR logic - matches resources with any of these tags
	Tags []string
	// Tags to search with AND logic - matches resources that have all of these tags
	TagsAll []string
	// Date field to filter on (within data object) - used with date_from and/or
	// date_to. Supports ISO 8601 datetime (2006-01-02T15:04:05Z) or date-only
	// (2006-01-02, assumes UTC)
	DateField *string
	// Start date (inclusive). Format: ISO 8601 datetime or date-only. Date-only
	// uses start of day UTC. Requires date_field.
	DateFrom *string
	// End date (inclusive). Format: ISO 8601 datetime or date-only. Date-only uses
	// end of day UTC. Requires date_field.
	DateTo *string
	// Direct field filters with term clauses on data fields - format:
	// 'field:value' (e.g., 'status:active'). Fields are automatically prefixed
	// with 'data.'
	Filters []string
	// Direct field filters with term clauses on data fields using AND logic -
	// format: 'field:value' (e.g., 'status:active'). Fields are automatically
	// prefixed with 'data.'. Matches resources that satisfy all of the provided
	// filters.
	FiltersAll []string
	// Direct field filters with term clauses on data fields using OR logic -
	// format: 'field:value' (e.g., 'status:active'). Fields are automatically
	// prefixed with 'data.'. Matches resources that satisfy at least one of the
	// provided filters.
	FiltersOr []string
}

QueryResourcesCountPayload is the payload type of the query-svc service query-resources-count method.

type QueryResourcesCountResult added in v0.4.5

type QueryResourcesCountResult struct {
	// Count of resources found
	Count uint64
	// True if count is not guaranteed to be exhaustive: client should request a
	// narrower query
	HasMore bool
	// Cache control header
	CacheControl *string
}

QueryResourcesCountResult is the result type of the query-svc service query-resources-count method.

type QueryResourcesPayload

type QueryResourcesPayload struct {
	// Token
	BearerToken string
	// Version of the API
	Version string
	// Resource name or alias; supports typeahead
	Name *string
	// Parent (for navigation; varies by object type)
	Parent *string
	// Resource type to search
	Type *string
	// Tags to search with OR logic - matches resources with any of these tags
	Tags []string
	// Tags to search with AND logic - matches resources that have all of these tags
	TagsAll []string
	// Date field to filter on (within data object) - used with date_from and/or
	// date_to. Supports ISO 8601 datetime (2006-01-02T15:04:05Z) or date-only
	// (2006-01-02, assumes UTC)
	DateField *string
	// Start date (inclusive). Format: ISO 8601 datetime or date-only. Date-only
	// uses start of day UTC. Requires date_field.
	DateFrom *string
	// End date (inclusive). Format: ISO 8601 datetime or date-only. Date-only uses
	// end of day UTC. Requires date_field.
	DateTo *string
	// Direct field filters with term clauses on data fields - format:
	// 'field:value' (e.g., 'status:active'). Fields are automatically prefixed
	// with 'data.'
	Filters []string
	// Direct field filters with term clauses on data fields using AND logic -
	// format: 'field:value' (e.g., 'status:active'). Fields are automatically
	// prefixed with 'data.'. Matches resources that satisfy all of the provided
	// filters.
	FiltersAll []string
	// Direct field filters with term clauses on data fields using OR logic -
	// format: 'field:value' (e.g., 'status:active'). Fields are automatically
	// prefixed with 'data.'. Matches resources that satisfy at least one of the
	// provided filters.
	FiltersOr []string
	// CEL expression to filter results on resource data fields. Available
	// variables: data (map), resource_type (string), id (string)
	CelFilter *string
	// Filter results to only resources the authenticated user has direct FGA
	// grants on. Requires type. Use 'direct' to filter by direct grants.
	FilterGrants *string
	// Sort order for results
	Sort string
	// Opaque token for pagination
	PageToken *string
	// Number of results per page
	PageSize int
}

QueryResourcesPayload is the payload type of the query-svc service query-resources method.

type QueryResourcesResult

type QueryResourcesResult struct {
	// Resources found
	Resources []*Resource
	// Opaque token if more results are available
	PageToken *string
	// Cache control header
	CacheControl *string
}

QueryResourcesResult is the result type of the query-svc service query-resources method.

type Resource

type Resource struct {
	// Resource type
	Type *string
	// Resource ID (within its resource collection)
	ID *string
	// Resource data snapshot
	Data any
}

A resource is a universal representation of an LFX API resource for indexing.

type Service

type Service interface {
	// Locate resources by their type or parent, or use typeahead search to query
	// resources by a display name or similar alias.
	QueryResources(context.Context, *QueryResourcesPayload) (res *QueryResourcesResult, err error)
	// Count matching resources by query.
	QueryResourcesCount(context.Context, *QueryResourcesCountPayload) (res *QueryResourcesCountResult, err error)
	// Locate a single organization by name or domain.
	QueryOrgs(context.Context, *QueryOrgsPayload) (res *Organization, err error)
	// Get organization suggestions for typeahead search based on a query.
	SuggestOrgs(context.Context, *SuggestOrgsPayload) (res *SuggestOrgsResult, err error)
	// Check if the service is able to take inbound requests.
	Readyz(context.Context) (res []byte, err error)
	// Check if the service is alive.
	Livez(context.Context) (res []byte, err error)
}

The query service provides resource and user queries.

type ServiceUnavailableError

type ServiceUnavailableError struct {
	// Error message
	Message string
}

func (*ServiceUnavailableError) Error

func (e *ServiceUnavailableError) Error() string

Error returns an error description.

func (*ServiceUnavailableError) ErrorName deprecated

func (e *ServiceUnavailableError) ErrorName() string

ErrorName returns "ServiceUnavailableError".

Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105

func (*ServiceUnavailableError) GoaErrorName

func (e *ServiceUnavailableError) GoaErrorName() string

GoaErrorName returns "ServiceUnavailableError".

type SuggestOrgsPayload added in v0.4.1

type SuggestOrgsPayload struct {
	// Token
	BearerToken string
	// Version of the API
	Version string
	// Search query for organization suggestions
	Query string
}

SuggestOrgsPayload is the payload type of the query-svc service suggest-orgs method.

type SuggestOrgsResult added in v0.4.1

type SuggestOrgsResult struct {
	// Organization suggestions
	Suggestions []*OrganizationSuggestion
}

SuggestOrgsResult is the result type of the query-svc service suggest-orgs method.

Jump to

Keyboard shortcuts

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