From 83a81838a5a946e04ad96335b2ed0ca7dc5b220d Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 <118799587+AnikaAgiwal2711@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:27:56 +0530 Subject: [PATCH] Service datasource (#103) removed additional properties --- go.mod | 2 +- service_test.go | 4 ++-- types/v1/templateTypes.go | 39 +++++++++------------------------------ 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/go.mod b/go.mod index cb9e7e6..f8bad7f 100644 --- a/go.mod +++ b/go.mod @@ -14,4 +14,4 @@ require ( golang.org/x/sys v0.2.0 // indirect ) -go 1.22 \ No newline at end of file +go 1.22 diff --git a/service_test.go b/service_test.go index 38ed2ae..62c086d 100644 --- a/service_test.go +++ b/service_test.go @@ -67,7 +67,7 @@ func TestGetDeployeServiceByID(t *testing.T) { t.Fatal(err) } - _, err = GC.GetServiceDetailsByID(tc.id,false) + _, err = GC.GetServiceDetailsByID(tc.id, false) if err != nil { if tc.expected == nil { t.Errorf("Getting template by ID did not work as expected, \n\tgot: %s \n\twant: %v", err, tc.expected) @@ -109,7 +109,7 @@ func TestGetDeployeServiceByIDNegative(t *testing.T) { t.Fatal(err) } - templates, err := client.GetServiceDetailsByID("Test",false) + templates, err := client.GetServiceDetailsByID("Test", false) assert.Nil(t, templates) assert.NotNil(t, err) } diff --git a/types/v1/templateTypes.go b/types/v1/templateTypes.go index 86e1f2d..42edeb9 100644 --- a/types/v1/templateTypes.go +++ b/types/v1/templateTypes.go @@ -330,12 +330,6 @@ type ComponentValid struct { Messages []Messages `json:"messages,omitempty"` } -type RelatedComponents struct { - AdditionalProp1 string `json:"additionalProp1,omitempty"` - AdditionalProp2 string `json:"additionalProp2,omitempty"` - AdditionalProp3 string `json:"additionalProp3,omitempty"` -} - type DependenciesDetails struct { ID string `json:"id,omitempty"` DependencyTarget string `json:"dependencyTarget,omitempty"` @@ -436,12 +430,6 @@ type ExternalVirtualDisks struct { EncryptionType string `json:"encryptionType,omitempty"` } -type SizeToDiskMap struct { - AdditionalProp1 int `json:"additionalProp1,omitempty"` - AdditionalProp2 int `json:"additionalProp2,omitempty"` - AdditionalProp3 int `json:"additionalProp3,omitempty"` -} - type RaidConfiguration struct { VirtualDisks []VirtualDisks `json:"virtualDisks,omitempty"` ExternalVirtualDisks []ExternalVirtualDisks `json:"externalVirtualDisks,omitempty"` @@ -449,13 +437,7 @@ type RaidConfiguration struct { SsdHotSpares []string `json:"ssdHotSpares,omitempty"` ExternalHddHotSpares []string `json:"externalHddHotSpares,omitempty"` ExternalSsdHotSpares []string `json:"externalSsdHotSpares,omitempty"` - SizeToDiskMap SizeToDiskMap `json:"sizeToDiskMap,omitempty"` -} - -type Attributes struct { - AdditionalProp1 string `json:"additionalProp1,omitempty"` - AdditionalProp2 string `json:"additionalProp2,omitempty"` - AdditionalProp3 string `json:"additionalProp3,omitempty"` + SizeToDiskMap map[string]int `json:"sizeToDiskMap,omitempty"` } type OptionsDetails struct { @@ -463,8 +445,9 @@ type OptionsDetails struct { Name string `json:"name,omitempty"` Value string `json:"value,omitempty"` Dependencies []DependenciesDetails `json:"dependencies,omitempty"` - Attributes Attributes `json:"attributes,omitempty"` + Attributes map[string]string `json:"attributes,omitempty"` } + type ScaleIOStoragePoolDisks struct { ProtectionDomainID string `json:"protectionDomainId,omitempty"` ProtectionDomainName string `json:"protectionDomainName,omitempty"` @@ -759,7 +742,7 @@ type ParametersDetails struct { ScaleIODiskConfiguration ScaleIODiskConfiguration `json:"scaleIODiskConfiguration,omitempty"` ProtectionDomainSettings []ProtectionDomainSettings `json:"protectionDomainSettings,omitempty"` FaultSetSettings []FaultSetSettings `json:"faultSetSettings,omitempty"` - Attributes Attributes `json:"attributes,omitempty"` + Attributes map[string]string `json:"attributes,omitempty"` VdsConfiguration VdsConfiguration `json:"vdsConfiguration,omitempty"` NodeSelection NodeSelection `json:"nodeSelection,omitempty"` } @@ -791,21 +774,17 @@ type AdditionalPropDetails struct { ScaleIODiskConfiguration ScaleIODiskConfiguration `json:"scaleIODiskConfiguration,omitempty"` ProtectionDomainSettings []ProtectionDomainSettings `json:"protectionDomainSettings,omitempty"` FaultSetSettings []FaultSetSettings `json:"faultSetSettings,omitempty"` - Attributes Attributes `json:"attributes,omitempty"` + Attributes map[string]string `json:"attributes,omitempty"` VdsConfiguration VdsConfiguration `json:"vdsConfiguration,omitempty"` NodeSelection NodeSelection `json:"nodeSelection,omitempty"` } -type ParametersMap struct { - AdditionalProp1 AdditionalPropDetails `json:"additionalProp1,omitempty"` - AdditionalProp2 AdditionalPropDetails `json:"additionalProp2,omitempty"` - AdditionalProp3 AdditionalPropDetails `json:"additionalProp3,omitempty"` -} + type Resources struct { GUID string `json:"guid,omitempty"` ID string `json:"id,omitempty"` DisplayName string `json:"displayName,omitempty"` Parameters []ParametersDetails `json:"parameters,omitempty"` - ParametersMap ParametersMap `json:"parametersMap,omitempty"` + ParametersMap map[string]string `json:"parametersMap,omitempty"` } type Components struct { ID string `json:"id,omitempty"` @@ -818,7 +797,7 @@ type Components struct { Teardown bool `json:"teardown,omitempty"` Type string `json:"type,omitempty"` SubType string `json:"subType,omitempty"` - RelatedComponents RelatedComponents `json:"relatedComponents,omitempty"` + RelatedComponents map[string]string `json:"relatedComponents,omitempty"` Resources []Resources `json:"resources,omitempty"` Brownfield bool `json:"brownfield,omitempty"` PuppetCertName string `json:"puppetCertName,omitempty"` @@ -872,7 +851,7 @@ type Options struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Dependencies []DependenciesDetails `json:"dependencies,omitempty"` - Attributes Attributes `json:"attributes,omitempty"` + Attributes map[string]string `json:"attributes,omitempty"` } type Parameters struct { ID string `json:"id,omitempty"`