network

package
v0.54.1-nocontractcheck Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNetworkDoesNotHaveGRPCHostConfigured = errors.New("network configuration does not have any gRPC host set")

Functions

func DeleteNetwork

func DeleteNetwork(store Store, req *DeleteNetworkRequest) error

func ImportNetwork

func ImportNetwork(store Store, net *Network, overwrite bool) error

Types

type APIConfig

type APIConfig struct {
	GRPC    GRPCConfig    `json:"grpc"`
	REST    RESTConfig    `json:"rest"`
	GraphQL GraphQLConfig `json:"graphQl"`
}

type DeleteNetworkRequest

type DeleteNetworkRequest struct {
	Name string `json:"name"`
}

type DescribeNetworkRequest

type DescribeNetworkRequest struct {
	Name string `json:"name"`
}

type DescribeNetworkResponse

type DescribeNetworkResponse struct {
	Name        string `json:"name"`
	Level       string `json:"logLevel"`
	TokenExpiry string `json:"tokenExpiry"`
	Port        int    `json:"port"`
	Host        string `json:"host"`
	API         struct {
		GRPCConfig struct {
			Hosts   []string `json:"hosts"`
			Retries uint64   `json:"retries"`
		} `json:"grpcConfig"`
		RESTConfig struct {
			Hosts []string `json:"hosts"`
		} `json:"restConfig"`
		GraphQLConfig struct {
			Hosts []string `json:"hosts"`
		} `json:"graphQLConfig"`
	} `json:"api"`
}

func DescribeNetwork

func DescribeNetwork(store Store, req *DescribeNetworkRequest) (*DescribeNetworkResponse, error)

type GRPCConfig

type GRPCConfig struct {
	Hosts   []string `json:"hosts"`
	Retries uint64   `json:"retries"`
}

type GraphQLConfig

type GraphQLConfig struct {
	Hosts []string `json:"hosts"`
}

type ImportNetworkFromSourceRequest

type ImportNetworkFromSourceRequest struct {
	FilePath string `json:"filePath"`
	URL      string `json:"url"`
	Name     string `json:"name"`
	Force    bool   `json:"force"`
}

type ImportNetworkFromSourceResponse

type ImportNetworkFromSourceResponse struct {
	Name     string `json:"name"`
	FilePath string `json:"filePath"`
}

type ListNetworksResponse

type ListNetworksResponse struct {
	Networks []string `json:"networks"`
}

func ListNetworks

func ListNetworks(store Store) (*ListNetworksResponse, error)

type Network

type Network struct {
	Name        string            `json:"name"`
	Level       encoding.LogLevel `json:"level"`
	TokenExpiry encoding.Duration `json:"tokenExpiry"`
	Port        int               `json:"port"`
	Host        string            `json:"host"`
	API         APIConfig         `json:"api"`
}

func GetNetwork

func GetNetwork(store Store, name string) (*Network, error)

func (*Network) EnsureCanConnectGRPCNode

func (n *Network) EnsureCanConnectGRPCNode() error

type NetworkAlreadyExistsError

type NetworkAlreadyExistsError struct {
	Name string
}

func NewNetworkAlreadyExistsError

func NewNetworkAlreadyExistsError(n string) NetworkAlreadyExistsError

func (NetworkAlreadyExistsError) Error

type NetworkDoesNotExistError

type NetworkDoesNotExistError struct {
	Name string
}

func NewNetworkDoesNotExistError

func NewNetworkDoesNotExistError(n string) NetworkDoesNotExistError

func (NetworkDoesNotExistError) Error

func (e NetworkDoesNotExistError) Error() string

type RESTConfig

type RESTConfig struct {
	Hosts []string `json:"hosts"`
}

type Reader

type Reader func(uri string, net interface{}) error

type Readers

type Readers struct {
	ReadFromFile Reader
	ReadFromURL  Reader
}

func NewReaders

func NewReaders() Readers

type Store

type Store interface {
	NetworkExists(string) (bool, error)
	GetNetwork(string) (*Network, error)
	SaveNetwork(*Network) error
	ListNetworks() ([]string, error)
	GetNetworkPath(string) string
	DeleteNetwork(string) error
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
store
v1

Jump to

Keyboard shortcuts

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