mirror of
https://github.com/foomo/redirects.git
synced 2025-10-16 12:35:37 +00:00
feat: refactor service interfaces into internal and external
This commit is contained in:
parent
2758589afc
commit
8623699e8b
@ -1,14 +1,11 @@
|
||||
package redirectdefinition
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/foomo/contentserver/content"
|
||||
keelmongo "github.com/foomo/keel/persistence/mongo"
|
||||
redirectcommand "github.com/foomo/redirects/domain/redirectdefinition/command"
|
||||
redirectquery "github.com/foomo/redirects/domain/redirectdefinition/query"
|
||||
service "github.com/foomo/redirects/domain/redirectdefinition/service"
|
||||
redirectstore "github.com/foomo/redirects/domain/redirectdefinition/store"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
@ -19,7 +16,7 @@ type Service struct {
|
||||
api *API
|
||||
}
|
||||
|
||||
func NewService(l *zap.Logger, p *keelmongo.Persistor, api *API, ctx context.Context) service.RedirectDefinitionService {
|
||||
func NewService(l *zap.Logger, api *API) *Service {
|
||||
return &Service{
|
||||
l: l,
|
||||
api: api,
|
||||
|
||||
@ -13,32 +13,28 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
RedirectDefinitionServiceGoTSRPCProxyCreate = "Create"
|
||||
RedirectDefinitionServiceGoTSRPCProxyCreateRedirectsFromContentserverexport = "CreateRedirectsFromContentserverexport"
|
||||
RedirectDefinitionServiceGoTSRPCProxyDelete = "Delete"
|
||||
RedirectDefinitionServiceGoTSRPCProxyGetRedirects = "GetRedirects"
|
||||
RedirectDefinitionServiceGoTSRPCProxySearch = "Search"
|
||||
RedirectDefinitionServiceGoTSRPCProxyUpdate = "Update"
|
||||
InternalServiceGoTSRPCProxyCreateRedirectsFromContentserverexport = "CreateRedirectsFromContentserverexport"
|
||||
InternalServiceGoTSRPCProxyGetRedirects = "GetRedirects"
|
||||
)
|
||||
|
||||
type RedirectDefinitionServiceGoTSRPCProxy struct {
|
||||
type InternalServiceGoTSRPCProxy struct {
|
||||
EndPoint string
|
||||
service RedirectDefinitionService
|
||||
service InternalService
|
||||
}
|
||||
|
||||
func NewDefaultRedirectDefinitionServiceGoTSRPCProxy(service RedirectDefinitionService) *RedirectDefinitionServiceGoTSRPCProxy {
|
||||
return NewRedirectDefinitionServiceGoTSRPCProxy(service, "/services/redirects/redirectdefinition")
|
||||
func NewDefaultInternalServiceGoTSRPCProxy(service InternalService) *InternalServiceGoTSRPCProxy {
|
||||
return NewInternalServiceGoTSRPCProxy(service, "/services/redirects/redirectdefinition/internal")
|
||||
}
|
||||
|
||||
func NewRedirectDefinitionServiceGoTSRPCProxy(service RedirectDefinitionService, endpoint string) *RedirectDefinitionServiceGoTSRPCProxy {
|
||||
return &RedirectDefinitionServiceGoTSRPCProxy{
|
||||
func NewInternalServiceGoTSRPCProxy(service InternalService, endpoint string) *InternalServiceGoTSRPCProxy {
|
||||
return &InternalServiceGoTSRPCProxy{
|
||||
EndPoint: endpoint,
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
||||
// ServeHTTP exposes your service
|
||||
func (p *RedirectDefinitionServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
func (p *InternalServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodOptions {
|
||||
return
|
||||
} else if r.Method != http.MethodPost {
|
||||
@ -51,35 +47,9 @@ func (p *RedirectDefinitionServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter,
|
||||
callStats, _ := gotsrpc.GetStatsForRequest(r)
|
||||
callStats.Func = funcName
|
||||
callStats.Package = "github.com/foomo/redirects/domain/redirectdefinition/service"
|
||||
callStats.Service = "RedirectDefinitionService"
|
||||
callStats.Service = "InternalService"
|
||||
switch funcName {
|
||||
case RedirectDefinitionServiceGoTSRPCProxyCreate:
|
||||
var (
|
||||
args []interface{}
|
||||
rets []interface{}
|
||||
)
|
||||
var (
|
||||
arg_def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition
|
||||
)
|
||||
args = []interface{}{&arg_def}
|
||||
if err := gotsrpc.LoadArgs(&args, callStats, r); err != nil {
|
||||
gotsrpc.ErrorCouldNotLoadArgs(w)
|
||||
return
|
||||
}
|
||||
executionStart := time.Now()
|
||||
rw := gotsrpc.ResponseWriter{ResponseWriter: w}
|
||||
createRet := p.service.Create(&rw, r, arg_def)
|
||||
callStats.Execution = time.Since(executionStart)
|
||||
if rw.Status() == http.StatusOK {
|
||||
rets = []interface{}{createRet}
|
||||
if err := gotsrpc.Reply(rets, callStats, r, w); err != nil {
|
||||
gotsrpc.ErrorCouldNotReply(w)
|
||||
return
|
||||
}
|
||||
}
|
||||
gotsrpc.Monitor(w, r, args, rets, callStats)
|
||||
return
|
||||
case RedirectDefinitionServiceGoTSRPCProxyCreateRedirectsFromContentserverexport:
|
||||
case InternalServiceGoTSRPCProxyCreateRedirectsFromContentserverexport:
|
||||
var (
|
||||
args []interface{}
|
||||
rets []interface{}
|
||||
@ -106,7 +76,96 @@ func (p *RedirectDefinitionServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter,
|
||||
}
|
||||
gotsrpc.Monitor(w, r, args, rets, callStats)
|
||||
return
|
||||
case RedirectDefinitionServiceGoTSRPCProxyDelete:
|
||||
case InternalServiceGoTSRPCProxyGetRedirects:
|
||||
var (
|
||||
args []interface{}
|
||||
rets []interface{}
|
||||
)
|
||||
executionStart := time.Now()
|
||||
rw := gotsrpc.ResponseWriter{ResponseWriter: w}
|
||||
getRedirectsRet, getRedirectsRet_1 := p.service.GetRedirects(&rw, r)
|
||||
callStats.Execution = time.Since(executionStart)
|
||||
if rw.Status() == http.StatusOK {
|
||||
rets = []interface{}{getRedirectsRet, getRedirectsRet_1}
|
||||
if err := gotsrpc.Reply(rets, callStats, r, w); err != nil {
|
||||
gotsrpc.ErrorCouldNotReply(w)
|
||||
return
|
||||
}
|
||||
}
|
||||
gotsrpc.Monitor(w, r, args, rets, callStats)
|
||||
return
|
||||
default:
|
||||
gotsrpc.ClearStats(r)
|
||||
gotsrpc.ErrorFuncNotFound(w)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
AdminServiceGoTSRPCProxyCreate = "Create"
|
||||
AdminServiceGoTSRPCProxyDelete = "Delete"
|
||||
AdminServiceGoTSRPCProxySearch = "Search"
|
||||
AdminServiceGoTSRPCProxyUpdate = "Update"
|
||||
)
|
||||
|
||||
type AdminServiceGoTSRPCProxy struct {
|
||||
EndPoint string
|
||||
service AdminService
|
||||
}
|
||||
|
||||
func NewDefaultAdminServiceGoTSRPCProxy(service AdminService) *AdminServiceGoTSRPCProxy {
|
||||
return NewAdminServiceGoTSRPCProxy(service, "/services/redirects/redirectdefinition/admin")
|
||||
}
|
||||
|
||||
func NewAdminServiceGoTSRPCProxy(service AdminService, endpoint string) *AdminServiceGoTSRPCProxy {
|
||||
return &AdminServiceGoTSRPCProxy{
|
||||
EndPoint: endpoint,
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
||||
// ServeHTTP exposes your service
|
||||
func (p *AdminServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodOptions {
|
||||
return
|
||||
} else if r.Method != http.MethodPost {
|
||||
gotsrpc.ErrorMethodNotAllowed(w)
|
||||
return
|
||||
}
|
||||
defer io.Copy(io.Discard, r.Body) // Drain Request Body
|
||||
|
||||
funcName := gotsrpc.GetCalledFunc(r, p.EndPoint)
|
||||
callStats, _ := gotsrpc.GetStatsForRequest(r)
|
||||
callStats.Func = funcName
|
||||
callStats.Package = "github.com/foomo/redirects/domain/redirectdefinition/service"
|
||||
callStats.Service = "AdminService"
|
||||
switch funcName {
|
||||
case AdminServiceGoTSRPCProxyCreate:
|
||||
var (
|
||||
args []interface{}
|
||||
rets []interface{}
|
||||
)
|
||||
var (
|
||||
arg_def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition
|
||||
)
|
||||
args = []interface{}{&arg_def}
|
||||
if err := gotsrpc.LoadArgs(&args, callStats, r); err != nil {
|
||||
gotsrpc.ErrorCouldNotLoadArgs(w)
|
||||
return
|
||||
}
|
||||
executionStart := time.Now()
|
||||
rw := gotsrpc.ResponseWriter{ResponseWriter: w}
|
||||
createRet := p.service.Create(&rw, r, arg_def)
|
||||
callStats.Execution = time.Since(executionStart)
|
||||
if rw.Status() == http.StatusOK {
|
||||
rets = []interface{}{createRet}
|
||||
if err := gotsrpc.Reply(rets, callStats, r, w); err != nil {
|
||||
gotsrpc.ErrorCouldNotReply(w)
|
||||
return
|
||||
}
|
||||
}
|
||||
gotsrpc.Monitor(w, r, args, rets, callStats)
|
||||
return
|
||||
case AdminServiceGoTSRPCProxyDelete:
|
||||
var (
|
||||
args []interface{}
|
||||
rets []interface{}
|
||||
@ -132,25 +191,7 @@ func (p *RedirectDefinitionServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter,
|
||||
}
|
||||
gotsrpc.Monitor(w, r, args, rets, callStats)
|
||||
return
|
||||
case RedirectDefinitionServiceGoTSRPCProxyGetRedirects:
|
||||
var (
|
||||
args []interface{}
|
||||
rets []interface{}
|
||||
)
|
||||
executionStart := time.Now()
|
||||
rw := gotsrpc.ResponseWriter{ResponseWriter: w}
|
||||
getRedirectsRet, getRedirectsRet_1 := p.service.GetRedirects(&rw, r)
|
||||
callStats.Execution = time.Since(executionStart)
|
||||
if rw.Status() == http.StatusOK {
|
||||
rets = []interface{}{getRedirectsRet, getRedirectsRet_1}
|
||||
if err := gotsrpc.Reply(rets, callStats, r, w); err != nil {
|
||||
gotsrpc.ErrorCouldNotReply(w)
|
||||
return
|
||||
}
|
||||
}
|
||||
gotsrpc.Monitor(w, r, args, rets, callStats)
|
||||
return
|
||||
case RedirectDefinitionServiceGoTSRPCProxySearch:
|
||||
case AdminServiceGoTSRPCProxySearch:
|
||||
var (
|
||||
args []interface{}
|
||||
rets []interface{}
|
||||
@ -178,7 +219,7 @@ func (p *RedirectDefinitionServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter,
|
||||
}
|
||||
gotsrpc.Monitor(w, r, args, rets, callStats)
|
||||
return
|
||||
case RedirectDefinitionServiceGoTSRPCProxyUpdate:
|
||||
case AdminServiceGoTSRPCProxyUpdate:
|
||||
var (
|
||||
args []interface{}
|
||||
rets []interface{}
|
||||
|
||||
@ -12,92 +12,116 @@ import (
|
||||
pkg_errors "github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type RedirectDefinitionServiceGoTSRPCClient interface {
|
||||
Create(ctx go_context.Context, def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition) (retCreate_0 error, clientErr error)
|
||||
type InternalServiceGoTSRPCClient interface {
|
||||
CreateRedirectsFromContentserverexport(ctx go_context.Context, old map[string]*github_com_foomo_contentserver_content.RepoNode, new map[string]*github_com_foomo_contentserver_content.RepoNode) (retCreateRedirectsFromContentserverexport_0 error, clientErr error)
|
||||
Delete(ctx go_context.Context, path string) (retDelete_0 error, clientErr error)
|
||||
GetRedirects(ctx go_context.Context) (retGetRedirects_0 *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinitions, retGetRedirects_1 error, clientErr error)
|
||||
Search(ctx go_context.Context, dimension string, id string, path string) (retSearch_0 *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinitions, retSearch_1 error, clientErr error)
|
||||
Update(ctx go_context.Context, def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition) (retUpdate_0 error, clientErr error)
|
||||
}
|
||||
|
||||
type HTTPRedirectDefinitionServiceGoTSRPCClient struct {
|
||||
type HTTPInternalServiceGoTSRPCClient struct {
|
||||
URL string
|
||||
EndPoint string
|
||||
Client gotsrpc.Client
|
||||
}
|
||||
|
||||
func NewDefaultRedirectDefinitionServiceGoTSRPCClient(url string) *HTTPRedirectDefinitionServiceGoTSRPCClient {
|
||||
return NewRedirectDefinitionServiceGoTSRPCClient(url, "/services/redirects/redirectdefinition")
|
||||
func NewDefaultInternalServiceGoTSRPCClient(url string) *HTTPInternalServiceGoTSRPCClient {
|
||||
return NewInternalServiceGoTSRPCClient(url, "/services/redirects/redirectdefinition/internal")
|
||||
}
|
||||
|
||||
func NewRedirectDefinitionServiceGoTSRPCClient(url string, endpoint string) *HTTPRedirectDefinitionServiceGoTSRPCClient {
|
||||
return NewRedirectDefinitionServiceGoTSRPCClientWithClient(url, endpoint, nil)
|
||||
func NewInternalServiceGoTSRPCClient(url string, endpoint string) *HTTPInternalServiceGoTSRPCClient {
|
||||
return NewInternalServiceGoTSRPCClientWithClient(url, endpoint, nil)
|
||||
}
|
||||
|
||||
func NewRedirectDefinitionServiceGoTSRPCClientWithClient(url string, endpoint string, client *go_net_http.Client) *HTTPRedirectDefinitionServiceGoTSRPCClient {
|
||||
return &HTTPRedirectDefinitionServiceGoTSRPCClient{
|
||||
func NewInternalServiceGoTSRPCClientWithClient(url string, endpoint string, client *go_net_http.Client) *HTTPInternalServiceGoTSRPCClient {
|
||||
return &HTTPInternalServiceGoTSRPCClient{
|
||||
URL: url,
|
||||
EndPoint: endpoint,
|
||||
Client: gotsrpc.NewClientWithHttpClient(client),
|
||||
}
|
||||
}
|
||||
func (tsc *HTTPRedirectDefinitionServiceGoTSRPCClient) Create(ctx go_context.Context, def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition) (retCreate_0 error, clientErr error) {
|
||||
args := []interface{}{def}
|
||||
reply := []interface{}{&retCreate_0}
|
||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Create", args, reply)
|
||||
if clientErr != nil {
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.RedirectDefinitionServiceGoTSRPCProxy Create")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tsc *HTTPRedirectDefinitionServiceGoTSRPCClient) CreateRedirectsFromContentserverexport(ctx go_context.Context, old map[string]*github_com_foomo_contentserver_content.RepoNode, new map[string]*github_com_foomo_contentserver_content.RepoNode) (retCreateRedirectsFromContentserverexport_0 error, clientErr error) {
|
||||
func (tsc *HTTPInternalServiceGoTSRPCClient) CreateRedirectsFromContentserverexport(ctx go_context.Context, old map[string]*github_com_foomo_contentserver_content.RepoNode, new map[string]*github_com_foomo_contentserver_content.RepoNode) (retCreateRedirectsFromContentserverexport_0 error, clientErr error) {
|
||||
args := []interface{}{old, new}
|
||||
reply := []interface{}{&retCreateRedirectsFromContentserverexport_0}
|
||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "CreateRedirectsFromContentserverexport", args, reply)
|
||||
if clientErr != nil {
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.RedirectDefinitionServiceGoTSRPCProxy CreateRedirectsFromContentserverexport")
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.InternalServiceGoTSRPCProxy CreateRedirectsFromContentserverexport")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tsc *HTTPRedirectDefinitionServiceGoTSRPCClient) Delete(ctx go_context.Context, path string) (retDelete_0 error, clientErr error) {
|
||||
args := []interface{}{path}
|
||||
reply := []interface{}{&retDelete_0}
|
||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Delete", args, reply)
|
||||
if clientErr != nil {
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.RedirectDefinitionServiceGoTSRPCProxy Delete")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tsc *HTTPRedirectDefinitionServiceGoTSRPCClient) GetRedirects(ctx go_context.Context) (retGetRedirects_0 *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinitions, retGetRedirects_1 error, clientErr error) {
|
||||
func (tsc *HTTPInternalServiceGoTSRPCClient) GetRedirects(ctx go_context.Context) (retGetRedirects_0 *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinitions, retGetRedirects_1 error, clientErr error) {
|
||||
args := []interface{}{}
|
||||
reply := []interface{}{&retGetRedirects_0, &retGetRedirects_1}
|
||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "GetRedirects", args, reply)
|
||||
if clientErr != nil {
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.RedirectDefinitionServiceGoTSRPCProxy GetRedirects")
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.InternalServiceGoTSRPCProxy GetRedirects")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tsc *HTTPRedirectDefinitionServiceGoTSRPCClient) Search(ctx go_context.Context, dimension string, id string, path string) (retSearch_0 *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinitions, retSearch_1 error, clientErr error) {
|
||||
type AdminServiceGoTSRPCClient interface {
|
||||
Create(ctx go_context.Context, def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition) (retCreate_0 error, clientErr error)
|
||||
Delete(ctx go_context.Context, path string) (retDelete_0 error, clientErr error)
|
||||
Search(ctx go_context.Context, dimension string, id string, path string) (retSearch_0 *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinitions, retSearch_1 error, clientErr error)
|
||||
Update(ctx go_context.Context, def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition) (retUpdate_0 error, clientErr error)
|
||||
}
|
||||
|
||||
type HTTPAdminServiceGoTSRPCClient struct {
|
||||
URL string
|
||||
EndPoint string
|
||||
Client gotsrpc.Client
|
||||
}
|
||||
|
||||
func NewDefaultAdminServiceGoTSRPCClient(url string) *HTTPAdminServiceGoTSRPCClient {
|
||||
return NewAdminServiceGoTSRPCClient(url, "/services/redirects/redirectdefinition/admin")
|
||||
}
|
||||
|
||||
func NewAdminServiceGoTSRPCClient(url string, endpoint string) *HTTPAdminServiceGoTSRPCClient {
|
||||
return NewAdminServiceGoTSRPCClientWithClient(url, endpoint, nil)
|
||||
}
|
||||
|
||||
func NewAdminServiceGoTSRPCClientWithClient(url string, endpoint string, client *go_net_http.Client) *HTTPAdminServiceGoTSRPCClient {
|
||||
return &HTTPAdminServiceGoTSRPCClient{
|
||||
URL: url,
|
||||
EndPoint: endpoint,
|
||||
Client: gotsrpc.NewClientWithHttpClient(client),
|
||||
}
|
||||
}
|
||||
func (tsc *HTTPAdminServiceGoTSRPCClient) Create(ctx go_context.Context, def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition) (retCreate_0 error, clientErr error) {
|
||||
args := []interface{}{def}
|
||||
reply := []interface{}{&retCreate_0}
|
||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Create", args, reply)
|
||||
if clientErr != nil {
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.AdminServiceGoTSRPCProxy Create")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tsc *HTTPAdminServiceGoTSRPCClient) Delete(ctx go_context.Context, path string) (retDelete_0 error, clientErr error) {
|
||||
args := []interface{}{path}
|
||||
reply := []interface{}{&retDelete_0}
|
||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Delete", args, reply)
|
||||
if clientErr != nil {
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.AdminServiceGoTSRPCProxy Delete")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tsc *HTTPAdminServiceGoTSRPCClient) Search(ctx go_context.Context, dimension string, id string, path string) (retSearch_0 *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinitions, retSearch_1 error, clientErr error) {
|
||||
args := []interface{}{dimension, id, path}
|
||||
reply := []interface{}{&retSearch_0, &retSearch_1}
|
||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Search", args, reply)
|
||||
if clientErr != nil {
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.RedirectDefinitionServiceGoTSRPCProxy Search")
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.AdminServiceGoTSRPCProxy Search")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tsc *HTTPRedirectDefinitionServiceGoTSRPCClient) Update(ctx go_context.Context, def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition) (retUpdate_0 error, clientErr error) {
|
||||
func (tsc *HTTPAdminServiceGoTSRPCClient) Update(ctx go_context.Context, def *github_com_foomo_redirects_domain_redirectdefinition_store.RedirectDefinition) (retUpdate_0 error, clientErr error) {
|
||||
args := []interface{}{def}
|
||||
reply := []interface{}{&retUpdate_0}
|
||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Update", args, reply)
|
||||
if clientErr != nil {
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.RedirectDefinitionServiceGoTSRPCProxy Update")
|
||||
clientErr = pkg_errors.WithMessage(clientErr, "failed to call service.AdminServiceGoTSRPCProxy Update")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -7,11 +7,14 @@ import (
|
||||
redirectstore "github.com/foomo/redirects/domain/redirectdefinition/store"
|
||||
)
|
||||
|
||||
type RedirectDefinitionService interface {
|
||||
CreateRedirectsFromContentserverexport(w http.ResponseWriter, r *http.Request, old, new map[string]*content.RepoNode) error
|
||||
type AdminService interface {
|
||||
Search(w http.ResponseWriter, r *http.Request, dimension, id, path string) (*redirectstore.RedirectDefinitions, error)
|
||||
Create(w http.ResponseWriter, r *http.Request, def *redirectstore.RedirectDefinition) error
|
||||
Delete(w http.ResponseWriter, r *http.Request, path string) error
|
||||
Update(w http.ResponseWriter, r *http.Request, def *redirectstore.RedirectDefinition) error
|
||||
}
|
||||
|
||||
type InternalService interface {
|
||||
CreateRedirectsFromContentserverexport(w http.ResponseWriter, r *http.Request, old, new map[string]*content.RepoNode) error
|
||||
GetRedirects(w http.ResponseWriter, r *http.Request) (*redirectstore.RedirectDefinitions, error)
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@ -34,7 +34,7 @@ require (
|
||||
github.com/xdg-go/stringprep v1.0.3 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||
go.mongodb.org/mongo-driver v1.11.9
|
||||
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.32.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.32.0
|
||||
go.opentelemetry.io/otel v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.7.0
|
||||
golang.org/x/crypto v0.12.0 // indirect
|
||||
|
||||
@ -5,7 +5,9 @@ module:
|
||||
targets:
|
||||
redirectdefinition:
|
||||
services:
|
||||
/services/redirects/redirectdefinition: RedirectDefinitionService
|
||||
/services/redirects/redirectdefinition/admin: AdminService
|
||||
/services/redirects/redirectdefinition/internal: InternalService
|
||||
package: github.com/foomo/redirects/domain/redirectdefinition/service
|
||||
tsrpc:
|
||||
- RedirectDefinitionService
|
||||
- AdminService
|
||||
- InternalService
|
||||
|
||||
Loading…
Reference in New Issue
Block a user