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

@@ -58,6 +58,8 @@ func DataSourceGridListEmails() *schema.Resource {
return &schema.Resource{
SchemaVersion: 1,
DeprecationMessage: "This data source is deprecated and will be removed in version 4.14.0.",
ReadContext: dataSourceGridListEmailsRead,
Timeouts: &schema.ResourceTimeout{

View File

@@ -9,8 +9,6 @@ import (
)
func flattenGrid(d *schema.ResourceData, grid *grid.RecordGrid) {
d.Set("ckey", grid.CKey)
d.Set("meta", flattens.FlattenMeta(grid.Meta))
d.Set("auth_broker", flattens.FlattenMeta(grid.AuthBroker))
d.Set("name", grid.Name)
d.Set("flag", grid.Flag)
@@ -19,8 +17,10 @@ func flattenGrid(d *schema.ResourceData, grid *grid.RecordGrid) {
d.Set("location_code", grid.LocationCode)
d.Set("id", grid.ID)
d.Set("network_modes", grid.NetworkModes)
d.Set("reserved_cpu", grid.ReservedCPU)
d.Set("reserved_ram", grid.ReservedRAM)
d.Set("sdn_support", grid.SDNSupport)
d.Set("zero_access_enabled", grid.ZeroAccessEnabled)
}
func flattenGridList(gl *grid.ListGrids) []map[string]interface{} {
@@ -36,8 +36,11 @@ func flattenGridList(gl *grid.ListGrids) []map[string]interface{} {
"location_code": item.LocationCode,
"id": item.ID,
"network_modes": item.NetworkModes,
"reserved_cpu": item.ReservedCPU,
"reserved_ram": item.ReservedRAM,
"sdn_support": item.SDNSupport,
"zero_access_enabled": item.ZeroAccessEnabled,
"bro_enabled": item.BROEnabled,
}
res = append(res, temp)
}
@@ -77,11 +80,26 @@ func flattenGridRecordResource(rr grid.RecordResource) []map[string]interface{}
"gpu": rr.GPU,
"ram": rr.RAM,
"seps": flattenGridSeps(rr.SEPs),
"policies": flattenGridPolicies(rr.Policies),
}
res = append(res, temp)
return res
}
func flattenGridPolicies(policies map[string]grid.PolicyUsage) []map[string]interface{} {
res := make([]map[string]interface{}, 0, len(policies))
for policyID, policy := range policies {
temp := map[string]interface{}{
"policy_id": policyID,
"disk_size": policy.DiskSize,
"disk_size_max": policy.DiskSizeMax,
"seps": flattenGridSeps(policy.SEPs),
}
res = append(res, temp)
}
return res
}
func flattenGridSeps(seps map[string]map[string]grid.DiskUsage) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
for sepKey, sepVal := range seps {
@@ -106,11 +124,14 @@ func flattenGridSettings(d *schema.ResourceData, gridSettings *grid.RecordSettin
d.Set("enable_uptime_monitor", gridSettings.EnableUptimeMonitor)
d.Set("extnet_max_pre_reservations_num", gridSettings.ExtnetMaxPreReservationsNum)
d.Set("healthcheck_notifications", flattenHealthcheckNotifications(gridSettings.HealthcheckNotifications))
d.Set("interface_generation_scheme", gridSettings.InterfaceGenerationScheme)
d.Set("k8s_cleanup_enabled", gridSettings.K8sCleanupEnabled)
d.Set("limits", string(limits))
d.Set("location_url", gridSettings.LocationURL)
d.Set("mac_address_prefix", gridSettings.MACAddressPrefix)
d.Set("net_qos", flattenNetQOS(gridSettings.NetQOS))
d.Set("networks", gridSettings.Networks)
d.Set("node_self_stop_timer_uptime_monitor", gridSettings.NodeSelfStopTimerUptimeMonitor)
d.Set("node_self_stop_uptime_monitor", gridSettings.NodeSelfStopUptimeMonitor)
d.Set("prometheus", flattenPrometheus(gridSettings.Prometheus))
d.Set("vins_max_pre_reservations_num", gridSettings.VinsMaxPreReservationsNum)
d.Set("vnfdev_mgmt_net_range", gridSettings.VnfdevMgmtNetRange)

View File

@@ -8,18 +8,6 @@ func dataSourceGetGridSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
Required: true,
},
"ckey": {
Type: schema.TypeString,
Computed: true,
},
"meta": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Description: "meta",
},
"auth_broker": {
Type: schema.TypeList,
Computed: true,
@@ -58,10 +46,22 @@ func dataSourceGetGridSchemaMake() map[string]*schema.Schema {
},
Computed: true,
},
"reserved_cpu": {
Type: schema.TypeInt,
Computed: true,
},
"reserved_ram": {
Type: schema.TypeInt,
Computed: true,
},
"sdn_support": {
Type: schema.TypeBool,
Computed: true,
},
"zero_access_enabled": {
Type: schema.TypeBool,
Computed: true,
},
}
}
@@ -156,6 +156,7 @@ func dataSourceGridListSchemaMake() map[string]*schema.Schema {
},
},
},
"policies": gridPoliciesSchemaMake(),
},
},
},
@@ -212,6 +213,7 @@ func dataSourceGridListSchemaMake() map[string]*schema.Schema {
},
},
},
"policies": gridPoliciesSchemaMake(),
},
},
},
@@ -256,6 +258,14 @@ func dataSourceGridListSchemaMake() map[string]*schema.Schema {
},
Computed: true,
},
"reserved_cpu": {
Type: schema.TypeInt,
Computed: true,
},
"reserved_ram": {
Type: schema.TypeInt,
Computed: true,
},
"sdn_support": {
Type: schema.TypeBool,
Computed: true,
@@ -264,6 +274,10 @@ func dataSourceGridListSchemaMake() map[string]*schema.Schema {
Type: schema.TypeBool,
Computed: true,
},
"bro_enabled": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},
@@ -307,6 +321,53 @@ func dataSourceGridListEmailsSchemaMake() map[string]*schema.Schema {
return rets
}
func gridPoliciesSchemaMake() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"policy_id": {
Type: schema.TypeString,
Computed: true,
},
"disk_size": {
Type: schema.TypeFloat,
Computed: true,
},
"disk_size_max": {
Type: schema.TypeFloat,
Computed: true,
},
"seps": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"sep_id": {
Type: schema.TypeString,
Computed: true,
},
"data_name": {
Type: schema.TypeString,
Computed: true,
},
"disk_size": {
Type: schema.TypeFloat,
Computed: true,
},
"disk_size_max": {
Type: schema.TypeFloat,
Computed: true,
},
},
},
},
},
},
}
}
func dataSourceGridGetConsumptionSchemaMake() map[string]*schema.Schema {
return map[string]*schema.Schema{
"grid_id": {
@@ -366,6 +427,7 @@ func dataSourceGridGetConsumptionSchemaMake() map[string]*schema.Schema {
},
},
},
"policies": gridPoliciesSchemaMake(),
},
},
},
@@ -422,6 +484,7 @@ func dataSourceGridGetConsumptionSchemaMake() map[string]*schema.Schema {
},
},
},
"policies": gridPoliciesSchemaMake(),
},
},
},
@@ -489,6 +552,7 @@ func dataSourceGridListConsumptionSchemaMake() map[string]*schema.Schema {
},
},
},
"policies": gridPoliciesSchemaMake(),
},
},
},
@@ -545,6 +609,7 @@ func dataSourceGridListConsumptionSchemaMake() map[string]*schema.Schema {
},
},
},
"policies": gridPoliciesSchemaMake(),
},
},
},
@@ -725,10 +790,6 @@ func dataSourceGridGetSettingsSchemaMake() map[string]*schema.Schema {
},
},
},
"networks": {
Type: schema.TypeString,
Computed: true,
},
"prometheus": {
Type: schema.TypeList,
Computed: true,
@@ -749,5 +810,21 @@ func dataSourceGridGetSettingsSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"interface_generation_scheme": {
Type: schema.TypeString,
Computed: true,
},
"mac_address_prefix": {
Type: schema.TypeString,
Computed: true,
},
"node_self_stop_timer_uptime_monitor": {
Type: schema.TypeInt,
Computed: true,
},
"node_self_stop_uptime_monitor": {
Type: schema.TypeBool,
Computed: true,
},
}
}