Skip to content

Commit

Permalink
fix(CatalogManagement): Bump Go SDK to v0.61.2, remove catalog syndic…
Browse files Browse the repository at this point in the history
…ation (IBM-Cloud#5219)

* fix(CatalogManagement): bump go sdk version to 0.61.2, fix catalog errors

* fix(CatalogManagement): remove catalog syndication from docs
  • Loading branch information
benbuchanan authored and ismirlia committed Apr 11, 2024
1 parent 69b7ebf commit c5a6d17
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 980 deletions.
2 changes: 0 additions & 2 deletions examples/ibm-catalog-management/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ resource "ibm_cm_catalog" "cm_catalog_instance" {
resource_group_id = var.cm_catalog_resource_group_id
owning_account = var.cm_catalog_owning_account
catalog_filters = var.cm_catalog_catalog_filters
syndication_settings = var.cm_catalog_syndication_settings
kind = var.cm_catalog_kind
metadata = var.cm_catalog_metadata
}
Expand Down Expand Up @@ -225,7 +224,6 @@ data "cm_offering_instance" "cm_offering_instance_instance" {
| resource_group_id | Resource group id the catalog is owned by. | `string` | false |
| owning_account | Account that owns catalog. | `string` | false |
| catalog_filters | Filters for account and catalog filters. | `` | false |
| syndication_settings | Feature information. | `` | false |
| kind | Kind of catalog. Supported kinds are offering and vpe. | `string` | false |
| metadata | Catalog specific metadata. | `map()` | false |
| catalog_id | Catalog identifier. | `string` | true |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta
github.com/IBM/keyprotect-go-client v0.12.2
github.com/IBM/networking-go-sdk v0.45.0
github.com/IBM/platform-services-go-sdk v0.60.0
github.com/IBM/platform-services-go-sdk v0.61.2
github.com/IBM/project-go-sdk v0.2.1
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
github.com/IBM/scc-go-sdk/v5 v5.1.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ github.com/IBM/mqcloud-go-sdk v0.0.4 h1:gqMpoU5a0qJ0GETG4PQrkgeEEoaQLvbxRJnEe6yt
github.com/IBM/mqcloud-go-sdk v0.0.4/go.mod h1:gQptHC6D+rxfg0muRFFGvTDmvl4YfiDE0uXkaRRewRk=
github.com/IBM/networking-go-sdk v0.45.0 h1:tYgDhVDpgKvELNY7tcodbZ4ny9fatpEWM6PwtQcDe20=
github.com/IBM/networking-go-sdk v0.45.0/go.mod h1:NnJPA1e5GWr5opJe+5Hs6e1G6RcBIFz64TrkZsdnSp8=
github.com/IBM/platform-services-go-sdk v0.60.0 h1:DXCp5hAtFO6quUmb5qKeosQw0ln/fYE5nrKjgXbiSBU=
github.com/IBM/platform-services-go-sdk v0.60.0/go.mod h1:fcmUb29QKLjMM0UWrR5bAidC7qfKWrf96H0xxmGJHdE=
github.com/IBM/platform-services-go-sdk v0.61.2 h1:yQ7sBmowpxlyKPRZChFBqlGn1nZO7ScPc6QqjUDdbYA=
github.com/IBM/platform-services-go-sdk v0.61.2/go.mod h1:fcmUb29QKLjMM0UWrR5bAidC7qfKWrf96H0xxmGJHdE=
github.com/IBM/project-go-sdk v0.2.1 h1:Xo7ITrfyfVm0eCsaC2SADlhcEjqjx9rtU37fwnzGMCI=
github.com/IBM/project-go-sdk v0.2.1/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig=
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4=
Expand Down
253 changes: 0 additions & 253 deletions ibm/service/catalogmanagement/data_source_ibm_cm_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,155 +220,6 @@ func DataSourceIBMCmCatalog() *schema.Resource {
},
},
},
"syndication_settings": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "Feature information.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"remove_related_components": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Description: "Remove related components.",
},
"clusters": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "Syndication clusters.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"region": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Cluster region.",
},
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Cluster ID.",
},
"name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Cluster name.",
},
"resource_group_name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Resource group ID.",
},
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Syndication type.",
},
"namespaces": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "Syndicated namespaces.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"all_namespaces": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Description: "Syndicated to all namespaces on cluster.",
},
},
},
},
"history": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "Feature information.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"namespaces": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "Array of syndicated namespaces.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"clusters": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "Array of syndicated namespaces.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"region": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Cluster region.",
},
"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Cluster ID.",
},
"name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Cluster name.",
},
"resource_group_name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Resource group ID.",
},
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Syndication type.",
},
"namespaces": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "Syndicated namespaces.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"all_namespaces": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Description: "Syndicated to all namespaces on cluster.",
},
},
},
},
"last_run": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Date and time last syndicated.",
},
},
},
},
"authorization": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "Feature information.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"token": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Array of syndicated namespaces.",
},
"last_run": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Date and time last updated.",
},
},
},
},
},
},
},
"kind": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -563,18 +414,6 @@ func dataSourceIBMCmCatalogRead(context context.Context, d *schema.ResourceData,
return diag.FromErr(fmt.Errorf("Error setting catalog_filters %s", err))
}

syndicationSettings := []map[string]interface{}{}
if catalog.SyndicationSettings != nil {
modelMap, err := dataSourceIBMCmCatalogSyndicationResourceToMap(catalog.SyndicationSettings)
if err != nil {
return diag.FromErr(err)
}
syndicationSettings = append(syndicationSettings, modelMap)
}
if err = d.Set("syndication_settings", syndicationSettings); err != nil {
return diag.FromErr(fmt.Errorf("Error setting syndication_settings %s", err))
}

if err = d.Set("kind", catalog.Kind); err != nil {
return diag.FromErr(fmt.Errorf("Error setting kind: %s", err))
}
Expand Down Expand Up @@ -695,95 +534,3 @@ func dataSourceIBMCmCatalogIDFilterToMap(model *catalogmanagementv1.IDFilter) (m
}
return modelMap, nil
}

func dataSourceIBMCmCatalogSyndicationResourceToMap(model *catalogmanagementv1.SyndicationResource) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
if model.RemoveRelatedComponents != nil {
modelMap["remove_related_components"] = *model.RemoveRelatedComponents
}
if model.Clusters != nil {
clusters := []map[string]interface{}{}
for _, clustersItem := range model.Clusters {
clustersItemMap, err := dataSourceIBMCmCatalogSyndicationClusterToMap(&clustersItem)
if err != nil {
return modelMap, err
}
clusters = append(clusters, clustersItemMap)
}
modelMap["clusters"] = clusters
}
if model.History != nil {
historyMap, err := dataSourceIBMCmCatalogSyndicationHistoryToMap(model.History)
if err != nil {
return modelMap, err
}
modelMap["history"] = []map[string]interface{}{historyMap}
}
if model.Authorization != nil {
authorizationMap, err := dataSourceIBMCmCatalogSyndicationAuthorizationToMap(model.Authorization)
if err != nil {
return modelMap, err
}
modelMap["authorization"] = []map[string]interface{}{authorizationMap}
}
return modelMap, nil
}

func dataSourceIBMCmCatalogSyndicationClusterToMap(model *catalogmanagementv1.SyndicationCluster) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
if model.Region != nil {
modelMap["region"] = *model.Region
}
if model.ID != nil {
modelMap["id"] = *model.ID
}
if model.Name != nil {
modelMap["name"] = *model.Name
}
if model.ResourceGroupName != nil {
modelMap["resource_group_name"] = *model.ResourceGroupName
}
if model.Type != nil {
modelMap["type"] = *model.Type
}
if model.Namespaces != nil {
modelMap["namespaces"] = model.Namespaces
}
if model.AllNamespaces != nil {
modelMap["all_namespaces"] = *model.AllNamespaces
}
return modelMap, nil
}

func dataSourceIBMCmCatalogSyndicationHistoryToMap(model *catalogmanagementv1.SyndicationHistory) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
if model.Namespaces != nil {
modelMap["namespaces"] = model.Namespaces
}
if model.Clusters != nil {
clusters := []map[string]interface{}{}
for _, clustersItem := range model.Clusters {
clustersItemMap, err := dataSourceIBMCmCatalogSyndicationClusterToMap(&clustersItem)
if err != nil {
return modelMap, err
}
clusters = append(clusters, clustersItemMap)
}
modelMap["clusters"] = clusters
}
if model.LastRun != nil {
modelMap["last_run"] = model.LastRun.String()
}
return modelMap, nil
}

func dataSourceIBMCmCatalogSyndicationAuthorizationToMap(model *catalogmanagementv1.SyndicationAuthorization) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
if model.Token != nil {
modelMap["token"] = *model.Token
}
if model.LastRun != nil {
modelMap["last_run"] = model.LastRun.String()
}
return modelMap, nil
}
Loading

0 comments on commit c5a6d17

Please sign in to comment.