storage

package
v0.0.50 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const AzureCosmosDB = "azure-cosmosdb"

FACTORY --------------------------------

Variables

View Source
var AzureBlob = "azure-blob"
View Source
var AzureFiles = "azure-files"

Functions

func GenerateUserDelegationSAS added in v0.0.48

func GenerateUserDelegationSAS(ctx context.Context, creds *cloudyazure.AzureCredentials, storageAccountName, containerName string, validFor time.Duration, permissions sas.ContainerPermissions) (string, error)

func GetStorageAccountType

func GetStorageAccountType(ctx context.Context, env *cloudy.Environment, name string) (string, error)

Types

type AzureBlobFileShareFactory

type AzureBlobFileShareFactory struct{}

func (*AzureBlobFileShareFactory) Create

func (f *AzureBlobFileShareFactory) Create(cfg interface{}) (storage.FileStorageManager, error)

func (*AzureBlobFileShareFactory) FromEnv

func (f *AzureBlobFileShareFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type AzureBlobStorageFactory

type AzureBlobStorageFactory struct{}

func (*AzureBlobStorageFactory) Create

func (f *AzureBlobStorageFactory) Create(cfg interface{}) (storage.ObjectStorageManager, error)

func (*AzureBlobStorageFactory) FromEnv

func (f *AzureBlobStorageFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type AzureCosmosDbDatastore

type AzureCosmosDbDatastore struct {
	DB *Cosmosdb
	// contains filtered or unexported fields
}

func NewAzureCosmosDb

func NewAzureCosmosDb(ctx context.Context, url string, key string, database string, collection string, idField string, pkField string, pkValue string) *AzureCosmosDbDatastore

func (*AzureCosmosDbDatastore) Close

func (*AzureCosmosDbDatastore) Delete

func (az *AzureCosmosDbDatastore) Delete(ctx context.Context, key string) error

func (*AzureCosmosDbDatastore) DeleteAll

func (az *AzureCosmosDbDatastore) DeleteAll(ctx context.Context, key []string) error

func (*AzureCosmosDbDatastore) Exists

func (az *AzureCosmosDbDatastore) Exists(ctx context.Context, key string) (bool, error)

func (*AzureCosmosDbDatastore) Get

func (az *AzureCosmosDbDatastore) Get(ctx context.Context, id string) ([]byte, error)

func (*AzureCosmosDbDatastore) GetAll

func (az *AzureCosmosDbDatastore) GetAll(ctx context.Context) ([][]byte, error)

func (*AzureCosmosDbDatastore) OnCreate

func (*AzureCosmosDbDatastore) Open

func (az *AzureCosmosDbDatastore) Open(ctx context.Context, config interface{}) error

func (*AzureCosmosDbDatastore) Ping

func (*AzureCosmosDbDatastore) Query

func (az *AzureCosmosDbDatastore) Query(ctx context.Context, query *datastore.SimpleQuery) ([][]byte, error)

func (*AzureCosmosDbDatastore) QueryAndUpdate

func (az *AzureCosmosDbDatastore) QueryAndUpdate(ctx context.Context, ds *datastore.SimpleQuery, f func(context.Context, [][]byte) ([][]byte, error)) ([][]byte, error)

func (*AzureCosmosDbDatastore) QueryAsMap

func (az *AzureCosmosDbDatastore) QueryAsMap(ctx context.Context, ds *datastore.SimpleQuery) ([]map[string]any, error)

func (*AzureCosmosDbDatastore) QueryTable

func (az *AzureCosmosDbDatastore) QueryTable(ctx context.Context, ds *datastore.SimpleQuery) ([][]interface{}, error)

func (*AzureCosmosDbDatastore) Save

func (az *AzureCosmosDbDatastore) Save(ctx context.Context, data []byte, key string) error

Saves an item into the Elastic Search. This item MUST be JSON data. The key is used as the ID for the document and is required to be unique for this index

func (*AzureCosmosDbDatastore) SaveAll

func (az *AzureCosmosDbDatastore) SaveAll(ctx context.Context, b [][]byte, s []string) error

type AzureFileShareFactory

type AzureFileShareFactory struct{}

func (*AzureFileShareFactory) Create

func (f *AzureFileShareFactory) Create(cfg interface{}) (storage.FileStorageManager, error)

func (*AzureFileShareFactory) FromEnv

func (f *AzureFileShareFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type AzureStorageAccount

type AzureStorageAccount struct {
	cloudyazure.AzureCredentials

	ServiceURL  string
	UrlSlug     string
	AccountName string
	AccountKey  string
}

type BlobContainerShare

type BlobContainerShare struct {
	Account string
	// AccountKey string
	// UrlSlug    string
	Client *azblob.Client
}

THe BlobContainerShare provides file shares based on the Azure Blob Storage

func NewBlobContainerShare

func NewBlobContainerShare(ctx context.Context, account string, accountKey string, urlslug string) (*BlobContainerShare, error)

func NewBlobContainerShare2

func NewBlobContainerShare2(ctx context.Context, acct *AzureStorageAccount) (*BlobContainerShare, error)

func (*BlobContainerShare) Create

func (bfs *BlobContainerShare) Create(ctx context.Context, key string, tags map[string]string) (*storage.FileShare, error)

func (*BlobContainerShare) Delete

func (bfs *BlobContainerShare) Delete(ctx context.Context, key string) error

func (*BlobContainerShare) Exists

func (bfs *BlobContainerShare) Exists(ctx context.Context, key string) (bool, error)

func (*BlobContainerShare) Get

func (*BlobContainerShare) List

type BlobFileShare

type BlobFileShare struct {
	Client *armstorage.FileSharesClient
	// Credentials        AzureCredentials
	SubscriptionID     string
	ResourceGroupName  string
	StorageAccountName string
}

THe BlobFileShare provides file shares based on the Azure Blob Storage

func NewAzureFileShare

func NewAzureFileShare(ctx context.Context, acct *AzureStorageAccount) (*BlobFileShare, error)

func (*BlobFileShare) Create

func (bfs *BlobFileShare) Create(ctx context.Context, key string, tags map[string]string) (*storage.FileShare, error)

func (*BlobFileShare) Delete

func (bfs *BlobFileShare) Delete(ctx context.Context, key string) error

func (*BlobFileShare) Exists

func (bfs *BlobFileShare) Exists(ctx context.Context, key string) (bool, error)

func (*BlobFileShare) Get

func (bfs *BlobFileShare) Get(ctx context.Context, key string) (*storage.FileShare, error)

func (*BlobFileShare) List

func (bfs *BlobFileShare) List(ctx context.Context) ([]*storage.FileShare, error)

type BlobStorage

type BlobStorage struct {
	Account    string
	AccountKey string
	Container  string
	UrlSlug    string
	Client     *container.Client
}

Object Storage

func NewBlobContainer

func NewBlobContainer(ctx context.Context, account string, accountKey string, container string, urlslug string) (*BlobStorage, error)

func NewBlobContainerFrom

func NewBlobContainerFrom(ctx context.Context, client *container.Client) *BlobStorage

func (*BlobStorage) Delete

func (b *BlobStorage) Delete(ctx context.Context, key string) error

func (*BlobStorage) Download

func (b *BlobStorage) Download(ctx context.Context, key string) (io.ReadCloser, error)

func (*BlobStorage) Exists

func (b *BlobStorage) Exists(ctx context.Context, key string) (bool, error)

func (*BlobStorage) GenDownloadURL

func (b *BlobStorage) GenDownloadURL(ctx context.Context, key string) (string, error)

func (*BlobStorage) GenUploadURL

func (b *BlobStorage) GenUploadURL(ctx context.Context, key string) (string, error)

func (*BlobStorage) List

func (*BlobStorage) ListNative

func (b *BlobStorage) ListNative(ctx context.Context, prefix string) ([]*container.BlobItem, []*container.BlobPrefix, error)

func (*BlobStorage) TagsToMap

func (b *BlobStorage) TagsToMap(tags *container.BlobTags) map[string]string

func (*BlobStorage) ToStoredObject

func (b *BlobStorage) ToStoredObject(item *container.BlobItem) *storage.StoredObject

func (*BlobStorage) UpdateMetadata

func (b *BlobStorage) UpdateMetadata(ctx context.Context, key string, tags map[string]string) error

func (*BlobStorage) Upload

func (b *BlobStorage) Upload(ctx context.Context, key string, data io.Reader, tags map[string]string) error

type BlobStorageAccount

type BlobStorageAccount struct {
	Account string
	// AccountKey string
	// UrlSlug    string
	Client *azblob.Client
}

ObjectStorageManager {

func NewBlobStorageAccount

func NewBlobStorageAccount(ctx context.Context, account string, accountKey string, urlslug string) (*BlobStorageAccount, error)

func NewBlobStorageAccount2

func NewBlobStorageAccount2(ctx context.Context, acct *AzureStorageAccount) (*BlobStorageAccount, error)

func (*BlobStorageAccount) Create

func (sa *BlobStorageAccount) Create(ctx context.Context, key string, openToPublic bool, tags map[string]string) (storage.ObjectStorage, error)

func (*BlobStorageAccount) Delete

func (sa *BlobStorageAccount) Delete(ctx context.Context, key string) error

func (*BlobStorageAccount) Exists

func (sa *BlobStorageAccount) Exists(ctx context.Context, key string) (bool, error)

func (*BlobStorageAccount) Get

func (*BlobStorageAccount) GetBlobContainer

func (sa *BlobStorageAccount) GetBlobContainer(ctx context.Context, name string) (*storage.StorageArea, error)

func (*BlobStorageAccount) GetItem

func (sa *BlobStorageAccount) GetItem(ctx context.Context, key string) (*storage.StorageArea, error)

func (*BlobStorageAccount) List

type CosmosDBFactory

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

func (*CosmosDBFactory) Create

func (c *CosmosDBFactory) Create(cfg interface{}) (datastore.UntypedJsonDataStoreFactory, error)

func (*CosmosDBFactory) CreateJsonDatastore

func (c *CosmosDBFactory) CreateJsonDatastore(ctx context.Context, typename string, prefix string, idField string) datastore.UntypedJsonDataStore

func (*CosmosDBFactory) FromEnv

func (c *CosmosDBFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type CosmosDbQueryConverter

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

func (*CosmosDbQueryConverter) Convert

func (qc *CosmosDbQueryConverter) Convert(c *datastore.SimpleQuery, table string) string

func (*CosmosDbQueryConverter) ConvertASort

func (qc *CosmosDbQueryConverter) ConvertASort(c *datastore.SortBy) string

func (*CosmosDbQueryConverter) ConvertCondition

func (*CosmosDbQueryConverter) ConvertConditionGroup

func (qc *CosmosDbQueryConverter) ConvertConditionGroup(cg *datastore.SimpleQueryConditionGroup) string

func (*CosmosDbQueryConverter) ConvertSelect

func (qc *CosmosDbQueryConverter) ConvertSelect(c *datastore.SimpleQuery, table string) string

func (*CosmosDbQueryConverter) ConvertSort

func (qc *CosmosDbQueryConverter) ConvertSort(sortbys []*datastore.SortBy) string

func (*CosmosDbQueryConverter) ToColumnName

func (qc *CosmosDbQueryConverter) ToColumnName(name string) string

type CosmosFactoryConfig

type CosmosFactoryConfig struct {
	URL      string
	Key      string
	Creds    *cloudyazure.AzureCredentials
	Database string
}

type CosmosObject

type CosmosObject struct {
	Item interface{}
}

type Cosmosdb

type Cosmosdb struct {
	Database  string
	Container string
	// contains filtered or unexported fields
}

func NewCosmosdb

func NewCosmosdb(ctx context.Context, db string, coll string, key string, endpoint string, idField string, partitionKeyField string, partitionKey string) (*Cosmosdb, error)

func (*Cosmosdb) Add

func (c *Cosmosdb) Add(ctx context.Context, id string, data []byte) error

Create user

func (*Cosmosdb) AddPK

func (c *Cosmosdb) AddPK(data []byte) ([]byte, error)

func (*Cosmosdb) CreateOpen

func (c *Cosmosdb) CreateOpen(ctx context.Context, onCollectionCreate func(ctx context.Context, c *Cosmosdb) error) error

func (*Cosmosdb) Exists

func (c *Cosmosdb) Exists(ctx context.Context, id string) (bool, error)

Get user by given id

func (*Cosmosdb) GetAll

func (c *Cosmosdb) GetAll(ctx context.Context) ([][]byte, error)

Get user by given id

func (*Cosmosdb) GetRaw

func (c *Cosmosdb) GetRaw(ctx context.Context, id string) ([]byte, error)

Get user by given id

func (*Cosmosdb) Healthy

func (c *Cosmosdb) Healthy(ctx context.Context) error

func (*Cosmosdb) IsStatusCodeNotFound

func (c *Cosmosdb) IsStatusCodeNotFound(err error) bool

func (*Cosmosdb) QueryAll

func (c *Cosmosdb) QueryAll(ctx context.Context, query string) ([][]byte, error)

func (*Cosmosdb) Remove

func (c *Cosmosdb) Remove(ctx context.Context, id string) error

func (*Cosmosdb) Replace

func (c *Cosmosdb) Replace(ctx context.Context, id string, data []byte) error

Update or insert

func (*Cosmosdb) Upsert

func (c *Cosmosdb) Upsert(ctx context.Context, id string, data []byte) error

Update or insert

Jump to

Keyboard shortcuts

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