storage

package
v0.0.0-...-5f05eaf Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContainerNotFound = errors.New("container not found")
)

Functions

func NewBlobSdkClient

func NewBlobSdkClient(
	credentialProvider auth.MultiTenantCredentialProvider,
	accountConfig *AccountConfig,
	coreClientOptions *azcore.ClientOptions,
	cloud *cloud.Cloud,
) (*azblob.Client, error)

createClient creates a new blob client and caches it for future use

Types

type AccountConfig

type AccountConfig struct {
	AccountName   string
	ContainerName string
	Endpoint      string
}

AccountConfig contains the configuration for connecting to a storage account

type Blob

type Blob struct {
	Name         string
	Path         string
	CreationTime time.Time
	LastModified time.Time
}

Blob represents a blob within a storage account container.

type BlobClient

type BlobClient interface {
	// Download downloads a blob from the configured storage account container.
	Download(ctx context.Context, blobPath string) (io.ReadCloser, error)

	// Upload uploads a blob to the configured storage account container.
	Upload(ctx context.Context, blobPath string, reader io.Reader) error

	// Delete deletes a blob from the configured storage account container.
	Delete(ctx context.Context, blobPath string) error

	// Items returns a list of blobs in the configured storage account container.
	Items(ctx context.Context) ([]*Blob, error)
}

func NewBlobClient

func NewBlobClient(
	config *AccountConfig,
	client *azblob.Client,
) BlobClient

NewBlobClient creates a new BlobClient instance to manage blobs within a container.

type FileShareService

type FileShareService interface {
	// Upload files from source path to a file share
	UploadPath(ctx context.Context, subId, shareUrl, source string) error
}

func NewFileShareService

func NewFileShareService(
	accountCreds account.SubscriptionCredentialProvider,
	options *arm.ClientOptions,
) FileShareService

Jump to

Keyboard shortcuts

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