Skip to content

Commit

Permalink
Remove api v1 commands and references
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicatoscani committed Jul 27, 2023
1 parent cca2997 commit 2518683
Show file tree
Hide file tree
Showing 472 changed files with 232 additions and 93,980 deletions.
73 changes: 0 additions & 73 deletions cmd/affinitygroup.go

This file was deleted.

56 changes: 0 additions & 56 deletions cmd/affinitygroup_create.go

This file was deleted.

65 changes: 0 additions & 65 deletions cmd/affinitygroup_delete.go

This file was deleted.

60 changes: 0 additions & 60 deletions cmd/affinitygroup_list.go

This file was deleted.

71 changes: 0 additions & 71 deletions cmd/affinitygroup_show.go

This file was deleted.

23 changes: 3 additions & 20 deletions cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/exoscale/cli/pkg/account"
"github.com/exoscale/cli/pkg/globalstate"
"github.com/exoscale/egoscale"
exov2 "github.com/exoscale/egoscale/v2"
)

Expand All @@ -32,7 +31,7 @@ func newCLIRoundTripper(next http.RoundTripper, headers map[string]string) cliRo
}

roundTripper.reqHeaders.Add("User-Agent", fmt.Sprintf("Exoscale-CLI/%s (%s) %s",
gVersion, gCommit, egoscale.UserAgent))
gVersion, gCommit, exov2.UserAgent))

for k, v := range headers {
roundTripper.reqHeaders.Add(k, v)
Expand Down Expand Up @@ -60,27 +59,11 @@ func buildClient() {

httpClient := &http.Client{Transport: newCLIRoundTripper(http.DefaultTransport, account.CurrentAccount.CustomHeaders)}

globalstate.EgoscaleClient = egoscale.NewClient(
account.CurrentAccount.Endpoint,
account.CurrentAccount.Key,
account.CurrentAccount.APISecret(),
egoscale.WithHTTPClient(httpClient),
egoscale.WithoutV2Client())

// During the Exoscale API V1 -> V2 transition, we need to initialize the
// V2 client independently of the V1 client because of HTTP middleware
// (http.Transport) clashes.
// This can be removed once the only API used is V2.
clientExoV2, err := exov2.NewClient(
account.CurrentAccount.Key,
account.CurrentAccount.APISecret(),
exov2.ClientOptWithAPIEndpoint(account.CurrentAccount.Endpoint),
exov2.ClientOptWithTimeout(time.Minute*time.Duration(account.CurrentAccount.ClientTimeout)),
exov2.ClientOptWithHTTPClient(func() *http.Client {
return &http.Client{
Transport: newCLIRoundTripper(http.DefaultTransport, account.CurrentAccount.CustomHeaders),
}
}()),
exov2.ClientOptWithHTTPClient(httpClient),
exov2.ClientOptCond(func() bool {
if v := os.Getenv("EXOSCALE_TRACE"); v != "" {
return true
Expand All @@ -91,6 +74,6 @@ func buildClient() {
if err != nil {
panic(fmt.Sprintf("unable to initialize Exoscale API V2 client: %v", err))
}
globalstate.EgoscaleClient.Client = clientExoV2
globalstate.EgoscaleClient = clientExoV2

}
Loading

0 comments on commit 2518683

Please sign in to comment.