项目作者: appscode

项目描述 :
🚚 ☁️ Object Store Manipulator - curl for cloud storage
高级语言: Go
项目地址: git://github.com/appscode/osm.git
创建时间: 2016-10-26T05:40:38Z
项目社区:https://github.com/appscode/osm

开源协议:Apache License 2.0

下载


Go Report Card
Build Status
codecov
Docker Pulls
Slack
Twitter

osm

Object Store Manipulator (osm: pronounced like awesome) - curl for cloud storage services. 🙌 osm can create & delete buckets and upload, download & delete files from buckets for AWS S3, AWS S3 compatible other storage services(i.e. Minio), DigitalOcean Spaces, Google Cloud Storage, Microsoft Azure storage and OpenStack Swift. Its single binary can be easily packaged instead of official python based clis inside Docker images.

Install OSM

You can download and install a pre-built binary:

  1. # Linux amd 64-bit:
  2. wget -O osm https://cdn.appscode.com/binaries/osm/0.9.1/osm-linux-amd64 \
  3. && chmod +x osm \
  4. && sudo mv osm /usr/local/bin/
  5. # Linux 386 32-bit:
  6. wget -O osm https://cdn.appscode.com/binaries/osm/0.9.1/osm-linux-386 \
  7. && chmod +x osm \
  8. && sudo mv osm /usr/local/bin/
  9. # Mac 64-bit
  10. wget -O osm https://cdn.appscode.com/binaries/osm/0.9.1/osm-darwin-amd64 \
  11. && chmod +x osm \
  12. && sudo mv osm /usr/local/bin/
  13. # Mac 32-bit
  14. wget -O osm https://cdn.appscode.com/binaries/osm/0.9.1/osm-darwin-386 \
  15. && chmod +x osm \
  16. && sudo mv osm /usr/local/bin/

To build from source, run: go get -u github.com/appscode/osm

Usage

  1. osm [command] [flags]
  2. osm [command]
  3. Available Commands:
  4. config OSM configuration
  5. help Help about any command
  6. lc List containers
  7. ls List items in a container
  8. mc Make container
  9. pull Pull item from container
  10. push Push item to container
  11. rc Remove container
  12. rm Remove item from container
  13. stat Stat item from container
  14. version Prints binary version number.
  15. Flags:
  16. --alsologtostderr log to standard error as well as files
  17. --enable-analytics Send usage events to Google Analytics (default true)
  18. -h, --help help for osm
  19. --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
  20. --log_dir string If non-empty, write log files in this directory
  21. --logtostderr log to standard error instead of files
  22. --osmconfig string Path to osm config (default "$HOME/.osm/config")
  23. --stderrthreshold severity logs at or above this threshold go to stderr (default 2)
  24. -v, --v Level log level for V logs
  25. --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
  26. Use "osm [command] --help" for more information about a command.

OSM Configuration

osm stores credentials necessary to connect to a cloud storage provider in YAML format in $HOME/.osm/config file.
This allows providing commands one time for multiple subsequent operations with a cloud provider.

  1. # AWS S3:
  2. osm config set-context osm-s3 --provider=s3 --s3.access_key_id=<key_id> --s3.secret_key=<secret_key> --s3.region=us-east-1
  3. # TLS secure Minio server
  4. osm config set-context osm-minio --provider=s3 --s3.access_key_id=<minio_access_key> --s3.secret_key=<minio_secret_key> --s3.endpoint=<minio_server_address> --s3.cacert_file=<root_ca_file_path>
  5. # DigitalOcean Spaces:
  6. osm config set-context osm-do --provider=s3 --s3.access_key_id=<key_id> --s3.secret_key=<secret_key> --s3.endpoint=nyc3.digitaloceanspaces.com
  7. # Google Cloud Storage:
  8. osm config set-context osm-gs --provider=google --google.json_key_path=<path_sa_file> --google.project_id=<my_project>
  9. # Microsoft Azure ARM Storage:
  10. osm config set-context osm-az --provider=azure --azure.account=<storage_ac> --azure.key=<key>
  11. # Local Filesystem
  12. osm config set-context osm-local --provider=local --local.path=/tmp/stow

Bucket Operations

  1. # create bucket
  2. osm mc mybucket
  3. # upload file to bucket
  4. osm push -c mybucket ~/Downloads/appscode.pdf a/b/c.pdf
  5. # print uploaded file attributes
  6. osm stat -c mybucket a/b/c.pdf
  7. # download file from bucket
  8. osm pull -c mybucket a/b/c.pdf /tmp/d.pdf
  9. # list bucket
  10. osm ls mybucket
  11. # remove file from bucket
  12. osm rm -c mybucket a/b/c.pdf
  13. # remove bucket (use -f to delete any files inside)
  14. osm rc -f mybucket

Contribution guidelines

Want to help improve OSM? Please start here.

Support

If you have any questions, file an issue or talk to us on our community Slack channel.


The osm binary collects anonymous usage statistics to help us learn how the software is being used and how we can improve it.
To disable stats collection, run the operator with the flag
--enable-analytics=false.