Skip to content

Commit d4a1ed7

Browse files
authored
[V2] add dummy trigger and app service (#7077)
* feat: add dummy trigger service Signed-off-by: machichima <nary12321@gmail.com> * feat: add dummy app service Signed-off-by: machichima <nary12321@gmail.com> --------- Signed-off-by: machichima <nary12321@gmail.com>
1 parent 9bf9792 commit d4a1ed7

File tree

3 files changed

+161
-0
lines changed

3 files changed

+161
-0
lines changed

runs/service/app_service.go

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package service
2+
3+
import (
4+
"context"
5+
6+
"connectrpc.com/connect"
7+
8+
flyteapp "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/app"
9+
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/app/appconnect"
10+
)
11+
12+
// AppService is a dummy implementation that returns empty responses for all endpoints.
13+
type AppService struct {
14+
appconnect.UnimplementedAppServiceHandler
15+
}
16+
17+
func NewAppService() *AppService {
18+
return &AppService{}
19+
}
20+
21+
var _ appconnect.AppServiceHandler = (*AppService)(nil)
22+
23+
func (s *AppService) Create(
24+
ctx context.Context,
25+
req *connect.Request[flyteapp.CreateRequest],
26+
) (*connect.Response[flyteapp.CreateResponse], error) {
27+
return connect.NewResponse(&flyteapp.CreateResponse{}), nil
28+
}
29+
30+
func (s *AppService) Get(
31+
ctx context.Context,
32+
req *connect.Request[flyteapp.GetRequest],
33+
) (*connect.Response[flyteapp.GetResponse], error) {
34+
return connect.NewResponse(&flyteapp.GetResponse{}), nil
35+
}
36+
37+
func (s *AppService) Update(
38+
ctx context.Context,
39+
req *connect.Request[flyteapp.UpdateRequest],
40+
) (*connect.Response[flyteapp.UpdateResponse], error) {
41+
return connect.NewResponse(&flyteapp.UpdateResponse{}), nil
42+
}
43+
44+
func (s *AppService) UpdateStatus(
45+
ctx context.Context,
46+
req *connect.Request[flyteapp.UpdateStatusRequest],
47+
) (*connect.Response[flyteapp.UpdateStatusResponse], error) {
48+
return connect.NewResponse(&flyteapp.UpdateStatusResponse{}), nil
49+
}
50+
51+
func (s *AppService) Delete(
52+
ctx context.Context,
53+
req *connect.Request[flyteapp.DeleteRequest],
54+
) (*connect.Response[flyteapp.DeleteResponse], error) {
55+
return connect.NewResponse(&flyteapp.DeleteResponse{}), nil
56+
}
57+
58+
func (s *AppService) List(
59+
ctx context.Context,
60+
req *connect.Request[flyteapp.ListRequest],
61+
) (*connect.Response[flyteapp.ListResponse], error) {
62+
return connect.NewResponse(&flyteapp.ListResponse{}), nil
63+
}
64+
65+
func (s *AppService) Watch(
66+
ctx context.Context,
67+
req *connect.Request[flyteapp.WatchRequest],
68+
stream *connect.ServerStream[flyteapp.WatchResponse],
69+
) error {
70+
return nil
71+
}
72+
73+
func (s *AppService) Lease(
74+
ctx context.Context,
75+
req *connect.Request[flyteapp.LeaseRequest],
76+
stream *connect.ServerStream[flyteapp.LeaseResponse],
77+
) error {
78+
return nil
79+
}

runs/service/trigger_service.go

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package service
2+
3+
import (
4+
"context"
5+
6+
"connectrpc.com/connect"
7+
8+
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/trigger"
9+
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/trigger/triggerconnect"
10+
)
11+
12+
// TriggerService is a dummy implementation that returns empty responses for all endpoints.
13+
type TriggerService struct {
14+
triggerconnect.UnimplementedTriggerServiceHandler
15+
}
16+
17+
func NewTriggerService() *TriggerService {
18+
return &TriggerService{}
19+
}
20+
21+
var _ triggerconnect.TriggerServiceHandler = (*TriggerService)(nil)
22+
23+
func (s *TriggerService) DeployTrigger(
24+
ctx context.Context,
25+
req *connect.Request[trigger.DeployTriggerRequest],
26+
) (*connect.Response[trigger.DeployTriggerResponse], error) {
27+
return connect.NewResponse(&trigger.DeployTriggerResponse{}), nil
28+
}
29+
30+
func (s *TriggerService) GetTriggerDetails(
31+
ctx context.Context,
32+
req *connect.Request[trigger.GetTriggerDetailsRequest],
33+
) (*connect.Response[trigger.GetTriggerDetailsResponse], error) {
34+
return connect.NewResponse(&trigger.GetTriggerDetailsResponse{}), nil
35+
}
36+
37+
func (s *TriggerService) GetTriggerRevisionDetails(
38+
ctx context.Context,
39+
req *connect.Request[trigger.GetTriggerRevisionDetailsRequest],
40+
) (*connect.Response[trigger.GetTriggerRevisionDetailsResponse], error) {
41+
return connect.NewResponse(&trigger.GetTriggerRevisionDetailsResponse{}), nil
42+
}
43+
44+
func (s *TriggerService) ListTriggers(
45+
ctx context.Context,
46+
req *connect.Request[trigger.ListTriggersRequest],
47+
) (*connect.Response[trigger.ListTriggersResponse], error) {
48+
return connect.NewResponse(&trigger.ListTriggersResponse{}), nil
49+
}
50+
51+
func (s *TriggerService) GetTriggerRevisionHistory(
52+
ctx context.Context,
53+
req *connect.Request[trigger.GetTriggerRevisionHistoryRequest],
54+
) (*connect.Response[trigger.GetTriggerRevisionHistoryResponse], error) {
55+
return connect.NewResponse(&trigger.GetTriggerRevisionHistoryResponse{}), nil
56+
}
57+
58+
func (s *TriggerService) UpdateTriggers(
59+
ctx context.Context,
60+
req *connect.Request[trigger.UpdateTriggersRequest],
61+
) (*connect.Response[trigger.UpdateTriggersResponse], error) {
62+
return connect.NewResponse(&trigger.UpdateTriggersResponse{}), nil
63+
}
64+
65+
func (s *TriggerService) DeleteTriggers(
66+
ctx context.Context,
67+
req *connect.Request[trigger.DeleteTriggersRequest],
68+
) (*connect.Response[trigger.DeleteTriggersResponse], error) {
69+
return connect.NewResponse(&trigger.DeleteTriggersResponse{}), nil
70+
}

runs/setup.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import (
88

99
"github.com/flyteorg/flyte/v2/app"
1010
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/actions/actionsconnect"
11+
flyteappconnect "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/app/appconnect"
1112
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/auth/authconnect"
1213
projectpb "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/project"
1314
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/project/projectconnect"
1415
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/task/taskconnect"
16+
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/trigger/triggerconnect"
1517
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/workflow/workflowconnect"
1618
"github.com/flyteorg/flyte/v2/runs/config"
1719
"github.com/flyteorg/flyte/v2/runs/migrations"
@@ -70,6 +72,16 @@ func Setup(ctx context.Context, sc *app.SetupContext) error {
7072
sc.Mux.Handle(identityPath, identityHandler)
7173
logger.Infof(ctx, "Mounted IdentityService at %s", identityPath)
7274

75+
appSvc := service.NewAppService()
76+
appPath, appHandler := flyteappconnect.NewAppServiceHandler(appSvc)
77+
sc.Mux.Handle(appPath, appHandler)
78+
logger.Infof(ctx, "Mounted AppService at %s", appPath)
79+
80+
triggerSvc := service.NewTriggerService()
81+
triggerPath, triggerHandler := triggerconnect.NewTriggerServiceHandler(triggerSvc)
82+
sc.Mux.Handle(triggerPath, triggerHandler)
83+
logger.Infof(ctx, "Mounted TriggerService at %s", triggerPath)
84+
7385
domains := make([]*projectpb.Domain, 0, len(cfg.Domains))
7486
for _, d := range cfg.Domains {
7587
domains = append(domains, &projectpb.Domain{

0 commit comments

Comments
 (0)