Skip to content

Commit a7ddb9b

Browse files
katia-echrisvdg
authored andcommitted
Adds set default gateway (#21)
1 parent 8110141 commit a7ddb9b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ovc/cloudspaces.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ type CloudSpaceService interface {
109109
Create(*CloudSpaceConfig) (string, error)
110110
Update(*CloudSpaceConfig) error
111111
Delete(*CloudSpaceDeleteConfig) error
112+
SetDefaultGateway(int, string) error
112113
}
113114

114115
// CloudSpaceServiceOp handles communication with the cloudspace related methods of the
@@ -235,3 +236,22 @@ func (s *CloudSpaceServiceOp) Update(cloudSpaceConfig *CloudSpaceConfig) error {
235236

236237
return err
237238
}
239+
240+
// SetDefaultGateway sets default gateway of the cloudspace to the given IP address
241+
func (s *CloudSpaceServiceOp) SetDefaultGateway(cloudspaceID int, gateway string) error {
242+
csMap := make(map[string]interface{})
243+
csMap["cloudspaceId"] = cloudspaceID
244+
csMap["gateway"] = gateway
245+
246+
csMapJSON, err := json.Marshal(csMap)
247+
if err != nil {
248+
return err
249+
}
250+
req, err := http.NewRequest("POST", s.client.ServerURL+"/cloudapi/cloudspaces/setDefaultGateway", bytes.NewBuffer(csMapJSON))
251+
if err != nil {
252+
return err
253+
}
254+
_, err = s.client.Do(req)
255+
256+
return err
257+
}

0 commit comments

Comments
 (0)