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 lease package provides exclusive locking mechanisms for blobs and containers to prevent concurrent modifications.
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/lease"type BlobClient struct {
// contains filtered or unexported fields
}Generic constructor supporting all blob types.
func NewBlobClient[T appendblob.Client | blob.Client | blockblob.Client | pageblob.Client](client *T, options *BlobClientOptions) (*BlobClient, error)Example:
import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/lease"
)
blobClient, err := blob.NewClient(blobURL, cred, nil)
leaseClient, err := lease.NewBlobClient(blobClient, nil)func (c *BlobClient) LeaseID() *stringReturns the current lease ID.
func (c *BlobClient) AcquireLease(ctx context.Context, duration int32, o *BlobAcquireOptions) (BlobAcquireResponse, error)Acquires a lease on the blob. Duration is in seconds (-1 for infinite).
Example:
// Acquire 60-second lease
resp, err := leaseClient.AcquireLease(ctx, 60, nil)
if err != nil {
// handle error
}
// Acquire infinite lease
resp, err := leaseClient.AcquireLease(ctx, -1, nil)func (c *BlobClient) ReleaseLease(ctx context.Context, o *BlobReleaseOptions) (BlobReleaseResponse, error)Releases an acquired lease.
func (c *BlobClient) RenewLease(ctx context.Context, o *BlobRenewOptions) (BlobRenewResponse, error)Renews a lease.
func (c *BlobClient) BreakLease(ctx context.Context, o *BlobBreakOptions) (BlobBreakResponse, error)Breaks a lease. Pass lease.BreakNaturally to let the lease expire naturally.
Options:
type BlobBreakOptions struct {
BreakPeriod *int32
ModifiedAccessConditions *ModifiedAccessConditions
}func (c *BlobClient) ChangeLease(ctx context.Context, proposedLeaseID string, o *BlobChangeOptions) (BlobChangeResponse, error)Changes the lease ID.
type ContainerClient struct {
// contains filtered or unexported fields
}func NewContainerClient(client *container.Client, options *ContainerClientOptions) (*ContainerClient, error)func (c *ContainerClient) LeaseID() *stringfunc (c *ContainerClient) AcquireLease(ctx context.Context, duration int32, o *ContainerAcquireOptions) (ContainerAcquireResponse, error)func (c *ContainerClient) ReleaseLease(ctx context.Context, o *ContainerReleaseOptions) (ContainerReleaseResponse, error)func (c *ContainerClient) RenewLease(ctx context.Context, o *ContainerRenewOptions) (ContainerRenewResponse, error)func (c *ContainerClient) BreakLease(ctx context.Context, o *ContainerBreakOptions) (ContainerBreakResponse, error)func (c *ContainerClient) ChangeLease(ctx context.Context, proposedLeaseID string, o *ContainerChangeOptions) (ContainerChangeResponse, error)const BreakNaturally int32 = -1type DurationType string
const (
DurationTypeInfinite DurationType = "infinite"
DurationTypeFixed DurationType = "fixed"
)
func PossibleDurationTypeValues() []DurationTypetype StateType string
const (
StateTypeAvailable StateType = "available"
StateTypeLeased StateType = "leased"
StateTypeExpired StateType = "expired"
StateTypeBreaking StateType = "breaking"
StateTypeBroken StateType = "broken"
)
func PossibleStateTypeValues() []StateTypetype StatusType string
const (
StatusTypeLocked StatusType = "locked"
StatusTypeUnlocked StatusType = "unlocked"
)
func PossibleStatusTypeValues() []StatusTypetype BlobAcquireOptions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type BlobReleaseOptions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type BlobRenewOptions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type BlobBreakOptions struct {
BreakPeriod *int32
ModifiedAccessConditions *ModifiedAccessConditions
}
type BlobChangeOptions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type BlobClientOptions struct {
LeaseID *string
}type ContainerAcquireOptions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type ContainerReleaseOptions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type ContainerRenewOptions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type ContainerBreakOptions struct {
BreakPeriod *int32
ModifiedAccessConditions *ModifiedAccessConditions
}
type ContainerChangeOptions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type ContainerClientOptions struct {
LeaseID *string
}type AccessConditions struct {
ModifiedAccessConditions *ModifiedAccessConditions
}
type ModifiedAccessConditions struct {
IfMatch *azcore.ETag
IfNoneMatch *azcore.ETag
IfModifiedSince *time.Time
IfUnmodifiedSince *time.Time
IfTags *string
}