You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform-provider-decort/internal/service/cloudapi/snapshot/flattens.go

29 lines
744 B

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, len(gl.Data))
for _, item := range gl.Data {
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)
}