search

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DateRangeQuery

type DateRangeQuery struct {
	Field      string
	Gt         string
	Gte        string
	Lt         string
	Lte        string
	Format     string
	To         string
	From       string
	TermFilter []TermQuery
}

DateRangeQuery is the properties required for a date range query in the resource finder

type Finder

type Finder struct {
	Client *elastic.Client
}

Finder is the connection to elasticsearch

func NewFinder

func NewFinder(config *common.Config) (*Finder, error)

NewFinder creates a new elasticsearch finder. It doesn't currently allow for all possible elasticsearch settings, but only the ones we need.

func (*Finder) DoDateRangeQuery

func (f *Finder) DoDateRangeQuery(index, rtype string, drqs ...*DateRangeQuery) ([]*Resource, error)

DoDateRangeQuery searches elasticsearch for a variable number of date range queries

func (*Finder) DoGet

func (f *Finder) DoGet(index, rtype, id string) (*Resource, error)

DoGet does the get of an ID and returns a resource

type Resource

type Resource struct {
	Account                  string
	CreatedBy                string `json:"yale:created_by"`
	SupportDepartmentContact string `json:"SupportDepartmentContact"`
	ID                       string
	Name                     string `json:"name,omitempty"`
	Provider                 string
	Status                   string
	RenewedAt                string `json:"yale:renewed_at,omitempty"`
	NotifiedAt               string `json:"yale:notified_at,omitempty"`
	FQDN                     string `json:"yale:fqdn,omitempty"`
	Org                      string `json:"yale:org,omitempty"`
}

Resource is the resource object returned from elasticsearch

type TermQuery

type TermQuery struct {
	Term  string
	Value string
}

TermQuery is the properties required for a term query in the resource finder

func NewTermQueryList

func NewTermQueryList(filters map[string]string) []TermQuery

NewTermQueryList generates a new list of term queries from a map of strings to strings it functions mostly as a helper to get from configuration to implementation.

Jump to

Keyboard shortcuts

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