vendor: update all dependencies

This commit is contained in:
Nick Craig-Wood 2019-04-13 13:47:57 +01:00
parent 8190a81201
commit 613a9bb86b
448 changed files with 62205 additions and 13395 deletions

View file

@ -61,6 +61,8 @@ func (v BlobSASSignatureValues) NewSASQueryParameters(sharedKeyCredential *Share
v.IPRange.String(),
string(v.Protocol),
v.Version,
resource,
"", // signed timestamp, @TODO add for snapshot sas feature
v.CacheControl, // rscc
v.ContentDisposition, // rscd
v.ContentEncoding, // rsce

View file

@ -69,6 +69,17 @@ func (ab AppendBlobURL) AppendBlock(ctx context.Context, body io.ReadSeeker, ac
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
}
// AppendBlockFromURL copies a new block of data from source URL to the end of the existing append blob.
// For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block-from-url.
func (ab AppendBlobURL) AppendBlockFromURL(ctx context.Context, sourceURL url.URL, offset int64, count int64, ac AppendBlobAccessConditions, transactionalMD5 []byte) (*AppendBlobAppendBlockFromURLResponse, error) {
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers()
ifAppendPositionEqual, ifMaxSizeLessThanOrEqual := ac.AppendPositionAccessConditions.pointers()
return ab.abClient.AppendBlockFromURL(ctx, sourceURL.String(), 0, httpRange{offset: offset, count: count}.pointers(),
transactionalMD5, nil, transactionalMD5, ac.LeaseAccessConditions.pointers(),
ifMaxSizeLessThanOrEqual, ifAppendPositionEqual,
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
}
type AppendBlobAccessConditions struct {
ModifiedAccessConditions
LeaseAccessConditions

View file

@ -72,6 +72,20 @@ func (pb PageBlobURL) UploadPages(ctx context.Context, offset int64, body io.Rea
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
}
// UploadPagesFromURL copies 1 or more pages from a source URL to the page blob.
// The sourceOffset specifies the start offset of source data to copy from.
// The destOffset specifies the start offset of data in page blob will be written to.
// The count must be a multiple of 512 bytes.
// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page-from-url.
func (pb PageBlobURL) UploadPagesFromURL(ctx context.Context, sourceURL url.URL, sourceOffset int64, destOffset int64, count int64, ac PageBlobAccessConditions, transactionalMD5 []byte) (*PageBlobUploadPagesFromURLResponse, error) {
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers()
ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual := ac.SequenceNumberAccessConditions.pointers()
return pb.pbClient.UploadPagesFromURL(ctx, sourceURL.String(), *PageRange{Start: sourceOffset, End: sourceOffset + count - 1}.pointers(), 0,
*PageRange{Start: destOffset, End: destOffset + count - 1}.pointers(), transactionalMD5, nil, ac.LeaseAccessConditions.pointers(),
ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual,
ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil)
}
// ClearPages frees the specified pages from the page blob.
// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page.
func (pb PageBlobURL) ClearPages(ctx context.Context, offset int64, count int64, ac PageBlobAccessConditions) (*PageBlobClearPagesResponse, error) {

View file

@ -1,3 +1,3 @@
package azblob
const serviceLibVersion = "0.5"
const serviceLibVersion = "0.6"

View file

@ -1,4 +1,4 @@
// +build linux darwin freebsd openbsd netbsd
// +build linux darwin freebsd openbsd netbsd dragonfly
package azblob

View file

@ -17,6 +17,9 @@ type PipelineOptions struct {
// Telemetry configures the built-in telemetry policy behavior.
Telemetry TelemetryOptions
// HTTPSender configures the sender of HTTP requests
HTTPSender pipeline.Factory
}
// NewPipeline creates a Pipeline using the specified credentials and options.
@ -35,8 +38,9 @@ func NewPipeline(c Credential, o PipelineOptions) pipeline.Pipeline {
f = append(f, c)
}
f = append(f,
pipeline.MethodFactoryMarker(), // indicates at what stage in the pipeline the method factory is invoked
NewRequestLogPolicyFactory(o.RequestLog))
NewRequestLogPolicyFactory(o.RequestLog),
pipeline.MethodFactoryMarker()) // indicates at what stage in the pipeline the method factory is invoked
return pipeline.NewPipeline(f, pipeline.Options{HTTPSender: nil, Log: o.Log})
return pipeline.NewPipeline(f, pipeline.Options{HTTPSender: o.HTTPSender, Log: o.Log})
}

View file

@ -120,7 +120,8 @@ func (o RetryOptions) calcDelay(try int32) time.Duration { // try is >=1; never
}
// Introduce some jitter: [0.0, 1.0) / 2 = [0.0, 0.5) + 0.8 = [0.8, 1.3)
delay = time.Duration(delay.Seconds() * (rand.Float64()/2 + 0.8) * float64(time.Second)) // NOTE: We want math/rand; not crypto/rand
// For casts and rounding - be careful, as per https://github.com/golang/go/issues/20757
delay = time.Duration(float32(delay) * (rand.Float32()/2 + 0.8)) // NOTE: We want math/rand; not crypto/rand
if delay > o.MaxRetryDelay {
delay = o.MaxRetryDelay
}
@ -157,7 +158,8 @@ func NewRetryPolicyFactory(o RetryOptions) pipeline.Factory {
logf("Primary try=%d, Delay=%v\n", primaryTry, delay)
time.Sleep(delay) // The 1st try returns 0 delay
} else {
delay := time.Second * time.Duration(rand.Float32()/2+0.8)
// For casts and rounding - be careful, as per https://github.com/golang/go/issues/20757
delay := time.Duration(float32(time.Second) * (rand.Float32()/2 + 0.8))
logf("Secondary try=%d, Delay=%v\n", try-primaryTry, delay)
time.Sleep(delay) // Delay with some jitter before trying secondary
}

View file

@ -6,14 +6,13 @@ package azblob
import (
"context"
"encoding/base64"
"github.com/Azure/azure-pipeline-go/pipeline"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"time"
"github.com/Azure/azure-pipeline-go/pipeline"
)
// appendBlobClient is the client for the AppendBlob methods of the Azblob service.
@ -123,6 +122,108 @@ func (client appendBlobClient) appendBlockResponder(resp pipeline.Response) (pip
return &AppendBlobAppendBlockResponse{rawResponse: resp.Response()}, err
}
// AppendBlockFromURL the Append Block operation commits a new block of data to the end of an existing append blob
// where the contents are read from a source url. The Append Block operation is permitted only if the blob was created
// with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later.
//
// sourceURL is specify a URL to the copy source. contentLength is the length of the request. sourceRange is bytes of
// source data in the specified range. sourceContentMD5 is specify the md5 calculated for the range of bytes that must
// be read from the copy source. timeout is the timeout parameter is expressed in seconds. For more information, see <a
// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
// Timeouts for Blob Service Operations.</a> transactionalContentMD5 is specify the transactional md5 for the body, to
// be validated by the service. leaseID is if specified, the operation only succeeds if the resource's lease is active
// and matches this ID. maxSize is optional conditional header. The max length in bytes permitted for the append blob.
// If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than
// the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code
// 412 - Precondition Failed). appendPosition is optional conditional header, used only for the Append Block operation.
// A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to
// this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412
// - Precondition Failed). ifModifiedSince is specify this header value to operate only on a blob if it has been
// modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if
// it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on blobs
// with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value.
// requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics
// logs when storage analytics logging is enabled.
func (client appendBlobClient) AppendBlockFromURL(ctx context.Context, sourceURL string, contentLength int64, sourceRange *string, sourceContentMD5 []byte, timeout *int32, transactionalContentMD5 []byte, leaseID *string, maxSize *int64, appendPosition *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*AppendBlobAppendBlockFromURLResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.appendBlockFromURLPreparer(sourceURL, contentLength, sourceRange, sourceContentMD5, timeout, transactionalContentMD5, leaseID, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID)
if err != nil {
return nil, err
}
resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.appendBlockFromURLResponder}, req)
if err != nil {
return nil, err
}
return resp.(*AppendBlobAppendBlockFromURLResponse), err
}
// appendBlockFromURLPreparer prepares the AppendBlockFromURL request.
func (client appendBlobClient) appendBlockFromURLPreparer(sourceURL string, contentLength int64, sourceRange *string, sourceContentMD5 []byte, timeout *int32, transactionalContentMD5 []byte, leaseID *string, maxSize *int64, appendPosition *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
}
params := req.URL.Query()
if timeout != nil {
params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
}
params.Set("comp", "appendblock")
req.URL.RawQuery = params.Encode()
req.Header.Set("x-ms-copy-source", sourceURL)
if sourceRange != nil {
req.Header.Set("x-ms-source-range", *sourceRange)
}
if sourceContentMD5 != nil {
req.Header.Set("x-ms-source-content-md5", base64.StdEncoding.EncodeToString(sourceContentMD5))
}
req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10))
if transactionalContentMD5 != nil {
req.Header.Set("Content-MD5", base64.StdEncoding.EncodeToString(transactionalContentMD5))
}
if leaseID != nil {
req.Header.Set("x-ms-lease-id", *leaseID)
}
if maxSize != nil {
req.Header.Set("x-ms-blob-condition-maxsize", strconv.FormatInt(*maxSize, 10))
}
if appendPosition != nil {
req.Header.Set("x-ms-blob-condition-appendpos", strconv.FormatInt(*appendPosition, 10))
}
if ifModifiedSince != nil {
req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
}
if ifUnmodifiedSince != nil {
req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
}
if ifMatch != nil {
req.Header.Set("If-Match", string(*ifMatch))
}
if ifNoneMatch != nil {
req.Header.Set("If-None-Match", string(*ifNoneMatch))
}
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
req.Header.Set("x-ms-client-request-id", *requestID)
}
return req, nil
}
// appendBlockFromURLResponder handles the response to the AppendBlockFromURL request.
func (client appendBlobClient) appendBlockFromURLResponder(resp pipeline.Response) (pipeline.Response, error) {
err := validateResponse(resp, http.StatusOK, http.StatusCreated)
if resp == nil {
return nil, err
}
io.Copy(ioutil.Discard, resp.Response().Body)
resp.Response().Body.Close()
return &AppendBlobAppendBlockFromURLResponse{rawResponse: resp.Response()}, err
}
// Create the Create Append Blob operation creates a new append blob.
//
// contentLength is the length of the request. timeout is the timeout parameter is expressed in seconds. For more

View file

@ -11,7 +11,7 @@ import (
const (
// ServiceVersion specifies the version of the operations used in this package.
ServiceVersion = "2018-03-28"
ServiceVersion = "2018-11-09"
)
// managementClient is the base client for Azblob.

View file

@ -654,6 +654,103 @@ func (ap *AccessPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) err
return d.DecodeElement(ap2, &start)
}
// AppendBlobAppendBlockFromURLResponse ...
type AppendBlobAppendBlockFromURLResponse struct {
rawResponse *http.Response
}
// Response returns the raw HTTP response object.
func (ababfur AppendBlobAppendBlockFromURLResponse) Response() *http.Response {
return ababfur.rawResponse
}
// StatusCode returns the HTTP status code of the response, e.g. 200.
func (ababfur AppendBlobAppendBlockFromURLResponse) StatusCode() int {
return ababfur.rawResponse.StatusCode
}
// Status returns the HTTP status message of the response, e.g. "200 OK".
func (ababfur AppendBlobAppendBlockFromURLResponse) Status() string {
return ababfur.rawResponse.Status
}
// BlobAppendOffset returns the value for header x-ms-blob-append-offset.
func (ababfur AppendBlobAppendBlockFromURLResponse) BlobAppendOffset() string {
return ababfur.rawResponse.Header.Get("x-ms-blob-append-offset")
}
// BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count.
func (ababfur AppendBlobAppendBlockFromURLResponse) BlobCommittedBlockCount() int32 {
s := ababfur.rawResponse.Header.Get("x-ms-blob-committed-block-count")
if s == "" {
return -1
}
i, err := strconv.ParseInt(s, 10, 32)
if err != nil {
i = 0
}
return int32(i)
}
// ContentMD5 returns the value for header Content-MD5.
func (ababfur AppendBlobAppendBlockFromURLResponse) ContentMD5() []byte {
s := ababfur.rawResponse.Header.Get("Content-MD5")
if s == "" {
return nil
}
b, err := base64.StdEncoding.DecodeString(s)
if err != nil {
b = nil
}
return b
}
// Date returns the value for header Date.
func (ababfur AppendBlobAppendBlockFromURLResponse) Date() time.Time {
s := ababfur.rawResponse.Header.Get("Date")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// ErrorCode returns the value for header x-ms-error-code.
func (ababfur AppendBlobAppendBlockFromURLResponse) ErrorCode() string {
return ababfur.rawResponse.Header.Get("x-ms-error-code")
}
// ETag returns the value for header ETag.
func (ababfur AppendBlobAppendBlockFromURLResponse) ETag() ETag {
return ETag(ababfur.rawResponse.Header.Get("ETag"))
}
// LastModified returns the value for header Last-Modified.
func (ababfur AppendBlobAppendBlockFromURLResponse) LastModified() time.Time {
s := ababfur.rawResponse.Header.Get("Last-Modified")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// RequestID returns the value for header x-ms-request-id.
func (ababfur AppendBlobAppendBlockFromURLResponse) RequestID() string {
return ababfur.rawResponse.Header.Get("x-ms-request-id")
}
// Version returns the value for header x-ms-version.
func (ababfur AppendBlobAppendBlockFromURLResponse) Version() string {
return ababfur.rawResponse.Header.Get("x-ms-version")
}
// AppendBlobAppendBlockResponse ...
type AppendBlobAppendBlockResponse struct {
rawResponse *http.Response
@ -4193,6 +4290,103 @@ func (pbusnr PageBlobUpdateSequenceNumberResponse) Version() string {
return pbusnr.rawResponse.Header.Get("x-ms-version")
}
// PageBlobUploadPagesFromURLResponse ...
type PageBlobUploadPagesFromURLResponse struct {
rawResponse *http.Response
}
// Response returns the raw HTTP response object.
func (pbupfur PageBlobUploadPagesFromURLResponse) Response() *http.Response {
return pbupfur.rawResponse
}
// StatusCode returns the HTTP status code of the response, e.g. 200.
func (pbupfur PageBlobUploadPagesFromURLResponse) StatusCode() int {
return pbupfur.rawResponse.StatusCode
}
// Status returns the HTTP status message of the response, e.g. "200 OK".
func (pbupfur PageBlobUploadPagesFromURLResponse) Status() string {
return pbupfur.rawResponse.Status
}
// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number.
func (pbupfur PageBlobUploadPagesFromURLResponse) BlobSequenceNumber() int64 {
s := pbupfur.rawResponse.Header.Get("x-ms-blob-sequence-number")
if s == "" {
return -1
}
i, err := strconv.ParseInt(s, 10, 64)
if err != nil {
i = 0
}
return i
}
// ContentMD5 returns the value for header Content-MD5.
func (pbupfur PageBlobUploadPagesFromURLResponse) ContentMD5() []byte {
s := pbupfur.rawResponse.Header.Get("Content-MD5")
if s == "" {
return nil
}
b, err := base64.StdEncoding.DecodeString(s)
if err != nil {
b = nil
}
return b
}
// Date returns the value for header Date.
func (pbupfur PageBlobUploadPagesFromURLResponse) Date() time.Time {
s := pbupfur.rawResponse.Header.Get("Date")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// ErrorCode returns the value for header x-ms-error-code.
func (pbupfur PageBlobUploadPagesFromURLResponse) ErrorCode() string {
return pbupfur.rawResponse.Header.Get("x-ms-error-code")
}
// ETag returns the value for header ETag.
func (pbupfur PageBlobUploadPagesFromURLResponse) ETag() ETag {
return ETag(pbupfur.rawResponse.Header.Get("ETag"))
}
// IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (pbupfur PageBlobUploadPagesFromURLResponse) IsServerEncrypted() string {
return pbupfur.rawResponse.Header.Get("x-ms-request-server-encrypted")
}
// LastModified returns the value for header Last-Modified.
func (pbupfur PageBlobUploadPagesFromURLResponse) LastModified() time.Time {
s := pbupfur.rawResponse.Header.Get("Last-Modified")
if s == "" {
return time.Time{}
}
t, err := time.Parse(time.RFC1123, s)
if err != nil {
t = time.Time{}
}
return t
}
// RequestID returns the value for header x-ms-request-id.
func (pbupfur PageBlobUploadPagesFromURLResponse) RequestID() string {
return pbupfur.rawResponse.Header.Get("x-ms-request-id")
}
// Version returns the value for header x-ms-version.
func (pbupfur PageBlobUploadPagesFromURLResponse) Version() string {
return pbupfur.rawResponse.Header.Get("x-ms-version")
}
// PageBlobUploadPagesResponse ...
type PageBlobUploadPagesResponse struct {
rawResponse *http.Response

View file

@ -778,3 +778,104 @@ func (client pageBlobClient) uploadPagesResponder(resp pipeline.Response) (pipel
resp.Response().Body.Close()
return &PageBlobUploadPagesResponse{rawResponse: resp.Response()}, err
}
// UploadPagesFromURL the Upload Pages operation writes a range of pages to a page blob where the contents are read
// from a URL
//
// sourceURL is specify a URL to the copy source. sourceRange is bytes of source data in the specified range. The
// length of this range should match the ContentLength header and x-ms-range/Range destination range header.
// contentLength is the length of the request. rangeParameter is the range of bytes to which the source range would be
// written. The range should be 512 aligned and range-end is required. sourceContentMD5 is specify the md5 calculated
// for the range of bytes that must be read from the copy source. timeout is the timeout parameter is expressed in
// seconds. For more information, see <a
// href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
// Timeouts for Blob Service Operations.</a> leaseID is if specified, the operation only succeeds if the resource's
// lease is active and matches this ID. ifSequenceNumberLessThanOrEqualTo is specify this header value to operate only
// on a blob if it has a sequence number less than or equal to the specified. ifSequenceNumberLessThan is specify this
// header value to operate only on a blob if it has a sequence number less than the specified. ifSequenceNumberEqualTo
// is specify this header value to operate only on a blob if it has the specified sequence number. ifModifiedSince is
// specify this header value to operate only on a blob if it has been modified since the specified date/time.
// ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been modified since the
// specified date/time. ifMatch is specify an ETag value to operate only on blobs with a matching value. ifNoneMatch is
// specify an ETag value to operate only on blobs without a matching value. requestID is provides a client-generated,
// opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is
// enabled.
func (client pageBlobClient) UploadPagesFromURL(ctx context.Context, sourceURL string, sourceRange string, contentLength int64, rangeParameter string, sourceContentMD5 []byte, timeout *int32, leaseID *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageBlobUploadPagesFromURLResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
req, err := client.uploadPagesFromURLPreparer(sourceURL, sourceRange, contentLength, rangeParameter, sourceContentMD5, timeout, leaseID, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID)
if err != nil {
return nil, err
}
resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.uploadPagesFromURLResponder}, req)
if err != nil {
return nil, err
}
return resp.(*PageBlobUploadPagesFromURLResponse), err
}
// uploadPagesFromURLPreparer prepares the UploadPagesFromURL request.
func (client pageBlobClient) uploadPagesFromURLPreparer(sourceURL string, sourceRange string, contentLength int64, rangeParameter string, sourceContentMD5 []byte, timeout *int32, leaseID *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
}
params := req.URL.Query()
if timeout != nil {
params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
}
params.Set("comp", "page")
req.URL.RawQuery = params.Encode()
req.Header.Set("x-ms-copy-source", sourceURL)
req.Header.Set("x-ms-source-range", sourceRange)
if sourceContentMD5 != nil {
req.Header.Set("x-ms-source-content-md5", base64.StdEncoding.EncodeToString(sourceContentMD5))
}
req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10))
req.Header.Set("x-ms-range", rangeParameter)
if leaseID != nil {
req.Header.Set("x-ms-lease-id", *leaseID)
}
if ifSequenceNumberLessThanOrEqualTo != nil {
req.Header.Set("x-ms-if-sequence-number-le", strconv.FormatInt(*ifSequenceNumberLessThanOrEqualTo, 10))
}
if ifSequenceNumberLessThan != nil {
req.Header.Set("x-ms-if-sequence-number-lt", strconv.FormatInt(*ifSequenceNumberLessThan, 10))
}
if ifSequenceNumberEqualTo != nil {
req.Header.Set("x-ms-if-sequence-number-eq", strconv.FormatInt(*ifSequenceNumberEqualTo, 10))
}
if ifModifiedSince != nil {
req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123))
}
if ifUnmodifiedSince != nil {
req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123))
}
if ifMatch != nil {
req.Header.Set("If-Match", string(*ifMatch))
}
if ifNoneMatch != nil {
req.Header.Set("If-None-Match", string(*ifNoneMatch))
}
req.Header.Set("x-ms-version", ServiceVersion)
if requestID != nil {
req.Header.Set("x-ms-client-request-id", *requestID)
}
req.Header.Set("x-ms-page-write", "update")
return req, nil
}
// uploadPagesFromURLResponder handles the response to the UploadPagesFromURL request.
func (client pageBlobClient) uploadPagesFromURLResponder(resp pipeline.Response) (pipeline.Response, error) {
err := validateResponse(resp, http.StatusOK, http.StatusCreated)
if resp == nil {
return nil, err
}
io.Copy(ioutil.Discard, resp.Response().Body)
resp.Response().Body.Close()
return &PageBlobUploadPagesFromURLResponse{rawResponse: resp.Response()}, err
}

View file

@ -5,7 +5,7 @@ package azblob
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/0.0.0 azblob/2018-03-28"
return "Azure-SDK-For-Go/0.0.0 azblob/2018-11-09"
}
// Version returns the semantic version (see http://semver.org) of the client.