4.9.0
This commit is contained in:
@@ -18,6 +18,7 @@ func flattenResourceAccount(d *schema.ResourceData, acc *account.RecordAccount)
|
||||
d.Set("created_by", acc.CreatedBy)
|
||||
d.Set("created_time", acc.CreatedTime)
|
||||
d.Set("deactivation_time", acc.DeactivationTime)
|
||||
d.Set("desc", acc.Description)
|
||||
d.Set("deleted_by", acc.DeletedBy)
|
||||
d.Set("deleted_time", acc.DeletedTime)
|
||||
d.Set("displayname", acc.DisplayName)
|
||||
@@ -46,6 +47,7 @@ func flattenDataAccount(d *schema.ResourceData, acc *account.RecordAccount) {
|
||||
d.Set("created_by", acc.CreatedBy)
|
||||
d.Set("created_time", acc.CreatedTime)
|
||||
d.Set("deactivation_time", acc.DeactivationTime)
|
||||
d.Set("desc", acc.Description)
|
||||
d.Set("deleted_by", acc.DeletedBy)
|
||||
d.Set("deleted_time", acc.DeletedTime)
|
||||
d.Set("displayname", acc.DisplayName)
|
||||
@@ -71,6 +73,7 @@ func flattenAccountRGList(argl *account.ListRG) []map[string]interface{} {
|
||||
"resources": flattenAccRGResources(arg.Resources),
|
||||
"created_by": arg.CreatedBy,
|
||||
"created_time": arg.CreatedTime,
|
||||
"desc": arg.Description,
|
||||
"deleted_by": arg.DeletedBy,
|
||||
"deleted_time": arg.DeletedTime,
|
||||
"rg_id": arg.ID,
|
||||
@@ -204,6 +207,7 @@ func flattenListDeleted(al *account.ListAccounts) []map[string]interface{} {
|
||||
"created_by": acc.CreatedBy,
|
||||
"created_time": acc.CreatedTime,
|
||||
"deactivation_time": acc.DeactivationTime,
|
||||
"desc": acc.Description,
|
||||
"deleted_by": acc.DeletedBy,
|
||||
"deleted_time": acc.DeletedTime,
|
||||
"displayname": acc.DisplayName,
|
||||
@@ -240,6 +244,7 @@ func flattenAccountList(al *account.ListAccounts) []map[string]interface{} {
|
||||
"created_by": acc.CreatedBy,
|
||||
"created_time": acc.CreatedTime,
|
||||
"deactivation_time": acc.DeactivationTime,
|
||||
"desc": acc.Description,
|
||||
"deleted_by": acc.DeletedBy,
|
||||
"deleted_time": acc.DeletedTime,
|
||||
"displayname": acc.DisplayName,
|
||||
|
||||
@@ -55,6 +55,10 @@ func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
Username: d.Get("username").(string),
|
||||
}
|
||||
|
||||
if desc, ok := d.GetOk("desc"); ok {
|
||||
req.Description = desc.(string)
|
||||
}
|
||||
|
||||
if emailaddress, ok := d.GetOk("emailaddress"); ok {
|
||||
req.EmailAddress = emailaddress.(string)
|
||||
}
|
||||
@@ -196,6 +200,7 @@ func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
if !d.Get("enable").(bool) {
|
||||
_, err := c.CloudBroker().Account().Disable(ctx, account.DisableRequest{
|
||||
AccountID: accountId,
|
||||
Reason: d.Get("reason").(string),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@@ -239,6 +244,8 @@ func resourceAccountDelete(ctx context.Context, d *schema.ResourceData, m interf
|
||||
req := account.DeleteRequest{
|
||||
AccountID: accountData.ID,
|
||||
Permanently: d.Get("permanently").(bool),
|
||||
Name: d.Get("account_name").(string),
|
||||
Reason: d.Get("reason").(string),
|
||||
}
|
||||
|
||||
_, err = c.CloudBroker().Account().Delete(ctx, req)
|
||||
@@ -277,6 +284,7 @@ func resourceAccountUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
if d.Get("restore").(bool) {
|
||||
_, err := c.CloudBroker().Account().Restore(ctx, account.RestoreRequest{
|
||||
AccountID: accountId,
|
||||
Reason: d.Get("reason").(string),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@@ -308,7 +316,7 @@ func resourceAccountUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if d.HasChanges("account_name", "send_access_emails", "uniq_pools", "resource_limits") {
|
||||
if d.HasChanges("account_name", "send_access_emails", "uniq_pools", "resource_limits", "desc") {
|
||||
if err := utilityAccountUpdate(ctx, d, m); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
@@ -17,6 +17,11 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
Description: "username of owner the account",
|
||||
},
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "description",
|
||||
},
|
||||
"emailaddress": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
@@ -72,6 +77,11 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
Description: "Share images with account",
|
||||
},
|
||||
"reason": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Description: "reason for restore or deactivation",
|
||||
},
|
||||
"restore": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
@@ -138,7 +148,7 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
ValidateFunc: validation.StringInSlice([]string{"hugepages", "numa", "cpupin", "vfnic"}, true),
|
||||
ValidateFunc: validation.StringInSlice([]string{"hugepages", "numa", "cpupin", "vfnic", "dpdk", "changemac"}, true),
|
||||
},
|
||||
},
|
||||
"account_id": {
|
||||
@@ -576,6 +586,10 @@ func dataSourceAccountListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -1214,6 +1228,10 @@ func dataSourceAccountListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -1710,6 +1728,10 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -1973,6 +1995,10 @@ func dataSourceAccountSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -218,6 +218,10 @@ func utilityAccountUpdate(ctx context.Context, d *schema.ResourceData, m interfa
|
||||
req.Name = d.Get("account_name").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("desc") {
|
||||
req.Description = d.Get("desc").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("send_access_emails") {
|
||||
req.SendAccessEmails = d.Get("send_access_emails").(bool)
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ func flattenAudit(d *schema.ResourceData, au *audit.RecordAudit) {
|
||||
d.Set("tags", au.Tags)
|
||||
d.Set("timestamp", au.Timestamp)
|
||||
d.Set("timestamp_end", au.TimestampEnd)
|
||||
d.Set("ttl", au.TTL)
|
||||
d.Set("user", au.User)
|
||||
}
|
||||
|
||||
@@ -59,12 +60,19 @@ func flattenAuditList(au *audit.ListAudits) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(au.Data))
|
||||
for _, item := range au.Data {
|
||||
temp := map[string]interface{}{
|
||||
"call": item.Call,
|
||||
"guid": item.GUID,
|
||||
"responsetime": item.ResponseTime,
|
||||
"status_code": item.StatusCode,
|
||||
"timestamp": item.Timestamp,
|
||||
"user": item.User,
|
||||
"args": item.Args,
|
||||
"call": item.Call,
|
||||
"guid": item.GUID,
|
||||
"kwargs": item.Kwargs,
|
||||
"remote_addr": item.RemoteAddr,
|
||||
"result": item.Result,
|
||||
"responsetime": item.ResponseTime,
|
||||
"status_code": item.StatusCode,
|
||||
"tags": item.Tags,
|
||||
"timestamp": item.Timestamp,
|
||||
"timestamp_end": item.TimestampEnd,
|
||||
"ttl": item.TTL,
|
||||
"user": item.User,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
@@ -76,14 +84,15 @@ func flattenLinkedJobs(ljl *audit.ListLinkedJobs) []map[string]interface{} {
|
||||
linkedJobs := *ljl
|
||||
for _, item := range linkedJobs {
|
||||
temp := map[string]interface{}{
|
||||
"cmd": item.CMD,
|
||||
"guid": item.GUID,
|
||||
"nid": item.NID,
|
||||
"state": item.State,
|
||||
"time_create": item.TimeCreate,
|
||||
"time_start": item.TimeStart,
|
||||
"time_stop": item.TimeStop,
|
||||
"timeout": item.Timeout,
|
||||
"cmd": item.CMD,
|
||||
"guid": item.GUID,
|
||||
"nid": item.NID,
|
||||
"physical_node": item.PhysicalNode,
|
||||
"state": item.State,
|
||||
"time_create": item.TimeCreate,
|
||||
"time_start": item.TimeStart,
|
||||
"time_stop": item.TimeStop,
|
||||
"timeout": item.Timeout,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
|
||||
@@ -54,6 +54,10 @@ func dataSourceAuditSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"ttl": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"user": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -103,12 +107,16 @@ func dataSourceAuditListSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "page number",
|
||||
},
|
||||
"request_id": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "request id",
|
||||
},
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "page size",
|
||||
},
|
||||
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -138,6 +146,34 @@ func dataSourceAuditListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"ttl": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"args": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"kwargs": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"result": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"timestamp_end": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"remote_addr": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"tags": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -177,6 +213,10 @@ func dataSourceLinkedJobsSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "nid",
|
||||
},
|
||||
"physical_node": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"state": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -70,6 +70,9 @@ func utilityAuditListCheckPresence(ctx context.Context, d *schema.ResourceData,
|
||||
if Page, ok := d.GetOk("page"); ok {
|
||||
req.Page = uint64(Page.(int))
|
||||
}
|
||||
if RequestID, ok := d.GetOk("request_id"); ok {
|
||||
req.RequestID = RequestID.(string)
|
||||
}
|
||||
if Size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(Size.(int))
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
d.Set("acl", string(diskAcl))
|
||||
d.Set("boot_partition", disk.BootPartition)
|
||||
d.Set("computes", flattenDiskComputes(disk.Computes))
|
||||
d.Set("created_by", disk.CreatedBy)
|
||||
d.Set("created_time", disk.CreatedTime)
|
||||
d.Set("deleted_by", disk.DeletedBy)
|
||||
d.Set("deleted_time", disk.DeletedTime)
|
||||
d.Set("desc", disk.Description)
|
||||
d.Set("destruction_time", disk.DestructionTime)
|
||||
@@ -29,6 +31,8 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
d.Set("iotune", flattenIOTune(disk.IOTune))
|
||||
d.Set("iqn", disk.IQN)
|
||||
d.Set("login", disk.Login)
|
||||
d.Set("machine_id", disk.MachineID)
|
||||
d.Set("machine_name", disk.MachineName)
|
||||
d.Set("milestones", disk.Milestones)
|
||||
d.Set("disk_name", disk.Name)
|
||||
d.Set("order", disk.Order)
|
||||
@@ -49,6 +53,7 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
d.Set("sep_id", disk.SEPID)
|
||||
d.Set("sep_type", disk.SEPType)
|
||||
d.Set("shareable", disk.Shareable)
|
||||
d.Set("size_available", disk.SizeAvailable)
|
||||
d.Set("size_max", disk.SizeMax)
|
||||
d.Set("size_used", disk.SizeUsed)
|
||||
d.Set("snapshots", flattendDiskSnapshotList(disk.Snapshots))
|
||||
@@ -56,6 +61,8 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
d.Set("tech_status", disk.TechStatus)
|
||||
d.Set("type", disk.Type)
|
||||
d.Set("vmid", disk.VMID)
|
||||
d.Set("updated_by", disk.UpdatedBy)
|
||||
d.Set("updated_time", disk.UpdatedTime)
|
||||
}
|
||||
|
||||
func flattenDiskReplica(d *schema.ResourceData, disk *disks.RecordDisk, statusReplication string) {
|
||||
@@ -176,7 +183,9 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} {
|
||||
"acl": string(diskAcl),
|
||||
"boot_partition": disk.BootPartition,
|
||||
"computes": flattenDiskComputes(disk.Computes),
|
||||
"created_by": disk.CreatedBy,
|
||||
"created_time": disk.CreatedTime,
|
||||
"deleted_by": disk.DeletedBy,
|
||||
"deleted_time": disk.DeletedTime,
|
||||
"desc": disk.Description,
|
||||
"destruction_time": disk.DestructionTime,
|
||||
@@ -210,6 +219,7 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} {
|
||||
"role": disk.Role,
|
||||
"sep_id": disk.SEPID,
|
||||
"sep_type": disk.SEPType,
|
||||
"size_available": disk.SizeAvailable,
|
||||
"size_max": disk.SizeMax,
|
||||
"size_used": disk.SizeUsed,
|
||||
"snapshots": flattendDiskSnapshotList(disk.Snapshots),
|
||||
@@ -217,6 +227,8 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} {
|
||||
"tech_status": disk.TechStatus,
|
||||
"type": disk.Type,
|
||||
"vmid": disk.VMID,
|
||||
"updated_by": disk.UpdatedBy,
|
||||
"updated_time": disk.UpdatedTime,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/dc"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/ic"
|
||||
@@ -14,15 +15,10 @@ func checkParamsExistence(ctx context.Context, d *schema.ResourceData, c *contro
|
||||
var errs []error
|
||||
|
||||
accountID := uint64(d.Get("account_id").(int))
|
||||
gid := uint64(d.Get("gid").(int))
|
||||
|
||||
if err := ic.ExistAccount(ctx, accountID, c); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
if err := ic.ExistGID(ctx, gid, c); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
return dc.ErrorsToDiagnostics(errs)
|
||||
}
|
||||
|
||||
@@ -58,20 +58,14 @@ func resourceDiskCreate(ctx context.Context, d *schema.ResourceData, m interface
|
||||
|
||||
req := disks.CreateRequest{
|
||||
AccountID: uint64(d.Get("account_id").(int)),
|
||||
GID: uint64(d.Get("gid").(int)),
|
||||
Name: d.Get("disk_name").(string),
|
||||
Size: uint64(d.Get("size_max").(int)),
|
||||
Type: d.Get("type").(string),
|
||||
}
|
||||
|
||||
if desc, ok := d.GetOk("desc"); ok {
|
||||
req.Description = desc.(string)
|
||||
}
|
||||
|
||||
if ssdSize, ok := d.GetOk("ssd_size"); ok {
|
||||
req.SSDSize = uint64(ssdSize.(int))
|
||||
}
|
||||
|
||||
if iops, ok := d.GetOk("iops"); ok {
|
||||
req.IOPS = uint64(iops.(int))
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package disks
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||
)
|
||||
|
||||
func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
@@ -43,10 +42,18 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -154,6 +161,14 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"machine_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"machine_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -187,7 +202,7 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -266,6 +281,10 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"size_available": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"size_max": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -326,6 +345,14 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
@@ -435,10 +462,18 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -591,7 +626,7 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -670,6 +705,10 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"size_available": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"size_max": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -730,6 +769,14 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -830,10 +877,18 @@ func dataSourceDiskListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -986,7 +1041,7 @@ func dataSourceDiskListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -1065,6 +1120,10 @@ func dataSourceDiskListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"size_available": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"size_max": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1125,6 +1184,14 @@ func dataSourceDiskListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1505,7 +1572,7 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema {
|
||||
Description: "Pool for disk location",
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -1796,22 +1863,18 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
//ForceNew: true,
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
//ForceNew: true,
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"disk_name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
},
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"D", "B", "T"}, false),
|
||||
Description: "The type of disk in terms of its role in compute: 'B=Boot, D=Data, T=Temp'",
|
||||
},
|
||||
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
@@ -1821,9 +1884,10 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
},
|
||||
"ssd_size": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "The type of disk in terms of its role in compute: 'B=Boot, D=Data, T=Temp'",
|
||||
},
|
||||
"iops": {
|
||||
Type: schema.TypeInt,
|
||||
@@ -1922,6 +1986,10 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"disk_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -2020,11 +2088,18 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"machine_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"machine_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"order": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -2046,7 +2121,7 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -2169,6 +2244,14 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
@@ -2367,7 +2450,7 @@ func dataSourceDiskReplicationSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -2741,7 +2824,7 @@ func resourceDiskReplicationSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
|
||||
@@ -85,6 +85,7 @@ func flattenRecordExtnet(d *schema.ResourceData, recNet *extnet.RecordExtNet) {
|
||||
d.Set("milestones", recNet.Milestones)
|
||||
d.Set("name", recNet.Name)
|
||||
d.Set("network_id", recNet.NetworkID)
|
||||
d.Set("ntp", recNet.NTP)
|
||||
d.Set("ovs_bridge", recNet.OVSBridge)
|
||||
d.Set("pre_reservations_num", recNet.PreReservationsNum)
|
||||
d.Set("pri_vnfdev_id", recNet.PriVNFDevID)
|
||||
|
||||
@@ -516,6 +516,13 @@ func dataSourceExtnetSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"ntp": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/image"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/ic"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/status"
|
||||
)
|
||||
|
||||
@@ -53,12 +52,6 @@ func resourceCDROMImageCreate(ctx context.Context, d *schema.ResourceData, m int
|
||||
URL: d.Get("url").(string),
|
||||
}
|
||||
|
||||
if err := ic.ExistGID(ctx, uint64(d.Get("gid").(int)), c); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
req.GID = uint64(d.Get("gid").(int))
|
||||
|
||||
drivers := []string{}
|
||||
for _, driver := range d.Get("drivers").([]interface{}) {
|
||||
drivers = append(drivers, driver.(string))
|
||||
|
||||
@@ -354,41 +354,47 @@ func resourceImageChangeAccess(ctx context.Context, d *schema.ResourceData, m in
|
||||
oldSet, newSet := d.GetChange("accounts")
|
||||
|
||||
revokeAccess := (oldSet.(*schema.Set).Difference(newSet.(*schema.Set))).List()
|
||||
if len(revokeAccess) > 0 {
|
||||
revokeAccounts := make([]uint64, 0, len(revokeAccess))
|
||||
revokeAccounts := make([]int64, 0, len(revokeAccess))
|
||||
if newSet.(*schema.Set).Len() == 0 {
|
||||
revokeAccounts = append(revokeAccounts, -1)
|
||||
} else if len(revokeAccess) > 0 {
|
||||
for _, accountId := range revokeAccess {
|
||||
revokeAccounts = append(revokeAccounts, uint64(accountId.(int)))
|
||||
revokeAccounts = append(revokeAccounts, accountId.(int64))
|
||||
}
|
||||
|
||||
req := image.RevokeAccessRequest{
|
||||
ImageID: imageId,
|
||||
AccountIDs: revokeAccounts,
|
||||
}
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Image().RevokeAccess(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req := image.RevokeAccessRequest{
|
||||
ImageID: imageId,
|
||||
AccountIDs: revokeAccounts,
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Image().RevokeAccess(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
addedAccess := (newSet.(*schema.Set).Difference(oldSet.(*schema.Set))).List()
|
||||
if len(addedAccess) > 0 {
|
||||
grantAccounts := make([]uint64, 0, len(addedAccess))
|
||||
grantAccounts := make([]int64, 0, len(addedAccess))
|
||||
if newSet.(*schema.Set).Len() == 0 {
|
||||
grantAccounts = append(grantAccounts, -1)
|
||||
} else if len(addedAccess) > 0 {
|
||||
for _, accountId := range addedAccess {
|
||||
grantAccounts = append(grantAccounts, uint64(accountId.(int)))
|
||||
grantAccounts = append(grantAccounts, accountId.(int64))
|
||||
}
|
||||
|
||||
req := image.GrantAccessRequest{
|
||||
ImageID: imageId,
|
||||
AccountIDs: grantAccounts,
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Image().GrantAccess(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// req := image.GrantAccessRequest{
|
||||
// ImageID: imageId,
|
||||
// AccountIDs: grantAccounts,
|
||||
// }
|
||||
|
||||
// _, err := c.CloudBroker().Image().GrantAccess(ctx, req)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -399,9 +405,9 @@ func resourceImageSetAccess(ctx context.Context, d *schema.ResourceData, m inter
|
||||
imageId, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
|
||||
accounts := d.Get("accounts").([]interface{})
|
||||
accountIDs := make([]uint64, 0, len(accounts))
|
||||
accountIDs := make([]int64, 0, len(accounts))
|
||||
for _, accountId := range accounts {
|
||||
accountIDs = append(accountIDs, uint64(accountId.(int)))
|
||||
accountIDs = append(accountIDs, accountId.(int64))
|
||||
}
|
||||
|
||||
req := image.GrantAccessRequest{
|
||||
|
||||
@@ -74,9 +74,6 @@ func resourceImageFromBlankComputeCreate(ctx context.Context, d *schema.Resource
|
||||
if accountId, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(accountId.(int))
|
||||
}
|
||||
if sepId, ok := d.GetOk("sep_id"); ok {
|
||||
req.SepID = uint64(sepId.(int))
|
||||
}
|
||||
if poolName, ok := d.GetOk("pool_name"); ok {
|
||||
req.PoolName = poolName.(string)
|
||||
}
|
||||
|
||||
@@ -76,9 +76,6 @@ func resourceImageFromPlatformDiskCreate(ctx context.Context, d *schema.Resource
|
||||
if accountId, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(accountId.(int))
|
||||
}
|
||||
if sepId, ok := d.GetOk("sep_id"); ok {
|
||||
req.SepID = uint64(sepId.(int))
|
||||
}
|
||||
if poolName, ok := d.GetOk("pool_name"); ok {
|
||||
req.PoolName = poolName.(string)
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ func dataSourceImageListSchemaMake() map[string]*schema.Schema {
|
||||
Description: "pool for image create",
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -832,7 +832,7 @@ func dataSourceImageSchemaMake() map[string]*schema.Schema {
|
||||
Description: "pool for image create",
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -930,11 +930,6 @@ func resourceCDROMImageSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
Description: "URL where to download ISO from",
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "grid (platform) ID where this template should be create in",
|
||||
},
|
||||
"drivers": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
@@ -1068,6 +1063,10 @@ func resourceCDROMImageSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "Boot type of image bios or uefi",
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1128,7 +1127,7 @@ func resourceCDROMImageSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -1200,11 +1199,6 @@ func resourceImageSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "path to image file",
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "grid (platform) ID where this template should be create in",
|
||||
},
|
||||
"boot_type": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
@@ -1365,6 +1359,10 @@ func resourceImageSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1424,7 +1422,7 @@ func resourceImageSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -1669,7 +1667,7 @@ func resourceVirtualImageSchemaMake() map[string]*schema.Schema {
|
||||
Description: "pool for image create",
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -1763,8 +1761,8 @@ func resourceImageFromBlankComputeSchemaMake() map[string]*schema.Schema {
|
||||
"image_type": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "other"}, true),
|
||||
Description: "Image type linux, windows or other",
|
||||
ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "unknown"}, true),
|
||||
Description: "Image type linux, windows or unknown",
|
||||
},
|
||||
|
||||
"username": {
|
||||
@@ -1787,7 +1785,6 @@ func resourceImageFromBlankComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "storage endpoint provider ID",
|
||||
},
|
||||
@@ -1966,7 +1963,7 @@ func resourceImageFromBlankComputeSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -2037,8 +2034,8 @@ func resourceImageFromPlatformDiskSchemaMake() map[string]*schema.Schema {
|
||||
"image_type": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "other"}, true),
|
||||
Description: "Image type linux, windows or other",
|
||||
ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "unknown"}, true),
|
||||
Description: "Image type linux, windows or unknown",
|
||||
},
|
||||
"architecture": {
|
||||
Type: schema.TypeString,
|
||||
@@ -2067,7 +2064,6 @@ func resourceImageFromPlatformDiskSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "storage endpoint provider ID",
|
||||
},
|
||||
@@ -2245,7 +2241,7 @@ func resourceImageFromPlatformDiskSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
|
||||
@@ -36,8 +36,6 @@ import (
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/image"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/ic"
|
||||
)
|
||||
|
||||
func SyncCreateRequest(ctx context.Context, d *schema.ResourceData, m interface{}, url string) (image.SyncCreateRequest, error) {
|
||||
@@ -100,14 +98,6 @@ func CreateRequest(ctx context.Context, d *schema.ResourceData, m interface{}, u
|
||||
ImageType: d.Get("image_type").(string),
|
||||
}
|
||||
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
if err := ic.ExistGID(ctx, uint64(d.Get("gid").(int)), c); err != nil {
|
||||
return req, err
|
||||
}
|
||||
|
||||
req.GID = uint64(d.Get("gid").(int))
|
||||
|
||||
if _, ok := d.GetOk("drivers"); ok {
|
||||
drivers := []string{}
|
||||
for _, driver := range d.Get("drivers").([]interface{}) {
|
||||
|
||||
@@ -50,6 +50,7 @@ func flattenResourceK8sCP(d *schema.ResourceData, k8s k8s.RecordK8S, masters []c
|
||||
d.Set("bservice_id", k8s.BServiceID)
|
||||
d.Set("created_by", k8s.CreatedBy)
|
||||
d.Set("created_time", k8s.CreatedTime)
|
||||
d.Set("desc", k8s.Description)
|
||||
d.Set("deleted_by", k8s.DeletedBy)
|
||||
d.Set("deleted_time", k8s.DeletedTime)
|
||||
d.Set("k8s_ci_name", k8s.K8CIName)
|
||||
@@ -91,6 +92,7 @@ func flattenK8sData(d *schema.ResourceData, cluster *k8s.RecordK8S, masters []co
|
||||
d.Set("created_time", cluster.CreatedTime)
|
||||
d.Set("deleted_by", cluster.DeletedBy)
|
||||
d.Set("deleted_time", cluster.DeletedTime)
|
||||
d.Set("desc", cluster.Description)
|
||||
d.Set("k8s_id", cluster.ID)
|
||||
d.Set("k8s_ci_name", cluster.K8CIName)
|
||||
d.Set("k8s_groups", flattenK8sGroups(cluster.K8SGroups, masters, workers))
|
||||
|
||||
@@ -51,12 +51,12 @@ func dataSourceComputeListDeletedRead(ctx context.Context, d *schema.ResourceDat
|
||||
result := computeList
|
||||
if d.Get("ignore_k8s").(bool) {
|
||||
// matches automatically generated names like "s234-g2134-c1" etc
|
||||
result = matchComputes(computeList)
|
||||
result = matchDeletedComputes(computeList)
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenComputeList(result))
|
||||
d.Set("items", flattenDeletedComputeList(result))
|
||||
d.Set("entry_count", computeList.EntryCount)
|
||||
|
||||
return nil
|
||||
|
||||
@@ -75,7 +75,7 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p
|
||||
d.Set("need_reboot", computeRec.NeedReboot)
|
||||
d.Set("numa_node_id", computeRec.NumaNodeId)
|
||||
d.Set("os_users", flattenOSUsers(computeRec.OSUsers))
|
||||
d.Set("pinned", computeRec.Pinned)
|
||||
d.Set("pinned", computeRec.PinnedToStack)
|
||||
d.Set("preferred_cpu", computeRec.PreferredCPU)
|
||||
d.Set("reference_id", computeRec.ReferenceID)
|
||||
d.Set("registered", computeRec.Registered)
|
||||
@@ -95,10 +95,14 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p
|
||||
d.Set("user_data", string(userData))
|
||||
d.Set("user_managed", computeRec.UserManaged)
|
||||
d.Set("vnc_password", computeRec.VNCPassword)
|
||||
d.Set("vgpus", computeRec.VGPUs)
|
||||
d.Set("vgpus", flattenVGPUs(computeRec.VGPUs))
|
||||
d.Set("virtual_image_id", computeRec.VirtualImageID)
|
||||
d.Set("virtual_image_name", computeRec.VirtualImageName)
|
||||
d.Set("pci_devices", flattenPCI(*pciList))
|
||||
d.Set("loader_type", computeRec.LoaderType)
|
||||
d.Set("boot_type", computeRec.BootType)
|
||||
d.Set("hot_resize", computeRec.HotResize)
|
||||
d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -249,6 +253,7 @@ func flattenComputeDisks(disksList compute.ListDisks, disksBlocks, extraDisks []
|
||||
"size_used": disk.SizeUsed,
|
||||
"size_max": disk.SizeMax,
|
||||
"permanently": pernamentlyValue,
|
||||
"present_to": disk.PresentTo,
|
||||
}
|
||||
res = append(res, temp)
|
||||
indexDataDisks++
|
||||
@@ -289,73 +294,164 @@ func flattenComputeList(computes *compute.ListComputes) []map[string]interface{}
|
||||
devices, _ := json.Marshal(computeItem.Devices)
|
||||
userData, _ := json.Marshal(computeItem.Userdata)
|
||||
temp := map[string]interface{}{
|
||||
"acl": flattenListACLInterface(computeItem.ACL),
|
||||
"account_id": computeItem.AccountID,
|
||||
"account_name": computeItem.AccountName,
|
||||
"affinity_label": computeItem.AffinityLabel,
|
||||
"affinity_rules": flattenListRules(computeItem.AffinityRules),
|
||||
"affinity_weight": computeItem.AffinityWeight,
|
||||
"anti_affinity_rules": flattenListRules(computeItem.AntiAffinityRules),
|
||||
"arch": computeItem.Arch,
|
||||
"auto_start_w_node": computeItem.AutoStart,
|
||||
"chipset": computeItem.Chipset,
|
||||
"cd_image_id": computeItem.CdImageId,
|
||||
"boot_order": computeItem.BootOrder,
|
||||
"bootdisk_size": computeItem.BootDiskSize,
|
||||
"clone_reference": computeItem.CloneReference,
|
||||
"clones": computeItem.Clones,
|
||||
"computeci_id": computeItem.ComputeCIID,
|
||||
"cpus": computeItem.CPUs,
|
||||
"created_by": computeItem.CreatedBy,
|
||||
"created_time": computeItem.CreatedTime,
|
||||
"custom_fields": string(customFields),
|
||||
"deleted_by": computeItem.DeletedBy,
|
||||
"deleted_time": computeItem.DeletedTime,
|
||||
"desc": computeItem.Description,
|
||||
"devices": string(devices),
|
||||
"disks": flattenDisks(computeItem.Disks),
|
||||
"driver": computeItem.Driver,
|
||||
"gid": computeItem.GID,
|
||||
"guid": computeItem.GUID,
|
||||
"hp_backed": computeItem.HPBacked,
|
||||
"compute_id": computeItem.ID,
|
||||
"cpu_pin": computeItem.CPUPin,
|
||||
"image_id": computeItem.ImageID,
|
||||
"interfaces": flattenInterfaces(computeItem.Interfaces),
|
||||
"lock_status": computeItem.LockStatus,
|
||||
"manager_id": computeItem.ManagerID,
|
||||
"manager_type": computeItem.ManagerType,
|
||||
"migrationjob": computeItem.MigrationJob,
|
||||
"milestones": computeItem.Milestones,
|
||||
"name": computeItem.Name,
|
||||
"need_reboot": computeItem.NeedReboot,
|
||||
"numa_affinity": computeItem.NumaAffinity,
|
||||
"numa_node_id": computeItem.NumaNodeId,
|
||||
"os_users": flattenOSUsers(computeItem.OSUsers),
|
||||
"pinned": computeItem.Pinned,
|
||||
"preferred_cpu": computeItem.PreferredCPU,
|
||||
"ram": computeItem.RAM,
|
||||
"reference_id": computeItem.ReferenceID,
|
||||
"registered": computeItem.Registered,
|
||||
"res_name": computeItem.ResName,
|
||||
"reserved_node_cpus": computeItem.ReservedNodeCpus,
|
||||
"rg_id": computeItem.RGID,
|
||||
"rg_name": computeItem.RGName,
|
||||
"snap_sets": flattenSnapSets(computeItem.SnapSets),
|
||||
"stack_id": computeItem.StackID,
|
||||
"stateless_sep_id": computeItem.StatelessSEPID,
|
||||
"stateless_sep_type": computeItem.StatelessSEPType,
|
||||
"status": computeItem.Status,
|
||||
"tags": flattenTags(computeItem.Tags),
|
||||
"tech_status": computeItem.TechStatus,
|
||||
"total_disk_size": computeItem.TotalDiskSize,
|
||||
"updated_by": computeItem.UpdatedBy,
|
||||
"updated_time": computeItem.UpdatedTime,
|
||||
"user_data": string(userData),
|
||||
"user_managed": computeItem.UserManaged,
|
||||
"vgpus": computeItem.VGPUs,
|
||||
"vins_connected": computeItem.VINSConnected,
|
||||
"virtual_image_id": computeItem.VirtualImageID,
|
||||
"acl": flattenListACLInterface(computeItem.ACL),
|
||||
"account_id": computeItem.AccountID,
|
||||
"account_name": computeItem.AccountName,
|
||||
"affinity_label": computeItem.AffinityLabel,
|
||||
"affinity_rules": flattenListRules(computeItem.AffinityRules),
|
||||
"affinity_weight": computeItem.AffinityWeight,
|
||||
"anti_affinity_rules": flattenListRules(computeItem.AntiAffinityRules),
|
||||
"arch": computeItem.Arch,
|
||||
"auto_start_w_node": computeItem.AutoStart,
|
||||
"chipset": computeItem.Chipset,
|
||||
"cd_image_id": computeItem.CdImageId,
|
||||
"boot_order": computeItem.BootOrder,
|
||||
"bootdisk_size": computeItem.BootDiskSize,
|
||||
"clone_reference": computeItem.CloneReference,
|
||||
"clones": computeItem.Clones,
|
||||
"computeci_id": computeItem.ComputeCIID,
|
||||
"cpus": computeItem.CPUs,
|
||||
"created_by": computeItem.CreatedBy,
|
||||
"created_time": computeItem.CreatedTime,
|
||||
"custom_fields": string(customFields),
|
||||
"deleted_by": computeItem.DeletedBy,
|
||||
"deleted_time": computeItem.DeletedTime,
|
||||
"desc": computeItem.Description,
|
||||
"devices": string(devices),
|
||||
"disks": flattenDisks(computeItem.Disks),
|
||||
"driver": computeItem.Driver,
|
||||
"gid": computeItem.GID,
|
||||
"guid": computeItem.GUID,
|
||||
"hp_backed": computeItem.HPBacked,
|
||||
"compute_id": computeItem.ID,
|
||||
"cpu_pin": computeItem.CPUPin,
|
||||
"image_id": computeItem.ImageID,
|
||||
"interfaces": flattenInterfaces(computeItem.Interfaces),
|
||||
"lock_status": computeItem.LockStatus,
|
||||
"manager_id": computeItem.ManagerID,
|
||||
"manager_type": computeItem.ManagerType,
|
||||
"migrationjob": computeItem.MigrationJob,
|
||||
"milestones": computeItem.Milestones,
|
||||
"nid": computeItem.NID,
|
||||
"name": computeItem.Name,
|
||||
"need_reboot": computeItem.NeedReboot,
|
||||
"numa_affinity": computeItem.NumaAffinity,
|
||||
"numa_node_id": computeItem.NumaNodeId,
|
||||
"os_users": flattenOSUsers(computeItem.OSUsers),
|
||||
"pinned": computeItem.PinnedToStack,
|
||||
"preferred_cpu": computeItem.PreferredCPU,
|
||||
"ram": computeItem.RAM,
|
||||
"reference_id": computeItem.ReferenceID,
|
||||
"registered": computeItem.Registered,
|
||||
"res_name": computeItem.ResName,
|
||||
"reserved_node_cpus": computeItem.ReservedNodeCpus,
|
||||
"rg_id": computeItem.RGID,
|
||||
"rg_name": computeItem.RGName,
|
||||
"snap_sets": flattenSnapSets(computeItem.SnapSets),
|
||||
"stack_id": computeItem.StackID,
|
||||
"stack_name": computeItem.StackName,
|
||||
"stateless_sep_id": computeItem.StatelessSEPID,
|
||||
"stateless_sep_type": computeItem.StatelessSEPType,
|
||||
"status": computeItem.Status,
|
||||
"tags": flattenTags(computeItem.Tags),
|
||||
"tech_status": computeItem.TechStatus,
|
||||
"total_disk_size": computeItem.TotalDiskSize,
|
||||
"updated_by": computeItem.UpdatedBy,
|
||||
"updated_time": computeItem.UpdatedTime,
|
||||
"user_data": string(userData),
|
||||
"user_managed": computeItem.UserManaged,
|
||||
"vgpus": computeItem.VGPUs,
|
||||
"vins_connected": computeItem.VINSConnected,
|
||||
"virtual_image_id": computeItem.VirtualImageID,
|
||||
"loader_type": computeItem.LoaderType,
|
||||
"boot_type": computeItem.BootType,
|
||||
"hot_resize": computeItem.HotResize,
|
||||
"network_interface_naming": computeItem.NetworkInterfaceNaming,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenDeletedComputeList(computes *compute.ListDeletedComputes) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(computes.Data))
|
||||
for _, computeItem := range computes.Data {
|
||||
customFields, _ := json.Marshal(computeItem.CustomFields)
|
||||
devices, _ := json.Marshal(computeItem.Devices)
|
||||
userData, _ := json.Marshal(computeItem.Userdata)
|
||||
temp := map[string]interface{}{
|
||||
"acl": flattenListACLInterface(computeItem.ACL),
|
||||
"account_id": computeItem.AccountID,
|
||||
"account_name": computeItem.AccountName,
|
||||
"affinity_label": computeItem.AffinityLabel,
|
||||
"affinity_rules": flattenListRules(computeItem.AffinityRules),
|
||||
"affinity_weight": computeItem.AffinityWeight,
|
||||
"anti_affinity_rules": flattenListRules(computeItem.AntiAffinityRules),
|
||||
"arch": computeItem.Arch,
|
||||
"auto_start_w_node": computeItem.AutoStart,
|
||||
"chipset": computeItem.Chipset,
|
||||
"cd_image_id": computeItem.CdImageId,
|
||||
"boot_order": computeItem.BootOrder,
|
||||
"bootdisk_size": computeItem.BootDiskSize,
|
||||
"clone_reference": computeItem.CloneReference,
|
||||
"clones": computeItem.Clones,
|
||||
"computeci_id": computeItem.ComputeCIID,
|
||||
"cpus": computeItem.CPUs,
|
||||
"created_by": computeItem.CreatedBy,
|
||||
"created_time": computeItem.CreatedTime,
|
||||
"custom_fields": string(customFields),
|
||||
"deleted_by": computeItem.DeletedBy,
|
||||
"deleted_time": computeItem.DeletedTime,
|
||||
"desc": computeItem.Description,
|
||||
"devices": string(devices),
|
||||
"disks": flattenDisks(computeItem.Disks),
|
||||
"driver": computeItem.Driver,
|
||||
"gid": computeItem.GID,
|
||||
"guid": computeItem.GUID,
|
||||
"hp_backed": computeItem.HPBacked,
|
||||
"compute_id": computeItem.ID,
|
||||
"cpu_pin": computeItem.CPUPin,
|
||||
"image_id": computeItem.ImageID,
|
||||
"interfaces": flattenInterfaces(computeItem.Interfaces),
|
||||
"lock_status": computeItem.LockStatus,
|
||||
"manager_id": computeItem.ManagerID,
|
||||
"manager_type": computeItem.ManagerType,
|
||||
"migrationjob": computeItem.MigrationJob,
|
||||
"milestones": computeItem.Milestones,
|
||||
"name": computeItem.Name,
|
||||
"need_reboot": computeItem.NeedReboot,
|
||||
"numa_affinity": computeItem.NumaAffinity,
|
||||
"numa_node_id": computeItem.NumaNodeId,
|
||||
"os_users": flattenOSUsers(computeItem.OSUsers),
|
||||
"pinned": computeItem.PinnedToStack,
|
||||
"preferred_cpu": computeItem.PreferredCPU,
|
||||
"ram": computeItem.RAM,
|
||||
"reference_id": computeItem.ReferenceID,
|
||||
"registered": computeItem.Registered,
|
||||
"res_name": computeItem.ResName,
|
||||
"reserved_node_cpus": computeItem.ReservedNodeCpus,
|
||||
"rg_id": computeItem.RGID,
|
||||
"rg_name": computeItem.RGName,
|
||||
"snap_sets": flattenSnapSets(computeItem.SnapSets),
|
||||
"stack_id": computeItem.StackID,
|
||||
"stack_name": computeItem.StackName,
|
||||
"stateless_sep_id": computeItem.StatelessSEPID,
|
||||
"stateless_sep_type": computeItem.StatelessSEPType,
|
||||
"status": computeItem.Status,
|
||||
"tags": flattenTags(computeItem.Tags),
|
||||
"tech_status": computeItem.TechStatus,
|
||||
"total_disk_size": computeItem.TotalDiskSize,
|
||||
"updated_by": computeItem.UpdatedBy,
|
||||
"updated_time": computeItem.UpdatedTime,
|
||||
"user_data": string(userData),
|
||||
"user_managed": computeItem.UserManaged,
|
||||
"vgpus": computeItem.VGPUs,
|
||||
"vins_connected": computeItem.VINSConnected,
|
||||
"virtual_image_id": computeItem.VirtualImageID,
|
||||
"loader_type": computeItem.LoaderType,
|
||||
"boot_type": computeItem.BootType,
|
||||
"hot_resize": computeItem.HotResize,
|
||||
"network_interface_naming": computeItem.NetworkInterfaceNaming,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
@@ -431,9 +527,9 @@ func flattenDisks(disks []compute.InfoDisk) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, disk := range disks {
|
||||
temp := map[string]interface{}{
|
||||
"bus_number": disk.BusNumber,
|
||||
"disk_id": disk.ID,
|
||||
"pci_slot": disk.PCISlot,
|
||||
// "bus_number": disk.BusNumber,
|
||||
"disk_id": disk.ID,
|
||||
// "pci_slot": disk.PCISlot,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
@@ -657,7 +753,7 @@ func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute
|
||||
d.Set("numa_affinity", compFacts.NumaAffinity)
|
||||
d.Set("numa_node_id", compFacts.NumaNodeId)
|
||||
d.Set("os_users", flattenOSUsers(compFacts.OSUsers))
|
||||
d.Set("pinned", compFacts.Pinned)
|
||||
d.Set("pinned", compFacts.PinnedToStack)
|
||||
d.Set("preferred_cpu", compFacts.PreferredCPU)
|
||||
d.Set("ram", compFacts.RAM)
|
||||
d.Set("reference_id", compFacts.ReferenceID)
|
||||
@@ -679,10 +775,14 @@ func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute
|
||||
d.Set("user_data", string(userData))
|
||||
d.Set("user_managed", compFacts.UserManaged)
|
||||
d.Set("vnc_password", compFacts.VNCPassword)
|
||||
d.Set("vgpus", compFacts.VGPUs)
|
||||
d.Set("vgpus", flattenVGPUs(compFacts.VGPUs))
|
||||
d.Set("virtual_image_id", compFacts.VirtualImageID)
|
||||
d.Set("virtual_image_name", compFacts.VirtualImageName)
|
||||
d.Set("pci_devices", flattenPCI(*pciList))
|
||||
d.Set("loader_type", compFacts.LoaderType)
|
||||
d.Set("boot_type", compFacts.BootType)
|
||||
d.Set("hot_resize", compFacts.HotResize)
|
||||
d.Set("network_interface_naming", compFacts.NetworkInterfaceNaming)
|
||||
//extra fields setting
|
||||
bootDisk := findBootDisk(compFacts.Disks)
|
||||
if bootDisk != nil {
|
||||
@@ -771,6 +871,7 @@ func flattenDisk(diskList compute.ListDisks) []map[string]interface{} {
|
||||
"role": disk.Role,
|
||||
"sep_id": disk.SEPID,
|
||||
"shareable": disk.Shareable,
|
||||
"size_available": disk.SizeAvailable,
|
||||
"size_max": disk.SizeMax,
|
||||
"size_used": disk.SizeUsed,
|
||||
"snapshots": flattendDiskSnapshotList(disk.Snapshots),
|
||||
@@ -837,3 +938,34 @@ func flattendDiskSnapshotList(sl compute.ListDetailedSnapshots) []interface{} {
|
||||
return res
|
||||
|
||||
}
|
||||
|
||||
func flattenVGPUs(vgpus []compute.VGPUItem) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, len(vgpus))
|
||||
|
||||
for i, vgpu := range vgpus {
|
||||
|
||||
res[i] = map[string]interface{}{
|
||||
"id": int(vgpu.ID),
|
||||
"gid": int(vgpu.GID),
|
||||
"type": vgpu.Type,
|
||||
"mode": vgpu.Mode,
|
||||
"status": vgpu.Status,
|
||||
"profile_id": vgpu.ProfileID,
|
||||
"ram": int(vgpu.RAM),
|
||||
"last_update_time": int(vgpu.LastUpdateTime),
|
||||
"created_time": int(vgpu.CreatedTime),
|
||||
"deleted_time": int(vgpu.DeletedTime),
|
||||
"vmid": int(vgpu.VMID),
|
||||
"pgpuid": int(vgpu.PGPuid),
|
||||
"reference_id": vgpu.ReferenceID,
|
||||
"account_id": int(vgpu.AccountID),
|
||||
"rg_id": int(vgpu.RgID),
|
||||
"last_claimed_by": int(vgpu.LastClaimedBy),
|
||||
"pci_slot": int(vgpu.PCISlot),
|
||||
"bus_number": int(vgpu.BusNumber),
|
||||
"guid": int(vgpu.GUID),
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
1060
internal/service/cloudbroker/kvmvm/old_schemas.go
Normal file
1060
internal/service/cloudbroker/kvmvm/old_schemas.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -121,6 +121,11 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
reqInterface.IPAddr = ipaddr.(string)
|
||||
}
|
||||
|
||||
macaddr, macSet := netInterfaceVal["mac"]
|
||||
if macSet {
|
||||
reqInterface.MAC = macaddr.(string)
|
||||
}
|
||||
|
||||
interfacesX86 = append(interfacesX86, reqInterface)
|
||||
}
|
||||
createReqX86.Interfaces = interfacesX86
|
||||
@@ -242,6 +247,38 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
|
||||
log.Debugf("resourceComputeCreate: new simple Compute ID %d, name %s created", computeId, d.Get("name").(string))
|
||||
|
||||
updateReq := compute.UpdateRequest{}
|
||||
|
||||
loaderType, loaderTypeOk := d.GetOk("loader_type")
|
||||
bootType, bootTypeOk := d.GetOk("boot_type")
|
||||
hotResize, hotResizeOk := d.GetOk("hot_resize")
|
||||
networkInterfaceNaming, networkInterfaceNamingOk := d.GetOk("network_interface_naming")
|
||||
|
||||
if loaderTypeOk {
|
||||
updateReq.LoaderType = loaderType.(string)
|
||||
}
|
||||
|
||||
if bootTypeOk {
|
||||
updateReq.BootType = bootType.(string)
|
||||
}
|
||||
|
||||
if hotResizeOk {
|
||||
updateReq.HotResize = hotResize.(bool)
|
||||
}
|
||||
|
||||
if networkInterfaceNamingOk {
|
||||
updateReq.NetworkInterfaceNaming = networkInterfaceNaming.(string)
|
||||
}
|
||||
|
||||
if loaderTypeOk || bootTypeOk || hotResizeOk || networkInterfaceNamingOk {
|
||||
log.Debugf("resourceComputeCreate: change loaderType or bootType or hotResize or networkInterfaceNaming on ComputeID: %d", computeId)
|
||||
updateReq.ComputeID = computeId
|
||||
_, err := c.CloudBroker().Compute().Update(ctx, updateReq)
|
||||
if err != nil {
|
||||
warnings.Add(err)
|
||||
}
|
||||
}
|
||||
|
||||
if ars, ok := d.GetOk("pci_devices"); ok {
|
||||
log.Debugf("resourceComputeCreate: add pci devices on ComputeID: %d", computeId)
|
||||
addedPciDevices := ars.(*schema.Set).List()
|
||||
@@ -352,9 +389,6 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
} else if ok && !start.(bool) {
|
||||
req := compute.StopRequest{ComputeID: computeId}
|
||||
if depresent, ok := d.Get("depresent").(bool); ok {
|
||||
req.Depresent = depresent
|
||||
}
|
||||
log.Debugf("resourceComputeCreate: stoping Compute ID %d after completing its resource configuration", computeId)
|
||||
if _, err := c.CloudBroker().Compute().Stop(ctx, req); err != nil {
|
||||
warnings.Add(err)
|
||||
@@ -713,7 +747,18 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if d.HasChanges("description", "name", "numa_affinity", "cpu_pin", "hp_backed", "chipset", "auto_start_w_node", "preferred_cpu") {
|
||||
if d.HasChanges("description",
|
||||
"name",
|
||||
"numa_affinity",
|
||||
"cpu_pin",
|
||||
"hp_backed",
|
||||
"chipset",
|
||||
"auto_start_w_node",
|
||||
"preferred_cpu",
|
||||
"loader_type",
|
||||
"boot_type",
|
||||
"hot_resize",
|
||||
"network_interface_naming") {
|
||||
if err := utilityComputeUpdate(ctx, d, m); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
@@ -874,7 +919,7 @@ func resourceComputeDelete(ctx context.Context, d *schema.ResourceData, m interf
|
||||
|
||||
func ResourceCompute() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
SchemaVersion: 2,
|
||||
|
||||
CustomizeDiff: func(ctx context.Context, diff *schema.ResourceDiff, i interface{}) error {
|
||||
if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_stack", "auto_start_w_node", "libvirt_settings", "network", "affinity_rules", "anti_affinity_rules",
|
||||
@@ -911,5 +956,12 @@ func ResourceCompute() *schema.Resource {
|
||||
},
|
||||
|
||||
Schema: resourceComputeSchemaMake(),
|
||||
StateUpgraders: []schema.StateUpgrader{
|
||||
{
|
||||
Type: resourceComputeResourceV1().CoreConfigSchema().ImpliedType(),
|
||||
Upgrade: resourceCompueteStateUpgradeV1,
|
||||
Version: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -466,6 +466,10 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"size_available": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"size_max": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -789,7 +793,7 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
"pinned": {
|
||||
Type: schema.TypeBool,
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"preferred_cpu": {
|
||||
@@ -918,10 +922,88 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"vgpus": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Description: "List of virtual GPUs",
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"mode": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"profile_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"ram": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"last_update_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vmid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"pgpuid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"reference_id": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"last_claimed_by": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"pci_slot": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"bus_number": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"virtual_image_id": {
|
||||
@@ -949,6 +1031,22 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"loader_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"hot_resize": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"network_interface_naming": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
return res
|
||||
}
|
||||
@@ -985,6 +1083,11 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "Find by tech status",
|
||||
},
|
||||
"stack_name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by node name.",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
@@ -1462,6 +1565,10 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"nid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"numa_affinity": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -1495,7 +1602,7 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
"pinned": {
|
||||
Type: schema.TypeBool,
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"preferred_cpu": {
|
||||
@@ -1567,6 +1674,11 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Find by node name.",
|
||||
},
|
||||
"stateless_sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1634,6 +1746,22 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"loader_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"hot_resize": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"network_interface_naming": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1848,6 +1976,10 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"cd_image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1948,6 +2080,10 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"bus_number": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"conn_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1984,6 +2120,10 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"mtu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -2032,6 +2172,42 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"libvirt_settings": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"guid": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"txmode": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"ioeventfd": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"event_idx": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"queues": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"rx_queue_size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"tx_queue_size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"target": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -2111,10 +2287,6 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
"pinned": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"ram": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
@@ -2125,6 +2297,10 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"ram": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"reference_id": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -2183,6 +2359,11 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Find by node name.",
|
||||
},
|
||||
"stateless_sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -2250,6 +2431,22 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"loader_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"hot_resize": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"network_interface_naming": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -3001,12 +3198,6 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "Optional text description of this compute instance.",
|
||||
},
|
||||
"depresent": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: true,
|
||||
Description: "whether to depresent compute disks from node or not",
|
||||
},
|
||||
"started": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
@@ -3044,7 +3235,6 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
MinItems: 1,
|
||||
MaxItems: constants.MAX_NETWORKS_PER_COMPUTE,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"net_type": {
|
||||
@@ -3067,9 +3257,11 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Description: "Optional IP address to assign to this connection. This IP should belong to the selected network and free for use.",
|
||||
},
|
||||
"mac": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "MAC address associated with this connection. MAC address is assigned automatically.",
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
DiffSuppressFunc: networkSubresIPAddreDiffSupperss,
|
||||
Description: "MAC address associated with this connection. MAC address is assigned automatically.",
|
||||
},
|
||||
"weight": {
|
||||
Type: schema.TypeInt,
|
||||
@@ -3288,6 +3480,13 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "Disk ID",
|
||||
},
|
||||
"present_to": {
|
||||
Type: schema.TypeMap,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"shareable": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
@@ -3306,7 +3505,6 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
"extra_disks": {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
MaxItems: constants.MAX_EXTRA_DISKS_PER_COMPUTE,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
@@ -3507,6 +3705,33 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
Description: "ID of the connected pci devices",
|
||||
},
|
||||
"loader_type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "unknown"}, false),
|
||||
Description: "Type of image vm.",
|
||||
},
|
||||
"boot_type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"bios", "uefi"}, false),
|
||||
Description: "Type of image upload.",
|
||||
},
|
||||
"hot_resize": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "Type of image vm.",
|
||||
},
|
||||
"network_interface_naming": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"eth", "ens"}, false),
|
||||
Description: "Name of netfowrk interface.",
|
||||
},
|
||||
// Computed properties
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
@@ -3858,7 +4083,7 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Description: "Guest OS users provisioned on this compute instance.",
|
||||
},
|
||||
"pinned": {
|
||||
Type: schema.TypeBool,
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"reference_id": {
|
||||
@@ -3950,10 +4175,88 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
},
|
||||
"vgpus": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Description: "List of virtual GPUs",
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"mode": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"profile_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"ram": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"last_update_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vmid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"pgpuid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"reference_id": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"last_claimed_by": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"pci_slot": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"bus_number": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"virtual_image_id": {
|
||||
|
||||
20
internal/service/cloudbroker/kvmvm/state_upgraders.go
Normal file
20
internal/service/cloudbroker/kvmvm/state_upgraders.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package kvmvm
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func resourceCompueteStateUpgradeV1(ctx context.Context, rawState map[string]interface{}, meta any) (map[string]interface{}, error) {
|
||||
log.Debug("resourceCompueteStateUpgradeV1: upgrading state")
|
||||
if oldVal, ok := rawState["pinned"].(bool); ok {
|
||||
if !oldVal {
|
||||
rawState["pinned"] = -1
|
||||
} else {
|
||||
rawState["pinned"] = 0
|
||||
}
|
||||
}
|
||||
|
||||
return rawState, nil
|
||||
}
|
||||
@@ -100,9 +100,6 @@ func utilityComputeStarted(ctx context.Context, d *schema.ResourceData, m interf
|
||||
if force, ok := d.Get("force_stop").(bool); ok {
|
||||
req.Force = force
|
||||
}
|
||||
if depresent, ok := d.Get("depresent").(bool); ok {
|
||||
req.Depresent = depresent
|
||||
}
|
||||
if _, err := c.CloudBroker().Compute().Stop(ctx, req); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -267,10 +264,6 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in
|
||||
Force: false,
|
||||
}
|
||||
|
||||
if depresent, ok := d.Get("depresent").(bool); ok {
|
||||
stopReq.Depresent = depresent
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Compute().Stop(ctx, stopReq)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -474,19 +467,6 @@ func utilityComputeExtraDisksConfigure(ctx context.Context, d *schema.ResourceDa
|
||||
|
||||
if detach_set.Len() > 0 {
|
||||
computeId, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
stopReq := compute.StopRequest{
|
||||
ComputeID: computeId,
|
||||
Force: false,
|
||||
}
|
||||
|
||||
if depresent, ok := d.Get("depresent").(bool); ok {
|
||||
stopReq.Depresent = depresent
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Compute().Stop(ctx, stopReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, diskId := range detach_set.List() {
|
||||
req := compute.DiskDetachRequest{
|
||||
@@ -501,14 +481,6 @@ func utilityComputeExtraDisksConfigure(ctx context.Context, d *schema.ResourceDa
|
||||
}
|
||||
}
|
||||
|
||||
req := compute.StartRequest{
|
||||
ComputeID: computeId,
|
||||
AltBootID: 0,
|
||||
}
|
||||
_, err = c.CloudBroker().Compute().Start(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
attach_set := new_set.(*schema.Set).Difference(old_set.(*schema.Set))
|
||||
@@ -601,7 +573,7 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData
|
||||
oldList := oldSet.(*schema.Set).List()
|
||||
newList := newSet.(*schema.Set).List()
|
||||
|
||||
detachMap, changeIpMap, attachMap := differenceNetwork(oldList, newList)
|
||||
detachMap, changeIpMap, changeMacMap, attachMap := differenceNetwork(oldList, newList)
|
||||
|
||||
apiErrCount := 0
|
||||
var lastSavedError error
|
||||
@@ -649,7 +621,7 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData
|
||||
addedLibvirtSettings := (newLibvirtSet.(*schema.Set).Difference(oldLibvirtSet.(*schema.Set))).List()
|
||||
libvirtSettingsMap := addAttachedNetwork(addedLibvirtSettings, newLibvirtSet.(*schema.Set).List(), attachMap)
|
||||
|
||||
if oldSet.(*schema.Set).Len() == len(detachMap) || oldSet.(*schema.Set).Len() == 0 || len(libvirtSettingsMap) > 0 || hasDPDKnetwork(attachMap) {
|
||||
if oldSet.(*schema.Set).Len() == len(detachMap) || oldSet.(*schema.Set).Len() == 0 || len(libvirtSettingsMap) > 0 || hasDPDKnetwork(attachMap) || len(changeMacMap) > 0 {
|
||||
if err := utilityComputeStop(ctx, d, m); err != nil {
|
||||
apiErrCount++
|
||||
lastSavedError = err
|
||||
@@ -659,6 +631,24 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("utilityComputeNetworksConfigure: changeMac set has %d items for Compute ID %s", len(changeMacMap), d.Id())
|
||||
for _, netData := range changeMacMap {
|
||||
computeId, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
req := compute.ChangeMACRequest{
|
||||
ComputeID: computeId,
|
||||
NewMAC: netData["mac"].(string),
|
||||
СurrentMAC: netData["old_mac"].(string),
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Compute().ChangeMAC(ctx, req)
|
||||
if err != nil {
|
||||
log.Errorf("utilityComputeNetworksConfigure: failed to change mac %s to %s from Compute ID %s: %s",
|
||||
req.СurrentMAC, req.NewMAC, d.Id(), err)
|
||||
apiErrCount++
|
||||
lastSavedError = err
|
||||
}
|
||||
}
|
||||
|
||||
sort.Slice(attachMap, func(i, j int) bool {
|
||||
weightI := attachMap[i]["weight"].(int)
|
||||
weightJ := attachMap[j]["weight"].(int)
|
||||
@@ -687,6 +677,10 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData
|
||||
req.IPAddr = netData["ip_address"].(string)
|
||||
}
|
||||
|
||||
if netData["mac"].(string) != "" {
|
||||
req.MACAddr = netData["mac"].(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Compute().NetAttach(ctx, req)
|
||||
if err != nil {
|
||||
log.Errorf("utilityComputeNetworksConfigure: failed to attach net ID %d of type %s to Compute ID %s: %s",
|
||||
@@ -758,9 +752,10 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData
|
||||
return nil
|
||||
}
|
||||
|
||||
func differenceNetwork(oldList, newList []interface{}) (detachMap, changeIpMap, attachMap []map[string]interface{}) {
|
||||
func differenceNetwork(oldList, newList []interface{}) (detachMap, changeIpMap, changeMacMap, attachMap []map[string]interface{}) {
|
||||
attachMap = make([]map[string]interface{}, 0)
|
||||
changeIpMap = make([]map[string]interface{}, 0)
|
||||
changeMacMap = make([]map[string]interface{}, 0)
|
||||
detachMap = make([]map[string]interface{}, 0)
|
||||
for _, oldNetwork := range oldList {
|
||||
oldMap := oldNetwork.(map[string]interface{})
|
||||
@@ -768,15 +763,21 @@ func differenceNetwork(oldList, newList []interface{}) (detachMap, changeIpMap,
|
||||
for _, newNetwork := range newList {
|
||||
newMap := newNetwork.(map[string]interface{})
|
||||
if newMap["net_type"] == oldMap["net_type"] && newMap["net_id"] == oldMap["net_id"] && newMap["weight"] == oldMap["weight"] && (newMap["mtu"] == oldMap["mtu"] || newMap["mtu"].(int) == 0) {
|
||||
if (newMap["net_type"].(string) == "EXTNET" || newMap["net_type"].(string) == "VINS") && (newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(string) != "") {
|
||||
found = true
|
||||
switch {
|
||||
case (newMap["net_type"].(string) == "EXTNET" || newMap["net_type"].(string) == "VINS") && (newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(string) != ""):
|
||||
changeIpMap = append(changeIpMap, newMap)
|
||||
found = true
|
||||
break
|
||||
} else if newMap["ip_address"] == oldMap["ip_address"] || newMap["ip_address"].(string) == "" {
|
||||
fallthrough
|
||||
case newMap["mac"] != oldMap["mac"] && newMap["mac"].(string) != "":
|
||||
newMap["old_mac"] = oldMap["mac"]
|
||||
changeMacMap = append(changeMacMap, newMap)
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
continue
|
||||
@@ -790,12 +791,8 @@ func differenceNetwork(oldList, newList []interface{}) (detachMap, changeIpMap,
|
||||
for _, oldNetwork := range oldList {
|
||||
oldMap := oldNetwork.(map[string]interface{})
|
||||
if newMap["net_type"] == oldMap["net_type"] && newMap["net_id"] == oldMap["net_id"] && newMap["weight"] == oldMap["weight"] && (newMap["mtu"] == oldMap["mtu"] || newMap["mtu"].(int) == 0) {
|
||||
if newMap["ip_address"] == oldMap["ip_address"] || newMap["ip_address"].(string) == "" ||
|
||||
((newMap["net_type"].(string) == "EXTNET" || newMap["net_type"].(string) == "VINS") &&
|
||||
newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(string) != "") {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
@@ -871,6 +868,23 @@ func utilityComputeUpdate(ctx context.Context, d *schema.ResourceData, m interfa
|
||||
if d.HasChange("chipset") {
|
||||
req.Chipset = d.Get("chipset").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("loader_type") {
|
||||
req.LoaderType = d.Get("loader_type").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("boot_type") {
|
||||
req.BootType = d.Get("boot_type").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("hot_resize") {
|
||||
req.HotResize = d.Get("hot_resize").(bool)
|
||||
}
|
||||
|
||||
if d.HasChange("network_interface_naming") {
|
||||
req.NetworkInterfaceNaming = d.Get("network_interface_naming").(string)
|
||||
}
|
||||
|
||||
req.CPUPin = d.Get("cpu_pin").(bool)
|
||||
req.HPBacked = d.Get("hp_backed").(bool)
|
||||
req.AutoStart = d.Get("auto_start_w_node").(bool)
|
||||
@@ -902,9 +916,7 @@ func utilityComputeUpdate(ctx context.Context, d *schema.ResourceData, m interfa
|
||||
ComputeID: computeId,
|
||||
Force: false,
|
||||
}
|
||||
if depresent, ok := d.Get("depresent").(bool); ok {
|
||||
stopReq.Depresent = depresent
|
||||
}
|
||||
|
||||
if _, err := c.CloudBroker().Compute().Stop(ctx, stopReq); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1368,9 +1380,6 @@ func utilityComputeRollback(ctx context.Context, d *schema.ResourceData, m inter
|
||||
ComputeID: computeId,
|
||||
Force: false,
|
||||
}
|
||||
if depresent, ok := d.Get("depresent").(bool); ok {
|
||||
req.Depresent = depresent
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Compute().Stop(ctx, req)
|
||||
if err != nil {
|
||||
@@ -1531,9 +1540,6 @@ func utilityComputeUpdateImage(ctx context.Context, d *schema.ResourceData, m in
|
||||
ComputeID: computeId,
|
||||
Force: false,
|
||||
}
|
||||
if depresent, ok := d.Get("depresent").(bool); ok {
|
||||
stopReq.Depresent = depresent
|
||||
}
|
||||
if forceStop, ok := d.GetOk("force_stop"); ok {
|
||||
stopReq.Force = forceStop.(bool)
|
||||
}
|
||||
@@ -1608,9 +1614,6 @@ func utilityComputeStop(ctx context.Context, d *schema.ResourceData, m interface
|
||||
Force: true,
|
||||
}
|
||||
req.ComputeID = uint64(d.Get("compute_id").(int))
|
||||
if depresent, ok := d.Get("depresent").(bool); ok {
|
||||
req.Depresent = depresent
|
||||
}
|
||||
|
||||
log.Debugf("utilityComputeStop: stopping compute %d", req.ComputeID)
|
||||
_, err := c.CloudBroker().Compute().Stop(ctx, req)
|
||||
|
||||
@@ -72,6 +72,9 @@ func utilityDataComputeListCheckPresence(ctx context.Context, d *schema.Resource
|
||||
if stackID, ok := d.GetOk("stack_id"); ok {
|
||||
req.StackID = stackID.(uint64)
|
||||
}
|
||||
if stackName, ok := d.GetOk("stack_name"); ok {
|
||||
req.StackName = stackName.(string)
|
||||
}
|
||||
if imageID, ok := d.GetOk("image_id"); ok {
|
||||
req.ImageID = imageID.(uint64)
|
||||
}
|
||||
|
||||
@@ -34,13 +34,14 @@ package kvmvm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/compute"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func utilityDataComputeListDeletedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*compute.ListComputes, error) {
|
||||
func utilityDataComputeListDeletedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*compute.ListDeletedComputes, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := compute.ListDeletedRequest{}
|
||||
|
||||
@@ -88,3 +89,12 @@ func utilityDataComputeListDeletedCheckPresence(ctx context.Context, d *schema.R
|
||||
|
||||
return listComputes, nil
|
||||
}
|
||||
func matchDeletedComputes(computeList *compute.ListDeletedComputes) *compute.ListDeletedComputes {
|
||||
matched, _ := regexp.Compile(`[a-zA-Z]+\\d+-[a-zA-Z]+\\d+-[a-zA-Z]+\\d+`)
|
||||
result := computeList.FilterFunc(func(ic compute.ItemDeletedCompute) bool {
|
||||
res := matched.Match([]byte(ic.Name))
|
||||
return !res
|
||||
})
|
||||
|
||||
return &result
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ func flattenResgroup(d *schema.ResourceData, rgData *rg.RecordRG) {
|
||||
d.Set("lock_status", rgData.LockStatus)
|
||||
d.Set("milestones", rgData.Milestones)
|
||||
d.Set("name", rgData.Name)
|
||||
d.Set("register_computes", rgData.RegisterComputes)
|
||||
d.Set("resource_limits", flattenRgResourceLimits(rgData.ResourceLimits))
|
||||
d.Set("resource_types", rgData.ResTypes)
|
||||
d.Set("secret", rgData.Secret)
|
||||
@@ -405,7 +404,6 @@ func flattenRgList(rgl *rg.ListRG) []map[string]interface{} {
|
||||
"lock_status": rg.LockStatus,
|
||||
"milestones": rg.Milestones,
|
||||
"name": rg.Name,
|
||||
"register_computes": rg.RegisterComputes,
|
||||
"resource_limits": flattenRgResourceLimits(rg.ResourceLimits),
|
||||
"secret": rg.Secret,
|
||||
"status": rg.Status,
|
||||
@@ -476,7 +474,6 @@ func flattenResourceRG(d *schema.ResourceData, rgData *rg.RecordRG) {
|
||||
d.Set("rg_name", rgData.Name)
|
||||
d.Set("resource_limits", flattenRgResourceLimits(rgData.ResourceLimits))
|
||||
d.Set("description", rgData.Description)
|
||||
d.Set("register_computes", rgData.RegisterComputes)
|
||||
d.Set("uniq_pools", rgData.UniqPools)
|
||||
d.Set("cpu_allocation_parameter", rgData.CPUAllocationParameter)
|
||||
d.Set("cpu_allocation_ratio", rgData.CPUAllocationRatio)
|
||||
|
||||
@@ -1,148 +1,147 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package rg
|
||||
|
||||
type ResourceLimits struct {
|
||||
CUC float64 `json:"CU_C"`
|
||||
CUD float64 `json:"CU_D"`
|
||||
CUI float64 `json:"CU_I"`
|
||||
CUM float64 `json:"CU_M"`
|
||||
CUNP float64 `json:"CU_NP"`
|
||||
GpuUnits float64 `json:"gpu_units"`
|
||||
}
|
||||
|
||||
type ResgroupRecord struct {
|
||||
ACLs []AccountAclRecord `json:"acl"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
DefaultNetID int `json:"def_net_id"`
|
||||
DefaultNetType string `json:"def_net_type"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
Decsription string `json:"desc"`
|
||||
GridID int `json:"gid"`
|
||||
GUID int `json:"guid"`
|
||||
ID uint `json:"id"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
Milestones int `json:"milestones"`
|
||||
Name string `json:"name"`
|
||||
RegisterComputes bool `json:"registerComputes"`
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
Secret string `json:"secret"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
Vins []int `json:"vins"`
|
||||
Computes []int `json:"vms"`
|
||||
}
|
||||
|
||||
type ResgroupListResp []ResgroupRecord
|
||||
|
||||
type ResgroupUpdateParam struct {
|
||||
RgId int `json:"rgId"`
|
||||
Name string `json:"name"`
|
||||
Desc string `json:"decs"`
|
||||
Ram int `json:"maxMemoryCapacity"`
|
||||
Disk int `json:"maxVDiskCapacity"`
|
||||
Cpu int `json:"maxCPUCapacity"`
|
||||
NetTraffic int `json:"maxNetworkPeerTransfer"`
|
||||
}
|
||||
|
||||
type AccountAclRecord struct {
|
||||
IsExplicit bool `json:"explicit"`
|
||||
Guid string `json:"guid"`
|
||||
Rights string `json:"right"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
UgroupID string `json:"userGroupId"`
|
||||
CanBeDeleted bool `json:"canBeDeleted"`
|
||||
}
|
||||
|
||||
type ResgroupGetResp struct {
|
||||
ACLs []UserAclRecord `json:"ACLs"`
|
||||
Usage UsageRecord `json:"Resources"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
GridID int `json:"gid"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
DefaultNetID int `json:"def_net_id"`
|
||||
DefaultNetType string `json:"def_net_type"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
Desc string `json:"desc"`
|
||||
ID uint `json:"id"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
Name string `json:"name"`
|
||||
Quota QuotaRecord `json:"resourceLimits"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
Vins []int `json:"vins"`
|
||||
Computes []int `json:"vms"`
|
||||
|
||||
Ignored map[string]interface{} `json:"-"`
|
||||
}
|
||||
|
||||
type UserAclRecord struct {
|
||||
IsExplicit bool `json:"explicit"`
|
||||
Rights string `json:"right"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
UgroupID string `json:"userGroupId"`
|
||||
// CanBeDeleted bool `json:"canBeDeleted"`
|
||||
}
|
||||
|
||||
type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get
|
||||
Cpu float64 `json:"CU_C"` // CPU count in pcs
|
||||
Ram float64 `json:"CU_M"` // RAM volume in MB, it is STILL reported as FLOAT
|
||||
Disk float64 `json:"CU_D"` // Disk capacity in GB
|
||||
ExtIPs float64 `json:"CU_I"` // Ext IPs count
|
||||
ExtTraffic float64 `json:"CU_NP"` // Ext network traffic
|
||||
GpuUnits float64 `json:"gpu_units"` // GPU count
|
||||
}
|
||||
|
||||
type ResourceRecord struct { // this is how actual usage is reported by /api/.../rg/get
|
||||
Cpu int `json:"cpu"`
|
||||
Disk int `json:"disksize"`
|
||||
ExtIPs int `json:"extips"`
|
||||
ExtTraffic int `json:"exttraffic"`
|
||||
Gpu int `json:"gpu"`
|
||||
Ram int `json:"ram"`
|
||||
}
|
||||
|
||||
type UsageRecord struct {
|
||||
Current ResourceRecord `json:"Current"`
|
||||
Reserved ResourceRecord `json:"Reserved"`
|
||||
}
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package rg
|
||||
|
||||
type ResourceLimits struct {
|
||||
CUC float64 `json:"CU_C"`
|
||||
CUD float64 `json:"CU_D"`
|
||||
CUI float64 `json:"CU_I"`
|
||||
CUM float64 `json:"CU_M"`
|
||||
CUNP float64 `json:"CU_NP"`
|
||||
GpuUnits float64 `json:"gpu_units"`
|
||||
}
|
||||
|
||||
type ResgroupRecord struct {
|
||||
ACLs []AccountAclRecord `json:"acl"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
DefaultNetID int `json:"def_net_id"`
|
||||
DefaultNetType string `json:"def_net_type"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
Decsription string `json:"desc"`
|
||||
GridID int `json:"gid"`
|
||||
GUID int `json:"guid"`
|
||||
ID uint `json:"id"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
Milestones int `json:"milestones"`
|
||||
Name string `json:"name"`
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
Secret string `json:"secret"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
Vins []int `json:"vins"`
|
||||
Computes []int `json:"vms"`
|
||||
}
|
||||
|
||||
type ResgroupListResp []ResgroupRecord
|
||||
|
||||
type ResgroupUpdateParam struct {
|
||||
RgId int `json:"rgId"`
|
||||
Name string `json:"name"`
|
||||
Desc string `json:"decs"`
|
||||
Ram int `json:"maxMemoryCapacity"`
|
||||
Disk int `json:"maxVDiskCapacity"`
|
||||
Cpu int `json:"maxCPUCapacity"`
|
||||
NetTraffic int `json:"maxNetworkPeerTransfer"`
|
||||
}
|
||||
|
||||
type AccountAclRecord struct {
|
||||
IsExplicit bool `json:"explicit"`
|
||||
Guid string `json:"guid"`
|
||||
Rights string `json:"right"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
UgroupID string `json:"userGroupId"`
|
||||
CanBeDeleted bool `json:"canBeDeleted"`
|
||||
}
|
||||
|
||||
type ResgroupGetResp struct {
|
||||
ACLs []UserAclRecord `json:"ACLs"`
|
||||
Usage UsageRecord `json:"Resources"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
GridID int `json:"gid"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
DefaultNetID int `json:"def_net_id"`
|
||||
DefaultNetType string `json:"def_net_type"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
Desc string `json:"desc"`
|
||||
ID uint `json:"id"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
Name string `json:"name"`
|
||||
Quota QuotaRecord `json:"resourceLimits"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
Vins []int `json:"vins"`
|
||||
Computes []int `json:"vms"`
|
||||
|
||||
Ignored map[string]interface{} `json:"-"`
|
||||
}
|
||||
|
||||
type UserAclRecord struct {
|
||||
IsExplicit bool `json:"explicit"`
|
||||
Rights string `json:"right"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
UgroupID string `json:"userGroupId"`
|
||||
// CanBeDeleted bool `json:"canBeDeleted"`
|
||||
}
|
||||
|
||||
type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get
|
||||
Cpu float64 `json:"CU_C"` // CPU count in pcs
|
||||
Ram float64 `json:"CU_M"` // RAM volume in MB, it is STILL reported as FLOAT
|
||||
Disk float64 `json:"CU_D"` // Disk capacity in GB
|
||||
ExtIPs float64 `json:"CU_I"` // Ext IPs count
|
||||
ExtTraffic float64 `json:"CU_NP"` // Ext network traffic
|
||||
GpuUnits float64 `json:"gpu_units"` // GPU count
|
||||
}
|
||||
|
||||
type ResourceRecord struct { // this is how actual usage is reported by /api/.../rg/get
|
||||
Cpu int `json:"cpu"`
|
||||
Disk int `json:"disksize"`
|
||||
ExtIPs int `json:"extips"`
|
||||
ExtTraffic int `json:"exttraffic"`
|
||||
Gpu int `json:"gpu"`
|
||||
Ram int `json:"ram"`
|
||||
}
|
||||
|
||||
type UsageRecord struct {
|
||||
Current ResourceRecord `json:"Current"`
|
||||
Reserved ResourceRecord `json:"Reserved"`
|
||||
}
|
||||
|
||||
@@ -129,10 +129,6 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
req.ExtIP = extIp.(string)
|
||||
}
|
||||
|
||||
if regComputes, ok := d.GetOk("register_computes"); ok {
|
||||
req.RegisterComputes = regComputes.(bool)
|
||||
}
|
||||
|
||||
if uniqPools, ok := d.GetOk("uniq_pools"); ok {
|
||||
uniqPools := uniqPools.([]interface{})
|
||||
|
||||
@@ -418,11 +414,6 @@ func resourceResgroupUpdate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
doGeneralUpdate = true
|
||||
}
|
||||
|
||||
if d.HasChange("register_computes") {
|
||||
req.RegisterComputes = d.Get("register_computes").(bool)
|
||||
doGeneralUpdate = true
|
||||
}
|
||||
|
||||
if d.HasChange("uniq_pools") {
|
||||
uniqPools := d.Get("uniq_pools").([]interface{})
|
||||
if len(uniqPools) == 0 {
|
||||
|
||||
@@ -119,10 +119,6 @@ func dataSourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"register_computes": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"resource_limits": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -1621,10 +1617,6 @@ func dataSourceRgListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"register_computes": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"resource_limits": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -1895,10 +1887,6 @@ func dataSourceRgListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"register_computes": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"resource_limits": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -2292,14 +2280,6 @@ func resourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Description: "IP address on the external netowrk to request when def_net_type=PRIVATE and ext_net_id is not 0",
|
||||
},
|
||||
|
||||
"register_computes": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
// Default: false,
|
||||
Description: "Register computes in registration system",
|
||||
},
|
||||
|
||||
"uniq_pools": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -2395,7 +2375,7 @@ func resourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
ValidateFunc: validation.StringInSlice([]string{"hugepages", "numa", "cpupin", "vfnic"}, true),
|
||||
ValidateFunc: validation.StringInSlice([]string{"hugepages", "numa", "cpupin", "vfnic", "dpdk", "changemac"}, true),
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
)
|
||||
|
||||
func DataSourceAvailableSEPAndPoolsListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
sepList, err := utilityAvailableSEPAndPoolsListCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("")
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
|
||||
flattenAvailableSEPList(d, sepList)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func DataSourceAvailableSEPAndPoolsList() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
ReadContext: DataSourceAvailableSEPAndPoolsListRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &constants.Timeout30s,
|
||||
Default: &constants.Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceAvailableSEPListSchemaMake(),
|
||||
}
|
||||
}
|
||||
71
internal/service/cloudbroker/sep/data_source_sep_template.go
Normal file
71
internal/service/cloudbroker/sep/data_source_sep_template.go
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
)
|
||||
|
||||
func dataSourceSepTemplateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
sepTemplate, err := utilitySepTemplateCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("")
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
|
||||
d.Set("sep_template", sepTemplate)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func DataSourceSepTemplate() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
ReadContext: dataSourceSepTemplateRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &constants.Timeout30s,
|
||||
Default: &constants.Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceSepTemplateSchemaMake(),
|
||||
}
|
||||
}
|
||||
@@ -147,3 +147,39 @@ func flattenSepConsumptionPools(bp *sep.RecordConsumption) []map[string]interfac
|
||||
}
|
||||
return sh
|
||||
}
|
||||
|
||||
func flattenAvailableSEPList(d *schema.ResourceData, sepList *sep.ListAvailableSEP) {
|
||||
d.Set("items", flattenSEPDataList(sepList.Data))
|
||||
d.Set("entry_count", sepList.EntryCount)
|
||||
}
|
||||
|
||||
func flattenSEPDataList(sepDataList []sep.SEPData) []map[string]interface{} {
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
|
||||
for _, sepData := range sepDataList {
|
||||
temp := map[string]interface{}{
|
||||
"sep_id": sepData.SEPID,
|
||||
"sep_name": sepData.SEPName,
|
||||
"sep_type": sepData.SEPType,
|
||||
"pools": flattenPoolList(sepData.Pools),
|
||||
}
|
||||
sh = append(sh, temp)
|
||||
}
|
||||
|
||||
return sh
|
||||
}
|
||||
|
||||
func flattenPoolList(pools []sep.Pool) []map[string]interface{} {
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
|
||||
for _, pool := range pools {
|
||||
temp := map[string]interface{}{
|
||||
"name": pool.Name,
|
||||
"types": pool.Types,
|
||||
"system": pool.System,
|
||||
}
|
||||
sh = append(sh, temp)
|
||||
}
|
||||
|
||||
return sh
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package sep
|
||||
|
||||
import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||
)
|
||||
|
||||
func dataSourceSepCSchemaMake() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{
|
||||
@@ -101,6 +104,27 @@ func dataSourceSepConfigSchemaMake() map[string]*schema.Schema {
|
||||
}
|
||||
}
|
||||
|
||||
func dataSourceSepTemplateSchemaMake() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{
|
||||
"sep_type": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"hitachi", "dorado", "tatlin", "shared", "local", "des"}, false),
|
||||
Description: "type of sep",
|
||||
},
|
||||
"lang": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"ru", "en"}, false),
|
||||
Description: "language",
|
||||
},
|
||||
"sep_template": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func dataSourceSepConsumptionSchemaMake() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{
|
||||
"sep_id": {
|
||||
@@ -698,3 +722,74 @@ func resourceSepConfigSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func dataSourceAvailableSEPListSchemaMake() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "Account ID",
|
||||
},
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Resource group ID",
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Number of available SEP entries",
|
||||
},
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Description: "List of available SEPs",
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "SEP ID",
|
||||
},
|
||||
"sep_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "SEP name",
|
||||
},
|
||||
"sep_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "SEP type",
|
||||
},
|
||||
"pools": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Description: "List of pools in the SEP",
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Pool name",
|
||||
},
|
||||
"types": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Description: "List of pool types",
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"system": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
Description: "Is system pool",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilityAvailableSEPAndPoolsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*sep.ListAvailableSEP, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := sep.ListAvailableSEPAndPoolsRequest{}
|
||||
|
||||
if AccountID, ok := d.GetOk("account_id"); ok {
|
||||
req.AccountID = uint64(AccountID.(int))
|
||||
}
|
||||
if RGID, ok := d.GetOk("rg_id"); ok {
|
||||
req.RGID = RGID.(uint64)
|
||||
}
|
||||
|
||||
log.Debugf("utilityAvailableSEPAndPoolsListCheckPresence: load sep and pools list")
|
||||
sepList, err := c.CloudBroker().SEP().ListAvailableSEPAndPools(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return sepList, nil
|
||||
}
|
||||
59
internal/service/cloudbroker/sep/utility_sep_template.go
Normal file
59
internal/service/cloudbroker/sep/utility_sep_template.go
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilitySepTemplateCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (string, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := sep.GetTemplateRequest{
|
||||
SepType: d.Get("sep_type").(string),
|
||||
Language: d.Get("lang").(string),
|
||||
}
|
||||
|
||||
log.Debugf("utilitySepTemplateCheckPresence: load sep template")
|
||||
sepTemplate, err := c.CloudBroker().SEP().GetTemplate(ctx, req)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return sepTemplate, nil
|
||||
}
|
||||
@@ -1237,6 +1237,11 @@ func dataSourceVinsListSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "sort by one of supported fields, format +|-(field)",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "sort by status",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
|
||||
@@ -66,6 +66,9 @@ func utilityVinsListCheckPresence(ctx context.Context, d *schema.ResourceData, m
|
||||
if sortBy, ok := d.GetOk("sort_by"); ok {
|
||||
req.SortBy = sortBy.(string)
|
||||
}
|
||||
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