This commit is contained in:
2023-07-26 13:32:39 +03:00
parent f731cf246f
commit 272e385318
167 changed files with 5194 additions and 890 deletions

View File

@@ -147,9 +147,9 @@ func flattenListACL(listAcl compute.ListACL) []map[string]interface{} {
return res
}
func flattenComputeList(computes compute.ListComputes) []map[string]interface{} {
func flattenComputeList(computes *compute.ListComputes) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
for _, compute := range computes {
for _, compute := range computes.Data {
customFields, _ := json.Marshal(compute.CustomFields)
devices, _ := json.Marshal(compute.Devices)
temp := map[string]interface{}{
@@ -265,7 +265,7 @@ func flattenComputeDisksDemo(disksList compute.ListComputeDisks, extraDisks []in
func flattenNetwork(interfaces compute.ListInterfaces) []map[string]interface{} {
res := make([]map[string]interface{}, 0, len(interfaces))
//index := 0
for _, network := range interfaces {
temp := map[string]interface{}{
"net_id": network.NetID,
@@ -316,7 +316,6 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute) er
d.Set("computeci_id", computeRec.ComputeCIID)
d.Set("created_by", computeRec.CreatedBy)
d.Set("created_time", computeRec.CreatedTime)
d.Set("custom_fields", flattenCustomFields(computeRec.CustomFields))
d.Set("deleted_by", computeRec.DeletedBy)
d.Set("deleted_time", computeRec.DeletedTime)
d.Set("description", computeRec.Description)
@@ -442,6 +441,7 @@ func flattenSnapshots(snapshots compute.SnapshotExtendList) []map[string]interfa
"guid": snapshot.GUID,
"label": snapshot.Label,
"res_id": snapshot.ResID,
"reference_id": snapshot.ReferenceID,
"snap_set_guid": snapshot.SnapSetGUID,
"snap_set_time": snapshot.SnapSetTime,
"timestamp": snapshot.TimeStamp,
@@ -503,18 +503,11 @@ func flattenListComputeDisks(disks compute.ListComputeDisks) []map[string]interf
return res
}
func flattenCustomFields(customFileds map[string]interface{}) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
for key, val := range customFileds {
value, _ := json.Marshal(val)
temp := map[string]interface{}{
"key": key,
"val": string(value),
}
res = append(res, temp)
}
return res
func flattenCustomFields(customFields map[string]interface{}) string {
encoded, _ := json.Marshal(customFields)
return string(encoded)
}
func flattenOsUsers(osUsers compute.ListOSUser) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
for _, user := range osUsers {
@@ -609,9 +602,9 @@ func flattenComputeAudits(computeAudits compute.ListAudits) []map[string]interfa
return res
}
func flattenPfwList(computePfws compute.ListPFWs) []map[string]interface{} {
func flattenPfwList(computePfws *compute.ListPFWs) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
for _, computePfw := range computePfws {
for _, computePfw := range computePfws.Data {
temp := map[string]interface{}{
"pfw_id": computePfw.ID,
"local_ip": computePfw.LocalIP,
@@ -626,10 +619,10 @@ func flattenPfwList(computePfws compute.ListPFWs) []map[string]interface{} {
return res
}
func flattenUserList(d *schema.ResourceData, userList compute.RecordACL) {
d.Set("account_acl", flattenListACL(userList.AccountACL))
d.Set("compute_acl", flattenListACL(userList.ComputeACL))
d.Set("rg_acl", flattenListACL(userList.RGACL))
func flattenUserList(d *schema.ResourceData, userList *compute.ListUsers) {
d.Set("account_acl", flattenListACL(userList.Data.AccountACL))
d.Set("compute_acl", flattenListACL(userList.Data.ComputeACL))
d.Set("rg_acl", flattenListACL(userList.Data.RGACL))
}
func flattenComputeGetAudits(computeAudits compute.ListShortAudits) []map[string]interface{} {