service

package
v0.0.0-...-cd00529 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash validates password hash and returns true in case of a match

Types

type APIProduct

type APIProduct interface {
	GetAll(organizationName string) (apiproducts types.APIProducts, err types.Error)

	Get(organizationName, apiproductName string) (apiproduct *types.APIProduct, err types.Error)

	Create(organizationName string, newAPIProduct types.APIProduct, who audit.Requester) (*types.APIProduct, types.Error)

	Update(organizationName string, updatedAPIProduct types.APIProduct, who audit.Requester) (*types.APIProduct, types.Error)

	Delete(organizationName string, apiproductName string, who audit.Requester) (e types.Error)
}

APIProduct is the service interface to manipulate APIProduct entities

type APIProductService

type APIProductService struct {
	// contains filtered or unexported fields
}

APIProductService is

func NewAPIProduct

func NewAPIProduct(database *db.Database, a *audit.Audit) *APIProductService

NewAPIProduct returns a new apiproduct instance

func (*APIProductService) Create

func (ds *APIProductService) Create(organizationName string, newAPIProduct types.APIProduct,
	who audit.Requester) (*types.APIProduct, types.Error)

Create creates a new apiproduct

func (*APIProductService) Delete

func (ds *APIProductService) Delete(organizationName, apiproductName string,
	who audit.Requester) (e types.Error)

Delete deletes an apiproduct

func (*APIProductService) Get

func (ds *APIProductService) Get(organizationName, apiproductName string) (apiproduct *types.APIProduct, err types.Error)

Get returns details of an apiproduct

func (*APIProductService) GetAll

func (ds *APIProductService) GetAll(organizationName string) (apiproducts types.APIProducts, err types.Error)

GetAll returns all apiproducts

func (*APIProductService) Update

func (ds *APIProductService) Update(organizationName string, updatedAPIProduct types.APIProduct,
	who audit.Requester) (*types.APIProduct, types.Error)

Update updates an existing apiproduct

type Audit

type Audit interface {
	GetOrganization(organizationName string, params AuditQueryParams) (audits types.Audits, err types.Error)

	GetAPIProduct(organizationName, apiproductName string, params AuditQueryParams) (audits types.Audits, err types.Error)

	GetDeveloper(organizationName, developerEmailaddress string, params AuditQueryParams) (audits types.Audits, err types.Error)

	GetApplication(organizationName, developerEmailaddress, appName string, params AuditQueryParams) (audits types.Audits, err types.Error)

	GetUser(userName string, params AuditQueryParams) (audits types.Audits, err types.Error)
}

Audit is the service interface to retrieve audit records

type AuditQueryParams

type AuditQueryParams struct {
	// Start timestamp in epoch milliseconds
	StartTime int64
	// End timestamp in epoch milliseconds
	EndTime int64
	// Maximum number of entities to return
	Count int64
}

AuditQueryParams holds query filter parameters for audit record retrieval

type AuditService

type AuditService struct {
	// contains filtered or unexported fields
}

AuditService is

func NewAudit

func NewAudit(database *db.Database, a *audit.Audit) *AuditService

NewAudit returns a new AuditService instance

func (*AuditService) GetAPIProduct

func (as *AuditService) GetAPIProduct(organizationName, apiproductName string, params AuditQueryParams) (audits types.Audits, err types.Error)

func (*AuditService) GetApplication

func (as *AuditService) GetApplication(organizationName, developerEmailaddress, appName string, params AuditQueryParams) (audits types.Audits, err types.Error)

func (*AuditService) GetDeveloper

func (as *AuditService) GetDeveloper(organizationName, developerEmailaddress string, params AuditQueryParams) (audits types.Audits, err types.Error)

func (*AuditService) GetOrganization

func (as *AuditService) GetOrganization(organizationName string, params AuditQueryParams) (audits types.Audits, err types.Error)

func (*AuditService) GetUser

func (as *AuditService) GetUser(userName string, params AuditQueryParams) (audits types.Audits, err types.Error)

type Cluster

type Cluster interface {
	GetAll() (clusters types.Clusters, err types.Error)

	Get(clusterName string) (cluster *types.Cluster, err types.Error)

	Create(newCluster types.Cluster, who audit.Requester) (*types.Cluster, types.Error)

	Update(updatedCluster types.Cluster, who audit.Requester) (*types.Cluster, types.Error)

	Delete(clusterName string, who audit.Requester) (e types.Error)
}

Cluster is the service interface to manipulate Cluster entities

type ClusterService

type ClusterService struct {
	// contains filtered or unexported fields
}

ClusterService is

func NewCluster

func NewCluster(database *db.Database, a *audit.Audit) *ClusterService

NewCluster returns a new cluster instance

func (*ClusterService) Create

func (cs *ClusterService) Create(newCluster types.Cluster, who audit.Requester) (
	*types.Cluster, types.Error)

Create creates an cluster

func (*ClusterService) Delete

func (cs *ClusterService) Delete(clusterName string, who audit.Requester) (e types.Error)

Delete deletes an cluster

func (*ClusterService) Get

func (cs *ClusterService) Get(clusterName string) (cluster *types.Cluster, err types.Error)

Get returns details of an cluster

func (*ClusterService) GetAll

func (cs *ClusterService) GetAll() (clusters types.Clusters, err types.Error)

GetAll returns all clusters

func (*ClusterService) GetAttribute

func (cs *ClusterService) GetAttribute(clusterName, attributeName string) (value string, err types.Error)

GetAttribute returns one particular attribute of an cluster

func (*ClusterService) Update

func (cs *ClusterService) Update(updatedCluster types.Cluster,
	who audit.Requester) (*types.Cluster, types.Error)

Update updates an existing cluster

type Company

type Company interface {
	GetAll(organizationName string) (companys types.Companies, err types.Error)

	Get(organizationName, companyName string) (company *types.Company, err types.Error)

	Create(organizationName string, newCompany types.Company, who audit.Requester) (*types.Company, types.Error)

	Update(organizationName string, updatedCompany types.Company, who audit.Requester) (*types.Company, types.Error)

	Delete(organizationName, companyName string, who audit.Requester) (e types.Error)
}

All interface of service layer

type CompanyService

type CompanyService struct {
	// contains filtered or unexported fields
}

CompanyService is

func NewCompany

func NewCompany(database *db.Database, a *audit.Audit) *CompanyService

NewCompany returns a new company instance

func (*CompanyService) Create

func (ds *CompanyService) Create(organizationName string, newCompany types.Company,
	who audit.Requester) (*types.Company, types.Error)

Create creates a new company

func (*CompanyService) Delete

func (ds *CompanyService) Delete(organizationName, companyName string,
	who audit.Requester) (e types.Error)

Delete deletes an company

func (*CompanyService) Get

func (ds *CompanyService) Get(organizationName, companyName string) (company *types.Company, err types.Error)

Get returns details of a company

func (*CompanyService) GetAll

func (ds *CompanyService) GetAll(organizationName string) (companys types.Companies, err types.Error)

GetAll returns all companies

func (*CompanyService) Update

func (ds *CompanyService) Update(organizationName string, updatedCompany types.Company,
	who audit.Requester) (*types.Company, types.Error)

Update updates an existing company

type Developer

type Developer interface {
	GetAll(organizationName string) (developers types.Developers, err types.Error)

	Get(organizationName, developerEmail string) (developer *types.Developer, err types.Error)

	Create(organizationName string, newDeveloper types.Developer, who audit.Requester) (*types.Developer, types.Error)

	Update(organizationName, developerEmail string, updatedDeveloper types.Developer, who audit.Requester) (*types.Developer, types.Error)

	Delete(organizationName, developerEmail string, who audit.Requester) (e types.Error)
}

Developer is the service interface to manipulate Developer entities

type DeveloperApp

type DeveloperApp interface {
	GetAll(organizationName string) (developerApps types.DeveloperApps, err types.Error)

	GetAllByEmail(organizationName, developerEmail string) (developerApps types.DeveloperApps, err types.Error)

	GetByName(organizationName, developerEmail, developerAppName string) (developerApp *types.DeveloperApp, err types.Error)

	GetByID(organizationName, developerAppName string) (developerApp *types.DeveloperApp, err types.Error)

	Create(organizationName, developerEmail string, newDeveloperApp types.DeveloperApp, who audit.Requester) (*types.DeveloperApp, types.Error)

	Update(organizationName, developerEmail string, updatedDeveloperApp types.DeveloperApp, who audit.Requester) (*types.DeveloperApp, types.Error)

	Delete(organizationName, developerEmail, developerAppName string, who audit.Requester) (e types.Error)
}

DeveloperApp is the service interface to manipulate DeveloperApp entities

type DeveloperAppService

type DeveloperAppService struct {
	// contains filtered or unexported fields
}

DeveloperAppService is

func NewDeveloperApp

func NewDeveloperApp(database *db.Database, a *audit.Audit) *DeveloperAppService

NewDeveloperApp returns a new developerApp instance

func (*DeveloperAppService) Create

func (das *DeveloperAppService) Create(organizationName, developerEmail string,
	newDeveloperApp types.DeveloperApp, who audit.Requester) (*types.DeveloperApp, types.Error)

Create creates a new developerApp

func (*DeveloperAppService) Delete

func (das *DeveloperAppService) Delete(organizationName, developerEmail, developerAppName string,
	who audit.Requester) (e types.Error)

Delete deletes an developerApp

func (*DeveloperAppService) GetAll

func (das *DeveloperAppService) GetAll(organizationName string) (developerApps types.DeveloperApps, err types.Error)

GetAll returns all developerApp apps

func (*DeveloperAppService) GetAllByEmail

func (das *DeveloperAppService) GetAllByEmail(organizationName, developerEmail string) (developerApps types.DeveloperApps, err types.Error)

GetAll returns all developer apps of one develoepr

func (*DeveloperAppService) GetByID

func (das *DeveloperAppService) GetByID(organizationName, developerAppID string) (developerApp *types.DeveloperApp, err types.Error)

GetByID returns details of an developerApp

func (*DeveloperAppService) GetByName

func (das *DeveloperAppService) GetByName(organizationName, developerEmail, developerAppName string) (developerApp *types.DeveloperApp, err types.Error)

GetByName returns details of an developerApp

func (*DeveloperAppService) Update

func (das *DeveloperAppService) Update(organizationName, developerEmail string, updatedDeveloperApp types.DeveloperApp,
	who audit.Requester) (*types.DeveloperApp, types.Error)

Update updates an existing developerApp

type DeveloperService

type DeveloperService struct {
	// contains filtered or unexported fields
}

DeveloperService is

func NewDeveloper

func NewDeveloper(database *db.Database, a *audit.Audit) *DeveloperService

NewDeveloper returns a new developer instance

func (*DeveloperService) Create

func (ds *DeveloperService) Create(organizationName string, newDeveloper types.Developer,
	who audit.Requester) (*types.Developer, types.Error)

Create creates a new developer

func (*DeveloperService) Delete

func (ds *DeveloperService) Delete(organizationName, developerName string, who audit.Requester) (e types.Error)

Delete deletes an developer

func (*DeveloperService) Get

func (ds *DeveloperService) Get(organizationName, developerName string) (developer *types.Developer, err types.Error)

Get returns details of an developer, in case name contains a @ assumption is developerId was provided

func (*DeveloperService) GetAll

func (ds *DeveloperService) GetAll(organizationName string) (developers types.Developers, err types.Error)

GetAll returns all developers

func (*DeveloperService) Update

func (ds *DeveloperService) Update(organizationName, developerEmail string, updatedDeveloper types.Developer, who audit.Requester) (
	*types.Developer, types.Error)

Update updates an existing developer

type Key

type Key interface {
	Get(organizationName, developerEmail, appName, consumerKey string) (key *types.Key, err types.Error)

	GetByDeveloperAppID(organizationName, developerAppID string) (keys types.Keys, err types.Error)

	Create(organizationName, developerEmail, developerAppName string, newKey types.Key, who audit.Requester) (*types.Key, types.Error)

	Update(organizationName, developerEmail, developerAppName string, consumerKey string, updateKey types.Key, who audit.Requester) (*types.Key, types.Error)

	Delete(organizationName, developerEmail, developerAppName string, consumerKey string, who audit.Requester) (e types.Error)
}

Key is the service interface to manipulate Key entities

type KeyService

type KeyService struct {
	// contains filtered or unexported fields
}

KeyService is

func NewKey

func NewKey(database *db.Database, a *audit.Audit) *KeyService

NewKey returns a new key instance

func (*KeyService) Create

func (ks *KeyService) Create(organizationName, developerEmail, developerAppName string, newKey types.Key, who audit.Requester) (*types.Key, types.Error)

Create creates a key

func (*KeyService) Delete

func (ks *KeyService) Delete(organizationName, developerEmail, developerAppName,
	consumerKey string, who audit.Requester) (e types.Error)

Delete deletes a key

func (*KeyService) Get

func (ks *KeyService) Get(organizationName, developerEmail, appName, key string) (*types.Key, types.Error)

Get returns details of an key

func (*KeyService) GetByDeveloperAppID

func (ks *KeyService) GetByDeveloperAppID(organizationName, developerAppID string) (types.Keys, types.Error)

GetByDeveloperAppID returns all keys of a developer app

func (*KeyService) Update

func (ks *KeyService) Update(organizationName, developerEmail, developerAppName string,
	consumerKey string, updatedKey types.Key, who audit.Requester) (*types.Key, types.Error)

Update updates an existing key

type Listener

type Listener interface {
	GetAll() (listeners types.Listeners, err types.Error)

	Get(listenerName string) (listener *types.Listener, err types.Error)

	Create(newListener types.Listener, who audit.Requester) (*types.Listener, types.Error)

	Update(updatedListener types.Listener, who audit.Requester) (*types.Listener, types.Error)

	Delete(listenerName string, who audit.Requester) (e types.Error)
}

Listener is the service interface to manipulate Listener entities

type ListenerService

type ListenerService struct {
	// contains filtered or unexported fields
}

ListenerService is

func NewListener

func NewListener(database *db.Database, a *audit.Audit) *ListenerService

NewListener returns a new listener instance

func (*ListenerService) Create

func (ls *ListenerService) Create(newListener types.Listener, who audit.Requester) (*types.Listener, types.Error)

Create creates an listener

func (*ListenerService) Delete

func (ls *ListenerService) Delete(listenerName string, who audit.Requester) (e types.Error)

Delete deletes an listener

func (*ListenerService) Get

func (ls *ListenerService) Get(listenerName string) (listener *types.Listener, err types.Error)

Get returns details of an listener

func (*ListenerService) GetAll

func (ls *ListenerService) GetAll() (listeners types.Listeners, err types.Error)

GetAll returns all listeners

func (*ListenerService) Update

func (ls *ListenerService) Update(updatedListener types.Listener, who audit.Requester) (*types.Listener, types.Error)

Update updates an existing listener

type Organization

type Organization interface {
	GetAll() (organizations types.Organizations, err types.Error)

	Get(organizationName string) (organization *types.Organization, err types.Error)

	Create(newOrganization types.Organization, who audit.Requester) (*types.Organization, types.Error)

	Update(updatedOrganization types.Organization, who audit.Requester) (*types.Organization, types.Error)

	Delete(organizationName string, who audit.Requester) (e types.Error)
}

All interface of service layer

type OrganizationService

type OrganizationService struct {
	// contains filtered or unexported fields
}

OrganizationService is

func NewOrganization

func NewOrganization(database *db.Database, a *audit.Audit) *OrganizationService

NewOrganization returns a new organization instance

func (*OrganizationService) Create

func (os *OrganizationService) Create(newOrganization types.Organization, who audit.Requester) (*types.Organization, types.Error)

Create creates an organization

func (*OrganizationService) Delete

func (os *OrganizationService) Delete(organizationName string, who audit.Requester) (e types.Error)

Delete deletes an organization

func (*OrganizationService) Get

func (os *OrganizationService) Get(organizationName string) (organization *types.Organization, err types.Error)

Get returns details of an organization

func (*OrganizationService) GetAll

func (os *OrganizationService) GetAll() (organizations types.Organizations, err types.Error)

GetAll returns all organizations

func (*OrganizationService) Update

func (os *OrganizationService) Update(updatedOrganization types.Organization, who audit.Requester) (*types.Organization, types.Error)

Update updates an existing organization

type Role

type Role interface {
	GetAll() (roles types.Roles, err types.Error)

	Get(roleName string) (role *types.Role, err types.Error)

	Create(newRole types.Role, who audit.Requester) (*types.Role, types.Error)

	Update(updatedRole types.Role, who audit.Requester) (*types.Role, types.Error)

	Delete(roleName string, who audit.Requester) (e types.Error)
}

Role is the service interface to manipulate Role entities

type RoleService

type RoleService struct {
	// contains filtered or unexported fields
}

RoleService is

func NewRole

func NewRole(database *db.Database, a *audit.Audit) *RoleService

NewRole returns a new role instance

func (*RoleService) Create

func (rs *RoleService) Create(newRole types.Role, who audit.Requester) (*types.Role, types.Error)

Create creates an role

func (*RoleService) Delete

func (rs *RoleService) Delete(roleName string, who audit.Requester) (e types.Error)

Delete deletes a role

func (*RoleService) Get

func (rs *RoleService) Get(roleName string) (role *types.Role, err types.Error)

Get returns details of an role

func (*RoleService) GetAll

func (rs *RoleService) GetAll() (roles types.Roles, err types.Error)

GetAll returns all roles

func (*RoleService) Update

func (rs *RoleService) Update(updatedRole types.Role, who audit.Requester) (*types.Role, types.Error)

Update updates an existing role

type Route

type Route interface {
	GetAll() (routes types.Routes, err types.Error)

	Get(routeName string) (route *types.Route, err types.Error)

	Create(newRoute types.Route, who audit.Requester) (*types.Route, types.Error)

	Update(updatedRoute types.Route, who audit.Requester) (*types.Route, types.Error)

	Delete(routeName string, who audit.Requester) (e types.Error)
}

Route is the service interface to manipulate Route entities

type RouteService

type RouteService struct {
	// contains filtered or unexported fields
}

RouteService is

func NewRoute

func NewRoute(database *db.Database, a *audit.Audit) *RouteService

NewRoute returns a new route instance

func (*RouteService) Create

func (rs *RouteService) Create(newRoute types.Route, who audit.Requester) (*types.Route, types.Error)

Create creates an route

func (*RouteService) Delete

func (rs *RouteService) Delete(routeName string, who audit.Requester) (e types.Error)

Delete deletes an route

func (*RouteService) Get

func (rs *RouteService) Get(routeName string) (route *types.Route, err types.Error)

Get returns details of an route

func (*RouteService) GetAll

func (rs *RouteService) GetAll() (routes types.Routes, err types.Error)

GetAll returns all routes

func (*RouteService) GetAttribute

func (rs *RouteService) GetAttribute(routeName, attributeName string) (value string, err types.Error)

GetAttribute returns one particular attribute of an route

func (*RouteService) GetAttributes

func (rs *RouteService) GetAttributes(routeName string) (attributes *types.Attributes, err types.Error)

GetAttributes returns attributes of an route

func (*RouteService) Update

func (rs *RouteService) Update(updatedRoute types.Route,
	who audit.Requester) (*types.Route, types.Error)

Update updates an existing route

type Service

Service can manipulate all our entities

func New

func New(database *db.Database, auditlog *audit.Audit) *Service

New sets up services for all entities

type User

type User interface {
	GetAll() (users types.Users, err types.Error)

	Get(userName string) (user *types.User, err types.Error)

	GetUsersByRole(roleName string) (users []string, err types.Error)

	Create(newUser types.User, who audit.Requester) (*types.User, types.Error)

	Update(updatedUser types.User, who audit.Requester) (*types.User, types.Error)

	Delete(userName string, who audit.Requester) (e types.Error)
}

User is the service interface to manipulate User entities

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

UserService is

func NewUser

func NewUser(database *db.Database, a *audit.Audit) *UserService

NewUser returns a new user instance

func (*UserService) Create

func (us *UserService) Create(newUser types.User, who audit.Requester) (*types.User, types.Error)

Create creates an user

func (*UserService) Delete

func (us *UserService) Delete(userName string, who audit.Requester) (e types.Error)

Delete deletes an user

func (*UserService) Get

func (us *UserService) Get(userName string) (user *types.User, err types.Error)

Get returns details of an user

func (*UserService) GetAll

func (us *UserService) GetAll() (users types.Users, err types.Error)

GetAll returns all users

func (*UserService) GetUsersByRole

func (us *UserService) GetUsersByRole(roleName string) ([]string, types.Error)

returns all users with a specific role

func (*UserService) Update

func (us *UserService) Update(updatedUser types.User,
	who audit.Requester) (*types.User, types.Error)

Update updates an existing user

Jump to

Keyboard shortcuts

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