aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/app/instance.go
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2019-05-22 23:48:26 -0700
committerKiran Kamineni <kiran.k.kamineni@intel.com>2019-05-22 23:53:27 -0700
commit525023e1d288bbf9cf59584c5b5dd37d83be7a4b (patch)
treebebc995e431abe5fc6b6421fdcb80b6dce8c0ce0 /src/k8splugin/internal/app/instance.go
parent352080a39d582a767d5908ab3372ac10d59a2261 (diff)
Minor change to instance response
Minor change to instance response. Now it includes the full request parameters in the response. Issue-ID: MULTICLOUD-649 Change-Id: Ia4a7e479f842dd580bcfb13aa91dc0b0a456cf25 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/internal/app/instance.go')
-rw-r--r--src/k8splugin/internal/app/instance.go35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/k8splugin/internal/app/instance.go b/src/k8splugin/internal/app/instance.go
index 41eca211..fe9f3857 100644
--- a/src/k8splugin/internal/app/instance.go
+++ b/src/k8splugin/internal/app/instance.go
@@ -40,13 +40,10 @@ type InstanceRequest struct {
// InstanceResponse contains the response from instantiation
type InstanceResponse struct {
- ID string `json:"id"`
- RBName string `json:"rb-name"`
- RBVersion string `json:"rb-version"`
- ProfileName string `json:"profile-name"`
- CloudRegion string `json:"cloud-region"`
- Namespace string `json:"namespace"`
- Resources []helm.KubernetesResource `json:"resources"`
+ ID string `json:"id"`
+ Request InstanceRequest `json:"request"`
+ Namespace string `json:"namespace"`
+ Resources []helm.KubernetesResource `json:"resources"`
}
// InstanceManager is an interface exposes the instantiation functionality
@@ -134,13 +131,15 @@ func (v *InstanceClient) Create(i InstanceRequest) (InstanceResponse, error) {
//Compose the return response
resp := InstanceResponse{
- ID: id,
- RBName: i.RBName,
- RBVersion: i.RBVersion,
- ProfileName: i.ProfileName,
- CloudRegion: i.CloudRegion,
- Namespace: profile.Namespace,
- Resources: createdResources,
+ ID: id,
+ Request: InstanceRequest{
+ RBName: i.RBName,
+ RBVersion: i.RBVersion,
+ ProfileName: i.ProfileName,
+ CloudRegion: i.CloudRegion,
+ },
+ Namespace: profile.Namespace,
+ Resources: createdResources,
}
key := InstanceKey{
@@ -199,13 +198,13 @@ func (v *InstanceClient) Find(rbName string, version string, profile string) ([]
return []InstanceResponse{}, pkgerrors.Wrap(err, "Unmarshaling Instance Value")
}
- if resp.RBName == rbName {
+ if resp.Request.RBName == rbName {
//Check if a version is provided and if it matches
if version != "" {
- if resp.RBVersion == version {
+ if resp.Request.RBVersion == version {
//Check if a profilename matches or if it is not provided
- if profile == "" || resp.ProfileName == profile {
+ if profile == "" || resp.Request.ProfileName == profile {
response = append(response, resp)
}
}
@@ -227,7 +226,7 @@ func (v *InstanceClient) Delete(id string) error {
}
k8sClient := KubernetesClient{}
- err = k8sClient.init(inst.CloudRegion)
+ err = k8sClient.init(inst.Request.CloudRegion)
if err != nil {
return pkgerrors.Wrap(err, "Getting CloudRegion Information")
}