exported

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventUpload is used when we compute number of blocks to upload and size of each block.
	EventUpload log.Event = "azblob.Upload"

	// EventSubmitBatch is used for logging events related to submit blob batch operation.
	EventSubmitBatch log.Event = "azblob.SubmitBatch"
)

NOTE: these are publicly exported via type-aliasing in azblob/log.go

View Source
const (
	ModuleName    = "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
	ModuleVersion = "v1.8.1"
)
View Source
const SnapshotTimeFormat = "2006-01-02T15:04:05.0000000Z07:00"

Variables

This section is empty.

Functions

func ComputeHMACSHA256

func ComputeHMACSHA256(cred *SharedKeyCredential, message string) (string, error)

ComputeHMACSHA256 is a helper for computing the signed string outside of this package.

func ComputeUDCHMACSHA256

func ComputeUDCHMACSHA256(udc *UserDelegationCredential, message string) (string, error)

ComputeUDCHMACSHA256 is a helper method for computing the signed string outside this package.

func CreateBatchRequest added in v1.1.0

func CreateBatchRequest(bb *BlobBatchBuilder) ([]byte, string, error)

CreateBatchRequest creates a new batch request using the sub-requests present in the BlobBatchBuilder.

Example of a sub-request in the batch request body:

--batch_357de4f7-6d0b-4e02-8cd2-6361411a9525
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 0

DELETE /container0/blob0 HTTP/1.1
x-ms-date: Thu, 14 Jun 2018 16:46:54 GMT
Authorization: SharedKey account:<redacted>
Content-Length: 0

func FormatHTTPRange

func FormatHTTPRange(r HTTPRange) *string

FormatHTTPRange converts an HTTPRange to its string format.

func GetAccountName

func GetAccountName(udc *UserDelegationCredential) string

GetAccountName is a helper method for accessing the user delegation key parameters outside this package.

func GetHTTPRangeOrDefault

func GetHTTPRangeOrDefault(r HTTPRange) string

GetHTTPRangeOrDefault returns a formatted HTTPRange or the empty string. Use this helper when the range string parameter is required and empty string is allowed.

func GetStructuredBodyType

func GetStructuredBodyType(tv TransferValidationType) string

GetStructuredBodyType returns the structured body header value if the given TransferValidationType is a structured message type, or empty string otherwise.

func SupportsMultiBlock

func SupportsMultiBlock(tv TransferValidationType) bool

SupportsMultiBlock reports whether the validation type can be used with multi-block uploads. Precomputed checksums (TransferValidationTypeCRC64, TransferValidationTypeMD5) cover the entire payload and cannot validate individual blocks, so they return false.

func UpdateSubRequestHeaders added in v1.1.0

func UpdateSubRequestHeaders(req *policy.Request)

UpdateSubRequestHeaders updates the sub-request headers. Removes x-ms-version header.

Types

type AccessPolicyPermission

type AccessPolicyPermission struct {
	Read, Add, Create, Write, Delete, List bool
}

AccessPolicyPermission type simplifies creating the permissions string for a container's access policy. Initialize an instance of this type and then call its String method to set AccessPolicy's Permission field.

func (*AccessPolicyPermission) Parse

func (p *AccessPolicyPermission) Parse(s string) error

Parse initializes the AccessPolicyPermission's fields from a string.

func (*AccessPolicyPermission) String

func (p *AccessPolicyPermission) String() string

String produces the access policy permission string for an Azure Storage container. Call this method to set AccessPolicy's Permission field.

type BatchResponseItem added in v1.1.0

type BatchResponseItem struct {
	ContentID     *int
	ContainerName *string
	BlobName      *string
	RequestID     *string
	Version       *string
	Error         error // nil error indicates that the batch sub-request operation is successful
}

BatchResponseItem contains the response for the individual sub-requests.

func ParseBlobBatchResponse added in v1.1.0

func ParseBlobBatchResponse(respBody io.ReadCloser, contentType *string, subRequests []*policy.Request) ([]*BatchResponseItem, error)

ParseBlobBatchResponse is used for parsing the batch response body into individual sub-responses for each item in the batch.

type BlobAccessConditions

type BlobAccessConditions struct {
	LeaseAccessConditions    *LeaseAccessConditions
	ModifiedAccessConditions *ModifiedAccessConditions
}

BlobAccessConditions identifies blob-specific access conditions which you optionally set.

type BlobBatchBuilder added in v1.1.0

type BlobBatchBuilder struct {
	AuthPolicy  policy.Policy
	SubRequests []*policy.Request
}

BlobBatchBuilder is used for creating the blob batch request

type BlobBatchOperationType added in v1.1.0

type BlobBatchOperationType string

BlobBatchOperationType defines the operation of the blob batch sub-requests.

const (
	BatchDeleteOperationType  BlobBatchOperationType = "delete"
	BatchSetTierOperationType BlobBatchOperationType = "set tier"
)

type BlobModifiedAccessConditions added in v1.6.4

type BlobModifiedAccessConditions = generated.BlobModifiedAccessConditions

func FormatBlobModifiedAccessConditions added in v1.6.4

func FormatBlobModifiedAccessConditions(src *BlobModifiedAccessConditions) *BlobModifiedAccessConditions

type ContainerAccessConditions

type ContainerAccessConditions struct {
	ModifiedAccessConditions *ModifiedAccessConditions
	LeaseAccessConditions    *LeaseAccessConditions
}

ContainerAccessConditions identifies container-specific access conditions which you optionally set.

type ExpectContinueMode added in v1.8.0

type ExpectContinueMode int

ExpectContinueMode is the mode for applying the HTTP "Expect: 100-continue" header to requests with a body.

const (
	// ExpectContinueModeApplyOnThrottle indicates that Expect-Continue will not be applied until
	// specific errors are encountered from the service, at which point it will be applied for a
	// fixed window of time after the last triggering error.
	//
	// Response codes that trigger this behavior are 429, 500, and 503. This is the default behavior.
	ExpectContinueModeApplyOnThrottle ExpectContinueMode = 0

	// ExpectContinueModeOn indicates Expect-Continue will be applied regardless of recent error status.
	// The ContentLengthThreshold option still applies.
	ExpectContinueModeOn ExpectContinueMode = 1

	// ExpectContinueModeOff indicates Expect-Continue will never be applied.
	ExpectContinueModeOff ExpectContinueMode = 2
)

type ExpectContinueOptions added in v1.8.0

type ExpectContinueOptions struct {
	// Mode controls when the Expect: 100-continue header is applied. The default value
	// (ExpectContinueModeApplyOnThrottle) applies the header for a fixed time window after
	// the service responds with a throttle/server-error status (429, 500, or 503).
	Mode ExpectContinueMode

	// ContentLengthThreshold is the minimum value of HTTP request Content-Length for applying
	// the Expect: 100-continue header. The default is zero, meaning any request that has a
	// non-empty body and a computable content length is eligible.
	ContentLengthThreshold int64

	// ThrottleInterval is used in ExpectContinueModeApplyOnThrottle mode to set the time window
	// during which the Expect: 100-continue header is applied after a triggering error response
	// (429, 500, or 503) is observed. A zero value uses the default of one minute.
	ThrottleInterval time.Duration
}

ExpectContinueOptions configures the behavior for applying the HTTP "Expect: 100-continue" header to operations that include a request body.

type ExpiryType added in v0.6.0

type ExpiryType interface {
	Format(o *SetExpiryOptions) (generated.ExpiryOptions, *generated.BlobClientSetExpiryOptions)
	// contains filtered or unexported methods
}

ExpiryType defines values for ExpiryType

type ExpiryTypeAbsolute added in v0.6.0

type ExpiryTypeAbsolute time.Time

ExpiryTypeAbsolute defines the absolute time for the blob expiry

func (ExpiryTypeAbsolute) Format added in v0.6.0

type ExpiryTypeNever added in v0.6.0

type ExpiryTypeNever struct {
}

ExpiryTypeNever defines that the blob will be set to never expire

func (ExpiryTypeNever) Format added in v0.6.0

type ExpiryTypeRelativeToCreation added in v0.6.0

type ExpiryTypeRelativeToCreation time.Duration

ExpiryTypeRelativeToCreation defines the duration relative to creation for the blob expiry

func (ExpiryTypeRelativeToCreation) Format added in v0.6.0

type ExpiryTypeRelativeToNow added in v0.6.0

type ExpiryTypeRelativeToNow time.Duration

ExpiryTypeRelativeToNow defines the duration relative to now for the blob expiry

func (ExpiryTypeRelativeToNow) Format added in v0.6.0

type HTTPRange

type HTTPRange struct {
	Offset int64
	Count  int64
}

HTTPRange defines a range of bytes within an HTTP resource, starting at offset and ending at offset+count. A zero-value HTTPRange indicates the entire resource. An HTTPRange which has an offset and zero value count indicates from the offset to the resource's end.

type LeaseAccessConditions

type LeaseAccessConditions = generated.LeaseAccessConditions

LeaseAccessConditions contains optional parameters to access leased entity.

type ModifiedAccessConditions

type ModifiedAccessConditions = generated.ModifiedAccessConditions

ModifiedAccessConditions contains a group of parameters for specifying access conditions.

type SetExpiryOptions added in v0.6.0

type SetExpiryOptions struct {
}

SetExpiryOptions contains the optional parameters for the Client.SetExpiry method.

type SharedKeyCredPolicy

type SharedKeyCredPolicy struct {
	// contains filtered or unexported fields
}

func NewSharedKeyCredPolicy

func NewSharedKeyCredPolicy(cred *SharedKeyCredential) *SharedKeyCredPolicy

func (*SharedKeyCredPolicy) Do

type SharedKeyCredential

type SharedKeyCredential struct {
	// contains filtered or unexported fields
}

SharedKeyCredential contains an account's name and its primary or secondary key.

func NewSharedKeyCredential

func NewSharedKeyCredential(accountName string, accountKey string) (*SharedKeyCredential, error)

NewSharedKeyCredential creates an immutable SharedKeyCredential containing the storage account's name and either its primary or secondary key.

func (*SharedKeyCredential) AccountName

func (c *SharedKeyCredential) AccountName() string

AccountName returns the Storage account's name.

func (*SharedKeyCredential) SetAccountKey

func (c *SharedKeyCredential) SetAccountKey(accountKey string) error

SetAccountKey replaces the existing account key with the specified account key.

type StorageResponseFormat

type StorageResponseFormat string

StorageResponseFormat specifies the format the service should use to return list results.

const (
	// StorageResponseFormatAuto lets the SDK choose the response format.
	// For the current release this resolves to XML; a future release will resolve to Arrow.
	StorageResponseFormatAuto StorageResponseFormat = ""

	// StorageResponseFormatXML forces XML-only responses. Use when you need raw XML responses (e.g. debugging).
	StorageResponseFormatXML StorageResponseFormat = "xml"

	// StorageResponseFormatArrow sends both Arrow and XML in the Accept header; the service returns Arrow
	// when Photon is enabled, otherwise falls back to XML. The SDK handles both transparently.
	// Arrow format is only supported on non-HNS (hierarchical namespace) accounts via the Blob endpoint.
	StorageResponseFormatArrow StorageResponseFormat = "arrow"
)

func ResolveAutoFormat

func ResolveAutoFormat(f StorageResponseFormat) StorageResponseFormat

ResolveAutoFormat returns the effective format, mapping Auto (zero value) to the default for the current release.

type TransferValidationType added in v0.6.0

type TransferValidationType interface {
	Apply(io.ReadSeekCloser, generated.TransactionalContentSetter) (io.ReadSeekCloser, error)
	// contains filtered or unexported methods
}

TransferValidationType abstracts the various mechanisms used to verify a transfer.

func TransferValidationTypeComputeCRC64 added in v0.6.0

func TransferValidationTypeComputeCRC64() TransferValidationType

TransferValidationTypeComputeCRC64 is a TransferValidationType that indicates a CRC64 should be computed during transfer.

func TransferValidationTypeComputeStructuredMessageCRC64

func TransferValidationTypeComputeStructuredMessageCRC64(segmentSize int) TransferValidationType

TransferValidationTypeComputeStructuredMessageCRC64 is a TransferValidationType that computes per-segment CRC64 checksums using the structured message binary format. The body is wrapped in a streaming SMEncoder that produces SM-encoded output on Read(). segmentSize specifies the maximum segment size in bytes. Values <= 0 use the default (4 MB).

type TransferValidationTypeCRC64 added in v0.6.0

type TransferValidationTypeCRC64 uint64

TransferValidationTypeCRC64 is a TransferValidationType used to provide a precomputed CRC64.

func (TransferValidationTypeCRC64) Apply added in v0.6.0

type TransferValidationTypeMD5 added in v0.6.0

type TransferValidationTypeMD5 []byte

TransferValidationTypeMD5 is a TransferValidationType used to provide a precomputed MD5.

func (TransferValidationTypeMD5) Apply added in v0.6.0

type UserDelegationCredential

type UserDelegationCredential struct {
	// contains filtered or unexported fields
}

UserDelegationCredential contains an account's name and its user delegation key.

func NewUserDelegationCredential

func NewUserDelegationCredential(accountName string, udk UserDelegationKey) *UserDelegationCredential

NewUserDelegationCredential creates a new UserDelegationCredential using a Storage account's Name and a user delegation Key from it

type UserDelegationKey

type UserDelegationKey = generated.UserDelegationKey

UserDelegationKey contains UserDelegationKey.

func GetUDKParams

func GetUDKParams(udc *UserDelegationCredential) *UserDelegationKey

GetUDKParams is a helper method for accessing the user delegation key parameters outside this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL