Skip to content

Commit 8229ea0

Browse files
Extend method description
1 parent 3ba928d commit 8229ea0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

services/iaasalpha/wait/wait.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,15 @@ func DeleteServerWaitHandler(ctx context.Context, a APIClientInterface, projectI
178178
}
179179

180180
// ProjectRequestWaitHandler will wait for a request to succeed
181-
// 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
181+
// 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.
182+
// To get the raw http response of an operation using the SDK, use the runtime.WithCaptureHTTPResponse method from the core pkg.
183+
// 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.
184+
// Example usage:
185+
// var httpResp *http.Response
186+
// ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
187+
// err = iaasalphaClient.AddPublicIpToServer(ctxWithHTTPResp, projectId, serverId, publicIpId).Execute()
188+
// requestId := httpResp.Header[wait.XRequestIDHeader][0]
189+
// _, err = wait.ProjectRequestWaitHandler(context.Background(), iaasalphaClient, projectId, requestId).WaitWithContext(context.Background())
182190
func ProjectRequestWaitHandler(ctx context.Context, a APIClientInterface, projectId, requestId string) *wait.AsyncActionHandler[iaasalpha.Request] {
183191
handler := wait.New(func() (waitFinished bool, response *iaasalpha.Request, err error) {
184192
request, err := a.GetProjectRequestExecute(ctx, projectId, requestId)

0 commit comments

Comments
 (0)