4.11.0
This commit is contained in:
@@ -4,14 +4,11 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/pcidevice"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||
)
|
||||
|
||||
func flattenPcidevice(d *schema.ResourceData, pd *pcidevice.ItemPCIDevice) {
|
||||
log.Debugf("flattenPCIDevice: ID %d", pd.ID)
|
||||
|
||||
d.Set("ckey", pd.CKey)
|
||||
d.Set("meta", flattens.FlattenMeta(pd.Meta))
|
||||
d.Set("compute_id", pd.ComputeID)
|
||||
d.Set("description", pd.Description)
|
||||
d.Set("guid", pd.GUID)
|
||||
@@ -19,7 +16,7 @@ func flattenPcidevice(d *schema.ResourceData, pd *pcidevice.ItemPCIDevice) {
|
||||
d.Set("device_id", pd.ID)
|
||||
d.Set("name", pd.Name)
|
||||
d.Set("rg_id", pd.RGID)
|
||||
d.Set("stack_id", pd.StackID)
|
||||
d.Set("node_id", pd.NodeID)
|
||||
d.Set("status", pd.Status)
|
||||
d.Set("system_name", pd.SystemName)
|
||||
}
|
||||
@@ -30,8 +27,6 @@ func flattenPcideviceList(pl *pcidevice.ListPCIDevices) []map[string]interface{}
|
||||
res := make([]map[string]interface{}, 0, len(pl.Data))
|
||||
for _, item := range pl.Data {
|
||||
temp := map[string]interface{}{
|
||||
"ckey": item.CKey,
|
||||
"meta": flattens.FlattenMeta(item.Meta),
|
||||
"compute_id": item.ComputeID,
|
||||
"description": item.Description,
|
||||
"guid": item.GUID,
|
||||
@@ -39,7 +34,7 @@ func flattenPcideviceList(pl *pcidevice.ListPCIDevices) []map[string]interface{}
|
||||
"device_id": item.ID,
|
||||
"rg_id": item.RGID,
|
||||
"name": item.Name,
|
||||
"stack_id": item.StackID,
|
||||
"node_id": item.NodeID,
|
||||
"status": item.Status,
|
||||
"system_name": item.SystemName,
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ import (
|
||||
func checkParamsExistence(ctx context.Context, d *schema.ResourceData, c *controller.ControllerCfg) diag.Diagnostics {
|
||||
var errs []error
|
||||
|
||||
stackId := uint64(d.Get("stack_id").(int))
|
||||
nodeId := uint64(d.Get("node_id").(int))
|
||||
rgId := uint64(d.Get("rg_id").(int))
|
||||
|
||||
if err := ic.ExistRG(ctx, rgId, c); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
if err := ic.ExistStack(ctx, stackId, c); err != nil {
|
||||
if err := ic.ExistNode(ctx, nodeId, c); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ func resourcePcideviceCreate(ctx context.Context, d *schema.ResourceData, m inte
|
||||
return diags
|
||||
}
|
||||
|
||||
createReq.StackID = uint64(d.Get("stack_id").(int))
|
||||
createReq.NodeID = uint64(d.Get("node_id").(int))
|
||||
createReq.RGID = uint64(d.Get("rg_id").(int))
|
||||
createReq.Name = d.Get("name").(string)
|
||||
createReq.HWPath = d.Get("hw_path").(string)
|
||||
|
||||
@@ -11,17 +11,6 @@ func dataSourcePcideviceSchemaMake() 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,
|
||||
},
|
||||
},
|
||||
"compute_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -46,7 +35,7 @@ func dataSourcePcideviceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": {
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
@@ -109,17 +98,6 @@ func dataSourcePcideviceListSchemaMake() 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,
|
||||
},
|
||||
},
|
||||
"compute_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -144,7 +122,7 @@ func dataSourcePcideviceListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": {
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
@@ -170,11 +148,11 @@ func dataSourcePcideviceListSchemaMake() map[string]*schema.Schema {
|
||||
|
||||
func resourcePcideviceSchemaMake() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{
|
||||
"stack_id": {
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "stackId",
|
||||
Description: "Node ID",
|
||||
},
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
|
||||
Reference in New Issue
Block a user