Skip to content

Commit

Permalink
Undo name change
Browse files Browse the repository at this point in the history
  • Loading branch information
ismirlia committed Feb 7, 2024
1 parent 5c0c741 commit a11439b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions clients/instance/ibm-pi-snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,19 @@ func (f *IBMPISnapshotClient) Restore(instanceID, snapshotID, restoreFailAction
}
return resp.Payload, nil
}

// Deprecated Restore function a Snapshot
func (f *IBMPISnapshotClient) Create(instanceID, snapshotID string, body *models.SnapshotRestore) (*models.Snapshot, error) {
params := p_cloud_p_vm_instances.NewPcloudPvminstancesSnapshotsRestorePostParams().
WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).
WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(instanceID).
WithSnapshotID(snapshotID).WithBody(body)
resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsRestorePost(params, f.session.AuthInfo(f.cloudInstanceID))
if err != nil {
return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to restore PI Snapshot %s of the instance %s: %w", snapshotID, instanceID, err))
}
if resp == nil || resp.Payload == nil {
return nil, fmt.Errorf("failed to restore PI Snapshot %s of the instance %s", snapshotID, instanceID)
}
return resp.Payload, nil
}

0 comments on commit a11439b

Please sign in to comment.