(ctx context.Context, pid string)
| 64 | } |
| 65 | |
| 66 | func (i *imlUpstreamModule) Get(ctx context.Context, pid string) (upstream_dto.UpstreamConfig, error) { |
| 67 | _, err := i.serviceService.Check(ctx, pid, asServer) |
| 68 | if err != nil { |
| 69 | return nil, err |
| 70 | } |
| 71 | _, err = i.upstreamService.Get(ctx, pid) |
| 72 | if err != nil { |
| 73 | if !errors.Is(err, gorm.ErrRecordNotFound) { |
| 74 | return nil, err |
| 75 | } |
| 76 | return nil, nil |
| 77 | } |
| 78 | commit, err := i.upstreamService.LatestCommit(ctx, pid, cluster.DefaultClusterID) |
| 79 | if err != nil { |
| 80 | if !errors.Is(err, gorm.ErrRecordNotFound) { |
| 81 | return nil, err |
| 82 | } |
| 83 | return nil, nil |
| 84 | } |
| 85 | |
| 86 | return upstream_dto.FromClusterConfig(commit.Data), nil |
| 87 | } |
| 88 | |
| 89 | func (i *imlUpstreamModule) Save(ctx context.Context, pid string, upstreamConfig upstream_dto.UpstreamConfig) (upstream_dto.UpstreamConfig, error) { |
| 90 | pInfo, err := i.serviceService.Check(ctx, pid, asServer) |
no test coverage detected