Files
terraform-provider-decort/internal/service/cloudapi/snapshot/flattens.go

29 lines
744 B
Go
Raw Normal View History

2023-05-04 10:08:25 +03:00
package snapshot
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
)
2023-07-26 13:32:39 +03:00
func flattenSnapshotList(gl *compute.ListSnapShots) []map[string]interface{} {
2023-10-13 13:28:19 +03:00
res := make([]map[string]interface{}, 0, len(gl.Data))
2023-07-26 13:32:39 +03:00
for _, item := range gl.Data {
2023-05-04 10:08:25 +03:00
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)
}