servicegroup

package
v0.0.0-...-9b02830 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LIST_SERVICE_GROUP    = `select id, name, isreachable from gapi_services_groups`
	LIST_SERVICE_GROUP_V2 = `` /* 206-byte string literal not displayed */

	GET_SERVICE_GROUP_BY_ID_OR_NAME = `` /* 241-byte string literal not displayed */

	ADD_SERVICE_TO_GROUP      = `update gapi_services set groupid = :groupid where id = :id`
	REMOVE_SERVICE_FROM_GROUP = `update gapi_services set groupid = '' where id = :id`
	CREATE_SERVICE_GROUP      = `insert into gapi_services_groups(id, name, isreachable) values (:id,:name,:isreachable)`
	UPDATE_SERVICE_GROUP      = `update gapi_services_groups set name = :name, isreachable = :isreachable where id = :id`
	DELETE_SERVICE_GROUP      = `delete from gapi_services_groups where id = :id`
)
View Source
const SERVICE_GROUP_COLLECTION = "services_groups"

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceGroup

type ServiceGroup struct {
	Id           bson.ObjectId `bson:"_id" json:"Id"`
	Name         string
	IsReachable  bool
	HostsEnabled []string
	Services     []bson.ObjectId
}

func RowsToServiceGroup

func RowsToServiceGroup(rows *sql.Rows, containsPagination bool) []ServiceGroup

RowsToServiceGroup convert sql rows to service group list

func (*ServiceGroup) Contains

func (sg *ServiceGroup) Contains(serviceId bson.ObjectId) bool

type ServiceGroupMongoRepository

type ServiceGroupMongoRepository struct {
	Session    *mgo.Session
	Db         *mgo.Database
	Collection *mgo.Collection
}

func (*ServiceGroupMongoRepository) AddServiceToGroup

func (sgmr *ServiceGroupMongoRepository) AddServiceToGroup(serviceGroupID string, serviceID string) error

AddServiceToGroup add service to an existing service group

func (*ServiceGroupMongoRepository) CommitTransaction

func (sgmr *ServiceGroupMongoRepository) CommitTransaction()

CommitTransaction commit database transaction

func (*ServiceGroupMongoRepository) CreateServiceGroup

func (sgmr *ServiceGroupMongoRepository) CreateServiceGroup(serviceGroup ServiceGroup) error

CreateServiceGroup create new service group

func (*ServiceGroupMongoRepository) DeleteServiceGroup

func (sgmr *ServiceGroupMongoRepository) DeleteServiceGroup(serviceGroupID string) error

DeleteServiceGroup delete an existing service group

func (*ServiceGroupMongoRepository) GetServiceGroupById

func (sgmr *ServiceGroupMongoRepository) GetServiceGroupById(serviceGroup string) (ServiceGroup, error)

GetServiceGroupById get service group by id

func (*ServiceGroupMongoRepository) GetServiceGroups

func (sgmr *ServiceGroupMongoRepository) GetServiceGroups() ([]ServiceGroup, error)

GetServiceGroups get list of service groups

func (*ServiceGroupMongoRepository) OpenTransaction

func (sgmr *ServiceGroupMongoRepository) OpenTransaction() error

OpenTransaction open new database transaction

func (*ServiceGroupMongoRepository) Release

func (sgmr *ServiceGroupMongoRepository) Release()

Release release database transaction to the pool

func (*ServiceGroupMongoRepository) RemoveServiceFromGroup

func (sgmr *ServiceGroupMongoRepository) RemoveServiceFromGroup(serviceGroupID string, serviceID string) error

RemoveServiceFromGroup remove service from an existing service group

func (*ServiceGroupMongoRepository) RollbackTransaction

func (sgmr *ServiceGroupMongoRepository) RollbackTransaction()

RollbackTransaction rollback database transaction

func (*ServiceGroupMongoRepository) UpdateServiceGroup

func (sgmr *ServiceGroupMongoRepository) UpdateServiceGroup(serviceGroupID string, serviceGroup ServiceGroup) error

UpdateServiceGroup update an existing service group

type ServiceGroupOracleRepository

type ServiceGroupOracleRepository struct {
	Db      *sql.DB
	DbError error
	Tx      *sql.Tx
}

func (*ServiceGroupOracleRepository) AddServiceToGroup

func (sgor *ServiceGroupOracleRepository) AddServiceToGroup(serviceGroupID string, serviceID string) error

AddServiceToGroup add new service to a group

func (*ServiceGroupOracleRepository) CommitTransaction

func (agmr *ServiceGroupOracleRepository) CommitTransaction()

func (*ServiceGroupOracleRepository) CreateServiceGroup

func (sgor *ServiceGroupOracleRepository) CreateServiceGroup(serviceGroup ServiceGroup) error

CreateServiceGroup create a new service group

func (*ServiceGroupOracleRepository) DeleteServiceGroup

func (sgor *ServiceGroupOracleRepository) DeleteServiceGroup(serviceGroupID string) error

DeleteServiceGroup delete a service group

func (*ServiceGroupOracleRepository) GetServiceGroupById

func (sgor *ServiceGroupOracleRepository) GetServiceGroupById(serviceGroup string) (ServiceGroup, error)

GetServiceGroupById get service groups by id

func (*ServiceGroupOracleRepository) GetServiceGroups

func (sgor *ServiceGroupOracleRepository) GetServiceGroups() ([]ServiceGroup, error)

GetServiceGroups get list of service groups

func (*ServiceGroupOracleRepository) OpenTransaction

func (agmr *ServiceGroupOracleRepository) OpenTransaction() error

func (*ServiceGroupOracleRepository) Release

func (agmr *ServiceGroupOracleRepository) Release()

func (*ServiceGroupOracleRepository) RemoveServiceFromGroup

func (sgor *ServiceGroupOracleRepository) RemoveServiceFromGroup(serviceGroupID string, serviceID string) error

RemoveServiceFromGroup remove a service from a group

func (*ServiceGroupOracleRepository) RollbackTransaction

func (agmr *ServiceGroupOracleRepository) RollbackTransaction()

func (*ServiceGroupOracleRepository) UpdateServiceGroup

func (sgor *ServiceGroupOracleRepository) UpdateServiceGroup(serviceGroupID string, serviceGroup ServiceGroup) error

UpdateServiceGroup update an already existing service group

type ServiceGroupRepository

type ServiceGroupRepository interface {
	GetServiceGroups() ([]ServiceGroup, error)
	GetServiceGroupById(serviceGroup string) (ServiceGroup, error)
	AddServiceToGroup(serviceGroupId string, serviceId string) error
	RemoveServiceFromGroup(serviceGroupId string, serviceId string) error
	CreateServiceGroup(serviceGroup ServiceGroup) error
	UpdateServiceGroup(serviceGroupId string, serviceGroup ServiceGroup) error
	DeleteServiceGroup(serviceGroupId string) error

	OpenTransaction() error
	CommitTransaction()
	RollbackTransaction()
	Release()
}

func NewServiceGroupRepository

func NewServiceGroupRepository(user userModels.User) ServiceGroupRepository

NewServiceGroupRepository create an application group repository based on the database

type ServiceGroupService

type ServiceGroupService struct {
	User              userModels.User
	ServiceGroupRepos ServiceGroupRepository
}

func NewServiceGroupService

func NewServiceGroupService(c *routing.Context) (ServiceGroupService, error)

NewServiceGroupService create service group service

func NewServiceGroupServiceWithUser

func NewServiceGroupServiceWithUser(user userModels.User) (ServiceGroupService, error)

NewServiceGroupServiceWithUser create service group service

func (*ServiceGroupService) AddServiceToGroup

func (spgs *ServiceGroupService) AddServiceToGroup(serviceGroupId string, serviceId string) error

AddServiceToGroup add servcie to an existing service group

func (*ServiceGroupService) CreateServiceGroup

func (spgs *ServiceGroupService) CreateServiceGroup(serviceGroup ServiceGroup) error

CreateServiceGroup create new service group

func (*ServiceGroupService) DeleteServiceGroup

func (spgs *ServiceGroupService) DeleteServiceGroup(serviceGroupId string) error

DeleteServiceGroup delete an already existing service group

func (*ServiceGroupService) GetServiceGroupById

func (spgs *ServiceGroupService) GetServiceGroupById(serviceGroupID string) (ServiceGroup, error)

GetServiceGroupById get service group by id

func (*ServiceGroupService) GetServiceGroups

func (spgs *ServiceGroupService) GetServiceGroups() ([]ServiceGroup, error)

GetServiceGroups get list of servcie groups

func (*ServiceGroupService) RemoveServiceFromGroup

func (spgs *ServiceGroupService) RemoveServiceFromGroup(serviceGroupId string, serviceId string) error

RemoveServiceFromGroup remove service from an existing service group

func (*ServiceGroupService) UpdateServiceGroup

func (spgs *ServiceGroupService) UpdateServiceGroup(serviceGroupId string, serviceGroup ServiceGroup) error

UpdateServiceGroup update an already existing service group

Jump to

Keyboard shortcuts

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