Skip to content

Commit

Permalink
Remove codebase related to MCA, App & catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitsakala committed Nov 26, 2024
1 parent e9c7b70 commit 33af4dc
Show file tree
Hide file tree
Showing 32 changed files with 0 additions and 4,184 deletions.
37 changes: 0 additions & 37 deletions docs/data-sources/app.md

This file was deleted.

36 changes: 0 additions & 36 deletions docs/data-sources/catalog.md

This file was deleted.

36 changes: 0 additions & 36 deletions docs/data-sources/multi_cluster_app.md

This file was deleted.

28 changes: 0 additions & 28 deletions rancher2/0_provider_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ resource "rancher2_namespace" "testacc" {
testAccCheckRancher2UpgradeVersion = []string{"v2.3.6", "v2.4.13", "v2.5.9", "v2.6.2"}
testAccCheckRancher2RunningVersionIndex = 0
testAccCheckRancher2UpgradeCluster = os.Getenv("RANCHER_ACC_CLUSTER_NAME")
testAccCheckRancher2UpgradeCatalogV24 = testAccRancher2CatalogGlobal + testAccRancher2CatalogCluster + testAccRancher2CatalogProject
testAccCheckRancher2UpgradeCertificateV24 = testAccRancher2Certificate + testAccRancher2CertificateNs
testAccCheckRancher2BootstrapV23 = `
provider "rancher2" {
Expand Down Expand Up @@ -99,7 +98,6 @@ provider "rancher2" {
`

testAccCheckRancher2UpgradeConfigV23 = testAccCheckRancher2BootstrapV23 + `
` + testAccRancher2App + `
` + testAccCheckRancher2UpgradeCatalogV24 + `
` + testAccCheckRancher2UpgradeCertificateV24 + `
` + testAccRancher2CloudCredentialConfigAmazonec2 + `
Expand All @@ -114,7 +112,6 @@ provider "rancher2" {
` + testAccRancher2ClusterTemplateConfig + `
` + testAccRancher2EtcdBackup + `
` + testAccRancher2GlobalRoleBinding + `
` + testAccRancher2MultiClusterApp + `
` + testAccRancher2Namespace + `
` + testAccRancher2NodeDriver + `
` + testAccRancher2NodePool + `
Expand All @@ -136,7 +133,6 @@ provider "rancher2" {
`

testAccCheckRancher2UpgradeConfigV24 = testAccCheckRancher2BootstrapV23 + `
` + testAccRancher2App + `
` + testAccCheckRancher2UpgradeCatalogV24 + `
` + testAccCheckRancher2UpgradeCertificateV24 + `
` + testAccRancher2CloudCredentialConfigAmazonec2 + `
Expand All @@ -151,7 +147,6 @@ provider "rancher2" {
` + testAccRancher2ClusterTemplateConfig + `
` + testAccRancher2EtcdBackup + `
` + testAccRancher2GlobalRoleBinding + `
` + testAccRancher2MultiClusterApp + `
` + testAccRancher2Namespace + `
` + testAccRancher2NodeDriver + `
` + testAccRancher2NodePool + `
Expand All @@ -173,7 +168,6 @@ provider "rancher2" {
`

testAccCheckRancher2UpgradeConfigV25 = testAccCheckRancher2Bootstrap + `
` + testAccRancher2App + `
` + testAccRancher2AppV2 + `
` + testAccCheckRancher2UpgradeCatalogV24 + `
` + testAccRancher2CatalogV2 + `
Expand All @@ -192,7 +186,6 @@ provider "rancher2" {
` + testAccRancher2EtcdBackup + `
` + testAccRancher2FeatureConfig + `
` + testAccRancher2GlobalRoleBinding + `
` + testAccRancher2MultiClusterApp + `
` + testAccRancher2Namespace + `
` + testAccRancher2NodeDriver + `
` + testAccRancher2NodePool + `
Expand All @@ -216,7 +209,6 @@ provider "rancher2" {
`

testAccCheckRancher2UpgradeConfigV26 = testAccCheckRancher2Bootstrap + `
` + testAccRancher2App + `
` + testAccRancher2AppV2 + `
` + testAccCheckRancher2UpgradeCatalogV24 + `
` + testAccRancher2CatalogV2 + `
Expand All @@ -237,7 +229,6 @@ provider "rancher2" {
` + testAccRancher2EtcdBackup + `
` + testAccRancher2FeatureConfig + `
` + testAccRancher2GlobalRoleBinding + `
` + testAccRancher2MultiClusterApp + `
` + testAccRancher2Namespace + `
` + testAccRancher2NodeDriver + `
` + testAccRancher2NodePool + `
Expand Down Expand Up @@ -283,10 +274,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "name", "foo-global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "description", "Terraform catalog acceptance test"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "url", "http://foo.com:8080"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "scope", "global"),
resource.TestCheckResourceAttr("rancher2_cluster.foo", "name", "foo"),
testAccRancher2UpgradeRancher(),
),
Expand All @@ -298,11 +285,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "name", "foo-global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "description", "Terraform catalog acceptance test"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "url", "http://foo.com:8080"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "scope", "global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "version", "helm_v3"),
resource.TestCheckResourceAttr("rancher2_cluster.foo", "name", "foo"),
testAccRancher2UpgradeRancher(),
),
Expand All @@ -314,11 +296,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "name", "foo-global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "description", "Terraform catalog acceptance test"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "url", "http://foo.com:8080"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "scope", "global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "version", "helm_v3"),
resource.TestCheckResourceAttr("rancher2_cluster.foo", "name", "foo"),
testAccRancher2UpgradeRancher(),
),
Expand All @@ -330,11 +307,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "name", "foo-global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "description", "Terraform catalog acceptance test"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "url", "http://foo.com:8080"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "scope", "global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "version", "helm_v3"),
resource.TestCheckResourceAttr("rancher2_cluster.foo", "name", "foo"),
),
},
Expand Down
135 changes: 0 additions & 135 deletions rancher2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1281,141 +1281,6 @@ func (c *Config) GetSettingValue(name string) (string, error) {
return setting.Value, nil
}

func (c *Config) GetCatalogByName(name, scope string) (interface{}, error) {
if len(name) == 0 || len(scope) == 0 {
return nil, fmt.Errorf("[ERROR] Name nor scope can't be nil")
}

client, err := c.ManagementClient()
if err != nil {
return nil, err
}

filters := map[string]interface{}{"name": name}
listOpts := NewListOpts(filters)

switch scope {
case catalogScopeCluster:
return client.ClusterCatalog.List(listOpts)
case catalogScopeGlobal:
return client.Catalog.List(listOpts)
case catalogScopeProject:
return client.ProjectCatalog.List(listOpts)
default:
return nil, fmt.Errorf("[ERROR] Unsupported scope on catalog: %s", scope)
}
}

func (c *Config) GetCatalog(id, scope string) (interface{}, error) {
if len(id) == 0 || len(scope) == 0 {
return nil, fmt.Errorf("[ERROR] Id nor scope can't be nil")
}

client, err := c.ManagementClient()
if err != nil {
return nil, err
}

switch scope {
case catalogScopeCluster:
return client.ClusterCatalog.ByID(id)
case catalogScopeGlobal:
return client.Catalog.ByID(id)
case catalogScopeProject:
return client.ProjectCatalog.ByID(id)
default:
return nil, fmt.Errorf("[ERROR] Unsupported scope on catalog: %s", scope)
}
}

func (c *Config) CreateCatalog(scope string, catalog interface{}) (interface{}, error) {
if catalog == nil || len(scope) == 0 {
return nil, fmt.Errorf("[ERROR] Catalog nor scope can't be nil")
}

client, err := c.ManagementClient()
if err != nil {
return nil, err
}

switch scope {
case catalogScopeCluster:
return client.ClusterCatalog.Create(catalog.(*managementClient.ClusterCatalog))
case catalogScopeGlobal:
return client.Catalog.Create(catalog.(*managementClient.Catalog))
case catalogScopeProject:
return client.ProjectCatalog.Create(catalog.(*managementClient.ProjectCatalog))
default:
return nil, fmt.Errorf("[ERROR] Unsupported scope on catalog: %s", scope)
}
}

func (c *Config) UpdateCatalog(scope string, catalog interface{}, update map[string]interface{}) (interface{}, error) {
if catalog == nil || len(scope) == 0 {
return nil, fmt.Errorf("[ERROR] Catalog nor scope can't be nil")
}

client, err := c.ManagementClient()
if err != nil {
return nil, err
}

switch scope {
case catalogScopeCluster:
return client.ClusterCatalog.Update(catalog.(*managementClient.ClusterCatalog), update)
case catalogScopeGlobal:
return client.Catalog.Update(catalog.(*managementClient.Catalog), update)
case catalogScopeProject:
return client.ProjectCatalog.Update(catalog.(*managementClient.ProjectCatalog), update)
default:
return nil, fmt.Errorf("[ERROR] Unsupported scope on catalog: %s", scope)
}
}

func (c *Config) DeleteCatalog(scope string, catalog interface{}) error {
if catalog == nil || len(scope) == 0 {
return fmt.Errorf("[ERROR] Catalog nor scope can't be nil")
}

client, err := c.ManagementClient()
if err != nil {
return err
}

switch scope {
case catalogScopeCluster:
return client.ClusterCatalog.Delete(catalog.(*managementClient.ClusterCatalog))
case catalogScopeGlobal:
return client.Catalog.Delete(catalog.(*managementClient.Catalog))
case catalogScopeProject:
return client.ProjectCatalog.Delete(catalog.(*managementClient.ProjectCatalog))
default:
return fmt.Errorf("[ERROR] Unsupported scope on catalog: %s", scope)
}
}

func (c *Config) RefreshCatalog(scope string, catalog interface{}) (*managementClient.CatalogRefresh, error) {
if catalog == nil || len(scope) == 0 {
return nil, fmt.Errorf("[ERROR] Catalog nor scope can't be nil")
}

client, err := c.ManagementClient()
if err != nil {
return nil, err
}

switch scope {
case catalogScopeCluster:
return client.ClusterCatalog.ActionRefresh(catalog.(*managementClient.ClusterCatalog))
case catalogScopeGlobal:
return client.Catalog.ActionRefresh(catalog.(*managementClient.Catalog))
case catalogScopeProject:
return client.ProjectCatalog.ActionRefresh(catalog.(*managementClient.ProjectCatalog))
default:
return nil, fmt.Errorf("[ERROR] Unsupported scope on catalog: %s", scope)
}
}

func getAuthConfigObject(kind string) (interface{}, error) {
switch kind {
case managementClient.ActiveDirectoryConfigType:
Expand Down
Loading

0 comments on commit 33af4dc

Please sign in to comment.