Skip to content

Commit

Permalink
Merge pull request #16 from arvancloud/data_center_migration
Browse files Browse the repository at this point in the history
Data center migration
  • Loading branch information
pjfa authored Nov 2, 2022
2 parents 2d50567 + f798c09 commit d96032b
Show file tree
Hide file tree
Showing 6 changed files with 283 additions and 85 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/docker/docker v20.10.0+incompatible // indirect
github.com/fsouza/go-dockerclient v1.6.6 // indirect
github.com/gonum/graph v0.0.0-20190426092945-678096d81a4b // indirect
github.com/gosuri/uilive v0.0.4
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/moby/buildkit v0.8.0 // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE=
github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE=
github.com/gosuri/uilive v0.0.4 h1:hUEBpQDj8D8jXgtCdBu7sWsy5sbW/5GhuO8KBwJ2jyY=
github.com/gosuri/uilive v0.0.4/go.mod h1:V/epo5LjjlDE5RJUcqx8dbw+zc93y5Ya3yg8tfZ74VI=
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
Expand Down Expand Up @@ -834,6 +836,7 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
Expand Down
9 changes: 4 additions & 5 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
updateServer = "https://cli.arvan.run"
)

//GetUserInfo returns a dictionary of user info if authentication credentials is valid.
// GetUserInfo returns a dictionary of user info if authentication credentials is valid.
func GetUserInfo(apikey string) (map[string]string, error) {
arvanConfig := config.GetConfigInfo()
arvanServer := arvanConfig.GetServer()
Expand Down Expand Up @@ -60,17 +60,16 @@ func GetUserInfo(apikey string) (map[string]string, error) {
return user, nil
}


//GetZones from PaaS API
// GetZones from PaaS API
func GetZones() (config.Region, error) {
var regions config.Region
arvanConfig := config.GetConfigInfo()
arvanURL, err := url.Parse(arvanConfig.GetServer())
if err != nil {
return regions, fmt.Errorf("invalid config")
}
httpReq, err := http.NewRequest("GET", arvanURL.Scheme + "://" + arvanURL.Host+regionsEndpoint, nil)

httpReq, err := http.NewRequest("GET", arvanURL.Scheme+"://"+arvanURL.Host+regionsEndpoint, nil)
if err != nil {
return regions, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ type Zone struct {
RegionCity string `json:"region_city"`
RegionCountry string `json:"region_country"`
CreatedAt time.Time `json:"created_at"`
}
}
Loading

0 comments on commit d96032b

Please sign in to comment.