This commit is contained in:
2026-09-21 11:51:12 +03:00
parent 9cd93e4277
commit 2b229a84fb
240 changed files with 7735 additions and 3166 deletions

View File

@@ -194,6 +194,34 @@ func dataSourceZoneSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"cpu_alignment_profiles": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"vendor": {
Type: schema.TypeString,
Computed: true,
},
"model": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
"reserved_cpu": {
Type: schema.TypeInt,
Computed: true,
},
"reserved_ram": {
Type: schema.TypeInt,
Computed: true,
},
}
}

View File

@@ -202,6 +202,34 @@ func dataSourceZoneListSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"cpu_alignment_profiles": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"vendor": {
Type: schema.TypeString,
Computed: true,
},
"model": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
"reserved_cpu": {
Type: schema.TypeInt,
Computed: true,
},
"reserved_ram": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},

View File

@@ -38,6 +38,18 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
)
func flattenCpuAlignmentProfiles(profiles []zone.CpuAlignmentProfile) []map[string]interface{} {
res := make([]map[string]interface{}, 0, len(profiles))
for _, p := range profiles {
res = append(res, map[string]interface{}{
"name": p.Name,
"vendor": p.Vendor,
"model": p.Model,
})
}
return res
}
func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d",
item.Name, item.ID)
@@ -71,6 +83,9 @@ func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
d.Set("ssl_skip_verify", item.SSLSkipVerify)
d.Set("domain", item.Domain)
d.Set("sso_type", item.SSOType)
d.Set("cpu_alignment_profiles", flattenCpuAlignmentProfiles(item.CpuAlignmentProfiles))
d.Set("reserved_cpu", item.ReservedCPU)
d.Set("reserved_ram", item.ReservedRAM)
log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete",
item.Name, item.ID)
@@ -82,28 +97,31 @@ func flattenZoneList(zone *zone.ListZones) []map[string]interface{} {
res := make([]map[string]interface{}, 0, len(zone.Data))
for _, zone := range zone.Data {
temp := map[string]interface{}{
"zone_id": int(zone.ID),
"guid": int(zone.GUID),
"gid": int(zone.GID),
"name": zone.Name,
"description": zone.Description,
"deletable": zone.Deletable,
"status": zone.Status,
"created_time": zone.CreatedTime,
"updated_time": zone.UpdatedTime,
"node_ids": zone.NodeIDs,
"auto_start": zone.AutoStart,
"drs": zone.DRS,
"drs_uid": zone.DRSUID,
"drs_name": zone.DRSName,
"sso_url": zone.SSOURL,
"app_id": zone.AppID,
"decort_url": zone.DecortURL,
"ping_addr": zone.PingAddr,
"broadcast_addr": zone.BroadcastAddr,
"ssl_skip_verify": zone.SSLSkipVerify,
"domain": zone.Domain,
"sso_type": zone.SSOType,
"zone_id": int(zone.ID),
"guid": int(zone.GUID),
"gid": int(zone.GID),
"name": zone.Name,
"description": zone.Description,
"deletable": zone.Deletable,
"status": zone.Status,
"created_time": zone.CreatedTime,
"updated_time": zone.UpdatedTime,
"node_ids": zone.NodeIDs,
"auto_start": zone.AutoStart,
"drs": zone.DRS,
"drs_uid": zone.DRSUID,
"drs_name": zone.DRSName,
"sso_url": zone.SSOURL,
"app_id": zone.AppID,
"decort_url": zone.DecortURL,
"ping_addr": zone.PingAddr,
"broadcast_addr": zone.BroadcastAddr,
"ssl_skip_verify": zone.SSLSkipVerify,
"domain": zone.Domain,
"sso_type": zone.SSOType,
"cpu_alignment_profiles": flattenCpuAlignmentProfiles(zone.CpuAlignmentProfiles),
"reserved_cpu": int(zone.ReservedCPU),
"reserved_ram": int(zone.ReservedRAM),
}
res = append(res, temp)
}