Add some conifguration and logging for the hub
This commit is contained in:
2
registrar/internal/services/app_registration.go
Normal file
2
registrar/internal/services/app_registration.go
Normal file
@@ -0,0 +1,2 @@
|
||||
package services
|
||||
|
||||
5
registrar/internal/services/approvals.go
Normal file
5
registrar/internal/services/approvals.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package services
|
||||
|
||||
type ApprovalRequester interface {
|
||||
SendApprovalRequest(appName string) error
|
||||
}
|
||||
14
registrar/internal/services/pubsub.go
Normal file
14
registrar/internal/services/pubsub.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package services
|
||||
|
||||
type Publisher interface {
|
||||
Publish(topic string, message string)
|
||||
}
|
||||
|
||||
type PubSub interface {
|
||||
Publisher
|
||||
Subscriber
|
||||
}
|
||||
|
||||
type Subscriber interface {
|
||||
Subscribe(topic string) <-chan string
|
||||
}
|
||||
27
registrar/internal/services/repo.go
Normal file
27
registrar/internal/services/repo.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrAppRepo = errors.New("AppRepo")
|
||||
ErrApplicationNotFound = fmt.Errorf("%w: application not found", ErrAppRepo)
|
||||
)
|
||||
|
||||
type Application struct {
|
||||
ID uuid.UUID
|
||||
Name string
|
||||
State string
|
||||
}
|
||||
|
||||
type AppRepo interface {
|
||||
IsRegistered(name string) bool
|
||||
PendingApprovalCount() int
|
||||
GetApp(name string) (Application, error)
|
||||
StartAppRegistration(name string) uuid.UUID
|
||||
ApproveApp(id uuid.UUID) (Application, error)
|
||||
}
|
||||
Reference in New Issue
Block a user