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 ¶
- type AssetFetchError
- type AssetNotFound
- type Customer
- type CustomerFetcher
- type Device
- type DeviceFetcher
- type IPAMData
- type IPAMDataFetcher
- type InvalidInput
- type LogFn
- type Logger
- type PhysicalAsset
- type PhysicalAssetFetcher
- type PhysicalAssetStorer
- type SQLDB
- type Stat
- type StatFn
- type Subnet
- type SubnetFetcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetFetchError ¶
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 ¶
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 CustomerFetcher ¶
CustomerFetcher provides an interface for fetching customer data
type Device ¶
Device represents a physical device with a network interface on the stored IP address.
type DeviceFetcher ¶
DeviceFetcher is an interface to fetch Device information
type IPAMDataFetcher ¶
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 ¶
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 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
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 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.