MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / Save

Method Save

module/upstream/iml.go:89–113  ·  view source on GitHub ↗
(ctx context.Context, pid string, upstreamConfig upstream_dto.UpstreamConfig)

Source from the content-addressed store, hash-verified

87}
88
89func (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)
91 if err != nil {
92 return nil, err
93 }
94
95 err = i.transaction.Transaction(ctx, func(ctx context.Context) error {
96 err = i.upstreamService.SaveCommit(ctx, pid, cluster.DefaultClusterID, upstream_dto.ConvertUpstream(upstreamConfig))
97 if err != nil {
98 return err
99 }
100
101 return i.upstreamService.Save(ctx, &upstream.SaveUpstream{
102 UUID: pid,
103 Name: fmt.Sprintf("upstream-%s", pid),
104 Service: pid,
105 Team: pInfo.Team,
106 })
107
108 })
109 if err != nil {
110 return nil, err
111 }
112 return i.Get(ctx, pid)
113}

Callers

nothing calls this directly

Calls 4

GetMethod · 0.95
CheckMethod · 0.65
SaveCommitMethod · 0.65
SaveMethod · 0.65

Tested by

no test coverage detected