Skip to content

Commit

Permalink
refactor(gateway): group imports
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Aug 15, 2022
1 parent 07c7a66 commit c2d889e
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 55 deletions.
5 changes: 3 additions & 2 deletions gateway/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import (
"sync"
"time"

cosmosclient "github.com/cosmos/cosmos-sdk/client"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/golang-jwt/jwt/v4"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
"k8s.io/client-go/tools/remotecommand"

cosmosclient "github.com/cosmos/cosmos-sdk/client"
sdk "github.com/cosmos/cosmos-sdk/types"

akashclient "github.com/ovrclk/akash/client"
manifest "github.com/ovrclk/akash/manifest/v2beta1"
ctypes "github.com/ovrclk/akash/x/cert/types/v1beta2"
Expand Down
10 changes: 6 additions & 4 deletions gateway/rest/client_shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/gorilla/websocket"
"github.com/ovrclk/akash/util/wsutil"
mtypes "github.com/ovrclk/akash/x/market/types/v1beta2"
"io"
"k8s.io/client-go/tools/remotecommand"
"net/url"
"sync"

"github.com/gorilla/websocket"
"k8s.io/client-go/tools/remotecommand"

"github.com/ovrclk/akash/util/wsutil"
mtypes "github.com/ovrclk/akash/x/market/types/v1beta2"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions gateway/rest/client_shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package rest
import (
"bytes"
"context"
"github.com/stretchr/testify/require"
"io"
"k8s.io/client-go/tools/remotecommand"
"strings"
"sync"
"testing"

"github.com/stretchr/testify/require"
"k8s.io/client-go/tools/remotecommand"
)

func TestProcessRemoteErrorReturnsNoError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions gateway/rest/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"crypto/tls"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"

"github.com/stretchr/testify/mock"

sdk "github.com/cosmos/cosmos-sdk/types"

qmock "github.com/ovrclk/akash/client/mocks"
akashmanifest "github.com/ovrclk/akash/manifest/v2beta1"
"github.com/ovrclk/akash/testutil"
Expand Down
6 changes: 3 additions & 3 deletions gateway/rest/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"strings"

"github.com/golang-jwt/jwt/v4"
"github.com/tendermint/tendermint/libs/log"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/gorilla/context"
gcontext "github.com/gorilla/context"
"github.com/gorilla/mux"
"github.com/pkg/errors"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/libs/log"

dtypes "github.com/ovrclk/akash/x/deployment/types/v1beta2"
mquery "github.com/ovrclk/akash/x/market/query"
mtypes "github.com/ovrclk/akash/x/market/types/v1beta2"
Expand Down
38 changes: 16 additions & 22 deletions gateway/rest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,34 @@ import (
"sync"
"time"

kubeclienterrors "github.com/ovrclk/provider-services/cluster/kube/errors"
"github.com/ovrclk/provider-services/cluster/operatorclients"
"github.com/ovrclk/provider-services/gateway/utils"
ipoptypes "github.com/ovrclk/provider-services/operator/ipoperator/types"

"github.com/golang-jwt/jwt/v4"

"github.com/ovrclk/provider-services/cluster/kube/builder"

"k8s.io/client-go/tools/remotecommand"

manifest "github.com/ovrclk/akash/manifest/v2beta1"
"github.com/ovrclk/akash/util/wsutil"

"github.com/ovrclk/provider-services/cluster/util"

sdk "github.com/cosmos/cosmos-sdk/types"
gcontext "github.com/gorilla/context"
"github.com/gorilla/mux"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
"github.com/tendermint/tendermint/libs/log"

"github.com/gorilla/mux"

kubeErrors "k8s.io/apimachinery/pkg/api/errors"
kubeVersion "k8s.io/apimachinery/pkg/version"
"k8s.io/client-go/tools/remotecommand"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/libs/log"

manifest "github.com/ovrclk/akash/manifest/v2beta1"
"github.com/ovrclk/akash/util/wsutil"
manifestValidation "github.com/ovrclk/akash/validation"
dtypes "github.com/ovrclk/akash/x/deployment/types/v1beta2"
mtypes "github.com/ovrclk/akash/x/market/types/v1beta2"

"github.com/ovrclk/provider-services"
"github.com/ovrclk/provider-services/cluster"
"github.com/ovrclk/provider-services/cluster/kube/builder"
kubeclienterrors "github.com/ovrclk/provider-services/cluster/kube/errors"
"github.com/ovrclk/provider-services/cluster/operatorclients"
cltypes "github.com/ovrclk/provider-services/cluster/types/v1beta2"
"github.com/ovrclk/provider-services/cluster/util"
"github.com/ovrclk/provider-services/gateway/utils"
pmanifest "github.com/ovrclk/provider-services/manifest"
ipoptypes "github.com/ovrclk/provider-services/operator/ipoperator/types"
)

type CtxAuthKey string
Expand Down Expand Up @@ -215,8 +208,9 @@ func newResourceServerRouter(log log.Logger, providerAddr sdk.Address, publicKey

// lokiServiceHandler forwards all requests to the loki instance running in provider's cluster.
// Example:
// Incoming Request: http://localhost:8445/lease/1/1/1/loki-service/loki/api/v1/query?query={app=".+"}
// Outgoing Request: http://{lokiGwAddr}/loki/api/v1/query?query={app=".+"}
//
// Incoming Request: http://localhost:8445/lease/1/1/1/loki-service/loki/api/v1/query?query={app=".+"}
// Outgoing Request: http://{lokiGwAddr}/loki/api/v1/query?query={app=".+"}
func lokiServiceHandler(log log.Logger, lokiGwAddr string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// set the X-Scope-OrgID header for fetching logs for the right tenant
Expand Down
4 changes: 2 additions & 2 deletions gateway/rest/router_migrate_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"net/http"

manifest "github.com/ovrclk/akash/manifest/v2beta1"
"github.com/tendermint/tendermint/libs/log"

"github.com/ovrclk/provider-services/pkg/apis/akash.network/v2beta1"
manifest "github.com/ovrclk/akash/manifest/v2beta1"

"github.com/ovrclk/provider-services/cluster"
clusterutil "github.com/ovrclk/provider-services/cluster/util"
"github.com/ovrclk/provider-services/pkg/apis/akash.network/v2beta1"
)

type endpointMigrateRequestBody struct {
Expand Down
4 changes: 2 additions & 2 deletions gateway/rest/router_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"testing"
"time"

crd "github.com/ovrclk/provider-services/pkg/apis/akash.network/v2beta1"

"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

"github.com/ovrclk/akash/testutil"
mtypes "github.com/ovrclk/akash/x/market/types/v1beta2"

crd "github.com/ovrclk/provider-services/pkg/apis/akash.network/v2beta1"
)

func TestRouteMigrateHostnameDoesNotExist(t *testing.T) {
Expand Down
8 changes: 5 additions & 3 deletions gateway/rest/router_shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"bytes"
"context"
"encoding/binary"
"github.com/gorilla/websocket"
"github.com/tendermint/tendermint/libs/log"
"io"
"k8s.io/client-go/tools/remotecommand"
"sync"
"time"

"github.com/gorilla/websocket"
"k8s.io/client-go/tools/remotecommand"

"github.com/tendermint/tendermint/libs/log"
)

func leaseShellPingHandler(ctx context.Context, wg *sync.WaitGroup, ws *websocket.Conn) {
Expand Down
20 changes: 9 additions & 11 deletions gateway/rest/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,33 @@ import (
"testing"
"time"

mtypes "github.com/ovrclk/akash/x/market/types/v1beta2"

"github.com/ovrclk/provider-services/pkg/apis/akash.network/v2beta1"

kubeclienterrors "github.com/ovrclk/provider-services/cluster/kube/errors"
"github.com/ovrclk/provider-services/cluster/operatorclients"
ctypes "github.com/ovrclk/provider-services/cluster/types/v1beta2"
"github.com/ovrclk/provider-services/gateway/utils"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/pkg/errors"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubeVersion "k8s.io/apimachinery/pkg/version"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"

qmock "github.com/ovrclk/akash/client/mocks"
"github.com/ovrclk/akash/sdl"
"github.com/ovrclk/akash/testutil"
manifestValidation "github.com/ovrclk/akash/validation"
dtypes "github.com/ovrclk/akash/x/deployment/types/v1beta2"
mtypes "github.com/ovrclk/akash/x/market/types/v1beta2"
types "github.com/ovrclk/akash/x/market/types/v1beta2"

"github.com/ovrclk/provider-services"
kubeclienterrors "github.com/ovrclk/provider-services/cluster/kube/errors"
pcmock "github.com/ovrclk/provider-services/cluster/mocks"
"github.com/ovrclk/provider-services/cluster/operatorclients"
clustertypes "github.com/ovrclk/provider-services/cluster/types/v1beta2"
ctypes "github.com/ovrclk/provider-services/cluster/types/v1beta2"
"github.com/ovrclk/provider-services/gateway/utils"
pmmock "github.com/ovrclk/provider-services/manifest/mocks"
pmock "github.com/ovrclk/provider-services/mocks"
"github.com/ovrclk/provider-services/pkg/apis/akash.network/v2beta1"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions gateway/rest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import (
"net/http"
"time"

"github.com/ovrclk/provider-services/cluster/operatorclients"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/libs/log"

ctypes "github.com/ovrclk/akash/x/cert/types/v1beta2"

"github.com/ovrclk/provider-services"
"github.com/ovrclk/provider-services/cluster/operatorclients"
gwutils "github.com/ovrclk/provider-services/gateway/utils"
)

Expand Down

0 comments on commit c2d889e

Please sign in to comment.