Skip to content

Commit

Permalink
Migrate to core modules (#4908)
Browse files Browse the repository at this point in the history
* Migrate to sensu/core modules

Signed-off-by: Christian Kruse <ctkruse99@gmail.com>

* Replace usage of sensu-go/api/core with core modules

Signed-off-by: Christian Kruse <ctkruse99@gmail.com>

* Migrate type resolution logic to sensu-api-tools

Signed-off-by: Christian Kruse <ctkruse99@gmail.com>

Signed-off-by: Christian Kruse <ctkruse99@gmail.com>
  • Loading branch information
c-kruse committed Nov 10, 2022
1 parent d16d49e commit 76c7a16
Show file tree
Hide file tree
Showing 482 changed files with 607 additions and 614 deletions.
4 changes: 2 additions & 2 deletions agent/agent.go
Expand Up @@ -27,8 +27,8 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"
"golang.org/x/time/rate"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
"github.com/sensu/sensu-go/asset"
"github.com/sensu/sensu-go/command"
"github.com/sensu/sensu-go/handler"
Expand Down
2 changes: 1 addition & 1 deletion agent/agent_test.go
Expand Up @@ -14,7 +14,7 @@ import (
"testing"
"time"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
sensutesting "github.com/sensu/sensu-go/testing"
"github.com/sensu/sensu-go/transport"
"github.com/sensu/sensu-go/types"
Expand Down
2 changes: 1 addition & 1 deletion agent/check_handler.go
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/google/uuid"
"github.com/sensu/sensu-go/agent/transformers"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/asset"
"github.com/sensu/sensu-go/command"
"github.com/sensu/sensu-go/token"
Expand Down
2 changes: 1 addition & 1 deletion agent/check_handler_internal_test.go
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/command"
"github.com/sensu/sensu-go/testing/mockexecutor"
"github.com/sensu/sensu-go/token"
Expand Down
2 changes: 1 addition & 1 deletion agent/cmd/start.go
Expand Up @@ -10,7 +10,7 @@ import (
"time"

"github.com/sensu/sensu-go/agent"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/asset"
"github.com/sensu/sensu-go/util/path"
"github.com/sensu/sensu-go/util/url"
Expand Down
2 changes: 1 addition & 1 deletion agent/cmd/start_test.go
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"github.com/sensu/sensu-go/agent"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion agent/config.go
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"time"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/asset"
"golang.org/x/time/rate"
)
Expand Down
4 changes: 2 additions & 2 deletions agent/entity.go
Expand Up @@ -3,8 +3,8 @@ package agent
import (
time "github.com/echlebek/timeproxy"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
"github.com/sensu/sensu-go/version"
)

Expand Down
2 changes: 1 addition & 1 deletion agent/entity_config_handler.go
Expand Up @@ -4,7 +4,7 @@ import (
"context"

time "github.com/echlebek/timeproxy"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev3 "github.com/sensu/core/v3"
)

func (a *Agent) handleEntityConfig(ctx context.Context, payload []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion agent/entity_config_handler_test.go
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/gogo/protobuf/proto"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev3 "github.com/sensu/core/v3"
)

func TestHandleEntityConfig(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions agent/entity_test.go
Expand Up @@ -3,8 +3,8 @@ package agent
import (
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion agent/event.go
Expand Up @@ -6,7 +6,7 @@ import (
time "github.com/echlebek/timeproxy"
"github.com/google/uuid"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
corev1 "github.com/sensu/sensu-go/types/v1"
)

Expand Down
4 changes: 2 additions & 2 deletions agent/event_test.go
Expand Up @@ -7,8 +7,8 @@ import (

time "github.com/echlebek/timeproxy"
"github.com/google/uuid"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
corev1 "github.com/sensu/sensu-go/types/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion agent/hook.go
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"time"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/asset"
"github.com/sensu/sensu-go/command"
"github.com/sensu/sensu-go/token"
Expand Down
2 changes: 1 addition & 1 deletion agent/hook_test.go
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

time "github.com/echlebek/timeproxy"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/command"
"github.com/sensu/sensu-go/testing/mockexecutor"

Expand Down
2 changes: 1 addition & 1 deletion agent/queue_test.go
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
)

func TestCompressionRoundTrip(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion asset/asset.go
Expand Up @@ -19,7 +19,7 @@ import (
"path/filepath"
"strings"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/util/environment"
)

Expand Down
2 changes: 1 addition & 1 deletion asset/boltdb_manager.go
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/dustin/go-humanize"
"github.com/prometheus/client_golang/prometheus"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
metricspkg "github.com/sensu/sensu-go/metrics"
bolt "go.etcd.io/bbolt"
"golang.org/x/time/rate"
Expand Down
2 changes: 1 addition & 1 deletion asset/filtered_manager.go
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/js"
"github.com/sensu/sensu-go/token"
"github.com/sensu/sensu-go/types/dynamic"
Expand Down
2 changes: 1 addition & 1 deletion asset/filtered_manager_test.go
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/types"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion asset/set_test.go
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/types"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/agentd/agentd.go
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/gorilla/websocket"
"github.com/prometheus/client_golang/prometheus"
"github.com/sensu/sensu-go/agent"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/apid/actions"
"github.com/sensu/sensu-go/backend/apid/middlewares"
"github.com/sensu/sensu-go/backend/apid/routers"
Expand Down
4 changes: 2 additions & 2 deletions backend/agentd/agentd_test.go
Expand Up @@ -11,8 +11,8 @@ import (
"net/http/httptest"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
"github.com/sensu/sensu-go/backend/apid/middlewares"
"github.com/sensu/sensu-go/backend/etcd"
"github.com/sensu/sensu-go/backend/store"
Expand Down
2 changes: 1 addition & 1 deletion backend/agentd/middlewares.go
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"

"github.com/gorilla/mux"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
)

// AuthenticationMiddleware represents the middleware used for authentication
Expand Down
4 changes: 2 additions & 2 deletions backend/agentd/session.go
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
"github.com/sensu/sensu-go/agent"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
"github.com/sensu/sensu-go/backend/messaging"
"github.com/sensu/sensu-go/backend/metrics"
"github.com/sensu/sensu-go/backend/ringv2"
Expand Down
4 changes: 2 additions & 2 deletions backend/agentd/session_test.go
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/gogo/protobuf/proto"
"github.com/sensu/sensu-go/agent"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
"github.com/sensu/sensu-go/backend/messaging"
"github.com/sensu/sensu-go/backend/store"
storev2 "github.com/sensu/sensu-go/backend/store/v2"
Expand Down
4 changes: 2 additions & 2 deletions backend/agentd/watcher.go
Expand Up @@ -5,8 +5,8 @@ import (
"errors"

"github.com/gogo/protobuf/proto"
corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
"github.com/sensu/sensu-go/backend/store"
etcdstore "github.com/sensu/sensu-go/backend/store/etcd"
storev2 "github.com/sensu/sensu-go/backend/store/v2"
Expand Down
2 changes: 1 addition & 1 deletion backend/api/asset.go
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/store"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
)

// AssetClient is an API client for assets.
Expand Down
2 changes: 1 addition & 1 deletion backend/api/asset_test.go
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/authorization/rbac"
"github.com/sensu/sensu-go/backend/store"
Expand Down
2 changes: 1 addition & 1 deletion backend/api/authentication.go
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"fmt"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authentication"
"github.com/sensu/sensu-go/backend/authentication/jwt"
"github.com/sensu/sensu-go/backend/authentication/providers/basic"
Expand Down
2 changes: 1 addition & 1 deletion backend/api/authentication_test.go
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authentication"
"github.com/sensu/sensu-go/backend/authentication/jwt"
"github.com/sensu/sensu-go/backend/authentication/providers/basic"
Expand Down
2 changes: 1 addition & 1 deletion backend/api/check.go
Expand Up @@ -3,7 +3,7 @@ package api
import (
"context"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/store"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/api/check_test.go
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/authorization/rbac"
"github.com/sensu/sensu-go/backend/store"
Expand Down
4 changes: 2 additions & 2 deletions backend/api/entity.go
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/sirupsen/logrus"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/store"
storev2 "github.com/sensu/sensu-go/backend/store/v2"
Expand Down
2 changes: 1 addition & 1 deletion backend/api/entity_test.go
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/stretchr/testify/mock"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/authorization/rbac"
"github.com/sensu/sensu-go/backend/store"
Expand Down
2 changes: 1 addition & 1 deletion backend/api/event.go
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authentication/jwt"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/messaging"
Expand Down
2 changes: 1 addition & 1 deletion backend/api/event_test.go
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/authorization/rbac"
"github.com/sensu/sensu-go/backend/messaging"
Expand Down
2 changes: 1 addition & 1 deletion backend/api/filter.go
Expand Up @@ -3,7 +3,7 @@ package api
import (
"context"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/store"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/api/filter_test.go
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev2 "github.com/sensu/core/v2"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/authorization/rbac"
"github.com/sensu/sensu-go/backend/store"
Expand Down
8 changes: 4 additions & 4 deletions backend/api/generic.go
Expand Up @@ -6,12 +6,12 @@ import (
"fmt"
"path"

corev2 "github.com/sensu/sensu-go/api/core/v2"
corev3 "github.com/sensu/sensu-go/api/core/v3"
corev2 "github.com/sensu/core/v2"
corev3 "github.com/sensu/core/v3"
apitools "github.com/sensu/sensu-api-tools"
"github.com/sensu/sensu-go/backend/authorization"
"github.com/sensu/sensu-go/backend/store"
storev2 "github.com/sensu/sensu-go/backend/store/v2"
"github.com/sensu/sensu-go/types"
)

type RBACVerb string
Expand Down Expand Up @@ -89,7 +89,7 @@ func (g *GenericClient) SetTypeMeta(meta corev2.TypeMeta) error {
}
g.APIGroup = path.Dir(meta.APIVersion)
g.APIVersion = path.Base(meta.APIVersion)
kind, err := types.ResolveRaw(meta.APIVersion, meta.Type)
kind, err := apitools.Resolve(meta.APIVersion, meta.Type)
if err != nil {
return fmt.Errorf("error (SetTypeMeta): %s", err)
}
Expand Down

0 comments on commit 76c7a16

Please sign in to comment.