Skip to content

Commit

Permalink
fix http post on migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfa committed Oct 29, 2022
1 parent 229ebca commit c85f350
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions pkg/paas/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ type ZoneInfo struct {
type Response struct {
Source ZoneInfo `json:"source"`
Destination ZoneInfo `json:"destination"`
Status int `json:"status"`
}

// NewCmdMigrate returns new cobra commad enables user to migrate namespaces to another region on arvan servers.
Expand Down Expand Up @@ -219,15 +218,11 @@ func (v confirmationValidator) confirmationValidate(input string) (bool, error)
func migrate(request Request) error {
response, err := httpPost(migrationEndpoint, request)
if err != nil {
failureOutput()
return err
}

if response.Status == http.StatusOK {
successOutput(response)
}

failureOutput()

successOutput(response)

return nil
}

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

if httpResp.StatusCode == http.StatusNoContent {
return nil, nil
}

if httpResp.StatusCode != http.StatusOK {
return nil, errors.New("server error. try again later")
}
Expand Down

0 comments on commit c85f350

Please sign in to comment.