4.0.0
This commit is contained in:
28
internal/service/cloudapi/snapshot/flattens.go
Normal file
28
internal/service/cloudapi/snapshot/flattens.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package snapshot
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
||||
)
|
||||
|
||||
func flattenSnapshotList(gl compute.ListSnapShots) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, item := range gl {
|
||||
temp := map[string]interface{}{
|
||||
"label": item.Label,
|
||||
"guid": item.GUID,
|
||||
"disks": item.Disks,
|
||||
"timestamp": item.Timestamp,
|
||||
}
|
||||
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenSnapshot(d *schema.ResourceData, snapshot *compute.ItemSnapshot) {
|
||||
d.Set("timestamp", snapshot.Timestamp)
|
||||
d.Set("guid", snapshot.GUID)
|
||||
d.Set("disks", snapshot.Disks)
|
||||
d.Set("label", snapshot.Label)
|
||||
}
|
||||
Reference in New Issue
Block a user