Fixed implementation for downloading chart by handling producer
for type appliation/zip.
Signed-off-by: subhash kumar singh <subh.singh@samsung.com>
Change-Id: I271a45e6fbbe15867518555f919dd0d3970b7bdf
get:
produces:
- application/zip
get:
produces:
- application/zip
parameters:
- in: path
name: xApp_name
parameters:
- in: path
name: xApp_name
'200':
description: Download helm chart OK
schema:
'200':
description: Download helm chart OK
schema:
- format: binary
- type: string
'500':
description: Get helm chart values.yaml failed
schema:
'500':
description: Get helm chart values.yaml failed
schema:
- return resp.Request.Body, nil
}
func (c *ChartMgr) GetChartsByName(name string) ([]map[string]interface{}, error) {
}
func (c *ChartMgr) GetChartsByName(name string) ([]map[string]interface{}, error) {
+ "fmt"
+ "io"
+ "io/ioutil"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/resthooks"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/ricdms"
"github.com/go-openapi/loads"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/resthooks"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/ricdms"
"github.com/go-openapi/loads"
+ "github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
)
"github.com/go-openapi/runtime/middleware"
)
+ api.ApplicationZipProducer = runtime.ProducerFunc(func(w io.Writer, data interface{}) error {
+ if zp, ok := data.(io.ReadCloser); ok {
+ defer zp.Close()
+ b, err := ioutil.ReadAll(zp)
+
+ if err != nil {
+ ricdms.Logger.Error("error: %v", err)
+ return err
+ }
+ _, err = w.Write(b)
+
+ if err != nil {
+ ricdms.Logger.Error("error: %v", err)
+ return err
+ }
+ return nil
+ }
+ return fmt.Errorf("not support")
+ })