configs

package
v0.0.0-...-f15f0a0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	Inputs map[string]struct {
		Label            string    `json:"label"`
		Tip              string    `json:"tip"`
		IsRequired       bool      `mapstructure:"is_required" json:"is_required"`
		IsAdministrative bool      `mapstructure:"is_administrative" json:"is_administrative"`
		InputKind        InputKind `mapstructure:"input_kind" json:"input_kind"`
		DefaultValue     string    `mapstructure:"default_value" json:"default_value"`
		Dropdown         Dropdown  `json:"dropdown"`
	} `json:"inputs"`
	API Endpoint `json:"api"`
}

APIKey holds the necessary information for getting authorisation via api keys.

type Action

type Action struct {
	Label      string           `json:"label"`
	Tip        string           `json:"tip"`
	ActionKind ActionKind       `json:"action_kind"`
	Inputs     map[string]Input `json:"inputs"`
	API        Endpoint         `json:"api"`
}

Action specifies an action operation.

type ActionKind

type ActionKind string

ActionKind is the type of action.

const (
	ActionKindAction ActionKind = "action"
	ActionKindSearch ActionKind = "search"
)

...

type AppCredentialsConfig

type AppCredentialsConfig struct {
	Version  uint       `json:"version"`
	Kind     ConfigKind `json:"kind"`
	Metadata struct {
		AppName string   `mapstructure:"app_name" json:"app_name"`
		AppID   UUID     `mapstructure:"app_id" json:"app_id"`
		Authors []Author `json:"authors"`
	} `json:"metadata"`
	Auths struct {
		OAuth2s []struct {
			Fields map[string][]string `json:"fields"`
			Envs   struct {
				ClientID     string `mapstructure:"client_id" json:"client_id"`
				ClientSecret string `mapstructure:"client_secret" json:"client_secret"`
				RedirectURI  string `mapstructure:"redirect_uri" json:"redirect_uri"`
			} `json:"envs"`
		} `json:"oauth2s"`
		APIKeys []struct {
			Fields map[string][]string `json:"fields"`
			Envs   struct {
				APIKey string `mapstructure:"api_key" json:"api_key"`
			} `json:"envs"`
		} `json:"api_keys"`
	} `json:"auths"`
}

AppCredentialsConfig contains app-specific information for establishing auth.

type AuthKind

type AuthKind string

AuthKind is the type of authorisation an App supports.

const (
	AuthKindOAuth2 AuthKind = "oauth2"
)

...

type Author

type Author struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

Author describes the author of a config file.

type ConfigFormat

type ConfigFormat string

ConfigFormat is the different config format supported by Gigamono.

const (
	YAML ConfigFormat = "YAML"
	JSON ConfigFormat = "JSON"
	TOML ConfigFormat = "TOML"
)

...

func ToConfigFormat

func ToConfigFormat(format string) (ConfigFormat, error)

ToConfigFormat convert a string to ConfigFormat.

type ConfigKind

type ConfigKind string

ConfigKind represents the kind of config file.

const (
	Integration            ConfigKind = "integration"
	Workflow               ConfigKind = "workflow"
	Gigamono               ConfigKind = "gigamono"
	IntegrationCredentials ConfigKind = "integration_credentials"
)

...

type DocumentConfig

type DocumentConfig struct {
	Version  uint       `json:"version"`
	Kind     ConfigKind `json:"kind"`
	Metadata struct {
		Name        string   `json:"name"`
		Description string   `json:"description"`
		Authors     []Author `json:"authors"`
	} `json:"metadata"`
}

DocumentConfig represents a table configuration.

func NewDocumentConfig

func NewDocumentConfig(documentString string, format ConfigFormat) (DocumentConfig, error)

NewDocumentConfig creates a DocumentConfig from string. Supports JSON, TOML and YAML string format.

func (*DocumentConfig) JSON

func (config *DocumentConfig) JSON() (string, error)

JSON converts config to json.

type Dropdown struct {
	Kind           DropdownKind `json:"kind"`
	AllowsMultiple bool         `mapstructure:"allows_multiple" json:"allows_multiple"`
	AllowsCustom   bool         `mapstructure:"allows_custom" json:"allows_custom"`
	Options        []string     `json:"options"`
}

Dropdown specifies dropdown information.

type DropdownKind string

DropdownKind is the type of dropdown.

const (
	Static  DropdownKind = "static"
	Dynamic DropdownKind = "dynamic"
)

...

type Endpoint

type Endpoint struct {
	Code     string `json:"code"`
	Language string `json:"language"`
	Form     struct {
		Method  string            `json:"method"`
		URL     string            `json:"url"`
		Headers map[string]string `json:"headers"`
		Params  map[string]string `json:"params"`
		Body    map[string]string `json:"body"`
	} `json:"form"`
}

Endpoint specifies how a resource is resoved, fetched, updated, etc.

type EnvironmentKind

type EnvironmentKind string

EnvironmentKind represents the kind of environment.

const (
	Development EnvironmentKind = "development"
	Production  EnvironmentKind = "production"
)

...

type FilestoreInfo

type FilestoreInfo struct {
	Kind  FilestoreManagerKind `json:"kind"`
	Paths struct {
		Public  string `json:"public"`
		Private string `json:"private"`
	} `json:"paths"`
}

FilestoreInfo represents information for managing certain type of file.

type FilestoreManagerKind

type FilestoreManagerKind string

FilestoreManagerKind represents the kind of filestore manager.

const (
	Local FilestoreManagerKind = "local"
)

...

type GigamonoConfig

type GigamonoConfig struct {
	Version  uint       `json:"version"`
	Kind     ConfigKind `json:"kind"`
	Metadata struct {
		DomainName string   `json:"domain_name"`
		Authors    []Author `json:"authors"`
	} `json:"metdata"`
	Environment EnvironmentKind `json:"environment"`
	Services    struct {
		API struct {
			Ports Ports `json:"ports"`
		} `json:"api"`
		Auth struct {
			Ports Ports `json:"ports"`
		} `json:"auth"`
		AutomationEngine struct {
			MainServer struct {
				Ports Ports `json:"ports"`
			} `mapstructure:"main_server" json:"main_server"`
			APIService struct {
				Ports Ports `json:"ports"`
			} `mapstructure:"api_service" json:"api_service"`
			RunnableSupervisor struct {
				Ports Ports `json:"ports"`
			} `mapstructure:"runnable_supervisor" json:"runnable_supervisor"`
		} `mapstructure:"automation_engine" json:"automation_engine"`
		BaseEngine struct {
			Ports Ports `json:"ports"`
		} `mapstructure:"base_engine" json:"base_engine"`
	} `json:"services"`
	Secrets   SecretsManagerKind `json:"secrets"`
	Filestore struct {
		Project   FilestoreInfo `json:"project"`
		Extension FilestoreInfo `json:"extension"`
		Image     FilestoreInfo `json:"image"`
	} `json:"filestore"`
}

GigamonoConfig holds Gigamono configurations. Sec: Secrets shouldn't be stored in this file.

func LoadGigamonoConfig

func LoadGigamonoConfig() (GigamonoConfig, error)

LoadGigamonoConfig loads a gigamono config from file.

func NewGigamonoConfig

func NewGigamonoConfig(gigamonoString string, format ConfigFormat) (GigamonoConfig, error)

NewGigamonoConfig creates a GigamonoConfig from string. Supports JSON, TOML and YAML string format.

func (*GigamonoConfig) JSON

func (config *GigamonoConfig) JSON() (string, error)

JSON converts config to json.

type Input

type Input struct {
	Label            string    `json:"label"`
	Tip              string    `json:"tip"`
	IsRequired       bool      `mapstructure:"is_required" json:"is_required"`
	IsWriteOp        bool      `mapstructure:"is_write_op" json:"is_write_op"`
	IsIdentification bool      `mapstructure:"is_identification" json:"is_identification"`
	ResourceNoun     string    `json:"resource_noun"`
	InputKind        InputKind `mapstructure:"input_kind" json:"input_kind"`
	Dropdown         Dropdown  `json:"dropdown"`
}

Input describes an input field.

type InputKind

type InputKind string

InputKind is the type of user input.

const (
	Email  InputKind = "email"
	Select InputKind = "select"
)

...

type IntegrationConfig

type IntegrationConfig struct {
	Version  uint       `json:"version"`
	Kind     ConfigKind `json:"kind"`
	Metadata struct {
		Name                string   `json:"name"`
		PublicID            *UUID    `mapstructure:"public_id" json:"public_id"`
		Version             string   `json:"version"`
		Description         string   `json:"description"`
		Category            string   `json:"category"`
		Builtin             bool     `json:"builtin"`
		Tags                []string `json:"tags"`
		AvatarURL           *string  `mapstructure:"avatar_url" json:"avatar_url"`
		HomepageURL         string   `mapstructure:"homepage_url" json:"homepage_url"`
		APIDocumentationURL string   `mapstructure:"api_documentation_url" json:"api_documentation_url"`
		ResourceNouns       []string `mapstructure:"resource_nouns" json:"resource_nouns"`
		Authors             []Author `json:"authors"`
	} `json:"metadata"`
	Auths struct {
		OAuth2s []OAuth2 `json:"oauth2s"`
		APIKeys []APIKey `json:"api_keys"`
	} `json:"auths"`
	Operations struct {
		Triggers map[string]Trigger `json:"triggers"`
		Actions  map[string]Action  `json:"actions"`
	} `json:"operations"`
}

IntegrationConfig holds the information about an app which can be used in tasks.

func NewIntegrationConfig

func NewIntegrationConfig(integrationString string, format ConfigFormat) (IntegrationConfig, error)

NewIntegrationConfig creates an IntegrationConfig from string. Supports JSON, TOML and YAML string format.

func (*IntegrationConfig) JSON

func (config *IntegrationConfig) JSON() (string, error)

JSON converts config to json.

type OAuth2

type OAuth2 struct {
	Label                      string   `json:"label"`
	Scopes                     []string `json:"scopes"`
	ShouldRefreshAutomatically bool     `mapstructure:"should_refresh_automatically" json:"should_refresh_automatically"`
	Inputs                     map[string]struct {
		Label            string    `json:"label"`
		Tip              string    `json:"tip"`
		IsRequired       bool      `mapstructure:"is_required" json:"is_required"`
		IsAdministrative bool      `mapstructure:"is_administrative" json:"is_administrative"`
		InputKind        InputKind `mapstructure:"input_kind" json:"input_kind"`
		DefaultValue     string    `mapstructure:"default_value" json:"default_value"`
		Dropdown         Dropdown  `json:"dropdown"`
	} `json:"inputs"`
	APIs struct {
		AuthorisationRequest Endpoint `mapstructure:"authorisation_request" json:"authorisation_request"`
		AccessTokenRequest   Endpoint `mapstructure:"access_token_request" json:"access_token_request"`
		RefreshTokenRequest  Endpoint `mapstructure:"refresh_token_request" json:"refresh_token_request"`
	} `json:"apis"`
}

OAuth2 holds the necessary information for getting authorisation via OAuth2.

type Poll

type Poll struct {
	Endpoint `json:"endpoint"`
	AuthKind AuthKind `json:"auth_kind"`
}

Poll describes how a trigger polls data.

type Ports

type Ports struct {
	Public  uint `json:"public_port"`
	Private uint `json:"private_port"`
}

Ports represents public and private ports.

type RestHook

type RestHook struct {
	AuthKind   AuthKind `json:"auth_kind"`
	Operations struct {
		Subscribe   Endpoint `json:"subscribe"`
		Unsubscribe Endpoint `json:"unsubscribe"`
		List        Endpoint `json:"list"`
	} `json:"operations"`
}

RestHook describes a webhook trigger API.

type SecretsManagerKind

type SecretsManagerKind string

SecretsManagerKind represents the kind of secrets manager.

const (
	Env SecretsManagerKind = "env"
)

...

type StepItem

type StepItem struct {
	IntegrationIndex uint              `mapstructure:"integration_index" json:"integration_index"`
	OperationKey     string            `mapstructure:"operation_key" json:"operation_key"`
	Dependencies     []uint            `json:"dependencies"`
	Inputs           map[string]string `json:"inputs"`
}

StepItem is a step in a workflow.

type Trigger

type Trigger struct {
	Label  string           `json:"label"`
	Tip    string           `json:"tip"`
	Inputs map[string]Input `json:"inputs"`
	APIs   struct {
		Polls     []Poll     `json:"polls"`
		RestHooks []RestHook `json:"resthook"`
	} `json:"apis"`
}

Trigger specifies a trigger operation.

type UUID

type UUID uuid.UUID

UUID aliases gofrs/UUID type to allow custom unmarhsalling.

type WorkflowConfig

type WorkflowConfig struct {
	Version  uint       `json:"version"`
	Kind     ConfigKind `json:"kind"`
	Metadata struct {
		Name        string   `json:"name"`
		Description string   `json:"description"`
		Authors     []Author `json:"authors"`
	} `json:"metadata"`
	Integration []struct {
		Name                 string `json:"name"`
		ID                   UUID   `json:"id"`
		SpecificationFileURL UUID   `mapstructure:"specification_file_url" json:"specification_file_url"`
	} `json:"integration"`
	Steps struct {
		Max   uint64              `json:"max"`
		Items map[uint64]StepItem `json:"items"`
	} `json:"steps"`
}

WorkflowConfig represents a runnable workflow.

func NewWorkflowConfig

func NewWorkflowConfig(workflowString string, format ConfigFormat) (WorkflowConfig, error)

NewWorkflowConfig creates a WorkflowConfig from string. Supports JSON, TOML and YAML string format.

func (*WorkflowConfig) JSON

func (config *WorkflowConfig) JSON() (string, error)

JSON converts config to json.

Jump to

Keyboard shortcuts

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