Skip to content

Commit

Permalink
feat(Catalog Management): support new offering version limit
Browse files Browse the repository at this point in the history
  • Loading branch information
benbuchanan authored and hkantare committed Sep 30, 2024
1 parent 212138c commit e30b5c6
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 120 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/IBM/eventstreams-go-sdk v1.4.0
github.com/IBM/go-sdk-core v1.1.0
github.com/IBM/go-sdk-core/v3 v3.2.4
github.com/IBM/go-sdk-core/v5 v5.17.4
github.com/IBM/go-sdk-core/v5 v5.17.5
github.com/IBM/ibm-cos-sdk-go v1.10.3
github.com/IBM/ibm-cos-sdk-go-config/v2 v2.1.0
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1
Expand All @@ -30,7 +30,7 @@ require (
github.com/IBM/logs-router-go-sdk v1.0.5
github.com/IBM/mqcloud-go-sdk v0.1.0
github.com/IBM/networking-go-sdk v0.49.0
github.com/IBM/platform-services-go-sdk v0.68.1
github.com/IBM/platform-services-go-sdk v0.69.1
github.com/IBM/project-go-sdk v0.3.5
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
github.com/IBM/sarama v1.41.2
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ github.com/IBM/go-sdk-core/v5 v5.6.3/go.mod h1:tt/B9rxLkRtglE7pvqLuYikgCXaZFL3bt
github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc=
github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE=
github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI=
github.com/IBM/go-sdk-core/v5 v5.17.4 h1:VGb9+mRrnS2HpHZFM5hy4J6ppIWnwNrw0G+tLSgcJLc=
github.com/IBM/go-sdk-core/v5 v5.17.4/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns=
github.com/IBM/go-sdk-core/v5 v5.17.5 h1:AjGC7xNee5tgDIjndekBDW5AbypdERHSgib3EZ1KNsA=
github.com/IBM/go-sdk-core/v5 v5.17.5/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns=
github.com/IBM/ibm-cos-sdk-go v1.10.3 h1:YfZSLqMiCrqDPbr3r+amY2sicIXlrd+3L5pok6QRXIQ=
github.com/IBM/ibm-cos-sdk-go v1.10.3/go.mod h1:T9x7pC47DUd5jD/TMFzlvly39P6EdW5wOemA78XEo2g=
github.com/IBM/ibm-cos-sdk-go-config/v2 v2.1.0 h1:U7EmXSfv7jtugRpTpOkPUmgS/xiNKtGfKVH3BGyC1hg=
Expand All @@ -175,8 +176,8 @@ github.com/IBM/mqcloud-go-sdk v0.1.0 h1:fWt4uisg5GbbsfNmAxx5/6c5gQIPM+VrEsTtnimE
github.com/IBM/mqcloud-go-sdk v0.1.0/go.mod h1:LesMQlKHXvdks4jqQLZH7HfATY5lvTzHuwQU5+y7b2g=
github.com/IBM/networking-go-sdk v0.49.0 h1:lPS34u3C0JVrbxH+Ulua76Nwl6Frv8BEfq6LRkyvOv0=
github.com/IBM/networking-go-sdk v0.49.0/go.mod h1:G9CKbmPE8gSLjN+ABh4hIZ1bMx076enl5Eekvj6zQnA=
github.com/IBM/platform-services-go-sdk v0.68.1 h1:RXGzEmdllzSj5OzCJO7AoTeQ+cgTTNa20CrrpLQe5KQ=
github.com/IBM/platform-services-go-sdk v0.68.1/go.mod h1:6rYd3stLSnotYmZlxclw45EJPaQuLmh5f7c+Mg7rOg4=
github.com/IBM/platform-services-go-sdk v0.69.1 h1:Wb8BYVpsPIppWbOQCgF7ytm+BbSOXdWWCf9zcZ6xGA4=
github.com/IBM/platform-services-go-sdk v0.69.1/go.mod h1:ZP3zUDxR1qRdUqzFdnJOlQN0QpVYol2eOUCv4uk03Jc=
github.com/IBM/project-go-sdk v0.3.5 h1:L+YClFUa14foS0B/hOOY9n7sIdsT5/XQicnXOyJSpyM=
github.com/IBM/project-go-sdk v0.3.5/go.mod h1:FOJM9ihQV3EEAY6YigcWiTNfVCThtdY8bLC/nhQHFvo=
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ func dataSourceIBMCmOfferingRead(context context.Context, d *schema.ResourceData
getOfferingOptions.SetCatalogIdentifier(d.Get("catalog_id").(string))
getOfferingOptions.SetOfferingID(d.Get("offering_id").(string))

offering, response, err := catalogManagementClient.GetOfferingWithContext(context, getOfferingOptions)
offering, response, err := FetchOfferingWithAllVersions(context, catalogManagementClient, getOfferingOptions)
if err != nil {
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("GetOfferingWithContext failed %s\n%s", err, response), "(Data) ibm_cm_object", "read")
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
Expand Down
4 changes: 3 additions & 1 deletion ibm/service/catalogmanagement/resource_ibm_cm_offering.go
Original file line number Diff line number Diff line change
Expand Up @@ -2559,6 +2559,8 @@ func resourceIBMCmOfferingCreate(context context.Context, d *schema.ResourceData
getOfferingOptions.SetCatalogIdentifier(d.Get("catalog_id").(string))
getOfferingOptions.SetOfferingID(d.Get("offering_id").(string))

// Don't need to get full offering with all versions here because we call resourceIBMCmOfferingRead which does
// This get is just to see if the offering exists and set state id
offering, response, err := catalogManagementClient.GetOfferingWithContext(context, getOfferingOptions)
if err != nil {
if response != nil && response.StatusCode == 404 {
Expand Down Expand Up @@ -2817,7 +2819,7 @@ func resourceIBMCmOfferingRead(context context.Context, d *schema.ResourceData,
getOfferingOptions.SetCatalogIdentifier(d.Get("catalog_id").(string))
getOfferingOptions.SetOfferingID(d.Id())

offering, response, err := catalogManagementClient.GetOfferingWithContext(context, getOfferingOptions)
offering, response, err := FetchOfferingWithAllVersions(context, catalogManagementClient, getOfferingOptions)
if err != nil {
if response != nil && response.StatusCode == 404 {
d.SetId("")
Expand Down
Loading

0 comments on commit e30b5c6

Please sign in to comment.