4.5.1
This commit is contained in:
@@ -35,11 +35,31 @@ package sep
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||
)
|
||||
|
||||
func flattenSepList(sl *sep.ListSEP) []map[string]interface{} {
|
||||
func flattenSep(d *schema.ResourceData, desSep *sep.RecordSEP) {
|
||||
d.Set("ckey", desSep.CKey)
|
||||
d.Set("meta", flattens.FlattenMeta(desSep.Meta))
|
||||
d.Set("consumed_by", desSep.ConsumedBy)
|
||||
d.Set("desc", desSep.Description)
|
||||
d.Set("gid", desSep.GID)
|
||||
d.Set("guid", desSep.GUID)
|
||||
d.Set("sep_id", desSep.ID)
|
||||
d.Set("milestones", desSep.Milestones)
|
||||
d.Set("name", desSep.Name)
|
||||
d.Set("obj_status", desSep.ObjStatus)
|
||||
d.Set("provided_by", desSep.ProvidedBy)
|
||||
d.Set("shared_with", desSep.SharedWith)
|
||||
d.Set("tech_status", desSep.TechStatus)
|
||||
d.Set("type", desSep.Type)
|
||||
data, _ := json.Marshal(desSep.Config)
|
||||
d.Set("config", string(data))
|
||||
}
|
||||
|
||||
func flattenSepListItems(sl *sep.ListSEP) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, item := range sl.Data {
|
||||
data, _ := json.Marshal(item.Config)
|
||||
@@ -93,7 +113,13 @@ func flattenSepPoolUris(rp *sep.RecordPool) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenSepConsumption(sc sep.Total) []map[string]interface{} {
|
||||
func flattenSepConsumption(d *schema.ResourceData, sepCons *sep.RecordConsumption) {
|
||||
d.Set("type", sepCons.Type)
|
||||
d.Set("total", flattenSepConsumptionTotal(sepCons.Total))
|
||||
d.Set("by_pool", flattenSepConsumptionPools(sepCons))
|
||||
}
|
||||
|
||||
func flattenSepConsumptionTotal(sc sep.Total) []map[string]interface{} {
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"capacity_limit": sc.CapacityLimit,
|
||||
@@ -112,7 +138,7 @@ func flattenSepConsumptionPools(bp *sep.RecordConsumption) []map[string]interfac
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
for key, value := range bp.ByPool {
|
||||
temp := map[string]interface{}{
|
||||
"name": key,
|
||||
"name": key,
|
||||
"disk_count": value.DiskCount,
|
||||
"disk_usage": value.DiskUsage,
|
||||
"snapshot_count": value.SnapshotCount,
|
||||
|
||||
Reference in New Issue
Block a user