inconfig

package
v3.1.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package inconfig contains the functions that convert from backend config to the config that integrations accept. TODO: config conversion should be moved into integrations directly

Index

Constants

Variables

This section is empty.

Functions

func ConvertEdgeCases

func ConvertEdgeCases(in *IntegrationAgent) error

TODO: the backend should send us the correct data for each integration

Types

type Integration

type Integration struct {
	IntegrationBase
	Config map[string]interface{} `json:"config"`
}

type IntegrationAgent

type IntegrationAgent struct {
	IntegrationBase
	Config IntegrationConfigAgent `json:"config"`
}

func AuthFromEvent

func AuthFromEvent(data map[string]interface{}, encryptionKey string) (in IntegrationAgent, err error)

AuthFromEvent converts the config received from backend export or onboarding events and converts it to config that integrations can accept (inconfig.IntegrationAgent). Also requires encryptionKey to decrypt the auth data.

type IntegrationBase

type IntegrationBase struct {
	// ID is the integration id passed from backend. We add it to last processed key to avoid conflicts and to maintain state in case ordering of integrations changes in export.
	// Can be left empty when export is called manually in that case will use index in integration array instead.
	ID   string          `json:"id"`
	Name string          `json:"name"`
	Type IntegrationType `json:"type"` // sourcecode or work
}

func (IntegrationBase) IntegrationDef

func (s IntegrationBase) IntegrationDef() (res IntegrationDef)

type IntegrationConfigAgent

type IntegrationConfigAgent struct {
	// URL URL of instance if relevant
	URL string `json:"url"`
	// Username Username for instance, if relevant
	Username string `json:"username"`
	// Password Password for instance, if relevant
	Password string `json:"password"`
	// CollectionName Collection name for instance, if relevant
	CollectionName string `json:"collection_name"`
	// APIKey API Key for instance, if relevant
	APIKey string `json:"api_key"`
	// Hostname Hostname for instance, if relevant
	Hostname string `json:"hostname"`
	// APIVersion the api version of the integration
	APIVersion string `json:"api_version"`
	// Organization Organization for instance, if relevant
	Organization string `json:"organization"`
	// Exclusions list of exclusions
	Exclusions []string `json:"exclusions"`
	// Exclusions list of inclusions
	Inclusions []string `json:"inclusions"`
	// AccessToken Access token
	AccessToken string `json:"access_token"`
	// RefreshToken Refresh token
	RefreshToken string `json:"refresh_token"`
}

type IntegrationDef

type IntegrationDef struct {
	// Name is the name of the integration binary
	Name string

	// Type is the value of the type option passed to binary.
	// Can be empty if binary contains only one integration.
	Type IntegrationType
}

IntegrationDef defines a unique integration. Since some integration binaries contain different integrations based on type, we neeed to include type as well.

func (IntegrationDef) Empty

func (s IntegrationDef) Empty() bool

func (IntegrationDef) String

func (s IntegrationDef) String() string

type IntegrationType

func TypeFromString

func TypeFromString(t string) (IntegrationType, error)

func (IntegrationType) String

func (in IntegrationType) String() string

Jump to

Keyboard shortcuts

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