@@ -134,16 +134,6 @@ type DeleteNodeGroupArgs struct {
134134 ID CloudProviderResourceID
135135}
136136
137- type CreateNodeGroupResponse struct {
138- ID CloudProviderResourceID
139- Name string
140- RefID string
141- MinNodeCount int
142- MaxNodeCount int
143- InstanceType string
144- DiskSizeGiB int
145- }
146-
147137type DeleteClusterArgs struct {
148138 ID CloudProviderResourceID
149139}
@@ -152,7 +142,7 @@ type CloudMaintainKubernetes interface {
152142 CreateCluster (ctx context.Context , args CreateClusterArgs ) (* Cluster , error )
153143 GetCluster (ctx context.Context , args GetClusterArgs ) (* Cluster , error )
154144 PutUser (ctx context.Context , args PutUserArgs ) (* PutUserResponse , error )
155- CreateNodeGroup (ctx context.Context , args CreateNodeGroupArgs ) (* CreateNodeGroupResponse , error )
145+ CreateNodeGroup (ctx context.Context , args CreateNodeGroupArgs ) (* NodeGroup , error )
156146 GetNodeGroup (ctx context.Context , args GetNodeGroupArgs ) (* NodeGroup , error )
157147 ModifyNodeGroup (ctx context.Context , args ModifyNodeGroupArgs ) error
158148 DeleteNodeGroup (ctx context.Context , args DeleteNodeGroupArgs ) error
@@ -165,6 +155,25 @@ func ValidateCreateKubernetesCluster(ctx context.Context, client CloudMaintainKu
165155 return nil , err
166156 }
167157
158+ if cluster .Name != attrs .Name {
159+ return nil , fmt .Errorf ("cluster name does not match create args: '%s' != '%s'" , cluster .Name , attrs .Name )
160+ }
161+ if cluster .RefID != attrs .RefID {
162+ return nil , fmt .Errorf ("cluster refID does not match create args: '%s' != '%s'" , cluster .RefID , attrs .RefID )
163+ }
164+ if cluster .Location != attrs .Location {
165+ return nil , fmt .Errorf ("cluster location does not match create args: '%s' != '%s'" , cluster .Location , attrs .Location )
166+ }
167+ if cluster .KubernetesVersion != attrs .KubernetesVersion {
168+ return nil , fmt .Errorf ("cluster KubernetesVersion does not match create args: '%s' != '%s'" , cluster .KubernetesVersion , attrs .KubernetesVersion )
169+ }
170+ if cluster .VPCID != attrs .VPCID {
171+ return nil , fmt .Errorf ("cluster VPCID does not match create args: '%s' != '%s'" , cluster .VPCID , attrs .VPCID )
172+ }
173+ if len (cluster .SubnetIDs ) != len (attrs .SubnetIDs ) {
174+ return nil , fmt .Errorf ("cluster subnetIDs does not match create args: '%d' != '%d'" , len (cluster .SubnetIDs ), len (attrs .SubnetIDs ))
175+ }
176+
168177 return cluster , nil
169178}
170179
@@ -173,6 +182,11 @@ func ValidateGetKubernetesCluster(ctx context.Context, client CloudMaintainKuber
173182 if err != nil {
174183 return nil , err
175184 }
185+
186+ if cluster .ID != attrs .ID {
187+ return nil , fmt .Errorf ("cluster ID does not match get args: '%s' != '%s'" , cluster .ID , attrs .ID )
188+ }
189+
176190 return cluster , nil
177191}
178192
@@ -223,12 +237,32 @@ func ValidateGetKubernetesClusterCredentials(ctx context.Context, client CloudMa
223237 return putUserResponse , nil
224238}
225239
226- func ValidateCreateKubernetesNodeGroup (ctx context.Context , client CloudMaintainKubernetes , attrs CreateNodeGroupArgs ) error {
227- _ , err := client .CreateNodeGroup (ctx , attrs )
240+ func ValidateCreateKubernetesNodeGroup (ctx context.Context , client CloudMaintainKubernetes , attrs CreateNodeGroupArgs ) ( * NodeGroup , error ) {
241+ nodeGroup , err := client .CreateNodeGroup (ctx , attrs )
228242 if err != nil {
229- return err
243+ return nil , err
230244 }
231- return nil
245+
246+ if nodeGroup .Name != attrs .Name {
247+ return nil , fmt .Errorf ("node group name does not match create args: '%s' != '%s'" , nodeGroup .Name , attrs .Name )
248+ }
249+ if nodeGroup .RefID != attrs .RefID {
250+ return nil , fmt .Errorf ("node group refID does not match create args: '%s' != '%s'" , nodeGroup .RefID , attrs .RefID )
251+ }
252+ if nodeGroup .MinNodeCount != attrs .MinNodeCount {
253+ return nil , fmt .Errorf ("node group minNodeCount does not match create args: '%d' != '%d'" , nodeGroup .MinNodeCount , attrs .MinNodeCount )
254+ }
255+ if nodeGroup .MaxNodeCount != attrs .MaxNodeCount {
256+ return nil , fmt .Errorf ("node group maxNodeCount does not match create args: '%d' != '%d'" , nodeGroup .MaxNodeCount , attrs .MaxNodeCount )
257+ }
258+ if nodeGroup .InstanceType != attrs .InstanceType {
259+ return nil , fmt .Errorf ("node group instanceType does not match create args: '%s' != '%s'" , nodeGroup .InstanceType , attrs .InstanceType )
260+ }
261+ if nodeGroup .DiskSizeGiB != attrs .DiskSizeGiB {
262+ return nil , fmt .Errorf ("node group diskSizeGiB does not match create args: '%d' != '%d'" , nodeGroup .DiskSizeGiB , attrs .DiskSizeGiB )
263+ }
264+
265+ return nodeGroup , nil
232266}
233267
234268func ValidateGetKubernetesNodeGroup (ctx context.Context , client CloudMaintainKubernetes , attrs GetNodeGroupArgs ) error {
0 commit comments