domain

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package domain is a container of all of the domain types and interfaces that are used across multiple packages within the service.

This package is also the container for all domain errors leveraged by the service. Each error here should represent a specific condition that needs to be communicated across interface boundaries.

Generally speaking, this package contains no executable code. All elements are expected to be either pure data containers that have no associated methods or interface definitions that have no corresponding implementations in this package. The notable exception to this are the domain error types which are required to define a corresponding Error() method. Because these errors provide executable code they must also have corresponding tests. Only domain error types are allowed to deviate from the "no executable code" rule.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetFetchError

type AssetFetchError struct {
	Inner error
	IP    string
}

AssetFetchError is used to indicate an unexpected error occurred while querying storage for an asset with the given IP address.

func (AssetFetchError) Error

func (e AssetFetchError) Error() string

type AssetNotFound

type AssetNotFound struct {
	Inner error
	IP    string
}

AssetNotFound is used to indicate that no physical asset with the given IP address exists in storage.

func (AssetNotFound) Error

func (e AssetNotFound) Error() string

type Customer

type Customer struct {
	ID            string
	ResourceOwner string
	BusinessUnit  string
}

Customer represents a person and team most directly responsible for a Subnet.

type CustomerFetcher

type CustomerFetcher interface {
	FetchCustomers(ctx context.Context) ([]Customer, error)
}

CustomerFetcher provides an interface for fetching customer data

type Device

type Device struct {
	ID       string
	IP       string
	SubnetID string
}

Device represents a physical device with a network interface on the stored IP address.

type DeviceFetcher

type DeviceFetcher interface {
	FetchDevices(ctx context.Context) ([]Device, error)
}

DeviceFetcher is an interface to fetch Device information

type IPAMData

type IPAMData struct {
	Devices   []Device
	Subnets   []Subnet
	Customers []Customer
}

IPAMData represents the full collection of IPAM data stored by the IPAM Facade.

type IPAMDataFetcher

type IPAMDataFetcher interface {
	FetchIPAMData(context.Context) (IPAMData, error)
}

IPAMDataFetcher fetches IPAM data from a CMDB like Device42 for local storage.

type InvalidInput

type InvalidInput struct {
	IP string
}

InvalidInput occurs when a physical asset is requested by an invalid IP address.

func (InvalidInput) Error

func (e InvalidInput) Error() string

type LogFn

type LogFn = runhttp.LogFn

LogFn is the recommended way to extract a logger from the context.

var LoggerFromContext LogFn = runhttp.LoggerFromContext

LoggerFromContext is a concrete implementation of the LogFn interface.

type Logger

type Logger = runhttp.Logger

Logger is the project logger interface.

type PhysicalAsset

type PhysicalAsset struct {
	IP            string
	ResourceOwner string
	BusinessUnit  string
	Network       string
	Location      string
	DeviceID      int64
	SubnetID      int64
	CustomerID    int64
}

PhysicalAsset represents a non-cloud device with a network interface.

type PhysicalAssetFetcher

type PhysicalAssetFetcher interface {
	FetchPhysicalAsset(ctx context.Context, ipAddress string) (PhysicalAsset, error)
}

PhysicalAssetFetcher retrieves a PhysicalAsset by its IP Address.

type PhysicalAssetStorer added in v0.2.0

type PhysicalAssetStorer interface {
	StorePhysicalAssets(context.Context, IPAMData) error
}

PhysicalAssetStorer stores IPAM data fetched from a CMDB data source into local storage.

type SQLDB added in v0.2.0

type SQLDB interface {
	// Init creates the database and schema if either or both do not already exist
	Init(ctx context.Context, host string, port string, username string, password string, dbname string) error
	// RunScript runs a named script against a previously initialized database connection
	RunScript(ctx context.Context, name string) error
	// Conn returns an existing, initialized database connection, or nil if one does not exist
	Conn() *sql.DB
	// Use closes any existing database connection and opens a new one using the given connection string
	Use(ctx context.Context, psqlInfo string) error
}

SQLDB encapsulates "database/sql" from the stdlib with methods for initializing a database connection and running SQL scripts against the database

type Stat

type Stat = runhttp.Stat

Stat is the project metrics client interface.

type StatFn

type StatFn = runhttp.StatFn

StatFn is the recommended way to extract a metrics client from the context.

var StatFromContext StatFn = runhttp.StatFromContext

StatFromContext is a concrete implementation of the StatFn interface.

type Subnet

type Subnet struct {
	ID         string
	Network    string
	MaskBits   int8
	Location   string
	CustomerID string
}

Subnet represents a block of IP addresses allocated to a ResourceOwner.

type SubnetFetcher

type SubnetFetcher interface {
	FetchSubnets(ctx context.Context) ([]Subnet, error)
}

SubnetFetcher is an interface to fetch Subnet information

Jump to

Keyboard shortcuts

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