Skip to content

Commit

Permalink
Fix the last operation as per new SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
hkantare committed Dec 8, 2022
1 parent 91dd5fa commit c5dfd4f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/IBM/ibm-hpcs-uko-sdk v0.0.4
github.com/IBM/keyprotect-go-client v0.9.0
github.com/IBM/networking-go-sdk v0.35.0
github.com/IBM/platform-services-go-sdk v0.29.2
github.com/IBM/platform-services-go-sdk v0.31.0
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
github.com/IBM/scc-go-sdk/v3 v3.1.6
github.com/IBM/scc-go-sdk/v4 v4.0.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ github.com/IBM/networking-go-sdk v0.35.0 h1:K7LCXKVF+GhmF2EUaL3vfOvrR2FADb6tv3af
github.com/IBM/networking-go-sdk v0.35.0/go.mod h1:tDJtlySQC/txyejU9KeQ27Amc6xKH0MwHFE/B2+Sn5w=
github.com/IBM/platform-services-go-sdk v0.29.2 h1:eZ5hFVQrVDUxiGztsX7Cz2DmiF3tFSqTe1Ew/lkCSOM=
github.com/IBM/platform-services-go-sdk v0.29.2/go.mod h1:jy0Ahvj5Gkkua3Gd7t22bo0GfmHRQaPZcaqwfVgEY7k=
github.com/IBM/platform-services-go-sdk v0.31.0 h1:XRSGejb/uMqNi2C5F28Q8x4jmVyXlRRE8cJCSwXBsPU=
github.com/IBM/platform-services-go-sdk v0.31.0/go.mod h1:jy0Ahvj5Gkkua3Gd7t22bo0GfmHRQaPZcaqwfVgEY7k=
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4=
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5/go.mod h1:b07XHUVh0XYnQE9s2mqgjYST1h9buaQNqN4EcKhOsX0=
github.com/IBM/scc-go-sdk/v3 v3.1.6 h1:wg7yujuJJ1O1pcGrIn8ITq6i6GeXb7GRBPNq6kLrkMU=
Expand Down
12 changes: 12 additions & 0 deletions ibm/flex/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -3472,3 +3472,15 @@ func GetResourceInstanceURL(d *schema.ResourceData, meta interface{}) (*string,

return &endpoint, nil
}

// Converts a struct to a map while maintaining the json alias as keys
func StructToMap(obj interface{}) (newMap map[string]interface{}, err error) {
data, err := json.Marshal(obj) // Convert to a json string

if err != nil {
return
}

err = json.Unmarshal(data, &newMap) // Convert to a map
return
}
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,10 @@ func ResourceIBMResourceInstanceRead(d *schema.ResourceData, meta interface{}) e
d.Set("resource_bindings_url", instance.ResourceBindingsURL)
d.Set("resource_aliases_url", instance.ResourceAliasesURL)
if instance.LastOperation != nil {
d.Set("last_operation", flex.Flatten(instance.LastOperation))
operation, err := flex.StructToMap(instance.LastOperation)
if err == nil {
d.Set("last_operation", flex.Flatten(operation))
}
}
d.Set("locked", instance.Locked)
d.Set("allow_cleanup", instance.AllowCleanup)
Expand Down

0 comments on commit c5dfd4f

Please sign in to comment.