Giter Site home page Giter Site logo

faesel / az-lazy Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 0.0 744 KB

Az Lazy CLI tool is designed for developers, it provides a command-line interface to quickly manage and make changes to azure storage queues, blobs and tables.

C# 100.00%
azure queues azure-storage cli containers blob tablestorage azure-storage-queues blobs

az-lazy's Introduction

Nuget .NET Core Downloads

AzLazy CLI tool is designed for developers, it provides a command line interface to quickly manage and make changes to azure storage queues, blobs and tables. The inspiration for this project was to move away from using Azure Storage Manager and provide a faster CLI experience for developers.

Table of Contents

  1. Installation
  2. Getting started
  3. Command list
    1. Connection Commands
    2. Queue Commands
    3. Container Commands
    4. Blob Commands
    5. Table Commands
  4. Contributing
  5. Change Log

1. Installation

You can download the tool from the Nuget Gallery, run the following installation command,

dotnet tool install --global az-lazy

2. Getting started

Use the following command to add a new connection

azlazy addconnection --name "dinosaurStorage" --connectionString "<<azure access key>>"

Select the connection you want to use

azlazy connection --select "dinosaurStorage"

You can check which connection is selected using the list command, by default you will always have devStorage which allows you to connect to a local Azure emulator

azlazy connection --list

Once a connection has been added you can begin using all the other commands, eg

azlazy queue --list

azlazy queue --watch "process-carnivores"

azlazy queue --peek "process-carnivores" --peekCount 3

azlazy addcontainer --name "dinosaurpictures" --publicAccess "Blob"

azlazy container --tree "dinofiles" --detailed

azlazy blob --container "dinofiles" --uploadDirectory "C:\Users\faese\Desktop\dinofiles"

3. Command List

To view a list of commands through the CLI you can use azlazy --help, each command has an alias beginning with the first letter of the command, eg azlazy connection --list can be aliased to azlazy connection -l.

i. Connection commands

Command Description
azlazy connection --help Display a list of commands you can use for connections
azlazy addconnection --name "name of connection" --connectionstring "connection string" Adds a new connection to the connection list.
  • --select true The select option allows you to select the connection when inserting
azlazy connection --list Show a list of connections available, the selected connection will be highlighted with a [*] symbol
azlazy connection --remove "name of connection" Removes a connection from the connections list
azlazy connection --select "name of connection" Selects a connection from the connections list
azlazy connection --wipe Removes all connections from the list, aside from the development connection

ii. Queue commands

Command Description
azlazy queue --help Display a list of commands you can use for queues
azlazy addqueue --name "queue to add" Creates a new queue with the given name
azlazy queue --list View a list of queues in the storage account along with the number of messages they are holding, poison queues are highlighted in red.
  • --contains can also be used to filter the list
azlazy queue --remove "queue to remove" Removes the queue with the given name
azlazy queue --cure "queue to move poison messages to" Moves poison queue messages back into the processing queue
azlazy queue --clear "queue to clear" Removes all messages in the queue
azlazy queue --addQueue "queue to add a new message" --addMessage '{ \"test\": true }' Adds a new message to the queue
azlazy queue --watch "queue to watch" Watches a queue for new messages
azlazy queue --peek "queue to peek messages" Views a messages in the queue, note this function peeks messages so visibility is not changed for consuming applications.
  • --peekCount 10 can also be used to specify how many messages you want to view. The Maximum peek count available is 32.
azlazy queue --from "source queue name" --to "destination queue name" Moves queue messages from the source queue to a destination queue

iii. Container commands

Command Description
azlazy container --help Displays a list of commands you can use for containers
azlazy container --list View a list of containers in the storage account, along with whether or not its public and when it was last modified.
  • --contains can also be used to filter the list
azlazy addcontainer --name "container to add" --publicAccess "Blob" Creates a new container with the given name. By default any container created will not be publicly accessible and so will have its public access level set to None,
  • --publicAccess the containers public access level can be set using this command. Possible options are None, Blob, BlobContainer
azlazy container --remove "container to remove" Removes a container with the given game
azlazy container --tree "container to view" Returns a tree view of the container, other options with this command include,
  • --detailed Command can also be used to view file sizes and last modified dates
  • --depth 2 For large containers this command can be used to limit how deep the folders are traversed
  • --prefix Command can be used to limit the results returned by searching within a prefixed path

iv. Blob commands

Command Description
azlazy blob --help Displays a list of commands you can use for blobs
azlazy blob --container "container name" --remove "blob to remove" removes a blob from a given container, note the blob name needs to contain the full path
azlazy blob --container "container name" --uploadFile "c:\dinofiles\safaripics\t-rex.png" --uploadPath "safaripics" Uploads a blob from a given path to the container. In the example given the file t-rex.png will be uploaded to safaripics\t-rex.png if no upload path is provided the file will be uploaded to the root of the container.
  • --uploadPath can also be optionally specified to copy the files into a subdirectory.
azlazy blob --container "container name" --uploadDirectory "c:\dinofiles" --uploadPath "safaripics" Upload all the files in a given directory to a container. When uploading, the folder structure of of the directory is reflected into the container.
  • --uploadPath can also be optionally specified to copy the files into a subdirectory.

v. Table commands

Command Description
azlazy table --help Displays a list of commands you can use for tables
azlazy table --list View a list of tables in the storage account.
  • --contains can also be used to filter the list
azlazy table --sample "table name" Samples the data from a table, by default 10 rows will be selected.
  • --sampleCount 30 can also be used to set how many rows should be returned
azlazy table --query "table name" Query's rows in a table, the filters specified below can be used in combination with each other. If no filters are specified all rows in the table will be returned.
  • --partitionKey used to query by the partition key
  • --rowKey used to query by the row key
  • --take 10 allows you to limit how many rows are returned
azlazy table --delete "table name" Removes rows from a table, to use this command one of the filters mentioned below must be used.
  • --partitionKey delete using the partition key
  • --rowKey delete using the row key
azlazy table --remove "table name" Removes the entire table from storage
azlazy addtable --name "table name" Creates a new table with the given table name

More coming soon !

4. Contributing

I haven't written any contributing guidelines yet but you can reach me here on Faesel.com contact page. Development Notes are also available.

5. Change Log

For older versions check the change log here, for newer versions check out the releases page.

6. Future changes

  • Explore adding connections and commands for Azure Storage Bus

az-lazy's People

Contributors

dependabot[bot] avatar faesel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

az-lazy's Issues

connections.db missing when tool installed locally.

When az-lazy is only installed as a local .net tool it reports and error missing a "connections.db"

Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path '%USERPROFILE%\.dotnet\tools\.store\az-lazy\connections.db'.
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at LiteDB.Engine.FileStreamFactory.GetStream(Boolean canWrite, Boolean sequencial)
   at LiteDB.Engine.StreamPool.<>c__DisplayClass3_0.<.ctor>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at LiteDB.Engine.StreamPool.get_Writer()
   at LiteDB.Engine.DiskService..ctor(EngineSettings settings, Int32[] memorySegmentSizes)
   at LiteDB.Engine.LiteEngine..ctor(EngineSettings settings)
   at LiteDB.ConnectionString.CreateEngine()
   at LiteDB.LiteDatabase..ctor(ConnectionString connectionString, BsonMapper mapper)
   at LiteDB.LiteDatabase..ctor(String connectionString, BsonMapper mapper)
   at az_lazy.Manager.LocalStorageManager.AddDevelopmentConnection() in C:\code\faesel\az-lazy\az-lazy\Manager\LocalStorageManager.cs:line 57
   at az_lazy.Program.Main(String[] args) in C:\code\faesel\az-lazy\az-lazy\Program.cs:line 19
   at az_lazy.Program.<Main>(String[] args)

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.