Skip to content

Commit c85f350

Browse files
committed
fix http post on migrate
1 parent 229ebca commit c85f350

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

pkg/paas/migration.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ type ZoneInfo struct {
5858
type Response struct {
5959
Source ZoneInfo `json:"source"`
6060
Destination ZoneInfo `json:"destination"`
61-
Status int `json:"status"`
6261
}
6362

6463
// NewCmdMigrate returns new cobra commad enables user to migrate namespaces to another region on arvan servers.
@@ -219,15 +218,11 @@ func (v confirmationValidator) confirmationValidate(input string) (bool, error)
219218
func migrate(request Request) error {
220219
response, err := httpPost(migrationEndpoint, request)
221220
if err != nil {
221+
failureOutput()
222222
return err
223223
}
224-
225-
if response.Status == http.StatusOK {
226-
successOutput(response)
227-
}
228-
229-
failureOutput()
230-
224+
successOutput(response)
225+
231226
return nil
232227
}
233228

@@ -259,10 +254,6 @@ func httpPost(endpoint string, payload interface{}) (*Response, error) {
259254
return nil, err
260255
}
261256

262-
if httpResp.StatusCode == http.StatusNoContent {
263-
return nil, nil
264-
}
265-
266257
if httpResp.StatusCode != http.StatusOK {
267258
return nil, errors.New("server error. try again later")
268259
}

0 commit comments

Comments
 (0)