@@ -104,7 +104,7 @@ public partial class NewAzWorkloadsSapVirtualInstance_CreateWithJsonString : glo
104104 ReadOnly = false ,
105105 Description = @"The name of the Virtual Instances for SAP solutions resource" ,
106106 SerializedName = @"sapVirtualInstanceName" ,
107- PossibleTypes = new [ ] { typeof ( string ) } ) ]
107+ PossibleTypes = new [ ] { typeof ( string ) } ) ]
108108 [ global ::System . Management . Automation . Alias ( "SapVirtualInstanceName" ) ]
109109 [ global ::Microsoft . Azure . PowerShell . Cmdlets . Workloads . SapVirtualInstance . Category ( global ::Microsoft . Azure . PowerShell . Cmdlets . Workloads . SapVirtualInstance . ParameterCategory . Path ) ]
110110 public string Name { get => this . _name ; set => this . _name = value ; }
@@ -148,7 +148,7 @@ public partial class NewAzWorkloadsSapVirtualInstance_CreateWithJsonString : glo
148148 ReadOnly = false ,
149149 Description = @"The name of the resource group. The name is case insensitive." ,
150150 SerializedName = @"resourceGroupName" ,
151- PossibleTypes = new [ ] { typeof ( string ) } ) ]
151+ PossibleTypes = new [ ] { typeof ( string ) } ) ]
152152 [ global ::Microsoft . Azure . PowerShell . Cmdlets . Workloads . SapVirtualInstance . Category ( global ::Microsoft . Azure . PowerShell . Cmdlets . Workloads . SapVirtualInstance . ParameterCategory . Path ) ]
153153 public string ResourceGroupName { get => this . _resourceGroupName ; set => this . _resourceGroupName = value ; }
154154
@@ -287,11 +287,36 @@ protected override void EndProcessing()
287287 WriteError ( new global ::System . Management . Automation . ErrorRecord ( new global ::System . Exception ( messageData ( ) . Message ) , string . Empty , global ::System . Management . Automation . ErrorCategory . NotSpecified , null ) ) ;
288288 return ;
289289 }
290+ case Microsoft . Azure . PowerShell . Cmdlets . Workloads . SapVirtualInstance . Runtime . Events . Progress :
291+ {
292+ var data = messageData ( ) ;
293+ int progress = ( int ) data . Value ;
294+ string activityMessage , statusDescription ;
295+ global ::System . Management . Automation . ProgressRecordType recordType ;
296+ if ( progress < 100 )
297+ {
298+ activityMessage = "In progress" ;
299+ statusDescription = "Checking operation status" ;
300+ recordType = System . Management . Automation . ProgressRecordType . Processing ;
301+ }
302+ else
303+ {
304+ activityMessage = "Completed" ;
305+ statusDescription = "Completed" ;
306+ recordType = System . Management . Automation . ProgressRecordType . Completed ;
307+ }
308+ WriteProgress ( new global ::System . Management . Automation . ProgressRecord ( 1 , activityMessage , statusDescription )
309+ {
310+ PercentComplete = progress ,
311+ RecordType = recordType
312+ } ) ;
313+ return ;
314+ }
290315 case Microsoft . Azure . PowerShell . Cmdlets . Workloads . SapVirtualInstance . Runtime . Events . DelayBeforePolling :
291316 {
317+ var data = messageData ( ) ;
292318 if ( true == MyInvocation ? . BoundParameters ? . ContainsKey ( "NoWait" ) )
293319 {
294- var data = messageData ( ) ;
295320 if ( data . ResponseMessage is System . Net . Http . HttpResponseMessage response )
296321 {
297322 var asyncOperation = response . GetFirstHeader ( @"Azure-AsyncOperation" ) ;
@@ -303,6 +328,22 @@ protected override void EndProcessing()
303328 return ;
304329 }
305330 }
331+ else
332+ {
333+ if ( data . ResponseMessage is System . Net . Http . HttpResponseMessage response )
334+ {
335+ int delay = ( int ) ( response . Headers . RetryAfter ? . Delta ? . TotalSeconds ?? 30 ) ;
336+ WriteDebug ( $ "Delaying { delay } seconds before polling.") ;
337+ for ( var now = 0 ; now < delay ; ++ now )
338+ {
339+ WriteProgress ( new global ::System . Management . Automation . ProgressRecord ( 1 , "In progress" , "Checking operation status" )
340+ {
341+ PercentComplete = now * 100 / delay
342+ } ) ;
343+ await global ::System . Threading . Tasks . Task . Delay ( 1000 , token ) ;
344+ }
345+ }
346+ }
306347 break ;
307348 }
308349 }
0 commit comments