Syntax check and fixing

This commit is contained in:
Sergey Shubin svs1370
2021-02-12 17:32:40 +03:00
parent c472e5ddbf
commit c928d996ed
28 changed files with 1001 additions and 1212 deletions

View File

@@ -18,75 +18,12 @@ limitations under the License.
package decort
import (
"log"
// log "github.com/sirupsen/logrus"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)
func makeDisksConfig(arg_list []interface{}) (disks []DiskConfig, count int) {
count = len(arg_list)
if count < 1 {
return nil, 0
}
// allocate DataDisks list and fill it
disks = make([]DiskConfig, count)
var subres_data map[string]interface{}
for index, value := range arg_list {
subres_data = value.(map[string]interface{})
disks[index].Label = subres_data["label"].(string)
disks[index].Size = subres_data["size"].(int)
disks[index].Pool = subres_data["pool"].(string)
disks[index].Provider = subres_data["provider"].(string)
}
return disks, count
}
func flattenDataDisks(disks []DataDiskRecord) []interface{} {
var length = 0
for _, value := range disks {
if value.DiskType == "D" {
length += 1
}
}
log.Printf("flattenDataDisks: found %d disks with D type", length)
result := make([]interface{}, length)
if length == 0 {
return result
}
elem := make(map[string]interface{})
var subindex = 0
for _, value := range disks {
if value.DiskType == "D" {
elem["label"] = value.Label
elem["size"] = value.SizeMax
elem["disk_id"] = value.ID
elem["pool"] = "default"
elem["provider"] = "default"
result[subindex] = elem
subindex += 1
}
}
return result
}
/*
func makeDataDisksArgString(disks []DiskConfig) string {
// Prepare a string with the sizes of data disks for the virtual machine.
// It is designed to be passed as "datadisks" argument of virtual machine create API call.
if len(disks) < 1 {
return ""
}
return ""
}
*/
// ID, type, name, size, account ID, SEP ID, SEP type, pool, status, tech status, compute ID, image ID
func diskSubresourceSchema() map[string]*schema.Schema {