| 1 | package blobsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.13 context/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 6 | "timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 7 | ) |
| 8 | |
| 9 | // CopyAndWait copies a blob to a destination within the storage account and waits for it to finish copying. |
| 10 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/Client#) CopyAndWaitscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/Client#CopyAndWait().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, accountName, containerName, blobName string, input CopyInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/CopyInput#, pollingInterval timescip-go gomod github.com/golang/go/src go1.13 time/.Durationscip-go gomod github.com/golang/go/src go1.13 time/Duration#) error { |
| 11 | if _, err := client.Copyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/Client#Copy().(ctx, accountName, containerName, blobName, input); err != nil { |
| 12 | return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error copying: %s", err) |
| 13 | } |
| 14 | |
| 15 | for true { |
| 16 | getInput := GetPropertiesInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/GetPropertiesInput#{ |
| 17 | LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/GetPropertiesInput#LeaseID.: input.LeaseIDscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/CopyInput#LeaseID., |
| 18 | } |
| 19 | getResult, err := client.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/Client#GetProperties().(ctx, accountName, containerName, blobName, getInput) |
| 20 | if err != nil { |
| 21 | return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("") |
| 22 | } |
| 23 | |
| 24 | switch getResult.CopyStatusscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/GetPropertiesResult#CopyStatus. { |
| 25 | case Abortedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/Aborted.: |
| 26 | return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Copy was aborted: %s", getResult.CopyStatusDescriptionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/GetPropertiesResult#CopyStatusDescription.) |
| 27 | |
| 28 | case Failedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/Failed.: |
| 29 | return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Copy failed: %s", getResult.CopyStatusDescriptionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/GetPropertiesResult#CopyStatusDescription.) |
| 30 | |
| 31 | case Successscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/Success.: |
| 32 | return nil |
| 33 | |
| 34 | case Pendingscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2017-07-29/blob/blobs`/Pending.: |
| 35 | timescip-go gomod github.com/golang/go/src go1.13 time/.Sleepscip-go gomod github.com/golang/go/src go1.13 time/Sleep().(pollingInterval) |
| 36 | continue |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Unexpected error waiting for the copy to complete") |
| 41 | } |