blobclient

package
v0.0.0-...-a1c22f6 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderLeaseID = "x-ms-lease-id"

HeaderLeaseID - specify the header name for operation lease id.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobClient

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

func New

func New(authorizer autorest.Authorizer) *BlobClient

func NewMsiBlobProviderWithClientID

func NewMsiBlobProviderWithClientID(clientID string) (*BlobClient, error)

func NewMsiBlobProviderWithMiResourceID

func NewMsiBlobProviderWithMiResourceID(miResID string) (*BlobClient, error)

func NewMsiBlobProviderWithMiResourceIDWithCloudName

func NewMsiBlobProviderWithMiResourceIDWithCloudName(miResID string, cloudName string) (*BlobClient, error)

func (*BlobClient) AcquireLease

func (c *BlobClient) AcquireLease(ctx context.Context,
	storageAccountName,
	containerName,
	blobName string,
	duration uint) (string, error)

func (*BlobClient) BlobExists

func (c *BlobClient) BlobExists(ctx context.Context, storageAccountName, containerName, blobName string) (bool, error)

BlobExists checks if a blob exist. ref: https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties

func (*BlobClient) BreakLease

func (c *BlobClient) BreakLease(ctx context.Context, storageAccountName, containerName, blobName, leaseID string) error

func (*BlobClient) ContainerExists

func (c *BlobClient) ContainerExists(ctx context.Context, storageAccountName, containerName string) (bool, error)

func (*BlobClient) CreateContainer

func (c *BlobClient) CreateContainer(ctx context.Context, storageAccountName, containerName string) error

func (*BlobClient) CreateContainerWithACL

func (c *BlobClient) CreateContainerWithACL(ctx context.Context, storageAccountName, containerName string, acl BlobPublicAccessLevel) error

func (*BlobClient) DeleteContainer

func (c *BlobClient) DeleteContainer(ctx context.Context, storageAccountName, containerName string) error

func (*BlobClient) GetBlobData

func (c *BlobClient) GetBlobData(ctx context.Context, url string) ([]byte, error)

GetBlobData gets data from blob with URL

func (*BlobClient) GetBlobDataV1

func (c *BlobClient) GetBlobDataV1(ctx context.Context, storageAccountName, containerName, blobName string) ([]byte, int, error)

GetBlobData gets data from blob with URL

func (*BlobClient) ListBlobsWithPrefix

func (c *BlobClient) ListBlobsWithPrefix(ctx context.Context, url, prefix string) (storage.BlobListResponse, error)

ListBlobsWithPrefix lists blobs with URL and prefix

func (*BlobClient) PutBlobData

func (c *BlobClient) PutBlobData(ctx context.Context, url string, data []byte) error

PutBlobData put data to blob with URL

func (*BlobClient) PutBlobDataV1

func (c *BlobClient) PutBlobDataV1(ctx context.Context, storageAccountName, containerName, blobName string, data []byte, extraHeaders map[string]interface{}) error

PutBlobDataV1 gets data from blob with URL

func (*BlobClient) ReleaseLease

func (c *BlobClient) ReleaseLease(ctx context.Context, storageAccountName, containerName, blobName, leaseID string) error

type BlobPublicAccessLevel

type BlobPublicAccessLevel string

BlobPublicAccessLevel specifies the storage account blob public access level. ref: https://docs.microsoft.com/en-us/rest/api/storageservices/create-container

const (
	// BlobPublicAccessLevelNotSet - default ACL, private to the account owner
	BlobPublicAccessLevelNotSet BlobPublicAccessLevel = ""
	// BlobPublicAccessLevelContainer - specifies full public read access for container and blob data.
	BlobPublicAccessLevelContainer BlobPublicAccessLevel = "container"
	// BlobPublicAccessLevelBlob - specifies public read access for blobs.
	BlobPublicAccessLevelBlob BlobPublicAccessLevel = "blob"
)

type Interface

type Interface interface {
	GetBlobData(ctx context.Context, url string) ([]byte, error)
	GetBlobDataV1(ctx context.Context, storageAccountName, containerName, blobName string) ([]byte, int, error)
	BlobExists(ctx context.Context, storageAccountName, containerName, blobName string) (bool, error)
	PutBlobData(ctx context.Context, url string, data []byte) error
	PutBlobDataV1(ctx context.Context, storageAccountName, containerName, blobName string, data []byte, extraHeaders map[string]interface{}) error
	ListBlobsWithPrefix(ctx context.Context, url, prefix string) (storage.BlobListResponse, error)
	ContainerExists(ctx context.Context, storageAccountName, containerName string) (bool, error)
	DeleteContainer(ctx context.Context, storageAccountName, containerName string) error
	CreateContainer(ctx context.Context, storageAccountName, containerName string) error
	CreateContainerWithACL(ctx context.Context, storageAccountName, containerName string, acl BlobPublicAccessLevel) error
	AcquireLease(ctx context.Context, storageAccountName, containerName, blobName string, durationInSeconds uint) (string, error)
	ReleaseLease(ctx context.Context, storageAccountName, containerName, blobName, leaseID string) error
	BreakLease(ctx context.Context, storageAccountName, containerName, blobName, leaseID string) error
}

Interface blob client APIs

Directories

Path Synopsis
Package mock_blobclient is a generated GoMock package.
Package mock_blobclient is a generated GoMock package.

Jump to

Keyboard shortcuts

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