|
|
@ -83,7 +83,7 @@ func resourceBasicServiceCreate(ctx context.Context, d *schema.ResourceData, m i
|
|
|
|
func resourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
|
|
|
func resourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
|
|
|
log.Debugf("resourceBasicServiceRead")
|
|
|
|
log.Debugf("resourceBasicServiceRead")
|
|
|
|
|
|
|
|
|
|
|
|
c := m.(*controller.ControllerCfg)
|
|
|
|
// c := m.(*controller.ControllerCfg)
|
|
|
|
|
|
|
|
|
|
|
|
bs, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
|
|
|
bs, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -104,29 +104,30 @@ func resourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m int
|
|
|
|
case status.Disabling:
|
|
|
|
case status.Disabling:
|
|
|
|
log.Debugf("The basic service is in status: %s, troubles can occur with the update.", bs.Status)
|
|
|
|
log.Debugf("The basic service is in status: %s, troubles can occur with the update.", bs.Status)
|
|
|
|
case status.Deleted:
|
|
|
|
case status.Deleted:
|
|
|
|
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
|
|
|
// id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
|
|
|
restoreReq := bservice.RestoreRequest{
|
|
|
|
// restoreReq := bservice.RestoreRequest{
|
|
|
|
ServiceID: id,
|
|
|
|
// ServiceID: id,
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
enableReq := bservice.EnableRequest{
|
|
|
|
// enableReq := bservice.EnableRequest{
|
|
|
|
ServiceID: id,
|
|
|
|
// ServiceID: id,
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
_, err := c.CloudAPI().BService().Restore(ctx, restoreReq)
|
|
|
|
// _, err := c.CloudAPI().BService().Restore(ctx, restoreReq)
|
|
|
|
if err != nil {
|
|
|
|
// if err != nil {
|
|
|
|
return diag.FromErr(err)
|
|
|
|
// return diag.FromErr(err)
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
_, err = c.CloudAPI().BService().Enable(ctx, enableReq)
|
|
|
|
// _, err = c.CloudAPI().BService().Enable(ctx, enableReq)
|
|
|
|
if err != nil {
|
|
|
|
// if err != nil {
|
|
|
|
return diag.FromErr(err)
|
|
|
|
// return diag.FromErr(err)
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
hasChanged = true
|
|
|
|
// hasChanged = true
|
|
|
|
case status.Deleting:
|
|
|
|
case status.Deleting:
|
|
|
|
case status.Destroyed:
|
|
|
|
case status.Destroyed:
|
|
|
|
d.SetId("")
|
|
|
|
d.SetId("")
|
|
|
|
return resourceBasicServiceCreate(ctx, d, m)
|
|
|
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
|
|
|
|
|
|
|
// return resourceBasicServiceCreate(ctx, d, m)
|
|
|
|
case status.Destroying:
|
|
|
|
case status.Destroying:
|
|
|
|
return diag.Errorf("The basic service is in progress with status: %s", bs.Status)
|
|
|
|
return diag.Errorf("The basic service is in progress with status: %s", bs.Status)
|
|
|
|
case status.Restoring:
|
|
|
|
case status.Restoring:
|
|
|
@ -224,7 +225,8 @@ func resourceBasicServiceUpdate(ctx context.Context, d *schema.ResourceData, m i
|
|
|
|
case status.Deleting:
|
|
|
|
case status.Deleting:
|
|
|
|
case status.Destroyed:
|
|
|
|
case status.Destroyed:
|
|
|
|
d.SetId("")
|
|
|
|
d.SetId("")
|
|
|
|
return resourceBasicServiceCreate(ctx, d, m)
|
|
|
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
|
|
|
|
|
|
|
// return resourceBasicServiceCreate(ctx, d, m)
|
|
|
|
case status.Destroying:
|
|
|
|
case status.Destroying:
|
|
|
|
return diag.Errorf("The basic service is in progress with status: %s", bs.Status)
|
|
|
|
return diag.Errorf("The basic service is in progress with status: %s", bs.Status)
|
|
|
|
case status.Restoring:
|
|
|
|
case status.Restoring:
|
|
|
|