@@ -78,14 +78,14 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
7878 // Get source name for label (use ID if name not available)
7979 sourceLabel := model .SourceID
8080 if model .SourceType == "volume" {
81- name , err := iaasutils .GetVolumeName (ctx , apiClient , model .ProjectId , model .SourceID )
81+ name , err := iaasutils .GetVolumeName (ctx , apiClient , model .ProjectId , model .Region , model . SourceID )
8282 if err != nil {
8383 params .Printer .Debug (print .ErrorLevel , "get volume name: %v" , err )
8484 } else if name != "" {
8585 sourceLabel = name
8686 }
8787 } else if model .SourceType == "snapshot" {
88- name , err := iaasutils .GetSnapshotName (ctx , apiClient , model .ProjectId , model .SourceID )
88+ name , err := iaasutils .GetSnapshotName (ctx , apiClient , model .ProjectId , model .Region , model . SourceID )
8989 if err != nil {
9090 params .Printer .Debug (print .ErrorLevel , "get snapshot name: %v" , err )
9191 } else if name != "" {
@@ -107,12 +107,16 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
107107 if err != nil {
108108 return fmt .Errorf ("create volume backup: %w" , err )
109109 }
110+ if resp == nil || resp .Id == nil {
111+ return fmt .Errorf ("create volume: empty response" )
112+ }
113+ volumeId := * resp .Id
110114
111115 // Wait for async operation, if async mode not enabled
112116 if ! model .Async {
113117 s := spinner .New (params .Printer )
114118 s .Start ("Creating backup" )
115- resp , err = wait .CreateBackupWaitHandler (ctx , apiClient , model .ProjectId , * resp . Id ).WaitWithContext (ctx )
119+ resp , err = wait .CreateBackupWaitHandler (ctx , apiClient , model .ProjectId , model . Region , volumeId ).WaitWithContext (ctx )
116120 if err != nil {
117121 return fmt .Errorf ("wait for backup creation: %w" , err )
118122 }
@@ -169,7 +173,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
169173}
170174
171175func buildRequest (ctx context.Context , model * inputModel , apiClient * iaas.APIClient ) iaas.ApiCreateBackupRequest {
172- req := apiClient .CreateBackup (ctx , model .ProjectId )
176+ req := apiClient .CreateBackup (ctx , model .ProjectId , model . Region )
173177
174178 payload := iaas.CreateBackupPayload {
175179 Name : model .Name ,
0 commit comments