4.3.0
This commit is contained in:
@@ -50,6 +50,7 @@ func dataSourceExtnetListRead(ctx context.Context, d *schema.ResourceData, m int
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenExtnetList(extnetList))
|
||||
d.Set("entry_count", extnetList.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -59,7 +60,36 @@ func dataSourceExtnetListSchemaMake() map[string]*schema.Schema {
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "filter by account ID",
|
||||
Description: "Find by account ID",
|
||||
},
|
||||
"by_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by ID",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by name",
|
||||
},
|
||||
"network": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
"vlan_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by VLAN ID",
|
||||
},
|
||||
"vnfdev_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by VnfDEV ID",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by status",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
@@ -91,6 +121,10 @@ func dataSourceExtnetListSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
func flattenExtnet(d *schema.ResourceData, e *extnet.RecordExtNet) {
|
||||
d.Set("ckey", e.CKey)
|
||||
d.Set("meta", flattens.FlattenMeta(e.Meta))
|
||||
d.Set("check_ips", e.CheckIps)
|
||||
d.Set("check_ips", e.CheckIPs)
|
||||
d.Set("default", e.Default)
|
||||
d.Set("default_qos", flattenExtnetDefaultQos(e.DefaultQOS))
|
||||
d.Set("desc", e.Description)
|
||||
@@ -105,9 +105,9 @@ func flattenExtnetsComputes(ecs extnet.ListExtNetExtends) []map[string]interface
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenExtnetComputesList(ecl extnet.ListExtNetComputes) []map[string]interface{} {
|
||||
func flattenExtnetComputesList(ecl *extnet.ListExtNetComputes) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, ec := range ecl {
|
||||
for _, ec := range ecl.Data {
|
||||
temp := map[string]interface{}{
|
||||
"account_id": ec.AccountID,
|
||||
"account_name": ec.AccountName,
|
||||
@@ -122,9 +122,9 @@ func flattenExtnetComputesList(ecl extnet.ListExtNetComputes) []map[string]inter
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenExtnetList(el extnet.ListExtNets) []map[string]interface{} {
|
||||
func flattenExtnetList(el *extnet.ListExtNets) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, e := range el {
|
||||
for _, e := range el.Data {
|
||||
temp := map[string]interface{}{
|
||||
"net_id": e.ID,
|
||||
"ipcidr": e.IPCIDR,
|
||||
|
||||
@@ -42,7 +42,7 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilityExtnetComputesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (extnet.ListExtNetComputes, error) {
|
||||
func utilityExtnetComputesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*extnet.ListExtNetComputes, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := extnet.ListComputesRequest{
|
||||
AccountID: uint64(d.Get("account_id").(int)),
|
||||
|
||||
@@ -42,13 +42,31 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilityExtnetListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (extnet.ListExtNets, error) {
|
||||
func utilityExtnetListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*extnet.ListExtNets, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := extnet.ListRequest{}
|
||||
|
||||
if accountId, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(accountId.(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 network, ok := d.GetOk("network"); ok {
|
||||
req.Network = network.(string)
|
||||
}
|
||||
if vlan_id, ok := d.GetOk("vlan_id"); ok {
|
||||
req.VLANID = uint64(vlan_id.(int))
|
||||
}
|
||||
if vnfdev_id, ok := d.GetOk("vnfdev_id"); ok {
|
||||
req.VNFDevID = uint64(vnfdev_id.(int))
|
||||
}
|
||||
if status, ok := d.GetOk("status"); ok {
|
||||
req.Status = status.(string)
|
||||
}
|
||||
if page, ok := d.GetOk("page"); ok {
|
||||
req.Page = uint64(page.(int))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user