Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,14 @@ func (c *ApisixJobCtl) executeServiceTask(client *apisix.Client, task *commonmod

func (c *ApisixJobCtl) executeProtoTask(client *apisix.Client, task *commonmodels.ApisixItemUpdateSpec) error {
proto, err := convertToProto(task.UserSpec)

if err != nil {
return fmt.Errorf("failed to convert spec to proto: %v", err)
}

switch task.Action {
case config.ApisixActionTypeCreate:
resp, err := client.CreateProto(proto)
resp, err := client.UpdateProto(proto.ID, proto)
if err != nil {
return err
}
Expand Down Expand Up @@ -398,6 +399,8 @@ func convertToProto(spec interface{}) (*apisix.Proto, error) {
if err := json.Unmarshal(data, proto); err != nil {
return nil, fmt.Errorf("failed to unmarshal to proto: %v", err)
}
proto.Desc = proto.Name
proto.ID = proto.Name

return proto, nil
}
Expand Down
Loading