This commit is contained in:
2025-05-21 16:38:25 +03:00
parent 2c70109d2d
commit 9e68edb2b9
1034 changed files with 73925 additions and 3187 deletions

View File

@@ -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,

View File

@@ -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)
}

View File

@@ -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,

View File

@@ -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)
}