4.3.0
This commit is contained in:
@@ -81,7 +81,7 @@ func resourcesSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": {
|
||||
Type: schema.TypeInt,
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"extips": {
|
||||
@@ -223,6 +223,10 @@ func resourceLimitsSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_dm": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_i": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
@@ -254,14 +258,6 @@ func dataSourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
"resources": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: resourcesSchemaMake(),
|
||||
},
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -50,12 +50,53 @@ func dataSourceRgListRead(ctx context.Context, d *schema.ResourceData, m interfa
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenRgList(rgList))
|
||||
d.Set("entry_count", rgList.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceRgListSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"by_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by ID",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by name",
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by account ID",
|
||||
},
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by account name",
|
||||
},
|
||||
"created_after": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find RGs created after specific time (unix timestamp)",
|
||||
},
|
||||
"created_before": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find RGs created before specific time (unix timestamp)",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by status",
|
||||
},
|
||||
"lock_status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by lock status",
|
||||
},
|
||||
"includedeleted": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
@@ -222,6 +263,10 @@ func dataSourceRgListSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ func dataSourceRgListComputesRead(ctx context.Context, d *schema.ResourceData, m
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenRgListComputes(listComputes))
|
||||
d.Set("entry_count", listComputes.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -92,12 +94,56 @@ func dataSourceRgListComputesSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
Description: "ID of the RG",
|
||||
},
|
||||
"reason": {
|
||||
"compute_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by compute ID",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "reason for action",
|
||||
Description: "Filter by name",
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by account ID",
|
||||
},
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by tech. status",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by status",
|
||||
},
|
||||
"ip_address": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "FIlter by IP address",
|
||||
},
|
||||
"extnet_name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by extnet name",
|
||||
},
|
||||
"extnet_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by extnet ID",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page number",
|
||||
},
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page size",
|
||||
},
|
||||
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -204,6 +250,10 @@ func dataSourceRgListComputesSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
@@ -50,12 +50,48 @@ func dataSourceRgListDeletedRead(ctx context.Context, d *schema.ResourceData, m
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenRgList(rgList))
|
||||
d.Set("entry_count", rgList.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceRgListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"by_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by ID",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by name",
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by account ID",
|
||||
},
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by account name",
|
||||
},
|
||||
"created_after": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter RGs created after certain point in time (unix timestamp)",
|
||||
},
|
||||
"created_before": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter RGs created before certain point in time (unix timestamp)",
|
||||
},
|
||||
"lock_status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by lock status",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
@@ -66,7 +102,6 @@ func dataSourceRgListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "Page size",
|
||||
},
|
||||
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -208,6 +243,10 @@ func dataSourceRgListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ func dataSourceRgListLbRead(ctx context.Context, d *schema.ResourceData, m inter
|
||||
|
||||
d.SetId(strconv.Itoa(d.Get("rg_id").(int)))
|
||||
d.Set("items", flattenRgListLb(listLb))
|
||||
d.Set("entry_count", listLb.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -244,7 +246,51 @@ func dataSourceRgListLbSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
Description: "ID of the RG",
|
||||
},
|
||||
|
||||
"by_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by ID",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by name",
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by account ID",
|
||||
},
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by tech. status",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by status",
|
||||
},
|
||||
"front_ip": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by frontend IP",
|
||||
},
|
||||
"back_ip": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by backend IP",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page number",
|
||||
},
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page size",
|
||||
},
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -368,6 +414,10 @@ func dataSourceRgListLbSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
@@ -49,6 +49,8 @@ func dataSourceRgListPfwRead(ctx context.Context, d *schema.ResourceData, m inte
|
||||
|
||||
d.SetId(strconv.Itoa(d.Get("rg_id").(int)))
|
||||
d.Set("items", flattenRgListPfw(listPfw))
|
||||
d.Set("entry_count", listPfw.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -59,7 +61,6 @@ func dataSourceRgListPfwSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
Description: "ID of the RG",
|
||||
},
|
||||
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -100,6 +101,10 @@ func dataSourceRgListPfwSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
@@ -49,6 +49,8 @@ func dataSourceRgListVinsRead(ctx context.Context, d *schema.ResourceData, m int
|
||||
|
||||
d.SetId(strconv.Itoa(d.Get("rg_id").(int)))
|
||||
d.Set("items", flattenRgListVins(listVins))
|
||||
d.Set("entry_count", listVins.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -59,12 +61,36 @@ func dataSourceRgListVinsSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
Description: "ID of the RG",
|
||||
},
|
||||
"reason": {
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Reason for action",
|
||||
Description: "Filter by name",
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by account ID",
|
||||
},
|
||||
"ext_ip": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Filter by external IP",
|
||||
},
|
||||
"vins_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "Filter by ViNS ID",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "Page number",
|
||||
},
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "Page size",
|
||||
},
|
||||
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -137,6 +163,10 @@ func dataSourceRgListVinsSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
@@ -92,7 +92,7 @@ func flattenResgroup(d *schema.ResourceData, details rg.RecordResourceGroup) err
|
||||
d.Set("def_net_type", details.DefNetType)
|
||||
d.Set("name", details.Name)
|
||||
|
||||
d.Set("resources", flattenRgResource(details.Resources))
|
||||
// d.Set("resources", flattenRgResource(details.Resources))
|
||||
d.Set("account_name", details.AccountName)
|
||||
d.Set("acl", flattenRgAcl(details.ACL))
|
||||
d.Set("vms", details.Computes)
|
||||
@@ -157,19 +157,8 @@ func flattenResource(resource rg.Resource) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRgResource(itemResource rg.Resources) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"current": flattenResource(itemResource.Current),
|
||||
"reserved": flattenResource(itemResource.Reserved),
|
||||
}
|
||||
|
||||
res = append(res, temp)
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRg(d *schema.ResourceData, itemRg rg.RecordResourceGroup) {
|
||||
d.Set("resources", flattenRgResource(itemRg.Resources))
|
||||
// d.Set("resources", flattenRgResource(itemRg.Resources))
|
||||
d.Set("account_id", itemRg.AccountID)
|
||||
d.Set("account_name", itemRg.AccountName)
|
||||
d.Set("acl", flattenRgAcl(itemRg.ACL))
|
||||
@@ -218,9 +207,9 @@ func flattenRgAudits(rgAudits rg.ListAudits) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRgList(rgl rg.ListResourceGroups) []map[string]interface{} {
|
||||
func flattenRgList(rgl *rg.ListResourceGroups) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, rg := range rgl {
|
||||
for _, rg := range rgl.Data {
|
||||
temp := map[string]interface{}{
|
||||
"account_acl": flattenRgAcl(rg.ACL),
|
||||
"account_id": rg.AccountID,
|
||||
@@ -282,13 +271,13 @@ func flattenRgResourceLimits(rl rg.ResourceLimits) []map[string]interface{} {
|
||||
"cu_d": rl.CUD,
|
||||
"cu_i": rl.CUI,
|
||||
"cu_m": rl.CUM,
|
||||
"cu_dm": rl.CUDM,
|
||||
"cu_np": rl.CUNP,
|
||||
"gpu_units": rl.GPUUnits,
|
||||
}
|
||||
res = append(res, temp)
|
||||
|
||||
return res
|
||||
|
||||
}
|
||||
|
||||
func flattenRules(list rg.ListRules) []map[string]interface{} {
|
||||
@@ -309,9 +298,9 @@ func flattenRules(list rg.ListRules) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRgListComputes(lc rg.ListComputes) []map[string]interface{} {
|
||||
func flattenRgListComputes(lc *rg.ListComputes) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, compute := range lc {
|
||||
for _, compute := range lc.Data {
|
||||
temp := map[string]interface{}{
|
||||
"account_id": compute.AccountID,
|
||||
"account_name": compute.AccountName,
|
||||
@@ -437,9 +426,9 @@ func flattenNode(node rg.RecordNode) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRgListLb(listLb rg.ListLB) []map[string]interface{} {
|
||||
func flattenRgListLb(listLb *rg.ListLB) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, lb := range listLb {
|
||||
for _, lb := range listLb.Data {
|
||||
temp := map[string]interface{}{
|
||||
"ha_mode": lb.HAMode,
|
||||
"acl": lb.ACL,
|
||||
@@ -472,9 +461,9 @@ func flattenRgListLb(listLb rg.ListLB) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRgListPfw(listPfw rg.ListPortForwards) []map[string]interface{} {
|
||||
func flattenRgListPfw(listPfw *rg.ListPortForwards) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, pfw := range listPfw {
|
||||
for _, pfw := range listPfw.Data {
|
||||
temp := map[string]interface{}{
|
||||
"public_port_end": pfw.PublicPortEnd,
|
||||
"public_port_start": pfw.PublicPortStart,
|
||||
@@ -491,9 +480,9 @@ func flattenRgListPfw(listPfw rg.ListPortForwards) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRgListVins(lv rg.ListVINS) []map[string]interface{} {
|
||||
func flattenRgListVins(lv *rg.ListVINS) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, vins := range lv {
|
||||
for _, vins := range lv.Data {
|
||||
temp := map[string]interface{}{
|
||||
"account_id": vins.AccountID,
|
||||
"account_name": vins.AccountName,
|
||||
@@ -519,7 +508,7 @@ func flattenRgListVins(lv rg.ListVINS) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRgAffinityGroupComputes(list rg.ListAffinityGroups) []map[string]interface{} {
|
||||
func flattenRgAffinityGroupComputes(list rg.ListAffinityGroupsComputes) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
|
||||
for _, item := range list {
|
||||
@@ -548,9 +537,9 @@ func flattenRgAffinityGroupsGet(list []uint64) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenRgListGroups(list map[string][]uint64) []map[string]interface{} {
|
||||
func flattenRgListGroups(list *rg.ListAffinityGroups) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for groupKey, groupVal := range list {
|
||||
for groupKey, groupVal := range list.Data {
|
||||
temp := map[string]interface{}{
|
||||
"label": groupKey,
|
||||
"ids": groupVal,
|
||||
|
||||
@@ -53,7 +53,7 @@ func existAccountID(ctx context.Context, d *schema.ResourceData, m interface{})
|
||||
return false, err
|
||||
}
|
||||
|
||||
return len(accountList.FilterByID(accountId)) != 0, nil
|
||||
return len(accountList.FilterByID(accountId).Data) != 0, nil
|
||||
}
|
||||
|
||||
func existGID(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
@@ -67,7 +67,7 @@ func existGID(ctx context.Context, d *schema.ResourceData, m interface{}) (bool,
|
||||
return false, err
|
||||
}
|
||||
|
||||
return len(locationList.FilterByGID(gid)) != 0, nil
|
||||
return len(locationList.FilterByGID(gid).Data) != 0, nil
|
||||
}
|
||||
|
||||
func existExtNetID(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
@@ -83,5 +83,5 @@ func existExtNetID(ctx context.Context, d *schema.ResourceData, m interface{}) (
|
||||
return false, err
|
||||
}
|
||||
|
||||
return len(listExtNet.FilterByID(extNetId)) != 0, nil
|
||||
return len(listExtNet.FilterByID(extNetId).Data) != 0, nil
|
||||
}
|
||||
|
||||
@@ -772,13 +772,13 @@ func ResourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "Name of the account, which this resource group belongs to.",
|
||||
},
|
||||
"resources": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: resourcesSchemaMake(),
|
||||
},
|
||||
},
|
||||
// "resources": {
|
||||
// Type: schema.TypeList,
|
||||
// Computed: true,
|
||||
// Elem: &schema.Resource{
|
||||
// Schema: resourcesSchemaMake(),
|
||||
// },
|
||||
// },
|
||||
|
||||
"acl": {
|
||||
Type: schema.TypeList,
|
||||
|
||||
@@ -40,7 +40,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityRgAffinityGroupComputesCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (rg.ListAffinityGroups, error) {
|
||||
func utilityRgAffinityGroupComputesCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (rg.ListAffinityGroupsComputes, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := rg.AffinityGroupComputesRequest{
|
||||
RGID: uint64(d.Get("rg_id").(int)),
|
||||
|
||||
@@ -40,7 +40,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityRgAffinityGroupsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (map[string][]uint64, error) {
|
||||
func utilityRgAffinityGroupsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*rg.ListAffinityGroups, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := rg.AffinityGroupsListRequest{
|
||||
RGID: uint64(d.Get("rg_id").(int)),
|
||||
|
||||
@@ -42,10 +42,34 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilityRgListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (rg.ListResourceGroups, error) {
|
||||
func utilityRgListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*rg.ListResourceGroups, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := rg.ListRequest{}
|
||||
|
||||
if byId, ok := d.GetOk("by_id"); ok {
|
||||
req.ByID = uint64(byId.(int))
|
||||
}
|
||||
if name, ok := d.GetOk("name"); ok {
|
||||
req.Name = name.(string)
|
||||
}
|
||||
if accountId, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(accountId.(int))
|
||||
}
|
||||
if accountName, ok := d.GetOk("account_name"); ok {
|
||||
req.AccountName = accountName.(string)
|
||||
}
|
||||
if createdAfter, ok := d.GetOk("created_after"); ok {
|
||||
req.CreatedAfter = uint64(createdAfter.(int))
|
||||
}
|
||||
if createdBefore, ok := d.GetOk("created_before"); ok {
|
||||
req.CreatedBefore = uint64(createdBefore.(int))
|
||||
}
|
||||
if status, ok := d.GetOk("status"); ok {
|
||||
req.Status = status.(string)
|
||||
}
|
||||
if lockStatus, ok := d.GetOk("lock_status"); ok {
|
||||
req.LockStatus = lockStatus.(string)
|
||||
}
|
||||
if size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(size.(int))
|
||||
}
|
||||
|
||||
@@ -40,14 +40,50 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityRgListComputesCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (rg.ListComputes, error) {
|
||||
func utilityRgListComputesCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*rg.ListComputes, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := rg.ListComputesRequest{
|
||||
RGID: uint64(d.Get("rg_id").(int)),
|
||||
}
|
||||
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
if compute_id, ok := d.GetOk("compute_id"); ok {
|
||||
req.ComputeID = uint64(compute_id.(int))
|
||||
}
|
||||
|
||||
if name, ok := d.GetOk("name"); ok {
|
||||
req.Name = name.(string)
|
||||
}
|
||||
|
||||
if account_id, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(account_id.(int))
|
||||
}
|
||||
|
||||
if status, ok := d.GetOk("status"); ok {
|
||||
req.Status = status.(string)
|
||||
}
|
||||
|
||||
if tech_status, ok := d.GetOk("tech_status"); ok {
|
||||
req.TechStatus = tech_status.(string)
|
||||
}
|
||||
|
||||
if ip_address, ok := d.GetOk("ip_address"); ok {
|
||||
req.IPAddress = ip_address.(string)
|
||||
}
|
||||
|
||||
if extnet_name, ok := d.GetOk("extnet_name"); ok {
|
||||
req.ExtNetName = extnet_name.(string)
|
||||
}
|
||||
|
||||
if extnet_id, ok := d.GetOk("extnet_id"); ok {
|
||||
req.ExtNetID = uint64(extnet_id.(int))
|
||||
}
|
||||
|
||||
if page, ok := d.GetOk("page"); ok {
|
||||
req.Page = uint64(page.(int))
|
||||
}
|
||||
|
||||
if size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(size.(int))
|
||||
}
|
||||
|
||||
listComputes, err := c.CloudAPI().RG().ListComputes(ctx, req)
|
||||
|
||||
@@ -40,10 +40,38 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityRgListDeletedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (rg.ListResourceGroups, error) {
|
||||
func utilityRgListDeletedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*rg.ListResourceGroups, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := rg.ListDeletedRequest{}
|
||||
|
||||
if by_id, ok := d.GetOk("by_id"); ok {
|
||||
req.ByID = uint64(by_id.(int))
|
||||
}
|
||||
|
||||
if name, ok := d.GetOk("name"); ok {
|
||||
req.Name = name.(string)
|
||||
}
|
||||
|
||||
if account_id, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(account_id.(int))
|
||||
}
|
||||
|
||||
if account_name, ok := d.GetOk("account_name"); ok {
|
||||
req.AccountName = account_name.(string)
|
||||
}
|
||||
|
||||
if created_after, ok := d.GetOk("created_after"); ok {
|
||||
req.CreatedAfter = uint64(created_after.(int))
|
||||
}
|
||||
|
||||
if created_before, ok := d.GetOk("created_before"); ok {
|
||||
req.CreatedBefore = uint64(created_before.(int))
|
||||
}
|
||||
|
||||
if lock_status, ok := d.GetOk("lock_status"); ok {
|
||||
req.LockStatus = lock_status.(string)
|
||||
}
|
||||
|
||||
if size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(size.(int))
|
||||
}
|
||||
|
||||
@@ -40,12 +40,48 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityRgListLbCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (rg.ListLB, error) {
|
||||
func utilityRgListLbCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*rg.ListLB, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := rg.ListLBRequest{
|
||||
RGID: uint64(d.Get("rg_id").(int)),
|
||||
}
|
||||
|
||||
if by_id, ok := d.GetOk("by_id"); ok {
|
||||
req.ByID = uint64(by_id.(int))
|
||||
}
|
||||
|
||||
if name, ok := d.GetOk("name"); ok {
|
||||
req.Name = name.(string)
|
||||
}
|
||||
|
||||
if account_id, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(account_id.(int))
|
||||
}
|
||||
|
||||
if tech_status, ok := d.GetOk("tech_status"); ok {
|
||||
req.TechStatus = tech_status.(string)
|
||||
}
|
||||
|
||||
if status, ok := d.GetOk("status"); ok {
|
||||
req.Status = status.(string)
|
||||
}
|
||||
|
||||
if front_ip, ok := d.GetOk("front_ip"); ok {
|
||||
req.FrontIP = front_ip.(string)
|
||||
}
|
||||
|
||||
if back_ip, ok := d.GetOk("back_ip"); ok {
|
||||
req.BackIP = back_ip.(string)
|
||||
}
|
||||
|
||||
if page, ok := d.GetOk("page"); ok {
|
||||
req.Page = uint64(page.(int))
|
||||
}
|
||||
|
||||
if size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(size.(int))
|
||||
}
|
||||
|
||||
listLb, err := c.CloudAPI().RG().ListLB(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -40,7 +40,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityRgListPfwCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (rg.ListPortForwards, error) {
|
||||
func utilityRgListPfwCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*rg.ListPortForwards, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := rg.ListPFWRequest{
|
||||
RGID: uint64(d.Get("rg_id").(int)),
|
||||
|
||||
@@ -40,14 +40,34 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityRgListVinsCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (rg.ListVINS, error) {
|
||||
func utilityRgListVinsCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*rg.ListVINS, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := rg.ListVINSRequest{
|
||||
RGID: uint64(d.Get("rg_id").(int)),
|
||||
}
|
||||
|
||||
if val, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = val.(string)
|
||||
if name, ok := d.GetOk("name"); ok {
|
||||
req.Name = name.(string)
|
||||
}
|
||||
|
||||
if account_id, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(account_id.(int))
|
||||
}
|
||||
|
||||
if ext_ip, ok := d.GetOk("ext_ip"); ok {
|
||||
req.ExtIP = ext_ip.(string)
|
||||
}
|
||||
|
||||
if vins_id, ok := d.GetOk("vins_id"); ok {
|
||||
req.VINSID = uint64(vins_id.(int))
|
||||
}
|
||||
|
||||
if page, ok := d.GetOk("page"); ok {
|
||||
req.Page = uint64(page.(int))
|
||||
}
|
||||
|
||||
if size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(size.(int))
|
||||
}
|
||||
|
||||
listVins, err := c.CloudAPI().RG().ListVINS(ctx, req)
|
||||
|
||||
Reference in New Issue
Block a user