func CreateOrReplaceAppendBlob()

in pkg/download/blob.go [118:142]


func CreateOrReplaceAppendBlob(blobURI, blobSas string) (*storage.Blob, error) {

	bloburl, err := url.Parse(blobURI + blobSas)
	if err != nil {
		return nil, err
	}

	containerRef, err := storage.GetContainerReferenceFromSASURI(*bloburl)
	if err != nil {
		return nil, err
	}

	fileName, blobPathError := getBlobPathAfterContainerName(blobURI, containerRef.Name)
	if fileName == "" {
		return nil, errors.Wrapf(blobPathError, "cannot extract blob path name from URL: %q", GetUriForLogging(blobURI))
	}

	blobref := containerRef.GetBlobReference(fileName)
	err = blobref.PutAppendBlob(nil) // Create the append blob
	if err != nil {
		return nil, err
	}

	return blobref, nil
}