From abd2bd729b3f7ccf4afd4c427946c4e431d34e0b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 8 Apr 2015 16:41:34 -0700 Subject: [PATCH] Update documentation --- Makefile | 2 +- README.md | 53 ++++++++++++++++++++++++-------------- cmd-common.go | 18 +------------ cmd-config.go | 4 +-- cmd-options.go | 6 ++--- docs/commands/config.md | 23 +++++++++++++++++ docs/commands/cp.md | 26 +++++++++++++++++++ docs/commands/ls.md | 24 +++++++++++++++++ docs/commands/mb.md | 20 ++++++++++++++ docs/debugging.md | 36 ++++++++++++++++++++++++++ docs/index.md | 53 ++++++++++++++++++++++++-------------- mkdocs.yml | 13 +++++++--- pkg/client/s3/s3-verify.go | 1 - url-parser.go | 11 +++----- 14 files changed, 217 insertions(+), 73 deletions(-) create mode 100644 docs/commands/config.md create mode 100644 docs/commands/cp.md create mode 100644 docs/commands/ls.md create mode 100644 docs/commands/mb.md create mode 100644 docs/debugging.md diff --git a/Makefile b/Makefile index f524cc0e..4c304858 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ docs-deploy: install: test-all @echo "Installing mc:" @godep go install -a github.com/minio-io/mc - @mkdir -p $(HOME)/.minio/mc + @mkdir -p $(HOME)/.mc clean: @rm -fv cover.out diff --git a/README.md b/README.md index a0969537..8c8c5144 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ mc - Minio Client for S3 Compatible Object Storage released under [Apache licens ### Commands ``` +$ mc help + NAME: mc - Minio Client for S3 Compatible Object Storage @@ -19,46 +21,59 @@ USAGE: mc [global options] command [command options] [arguments...] VERSION: - 0.1.0 + <---- GIT COMMIT ID ----> -AUTHOR: - Minio.io +BUILD: + <---- BUILD TIME ----> COMMANDS: - cp copy objects - ls get list of objects - mb makes a bucket - config Generate configuration "/home/harsha/.minio/mc/config.json" file. - help, h Shows a list of commands or help for one command + cp copy objects and files + ls list files and objects + mb makes a bucket + config Generate configuration "/home/alexa/.mc/config.json" file. GLOBAL OPTIONS: - --debug enable HTTP tracing - --quiet, -q disable chatty output, such as the progress bar - --get-bash-completion Generate bash completion "/home/harsha/.minio/mc/mc.bash_completion" file. - --help, -h show help - --generate-bash-completion - --version, -v print the version + --debug enable HTTP tracing + --quiet, -q disable chatty output, such as the progress bar + --version, -v print the version + ``` ## Contribute [Contribute to mc](./CONTRIBUTING.md) +### Supported platforms + +| Name | Supported | +| ------------- | ------------- | +| Linux | Yes | +| Windows | Yes | +| Mac OSX | Yes | + +### Supported architectures + +| Arch | Supported | +| ------------- | ------------- | +| x86-64 | Yes | +| arm64 | Not yet| +| i386 | Not yet | + ### Enable bash completion To generate bash completion for ``mc`` all you have to do is ``` -$ mc --get-bash-completion +$ mc config --completion -Configuration written to /home/user/.minio/mc/mc.bash_completion +Configuration written to /home/user/.mc/mc.bash_completion -$ source ${HOME}/.minio/mc/mc.bash_completion -$ echo 'source ${HOME}/.minio/mc/mc.bash_completion' >> ${HOME}/.bashrc +$ source ${HOME}/.mc/mc.bash_completion +$ echo 'source ${HOME}/.mc/mc.bash_completion' >> ${HOME}/.bashrc ``` ``` $ mc -config cp h help ls mb sync +config cp h help ls mb ``` diff --git a/cmd-common.go b/cmd-common.go index 9e480dee..7d8fa2ba 100644 --- a/cmd-common.go +++ b/cmd-common.go @@ -177,7 +177,7 @@ func getNewClient(debug bool, urlStr string) (clnt client.Client, err error) { } switch uType { - case urlS3: // Minio and S3 compatible object storage + case urlObjectStorage: // Minio and S3 compatible object storage traceTransport := getTraceTransport() if debug { clnt = s3.GetNewClient(&auth, urlStr, traceTransport) @@ -185,22 +185,6 @@ func getNewClient(debug bool, urlStr string) (clnt client.Client, err error) { clnt = s3.GetNewClient(&auth, urlStr, http.DefaultTransport) } return clnt, nil - - // TODO: donut.GetNewClient should only take donutName as input. Rest it should read from its own config file. - /* - case urlDonut: // Donut object storage - - host, err := url2Host(urlStr) - if err != nil { - return nil, err - } - - clnt, err := donut.GetNewClient(host, nodeDiskMap) - if err != nil { - return nil, err - } - - return clnt, nil */ case urlFile: // POSIX compatible file systems fallthrough case urlUnknown: // Unknown type diff --git a/cmd-config.go b/cmd-config.go index 837b958b..12852a67 100644 --- a/cmd-config.go +++ b/cmd-config.go @@ -209,8 +209,8 @@ func getBashCompletion() { fatal(err) } msg := "\nConfiguration written to " + f - msg = msg + "\n\n$ source ${HOME}/.minio/mc/mc.bash_completion\n" - msg = msg + "$ echo 'source ${HOME}/.minio/mc/mc.bash_completion' >> ${HOME}/.bashrc\n" + msg = msg + "\n\n$ source ${HOME}/.mc/mc.bash_completion\n" + msg = msg + "$ echo 'source ${HOME}/.mc/mc.bash_completion' >> ${HOME}/.bashrc\n" info(msg) } diff --git a/cmd-options.go b/cmd-options.go index 1ceb1e3f..b1651a5b 100644 --- a/cmd-options.go +++ b/cmd-options.go @@ -27,7 +27,7 @@ var ( cpCmd = cli.Command{ Name: "cp", Usage: "copy objects and files", - Description: "Copy files and objects recursively between Amazon S3, Donut and Filesystem", + Description: "Copy files and objects recursively between Amazon S3, Minio Object Storage and Filesystem", Action: doCopyCmd, Flags: []cli.Flag{ cli.BoolFlag{ @@ -63,7 +63,7 @@ EXAMPLES: lsCmd = cli.Command{ Name: "ls", Usage: "list files and objects", - Description: `List files and objects recursively between Amazon S3, Donut and Filesystem`, + Description: `List files and objects recursively between Amazon S3, Minio Object Storage and Filesystem`, Action: doListCmd, CustomHelpTemplate: `NAME: mc {{.Name}} - {{.Usage}} @@ -154,7 +154,7 @@ EXAMPLES: ) type object struct { - scheme string // protocol type: possible values are http, https, donut, nil + scheme string // protocol type: possible values are http, https, nil host string // Bucket name can also be a DNS name. "." is allowed, with certain restrictions. // Read more at http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html diff --git a/docs/commands/config.md b/docs/commands/config.md new file mode 100644 index 00000000..846107c2 --- /dev/null +++ b/docs/commands/config.md @@ -0,0 +1,23 @@ +#### generate config + +``` +NAME: + config - Generate configuration "/home/alexa/.mc/config.json" file. + +USAGE: + command config [command options] [arguments...] + +DESCRIPTION: + Configure minio client configuration data. If your config + file does not exist (the default location is ~/.auth), it will be + automatically created for you. Note that the configure command only writes + values to the config file. It does not use any configuration values from + the environment variables. + +OPTIONS: + --accesskeyid, -a AWS access key ID + --secretkey, -s AWS secret access key + --alias Add aliases into config + --completion Generate bash completion "/home/alexa/.mc/mc.bash_completion" file. + +``` \ No newline at end of file diff --git a/docs/commands/cp.md b/docs/commands/cp.md new file mode 100644 index 00000000..cd61345b --- /dev/null +++ b/docs/commands/cp.md @@ -0,0 +1,26 @@ +#### copy objects + +``` +NAME: + mc cp - copy objects and files + +USAGE: + mc cp [ARGS...] SOURCE TARGET [TARGET...] + +DESCRIPTION: + Copy files and objects recursively between Amazon S3, Minio Object Storage and Filesystem + +OPTIONS: + --recursive, -r recursively crawls a given directory or bucket + +EXAMPLES: + 1. Copy an object from Amazon S3 object storage to local fileystem. + $ mc cp https://s3.amazonaws.com/jukebox/klingon_opera_aktuh_maylotah.ogg wakeup.ogg + + 2. Copy a bucket recursive from Minio object storage to Amazon S3 object storage + $ mc cp --recursive http://localhost:9000/photos/burningman2011 https://s3.amazonaws.com/burningman/ + + 3. Copy a local folder to Minio object storage and Amazon S3 object storage + $ mc cp --recursive backup/ http://localhost:9000/archive/ https://s3.amazonaws.com/archive/ + +``` \ No newline at end of file diff --git a/docs/commands/ls.md b/docs/commands/ls.md new file mode 100644 index 00000000..aba5ce89 --- /dev/null +++ b/docs/commands/ls.md @@ -0,0 +1,24 @@ +#### list objects + +``` +NAME: + mc ls - list files and objects + +USAGE: + mc ls TARGET + +DESCRIPTION: + List files and objects recursively between Amazon S3, Minio Object Storage and Filesystem + +EXAMPLES: + 1. List objects on Minio object storage + $ mc ls http://localhost:9000/backup/ + 2015-03-28 12:47:50 PDT 51.00 MB 2006-Jan-1/backup.tar.gz + 2015-03-31 14:46:33 PDT 55.00 MB 2006-Mar-1/backup.tar.gz + + 2. List buckets on Amazon S3 object storage + $ mc ls https://s3.amazonaws.com/ + 2015-01-20 15:42:00 PST rom + 2015-01-15 00:05:40 PST zek + +``` \ No newline at end of file diff --git a/docs/commands/mb.md b/docs/commands/mb.md new file mode 100644 index 00000000..48f0d027 --- /dev/null +++ b/docs/commands/mb.md @@ -0,0 +1,20 @@ +#### make bucket + +``` +NAME: + mc mb - makes a bucket + +USAGE: + mc mb TARGET + +DESCRIPTION: + Creates an S3 bucket + +EXAMPLES: + 1. Create a bucket on Amazon S3 object storage + $ mc mb https://s3.amazonaws.com/public-photo-store + + 2. Create a bucket on Minio object storage + $ mc mb http://localhost:9000/mongodb-backup + +``` \ No newline at end of file diff --git a/docs/debugging.md b/docs/debugging.md new file mode 100644 index 00000000..9a6dbc62 --- /dev/null +++ b/docs/debugging.md @@ -0,0 +1,36 @@ +### Debugging ``mc`` commands + +#### mb [DEBUG] +``` +$ mc --debug mb localhost:localbucket +PUT /localbucket HTTP/1.1 +Host: localhost:9000 +User-Agent: Minio s3Client +Content-Length: 0 +Authorization: AWS **PASSWORD**STRIPPED** +Date: Wed, 08 Apr 2015 23:44:29 GMT +Accept-Encoding: gzip + +HTTP/1.1 200 OK +``` + +#### ls [DEBUG] +``` +$ mc --debug ls localhost: +GET / HTTP/1.1 +Host: localhost:9000 +User-Agent: Minio s3Client +Authorization: AWS **PASSWORD**STRIPPED** +Date: Wed, 08 Apr 2015 23:42:36 GMT +Accept-Encoding: gzip + +HTTP/1.1 200 OK +Connection: close +Content-Length: 221 +Accept-Ranges: bytes +Content-Type: application/xml +Date: Wed, 08 Apr 2015 23:42:36 GMT +Server: Minio + +2015-04-08 09:42:36 PDT newbucket +``` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index e35fa3ce..0b59bf4a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,6 +12,8 @@ mc - Minio Client for S3 Compatible Object Storage released under [Apache licens ### Commands ``` +$ mc help + NAME: mc - Minio Client for S3 Compatible Object Storage @@ -19,46 +21,59 @@ USAGE: mc [global options] command [command options] [arguments...] VERSION: - 0.1.0 + <---- GIT COMMIT ID ----> -AUTHOR: - Minio.io +BUILD: + <---- BUILD TIME ----> COMMANDS: - cp copy objects - ls get list of objects - mb makes a bucket - config Generate configuration "/home/harsha/.minio/mc/config.json" file. - help, h Shows a list of commands or help for one command + cp copy objects and files + ls list files and objects + mb makes a bucket + config Generate configuration "/home/alexa/.mc/config.json" file. GLOBAL OPTIONS: - --debug enable HTTP tracing - --quiet, -q disable chatty output, such as the progress bar - --get-bash-completion Generate bash completion "/home/harsha/.minio/mc/mc.bash_completion" file. - --help, -h show help - --generate-bash-completion - --version, -v print the version + --debug enable HTTP tracing + --quiet, -q disable chatty output, such as the progress bar + --version, -v print the version + ``` ## Contribute [Contribute to mc](./contributing.md) +### Supported platforms + +| Name | Supported | +| ------------- | ------------- | +| Linux | Yes | +| Windows | Yes | +| Mac OSX | Yes | + +### Supported architectures + +| Arch | Supported | +| ------------- | ------------- | +| x86-64 | Yes | +| arm64 | Not yet| +| i386 | Not yet | + ### Enable bash completion To generate bash completion for ``mc`` all you have to do is ``` -$ mc --get-bash-completion +$ mc config --completion -Configuration written to /home/user/.minio/mc/mc.bash_completion +Configuration written to /home/user/.mc/mc.bash_completion -$ source ${HOME}/.minio/mc/mc.bash_completion -$ echo 'source ${HOME}/.minio/mc/mc.bash_completion' >> ${HOME}/.bashrc +$ source ${HOME}/.mc/mc.bash_completion +$ echo 'source ${HOME}/.mc/mc.bash_completion' >> ${HOME}/.bashrc ``` ``` $ mc -config cp h help ls mb sync +config cp h help ls mb ``` diff --git a/mkdocs.yml b/mkdocs.yml index d6dfb854..a8c9c120 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,8 +1,13 @@ site_name: Minio Client Documentation pages: - ['index.md', Index] -- ['sdks/js/javascript.md', 'SDKs', 'Javascript'] -- ['sdks/python/python.md', 'SDKs', 'Python'] -- ['sdks/ruby/ruby.md', 'SDKs', 'Ruby'] -- ['contributing.md', 'Contributing', 'Overview'] +- ['commands/config.md', 'Commands', 'config'] +- ['commands/ls.md', 'Commands', 'ls'] +- ['commands/cp.md', 'Commands', 'cp'] +- ['commands/mb.md', 'Commands', 'mb'] +- ['sdks/js/javascript.md', 'SDKs'] +- ['sdks/python/python.md', 'SDKs'] +- ['sdks/ruby/ruby.md', 'SDKs'] +- ['contributing.md', 'Contributing'] +- ['debugging.md', 'Debugging'] theme: readthedocs diff --git a/pkg/client/s3/s3-verify.go b/pkg/client/s3/s3-verify.go index 272ef187..9d4ecb53 100644 --- a/pkg/client/s3/s3-verify.go +++ b/pkg/client/s3/s3-verify.go @@ -50,7 +50,6 @@ Example AWS S3 Request / Response X-Amz-Request-Id: 5E9A737908F886D0 2015-03-11 01:28:03 -0700 PDT 1.10 KB color.go - 2015-03-07 15:53:44 -0800 PST 2.58 KB donut.go 2015-03-08 03:31:50 -0700 PDT 11.09 KB apache/license.txt */ diff --git a/url-parser.go b/url-parser.go index e3e7b808..adf965f4 100644 --- a/url-parser.go +++ b/url-parser.go @@ -29,10 +29,9 @@ import ( type urlType int const ( - urlUnknown urlType = iota // Unknown type - urlS3 // Minio and S3 compatible object storage - urlDonut // Donut object storage - urlFile // POSIX compatible file systems + urlUnknown urlType = iota // Unknown type + urlObjectStorage // Minio and S3 compatible object storage + urlFile // POSIX compatible file systems ) // urlType detects the type of URL @@ -45,9 +44,7 @@ func getURLType(urlStr string) (uType urlType, err error) { case "http": fallthrough case "https": - return urlS3, nil - case "donut": - return urlDonut, nil + return urlObjectStorage, nil case "file": fallthrough case "":