Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b152359706 | ||
| a844f6cc30 |
@@ -33,6 +33,7 @@ package image
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -94,11 +95,25 @@ func resourceImageCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
if architecture, ok := d.GetOk("architecture"); ok {
|
if architecture, ok := d.GetOk("architecture"); ok {
|
||||||
urlValues.Add("architecture", architecture.(string))
|
urlValues.Add("architecture", architecture.(string))
|
||||||
}
|
}
|
||||||
|
/* uncomment then OK
|
||||||
imageId, err := c.DecortAPICall(ctx, "POST", imageCreateAPI, urlValues)
|
imageId, err := c.DecortAPICall(ctx, "POST", imageCreateAPI, urlValues)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
//innovation
|
||||||
|
res, err := c.DecortAPICall(ctx, "POST", imageCreateAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
i := make([]interface{}, 0)
|
||||||
|
err = json.Unmarshal([]byte(res), &i)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
imageId := strconv.Itoa(int(i[1].(float64)))
|
||||||
|
// end innovation
|
||||||
|
|
||||||
d.SetId(imageId)
|
d.SetId(imageId)
|
||||||
d.Set("image_id", imageId)
|
d.Set("image_id", imageId)
|
||||||
|
|||||||
Reference in New Issue
Block a user