tessl install tessl/golang-github-com--azure--azure-sdk-for-go--sdk--storage--azblob@1.6.0Azure Blob Storage SDK for Go providing comprehensive blob storage operations including uploads, downloads, container management, and advanced features like leases and SAS generation
The page blob client provides operations specific to page blobs, which support random read/write access in 512-byte pages. Page blobs are used for VHD files and other scenarios requiring random access.
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/pageblob"type Client struct {
// contains filtered or unexported fields
}func NewClient(blobURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error)
func NewClientWithSharedKeyCredential(blobURL string, cred *blob.SharedKeyCredential, options *ClientOptions) (*Client, error)
func NewClientFromConnectionString(connectionString, containerName, blobName string, options *ClientOptions) (*Client, error)
func NewClientWithNoCredential(blobURL string, options *ClientOptions) (*Client, error)func (c *Client) BlobClient() *blob.Client
func (c *Client) URL() string
func (c *Client) WithSnapshot(snapshot string) (*Client, error)
func (c *Client) WithVersionID(versionID string) (*Client, error)Creates a new page blob with a specified size.
func (c *Client) Create(ctx context.Context, size int64, o *CreateOptions) (CreateResponse, error)Options:
type CreateOptions struct {
HTTPHeaders *blob.HTTPHeaders
Metadata map[string]*string
Tags map[string]string
SequenceNumber *int64
AccessConditions *blob.AccessConditions
AccessTier *PremiumPageBlobAccessTier
CPKInfo *blob.CPKInfo
CPKScopeInfo *blob.CPKScopeInfo
}Uploads one or more pages to a page blob.
func (c *Client) UploadPages(ctx context.Context, body io.ReadSeekCloser, contentRange blob.HTTPRange, options *UploadPagesOptions) (UploadPagesResponse, error)Options:
type UploadPagesOptions struct {
CPKInfo *blob.CPKInfo
CPKScopeInfo *blob.CPKScopeInfo
LeaseAccessConditions *blob.LeaseAccessConditions
ModifiedAccessConditions *blob.ModifiedAccessConditions
SequenceNumberAccessConditions *SequenceNumberAccessConditions
TransferValidation blob.TransferValidationType
}
type SequenceNumberAccessConditions struct {
IfSequenceNumberLessThan *int64
IfSequenceNumberLessThanOrEqualTo *int64
IfSequenceNumberEqualTo *int64
}Example:
// Create page blob (size must be multiple of 512)
size := int64(512 * 100) // 100 pages
_, err := pageBlobClient.Create(ctx, size, nil)
// Upload pages
data := make([]byte, 512)
contentRange := blob.HTTPRange{Offset: 0, Count: 512}
_, err = pageBlobClient.UploadPages(ctx, streaming.NopCloser(bytes.NewReader(data)), contentRange, nil)Uploads pages from a URL source.
func (c *Client) UploadPagesFromURL(ctx context.Context, source string, sourceOffset, destOffset, count int64, o *UploadPagesFromURLOptions) (UploadPagesFromURLResponse, error)Clears one or more pages from a page blob.
func (c *Client) ClearPages(ctx context.Context, rnge blob.HTTPRange, options *ClearPagesOptions) (ClearPagesResponse, error)Resizes a page blob.
func (c *Client) Resize(ctx context.Context, size int64, options *ResizeOptions) (ResizeResponse, error)Updates the sequence number of a page blob.
func (c *Client) UpdateSequenceNumber(ctx context.Context, options *UpdateSequenceNumberOptions) (UpdateSequenceNumberResponse, error)Options:
type UpdateSequenceNumberOptions struct {
ActionType *SequenceNumberActionType
SequenceNumber *int64
LeaseAccessConditions *blob.LeaseAccessConditions
ModifiedAccessConditions *blob.ModifiedAccessConditions
}
type SequenceNumberActionType string
const (
SequenceNumberActionTypeMax SequenceNumberActionType = "max"
SequenceNumberActionTypeUpdate SequenceNumberActionType = "update"
SequenceNumberActionTypeIncrement SequenceNumberActionType = "increment"
)
func PossibleSequenceNumberActionTypeValues() []SequenceNumberActionTypeGets the list of valid page ranges.
func (c *Client) NewGetPageRangesPager(o *GetPageRangesOptions) *runtime.Pager[GetPageRangesResponse]Gets the difference in page ranges between a snapshot and the current blob.
func (c *Client) NewGetPageRangesDiffPager(o *GetPageRangesDiffOptions) *runtime.Pager[GetPageRangesDiffResponse]Gets the list of valid page ranges.
func (c *Client) NewGetPageRangesPager(o *GetPageRangesOptions) *runtime.Pager[GetPageRangesResponse]Returns a pager for iterating through valid page ranges in the page blob.
Options:
type GetPageRangesOptions struct {
Marker *string
MaxResults *int32
PrevSnapshotURL *string
PrevSnapshot *string
Range blob.HTTPRange
Snapshot *string
AccessConditions *blob.AccessConditions
}Gets the difference in page ranges between a snapshot and the current blob.
func (c *Client) NewGetPageRangesDiffPager(o *GetPageRangesDiffOptions) *runtime.Pager[GetPageRangesDiffResponse]Returns a pager for iterating through page ranges that differ between a snapshot and the current blob.
Options:
type GetPageRangesDiffOptions struct {
Marker *string
MaxResults *int32
PrevSnapshotURL *string
PrevSnapshot *string
Range blob.HTTPRange
Snapshot *string
AccessConditions *blob.AccessConditions
}Starts an incremental copy of a snapshot to this page blob.
func (c *Client) StartCopyIncremental(ctx context.Context, copySource string, prevSnapshot string, options *CopyIncrementalOptions) (CopyIncrementalResponse, error)Options:
type CopyIncrementalOptions struct {
ModifiedAccessConditions *blob.ModifiedAccessConditions
}const PageBytes int64 = 512type PremiumPageBlobAccessTier string
const (
PremiumPageBlobAccessTierP4 PremiumPageBlobAccessTier = "P4"
PremiumPageBlobAccessTierP6 PremiumPageBlobAccessTier = "P6"
PremiumPageBlobAccessTierP10 PremiumPageBlobAccessTier = "P10"
PremiumPageBlobAccessTierP15 PremiumPageBlobAccessTier = "P15"
PremiumPageBlobAccessTierP20 PremiumPageBlobAccessTier = "P20"
PremiumPageBlobAccessTierP30 PremiumPageBlobAccessTier = "P30"
PremiumPageBlobAccessTierP40 PremiumPageBlobAccessTier = "P40"
PremiumPageBlobAccessTierP50 PremiumPageBlobAccessTier = "P50"
PremiumPageBlobAccessTierP60 PremiumPageBlobAccessTier = "P60"
PremiumPageBlobAccessTierP70 PremiumPageBlobAccessTier = "P70"
PremiumPageBlobAccessTierP80 PremiumPageBlobAccessTier = "P80"
)
func PossiblePremiumPageBlobAccessTierValues() []PremiumPageBlobAccessTiertype CopyStatusType string
const (
CopyStatusTypePending CopyStatusType = "pending"
CopyStatusTypeSuccess CopyStatusType = "success"
CopyStatusTypeAborted CopyStatusType = "aborted"
CopyStatusTypeFailed CopyStatusType = "failed"
)
func PossibleCopyStatusTypeValues() []CopyStatusTypetype PageRange struct {
Start *int64
End *int64
}type ClearRange struct {
Start *int64
End *int64
}type PageList struct {
ClearRange []*ClearRange
NextMarker *string
PageRange []*PageRange
}type ClientOptions struct {
Telemetry policy.TelemetryOptions
Transport policy.Transporter
Retry policy.RetryOptions
PerCallPolicies []policy.Policy
PerRetryPolicies []policy.Policy
InsecureAllowCredentialWithHTTP bool
DisableRPRegistration bool
}