This commit is contained in:
2024-11-12 13:41:38 +03:00
parent 040af43607
commit 36879efd58
517 changed files with 37877 additions and 1900 deletions

View File

@@ -130,10 +130,6 @@ func resourceCDROMImageDelete(ctx context.Context, d *schema.ResourceData, m int
ImageID: imageData.ID,
}
if permanently, ok := d.GetOk("permanently"); ok {
req.Permanently = permanently.(bool)
}
_, err = c.CloudBroker().Image().DeleteCDROMImage(ctx, req)
if err != nil {
return diag.FromErr(err)

View File

@@ -141,13 +141,6 @@ func resourceImageDelete(ctx context.Context, d *schema.ResourceData, m interfac
ImageID: uint64(d.Get("image_id").(int)),
}
if reason, ok := d.GetOk("reason"); ok {
req.Reason = reason.(string)
}
if permanently, ok := d.GetOk("permanently"); ok {
req.Permanently = permanently.(bool)
}
_, err = c.CloudBroker().Image().Delete(ctx, req)
if err != nil {
return diag.FromErr(err)

View File

@@ -179,13 +179,6 @@ func resourceImageFromBlankComputeDelete(ctx context.Context, d *schema.Resource
ImageID: uint64(d.Get("image_id").(int)),
}
if reason, ok := d.GetOk("reason"); ok {
req.Reason = reason.(string)
}
if permanently, ok := d.GetOk("permanently"); ok {
req.Permanently = permanently.(bool)
}
_, err = c.CloudBroker().Image().Delete(ctx, req)
if err != nil {
return diag.FromErr(err)

View File

@@ -186,13 +186,6 @@ func resourceImageFromPlatformDiskDelete(ctx context.Context, d *schema.Resource
ImageID: uint64(d.Get("image_id").(int)),
}
if reason, ok := d.GetOk("reason"); ok {
req.Reason = reason.(string)
}
if permanently, ok := d.GetOk("permanently"); ok {
req.Permanently = permanently.(bool)
}
_, err = c.CloudBroker().Image().Delete(ctx, req)
if err != nil {
return diag.FromErr(err)

View File

@@ -99,13 +99,6 @@ func resourceVirtualImageDelete(ctx context.Context, d *schema.ResourceData, m i
ImageID: uint64(d.Get("image_id").(int)),
}
if reason, ok := d.GetOk("reason"); ok {
req.Reason = reason.(string)
}
if permanently, ok := d.GetOk("permanently"); ok {
req.Permanently = permanently.(bool)
}
_, err = c.CloudBroker().Image().Delete(ctx, req)
if err != nil {
return diag.FromErr(err)

View File

@@ -407,6 +407,11 @@ func dataSourceImageListSchemaMake() map[string]*schema.Schema {
Optional: true,
Description: "page size",
},
"enabled": {
Type: schema.TypeBool,
Optional: true,
Description: "find by enabled True or False",
},
"items": {
Type: schema.TypeList,
Computed: true,
@@ -458,7 +463,7 @@ func dataSourceImageListSchemaMake() map[string]*schema.Schema {
"architecture": {
Type: schema.TypeString,
Computed: true,
Description: "binary architecture of this image, one of X86_64 of PPC64_LE",
Description: "binary architecture of this image, one of X86_64",
},
"boot_type": {
Type: schema.TypeString,
@@ -716,7 +721,7 @@ func dataSourceImageSchemaMake() map[string]*schema.Schema {
"architecture": {
Type: schema.TypeString,
Computed: true,
Description: "binary architecture of this image, one of X86_64 of PPC64_LE",
Description: "binary architecture of this image, one of X86_64",
},
"boot_type": {
Type: schema.TypeString,
@@ -922,7 +927,7 @@ func resourceCDROMImageSchemaMake() map[string]*schema.Schema {
},
"drivers": {
Type: schema.TypeList,
Required: true,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
@@ -968,13 +973,7 @@ func resourceCDROMImageSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "binary architecture of this image, one of X86_64 of PPC64_LE",
},
"permanently": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Whether to completely delete the image",
Description: "binary architecture of this image, one of X86_64",
},
"bootable": {
Type: schema.TypeBool,
@@ -1269,12 +1268,7 @@ func resourceImageSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "binary architecture of this image, one of X86_64 of PPC64_LE",
},
"permanently": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to completely delete the image",
Description: "binary architecture of this image, one of X86_64",
},
"bootable": {
Type: schema.TypeBool,
@@ -1313,10 +1307,7 @@ func resourceImageSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
},
},
"reason": {
Type: schema.TypeString,
Optional: true,
},
"accounts": {
Type: schema.TypeList,
Optional: true,
@@ -1534,15 +1525,7 @@ func resourceVirtualImageSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
},
},
"permanently": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to completely delete the image",
},
"reason": {
Type: schema.TypeString,
Optional: true,
},
"unc_path": {
Type: schema.TypeString,
Computed: true,
@@ -1595,7 +1578,7 @@ func resourceVirtualImageSchemaMake() map[string]*schema.Schema {
"architecture": {
Type: schema.TypeString,
Computed: true,
Description: "binary architecture of this image, one of X86_64 of PPC64_LE",
Description: "binary architecture of this image, one of X86_64",
},
"boot_type": {
Type: schema.TypeString,
@@ -1801,12 +1784,6 @@ func resourceImageFromBlankComputeSchemaMake() map[string]*schema.Schema {
Default: false,
Description: "create an image in async/sync mode",
},
"permanently": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "whether to completely delete the image",
},
"bootable": {
Type: schema.TypeBool,
Optional: true,
@@ -1838,10 +1815,7 @@ func resourceImageFromBlankComputeSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
},
},
"reason": {
Type: schema.TypeString,
Optional: true,
},
"accounts": {
Type: schema.TypeList,
Optional: true,
@@ -2039,7 +2013,7 @@ func resourceImageFromPlatformDiskSchemaMake() map[string]*schema.Schema {
"architecture": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"X86_64", "PPC64_LE"}, true),
ValidateFunc: validation.StringInSlice([]string{"X86_64"}, true),
Description: "Image type linux, windows or other",
},
@@ -2069,11 +2043,10 @@ func resourceImageFromPlatformDiskSchemaMake() map[string]*schema.Schema {
},
"drivers": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Required: true,
Elem: &schema.Schema{
StateFunc: statefuncs.StateFuncToUpper,
ValidateFunc: validation.StringInSlice([]string{"SVA_KVM_X86", "KVM_X86", "KVM_PPC"}, false), // observe case while validating
ValidateFunc: validation.StringInSlice([]string{"SVA_KVM_X86", "KVM_X86"}, false), // observe case while validating
Type: schema.TypeString,
},
Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]",
@@ -2096,12 +2069,6 @@ func resourceImageFromPlatformDiskSchemaMake() map[string]*schema.Schema {
Default: false,
Description: "create an image in async/sync mode",
},
"permanently": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "whether to completely delete the image",
},
"bootable": {
Type: schema.TypeBool,
Optional: true,
@@ -2133,10 +2100,7 @@ func resourceImageFromPlatformDiskSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
},
},
"reason": {
Type: schema.TypeString,
Optional: true,
},
"accounts": {
Type: schema.TypeList,
Optional: true,

View File

@@ -72,13 +72,13 @@ func utilityImageListCheckPresence(ctx context.Context, d *schema.ResourceData,
if pool, ok := d.GetOk("pool"); ok {
req.Pool = pool.(string)
}
if public, ok := d.GetOk("public"); ok {
if public, ok := d.GetOkExists("public"); ok {
req.Public = public.(bool)
}
if hotResize, ok := d.GetOk("hot_resize"); ok {
if hotResize, ok := d.GetOkExists("hot_resize"); ok {
req.HotResize = hotResize.(bool)
}
if bootable, ok := d.GetOk("bootable"); ok {
if bootable, ok := d.GetOkExists("bootable"); ok {
req.Bootable = bootable.(bool)
}
if sortBy, ok := d.GetOk("sort_by"); ok {
@@ -90,7 +90,9 @@ func utilityImageListCheckPresence(ctx context.Context, d *schema.ResourceData,
if size, ok := d.GetOk("size"); ok {
req.Size = uint64(size.(int))
}
if enabled, ok := d.GetOkExists("enabled"); ok {
req.Enabled = enabled.(bool)
}
log.Debugf("utilityImageListCheckPresence: load image list")
imageList, err := c.CloudBroker().Image().List(ctx, req)
if err != nil {

View File

@@ -48,14 +48,6 @@ func SyncCreateRequest(ctx context.Context, d *schema.ResourceData, m interface{
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{}) {