Skip to content

Commit defd0fd

Browse files
committed
refactor: use api v1beta1 instead of v1
Signed-off-by: Kush <[email protected]>
1 parent 1275074 commit defd0fd

30 files changed

Lines changed: 1709 additions & 1386 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ NAME = "github.com/odpf/optimus"
55
LAST_COMMIT := $(shell git rev-parse --short HEAD)
66
LAST_TAG := "$(shell git rev-list --tags --max-count=1)"
77
OPMS_VERSION := "$(shell git describe --tags ${LAST_TAG})-next"
8-
PROTON_COMMIT := "00a4f30ab69c44650c819f68c118d9c0a0d69e7d"
8+
PROTON_COMMIT := "1ff5d1bca91c05be0f6288b188add035b0eb5989"
99

1010
all: build
1111

api/handler/v1/adapter.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"strings"
55
"time"
66

7+
"github.com/odpf/optimus/utils"
8+
79
"google.golang.org/protobuf/types/known/durationpb"
810

911
"github.com/golang/protobuf/proto"
@@ -82,7 +84,7 @@ func (adapt *Adapter) FromJobProto(spec *pb.JobSpecification) (models.JobSpec, e
8284

8385
for _, notify := range spec.Behavior.Notify {
8486
notifiers = append(notifiers, models.JobSpecNotifier{
85-
On: models.JobEventType(strings.TrimPrefix(strings.ToLower(notify.On.String()), "type_")),
87+
On: models.JobEventType(utils.FromEnumProto(notify.On.String(), "type")),
8688
Config: notify.Config,
8789
Channels: notify.Channels,
8890
})
@@ -154,7 +156,7 @@ func (adapt *Adapter) ToJobProto(spec models.JobSpec) (*pb.JobSpecification, err
154156
var notifyProto []*pb.JobSpecification_Behavior_Notifiers
155157
for _, notify := range spec.Behavior.Notify {
156158
notifyProto = append(notifyProto, &pb.JobSpecification_Behavior_Notifiers{
157-
On: pb.JobEvent_Type(pb.JobEvent_Type_value["TYPE_"+strings.ToUpper(string(notify.On))]),
159+
On: pb.JobEvent_Type(pb.JobEvent_Type_value[utils.ToEnumProto(string(notify.On), "type")]),
158160
Channels: notify.Channels,
159161
Config: notify.Config,
160162
})

api/handler/v1/runtime.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ func (sv *RuntimeServiceServer) CreateJobSpecification(ctx context.Context, req
375375
}, nil
376376
}
377377

378-
func (sv *RuntimeServiceServer) ReadJobSpecification(ctx context.Context, req *pb.ReadJobSpecificationRequest) (*pb.ReadJobSpecificationResponse, error) {
378+
func (sv *RuntimeServiceServer) GetJobSpecification(ctx context.Context, req *pb.GetJobSpecificationRequest) (*pb.GetJobSpecificationResponse, error) {
379379
projectRepo := sv.projectRepoFactory.New()
380380
projSpec, err := projectRepo.GetByName(ctx, req.GetProjectName())
381381
if err != nil {
@@ -398,7 +398,7 @@ func (sv *RuntimeServiceServer) ReadJobSpecification(ctx context.Context, req *p
398398
return nil, status.Errorf(codes.Internal, "cannot serialize job: \n%s", err.Error())
399399
}
400400

401-
return &pb.ReadJobSpecificationResponse{
401+
return &pb.GetJobSpecificationResponse{
402402
Spec: jobSpecAdapt,
403403
}, nil
404404
}

api/handler/v1/runtime_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ func TestRuntimeServiceServer(t *testing.T) {
849849
})
850850
})
851851

852-
t.Run("ReadJobSpecification", func(t *testing.T) {
852+
t.Run("GetJobSpecification", func(t *testing.T) {
853853
t.Run("should read a job spec", func(t *testing.T) {
854854
Version := "1.0.1"
855855

@@ -943,8 +943,8 @@ func TestRuntimeServiceServer(t *testing.T) {
943943
)
944944

945945
jobSpecAdapted, _ := adapter.ToJobProto(jobSpecs[0])
946-
deployRequest := pb.ReadJobSpecificationRequest{ProjectName: projectName, JobName: jobSpecs[0].Name, Namespace: namespaceSpec.Name}
947-
jobSpecResp, err := runtimeServiceServer.ReadJobSpecification(context.Background(), &deployRequest)
946+
deployRequest := pb.GetJobSpecificationRequest{ProjectName: projectName, JobName: jobSpecs[0].Name, Namespace: namespaceSpec.Name}
947+
jobSpecResp, err := runtimeServiceServer.GetJobSpecification(context.Background(), &deployRequest)
948948
assert.Nil(t, err)
949949
assert.Equal(t, jobSpecAdapted, jobSpecResp.Spec)
950950
})

api/proto/odpf/optimus/core/v1beta1/runtime.pb.go

Lines changed: 856 additions & 814 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/proto/odpf/optimus/core/v1beta1/runtime.pb.gw.go

Lines changed: 97 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/proto/odpf/optimus/core/v1beta1/runtime_grpc.pb.go

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)