Documentation
¶
Overview ¶
Package allocationPools defines data structure representing a allocationPool instance and methods for interacting with them it is left to concrete implementations in package db or others to implement these interfaces
Index ¶
- Variables
- type AllocationPool
- type AllocationPoolController
- func (allocationPoolController *AllocationPoolController) AddEnvironmentByID(currentAllocationPool AllocationPool, environmentID int) (AllocationPool, error)
- func (allocationPoolController *AllocationPoolController) CreateNew(newAllocationPool CreateAllocationPoolRequest) (AllocationPool, error)
- func (allocationPoolController AllocationPoolController) DoesAllocationPoolExist(name string) (int, bool)
- func (allocationPoolController *AllocationPoolController) GetByID(id int) (AllocationPool, error)
- func (allocationPoolController *AllocationPoolController) GetByName(name string) (AllocationPool, error)
- func (allocationPoolController *AllocationPoolController) ListAll() ([]AllocationPool, error)
- type CreateAllocationPoolRequest
Constants ¶
This section is empty.
Variables ¶
var ErrAllocationPoolNotFound = gorm.ErrRecordNotFound
ErrAllocationPoolNotFound is the error to represent a failed lookup of a allocationPool db record
Functions ¶
This section is empty.
Types ¶
type AllocationPool ¶
type AllocationPool struct { ID int `gorm:"primaryKey;uniqueIndex"` Name string `gorm:"not null;default:null"` CreatedAt time.Time UpdatedAt time.Time Environments []environments.Environment }
AllocationPool is the data structure that models a persisted to a database via gorm
type AllocationPoolController ¶
type AllocationPoolController struct {
// contains filtered or unexported fields
}
AllocationPoolController is the management layer for allocationPools
func NewController ¶
func NewController(dbConn *gorm.DB) *AllocationPoolController
NewController accepts a gorm DB connection and returns a new instance of the allocationPool controller
func (*AllocationPoolController) AddEnvironmentByID ¶
func (allocationPoolController *AllocationPoolController) AddEnvironmentByID(currentAllocationPool AllocationPool, environmentID int) (AllocationPool, error)
AddEnvironmentByID takes a AllocationPoolObject and associates an existing environment to it.
func (*AllocationPoolController) CreateNew ¶
func (allocationPoolController *AllocationPoolController) CreateNew(newAllocationPool CreateAllocationPoolRequest) (AllocationPool, error)
CreateNew is the public api on the allocationPoolController for persisting a new service entity to the data store
func (AllocationPoolController) DoesAllocationPoolExist ¶
func (allocationPoolController AllocationPoolController) DoesAllocationPoolExist(name string) (int, bool)
DoesAllocationPoolExist is a helper method to check if a allocationPool with the given name already exists in sherlock's data storage
func (*AllocationPoolController) GetByID ¶
func (allocationPoolController *AllocationPoolController) GetByID(id int) (AllocationPool, error)
GetByID is the public API for looking up a allocationPool from the data store by name
func (*AllocationPoolController) GetByName ¶
func (allocationPoolController *AllocationPoolController) GetByName(name string) (AllocationPool, error)
GetByName is the public API for looking up a allocationPool from the data store by name
func (*AllocationPoolController) ListAll ¶
func (allocationPoolController *AllocationPoolController) ListAll() ([]AllocationPool, error)
ListAll is the public api for listing out all allocationPools tracked by sherlock
type CreateAllocationPoolRequest ¶
type CreateAllocationPoolRequest struct { Name string `json:"name" binding:"required"` Environments []environments.Environment }
CreateAllocationPoolRequest struct defines the data required to create a new allocationPool in db