Skip to content

Commit 2615926

Browse files
committed
feat: Improve descriptions and comments
1 parent 46ac26f commit 2615926

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

examples/iaasalpha/image/image.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func main() {
5555
}
5656
req.Header.Set("Content-Type", "application/octet-stream")
5757

58-
fmt.Printf("[iaasalpha API] Uploading image %q...\n", *imageCreateResp.Id)
58+
fmt.Printf("[iaasalpha API] Uploading image contents to %q...\n", *imageCreateResp.Id)
5959
client := &http.Client{}
6060
resp, err := client.Do(req)
6161
if err != nil {
@@ -68,10 +68,10 @@ func main() {
6868
os.Exit(1)
6969
}
7070
_ = resp.Body.Close()
71-
fmt.Printf("[iaasalpha API] Image %q has been successfully uploaded.\n", *imageCreateResp.Id)
71+
fmt.Printf("[iaasalpha API] Image %q has been uploaded.\n", *imageCreateResp.Id)
7272

7373
// Wait for image to become available
74-
image, err := wait.ImageUploadWaitHandler(ctx, iaasalphaClient, projectId, *imageCreateResp.Id).WaitWithContext(ctx)
74+
image, err := wait.UploadImageWaitHandler(ctx, iaasalphaClient, projectId, *imageCreateResp.Id).WaitWithContext(ctx)
7575
if err != nil {
7676
fmt.Fprintf(os.Stderr, "[iaasalpha API] Error when waiting for upload: %v\n", err)
7777
os.Exit(1)

services/iaasalpha/wait/wait.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ func DeleteVirtualIPWaitHandler(ctx context.Context, a APIClientInterface, proje
350350
return handler
351351
}
352352

353-
// ImageUploadWaitHandler will wait for server creation
354-
func ImageUploadWaitHandler(ctx context.Context, a APIClientInterface, projectId, imageId string) *wait.AsyncActionHandler[iaasalpha.Image] {
353+
// UploadImageWaitHandler will wait for the status image to become AVAILABLE, which indicates the upload of the image has been completed successfully
354+
func UploadImageWaitHandler(ctx context.Context, a APIClientInterface, projectId, imageId string) *wait.AsyncActionHandler[iaasalpha.Image] {
355355
handler := wait.New(func() (waitFinished bool, response *iaasalpha.Image, err error) {
356356
image, err := a.GetImageExecute(ctx, projectId, imageId)
357357
if err != nil {
@@ -368,7 +368,7 @@ func ImageUploadWaitHandler(ctx context.Context, a APIClientInterface, projectId
368368
}
369369
return false, image, nil
370370
})
371-
handler.SetTimeout(15 * time.Minute)
371+
handler.SetTimeout(45 * time.Minute)
372372
return handler
373373
}
374374

services/iaasalpha/wait/wait_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ func TestImageUploadWaitHandler(t *testing.T) {
864864
}
865865
}
866866

867-
handler := ImageUploadWaitHandler(context.Background(), apiClient, "pid", "iid")
867+
handler := UploadImageWaitHandler(context.Background(), apiClient, "pid", "iid")
868868

869869
gotRes, err := handler.SetTimeout(10 * time.Millisecond).WaitWithContext(context.Background())
870870

0 commit comments

Comments
 (0)