This commit is contained in:
2023-07-26 13:32:39 +03:00
parent f731cf246f
commit 272e385318
167 changed files with 5194 additions and 890 deletions

View File

@@ -59,11 +59,6 @@ func dataSourceImageListSchemaMake() map[string]*schema.Schema {
Optional: true,
Description: "filter images by storage endpoint provider ID",
},
"shared_with": {
Type: schema.TypeInt,
Optional: true,
Description: "filter images by account ID availability",
},
"page": {
Type: schema.TypeInt,
Optional: true,

View File

@@ -82,9 +82,9 @@ func flattenHistory(history []image.History) []map[string]interface{} {
return temp
}
func flattenImageList(il image.ListImages) []map[string]interface{} {
func flattenImageList(il *image.ListImages) []map[string]interface{} {
res := make([]map[string]interface{}, 0)
for _, item := range il {
for _, item := range il.Data {
temp := map[string]interface{}{
"name": item.Name,
"url": item.URL,
@@ -130,9 +130,9 @@ func flattenImageList(il image.ListImages) []map[string]interface{} {
return res
}
func flattenImageListStacks(_ *schema.ResourceData, stack image.ListStacks) []map[string]interface{} {
func flattenImageListStacks(_ *schema.ResourceData, stack *image.ListStacks) []map[string]interface{} {
temp := make([]map[string]interface{}, 0)
for _, item := range stack {
for _, item := range stack.Data {
t := map[string]interface{}{
"api_url": item.APIURL,
"api_key": item.APIKey,

View File

@@ -41,16 +41,13 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func utilityImageListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (image.ListImages, error) {
func utilityImageListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*image.ListImages, error) {
c := m.(*controller.ControllerCfg)
req := image.ListRequest{}
if sepId, ok := d.GetOk("sep_id"); ok {
req.SepID = uint64(sepId.(int))
}
if sharedWith, ok := d.GetOk("shared_with"); ok {
req.SharedWith = uint64(sharedWith.(int))
}
if page, ok := d.GetOk("page"); ok {
req.Page = uint64(page.(int))

View File

@@ -41,7 +41,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func utilityImageListStacksCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (image.ListStacks, error) {
func utilityImageListStacksCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*image.ListStacks, error) {
c := m.(*controller.ControllerCfg)
req := image.ListStacksRequest{
ImageID: uint64(d.Get("image_id").(int)),