@@ -105,40 +105,46 @@ Function Invoke-FabricRestMethod {
105
105
Write-Message - Message " No request body provided." - Level Debug
106
106
}
107
107
108
- $request = @ {
109
- Headers = $FabricSession.HeaderParams
110
- Uri = $Uri
111
- Method = $Method
112
- Body = $Body
113
- ContentType = " application/json"
114
- ErrorAction = ' Stop'
115
- SkipHttpErrorCheck = $true
116
- ResponseHeadersVariable = " responseHeader"
117
- StatusCodeVariable = " statusCode"
118
- }
119
- $response = Invoke-RestMethod @request
108
+ $repeat = $false
109
+ do {
110
+
111
+ $request = @ {
112
+ Headers = $FabricSession.HeaderParams
113
+ Uri = $Uri
114
+ Method = $Method
115
+ Body = $Body
116
+ ContentType = " application/json"
117
+ ErrorAction = ' Stop'
118
+ SkipHttpErrorCheck = $true
119
+ ResponseHeadersVariable = " responseHeader"
120
+ StatusCodeVariable = " statusCode"
121
+ }
122
+ $response = Invoke-RestMethod @request
120
123
121
- Write-Message - Message " Result response code: $statusCode " - Level Debug
122
- if ($response ) {
123
- Write-Message - Message " Result return: $response " - Level Debug
124
- }
125
- # Needed for backward compatibility, example: Get-FabricWorkspace
126
- $script :statusCode = $statusCode
127
- $script :responseHeader = $responseHeader
128
-
129
- if ($HandleResponse ) {
130
- $params = @ {
131
- Response = $response
132
- ResponseHeader = $responseHeader
133
- StatusCode = $statusCode
134
- Operation = (Get-PSCallStack )[1 ].Command.Split(' -' )[0 ]
135
- ObjectIdOrName = $ObjectIdOrName
136
- TypeName = $TypeName
137
- NoWait = $NoWait
138
- SuccessMessage = $SuccessMessage
124
+ Write-Message - Message " Result response code: $statusCode " - Level Debug
125
+ if ($response ) {
126
+ Write-Message - Message " Result return: $response " - Level Debug
139
127
}
140
- $response = Test-FabricApiResponse @params
141
- }
128
+ # Needed for backward compatibility, example: Get-FabricWorkspace
129
+ $script :statusCode = $statusCode
130
+ $script :responseHeader = $responseHeader
131
+
132
+ if ($HandleResponse ) {
133
+ $params = @ {
134
+ Response = $response
135
+ ResponseHeader = $responseHeader
136
+ StatusCode = $statusCode
137
+ Operation = (Get-PSCallStack )[1 ].Command.Split(' -' )[0 ]
138
+ ObjectIdOrName = $ObjectIdOrName
139
+ TypeName = $TypeName
140
+ NoWait = $NoWait
141
+ SuccessMessage = $SuccessMessage
142
+ }
143
+ $response = Test-FabricApiResponse @params
144
+ $repeat = $response -is [string ] -and $response -eq " Command:Repeat"
145
+ }
146
+
147
+ } while ($repeat )
142
148
143
149
Write-Message - Message " ::End" - Level Debug
144
150
$response
0 commit comments