a lot of refactoring and fixes
This commit is contained in:
@@ -64,7 +64,7 @@ func flattenPcideviceList(pl PcideviceList) []map[string]interface{} {
|
||||
}
|
||||
|
||||
func dataSourcePcideviceListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
pcideviceList, err := utilityPcideviceListCheckPresence(ctx, d, m)
|
||||
pcideviceList, err := utilityPcideviceListCheckPresence(ctx, m)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
@@ -115,18 +115,6 @@ func resourcePcideviceDelete(ctx context.Context, d *schema.ResourceData, m inte
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourcePcideviceExists(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
pcidevice, err := utilityPcideviceCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if pcidevice == nil {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func resourcePcideviceEdit(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
if d.HasChange("enable") {
|
||||
state := d.Get("enable").(bool)
|
||||
|
||||
@@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
func utilityPcideviceCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*Pcidevice, error) {
|
||||
pcideviceList, err := utilityPcideviceListCheckPresence(ctx, d, m)
|
||||
pcideviceList, err := utilityPcideviceListCheckPresence(ctx, m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -36,11 +36,10 @@ import (
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityPcideviceListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (PcideviceList, error) {
|
||||
func utilityPcideviceListCheckPresence(ctx context.Context, m interface{}) (PcideviceList, error) {
|
||||
pcideviceList := PcideviceList{}
|
||||
c := m.(*controller.ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
Reference in New Issue
Block a user