allocationpools

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

Jump to

Keyboard shortcuts

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