Skip to content

Commit

Permalink
fix: add 2.0.0 major version of AKO
Browse files Browse the repository at this point in the history
  • Loading branch information
s-urbaniak committed Nov 24, 2023
1 parent c3f4ff6 commit 92e52c2
Show file tree
Hide file tree
Showing 24 changed files with 1,244 additions and 959 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ INTEGRATION_TAGS?=integration
E2E_TAGS?=e2e
E2E_TIMEOUT?=60m
E2E_PARALLEL?=1
E2E_EXTRA_ARGS?=

export PATH := $(shell go env GOPATH)/bin:$(PATH)
export PATH := ./bin:$(PATH)
Expand Down Expand Up @@ -155,7 +156,7 @@ build-atlascli-debug: ## Generate a binary in ./bin for debugging atlascli
e2e-test: build-all ## Run E2E tests
@echo "==> Running E2E tests..."
# the target assumes the MCLI_* environment variables are exported
$(TEST_CMD) -v -p 1 -parallel $(E2E_PARALLEL) -timeout $(E2E_TIMEOUT) -tags="$(E2E_TAGS)" ./test/e2e...
$(TEST_CMD) -v -p 1 -parallel $(E2E_PARALLEL) -timeout $(E2E_TIMEOUT) -tags="$(E2E_TAGS)" ./test/e2e... $(E2E_EXTRA_ARGS)

.PHONY: integration-test
integration-test: ## Run integration tests
Expand Down
2 changes: 1 addition & 1 deletion build/ci/library_owners.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"golang.org/x/mod": "mongocli",
"gopkg.in/yaml.v3": "mongocli",
"github.com/jba/templatecheck": "mongocli",
"github.com/mongodb/mongodb-atlas-kubernetes": "atlas_kubernetes_team",
"github.com/mongodb/mongodb-atlas-kubernetes/v2": "atlas_kubernetes_team",
"k8s.io/api": "atlas_kubernetes_team",
"k8s.io/apimachinery": "atlas_kubernetes_team",
"k8s.io/client-go": "atlas_kubernetes_team",
Expand Down
2 changes: 1 addition & 1 deletion docs/atlascli/command/atlas-kubernetes-config-generate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Options
* - --operatorVersion
- string
- false
- Version of Atlas Kubernetes Operator to generate resources for. This value defaults to "1.9.0".
- Version of Atlas Kubernetes Operator to generate resources for. This value defaults to "2.0.0".
* - --orgId
- string
- false
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/mongodb-forks/digest v1.0.5
github.com/mongodb-labs/cobra2snooty v0.17.0
github.com/mongodb/mongodb-atlas-kubernetes v1.9.0
github.com/mongodb/mongodb-atlas-kubernetes/v2 v2.0.0
github.com/pelletier/go-toml v1.9.5
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/shirou/gopsutil/v3 v3.23.10
Expand All @@ -58,14 +58,15 @@ require (
k8s.io/api v0.26.4
k8s.io/apiextensions-apiserver v0.26.1
k8s.io/apimachinery v0.26.4
k8s.io/apiserver v0.26.1
k8s.io/client-go v0.26.4
sigs.k8s.io/controller-runtime v0.14.6
sigs.k8s.io/kind v0.20.0
sigs.k8s.io/yaml v1.3.0
)

require (
cloud.google.com/go/compute v1.23.1 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.3 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect
Expand Down Expand Up @@ -106,7 +107,7 @@ require (
github.com/fatih/color v1.15.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gemalto/flume v0.13.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/compute v1.23.1 h1:V97tBoDaZHb6leicZ1G6DLK2BAaZLJ/7+9BB/En3hR0=
cloud.google.com/go/compute v1.23.1/go.mod h1:CqB3xpmPKKt3OJpW2ndFIXnA9A4xAy/F3Xp1ixncW78=
cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk=
cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI=
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
Expand Down Expand Up @@ -198,8 +198,6 @@ github.com/evergreen-ci/shrub v0.0.0-20230905131908-6b01f04bb1d2 h1:46brusTyZ3O0
github.com/evergreen-ci/shrub v0.0.0-20230905131908-6b01f04bb1d2/go.mod h1:r6YQr77CR37LMhBdWcFrxqu5V+UhO+SYloHfd9vO1go=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
Expand All @@ -216,8 +214,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo=
github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
Expand Down Expand Up @@ -424,18 +422,18 @@ github.com/mongodb-forks/digest v1.0.5 h1:EJu3wtLZcA0HCvsZpX5yuD193/sW9tHiNvrEM5
github.com/mongodb-forks/digest v1.0.5/go.mod h1:rb+EX8zotClD5Dj4NdgxnJXG9nwrlx3NWKJ8xttz1Dg=
github.com/mongodb-labs/cobra2snooty v0.17.0 h1:Os4RpsIHViw2fT6Wk5d5cG/rItRS0c8Za8sKKhw3oc8=
github.com/mongodb-labs/cobra2snooty v0.17.0/go.mod h1:TgFBJczSy1fdW6HY5ZGQfC9EOlhrD1ZJ9hWRldG5gTI=
github.com/mongodb/mongodb-atlas-kubernetes v1.9.0 h1:G0W00WwOMf00slHjQG5I6JhQPzN2zAjee1rQJxA9t+w=
github.com/mongodb/mongodb-atlas-kubernetes v1.9.0/go.mod h1:S7JpgyRq6Asp/PBNFWppwUTwao7EIFgFau3ltpt3rpA=
github.com/mongodb/mongodb-atlas-kubernetes/v2 v2.0.0 h1:G44tdN++ZoAi6gTMQLPjpu56Ay0AV9BuRSOSwrNTO8s=
github.com/mongodb/mongodb-atlas-kubernetes/v2 v2.0.0/go.mod h1:Ruj7U3GZaJuqQN64BgENOix5GW0PXuuzWV0zM87uKdo=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/montanaflynn/stats v0.7.0 h1:r3y12KyNxj/Sb/iOE46ws+3mS1+MZca1wlHQFPsY/JU=
github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo/v2 v2.12.1 h1:uHNEO1RP2SpuZApSkel9nEh1/Mu+hmQe7Q+Pepg5OYA=
github.com/onsi/ginkgo/v2 v2.12.1/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8=
github.com/onsi/ginkgo/v2 v2.13.1 h1:LNGfMbR2OVGBfXjvRZIZ2YCTQdGKtPLvuI1rMCCj3OU=
github.com/onsi/ginkgo/v2 v2.13.1/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI=
Expand Down Expand Up @@ -983,6 +981,8 @@ k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66b
k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM=
k8s.io/apimachinery v0.26.4 h1:rZccKdBLg9vP6J09JD+z8Yr99Ce8gk3Lbi9TCx05Jzs=
k8s.io/apimachinery v0.26.4/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I=
k8s.io/apiserver v0.26.1 h1:6vmnAqCDO194SVCPU3MU8NcDgSqsUA62tBUSWrFXhsc=
k8s.io/apiserver v0.26.1/go.mod h1:wr75z634Cv+sifswE9HlAo5FQ7UoUauIICRlOE+5dCg=
k8s.io/client-go v0.26.4 h1:/7P/IbGBuT73A+G97trf44NTPSNqvuBREpOfdLbHvD4=
k8s.io/client-go v0.26.4/go.mod h1:6qOItWm3EwxJdl/8p5t7FWtWUOwyMdA8N9ekbW4idpI=
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
Expand Down
4 changes: 2 additions & 2 deletions internal/kubernetes/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"

"github.com/mongodb/mongodb-atlas-cli/internal/log"
akov1 "github.com/mongodb/mongodb-atlas-kubernetes/pkg/api/v1"
akov2 "github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/api/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -126,7 +126,7 @@ func (ctl *KubeCtl) setupClient(witContext string) error {
return fmt.Errorf("unable to prepare client configuration: %w", err)
}

err = akov1.AddToScheme(scheme.Scheme)
err = akov2.AddToScheme(scheme.Scheme)
if err != nil {
return err
}
Expand Down
14 changes: 7 additions & 7 deletions internal/kubernetes/operator/config_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/mongodb/mongodb-atlas-cli/internal/kubernetes"
"github.com/mongodb/mongodb-atlas-cli/internal/kubernetes/operator/features"
akov1 "github.com/mongodb/mongodb-atlas-kubernetes/pkg/api/v1"
akov2 "github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/api/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -110,29 +110,29 @@ func sortResources(projectResources, deploymentResources []runtime.Object, versi
sortedResources[0] = append(sortedResources[0], resource)
}

if _, ok := resource.(*akov1.AtlasTeam); ok {
if _, ok := resource.(*akov2.AtlasTeam); ok {
sortedResources[1] = append(sortedResources[1], resource)
}

if _, ok := resource.(*akov1.AtlasProject); ok {
if _, ok := resource.(*akov2.AtlasProject); ok {
sortedResources[2] = append(sortedResources[2], resource)
}

if _, ok := resource.(*akov1.AtlasDatabaseUser); ok {
if _, ok := resource.(*akov2.AtlasDatabaseUser); ok {
sortedResources[3] = append(sortedResources[3], resource)
}
}

for _, resource := range deploymentResources {
if _, ok := resource.(*akov1.AtlasBackupPolicy); ok {
if _, ok := resource.(*akov2.AtlasBackupPolicy); ok {
sortedResources[4] = append(sortedResources[4], resource)
}

if _, ok := resource.(*akov1.AtlasBackupSchedule); ok {
if _, ok := resource.(*akov2.AtlasBackupSchedule); ok {
sortedResources[5] = append(sortedResources[5], resource)
}

if _, ok := resource.(*akov1.AtlasDeployment); ok {
if _, ok := resource.(*akov2.AtlasDeployment); ok {
sortedResources[6] = append(sortedResources[6], resource)
}
}
Expand Down
82 changes: 41 additions & 41 deletions internal/kubernetes/operator/datafederation/datafederation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"github.com/mongodb/mongodb-atlas-cli/internal/kubernetes/operator/features"
"github.com/mongodb/mongodb-atlas-cli/internal/kubernetes/operator/resources"
"github.com/mongodb/mongodb-atlas-cli/internal/store/atlas"
atlasV1 "github.com/mongodb/mongodb-atlas-kubernetes/pkg/api/v1"
"github.com/mongodb/mongodb-atlas-kubernetes/pkg/api/v1/common"
"github.com/mongodb/mongodb-atlas-kubernetes/pkg/api/v1/status"
akov2 "github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/api/v1"
akov2common "github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/api/v1/common"
akov2status "github.com/mongodb/mongodb-atlas-kubernetes/v2/pkg/api/v1/status"
"go.mongodb.org/atlas-sdk/v20231115002/admin"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -32,15 +32,15 @@ const (
DeletedState = "DELETED"
)

func BuildAtlasDataFederation(dataFederationStore atlas.DataFederationStore, dataFederationName, projectID, projectName, operatorVersion, targetNamespace string, dictionary map[string]string) (*atlasV1.AtlasDataFederation, error) {
func BuildAtlasDataFederation(dataFederationStore atlas.DataFederationStore, dataFederationName, projectID, projectName, operatorVersion, targetNamespace string, dictionary map[string]string) (*akov2.AtlasDataFederation, error) {
dataFederation, err := dataFederationStore.DataFederation(projectID, dataFederationName)
if err != nil {
return nil, err
}
if !isDataFederationExportable(dataFederation) {
return nil, nil
}
atlasDataFederation := &atlasV1.AtlasDataFederation{
atlasDataFederation := &akov2.AtlasDataFederation{
TypeMeta: v1.TypeMeta{
APIVersion: "atlas.mongodb.com/v1",
Kind: "AtlasDataFederation",
Expand All @@ -53,9 +53,9 @@ func BuildAtlasDataFederation(dataFederationStore atlas.DataFederationStore, dat
},
},
Spec: getDataFederationSpec(dataFederation, targetNamespace, projectName),
Status: status.DataFederationStatus{
Common: status.Common{
Conditions: []status.Condition{},
Status: akov2status.DataFederationStatus{
Common: akov2status.Common{
Conditions: []akov2status.Condition{},
},
},
}
Expand All @@ -67,56 +67,56 @@ func isDataFederationExportable(dataFederation *admin.DataLakeTenant) bool {
return state != DeletingState && state != DeletedState
}

func getDataFederationSpec(dataFederationSpec *admin.DataLakeTenant, targetNamespace, projectName string) atlasV1.DataFederationSpec {
return atlasV1.DataFederationSpec{
Project: common.ResourceRefNamespaced{Name: projectName, Namespace: targetNamespace},
func getDataFederationSpec(dataFederationSpec *admin.DataLakeTenant, targetNamespace, projectName string) akov2.DataFederationSpec {
return akov2.DataFederationSpec{
Project: akov2common.ResourceRefNamespaced{Name: projectName, Namespace: targetNamespace},
Name: dataFederationSpec.GetName(),
CloudProviderConfig: getCloudProviderConfig(dataFederationSpec.CloudProviderConfig),
DataProcessRegion: getDataProcessRegion(dataFederationSpec.DataProcessRegion),
Storage: getStorage(dataFederationSpec.Storage),
}
}

func getCloudProviderConfig(cloudProviderConfig *admin.DataLakeCloudProviderConfig) *atlasV1.CloudProviderConfig {
func getCloudProviderConfig(cloudProviderConfig *admin.DataLakeCloudProviderConfig) *akov2.CloudProviderConfig {
if cloudProviderConfig == nil {
return &atlasV1.CloudProviderConfig{}
return &akov2.CloudProviderConfig{}
}
return &atlasV1.CloudProviderConfig{
AWS: &atlasV1.AWSProviderConfig{
return &akov2.CloudProviderConfig{
AWS: &akov2.AWSProviderConfig{
RoleID: cloudProviderConfig.Aws.RoleId,
TestS3Bucket: cloudProviderConfig.Aws.TestS3Bucket,
},
}
}

func getDataProcessRegion(dataProcessRegion *admin.DataLakeDataProcessRegion) *atlasV1.DataProcessRegion {
func getDataProcessRegion(dataProcessRegion *admin.DataLakeDataProcessRegion) *akov2.DataProcessRegion {
if dataProcessRegion == nil {
return &atlasV1.DataProcessRegion{}
return &akov2.DataProcessRegion{}
}
return &atlasV1.DataProcessRegion{
return &akov2.DataProcessRegion{
CloudProvider: dataProcessRegion.CloudProvider,
Region: dataProcessRegion.Region,
}
}

func getStorage(storage *admin.DataLakeStorage) *atlasV1.Storage {
func getStorage(storage *admin.DataLakeStorage) *akov2.Storage {
if storage == nil {
return &atlasV1.Storage{}
return &akov2.Storage{}
}
return &atlasV1.Storage{
return &akov2.Storage{
Databases: getDatabases(storage.Databases),
Stores: getStores(storage.Stores),
}
}

func getDatabases(database []admin.DataLakeDatabaseInstance) []atlasV1.Database {
func getDatabases(database []admin.DataLakeDatabaseInstance) []akov2.Database {
if database == nil {
return []atlasV1.Database{}
return []akov2.Database{}
}
result := make([]atlasV1.Database, 0, len(database))
result := make([]akov2.Database, 0, len(database))

for _, obj := range database {
result = append(result, atlasV1.Database{
result = append(result, akov2.Database{
Collections: getCollection(obj.GetCollections()),
MaxWildcardCollections: obj.GetMaxWildcardCollections(),
Name: obj.GetName(),
Expand All @@ -126,29 +126,29 @@ func getDatabases(database []admin.DataLakeDatabaseInstance) []atlasV1.Database
return result
}

func getCollection(collections []admin.DataLakeDatabaseCollection) []atlasV1.Collection {
func getCollection(collections []admin.DataLakeDatabaseCollection) []akov2.Collection {
if collections == nil {
return []atlasV1.Collection{}
return []akov2.Collection{}
}
result := make([]atlasV1.Collection, 0, len(collections))
result := make([]akov2.Collection, 0, len(collections))

for _, obj := range collections {
result = append(result, atlasV1.Collection{
result = append(result, akov2.Collection{
DataSources: getDataSources(obj.GetDataSources()),
Name: obj.GetName(),
})
}
return result
}

func getDataSources(dataSources []admin.DataLakeDatabaseDataSourceSettings) []atlasV1.DataSource {
func getDataSources(dataSources []admin.DataLakeDatabaseDataSourceSettings) []akov2.DataSource {
if dataSources == nil {
return []atlasV1.DataSource{}
return []akov2.DataSource{}
}
result := make([]atlasV1.DataSource, 0, len(dataSources))
result := make([]akov2.DataSource, 0, len(dataSources))

for _, obj := range dataSources {
result = append(result, atlasV1.DataSource{
result = append(result, akov2.DataSource{
AllowInsecure: obj.GetAllowInsecure(),
Collection: obj.GetCollection(),
CollectionRegex: obj.GetCollectionRegex(),
Expand All @@ -164,14 +164,14 @@ func getDataSources(dataSources []admin.DataLakeDatabaseDataSourceSettings) []at
return result
}

func getViews(views []admin.DataLakeApiBase) []atlasV1.View {
func getViews(views []admin.DataLakeApiBase) []akov2.View {
if views == nil {
return []atlasV1.View{}
return []akov2.View{}
}
result := make([]atlasV1.View, 0, len(views))
result := make([]akov2.View, 0, len(views))

for _, obj := range views {
result = append(result, atlasV1.View{
result = append(result, akov2.View{
Name: obj.GetName(),
Pipeline: obj.GetPipeline(),
Source: obj.GetSource(),
Expand All @@ -180,14 +180,14 @@ func getViews(views []admin.DataLakeApiBase) []atlasV1.View {
return result
}

func getStores(stores []admin.DataLakeStoreSettings) []atlasV1.Store {
func getStores(stores []admin.DataLakeStoreSettings) []akov2.Store {
if stores == nil {
return []atlasV1.Store{}
return []akov2.Store{}
}
result := make([]atlasV1.Store, 0, len(stores))
result := make([]akov2.Store, 0, len(stores))

for _, obj := range stores {
result = append(result, atlasV1.Store{
result = append(result, akov2.Store{
Name: obj.GetName(),
Provider: obj.Provider,
AdditionalStorageClasses: obj.GetAdditionalStorageClasses(),
Expand Down
Loading

0 comments on commit 92e52c2

Please sign in to comment.