summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/handler.go
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2019-03-15 15:18:12 -0700
committerKiran Kamineni <kiran.k.kamineni@intel.com>2019-03-26 19:19:53 -0700
commitb2b175eae0f4e8b5b0cb9ccbeeca1e98065feeb5 (patch)
treee5a984dd156016b3b615acfd0b903f61e07655ea /src/k8splugin/api/handler.go
parent1ab1af62578c1c2bf7b3b2e56827fe408cabdbb3 (diff)
Update definition and profile to latest spec
Bringing all the definition and profile code upto the latest spec. Integrated the end to end instance code changes that were made. P9: Added updated plugin.sh with updated uri paths based on spec Issue-ID: MULTICLOUD-291 Change-Id: Id6e3c6bc2cd02cfb7005e203ccf03e0793b97e95 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/api/handler.go')
-rw-r--r--src/k8splugin/api/handler.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/k8splugin/api/handler.go b/src/k8splugin/api/handler.go
index b1cc6709..31ffad90 100644
--- a/src/k8splugin/api/handler.go
+++ b/src/k8splugin/api/handler.go
@@ -63,8 +63,12 @@ func validateBody(body interface{}) error {
werr := pkgerrors.Wrap(errors.New("Invalid/Missing CsarID in POST request"), "CreateVnfRequest bad request")
return werr
}
- if b.RBProfileID == "" {
- werr := pkgerrors.Wrap(errors.New("Invalid/Missing RB ProfileID in POST request"), "CreateVnfRequest bad request")
+ if b.RBName == "" || b.RBVersion == "" {
+ werr := pkgerrors.Wrap(errors.New("Invalid/Missing resource bundle parameters in POST request"), "CreateVnfRequest bad request")
+ return werr
+ }
+ if b.ProfileName == "" {
+ werr := pkgerrors.Wrap(errors.New("Invalid/Missing profile name in POST request"), "CreateVnfRequest bad request")
return werr
}
if strings.Contains(b.CloudRegionID, "|") {
@@ -117,16 +121,20 @@ func CreateHandler(w http.ResponseWriter, r *http.Request) {
},
nil
*/
+ profile, err := rb.NewProfileClient().Get(resource.RBName, resource.RBVersion, resource.ProfileName)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
externalVNFID, resourceNameMap, err := helper.CreateVNF(resource.CsarID, resource.CloudRegionID,
- resource.RBProfileID, &kubeclient)
+ profile, &kubeclient)
if err != nil {
werr := pkgerrors.Wrap(err, "Read Kubernetes Data information error")
http.Error(w, werr.Error(), http.StatusInternalServerError)
return
}
- rbProfile, _ := rb.NewProfileClient().Get(resource.RBProfileID)
- namespace := rbProfile.Namespace
+ namespace := profile.Namespace
// cloud1-default-uuid
internalVNFID := resource.CloudRegionID + "-" + namespace + "-" + externalVNFID