Move Day2 Config Values API to new endpoint
[multicloud/k8s.git] / src / k8splugin / internal / app / instance.go
index a6e213c..69ade3a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright 2018 Intel Corporation, Inc
- * Copyright © 2020 Samsung Electronics
+ * Copyright © 2021 Samsung Electronics
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -111,6 +111,16 @@ func NewInstanceClient() *InstanceClient {
        }
 }
 
+// Simplified function to retrieve model data from instance ID
+func resolveModelFromInstance(instanceID string) (rbName, rbVersion, profileName, releaseName string, err error) {
+       v := NewInstanceClient()
+       resp, err := v.Get(instanceID)
+       if err != nil {
+               return "", "", "", "", pkgerrors.Wrap(err, "Getting instance")
+       }
+       return resp.Request.RBName, resp.Request.RBVersion, resp.Request.ProfileName, resp.ReleaseName, nil
+}
+
 // Create an instance of rb on the cluster  in the database
 func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) {