service

package
v2.0.0-k8s-fix-members... Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoElasticClient = errors.New("no ElasticSearch client available")
)

Functions

func NewElasticClient

func NewElasticClient(region string, config EsAccessConfig) (*elastic.Client, error)

Types

type AWSSigningTransport

type AWSSigningTransport struct {
	HTTPClient  *http.Client
	Credentials awsauth.Credentials
}

func (AWSSigningTransport) RoundTrip

func (a AWSSigningTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implementation

type AggregateConceptModel

type AggregateConceptModel struct {
	// Required fields
	PrefUUID   string `json:"prefUUID"`
	DirectType string `json:"type"`
	PrefLabel  string `json:"prefLabel"`
	// Additional fields
	Aliases   []string `json:"aliases,omitempty"`
	ScopeNote string   `json:"scopeNote,omitempty"`
	// Membership
	MembershipRoles  []AggregateMembershipRole `json:"membershipRoles,omitempty"`
	OrganisationUUID string                    `json:"organisationUUID,omitempty"`
	PersonUUID       string                    `json:"personUUID,omitempty"`
	// Organisation
	CountryCode            string `json:"countryCode,omitempty"`
	CountryOfIncorporation string `json:"countryOfIncorporation,omitempty"`
	IsDeprecated           bool   `json:"isDeprecated,omitempty"`
	// Source representations
	SourceRepresentations []SourceConcept `json:"sourceRepresentations"`
}

func (AggregateConceptModel) ConcordedUUIDs

func (c AggregateConceptModel) ConcordedUUIDs() []string

func (AggregateConceptModel) GetAuthorities

func (c AggregateConceptModel) GetAuthorities() []string

func (AggregateConceptModel) PreferredUUID

func (c AggregateConceptModel) PreferredUUID() string

type AggregateMembershipRole

type AggregateMembershipRole struct {
	RoleUUID        string `json:"membershipRoleUUID,omitempty"`
	InceptionDate   string `json:"inceptionDate,omitempty"`
	TerminationDate string `json:"terminationDate,omitempty"`
}

type BulkProcessorConfig

type BulkProcessorConfig struct {
	// contains filtered or unexported fields
}

func NewBulkProcessorConfig

func NewBulkProcessorConfig(nrWorkers int, nrOfRequests int, bulkSize int, flushInterval time.Duration) BulkProcessorConfig

type Concept

type Concept interface {
	// GetAuthorities returns an array containing all authorities that this concept is identified by
	GetAuthorities() []string
	// ConcordedUUIDs returns an array containing all concorded concept uuids - N.B. it will not contain the canonical prefUUID.
	ConcordedUUIDs() []string

	PreferredUUID() string
}

Concept contains common function between both concept models

type ConceptMetrics

type ConceptMetrics struct {
	AnnotationsCount         int `json:"annotationsCount"`
	PrevWeekAnnotationsCount int `json:"prevWeekAnnotationsCount"`
}

type ConceptModel

type ConceptModel struct {
	UUID                   string                 `json:"uuid"`
	DirectType             string                 `json:"type"`
	PrefLabel              string                 `json:"prefLabel"`
	Authority              string                 `json:"authority,omitempty"`
	Aliases                []string               `json:"aliases,omitempty"`
	AlternativeIdentifiers map[string]interface{} `json:"alternativeIdentifiers,omitempty"`
	IsDeprecated           bool                   `json:"isDeprecated,omitempty"`
	ScopeNote              string                 `json:"scopeNote,omitempty"`
}

func (ConceptModel) ConcordedUUIDs

func (c ConceptModel) ConcordedUUIDs() []string

func (ConceptModel) GetAuthorities

func (c ConceptModel) GetAuthorities() []string

func (ConceptModel) PreferredUUID

func (c ConceptModel) PreferredUUID() string

type EsAccessConfig

type EsAccessConfig struct {
	// contains filtered or unexported fields
}

func NewAccessConfig

func NewAccessConfig(accessKey string, secretKey string, endpoint string, tracelogging bool) EsAccessConfig

type EsConceptModel

type EsConceptModel struct {
	Id                     string          `json:"id"`
	ApiUrl                 string          `json:"apiUrl"`
	PrefLabel              string          `json:"prefLabel"`
	Types                  []string        `json:"types"`
	Authorities            []string        `json:"authorities"`
	DirectType             string          `json:"directType"`
	Aliases                []string        `json:"aliases,omitempty"`
	LastModified           string          `json:"lastModified"`
	PublishReference       string          `json:"publishReference"`
	IsDeprecated           bool            `json:"isDeprecated,omitempty"` // stored only if this is true
	ScopeNote              string          `json:"scopeNote,omitempty"`
	CountryCode            string          `json:"countryCode,omitempty"`
	CountryOfIncorporation string          `json:"countryOfIncorporation,omitempty"`
	Metrics                *ConceptMetrics `json:"metrics,omitempty"`
}

type EsConceptModelPatch

type EsConceptModelPatch struct {
	Metrics *ConceptMetrics `json:"metrics"`
}

type EsIDTypePair

type EsIDTypePair struct {
	ID   string `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
}

type EsMembershipModel

type EsMembershipModel struct {
	Id             string   `json:"id"`
	PersonId       string   `json:"personId"`
	OrganisationId string   `json:"organisationId"`
	Memberships    []string `json:"memberships"`
}

type EsModel

type EsModel interface{}

func ConvertAggregateConceptToESConceptModel

func ConvertAggregateConceptToESConceptModel(concept AggregateConceptModel, conceptType string, publishRef string) (esModel EsModel)

func ConvertConceptToESConceptModel

func ConvertConceptToESConceptModel(concept ConceptModel, conceptType string, publishRef string) EsModel

type EsPersonConceptModel

type EsPersonConceptModel struct {
	*EsConceptModel
	IsFTAuthor string `json:"isFTAuthor"`
}

type EsPersonConceptPatch

type EsPersonConceptPatch struct {
	Metrics    *ConceptMetrics `json:"metrics"`
	IsFTAuthor string          `json:"isFTAuthor"`
}

type EsService

type EsService interface {
	LoadData(ctx context.Context, conceptType string, uuid string, payload EsModel) (bool, *elastic.IndexResponse, error)
	ReadData(conceptType string, uuid string) (*elastic.GetResult, error)
	DeleteData(ctx context.Context, conceptType string, uuid string) (*elastic.DeleteResponse, error)
	LoadBulkData(conceptType string, uuid string, payload interface{})
	CleanupData(ctx context.Context, concept Concept)
	PatchUpdateConcept(ctx context.Context, conceptType string, uuid string, payload PayloadPatch)
	CloseBulkProcessor() error
	GetClusterHealth() (*elastic.ClusterHealthResponse, error)
	IsIndexReadOnly() (bool, string, error)
	GetAllIds(ctx context.Context) chan EsIDTypePair
}

func NewEsService

func NewEsService(ch chan *elastic.Client, indexName string, bulkProcessorConfig *BulkProcessorConfig) EsService

type PayloadPatch

type PayloadPatch interface{}

type SourceConcept

type SourceConcept struct {
	UUID      string `json:"uuid"`
	Authority string `json:"authority"`
}

Jump to

Keyboard shortcuts

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