Skip to content

Commit 70ad185

Browse files
Update services/iaasalpha/wait/wait.go
Co-authored-by: João Palet <[email protected]>
1 parent 6907e22 commit 70ad185

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

services/iaasalpha/wait/wait.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,23 @@ func DeleteServerWaitHandler(ctx context.Context, a APIClientInterface, projectI
178178
return handler
179179
}
180180

181-
// ProjectRequestWaitHandler will wait for a request to succeed
182-
// It receives a request id that can be obtained from the x-request-id header in the http response of any operation in the IaaS API.
183-
// To get the raw http response of an operation using the SDK, use the runtime.WithCaptureHTTPResponse method from the core pkg.
184-
// Then the value of the request id can be obtained by accessing the header key which is defined in the constant XRequestIDHeader in this package.
181+
// ProjectRequestWaitHandler will wait for a request to succeed.
182+
//
183+
// It receives a request ID that can be obtained from the "X-Request-Id" header in the HTTP response of any operation in the IaaS API.
184+
// To get this response header, use the "runtime.WithCaptureHTTPResponse" method from the "core" packaghe to get the raw HTTP response of an SDK operation.
185+
// Then, the value of the request ID can be obtained by accessing the header key which is defined in the constant "XRequestIDHeader" of this package.
186+
//
185187
// Example usage:
186188
//
187189
// var httpResp *http.Response
190+
//
188191
// ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
192+
//
189193
// err = iaasalphaClient.AddPublicIpToServer(ctxWithHTTPResp, projectId, serverId, publicIpId).Execute()
194+
//
190195
// requestId := httpResp.Header[wait.XRequestIDHeader][0]
191-
//
192-
// _, err = wait.ProjectRequestWaitHandler(context.Background(), iaasalphaClient, projectId, requestId).WaitWithContext(context.Background())
196+
//
197+
// _, err = wait.ProjectRequestWaitHandler(context.Background(), iaasalphaClient, projectId, requestId).WaitWithContext(context.Background())
193198
func ProjectRequestWaitHandler(ctx context.Context, a APIClientInterface, projectId, requestId string) *wait.AsyncActionHandler[iaasalpha.Request] {
194199
handler := wait.New(func() (waitFinished bool, response *iaasalpha.Request, err error) {
195200
request, err := a.GetProjectRequestExecute(ctx, projectId, requestId)

0 commit comments

Comments
 (0)