Giter Site home page Giter Site logo

cake.azurestorage's Introduction

Cake.AzureStorage

A Cake Addin for Azure Storage.

Build status

cakebuild.net

Join the chat at https://gitter.im/cake-build/cake

Functionality

Supports uploading Blobs to Azure Blob Storage as well as deleting them by prefix and by name. More features to be added in the future.

Usage

To use the addin just add it to Cake call the aliases and configure any settings you want.

#addin Cake.AzureStorage
...

// How to package with no settings
Task("PackageNoSettings")
	.Does(() => {
     var settings = new AzureStorageSettings();
     settings.AccountName = "AccountName";
     settings.Key = "API KEY";
     settings.ContainerName = "ContainerName";
     settings.BlobName = "BlobName";
	   UploadFileToBlob(settings, GetFile("./path/to/file/to/upload"));
	)};


Task("PackageAfterDelete")
	.Does(() => {
		var settings = new AzureStorageSettings();
		settings.AccountName = "AccountName";
		settings.Key = "API KEY";
		settings.ContainerName = "ContainerName";
		settings.BlobName = "NameToDelete";
		DeleteBlob(settings);
	
		settings.BlobName = "NameToUploadAs";
		var filePath = new FilePath("./location/of/file/to/upload");
		UploadFileToBlob(settings, filePath);
	});

Task("PackageAfterMultiDelete")
	.Does(() => {
		var settings = new AzureStorageSettings();
		settings.AccountName = "AccountName";
		settings.Key = "API KEY";
		settings.ContainerName = "ContainerName";
		settings.BlobName = "PrefixToSearchBy";
		
		var deletedLog = DeleteBlobsByPrefix(settings);
		foreach (var line in deletedLog){
			Information(line);
		}
		
		settings.BlobName = "NameToUploadAs";
		var filePath = new FilePath("./location/of/file/to/upload");
		UploadFileToBlob(settings, filePath);
	});

The Prefix used for deleting blobs is exactly like it sounds, a prefix of the file you want to delete. So if you have files named ABC-ImportantFile-1.0.0.1.exe, ABC-ImportantFile-1.0.0.2.exe, ABC-ImportantFile-1.0.0.3.exe, etc. You can delete these by specifying "ABC-ImportantFile-" as your blob name and it will get all files starting with that string.

That's it.

Hope you enjoy using.

cake.azurestorage's People

Contributors

jrkelso avatar phillipsj avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.