Documentation ¶
Index ¶
- func AppendToBlob(ctx context.Context, accountName, containerName, blobName, message string) error
- func ClearPage(ctx context.Context, accountName, containerName, blobName string, page int) error
- func CommitBlocks(ctx context.Context, accountName, containerName, blobName string) error
- func CreateAppendBlob(ctx context.Context, accountName, containerName, blobName string) (blob.AppendBlobURL, error)
- func CreateBlockBlob(ctx context.Context, accountName, containerName, blobName string) (blob.BlockBlobURL, error)
- func CreateContainer(ctx context.Context, accountName, containerName string) (blob.ContainerURL, error)
- func CreatePageBlob(ctx context.Context, accountName, containerName, blobName string, pages int) (blob.PageBlobURL, error)
- func CreateStorageAccount(ctx context.Context, accountName string) (s storage.Account, err error)
- func DeleteContainer(ctx context.Context, accountName, containerName string) error
- func DeleteStorageAccount(ctx context.Context, accountName string) (autorest.Response, error)
- func GetBlob(ctx context.Context, accountName, containerName, blobName string) (string, error)
- func GetContainer(ctx context.Context, accountName, containerName string) (blob.ContainerURL, error)
- func GetPageRanges(ctx context.Context, accountName, containerName, blobName string, pages int) (*blob.PageList, error)
- func GetStorageAccount(ctx context.Context, accountName string) (storage.Account, error)
- func GetUncommitedBlocks(ctx context.Context, accountName, containerName, blobName string) (*blob.BlockList, error)
- func ListBlobs(ctx context.Context, accountName, containerName string) (*blob.ListBlobsResponse, error)
- func PutBlockOnBlob(ctx context.Context, accountName, containerName, blobName, message string, ...) error
- func PutPage(ctx context.Context, accountName, containerName, blobName, message string, ...) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToBlob ¶
AppendToBlob appends new data to the specified append blob
func CommitBlocks ¶
CommitBlocks commits the uncommitted blocks to the blob
func CreateAppendBlob ¶
func CreateAppendBlob(ctx context.Context, accountName, containerName, blobName string) (blob.AppendBlobURL, error)
CreateAppendBlob creates an empty append blob
func CreateBlockBlob ¶
func CreateBlockBlob(ctx context.Context, accountName, containerName, blobName string) (blob.BlockBlobURL, error)
CreateBlockBlob creates a new block blob
func CreateContainer ¶
func CreateContainer(ctx context.Context, accountName, containerName string) (blob.ContainerURL, error)
CreateContainer creates a new container with the specified name in the specified account
func CreatePageBlob ¶
func CreatePageBlob(ctx context.Context, accountName, containerName, blobName string, pages int) (blob.PageBlobURL, error)
CreatePageBlob creates a new test blob in the container specified by env var
func CreateStorageAccount ¶
CreateStorageAccount creates a new storage account.
func DeleteContainer ¶
DeleteContainer deletes the named container.
func DeleteStorageAccount ¶
DeleteStorageAccount deletes an existing storate account
func GetContainer ¶
func GetContainer(ctx context.Context, accountName, containerName string) (blob.ContainerURL, error)
GetContainer gets info about an existing container.
func GetPageRanges ¶
func GetPageRanges(ctx context.Context, accountName, containerName, blobName string, pages int) (*blob.PageList, error)
GetPageRanges gets a list of valid page ranges in the page blob
func GetStorageAccount ¶
GetStorageAccount gets details on the specified storage account
func GetUncommitedBlocks ¶
func GetUncommitedBlocks(ctx context.Context, accountName, containerName, blobName string) (*blob.BlockList, error)
GetUncommitedBlocks gets a list of uncommited blobs
func ListBlobs ¶
func ListBlobs(ctx context.Context, accountName, containerName string) (*blob.ListBlobsResponse, error)
ListBlobs lists blobs on the specified container
Example ¶
accountName = getAccountName() containerName = strings.ToLower(containerName) helpers.SetResourceGroupName("ListBlobs") ctx := context.Background() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, helpers.ResourceGroupName()) if err != nil { helpers.PrintAndLog(err.Error()) } _, err = CreateStorageAccount(ctx, accountName) if err != nil { helpers.PrintAndLog(err.Error()) } helpers.PrintAndLog("created storage account") _, err = CreateContainer(ctx, accountName, containerName) if err != nil { helpers.PrintAndLog(err.Error()) } helpers.PrintAndLog("created container") for i := 0; i < 3; i++ { name := fmt.Sprintf("blob%d", i) _, err = CreateBlockBlob(ctx, accountName, containerName, name) if err != nil { helpers.PrintAndLog(err.Error()) } helpers.PrintAndLog("created blob") } list, err := ListBlobs(ctx, accountName, containerName) if err != nil { helpers.PrintAndLog(err.Error()) } helpers.PrintAndLog(fmt.Sprintf("listed blobs: %d", len(list.Blobs.Blob)))
Output: created storage account created container created blob created blob created blob listed blobs: 3
Types ¶
This section is empty.