├── .dir-locals.el ├── .gitignore ├── .gitmodules ├── .npmignore ├── CHANGES.md ├── CONTRIBUTING.md ├── Makefile ├── README.md ├── bin ├── mchattr ├── mchmod ├── mfind ├── mget ├── minfo ├── mjob ├── mln ├── mlogin ├── mls ├── mmd5 ├── mmkdir ├── mmpu ├── mput ├── mrm ├── mrmdir ├── msign ├── msync └── muntar ├── docs ├── index.md ├── man │ ├── mchattr.md │ ├── mchmod.md │ ├── mfind.md │ ├── mget.md │ ├── minfo.md │ ├── mjob.md │ ├── mln.md │ ├── mlogin.md │ ├── mls.md │ ├── mmkdir.md │ ├── mmpu.md │ ├── mput.md │ ├── mrm.md │ ├── mrmdir.md │ ├── msign.md │ ├── msync.md │ └── muntar.md └── media │ ├── css │ └── restdown.css │ └── img │ ├── favicon.ico │ └── logo.png ├── examples └── client-trace-logging.js ├── lib ├── client.js ├── create_client.js ├── index.js ├── jobshare.js ├── msync │ ├── file.js │ ├── finder.js │ ├── glob.js │ ├── localfile.js │ └── mantafile.js ├── options.js ├── queue.js ├── streaming_json_stream.js ├── string_stream.js ├── trackmarker.js └── utils.js ├── man └── man1 │ ├── mchattr.1 │ ├── mchmod.1 │ ├── mfind.1 │ ├── mget.1 │ ├── minfo.1 │ ├── mjob.1 │ ├── mln.1 │ ├── mlogin.1 │ ├── mls.1 │ ├── mmkdir.1 │ ├── mmpu.1 │ ├── mput.1 │ ├── mrm.1 │ ├── mrmdir.1 │ ├── msign.1 │ ├── msync.1 │ └── muntar.1 ├── package-lock.json ├── package.json ├── share ├── bg_graph.png ├── github.css ├── highlight.pack.js └── jobtemplate.htm ├── test ├── integration │ ├── client-mpu.test.js │ ├── client.test.js │ ├── corpus │ │ ├── 259-emptydir.tar │ │ └── tar1.tar │ ├── mchmod.test.js │ ├── mfind.test.js │ ├── mget.test.js │ ├── mjob-simple.test.js │ ├── mln.test.js │ ├── mmkdir.test.js │ ├── mmpu.test.js │ ├── mput.test.js │ ├── mrm.test.js │ ├── mrmdir.test.js │ ├── msign.test.js │ └── muntar.test.js ├── lib │ ├── logging.js │ └── utils.js └── unit │ ├── completion.test.js │ ├── options.test.js │ ├── trackmarker.test.js │ └── utils.test.js └── tools ├── changelog-issue-line ├── jsl.node.conf ├── jsstyle.conf ├── mk ├── Makefile.defs ├── Makefile.deps ├── Makefile.node_deps.defs ├── Makefile.node_deps.targ └── Makefile.targ └── test-in-smartos-container.sh /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((nil . ((indent-tabs-mode . nil) 2 | (tab-width . 8) 3 | (fill-column . 80))) 4 | (js-mode . ((js-indent-level . 4) 5 | (indent-tabs-mode . nil) 6 | ))) 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /tmp 3 | build 4 | docs/*.json 5 | docs/*.html 6 | cscope.in.out 7 | cscope.po.out 8 | cscope.out 9 | smf/manifests/bapi.xml 10 | /manta-*.tgz 11 | /npm-debug.log 12 | /share/manta.completion 13 | /test.tap 14 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/jsstyle"] 2 | path = deps/jsstyle 3 | url = https://github.com/TritonDataCenter/jsstyle.git 4 | [submodule "deps/restdown"] 5 | path = deps/restdown 6 | url = https://github.com/TritonDataCenter/restdown.git 7 | [submodule "deps/javascriptlint"] 8 | path = deps/javascriptlint 9 | url = https://github.com/TritonDataCenter/javascriptlint.git 10 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /.gitmodules 2 | /Makefile 3 | /deps 4 | /docs 5 | /test 6 | /tools 7 | /tmp 8 | /npm-debug.log 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This repository is part of the Triton Manta project. See the [contribution 4 | guidelines for the Manta 5 | project](https://github.com/TritonDataCenter/manta/blob/master/CONTRIBUTING.md). 6 | 7 | In addition to the guidelines described there, user-facing changes should 8 | include an update to `CHANGES.md` (to list the change) and `package.json` (to 9 | bump this package's version appropriately). 10 | 11 | If you have a GitHub issue created for a change you want to include in the 12 | changelog you can use the included script `./tools/changelog-issue-line` 13 | (requires [json](https://github.com/trentm/json) to be installed). Example: 14 | 15 | $ ./tools/changelog-issue-line 349 16 | - [#349](https://github.com/TritonDataCenter/node-manta/issues/349) issue numbers in CHANGES.md should link to GitHub issues 17 | 18 | Or in `vim` 19 | 20 | :r!./tools/changelog-issue-line 349 21 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2019 Joyent, Inc. 3 | # Copyright 2024 MNX Cloud, Inc. 4 | # 5 | 6 | # 7 | # Tools 8 | # 9 | # Get md2man-roff from 10 | MD2MAN := md2man-roff 11 | NPM := npm 12 | TAP_EXEC = ./node_modules/.bin/tap 13 | TEST_JOBS ?= 10 14 | TEST_TIMEOUT_S ?= 1200 15 | TEST_FILTER ?= .* 16 | 17 | # 18 | # Files 19 | # 20 | DOC_FILES = index.md 21 | JS_FILES := $(shell find lib test -name '*.js') 22 | JS_FILES += $(shell find bin -type f -not -name '.*.swp') 23 | JSL_CONF_NODE = tools/jsl.node.conf 24 | JSL_FILES_NODE = $(JS_FILES) 25 | JSSTYLE_FILES = $(JS_FILES) 26 | JSSTYLE_FLAGS = -f tools/jsstyle.conf 27 | 28 | CLEAN_FILES += node_modules 29 | 30 | include ./tools/mk/Makefile.defs 31 | 32 | # 33 | # Variables 34 | # 35 | 36 | MAN_PAGES := $(shell ls docs/man) 37 | MAN_OUTDIR := man/man1 38 | MAN_OUTPAGES=$(MAN_PAGES:%.md=$(MAN_OUTDIR)/%.1) 39 | MAN_ROOT := docs/man 40 | 41 | COMPLETION_CMDS := $(shell find bin -type f) 42 | COMPLETION_FILE=share/manta.completion 43 | 44 | # 45 | # Repo-specific targets 46 | # 47 | .PHONY: all 48 | all: $(SMF_MANIFESTS) deps completion 49 | 50 | .PHONY: deps 51 | deps $(TAP_EXEC): | $(REPO_DEPS) $(NPM_EXEC) 52 | $(NPM_ENV) $(NPM) install 53 | 54 | 55 | .PHONY: ensure-node-v6-or-greater-for-test-suite 56 | ensure-node-v6-or-greater-for-test-suite: | $(TAP_EXEC) 57 | @NODE_VER=$(shell node --version) && \ 58 | ./node_modules/.bin/semver -r '>=6.x' $$NODE_VER >/dev/null || \ 59 | (echo "error: node-tap@12 runner requires node v6 or greater: you have $$NODE_VER"; exit 1) 60 | 61 | .PHONY: test 62 | test: ensure-node-v6-or-greater-for-test-suite | $(TAP_EXEC) 63 | @testFiles="$(shell ls test/unit/*.test.js test/integration/*.test.js | egrep "$(TEST_FILTER)")" && \ 64 | test -z "$$testFiles" || \ 65 | NODE_NDEBUG= $(TAP_EXEC) --timeout $(TEST_TIMEOUT_S) -j $(TEST_JOBS) -o ./test.tap $$testFiles 66 | 67 | 68 | $(MAN_OUTDIR): 69 | mkdir -p $@ 70 | 71 | $(MAN_OUTDIR)/%.1: $(MAN_ROOT)/%.md | $(MAN_OUTDIR) 72 | $(MD2MAN) $^ > $@ 73 | 74 | .PHONY: manpages 75 | manpages: $(MAN_OUTPAGES) 76 | 77 | 78 | # 79 | # Each m* tool has a '--completion' option to emit Bash completion code. We 80 | # gather all those to a share/manta.completion file for users to source. 81 | # 82 | 83 | .PHONY: completion 84 | completion: $(COMPLETION_FILE) 85 | 86 | $(COMPLETION_FILE): $(COMPLETION_CMDS) lib/create_client.js 87 | echo "# node-manta tools v$(shell cat package.json | json version) completion" >$@ 88 | echo $(COMPLETION_CMDS) | xargs -n1 basename | sed -E 's/(.*)/# \1(1)/' >>$@ 89 | echo "" >>$@ 90 | for cmd in $(COMPLETION_CMDS); do \ 91 | $$cmd --completion | grep -v '^#' >>$@; \ 92 | done 93 | 94 | CLEAN_FILES += $(COMPLETION_FILE) 95 | 96 | # Ensure CHANGES.md and package.json have the same version. 97 | .PHONY: versioncheck 98 | versioncheck: 99 | @echo version is: $(shell cat package.json | json version) 100 | [[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -2 | tail -1 | awk '{print $$2}'` ]] 101 | 102 | check:: versioncheck 103 | 104 | .PHONY: cutarelease 105 | cutarelease: $(COMPLETION_FILE) versioncheck 106 | [[ -z `git status --short` ]] # If this fails, the working dir is dirty. 107 | @which json 2>/dev/null 1>/dev/null && \ 108 | ver=$(shell json -f package.json version) && \ 109 | name=$(shell json -f package.json name) && \ 110 | publishedVer=$(shell npm view -j $(shell json -f package.json name)@$(shell json -f package.json version) 2>/dev/null | json version) && \ 111 | if [[ -n "$$publishedVer" ]]; then \ 112 | echo "error: $$name@$$ver is already published to npm"; \ 113 | exit 1; \ 114 | fi && \ 115 | echo "** Are you sure you want to tag and publish $$name@$$ver to npm?" && \ 116 | echo "** Enter to continue, Ctrl+C to abort." && \ 117 | read 118 | ver=$(shell cat package.json | json version) && \ 119 | date=$(shell date -u "+%Y-%m-%d") && \ 120 | git tag -a "v$$ver" -m "version $$ver ($$date)" && \ 121 | git push origin "v$$ver" && \ 122 | npm publish 123 | 124 | 125 | include ./tools/mk/Makefile.deps 126 | include ./tools/mk/Makefile.targ 127 | -------------------------------------------------------------------------------- /bin/mchattr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // -*- mode: js -*- 3 | /* 4 | * Copyright 2018 Joyent, Inc. 5 | */ 6 | 7 | var path = require('path'); 8 | var url = require('url'); 9 | 10 | var bunyan = require('bunyan'); 11 | var dashdash = require('dashdash'); 12 | 13 | var manta = require('../lib'); 14 | 15 | 16 | ///--- Functions 17 | 18 | /** 19 | * Create a dashdash options parser for this command 20 | * 21 | * @param {String} name: Required. The command name. 22 | * @returns {Object} A dashdash options parser for the command. 23 | */ 24 | function optionsParser(name) { 25 | var parser = dashdash.createParser({ 26 | options: manta.DEFAULT_CLI_OPTIONS.concat([ 27 | { 28 | group: name + ' options' 29 | }, 30 | { 31 | names: ['header', 'H'], 32 | type: 'arrayOfString', 33 | help: 'HTTP headers to include', 34 | helpArg: 'HEADER' 35 | } 36 | ]) 37 | }); 38 | 39 | return (parser); 40 | } 41 | 42 | 43 | function ifError(err) { 44 | if (err) { 45 | console.error('mchattr: ' + err.toString()); 46 | process.exit(1); 47 | } 48 | } 49 | 50 | 51 | function printEntry(obj) { 52 | console.log('%j', obj); 53 | } 54 | 55 | 56 | ///--- Mainline 57 | 58 | (function main() { 59 | var name = path.basename(process.argv[1]); 60 | var argTypes = ['mpath']; 61 | var log = bunyan.createLogger({ 62 | name: name, 63 | level: (process.env.LOG_LEVEL || 'info'), 64 | stream: process.stderr 65 | }); 66 | 67 | var parser = optionsParser(name); 68 | var parseArgs = { 69 | name: name, 70 | parser: parser, 71 | argTypes: argTypes, 72 | log: log 73 | }; 74 | var options = manta.parseOptions(parseArgs); 75 | 76 | var client = manta.createBinClient(options); 77 | var i = -1; 78 | var opts = { 79 | headers: options.headers 80 | }; 81 | 82 | (function chattr(cb_err) { 83 | ifError(cb_err); 84 | 85 | var p = options.paths[++i]; 86 | if (!p) { 87 | client.close(); 88 | } else { 89 | client.chattr(p, opts, chattr); 90 | } 91 | })(); 92 | })(); 93 | -------------------------------------------------------------------------------- /bin/mchmod: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // -*- mode: js -*- 3 | /* 4 | * Copyright 2018 Joyent, Inc. 5 | */ 6 | 7 | var path = require('path'); 8 | var url = require('url'); 9 | 10 | var bunyan = require('bunyan'); 11 | var dashdash = require('dashdash'); 12 | 13 | var manta = require('../lib'); 14 | 15 | 16 | ///--- Functions 17 | 18 | function optionsParser(name) { 19 | var parser = dashdash.createParser({ 20 | options: manta.DEFAULT_CLI_OPTIONS 21 | }); 22 | 23 | return (parser); 24 | } 25 | 26 | 27 | function ifError(err, name) { 28 | if (err) { 29 | console.error('%s: %s', name, err.toString()); 30 | process.exit(1); 31 | } 32 | } 33 | 34 | 35 | /** 36 | * Handle command-specific options parsing and checking. 37 | * 38 | * @param {Object} opts: Required. A parsed options object. 39 | * @param {Object} parser: Required. A dashdash option parser. 40 | * @returns {Object} A possibly mutated version of the `opts` input parameter. 41 | */ 42 | function parseCmdOptions(opts, parser) { 43 | if (opts._args.length < 1) { 44 | manta.cli_usage(parser, 'role required', 45 | '-- [+-=]role,... path...'); 46 | } 47 | 48 | var roleOpt = opts._args.shift(); 49 | var operation = roleOpt.charAt(0); 50 | 51 | if (operation !== '+' && operation !== '-' && operation !== '=') { 52 | manta.cli_usage(parser, 53 | 'operation should be one of "+", "-" or "="'); 54 | } 55 | 56 | opts.mchmodOperation = operation; 57 | opts.mchmodRoles = roleOpt.substring(1).split(','); 58 | 59 | return (opts); 60 | } 61 | 62 | 63 | function printEntry(obj) { 64 | console.log('%j', obj); 65 | } 66 | 67 | 68 | 69 | ///--- Mainline 70 | 71 | (function main() { 72 | var argTypes = ['mpath']; 73 | var name = path.basename(process.argv[1]); 74 | var log = bunyan.createLogger({ 75 | name: name, 76 | level: (process.env.LOG_LEVEL || 'info'), 77 | stream: process.stderr 78 | }); 79 | var parser = optionsParser(name); 80 | var parseArgs = { 81 | name: name, 82 | parser: parser, 83 | argTypes: argTypes, 84 | parseCmdOptions: parseCmdOptions, 85 | log: log, 86 | extra: '-- [+-=]role,... path...' 87 | }; 88 | var options = manta.parseOptions(parseArgs); 89 | 90 | var client = manta.createBinClient(options); 91 | var i = -1; 92 | 93 | (function chmod(cb_err) { 94 | ifError(cb_err, name); 95 | 96 | var opts = { 97 | headers: {} 98 | }; 99 | 100 | var p = options.paths[++i]; 101 | if (!p) { 102 | client.close(); 103 | return; 104 | } 105 | 106 | if (options.mchmodOperation === '=') { 107 | opts.headers['role-tag'] = options.mchmodRoles.join(','); 108 | client.chattr(p, opts, chmod); 109 | return; 110 | } 111 | 112 | client.info(p, options, function (err, info, res) { 113 | if (err && err.name === 'AuthorizationFailedError') { 114 | console.error('%s: getobject access required for %s %s', name, 115 | name, options.mchmodOperation); 116 | process.exit(1); 117 | } 118 | ifError(err, name); 119 | var roles; 120 | if (info.headers['role-tag']) { 121 | /* JSSTYLED */ 122 | roles = info.headers['role-tag'].split(/\s*,\s*/); 123 | } else { 124 | roles = []; 125 | } 126 | 127 | if (options.mchmodOperation === '+') { 128 | options.mchmodRoles.forEach(function (role) { 129 | if (roles.indexOf(role) < 0) { 130 | roles.push(role); 131 | } 132 | }); 133 | } else if (options.mchmodOperation === '-') { 134 | options.mchmodRoles.forEach(function (role) { 135 | var index = roles.indexOf(role); 136 | if (index >= 0) { 137 | roles.splice(index, 1); 138 | } 139 | }); 140 | } 141 | opts.headers['role-tag'] = roles.join(','); 142 | client.chattr(p, opts, chmod); 143 | }); 144 | })(); 145 | })(); 146 | -------------------------------------------------------------------------------- /bin/minfo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // -*- mode: js -*- 3 | /* 4 | * Copyright 2018 Joyent, Inc. 5 | * Copyright 2022 MNX Cloud, Inc. 6 | */ 7 | 8 | var http = require('http'); 9 | var path = require('path-platform'); 10 | 11 | var bunyan = require('bunyan'); 12 | var dashdash = require('dashdash'); 13 | 14 | var manta = require('../lib'); 15 | 16 | 17 | ///--- Functions 18 | 19 | function optionsParser(name) { 20 | var parser = dashdash.createParser({ 21 | options: manta.DEFAULT_CLI_OPTIONS.concat([ 22 | { 23 | group: name + ' options' 24 | }, 25 | { 26 | names: [ 'json', 'j' ], 27 | type: 'bool', 28 | help: 'JSON output. Additional fields \'status\' and \ 29 | \'statusCode\' will be included in the output object.' 30 | } 31 | ]) 32 | }); 33 | 34 | return (parser); 35 | } 36 | 37 | 38 | function printEntry(res) { 39 | console.log('HTTP/%s %s %s', 40 | res.httpVersion, 41 | res.statusCode, 42 | http.STATUS_CODES[res.statusCode]); 43 | Object.keys(res.headers).forEach(function (k) { 44 | console.log('%s: %s', k, res.headers[k]); 45 | }); 46 | console.log(); 47 | } 48 | 49 | 50 | ///--- Mainline 51 | 52 | (function main() { 53 | var argTypes = ['mpath']; 54 | var name = path.basename(process.argv[1]); 55 | var log = bunyan.createLogger({ 56 | name: name, 57 | level: (process.env.LOG_LEVEL || 'info'), 58 | stream: process.stderr 59 | }); 60 | var parser = optionsParser(name); 61 | var parseArgs = { 62 | name: name, 63 | parser: parser, 64 | argTypes: argTypes, 65 | log: log 66 | }; 67 | var options = manta.parseOptions(parseArgs); 68 | 69 | var client = manta.createBinClient(options); 70 | var i = -1; 71 | 72 | function get() { 73 | var p = options.paths[++i]; 74 | if (!p) { 75 | client.close(); 76 | return; 77 | } 78 | 79 | client.info(p, function (err, info, res) { 80 | if (err) 81 | res = info; 82 | if (options.json) { 83 | var status = 'HTTP/' + res.httpVersion + ' ' + res.statusCode + 84 | ' ' + http.STATUS_CODES[res.statusCode]; 85 | var h = Object.assign({ 86 | status: status, 87 | statusCode: res.statusCode 88 | }, res.headers); 89 | console.log(JSON.stringify(h)); 90 | } else { 91 | printEntry(res); 92 | } 93 | get(); 94 | }); 95 | } 96 | 97 | get(); 98 | })(); 99 | -------------------------------------------------------------------------------- /bin/mln: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // -*- mode: js -*- 3 | /* 4 | * Copyright 2018 Joyent, Inc. 5 | */ 6 | 7 | var fs = require('fs'); 8 | var path = require('path-platform'); 9 | var url = require('url'); 10 | 11 | var bunyan = require('bunyan'); 12 | var dashdash = require('dashdash'); 13 | 14 | var manta = require('../lib'); 15 | 16 | 17 | ///--- Functions 18 | 19 | function optionsParser(name) { 20 | var parser = dashdash.createParser({ 21 | options: manta.DEFAULT_CLI_OPTIONS.concat([ 22 | { 23 | group: name + ' options' 24 | }, 25 | { 26 | names: ['role-tag'], 27 | type: 'arrayOfString', 28 | help: 'role tags to apply to the destination object', 29 | helpArg: 'TAG,TAG...' 30 | } 31 | ]) 32 | }); 33 | 34 | return (parser); 35 | } 36 | 37 | 38 | function ifError(err) { 39 | if (err) { 40 | console.error('mln: ' + err.toString()); 41 | process.exit(1); 42 | } 43 | } 44 | 45 | 46 | /** 47 | * Handle command-specific options parsing and checking. 48 | * 49 | * @param {Object} opts: Required. A parsed options object. 50 | * @param {Object} parser: Required. A dashdash option parser. 51 | * @returns {Object} A possibly mutated version of the `opts` input parameter. 52 | */ 53 | function parseCmdOptions(opts, parser) { 54 | if (opts._args.length < 1) { 55 | manta.cli_usage(parser, 'source required', 'source dest'); 56 | } else if (opts._args.length < 2) { 57 | manta.cli_usage(parser, 'dest required', 'source dest'); 58 | } 59 | 60 | opts.source = path.posix.normalize(opts._args[0]); 61 | opts.path = path.posix.normalize(opts._args[1]); 62 | 63 | ifError(manta.assertPath(opts.path, true)); 64 | 65 | if (opts.role_tag && opts.role_tag.length === 1) { 66 | /* JSSTYLED */ 67 | opts.role_tag = opts.role_tag[0].split(/\s*,\s*/); 68 | } 69 | 70 | return (opts); 71 | } 72 | 73 | 74 | ///--- Mainline 75 | 76 | (function main() { 77 | var argTypes = ['mpath', 'mpath', 'none']; 78 | var name = path.basename(process.argv[1]); 79 | var log = bunyan.createLogger({ 80 | name: name, 81 | level: (process.env.LOG_LEVEL || 'info'), 82 | stream: process.stderr 83 | }); 84 | var parser = optionsParser(name); 85 | var parseArgs = { 86 | name: name, 87 | parser: parser, 88 | argTypes: argTypes, 89 | parseCmdOptions: parseCmdOptions, 90 | log: log, 91 | extra: 'source dest' 92 | }; 93 | var options = manta.parseOptions(parseArgs); 94 | 95 | var client = manta.createBinClient(options); 96 | var headers = { 97 | headers: options.headers || {} 98 | }; 99 | 100 | if (options.role_tag) { 101 | headers.headers['role-tag'] = options.role_tag.join(','); 102 | } 103 | 104 | client.ln(options.source, options.path, headers, function (err) { 105 | ifError(err); 106 | 107 | client.close(); 108 | }); 109 | })(); 110 | -------------------------------------------------------------------------------- /bin/mmd5: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // -*- mode: js -*- 3 | /* 4 | * Copyright 2018 Joyent, Inc. 5 | * Copyright 2023 MNX Cloud, Inc. 6 | */ 7 | 8 | var fs = require('fs'); 9 | var path = require('path'); 10 | var url = require('url'); 11 | 12 | var bunyan = require('bunyan'); 13 | var dashdash = require('dashdash'); 14 | var vasync = require('vasync'); 15 | 16 | var manta = require('../lib'); 17 | 18 | 19 | ///--- Functions 20 | 21 | function optionsParser(name) { 22 | var parser = dashdash.createParser({ 23 | options: manta.DEFAULT_CLI_OPTIONS 24 | }); 25 | 26 | return (parser); 27 | } 28 | 29 | 30 | function ifError(err) { 31 | if (err) { 32 | console.error('mmd5: ' + err.toString()); 33 | process.exit(1); 34 | } 35 | } 36 | 37 | 38 | /** 39 | * Handle command-specific options parsing and checking. 40 | * 41 | * @param {Object} opts: Required. A parsed options object. 42 | * @param {Object} parser: Required. A dashdash option parser. 43 | * @returns {Object} A possibly mutated version of the `opts` input parameter. 44 | */ 45 | function parseCmdOptions(opts, parser) { 46 | opts.parallel = 10; 47 | 48 | return (opts); 49 | } 50 | 51 | 52 | function printEntry(p, md5) { 53 | var _md5 = new Buffer.from(md5, 'base64'); 54 | console.log(_md5.toString('hex') + ' ' + p); 55 | } 56 | 57 | 58 | function printError(p, err) { 59 | var msg = err ? (err.message || err) : ''; 60 | console.error('mmd5: ' + p + ': ' + msg); 61 | } 62 | 63 | 64 | ///--- Mainline 65 | 66 | (function main() { 67 | const dirContentType = 'application/x-json-stream; type=directory'; 68 | var hadErr = false; 69 | var argTypes = ['mpath']; 70 | var name = path.basename(process.argv[1]); 71 | var log = bunyan.createLogger({ 72 | name: name, 73 | level: (process.env.LOG_LEVEL || 'info'), 74 | stream: process.stderr 75 | }); 76 | var parser = optionsParser(name); 77 | var parseArgs = { 78 | name: name, 79 | parser: parser, 80 | argTypes: argTypes, 81 | parseCmdOptions: parseCmdOptions, 82 | log: log 83 | }; 84 | var options = manta.parseOptions(parseArgs); 85 | 86 | var client = manta.createBinClient(options); 87 | var queue = new manta.Queue({ 88 | limit: options.parallel, 89 | worker: function getMD5(p, cb) { 90 | client.info(p, function (err, info) { 91 | if (err) { 92 | hadErr = true; 93 | printError(p, err); 94 | } else if (info.hasOwnProperty('md5')) { 95 | printEntry(p, info.md5); 96 | } else if (info.type === dirContentType) { 97 | hadErr = true; 98 | printError(p, p + ' is a directory'); 99 | } else { 100 | hadErr = true; 101 | printError(p, 'missing MD5'); 102 | } 103 | cb(); 104 | }); 105 | } 106 | }); 107 | 108 | queue.once('end', function () { 109 | process.exit(hadErr ? 1 : 0); 110 | }); 111 | 112 | options.paths.forEach(function (p) { 113 | ifError(manta.assertPath(p, true)); 114 | queue.push(manta.path(p, true)); 115 | }); 116 | 117 | queue.close(); 118 | })(); 119 | -------------------------------------------------------------------------------- /bin/mmkdir: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // -*- mode: js -*- 3 | /* 4 | * Copyright 2017 Joyent, Inc. 5 | */ 6 | 7 | var path = require('path'); 8 | var strsplit = require('strsplit'); 9 | var url = require('url'); 10 | 11 | var bunyan = require('bunyan'); 12 | var dashdash = require('dashdash'); 13 | 14 | var manta = require('../lib'); 15 | 16 | 17 | ///--- Functions 18 | 19 | /** 20 | * Create a dashdash options parser for this command 21 | * 22 | * @param {String} name: Required. The command name. 23 | * @returns {Object} A dashdash options parser for the command. 24 | */ 25 | function optionsParser(name) { 26 | var parser = dashdash.createParser({ 27 | options: manta.DEFAULT_CLI_OPTIONS.concat([ 28 | { 29 | group: name + ' options' 30 | }, 31 | { 32 | names: ['header', 'H'], 33 | type: 'arrayOfString', 34 | help: 'HTTP headers to include', 35 | helpArg: 'HEADER' 36 | }, 37 | { 38 | names: ['parents', 'p'], 39 | type: 'bool', 40 | help: 'no error if existing, make parent directories as needed' 41 | }, 42 | { 43 | names: ['role-tag'], 44 | type: 'arrayOfString', 45 | help: 'role tags to apply to the created directory', 46 | helpArg: 'TAG,TAG...' 47 | } 48 | ]) 49 | }); 50 | 51 | return (parser); 52 | 53 | } 54 | 55 | 56 | function ifError(err) { 57 | if (err) { 58 | console.error('mmkdir: ' + err.toString()); 59 | process.exit(1); 60 | } 61 | } 62 | 63 | 64 | /** 65 | * Handle command-specific options parsing and checking. 66 | * 67 | * @param {Object} opts: Required. A parsed options object. 68 | * @param {Object} parser: Required. A dashdash option parser. 69 | * @returns {Object} A possibly mutated version of the `opts` input parameter. 70 | */ 71 | function parseCmdOptions(opts, parser) { 72 | if (opts.role_tag && opts.role_tag.length === 1) { 73 | /* JSSTYLED */ 74 | opts.role_tag = opts.role_tag[0].split(/\s*,\s*/); 75 | } 76 | 77 | if (opts._args.length < 1) 78 | manta.cli_usage(parser, 'path required', 'path...'); 79 | 80 | opts.paths = opts._args.map(function (p) { 81 | ifError(manta.assertPath(p, true)); 82 | return (manta.path(p, true)); 83 | }); 84 | 85 | return (opts); 86 | } 87 | 88 | 89 | 90 | ///--- Mainline 91 | (function main() { 92 | var done = 0; 93 | var name = path.basename(process.argv[1]); 94 | var log = bunyan.createLogger({ 95 | name: name, 96 | level: (process.env.LOG_LEVEL || 'info'), 97 | stream: process.stderr 98 | }); 99 | var parser = optionsParser(name); 100 | var parseArgs = { 101 | name: name, 102 | parser: parser, 103 | argTypes: ['mdir'], 104 | parseCmdOptions: parseCmdOptions, 105 | log: log 106 | }; 107 | var options = manta.parseOptions(parseArgs); 108 | var client = manta.createBinClient(options); 109 | var headers = { 110 | headers: options.headers || {} 111 | }; 112 | 113 | if (options.role_tag) { 114 | headers.headers['role-tag'] = options.role_tag.join(','); 115 | } 116 | 117 | function cb(err) { 118 | ifError(err); 119 | 120 | if (++done === options.paths.length) 121 | client.close(); 122 | } 123 | 124 | options.paths.forEach(function (p) { 125 | if (options.parents) { 126 | client.mkdirp(p, headers, cb); 127 | } else { 128 | client.mkdir(p, headers, cb); 129 | } 130 | }); 131 | 132 | })(); 133 | -------------------------------------------------------------------------------- /bin/mrm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // -*- mode: js -*- 3 | /* 4 | * Copyright 2018 Joyent, Inc. 5 | */ 6 | 7 | var assert = require('assert-plus'); 8 | var f = require('util').format; 9 | var path = require('path'); 10 | 11 | var bunyan = require('bunyan'); 12 | var dashdash = require('dashdash'); 13 | 14 | var manta = require('../lib'); 15 | 16 | ///--- Functions 17 | 18 | function optionsParser(name) { 19 | var parser = dashdash.createParser({ 20 | options: manta.DEFAULT_CLI_OPTIONS.concat([ 21 | { 22 | group: name + ' options' 23 | }, 24 | { 25 | names: ['interactive', 'I'], 26 | type: 'bool', 27 | help: 'confirm before deleting objects' 28 | }, 29 | { 30 | names: ['parallel', 'p'], 31 | type: 'positiveInteger', 32 | help: 'limit concurrent operations (default 50)', 33 | 'default': 50, 34 | helpArg: 'NUM' 35 | }, 36 | { 37 | names: ['recursive', 'r'], 38 | type: 'bool', 39 | help: 'remove directories and their contents recursively' 40 | } 41 | ]) 42 | }); 43 | 44 | return (parser); 45 | } 46 | 47 | 48 | function ifError(err) { 49 | if (err) { 50 | console.error('mrm: ' + err.toString()); 51 | process.exit(1); 52 | } 53 | } 54 | 55 | ///--- Mainline 56 | 57 | (function main() { 58 | var argTypes = ['mpath']; 59 | var name = path.basename(process.argv[1]); 60 | var log = bunyan.createLogger({ 61 | name: name, 62 | level: (process.env.LOG_LEVEL || 'info'), 63 | stream: process.stderr 64 | }); 65 | var parser = optionsParser(name); 66 | var parseArgs = { 67 | name: name, 68 | parser: parser, 69 | argTypes: argTypes, 70 | log: log 71 | }; 72 | var options = manta.parseOptions(parseArgs); 73 | var client = manta.createBinClient(options); 74 | var i = -1; 75 | 76 | if (options.interactive && !process.stdin.isTTY) { 77 | console.error('stdin must be a tty when interactive specified'); 78 | process.exit(1); 79 | } 80 | 81 | (function rm(cb_err) { 82 | ifError(cb_err); 83 | 84 | var p = options.paths[++i]; 85 | if (!p) { 86 | client.close(); 87 | return; 88 | } 89 | 90 | client.info(p, function (err, info) { 91 | if (err) { 92 | client.get(p, function (err2) { 93 | ifError(err2); 94 | // We *shouldn't* ever hit this... 95 | ifError(err); 96 | }); 97 | return; 98 | } 99 | 100 | if (info.extension === 'directory') { 101 | // entry is a directory 102 | if (!options.recursive) { 103 | console.error('%s is not an object', p); 104 | process.exit(1); 105 | } 106 | 107 | if (!options.interactive) { 108 | client.rmr(p, options, rm); 109 | return; 110 | } 111 | 112 | manta.promptConfirm( 113 | f('recursively remove directory `%s` [y/N]?: ', p), 114 | function (ans) { 115 | 116 | if (!ans) { 117 | // skip removing 118 | rm(); 119 | return; 120 | } 121 | 122 | client.rmr(p, options, rm); 123 | }); 124 | } else { 125 | // entry is an object 126 | if (!options.interactive) { 127 | client.unlink(p, rm); 128 | return; 129 | } 130 | 131 | manta.promptConfirm(f('remove object `%s` [y/N]?: ', p), 132 | function (ans) { 133 | 134 | if (!ans) { 135 | rm(); 136 | return; 137 | } 138 | 139 | client.unlink(p, rm); 140 | }); 141 | } 142 | }); 143 | })(); 144 | })(); 145 | -------------------------------------------------------------------------------- /bin/mrmdir: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // -*- mode: js -*- 3 | /* 4 | * Copyright 2018 Joyent, Inc. 5 | */ 6 | 7 | var assert = require('assert-plus'); 8 | var f = require('util').format; 9 | var path = require('path'); 10 | 11 | var bunyan = require('bunyan'); 12 | var dashdash = require('dashdash'); 13 | 14 | var manta = require('../lib'); 15 | 16 | 17 | ///--- Functions 18 | 19 | function optionsParser(name) { 20 | var parser = dashdash.createParser({ 21 | options: manta.DEFAULT_CLI_OPTIONS.concat([ 22 | { 23 | group: name + ' options' 24 | }, 25 | { 26 | names: ['interactive', 'I'], 27 | type: 'bool', 28 | help: 'confirm before deleting directories' 29 | } 30 | ]) 31 | }); 32 | 33 | return (parser); 34 | } 35 | 36 | 37 | function ifError(err) { 38 | if (err) { 39 | console.error('mrmdir: ' + err.toString()); 40 | process.exit(1); 41 | } 42 | } 43 | 44 | ///--- Mainline 45 | 46 | (function main() { 47 | var argTypes = ['mdir']; 48 | var name = path.basename(process.argv[1]); 49 | var log = bunyan.createLogger({ 50 | name: name, 51 | level: (process.env.LOG_LEVEL || 'info'), 52 | stream: process.stderr 53 | }); 54 | var parser = optionsParser(name); 55 | var parseArgs = { 56 | name: name, 57 | parser: parser, 58 | argTypes: argTypes, 59 | log: log 60 | }; 61 | var options = manta.parseOptions(parseArgs); 62 | var client = manta.createBinClient(options); 63 | var i = -1; 64 | 65 | if (options.interactive && !process.stdin.isTTY) { 66 | console.error('stdin must be a tty when interactive specified'); 67 | process.exit(1); 68 | } 69 | 70 | (function rmdir(cb_err) { 71 | ifError(cb_err); 72 | 73 | var p = options.paths[++i]; 74 | if (!p) { 75 | client.close(); 76 | return; 77 | } 78 | 79 | client.info(p, function (err, info) { 80 | if (err) { 81 | client.get(p, function (err2) { 82 | ifError(err2); 83 | // We *shouldn't* ever hit this... 84 | ifError(err); 85 | }); 86 | return; 87 | } 88 | 89 | if (info.extension !== 'directory') { 90 | console.error('%s is not a directory', p); 91 | process.exit(1); 92 | } 93 | 94 | if (!options.interactive) { 95 | client.unlink(p, rmdir); 96 | return; 97 | } 98 | 99 | manta.promptConfirm(f('remove directory `%s` [y/N]?: ', p), 100 | function (ans) { 101 | 102 | if (!ans) { 103 | // skip removing this file 104 | rmdir(); 105 | return; 106 | } 107 | 108 | client.unlink(p, rmdir); 109 | }); 110 | }); 111 | })(); 112 | })(); 113 | -------------------------------------------------------------------------------- /docs/man/mchattr.md: -------------------------------------------------------------------------------- 1 | mput 1 "May 2013" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mchattr - change object attributes 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mchattr` [OPTION...] OBJECT 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | mchattr changes attributes of an object. Running mchattr only changes metadata 18 | about the object (i.e., HTTP headers). Running mchattr completely replaces all 19 | modifiable HTTP headers, so you must specify the complete set upon running. 20 | 21 | Note you are not permitted to update "core" headers, such as `durability-level`, 22 | `content-length`, and `content-md5`. You can update `content-type`, `m-*` and 23 | CORS headers. 24 | 25 | EXAMPLES 26 | -------- 27 | 28 | $ mchattr -H m-foo:bar ~~/stor/foo.txt 29 | 30 | OPTIONS 31 | ------- 32 | 33 | `-a, --account login` 34 | Authenticate as account (login name). 35 | 36 | `-h, --help` 37 | Print a help message and exit. 38 | 39 | `-i, --insecure` 40 | This option explicitly allows "insecure" SSL connections and transfers. All 41 | SSL connections are attempted to be made secure by using the CA certificate 42 | bundle installed by default. 43 | 44 | `-H, --header` 45 | Set the specified HTTP header. 46 | 47 | `-k, --key fingerprint` 48 | Authenticate using the SSH key described by FINGERPRINT. The key must 49 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 50 | 51 | `--role=ROLE,ROLE,...` 52 | Specify which roles to assume for the request. 53 | 54 | `-u, --url url` 55 | Manta base URL (such as `https://us-central.manta.mnx.io`). 56 | 57 | `--user user` 58 | Authenticate as user under account. 59 | 60 | `-v, --verbose` 61 | Print debug output to stderr. Repeat option to increase verbosity. 62 | 63 | ENVIRONMENT 64 | ----------- 65 | 66 | `MANTA_USER` 67 | In place of `-a, --account`. 68 | 69 | `MANTA_SUBUSER` 70 | In place of `--user`. 71 | 72 | `MANTA_KEY_ID` 73 | In place of `-k, --key`. 74 | 75 | `MANTA_ROLE` 76 | In place of `--role`. 77 | 78 | `MANTA_URL` 79 | In place of `-u, --url`. 80 | 81 | `MANTA_TLS_INSECURE` 82 | In place of `-i, --insecure`. 83 | 84 | The shortcut `~~` is equivalent to `/:login` 85 | where `:login` is the account login name. 86 | 87 | DIAGNOSTICS 88 | ----------- 89 | 90 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 91 | output format. As an example of tracing all information about a request, 92 | try: 93 | 94 | $ mchattr -v ~~/stor/foo 2>&1 | bunyan 95 | 96 | BUGS 97 | ---- 98 | 99 | DSA keys do not work when loaded via the SSH agent. 100 | 101 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 102 | -------------------------------------------------------------------------------- /docs/man/mchmod.md: -------------------------------------------------------------------------------- 1 | mchmod 1 "August 2014" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mchmod - change object role tags 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mchmod` [OPTION...] -- [+-=]ROLE,... OBJECT 13 | 14 | 15 | DESCRIPTION 16 | ----------- 17 | 18 | mchmod sets the role tags on an object or directory. Role tags are used to 19 | determine which of a user's roles will be checked to allow access. 20 | 21 | Note that in order to use `mchmod +ROLE` or `mchmode -ROLE` you will need access 22 | to read and write object metadata. Using `mchmod =ROLE` only requires write 23 | access. 24 | 25 | EXAMPLES 26 | -------- 27 | 28 | $ mchmod -- +read ~~/stor/foo.txt 29 | 30 | $ mchmod -- -read,write ~~/stor/foo.txt 31 | 32 | $ mchmod -a other_account -- =read ~~/stor/foot.txt 33 | 34 | 35 | OPTIONS 36 | ------- 37 | 38 | `-a, --account login` 39 | Authenticate as account (login name). 40 | 41 | `-h, --help` 42 | Print a help message and exit. 43 | 44 | `-i, --insecure` 45 | This option explicitly allows "insecure" SSL connections and transfers. All 46 | SSL connections are attempted to be made secure by using the CA certificate 47 | bundle installed by default. 48 | 49 | `-k, --key fingerprint` 50 | Authenticate using the SSH key described by FINGERPRINT. The key must 51 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 52 | 53 | `--role` 54 | Specify which roles to assume for the request. 55 | 56 | `-u, --url url` 57 | Manta base URL (such as `https://us-central.manta.mnx.io`). 58 | 59 | `--user user` 60 | Authenticate as user under account. 61 | 62 | `-v, --verbose` 63 | Print debug output to stderr. Repeat option to increase verbosity. 64 | 65 | ENVIRONMENT 66 | ----------- 67 | 68 | `MANTA_USER` 69 | In place of `-a, --account`. 70 | 71 | `MANTA_SUBUSER` 72 | In place of `--user`. 73 | 74 | `MANTA_KEY_ID` 75 | In place of `-k, --key`. 76 | 77 | `MANTA_URL` 78 | In place of `-u, --url`. 79 | 80 | `MANTA_TLS_INSECURE` 81 | In place of `-i, --insecure`. 82 | 83 | `MANTA_ROLE` 84 | In place of `--role`. 85 | 86 | The shortcut `~~` is equivalent to `/:login` 87 | where `:login` is the account login name. 88 | 89 | DIAGNOSTICS 90 | ----------- 91 | 92 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 93 | output format. As an example of tracing all information about a request, 94 | try: 95 | 96 | $ mchmod -v ~~/stor/foo 2>&1 | bunyan 97 | 98 | BUGS 99 | ---- 100 | 101 | DSA keys do not work when loaded via the SSH agent. 102 | 103 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 104 | -------------------------------------------------------------------------------- /docs/man/mfind.md: -------------------------------------------------------------------------------- 1 | mfind 1 "July 2016" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mfind - search for objects in a directory hierarchy. 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mfind` [OPTION...] PATH... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | The mfind utility recursively descends the directory tree for each path listed, 18 | listing names that are the specified `type` (or all if none is specified). 19 | 20 | Unlike GNU/BSD find, `mfind` is not yet sophisticated enough to support full 21 | `expression` matching, but does (currently) allow a `--name` option that 22 | supports Regular Expression matching. 23 | 24 | With the `--json` option a stream of JSON objects is printed. Each JSON object 25 | contains the fields from the Manta [ListDirectory API 26 | endpoint](https://apidocs.tritondatacenter.com/manta/api.html#ListDirectory), plus the 27 | following client-side added fields: 28 | 29 | - `depth`: An integer directory depth under the given directory, 30 | starting from 0. 31 | - `parent`: The full directory path of the entry. 32 | 33 | 34 | EXAMPLES 35 | -------- 36 | 37 | $ mfind -t o -n '.+.log$' ~~/stor/logs/foo/2013/04/29 38 | ~~/stor/logs/foo/2013/04/29/00/gandalf.log 39 | /$USER/stor/logs/foo/2013/04/29/00/frodo.log 40 | ~~/stor/logs/foo/2013/04/29/01/sam.log 41 | /$USER/stor/logs/foo/2013/04/29/01/aragorn.log 42 | 43 | OPTIONS 44 | ------- 45 | 46 | `-a, --account login` 47 | Authenticate as account (login name). 48 | 49 | `-h, --help` 50 | Print a help message and exit. 51 | 52 | `-i, --insecure` 53 | This option explicitly allows "insecure" SSL connections and transfers. All 54 | SSL connections are attempted to be made secure by using the CA certificate 55 | bundle installed by default. 56 | 57 | `-j, --json` 58 | Output a newline-separated JSON stream of find results. 59 | 60 | `-k, --key fingerprint` 61 | Authenticate using the SSH key described by FINGERPRINT. The key must 62 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 63 | 64 | `-l, --limit` 65 | Limit number of entries returned per request. 66 | 67 | `-n, --name regexp` 68 | Only return entries that have a name matching RegExp. RegExp is a 69 | Javascript Regular Expression. 70 | 71 | `-p, --parallel NUM` 72 | Limit concurrent operations to NUM. Default is 50. 73 | 74 | `-s, --size SIZE` 75 | Only list objects that are greater than SIZE bytes. 76 | 77 | `-t, --type type` 78 | Specify `d` for directories, and `o` for objects. If specified, only names of 79 | that type will be returned. 80 | 81 | `--maxdepth` 82 | Only print items items less than this depth 83 | 84 | `--mindepth` 85 | Only print items with at least this depth 86 | 87 | `--role=ROLE,ROLE,...` 88 | Specify which roles to assume for the request. 89 | 90 | `--user user` 91 | Authenticate as user under account. 92 | 93 | `-u, --url url` 94 | Manta base URL (such as `https://us-central.manta.mnx.io`). 95 | 96 | `-v, --verbose` 97 | Print debug output to stderr. Repeat option to increase verbosity. 98 | 99 | ENVIRONMENT 100 | ----------- 101 | `MANTA_USER` 102 | In place of `-a, --account`. 103 | 104 | `MANTA_SUBUSER` 105 | In place of `--user`. 106 | 107 | `MANTA_KEY_ID` 108 | In place of `-k, --key`. 109 | 110 | `MANTA_ROLE` 111 | In place of `--role`. 112 | 113 | `MANTA_URL` 114 | In place of `-u, --url`. 115 | 116 | `MANTA_TLS_INSECURE` 117 | In place of `-i, --insecure`. 118 | 119 | The shortcut `~~` is equivalent to `/:login` 120 | where `:login` is the account login name. 121 | 122 | DIAGNOSTICS 123 | ----------- 124 | 125 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 126 | output format. As an example of tracing all information about a request, 127 | try: 128 | 129 | $ mfind -vv ~~/stor 2>&1 | bunyan 130 | 131 | BUGS 132 | ---- 133 | 134 | DSA keys do not work when loaded via the SSH agent. 135 | 136 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 137 | -------------------------------------------------------------------------------- /docs/man/mget.md: -------------------------------------------------------------------------------- 1 | mget 1 "March 2019" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mget - download an object from Manta. 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mget` [OPTION...] PATH... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | Retrieves the content of object(s) specified by PATH(s), and dumps them to 18 | stdout. Note that mget does not perform incremental/resumable downloads, so any 19 | network-level errors that occur during transfer will result in an incomplete 20 | and/or corrupt output. You should check for an exit status of 0 to know that 21 | the request was successful. 22 | 23 | Note that mget by default will emit a progress meter on stderr. You can 24 | disable this with `-q`. 25 | 26 | EXAMPLES 27 | -------- 28 | 29 | Retrieves the given object, with a progress indicator. 30 | 31 | $ mget ~~/stor/README.md > /tmp/README.md 32 | 33 | Retrieves the given object, with a progress indicator, and stores it in the 34 | file README.md in the current directory. 35 | 36 | $ mget -O ~~/stor/README.md 37 | 38 | Finds and fetches a set of Javascript files, and pipes them to less. 39 | 40 | $ mfind -t o -n '.js$' ~~/stor/foo | xargs mget -q | less 41 | 42 | OPTIONS 43 | ------- 44 | 45 | `-a, --account login` 46 | Authenticate as account (login name). 47 | 48 | `-H, --header='header: value'` 49 | Additional HTTP header to include. Can be specified multiple times. Must be 50 | specified for each additional header. 51 | 52 | `-h, --help` 53 | Print a help message and exit. 54 | 55 | `-i, --insecure` 56 | This option explicitly allows "insecure" SSL connections and transfers. All 57 | SSL connections are attempted to be made secure by using the CA certificate 58 | bundle installed by default. 59 | 60 | `-k, --key fingerprint` 61 | Authenticate using the SSH key described by FINGERPRINT. The key must 62 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 63 | 64 | `--role=ROLE,ROLE,...` 65 | Specify which roles to assume for the request. 66 | 67 | `-o, --output file` 68 | Write output to <file> instead of stdout. 69 | 70 | `-O, --remote-name` 71 | Write output to a file using the requested object's name (i.e. the last 72 | element of the full object path) instead of stdout. 73 | 74 | `-q, --quiet` 75 | Do not display a progress meter. 76 | 77 | `--user user` 78 | Authenticate as user under account. 79 | 80 | `-u, --url url` 81 | Manta base URL (such as `https://us-central.manta.mnx.io`). 82 | 83 | `-v, --verbose` 84 | Print debug output to stderr. Repeat option to increase verbosity. 85 | 86 | ENVIRONMENT 87 | ----------- 88 | `MANTA_USER` 89 | In place of `-a, --account`. 90 | 91 | `MANTA_SUBUSER` 92 | In place of `--user`. 93 | 94 | `MANTA_KEY_ID` 95 | In place of `-k, --key`. 96 | 97 | `MANTA_ROLE` 98 | In place of `--role`. 99 | 100 | `MANTA_URL` 101 | In place of `-u, --url`. 102 | 103 | `MANTA_TLS_INSECURE` 104 | In place of `-i, --insecure`. 105 | 106 | The shortcut `~~` is equivalent to `/:login` 107 | where `:login` is the account login name. 108 | 109 | DIAGNOSTICS 110 | ----------- 111 | 112 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 113 | output format. As an example of tracing all information about a request, 114 | try: 115 | 116 | $ mget -vv ~~/stor/foo 2>&1 | bunyan 117 | 118 | BUGS 119 | ---- 120 | 121 | DSA keys do not work when loaded via the SSH agent. 122 | 123 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 124 | -------------------------------------------------------------------------------- /docs/man/minfo.md: -------------------------------------------------------------------------------- 1 | minfo 1 "May 2013" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | minfo - show HTTP headers for a Manta object 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `minfo` [OPTION...] PATH... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | Retrieves the HTTP headers of object(s) specified by PATH(s), and dumps them to 18 | stdout. Note that minfo does not download any content; use `mget` for that. 19 | 20 | EXAMPLES 21 | -------- 22 | 23 | Retrieves HTTP headers for the given object. 24 | 25 | $ minfo ~~/stor/README.md 26 | 27 | OPTIONS 28 | ------- 29 | 30 | `-a, --account login` 31 | Authenticate as account (login name). 32 | 33 | `-h, --help` 34 | Print a help message and exit. 35 | 36 | `-i, --insecure` 37 | This option explicitly allows "insecure" SSL connections and transfers. All 38 | SSL connections are attempted to be made secure by using the CA certificate 39 | bundle installed by default. 40 | 41 | `-j, --json` 42 | Output object headers in JSON format. Additionally, `status` and `statusCode`, 43 | while not technically headers, will be included in the output object. 44 | 45 | `-k, --key fingerprint` 46 | Authenticate using the SSH key described by FINGERPRINT. The key must 47 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 48 | 49 | `--role=ROLE,ROLE,...` 50 | Specify which roles to assume for the request. 51 | 52 | `--user user` 53 | Authenticate as user under account. 54 | 55 | `-u, --url url` 56 | Manta base URL (such as `https://us-central.manta.mnx.io`). 57 | 58 | `-v, --verbose` 59 | Print debug output to stderr. Repeat option to increase verbosity. 60 | 61 | ENVIRONMENT 62 | ----------- 63 | 64 | `MANTA_USER` 65 | In place of `-a, --account`. 66 | 67 | `MANTA_SUBUSER` 68 | In place of `--user`. 69 | 70 | `MANTA_KEY_ID` 71 | In place of `-k, --key`. 72 | 73 | `MANTA_ROLE` 74 | In place of `--role`. 75 | 76 | `MANTA_URL` 77 | In place of `-u, --url`. 78 | 79 | `MANTA_TLS_INSECURE` 80 | In place of `-i, --insecure`. 81 | 82 | The shortcut `~~` is equivalent to `/:login` 83 | where `:login` is the account login name. 84 | 85 | DIAGNOSTICS 86 | ----------- 87 | 88 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 89 | output format. As an example of tracing all information about a request, 90 | try: 91 | 92 | $ minfo -vv ~~/stor/foo 2>&1 | bunyan 93 | 94 | BUGS 95 | ---- 96 | 97 | DSA keys do not work when loaded via the SSH agent. 98 | 99 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 100 | -------------------------------------------------------------------------------- /docs/man/mln.md: -------------------------------------------------------------------------------- 1 | mln 1 "May 2013" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mln - make link between objects 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mln` [OPTION...] TARGET LINK_NAME 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | mln creates a link to TARGET with the name LINK_NAME. Links in Manta are 18 | allowed to be created by pointing at an object only, and are semantically 19 | different than a UNIX link (both hard and soft). Links in Manta are essentially 20 | a "snapshot". That is given object `A` and a link `B` to `A`, when `A` is 21 | overwritten to be `A'`, `B` will still return the original value of `A`. 22 | 23 | EXAMPLES 24 | -------- 25 | 26 | Creates a link from README that snapshots the contents of README.md. 27 | 28 | $ mln ~~/stor/README.md ~~/stor/README 29 | 30 | OPTIONS 31 | ------- 32 | 33 | `-a, --account login` 34 | Authenticate as account (login name). 35 | 36 | `-h, --help` 37 | Print a help message and exit. 38 | 39 | `-i, --insecure` 40 | This option explicitly allows "insecure" SSL connections and transfers. All 41 | SSL connections are attempted to be made secure by using the CA certificate 42 | bundle installed by default. 43 | 44 | `-k, --key fingerprint` 45 | Authenticate using the SSH key described by FINGERPRINT. The key must 46 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 47 | 48 | `--role=ROLE,ROLE,...` 49 | Specify which roles to assume for the request. 50 | 51 | `--role-tag=ROLE,ROLE,...` 52 | Set the role tags on the created link. 53 | 54 | `--user user` 55 | Authenticate as user under account. 56 | 57 | `-u, --url url` 58 | Manta base URL (such as `https://us-central.manta.mnx.io`). 59 | 60 | `-v, --verbose` 61 | Print debug output to stderr. Repeat option to increase verbosity. 62 | 63 | ENVIRONMENT 64 | ----------- 65 | 66 | `MANTA_USER` 67 | In place of `-a, --account`. 68 | 69 | `MANTA_SUBUSER` 70 | In place of `--user`. 71 | 72 | `MANTA_KEY_ID` 73 | In place of `-k, --key`. 74 | 75 | `MANTA_ROLE` 76 | In place of `--role`. 77 | 78 | `MANTA_URL` 79 | In place of `-u, --url`. 80 | 81 | `MANTA_TLS_INSECURE` 82 | In place of `-i, --insecure`. 83 | 84 | The shortcut `~~` is equivalent to `/:login` 85 | where `:login` is the account login name. 86 | 87 | DIAGNOSTICS 88 | ----------- 89 | 90 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 91 | output format. As an example of tracing all information about a request, 92 | try: 93 | 94 | $ mln -vv ~~/stor/foo 2>&1 | bunyan 95 | 96 | BUGS 97 | ---- 98 | 99 | DSA keys do not work when loaded via the SSH agent. 100 | 101 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 102 | -------------------------------------------------------------------------------- /docs/man/mlogin.md: -------------------------------------------------------------------------------- 1 | mlogin 1 "August 2017" Manta "Manta Commands" 2 | =========================================== 3 | 4 | NAME 5 | ---- 6 | 7 | mlogin - manta interactive session client 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mlogin` [OPTION...] [OBJECT] 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | `mlogin` allows you to spawn an interactive job in Manta. Once running, your 18 | terminal will be attached to the remote process running in the job via a shell 19 | session tunneled through HTTPS, similar in concept to SSH. 20 | 21 | Interactive sessions are a great way to debug a new job script in-situ, or to 22 | experience and explore the compute zone environment hands on. It can also 23 | become part of a workflow using interactive terminal utilities on large Manta 24 | objects without the need to download or transfer the data -- e.g. the the use 25 | of `mdb` (the Modular Debugger) on crash dumps and core files. 26 | 27 | The mlogin session terminates when the top level process has exited (usually the 28 | interactive shell, unless the `-c` option was used) and all references to that 29 | process's controlling terminal have also been closed. Beware that if you fork a 30 | background process and then exit the shell, the background process (and the job) 31 | may continue running if they hold the terminal open. You may need to cancel the 32 | job in order to stop it. 33 | 34 | Note that `mlogin` makes use of publicly-readable assets stored under the 35 | "poseidon" account, which is provided by the system. 36 | 37 | 38 | EXAMPLES 39 | -------- 40 | 41 | The default mode of `mlogin` is to create a reduce job with no input keys. This 42 | job has no input data, but gets you a shell running in a Manta compute zone. 43 | 44 | $ mlogin 45 | * created interactive job 46 | * waiting for session... established 47 | user@manta # ptree $$ 48 | 91352 zsched 49 | 2701 ./node lib/agent.js 50 | 2715 /bin/bash --norc 51 | 2735 ptree 2715 52 | user@manta # exit 53 | * remote process exited 54 | * cleaning up resources... 55 | * session complete 56 | 57 | A more complicated use of `mlogin` would be crashdump analysis with `mdb`: 58 | 59 | $ mlogin -c 'mdb /manta/user/stor/vmcore.1' /user/stor/vmcore.1 60 | * created interactive job 61 | * waiting for session... established 62 | Loading modules: [ unix genunix specfs dtrace mac ] 63 | > ::status 64 | debugging crash dump /manta/user/stor/vmcore.1 (64-bit) 65 | operating system: 5.11 joyent_20130226T234312Z (i86pc) 66 | panic message: 67 | BAD TRAP: type=e (#pf Page fault) rp=ffffff00b8e01070 addr=7b0 68 | > $q 69 | * remote process exited 70 | * cleaning up resources... 71 | * session complete 72 | 73 | OPTIONS 74 | ------- 75 | 76 | The options are supported: 77 | 78 | `-a, --account login` 79 | Authenticate as account (login name). 80 | 81 | `-c, --command shell_command` 82 | Run `shell_command` instead of the default shell. This will be passed to 83 | `bash -c` inside the interactive job, and can be used to run a command 84 | other than the default interactive shell. Can be especially useful when 85 | you provide a script or program to run via `--assets`. 86 | 87 | `--disk disk` 88 | Override the OS quota, and use the specified amount of disk. 89 | This option is specified in gigabytes. 90 | 91 | `-e, --escape escape_character` 92 | Sets the escape character for this mlogin session. This character is 93 | recognised immediately following a carriage return, and allows the user 94 | to perform a session control function. If the escape character is 95 | followed by a period (`.`), the session will end; followed by a 96 | question mark (`?`) prints a list of available escape characters. 97 | Passing `"none"` to the `-e` flag disables the escape character entirely. 98 | 99 | `-h, --help` 100 | Print a help message and exit. 101 | 102 | `--image version` 103 | Specifies an image version semver to use in job phases. Must be specified as 104 | a semver string (default is ~1.0). 105 | 106 | `--init command` 107 | Specifies a command to execute in the compute zone. This command will be 108 | executed prior to starting the interactive job. This is useful for setup, 109 | etc. 110 | 111 | `-i, --insecure` 112 | This option explicitly allows "insecure" SSL connections and transfers. All 113 | SSL connections are attempted to be made secure by using the CA certificate 114 | bundle installed by default. 115 | 116 | `-k, --key fingerprint` 117 | Authenticate using the SSH key described by `fingerprint`. The key must 118 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 119 | 120 | `--memory memory` 121 | Override the OS size, and use the specified amount of DRAM. 122 | This option is specified in megabytes. 123 | 124 | `--role=ROLE,ROLE,...` 125 | Specify which roles to assume for the request. 126 | 127 | `-s, --assets path` 128 | Specifies an asset to make available in the compute zone. 129 | 130 | `--user user` 131 | Authenticate as user under account. 132 | 133 | `-u, --url url` 134 | Manta base URL (such as `https://us-central.manta.mnx.io`). 135 | 136 | `-v, --verbose` 137 | Print debug output to stderr. Repeat option to increase verbosity. 138 | 139 | `-q, --quiet` 140 | Don't print session establishment status messages. 141 | 142 | ENVIRONMENT 143 | ----------- 144 | 145 | `MANTA_USER` 146 | In place of `-a, --account`. 147 | 148 | `MANTA_SUBUSER` 149 | In place of `--user`. 150 | 151 | `MANTA_KEY_ID` 152 | In place of `-k, --key`. 153 | 154 | `MANTA_ROLE` 155 | In place of `--role`. 156 | 157 | `MANTA_URL` 158 | In place of `-u, --url`. 159 | 160 | `MANTA_TLS_INSECURE` 161 | In place of `-i, --insecure`. 162 | 163 | The shortcut `~~` is equivalent to `/:login` 164 | where `:login` is the account login name. 165 | 166 | BUGS 167 | ---- 168 | 169 | DSA keys do not work when loaded via the SSH agent. 170 | 171 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 172 | -------------------------------------------------------------------------------- /docs/man/mls.md: -------------------------------------------------------------------------------- 1 | mls 1 "Sep 2018" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mls - list directory contents. 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mls` [OPTION...] [FILE]... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | List information about the FILEs (`/:login/stor` by default, where `:login` is 18 | either the login specified by `-a` or `$MANTA_USER`). Entries are sorted by 19 | creation time. Note that `directories` will appear to have a trailing `/` after 20 | them, while objects will be just the name (unless `-l` is specified). 21 | 22 | EXAMPLES 23 | -------- 24 | 25 | $ mls ~~/stor 26 | foo 27 | home/ 28 | README.md 29 | tmp/ 30 | 31 | OPTIONS 32 | ------- 33 | 34 | `-a, --account login` 35 | Authenticate as account (login name). 36 | 37 | `-h, --human-readable` 38 | Human readable output when using a long listing format. 39 | 40 | `--help` 41 | Print a help message and exit. 42 | 43 | `-i, --insecure` 44 | This option explicitly allows "insecure" SSL connections and transfers. All 45 | SSL connections are attempted to be made secure by using the CA certificate 46 | bundle installed by default. 47 | 48 | `-j, --json` 49 | Output records in JSON, as opposed to human readable form. 50 | 51 | `-k, --key fingerprint` 52 | Authenticate using the SSH key described by FINGERPRINT. The key must 53 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 54 | 55 | `-l, --long` 56 | Use a long listing format. Note that as Manta does not have group information, 57 | this is like `ls -o`, not `ls -l`, in a traditional shell. 58 | 59 | `-m, --marker name` 60 | Start listing at name NAME. Useful to paginate through large listings. 61 | 62 | `-r, --reverse` 63 | reverse order while sorting 64 | 65 | `--role=ROLE,ROLE,...` 66 | Specify which roles to assume for the request. 67 | 68 | `-t, --time` 69 | sort by modification time, newest first 70 | 71 | `--user user` 72 | Authenticate as user under account. 73 | 74 | `-u, --url url` 75 | Manta base URL (such as `https://us-central.manta.mnx.io`). 76 | 77 | `-v, --verbose` 78 | Print debug output to stderr. Repeat option to increase verbosity. 79 | 80 | ENVIRONMENT 81 | ----------- 82 | 83 | `MANTA_USER` 84 | In place of `-a, --account`. 85 | 86 | `MANTA_SUBUSER` 87 | In place of `--user`. 88 | 89 | `MANTA_KEY_ID` 90 | In place of `-k, --key`. 91 | 92 | `MANTA_ROLE` 93 | In place of `--role`. 94 | 95 | `MANTA_URL` 96 | In place of `-u, --url`. 97 | 98 | `MANTA_TLS_INSECURE` 99 | In place of `-i, --insecure`. 100 | 101 | The shortcut `~~` is equivalent to `/:login` 102 | where `:login` is the account login name. 103 | 104 | DIAGNOSTICS 105 | ----------- 106 | 107 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 108 | output format. As an example of tracing all information about a request, 109 | try: 110 | 111 | $ mls -vv ~~/stor 2>&1 | bunyan 112 | 113 | BUGS 114 | ---- 115 | 116 | DSA keys do not work when loaded via the SSH agent. 117 | 118 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 119 | -------------------------------------------------------------------------------- /docs/man/mmkdir.md: -------------------------------------------------------------------------------- 1 | mmkdir 1 "May 2013" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mmkdir - make directories 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mmkdir` [OPTION...] DIRECTORY... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | Create the DIRECTORY(ies), if they do not already exist. 18 | 19 | EXAMPLES 20 | -------- 21 | 22 | $ mmkdir -p ~~/stor/foo/bar/baz 23 | 24 | OPTIONS 25 | ------- 26 | 27 | `-a, --account login` 28 | Authenticate as account (login name). 29 | 30 | `-h, --help` 31 | Print a help message and exit. 32 | 33 | `-i, --insecure` 34 | This option explicitly allows "insecure" SSL connections and transfers. All 35 | SSL connections are attempted to be made secure by using the CA certificate 36 | bundle installed by default. 37 | 38 | `-k, --key fingerprint` 39 | Authenticate using the SSH key described by FINGERPRINT. The key must 40 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 41 | 42 | `-p, --parents` 43 | no error if existing, make parent directories as needed. 44 | 45 | `--role=ROLE,ROLE,...` 46 | Specify which roles to assume for the request. 47 | 48 | `--role-tag=ROLE,ROLE,...` 49 | Set the role tags on the created directory. 50 | 51 | `--user user` 52 | Authenticate as user under account. 53 | 54 | `-u, --url url` 55 | Manta base URL (such as `https://us-central.manta.mnx.io`). 56 | 57 | `-v, --verbose` 58 | Print debug output to stderr. Repeat option to increase verbosity. 59 | 60 | ENVIRONMENT 61 | ----------- 62 | 63 | `MANTA_USER` 64 | In place of `-a, --account`. 65 | 66 | `MANTA_SUBUSER` 67 | In place of `--user`. 68 | 69 | `MANTA_KEY_ID` 70 | In place of `-k, --key`. 71 | 72 | `MANTA_ROLE` 73 | In place of `--role`. 74 | 75 | `MANTA_URL` 76 | In place of `-u, --url`. 77 | 78 | `MANTA_TLS_INSECURE` 79 | In place of `-i, --insecure`. 80 | 81 | The shortcut `~~` is equivalent to `/:login` 82 | where `:login` is the account login name. 83 | 84 | DIAGNOSTICS 85 | ----------- 86 | 87 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 88 | output format. As an example of tracing all information about a request, 89 | try: 90 | 91 | $ mmkdir -vv ~~/stor/foo 2>&1 | bunyan 92 | 93 | BUGS 94 | ---- 95 | 96 | DSA keys do not work when loaded via the SSH agent. 97 | 98 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 99 | -------------------------------------------------------------------------------- /docs/man/mput.md: -------------------------------------------------------------------------------- 1 | mput 1 "May 2013" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mput - create an object 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mput` [OPTION...] OBJECT 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | mput creates an object specified at the name OBJECT with the contents either 18 | coming from stdin, or from the file specified with `-f`. mput will attempt to 19 | set the HTTP Content-Type based on the extension on the object, unless 20 | Content-Type is specified as an HTTP header. If mput cannot determine the type 21 | based on the extension the default content-type is usually 22 | `application/octet-stream`, but this can be overriden by setting the environment 23 | variable `MANTA_DEFAULT_CONTENT_TYPE` (or passing `-H`). 24 | 25 | By default, mput creates two copies of an object; this can be overridden with 26 | `-c`. Lastly, mput also draws a progress meter by default; this can be disabled 27 | with `-q`. 28 | 29 | EXAMPLES 30 | -------- 31 | 32 | Create an object with the contents of foo.txt. Content-type will be text/plain. 33 | 34 | $ mput -f ./foo.txt ~~/stor/foo.txt 35 | 36 | Create the same object from stdin, and set content-type. 37 | 38 | $ cat ./foo.txt | mput -H 'content-type: text/plain' ~~/stor/foo.txt 39 | 40 | Create the same object, set CORS header, and create 3 copies, with no progress bar: 41 | 42 | $ cat ./foo.txt | mput -H 'content-type: text/plain' \ 43 | -H 'access-control-allow-origin: *' \ 44 | -c 3 -q \ 45 | ~~/stor/foo.txt 46 | 47 | OPTIONS 48 | ------- 49 | 50 | `-a, --account login` 51 | Authenticate as account (login name). 52 | 53 | `-c, --copies file` 54 | Create COPIES copies as a replication factor (default 2). 55 | 56 | `-f, --file file` 57 | Create contents of object from file. 58 | 59 | `-h, --help` 60 | Print a help message and exit. 61 | 62 | `-i, --insecure` 63 | This option explicitly allows "insecure" SSL connections and transfers. All 64 | SSL connections are attempted to be made secure by using the CA certificate 65 | bundle installed by default. 66 | 67 | `-k, --key fingerprint` 68 | Authenticate using the SSH key described by FINGERPRINT. The key must 69 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 70 | 71 | `-m, --md5` 72 | When using `--file`, this switch instructs mput to first compute the MD5 of 73 | the file and send it in `content-md5`. 74 | 75 | `-p, --parents` 76 | Create parent directories as needed. 77 | 78 | `-q, --quiet` 79 | Do not display a progress meter. 80 | 81 | `--role=ROLE,ROLE,...` 82 | Specify which roles to assume for the request. 83 | 84 | `--role-tag=ROLE,ROLE,...` 85 | Set the role tags on the created object. 86 | 87 | `--user user` 88 | Authenticate as user under account. 89 | 90 | `-u, --url url` 91 | Manta base URL (such as `https://us-central.manta.mnx.io`). 92 | 93 | `-v, --verbose` 94 | Print debug output to stderr. Repeat option to increase verbosity. 95 | 96 | ENVIRONMENT 97 | ----------- 98 | 99 | `MANTA_USER` 100 | In place of `-a, --account`. 101 | 102 | `MANTA_SUBUSER` 103 | In place of `--user`. 104 | 105 | `MANTA_KEY_ID` 106 | In place of `-k, --key`. 107 | 108 | `MANTA_ROLE` 109 | In place of `--role`. 110 | 111 | `MANTA_URL` 112 | In place of `-u, --url`. 113 | 114 | `MANTA_TLS_INSECURE` 115 | In place of `-i, --insecure`. 116 | 117 | The shortcut `~~` is equivalent to `/:login` 118 | where `:login` is the account login name. 119 | 120 | DIAGNOSTICS 121 | ----------- 122 | 123 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 124 | output format. As an example of tracing all information about a request, 125 | try: 126 | 127 | $ mput -vv ~~/stor/foo 2>&1 | bunyan 128 | 129 | BUGS 130 | ---- 131 | 132 | DSA keys do not work when loaded via the SSH agent. 133 | 134 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 135 | -------------------------------------------------------------------------------- /docs/man/mrm.md: -------------------------------------------------------------------------------- 1 | mrm 1 "August 2018" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mrm - remove objects or directories 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mrm` [OPTION...] OBJECT... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | mrm removes each specified object. By default, it does not remove directories. 18 | 19 | EXAMPLES 20 | -------- 21 | 22 | Recursively delete all directories and objects under `/:login/stor/tmp`. 23 | 24 | $ mrm -r ~~/stor/tmp 25 | 26 | OPTIONS 27 | ------- 28 | 29 | `-a, --account login` 30 | Authenticate as account (login name). 31 | 32 | `-h, --help` 33 | Print a help message and exit. 34 | 35 | `-i, --insecure` 36 | This option explicitly allows "insecure" SSL connections and transfers. All 37 | SSL connections are attempted to be made secure by using the CA certificate 38 | bundle installed by default. 39 | 40 | `-I, --interactive` 41 | Confirm before deleting objects. 42 | 43 | `-k, --key fingerprint` 44 | Authenticate using the SSH key described by FINGERPRINT. The key must 45 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 46 | 47 | `-p, --parallel NUM` 48 | Limit concurrent operations to NUM. Default is 50. 49 | 50 | `-r, --recursive` 51 | Remove directories and their contents recursively. 52 | 53 | `--role=ROLE,ROLE,...` 54 | Specify which roles to assume for the request. 55 | 56 | `--user user` 57 | Authenticate as user under account. 58 | 59 | `-u, --url url` 60 | Manta base URL (such as `https://us-central.manta.mnx.io`). 61 | 62 | `-v, --verbose` 63 | Print debug output to stderr. Repeat option to increase verbosity. 64 | 65 | ENVIRONMENT 66 | ----------- 67 | 68 | `MANTA_USER` 69 | In place of `-a, --account`. 70 | 71 | `MANTA_SUBUSER` 72 | In place of `--user`. 73 | 74 | `MANTA_KEY_ID` 75 | In place of `-k, --key`. 76 | 77 | `MANTA_ROLE` 78 | In place of `--role`. 79 | 80 | `MANTA_URL` 81 | In place of `-u, --url`. 82 | 83 | `MANTA_TLS_INSECURE` 84 | In place of `-i, --insecure`. 85 | 86 | The shortcut `~~` is equivalent to `/:login` 87 | where `:login` is the account login name. 88 | 89 | DIAGNOSTICS 90 | ----------- 91 | 92 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 93 | output format. As an example of tracing all information about a request, 94 | try: 95 | 96 | $ mrm -vv ~~/stor/foo 2>&1 | bunyan 97 | 98 | BUGS 99 | ---- 100 | 101 | DSA keys do not work when loaded via the SSH agent. 102 | 103 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 104 | -------------------------------------------------------------------------------- /docs/man/mrmdir.md: -------------------------------------------------------------------------------- 1 | mrmdir 1 "August 2018" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | mrmdir - remove empty directories 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `mrmdir` [OPTION...] DIRECTORY... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | mrmdir removes each specified directory, if they are empty. 18 | 19 | EXAMPLES 20 | -------- 21 | 22 | $ mrmdir ~~/stor/tmp 23 | 24 | OPTIONS 25 | ------- 26 | 27 | `-a, --account login` 28 | Authenticate as account (login name). 29 | 30 | `-h, --help` 31 | Print a help message and exit. 32 | 33 | `-i, --insecure` 34 | This option explicitly allows "insecure" SSL connections and transfers. All 35 | SSL connections are attempted to be made secure by using the CA certificate 36 | bundle installed by default. 37 | 38 | `-I, --interactive` 39 | Confirm before deleting directories. 40 | 41 | `-k, --key fingerprint` 42 | Authenticate using the SSH key described by FINGERPRINT. The key must 43 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 44 | 45 | `--role=ROLE,ROLE,...` 46 | Specify which roles to assume for the request. 47 | 48 | `--user user` 49 | Authenticate as user under account. 50 | 51 | `-u, --url url` 52 | Manta base URL (such as `https://us-central.manta.mnx.io`). 53 | 54 | `-v, --verbose` 55 | Print debug output to stderr. Repeat option to increase verbosity. 56 | 57 | ENVIRONMENT 58 | ----------- 59 | 60 | `MANTA_USER` 61 | In place of `-a, --account`. 62 | 63 | `MANTA_SUBUSER` 64 | In place of `--user`. 65 | 66 | `MANTA_KEY_ID` 67 | In place of `-k, --key`. 68 | 69 | `MANTA_ROLE` 70 | In place of `--role`. 71 | 72 | `MANTA_URL` 73 | In place of `-u, --url`. 74 | 75 | `MANTA_TLS_INSECURE` 76 | In place of `-i, --insecure`. 77 | 78 | The shortcut `~~` is equivalent to `/:login` 79 | where `:login` is the account login name. 80 | 81 | DIAGNOSTICS 82 | ----------- 83 | 84 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 85 | output format. As an example of tracing all information about a request, 86 | try: 87 | 88 | $ mrmdir -vv ~~/stor/foo 2>&1 | bunyan 89 | 90 | BUGS 91 | ---- 92 | 93 | DSA keys do not work when loaded via the SSH agent. 94 | 95 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 96 | -------------------------------------------------------------------------------- /docs/man/msign.md: -------------------------------------------------------------------------------- 1 | msign 1 "December 2018" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | msign - create a signed URL to a Manta object 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `msign` [OPTION...] OBJECT... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | msign takes a list of objects (or directories), and using the credentials from 18 | the environment (whether environment variables or command line switches) creates 19 | time-expiring URLs that can be shared with others. This is useful to generate 20 | HTML links, for example. 21 | 22 | The default expiration for URLs is 1 hour from `now`, but this can be changed 23 | with the `expires` option. The expires option is designed to be used in 24 | conjunction with the UNIX date command. In general, you should use the date 25 | command with a modifier (the syntax is different between BSD and GNU forms), and 26 | format the output to epoch time. 27 | 28 | EXAMPLES 29 | -------- 30 | 31 | Assuming the GNU date command, generate a signed URL that expires in one month: 32 | 33 | $ msign -e $(date -d "1 month" "+%s") ~~/stor/tmp 34 | 35 | On OS X, you would sign this way: 36 | 37 | $ msign -e $(date -v+1m "+%s") ~~/stor/tmp 38 | 39 | You can also use `-E` for a friendly relative date format: 40 | 41 | $ msign -E 5s ~~/foo # expires in 5 seconds 42 | $ msign -E 5m ~~/foo # expires in 5 minutes 43 | $ msign -E 5h ~~/foo # expires in 5 hours 44 | $ msign -E 5d ~~/foo # expires in 5 days 45 | $ msign -E 5w ~~/foo # expires in 5 weeks 46 | $ msign -E 5y ~~/foo # expires in 5 years 47 | 48 | OPTIONS 49 | ------- 50 | 51 | `-a, --account login` 52 | Authenticate as account (login name). 53 | 54 | `-e, --expires expiration` 55 | Signed URL should last until EXPIRATION (seconds since epoch). Default is 1 56 | hour from `now`. 57 | 58 | `-E, --expires-relative expiration` 59 | Signed URL should last until EXPIRATION (relative time spec). Default is 1 60 | hour from `now`. Time specification format: 61 | 62 | [n]s - seconds from now 63 | [n]m - minutes from now 64 | [n]h - hours from now 65 | [n]d - days from now 66 | [n]w - weeks from now 67 | [n]y - years from now 68 | 69 | `-h, --help` 70 | Print a help message and exit. 71 | 72 | `-i, --insecure` 73 | This option explicitly allows "insecure" SSL connections and transfers. All 74 | SSL connections are attempted to be made secure by using the CA certificate 75 | bundle installed by default. 76 | 77 | `-k, --key fingerprint` 78 | Authenticate using the SSH key described by FINGERPRINT. The key must 79 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 80 | 81 | `-m, --method http_method` 82 | Allow URL to work for the HTTP method specified (default is GET). 83 | 84 | `--role=ROLE,ROLE,...` 85 | Specify which roles to assume for the request. 86 | 87 | `--role-tag=ROLE,ROLE,...` 88 | Set the role tags on objects created with the signed URL. 89 | 90 | `--user user` 91 | Authenticate as user under account. 92 | 93 | `-u, --url url` 94 | Manta base URL (such as `https://us-central.manta.mnx.io`). 95 | 96 | `-v, --verbose` 97 | Print debug output to stderr. Repeat option to increase verbosity. 98 | 99 | ENVIRONMENT 100 | ----------- 101 | 102 | `MANTA_USER` 103 | In place of `-a, --account`. 104 | 105 | `MANTA_SUBUSER` 106 | In place of `--user`. 107 | 108 | `MANTA_KEY_ID` 109 | In place of `-k, --key`. 110 | 111 | `MANTA_ROLE` 112 | In place of `--role`. 113 | 114 | `MANTA_URL` 115 | In place of `-u, --url`. 116 | 117 | `MANTA_TLS_INSECURE` 118 | In place of `-i, --insecure`. 119 | 120 | The shortcut `~~` is equivalent to `/:login` 121 | where `:login` is the account login name. 122 | 123 | DIAGNOSTICS 124 | ----------- 125 | 126 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 127 | output format. As an example of tracing all information about a request, 128 | try: 129 | 130 | $ msign -vv ~~/stor/foo 2>&1 | bunyan 131 | 132 | BUGS 133 | ---- 134 | 135 | DSA keys do not work when loaded via the SSH agent. 136 | 137 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 138 | -------------------------------------------------------------------------------- /docs/man/msync.md: -------------------------------------------------------------------------------- 1 | msync 1 "May 2023" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | msync - synchronize a directory hierarchy with Manta. 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `msync` LOCAL\_PATH MANTA\_PATH 13 | 14 | `msync` -r MANTA\_PATH LOCAL\_PATH 15 | 16 | DESCRIPTION 17 | ----------- 18 | 19 | The msync utility synchronizes the contents of a directory between a local 20 | filesystem and manta. By default a local directory will be uploaded to Manta. 21 | Using the `-r` flag will reverse the operation, downloading an entire Manta 22 | directory. 23 | 24 | Like rsync, msync will skip files already on the destination by checking the 25 | size (or alternatively the md5 sum). 26 | 27 | EXAMPLES 28 | -------- 29 | 30 | $ msync ./shakespeare/ ~~/stor/plays/shakespeare 31 | building source file list... 32 | source file list built, 1222 files found 33 | /fbulsara/stor/plays/shakespeare/index.html... not found, adding to sync list (1/1222) 34 | /fbulsara/stor/plays/shakespeare/test.html... not found, adding to sync list (2/1222) 35 | /fbulsara/stor/plays/shakespeare/favicon.ico... not found, adding to sync list (3/1222) 36 | /fbulsara/stor/plays/shakespeare/news.html... not found, adding to sync list (4/1222) 37 | . . . 38 | /fbulsara/stor/plays/shakespeare/History/2kinghenryvi/2henryvi.2.3.html... synced (1221/1222) 39 | /fbulsara/stor/plays/shakespeare/History/2kinghenryvi/2henryvi.4.8.html... synced (1222/1222) 40 | 41 | 1222 files (24.07 MB) synced successfully, 0 files failed to sync (took 33s 758ms) 42 | done 43 | 44 | OPTIONS 45 | ------- 46 | 47 | `-a, --account=login` 48 | Authenticate as account (login name). 49 | 50 | `-c, --copies=copies` 51 | Number of copies to make. 52 | 53 | `-f, --file=tarfile` 54 | The tar file to extract from. 55 | 56 | `-H, --header=header` 57 | HTTP headers to include. 58 | 59 | `-h, --help` 60 | Print a help message and exit. 61 | 62 | `-i, --insecure` 63 | This option explicitly allows "insecure" SSL connections and transfers. All 64 | SSL connections are attempted to be made secure by using the CA certificate 65 | bundle installed by default. 66 | 67 | `-k fingerprint, --key=fingerprint` 68 | Authenticate using the SSH key described by FINGERPRINT. The key must 69 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 70 | 71 | `-p NUM, --parallel=NUM` 72 | Limit concurrent operations to NUM. Default is 20. 73 | 74 | `-t, --type type` 75 | Specify `d` for directories, and `o` for objects. If specified, only names of 76 | that type will be returned. 77 | 78 | `--role=ROLE,ROLE,...` 79 | Specify which roles to assume for the request. 80 | 81 | `--role-tag=ROLE,ROLE,...` 82 | Set the role tags on created objects and directories. 83 | 84 | `--user user` 85 | Authenticate as user under account. 86 | 87 | `-u, --url url` 88 | Manta base URL (such as `https://us-central.manta.mnx.io`). 89 | 90 | `-v, --verbose` 91 | Print debug output to stderr. Repeat option to increase verbosity. 92 | 93 | `-j, --just-delete` 94 | don't send local files, just delete extra remote files. 95 | 96 | `-l, --ignore-links` 97 | ignore symlinks. Note: By default symlinks are followed. The linked file will 98 | be uploaded as an object to Manta. 99 | 100 | `-m, --md5` 101 | use md5 instead of file size (slower, but more accurate). 102 | 103 | `-n, --dry-run` 104 | don't perform any remote PUT or DELETE operations. 105 | 106 | `-p CONCURRENCY, --parallel=CONCURRENCY` 107 | limit concurrent operations. 108 | 109 | `-q, --quiet` 110 | suppress all output. 111 | 112 | `-r, --reverse` 113 | manta to local sync. 114 | 115 | ENVIRONMENT 116 | ----------- 117 | 118 | `MANTA_USER` 119 | In place of `-a, --account`. 120 | 121 | `MANTA_SUBUSER` 122 | In place of `--user`. 123 | 124 | `MANTA_KEY_ID` 125 | In place of `-k, --key`. 126 | 127 | `MANTA_ROLE` 128 | In place of `--role`. 129 | 130 | `MANTA_URL` 131 | In place of `-u, --url`. 132 | 133 | `MANTA_TLS_INSECURE` 134 | In place of `-i, --insecure`. 135 | 136 | The shortcut `~~` is equivalent to `/:login` 137 | where `:login` is the account login name. 138 | 139 | DIAGNOSTICS 140 | ----------- 141 | 142 | Unlike other commands, -v does not output bunyan logs. Instead, it will list 143 | each file status rather than only files that are out of sync. 144 | 145 | NOTES 146 | ----- 147 | 148 | BUGS 149 | ---- 150 | 151 | DSA keys do not work when loaded via the SSH agent. 152 | 153 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 154 | -------------------------------------------------------------------------------- /docs/man/muntar.md: -------------------------------------------------------------------------------- 1 | muntar 1 "May 2023" Manta "Manta Commands" 2 | ======================================= 3 | 4 | NAME 5 | ---- 6 | 7 | muntar - deprecated; create a directory hierarchy from a tar file 8 | 9 | SYNOPSIS 10 | -------- 11 | 12 | `muntar` -f tarfile [OPTION...] PATH... 13 | 14 | DESCRIPTION 15 | ----------- 16 | 17 | muntar is deprecated and will be removed in a future release. 18 | 19 | The muntar utility extracts the contents of a tar file and creates 20 | the corresponding objects in the path specified. If the destination 21 | directories do not exist, they are created. 22 | 23 | 24 | EXAMPLES 25 | -------- 26 | 27 | $ muntar -f shakespeare.tar ~~/stor/plays/shakespeare 28 | ~~/stor/plays/shakespeare/README 29 | ~~/stor/plays/shakespeare/comedies/cymbeline 30 | ~~/stor/plays/shakespeare/glossary 31 | . . . 32 | ~~/stor/plays/shakespeare/comedies/merrywivesofwindsor 33 | ~~/stor/plays/shakespeare/poetry/rapeoflucrece 34 | ~~/stor/plays/shakespeare/poetry/various 35 | ~~/stor/plays/shakespeare/poetry/sonnets 36 | 37 | If the tarball is compressed, you can store it as an object and use muntar 38 | in the compute environment. 39 | 40 | $ mput -f /var/tmp/backup.tar.gz ~~/stor/backup.tar.gz 41 | $ echo ~~/stor/backup.tar.gz | \ 42 | mjob create -o -m gzcat -m 'muntar -f $MANTA_INPUT_FILE ~~/stor' 43 | 44 | 45 | 46 | OPTIONS 47 | ------- 48 | 49 | `-a, --account=login` 50 | Authenticate as account (login name). 51 | 52 | `-c, --copies=copies` 53 | Number of copies to make. 54 | 55 | `-f, --file=tarfile` 56 | The tar file to extract from. 57 | 58 | `-H, --header=header` 59 | HTTP headers to include. 60 | 61 | `-h, --help` 62 | Print a help message and exit. 63 | 64 | 65 | `-i, --insecure` 66 | This option explicitly allows "insecure" SSL connections and transfers. All 67 | SSL connections are attempted to be made secure by using the CA certificate 68 | bundle installed by default. 69 | 70 | `-k fingerprint, --key=fingerprint` 71 | Authenticate using the SSH key described by FINGERPRINT. The key must 72 | either be in `~/.ssh` or loaded in the SSH agent via `ssh-add`. 73 | 74 | `-p NUM, --parallel=NUM` 75 | Limit concurrent operations to NUM. Default is 20. 76 | 77 | `-t, --type type` 78 | Specify `d` for directories, and `o` for objects. If specified, only names of 79 | that type will be returned. 80 | 81 | `--role=ROLE,ROLE,...` 82 | Specify which roles to assume for the request. 83 | 84 | `--role-tag=ROLE,ROLE,...` 85 | Set the role tags on created objects and directories. 86 | 87 | `--user user` 88 | Authenticate as user under account. 89 | 90 | `-u, --url url` 91 | Manta base URL (such as `https://us-central.manta.mnx.io`). 92 | 93 | `-v, --verbose` 94 | Print debug output to stderr. Repeat option to increase verbosity. 95 | 96 | 97 | ENVIRONMENT 98 | ----------- 99 | `MANTA_USER` 100 | In place of `-a, --account`. 101 | 102 | `MANTA_SUBUSER` 103 | In place of `--user`. 104 | 105 | `MANTA_KEY_ID` 106 | In place of `-k, --key`. 107 | 108 | `MANTA_ROLE` 109 | In place of `--role`. 110 | 111 | `MANTA_URL` 112 | In place of `-u, --url`. 113 | 114 | `MANTA_TLS_INSECURE` 115 | In place of `-i, --insecure`. 116 | 117 | The shortcut `~~` is equivalent to `/:login` 118 | where `:login` is the account login name. 119 | 120 | DIAGNOSTICS 121 | ----------- 122 | 123 | When using the `-v` option, diagnostics will be sent to stderr in bunyan 124 | output format. As an example of tracing all information about a request, 125 | try: 126 | 127 | $ mfind -vv ~~/stor 2>&1 | bunyan 128 | 129 | NOTES 130 | ----- 131 | 132 | 133 | BUGS 134 | ---- 135 | 136 | DSA keys do not work when loaded via the SSH agent. 137 | 138 | Report bugs at [Github](https://github.com/TritonDataCenter/node-manta/issues) 139 | -------------------------------------------------------------------------------- /docs/media/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonDataCenter/node-manta/14d4442250f1bff9aebdb2887c344e762a7445d6/docs/media/img/favicon.ico -------------------------------------------------------------------------------- /docs/media/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonDataCenter/node-manta/14d4442250f1bff9aebdb2887c344e762a7445d6/docs/media/img/logo.png -------------------------------------------------------------------------------- /examples/client-trace-logging.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /** 3 | * Example node script showing how to get trace-level logging of the 4 | * *client-side* of talking to Manta. 5 | * 6 | * Usage: 7 | * git clone https://github.com/TritonDataCenter/node-manta.git 8 | * cd node-manta 9 | * npm install 10 | * node examples/client-trace-logging.js | bunyan 11 | */ 12 | 13 | var bunyan = require('bunyan'); 14 | var manta = require('../'); 15 | 16 | 17 | var log = bunyan.createLogger({ 18 | name: 'client-trace-logging', 19 | level: 'trace', // <---- set log level here 20 | serializers: bunyan.stdSerializers 21 | }); 22 | 23 | 24 | 25 | var client = manta.createBinClient({log: log}); 26 | 27 | client.ls('~~/stor', function (err, results) { 28 | if (err) { 29 | log.error(err, 'ls failed'); 30 | process.exit(1); 31 | } 32 | 33 | results.on('error', function (err) { 34 | log.error(err, 'ls results error'); 35 | }); 36 | results.on('entry', function (dirent) { 37 | log.info({dirent: dirent}, 'entry'); 38 | }); 39 | results.on('end', function () { 40 | log.info('end'); 41 | process.exit(0); 42 | }); 43 | }); 44 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, Joyent, Inc. All rights reserved. 2 | // Copyright 2023 MNX Cloud, Inc. 3 | 4 | // Workaround a bug in node v10-16 when using OpenSSL 3 without ssh-agent. 5 | // This needs to be set before the crypto module is loaded. 6 | if (typeof (process.env.OPENSSL_CONF) === 'undefined') { 7 | process.env['OPENSSL_CONF'] = ''; 8 | } 9 | 10 | var auth = require('smartdc-auth'); 11 | var cc = require('./create_client'); 12 | var manta = require('./client'); 13 | var options = require('./options'); 14 | var progbar = require('progbar'); 15 | var Queue = require('./queue'); 16 | var StringStream = require('./string_stream'); 17 | var utils = require('./utils'); 18 | 19 | 20 | 21 | ///--- Exports 22 | 23 | module.exports = { 24 | MantaClient: manta.MantaClient, 25 | Queue: Queue, 26 | ProgressBar: progbar.ProgressBar, 27 | createClient: cc.createClient, 28 | createClientFromFileSync: cc.createClientFromFileSync, 29 | checkBinEnv: cc.checkBinEnv, 30 | cloneOptions: cc.cloneOptions, 31 | createBinClient: cc.createBinClient, 32 | cliSigner: auth.cliSigner, 33 | privateKeySigner: auth.privateKeySigner, 34 | sshAgentSigner: auth.sshAgentSigner, 35 | signUrl: function (opts, cb) { 36 | opts.mantaSubUser = true; 37 | return (auth.signUrl(opts, cb)); 38 | }, 39 | loadSSHKey: auth.loadSSHKey, 40 | assertPath: utils.assertPath, 41 | DEFAULT_CLI_OPTIONS: cc.DEFAULT_OPTIONS, 42 | cli_usage: cc.usage, 43 | cli_logger: cc.setupLogger, 44 | cliVersionCheckPrintAndExit: cc.versionCheckPrintAndExit, 45 | cliCompletionCheckPrintAndExit: cc.completionCheckPrintAndExit, 46 | StringStream: StringStream, 47 | path: manta.path, 48 | jobPath: manta.jobPath, 49 | escapePath: utils.escapePath, 50 | parseOptions: options.parseOptions, 51 | promptConfirm: utils.promptConfirm, 52 | prettyBytes: utils.prettyBytes 53 | }; 54 | -------------------------------------------------------------------------------- /lib/msync/file.js: -------------------------------------------------------------------------------- 1 | /** 2 | * generic file wrapper (abstract class) 3 | * 4 | * this class describes a "File" object, and should be subclassed 5 | * to define specific types of files, like "MantaFile", "LocalFile", etc. 6 | * 7 | * Author: Dave Eddy 8 | * Date: January 24, 2015 9 | * License: MIT 10 | */ 11 | 12 | module.exports = File; 13 | 14 | function File() { 15 | } 16 | 17 | // get file info and return it as cb(e, info) 18 | File.prototype.info = function info(cb) { 19 | throw new Error('not implemented'); 20 | }; 21 | 22 | // create a read stream and return it 23 | File.prototype.createReadStream = function createReadStream() { 24 | throw new Error('not implemented'); 25 | }; 26 | 27 | // put a file 28 | File.prototype.put = function put() { 29 | throw new Error('not implemented'); 30 | }; 31 | 32 | // delete a file 33 | File.prototype.remove = function remove() { 34 | throw new Error('not implemented'); 35 | }; 36 | 37 | // ftw 38 | File.prototype.ftw = function ftw() { 39 | throw new Error('not implemented'); 40 | }; 41 | 42 | // toString 43 | File.prototype.toString = function toString() { 44 | return ('<' + this.constructor.name + ': ' + this.path + '>'); 45 | }; 46 | -------------------------------------------------------------------------------- /lib/msync/finder.js: -------------------------------------------------------------------------------- 1 | /** 2 | * basic recursive file walker 3 | * 4 | * like the node module `findit`, but doesn't 5 | * give special treatment to symlinks unless specified 6 | */ 7 | var EventEmitter = require('events').EventEmitter; 8 | var fs = require('fs'); 9 | var path = require('path'); 10 | var util = require('util'); 11 | 12 | module.exports = Finder; 13 | 14 | util.inherits(Finder, EventEmitter); 15 | function Finder(basedir, opts) { 16 | var self = this; 17 | opts = opts || {}; 18 | EventEmitter.call(self); 19 | 20 | var statFunc = opts.ignoreSymlinks ? fs.lstat : fs.stat; 21 | 22 | var pending = 0; 23 | walk('.'); 24 | function walk(dir) { 25 | pending++; 26 | var absolutedir = path.join(basedir, dir); 27 | fs.readdir(absolutedir, function (err, rdir) { 28 | var ignored = []; 29 | pending--; 30 | if (err || !rdir.length) 31 | return (check()); 32 | rdir.forEach(function (f) { 33 | pending++; 34 | var relativepath = path.join(dir, f); 35 | var fullpath = path.join(basedir, relativepath); 36 | statFunc(fullpath, function (_err, stat) { 37 | pending--; 38 | if (opts.ignoreSymlinks && stat && stat.isSymbolicLink()) { 39 | ignored.push(stat); 40 | } else if (stat && stat.isDirectory()) { 41 | self.emit('directory', fullpath, stat); 42 | walk(relativepath); 43 | } else if (stat && stat.isFile()) { 44 | self.emit('file', fullpath, stat); 45 | } 46 | check(); 47 | }); 48 | }); 49 | return (0); 50 | }); 51 | } 52 | function check() { 53 | if (pending === 0) 54 | self.emit('end'); 55 | } 56 | } 57 | 58 | if (require.main === module) { 59 | var finder = new Finder(process.argv[2] || __dirname); 60 | finder.on('file', function (file, stats) { 61 | console.log('%s = %d bytes', file, stats.size); 62 | }); 63 | 64 | finder.on('directory', function (directory, stats) { 65 | console.log('%s%s', directory, path.sep); 66 | }); 67 | 68 | finder.on('end', function () { 69 | console.log('done'); 70 | }); 71 | } 72 | -------------------------------------------------------------------------------- /lib/msync/glob.js: -------------------------------------------------------------------------------- 1 | /** 2 | * extremely basic and limited globbing functionality 3 | * 4 | * Author: Dave Eddy 5 | * Date: 4/21/14 6 | * License: MIT 7 | */ 8 | 9 | var path = require('path'); 10 | 11 | module.exports = Glob; 12 | 13 | function Glob(s) { 14 | this.s = s; 15 | 16 | var _s = cleanGlob(s).split('*'); 17 | this.startsWith = _s[0] || ''; 18 | this.endsWith = _s[1] || ''; 19 | } 20 | 21 | Glob.prototype.test = function test(s) { 22 | s = cleanGlob(s); 23 | return (startsWith(s, this.startsWith) && endsWith(s, this.endsWith)); 24 | }; 25 | 26 | Glob.prototype.toString = function toString() { 27 | return (this.s); 28 | }; 29 | 30 | function cleanGlob(s) { 31 | if (s.indexOf('.' + path.sep) === 0) 32 | s = s.substr(2); 33 | while (s.charAt(0) === path.sep) 34 | s = s.substr(1); 35 | return (s); 36 | } 37 | 38 | function startsWith(s, t) { 39 | return (s.indexOf(t) === 0); 40 | } 41 | 42 | function endsWith(s, t) { 43 | var slen = s.length; 44 | var tlen = t.length; 45 | if (tlen > slen) 46 | return (false); 47 | return (s.substr(slen - tlen).indexOf(t) === 0); 48 | } 49 | 50 | if (require.main === module) { 51 | var assert = require('assert'); 52 | var c; 53 | 54 | console.log('running tests'); 55 | 56 | // should match any and all txt files 57 | c = new Glob('*.txt'); 58 | assert(c.test('/foo/bar/baz.txt')); 59 | assert(!c.test('/foo/bar/baz.png')); 60 | assert(!c.test('/foo/bar')); 61 | assert(c.test('.txt')); // this matches 62 | 63 | c = new Glob('./.git'); 64 | // these 3 should all be effectively the same 65 | assert(c.test('./.git')); 66 | assert(c.test('/.git')); 67 | assert(c.test('.git')); 68 | 69 | assert(c.test('.git/foo')); 70 | assert(c.test('.git/bar')); 71 | 72 | c = new Glob('./.git'); 73 | assert(c.test('.gitignore')); // matches 74 | 75 | c = new Glob('./.git/'); 76 | assert(!c.test('.gitignore')); // no match 77 | 78 | c = new Glob('foobar/*/baz.txt'); 79 | assert(c.test('./foobar/1/2/3/baz.txt')); 80 | assert(c.test('./foobar/1/2/3/4/baz.txt')); 81 | 82 | assert(!c.test('./bat/1/2/3/4/baz.txt')); 83 | assert(!c.test('./foobar/1/2/3/4/foo.txt')); 84 | } 85 | -------------------------------------------------------------------------------- /lib/msync/localfile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * local file object 3 | * 4 | * Author: Dave Eddy 5 | * Date: January 24, 2015 6 | * License: MIT 7 | */ 8 | 9 | var crypto = require('crypto'); 10 | var EventEmitter = require('events').EventEmitter; 11 | var fs = require('fs'); 12 | var path = require('path'); 13 | var util = require('util'); 14 | 15 | var mkdirp = require('mkdirp'); 16 | var once = require('once'); 17 | 18 | var File = require('./file'); 19 | var Finder = require('./finder'); 20 | 21 | module.exports = LocalFile; 22 | 23 | util.inherits(LocalFile, File); 24 | function LocalFile(_path, _stat) { 25 | File.call(this); 26 | this.path = _path; 27 | this.stat = _stat; 28 | } 29 | 30 | // get local file info by doing a stat(2), and optionally 31 | // getting the md5, stat(2) object will also be cached 32 | LocalFile.prototype.info = function info(opts, cb) { 33 | var self = this; 34 | if (typeof (opts) === 'function') { 35 | cb = opts; 36 | opts = null; 37 | } 38 | opts = opts || {}; 39 | 40 | // use cached stat data if available 41 | if (this.stat) 42 | statcb(null, this.stat); 43 | else 44 | fs.stat(this.path, statcb); 45 | 46 | // called when stat(2) data is available 47 | function statcb(err, stats) { 48 | if (err) 49 | return (cb(err)); 50 | 51 | self.stat = stats; 52 | 53 | if (!self.stat.md5 && opts.md5) { 54 | // get the md5sum 55 | var md5sum = crypto.createHash('md5'); 56 | var rs = self.createReadStream(); 57 | rs.on('error', function (_err) { 58 | return (cb(_err)); 59 | }); 60 | rs.on('data', md5sum.update.bind(md5sum)); 61 | rs.on('end', function () { 62 | self.stat.md5 = md5sum.digest('hex'); 63 | cb(null, self.stat); 64 | }); 65 | } else { 66 | cb(null, self.stat); 67 | } 68 | return (0); 69 | } 70 | }; 71 | 72 | // remove the local file 73 | LocalFile.prototype.remove = function remove(cb) { 74 | return (fs.unlink(this.path, cb)); 75 | }; 76 | 77 | // create a read stream 78 | LocalFile.prototype.createReadStream = function createReadStream() { 79 | return (fs.createReadStream(this.path)); 80 | }; 81 | 82 | // put a file 83 | LocalFile.prototype.put = function put(rs, opts, cb) { 84 | var self = this; 85 | if (typeof (opts) === 'function') { 86 | cb = opts; 87 | opts = null; 88 | } 89 | opts = opts || {}; 90 | cb = once(cb); 91 | 92 | if (opts.mkdirs) 93 | mkdirp(path.dirname(this.path), write); 94 | else 95 | write(); 96 | 97 | function write() { 98 | var ws = fs.createWriteStream(self.path); 99 | ws.on('error', cb); 100 | rs.on('error', cb); 101 | ws.on('finish', function () { 102 | cb(); 103 | }); 104 | rs.pipe(ws); 105 | } 106 | }; 107 | 108 | // list local files 109 | LocalFile.prototype.ftw = function ftw(opts, cb) { 110 | var self = this; 111 | if (typeof (opts) === 'function') { 112 | cb = opts; 113 | opts = null; 114 | } 115 | opts = opts || {}; 116 | 117 | var ee = new EventEmitter(); 118 | cb(null, ee); 119 | 120 | process.nextTick(function () { 121 | var f = new Finder(self.path, opts); 122 | f.on('file', function (fullpath, stat) { 123 | ee.emit('file', fullpath); 124 | }); 125 | f.on('end', function () { 126 | ee.emit('end'); 127 | }); 128 | }); 129 | }; 130 | -------------------------------------------------------------------------------- /lib/msync/mantafile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * manta file object 3 | * 4 | * Author: Dave Eddy 5 | * Date: January 24, 2015 6 | * License: MIT 7 | */ 8 | 9 | var EventEmitter = require('events').EventEmitter; 10 | var util = require('util'); 11 | 12 | var File = require('./file'); 13 | var path = require('path-platform'); 14 | 15 | module.exports = MantaFile; 16 | 17 | util.inherits(MantaFile, File); 18 | function MantaFile(_path, _client) { 19 | File.call(this); 20 | this.path = _path; 21 | this.client = _client; 22 | } 23 | 24 | // get manta info 25 | MantaFile.prototype.info = function info(opts, cb) { 26 | var self = this; 27 | if (typeof (opts) === 'function') { 28 | cb = opts; 29 | opts = null; 30 | } 31 | opts = opts || {}; 32 | 33 | // return cached version if available 34 | if (this._cached_info) { 35 | cb(null, this._cached_info); 36 | return; 37 | } 38 | 39 | // get the info and cache it 40 | this.client.info(this.path, function (err, _info) { 41 | if (err) 42 | return (cb(err)); 43 | 44 | _info.md5 = new Buffer.from(_info.md5, 'base64').toString('hex'); 45 | self._cached_info = _info; 46 | 47 | return (cb(null, _info)); 48 | }); 49 | }; 50 | 51 | // remove the remote filex 52 | MantaFile.prototype.remove = function remove(cb) { 53 | return (this.client.unlink(this.path, cb)); 54 | }; 55 | 56 | // create a read stream 57 | MantaFile.prototype.createReadStream = function createReadStream() { 58 | return (this.client.createReadStream(this.path)); 59 | }; 60 | 61 | // put a file 62 | MantaFile.prototype.put = function put(rs, opts, cb) { 63 | return (this.client.put(this.path, rs, opts, cb)); 64 | }; 65 | 66 | // list manta files 67 | MantaFile.prototype.ftw = function ftw(opts, cb) { 68 | var self = this; 69 | if (typeof (opts) === 'function') { 70 | cb = opts; 71 | opts = null; 72 | } 73 | opts = opts || {}; 74 | 75 | var ee = new EventEmitter(); 76 | self.client.ftw(self.path, opts, function (err, res) { 77 | if (err) 78 | return (cb(err)); 79 | 80 | cb(null, ee); 81 | 82 | process.nextTick(function () { 83 | res.on('entry', function (d) { 84 | if (d.type !== 'object') 85 | return; 86 | ee.emit('file', path.posix.join(d.parent, d.name)); 87 | }); 88 | res.on('end', function () { 89 | ee.emit('end'); 90 | }); 91 | }); 92 | return (0); 93 | }); 94 | }; 95 | -------------------------------------------------------------------------------- /lib/options.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | */ 4 | 5 | var assert = require('assert-plus'); 6 | var strsplit = require('strsplit'); 7 | 8 | var cc = require('./create_client'); 9 | var client = require('./client'); 10 | var utils = require('./utils'); 11 | 12 | module.exports = { 13 | parseOptions: parseOptions 14 | }; 15 | 16 | 17 | /** 18 | * Parse the common command options and then check any command-specific options 19 | * represented by the caller as a function from opts Object to options Object 20 | * 21 | * 22 | * @param {Object} args: Required. Object to specify parsing arguments with 23 | * the following fields: 24 | * - `name`: String. The command name. 25 | * - `parser`: Object. A dashdash options parser. 26 | * - `argTypes`: Array of String. An array of types for positional 27 | * arguments to this command. See 'argtypes' docs here: 28 | * // JSSTYLED 29 | * 30 | * - `parseCmdOptions`: Function. A function takes a parsed options 31 | * object and a parser instance as input and 32 | * performs command-specific options options 33 | * parsing. The options object is returned and 34 | * may be mutated by the function. 35 | * - `log`: Object. Bunyan Logger instance 36 | * @returns {Object} Parsed `opts`. It has special keys `_args` (the 37 | * remaining args from `argv`) and `_order` (gives the 38 | * order that options were specified). 39 | */ 40 | function parseOptions(args) { 41 | assert.object(args, 'args'); 42 | assert.string(args.name, 'args.name'); 43 | assert.object(args.parser, 'args.parser'); 44 | assert.optionalArrayOfString(args.argTypes, 'args.argTypes'); 45 | assert.optionalFunc(args.parseCmdOptions, 'args.parseCmdOptions'); 46 | assert.object(args.log, 'args.log'); 47 | assert.optionalString(args.extra, 'args.extra'); 48 | 49 | const defaultExtra = 'path...'; 50 | var extra = args.extra || defaultExtra; 51 | 52 | var parser = args.parser; 53 | var opts; 54 | 55 | try { 56 | opts = parser.parse(process.argv); 57 | } catch (e) { 58 | cc.usage(parser, e.message, extra); 59 | } 60 | 61 | cc.setupLogger(opts, args.log); 62 | 63 | if (opts.help) 64 | cc.usage(parser, false, extra); 65 | 66 | cc.versionCheckPrintAndExit(opts); 67 | cc.completionCheckPrintAndExit(opts, parser, args.name, args.argTypes); 68 | 69 | opts.headers = {}; 70 | (opts.header || []).forEach(function (h) { 71 | if (h.indexOf(':') === -1) { 72 | const errMsg = 'header must be in the form of "[header]: value"'; 73 | cc.usage(parser, errMsg, extra); 74 | } 75 | var tokens = strsplit(h, ':', 2); 76 | opts.headers[tokens[0]] = tokens[1].trim(); 77 | }); 78 | 79 | const getPath = function (acc, p) { 80 | if (client.isPath(p, true)) { 81 | acc.push(client.path(p, true)); 82 | } 83 | return (acc); 84 | }; 85 | opts.paths = opts._args.reduce(getPath, []); 86 | 87 | if (opts.paths.length < 1) { 88 | cc.usage(parser, 'path required', extra); 89 | } 90 | 91 | if (args.parseCmdOptions) { 92 | args.parseCmdOptions(opts, parser); 93 | } 94 | 95 | try { 96 | cc.checkBinEnv(opts); 97 | } catch (e) { 98 | cc.usage(parser, e.message, extra); 99 | } 100 | 101 | return (opts); 102 | } 103 | -------------------------------------------------------------------------------- /lib/queue.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Joyent, Inc. All rights reserved. 2 | 3 | var EventEmitter = require('events').EventEmitter; 4 | var util = require('util'); 5 | 6 | var assert = require('assert-plus'); 7 | var once = require('once'); 8 | 9 | 10 | 11 | ///-- Globals 12 | 13 | var sprintf = util.format; 14 | 15 | 16 | 17 | ///--- Internals 18 | 19 | function dispatch(w, t) { 20 | assert.func(w, 'worker'); 21 | 22 | var q = this.queue; 23 | var self = this; 24 | 25 | var cb = once(function _cb(err) { 26 | self.dispatched--; 27 | if (err) { 28 | process.nextTick(function emitError() { 29 | self._end(err); 30 | }); 31 | return; 32 | } 33 | 34 | if (q.length > 0) { 35 | if (self.dispatched < self.limit) { 36 | var _t = q.pop(); 37 | self.dispatched++; 38 | process.nextTick(dispatch.bind(self, w, _t)); 39 | } 40 | return; 41 | } 42 | 43 | if (self.dispatched === 0) { 44 | if (self.closed && !self.errored) { 45 | process.nextTick(function _done() { 46 | self._end(); 47 | }); 48 | } else { 49 | process.nextTick(function _drain() { 50 | self.emit('drain'); 51 | }); 52 | } 53 | } 54 | }); 55 | 56 | w(t, cb); 57 | } 58 | 59 | 60 | 61 | ///--API 62 | 63 | function Queue(opts) { 64 | assert.object(opts, 'options'); 65 | assert.finite(opts.limit, 'options.limit'); 66 | assert.func(opts.worker, 'options.worker'); 67 | 68 | var self = this; 69 | 70 | EventEmitter.call(this); 71 | 72 | this.closed = false; 73 | this.dispatched = 0; 74 | this.limit = opts.limit; 75 | this.queue = []; 76 | this.worker = opts.worker; 77 | 78 | this._end = once(function end(err) { 79 | self.closed = true; 80 | if (err) { 81 | self.emit('error', err); 82 | } else { 83 | self.emit('end'); 84 | } 85 | }); 86 | } 87 | util.inherits(Queue, EventEmitter); 88 | module.exports = Queue; 89 | 90 | 91 | Queue.prototype.close = function close() { 92 | var self = this; 93 | 94 | function closeOnDrain() { 95 | self._end(); 96 | } 97 | if (this.dispatched === 0) { 98 | process.nextTick(function closeEnd() { 99 | self._end(); 100 | }); 101 | } else { 102 | var listeners = this.listeners('drain'); 103 | if (listeners.length === 0) { 104 | this.once('drain', closeOnDrain); 105 | } else if (listeners.some(function (l) { 106 | return (l.listener === closeOnDrain); 107 | })) { 108 | this.once('drain', closeOnDrain); 109 | } 110 | } 111 | }; 112 | 113 | 114 | Queue.prototype.push = function push(task) { 115 | var q = this.queue; 116 | var w = this.worker; 117 | 118 | if (q.closed) 119 | return (false); 120 | 121 | if (this.dispatched >= this.limit) { 122 | q.push(task); 123 | this.emit('task'); 124 | return (false); 125 | } 126 | 127 | this.dispatched++; 128 | process.nextTick(dispatch.bind(this, w, task)); 129 | 130 | return (true); 131 | }; 132 | 133 | 134 | Queue.prototype.toString = function toString() { 135 | var s = sprintf('[object Queue ]', 136 | this.queue.length, 137 | this.limit, 138 | this.dispatched); 139 | 140 | return (s); 141 | }; 142 | -------------------------------------------------------------------------------- /lib/streaming_json_stream.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Joyent, Inc. 3 | */ 4 | 5 | var mod_assert = require('assert-plus'); 6 | var mod_util = require('util'); 7 | var mod_stream = require('stream'); 8 | if (!mod_stream.Readable) { 9 | mod_stream = require('readable-stream'); 10 | } 11 | 12 | /* 13 | * Read newline-separated JSON and parse it. 14 | */ 15 | function StreamingJSONStream() { 16 | mod_stream.Transform.call(this, { 17 | objectMode: true, 18 | highWaterMark: 0 19 | }); 20 | 21 | this.sjs_accum = ''; 22 | } 23 | mod_util.inherits(StreamingJSONStream, mod_stream.Transform); 24 | 25 | StreamingJSONStream.prototype.process = function process(inFlush, done) { 26 | var self = this; 27 | var idx; 28 | 29 | var parse = function (s) { 30 | var o; 31 | 32 | if (!s) { 33 | /* 34 | * Skip empty lines. 35 | */ 36 | return (true); 37 | } 38 | 39 | try { 40 | o = JSON.parse(s); 41 | } catch (ex) { 42 | ex.data = s; 43 | done(ex); 44 | return (false); 45 | } 46 | 47 | mod_assert.notStrictEqual(o, null); 48 | self.push(o); 49 | return (true); 50 | }; 51 | 52 | /* 53 | * Process each line as a JSON record: 54 | */ 55 | while ((idx = self.sjs_accum.indexOf('\n')) !== -1) { 56 | var instr = self.sjs_accum.substr(0, idx).trim(); 57 | self.sjs_accum = self.sjs_accum.substr(idx + 1); 58 | 59 | if (!parse(instr)) { 60 | return; 61 | } 62 | } 63 | 64 | if (inFlush) { 65 | mod_assert.strictEqual(self.sjs_accum.indexOf('\n'), -1); 66 | if (!parse(self.sjs_accum)) { 67 | return; 68 | } 69 | 70 | /* 71 | * Signal the end of the stream: 72 | */ 73 | self.push(null); 74 | } 75 | 76 | done(); 77 | }; 78 | 79 | StreamingJSONStream.prototype._transform = function _transform(chunk, encoding, 80 | done) { 81 | 82 | var self = this; 83 | 84 | self.sjs_accum += chunk.toString(); 85 | self.process(false, done); 86 | }; 87 | 88 | StreamingJSONStream.prototype._flush = function _flush(done) { 89 | var self = this; 90 | 91 | self.process(true, done); 92 | }; 93 | 94 | module.exports = StreamingJSONStream; 95 | 96 | /* vim: set syntax=javascript ts=4 sts=4 sw=4 et: */ 97 | -------------------------------------------------------------------------------- /lib/string_stream.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Joyent, Inc. All rights reserved. 2 | // vim: set syntax=javascript ts=4 sts=4 sw=4 et: 3 | 4 | var util = require('util'); 5 | var stream = require('stream'); 6 | if (!stream.Readable) 7 | stream = require('readable-stream'); 8 | 9 | // The bare minimum Stream required to coerce put() into putting a string 10 | // into Manta. 11 | 12 | function StringStream(string, options) { 13 | this.instr = string; 14 | stream.Readable.call(this, options); 15 | } 16 | util.inherits(StringStream, stream.Readable); 17 | 18 | 19 | StringStream.prototype._read = function _read() { 20 | this.push(this.instr); 21 | this.instr = null; 22 | }; 23 | 24 | 25 | 26 | module.exports = StringStream; 27 | -------------------------------------------------------------------------------- /lib/utils.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, Joyent, Inc. All rights reserved. 2 | 3 | var assert = require('assert-plus'); 4 | var readline = require('readline'); 5 | 6 | var manta = require('./client'); 7 | 8 | module.exports = { 9 | assertPath: assertPath, 10 | escapePath: escapePath, 11 | promptConfirm: promptConfirm, 12 | prettyBytes: prettyBytes 13 | }; 14 | 15 | function escapePath(s) { 16 | assert.string(s, 'escapePath'); 17 | /*JSSTYLED*/ 18 | return (JSON.stringify(s).replace(/^"|"$/g, '').replace(/\\"/g, '"')); 19 | } 20 | 21 | function assertPath(p, noThrow) { 22 | try { 23 | manta.path(p, null); 24 | } catch (e) { 25 | if (noThrow) 26 | return (e); 27 | 28 | throw e; 29 | } 30 | return (null); 31 | } 32 | 33 | function promptConfirm(msg, cb) { 34 | assert.string(msg, 'msg'); 35 | assert.func(cb, 'cb'); 36 | assert(process.stdin.isTTY, 'stdin must be a TTY'); 37 | 38 | var rl = readline.createInterface({ 39 | input: process.stdin, 40 | output: process.stdout 41 | }); 42 | 43 | rl.question(msg, function (ans) { 44 | rl.close(); 45 | cb(ans === 'y' || ans === 'Y'); 46 | }); 47 | } 48 | 49 | function prettyBytes(bytes, scale) { 50 | scale = scale || 1024; 51 | 52 | assert.number(bytes); 53 | assert(bytes >= 0, 'bytes >= 0'); 54 | assert.number(scale, 'scale'); 55 | assert(scale >= 1, 'scale >= 1'); 56 | 57 | var suffixes = [ 58 | '', // empty for bytes 59 | 'K', 60 | 'M', 61 | 'G', 62 | 'T' 63 | ]; 64 | var suffix, num, s; 65 | 66 | for (var i = suffixes.length; i >= 0; i--) { 67 | suffix = suffixes[i]; 68 | num = Math.pow(1024, i); 69 | if (bytes >= num) { 70 | // convert bytes to human readable string 71 | s = (bytes / num).toFixed(2); 72 | 73 | /* 74 | * It can be the case that 's' has 0's that can be chopped off 75 | * like "5.10" or "2.00". To handle this, we parse the number as a 76 | * float and then call toString() on the result. 77 | */ 78 | s = parseFloat(s).toString(); 79 | return (s + suffix); 80 | } 81 | } 82 | 83 | assert.equal(bytes, 0, 'bytes == 0'); 84 | return ('0'); 85 | } 86 | -------------------------------------------------------------------------------- /man/man1/mchattr.1: -------------------------------------------------------------------------------- 1 | .TH mput 1 "May 2013" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mchattr \- change object attributes 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmchattr\fR [OPTION...] OBJECT 8 | .SH DESCRIPTION 9 | .PP 10 | mchattr changes attributes of an object. Running mchattr only changes metadata 11 | about the object (i.e., HTTP headers). Running mchattr completely replaces all 12 | modifiable HTTP headers, so you must specify the complete set upon running. 13 | .PP 14 | Note you are not permitted to update "core" headers, such as \fB\fCdurability\-level\fR, 15 | \fB\fCcontent\-length\fR, and \fB\fCcontent\-md5\fR\&. You can update \fB\fCcontent\-type\fR, \fB\fCm\-*\fR and 16 | CORS headers. 17 | .SH EXAMPLES 18 | .PP 19 | .RS 20 | .nf 21 | $ mchattr \-H m\-foo:bar ~~/stor/foo.txt 22 | .fi 23 | .RE 24 | .SH OPTIONS 25 | .TP 26 | \fB\fC\-a, \-\-account login\fR 27 | Authenticate as account (login name). 28 | .TP 29 | \fB\fC\-h, \-\-help\fR 30 | Print a help message and exit. 31 | .TP 32 | \fB\fC\-i, \-\-insecure\fR 33 | This option explicitly allows "insecure" SSL connections and transfers. All 34 | SSL connections are attempted to be made secure by using the CA certificate 35 | bundle installed by default. 36 | .TP 37 | \fB\fC\-H, \-\-header\fR 38 | Set the specified HTTP header. 39 | .TP 40 | \fB\fC\-k, \-\-key fingerprint\fR 41 | Authenticate using the SSH key described by FINGERPRINT. The key must 42 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 43 | .TP 44 | \fB\fC\-\-role=ROLE,ROLE,...\fR 45 | Specify which roles to assume for the request. 46 | .TP 47 | \fB\fC\-u, \-\-url url\fR 48 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 49 | .TP 50 | \fB\fC\-\-user user\fR 51 | Authenticate as user under account. 52 | .TP 53 | \fB\fC\-v, \-\-verbose\fR 54 | Print debug output to stderr. Repeat option to increase verbosity. 55 | .SH ENVIRONMENT 56 | .TP 57 | \fB\fCMANTA_USER\fR 58 | In place of \fB\fC\-a, \-\-account\fR\&. 59 | .TP 60 | \fB\fCMANTA_SUBUSER\fR 61 | In place of \fB\fC\-\-user\fR\&. 62 | .TP 63 | \fB\fCMANTA_KEY_ID\fR 64 | In place of \fB\fC\-k, \-\-key\fR\&. 65 | .TP 66 | \fB\fCMANTA_ROLE\fR 67 | In place of \fB\fC\-\-role\fR\&. 68 | .TP 69 | \fB\fCMANTA_URL\fR 70 | In place of \fB\fC\-u, \-\-url\fR\&. 71 | .TP 72 | \fB\fCMANTA_TLS_INSECURE\fR 73 | In place of \fB\fC\-i, \-\-insecure\fR\&. 74 | .PP 75 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 76 | where \fB\fC:login\fR is the account login name. 77 | .SH DIAGNOSTICS 78 | .PP 79 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 80 | output format. As an example of tracing all information about a request, 81 | try: 82 | .PP 83 | .RS 84 | .nf 85 | $ mchattr \-v ~~/stor/foo 2>&1 | bunyan 86 | .fi 87 | .RE 88 | .SH BUGS 89 | .PP 90 | DSA keys do not work when loaded via the SSH agent. 91 | .PP 92 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 93 | -------------------------------------------------------------------------------- /man/man1/mchmod.1: -------------------------------------------------------------------------------- 1 | .TH mchmod 1 "August 2014" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mchmod \- change object role tags 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmchmod\fR [OPTION...] \-\- [+\-=]ROLE,... OBJECT 8 | .SH DESCRIPTION 9 | .PP 10 | mchmod sets the role tags on an object or directory. Role tags are used to 11 | determine which of a user's roles will be checked to allow access. 12 | .PP 13 | Note that in order to use \fB\fCmchmod +ROLE\fR or \fB\fCmchmode \-ROLE\fR you will need access 14 | to read and write object metadata. Using \fB\fCmchmod =ROLE\fR only requires write 15 | access. 16 | .SH EXAMPLES 17 | .PP 18 | .RS 19 | .nf 20 | $ mchmod \-\- +read ~~/stor/foo.txt 21 | 22 | $ mchmod \-\- \-read,write ~~/stor/foo.txt 23 | 24 | $ mchmod \-a other_account \-\- =read ~~/stor/foot.txt 25 | .fi 26 | .RE 27 | .SH OPTIONS 28 | .TP 29 | \fB\fC\-a, \-\-account login\fR 30 | Authenticate as account (login name). 31 | .TP 32 | \fB\fC\-h, \-\-help\fR 33 | Print a help message and exit. 34 | .TP 35 | \fB\fC\-i, \-\-insecure\fR 36 | This option explicitly allows "insecure" SSL connections and transfers. All 37 | SSL connections are attempted to be made secure by using the CA certificate 38 | bundle installed by default. 39 | .TP 40 | \fB\fC\-k, \-\-key fingerprint\fR 41 | Authenticate using the SSH key described by FINGERPRINT. The key must 42 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 43 | .TP 44 | \fB\fC\-\-role\fR 45 | Specify which roles to assume for the request. 46 | .TP 47 | \fB\fC\-u, \-\-url url\fR 48 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 49 | .TP 50 | \fB\fC\-\-user user\fR 51 | Authenticate as user under account. 52 | .TP 53 | \fB\fC\-v, \-\-verbose\fR 54 | Print debug output to stderr. Repeat option to increase verbosity. 55 | .SH ENVIRONMENT 56 | .TP 57 | \fB\fCMANTA_USER\fR 58 | In place of \fB\fC\-a, \-\-account\fR\&. 59 | .TP 60 | \fB\fCMANTA_SUBUSER\fR 61 | In place of \fB\fC\-\-user\fR\&. 62 | .TP 63 | \fB\fCMANTA_KEY_ID\fR 64 | In place of \fB\fC\-k, \-\-key\fR\&. 65 | .TP 66 | \fB\fCMANTA_URL\fR 67 | In place of \fB\fC\-u, \-\-url\fR\&. 68 | .TP 69 | \fB\fCMANTA_TLS_INSECURE\fR 70 | In place of \fB\fC\-i, \-\-insecure\fR\&. 71 | .TP 72 | \fB\fCMANTA_ROLE\fR 73 | In place of \fB\fC\-\-role\fR\&. 74 | .PP 75 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 76 | where \fB\fC:login\fR is the account login name. 77 | .SH DIAGNOSTICS 78 | .PP 79 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 80 | output format. As an example of tracing all information about a request, 81 | try: 82 | .PP 83 | .RS 84 | .nf 85 | $ mchmod \-v ~~/stor/foo 2>&1 | bunyan 86 | .fi 87 | .RE 88 | .SH BUGS 89 | .PP 90 | DSA keys do not work when loaded via the SSH agent. 91 | .PP 92 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 93 | -------------------------------------------------------------------------------- /man/man1/mfind.1: -------------------------------------------------------------------------------- 1 | .TH mfind 1 "July 2016" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mfind \- search for objects in a directory hierarchy. 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmfind\fR [OPTION...] PATH... 8 | .SH DESCRIPTION 9 | .PP 10 | The mfind utility recursively descends the directory tree for each path listed, 11 | listing names that are the specified \fB\fCtype\fR (or all if none is specified). 12 | .PP 13 | Unlike GNU/BSD find, \fB\fCmfind\fR is not yet sophisticated enough to support full 14 | \fB\fCexpression\fR matching, but does (currently) allow a \fB\fC\-\-name\fR option that 15 | supports Regular Expression matching. 16 | .PP 17 | With the \fB\fC\-\-json\fR option a stream of JSON objects is printed. Each JSON object 18 | contains the fields from the Manta ListDirectory API 19 | endpoint \[la]https://apidocs.tritondatacenter.com/manta/api.html#ListDirectory\[ra], plus the 20 | following client\-side added fields: 21 | .RS 22 | .IP \(bu 2 23 | \fB\fCdepth\fR: An integer directory depth under the given directory, 24 | starting from 0. 25 | .IP \(bu 2 26 | \fB\fCparent\fR: The full directory path of the entry. 27 | .RE 28 | .SH EXAMPLES 29 | .PP 30 | .RS 31 | .nf 32 | $ mfind \-t o \-n '.+.log$' ~~/stor/logs/foo/2013/04/29 33 | ~~/stor/logs/foo/2013/04/29/00/gandalf.log 34 | /$USER/stor/logs/foo/2013/04/29/00/frodo.log 35 | ~~/stor/logs/foo/2013/04/29/01/sam.log 36 | /$USER/stor/logs/foo/2013/04/29/01/aragorn.log 37 | .fi 38 | .RE 39 | .SH OPTIONS 40 | .TP 41 | \fB\fC\-a, \-\-account login\fR 42 | Authenticate as account (login name). 43 | .TP 44 | \fB\fC\-h, \-\-help\fR 45 | Print a help message and exit. 46 | .TP 47 | \fB\fC\-i, \-\-insecure\fR 48 | This option explicitly allows "insecure" SSL connections and transfers. All 49 | SSL connections are attempted to be made secure by using the CA certificate 50 | bundle installed by default. 51 | .TP 52 | \fB\fC\-j, \-\-json\fR 53 | Output a newline\-separated JSON stream of find results. 54 | .TP 55 | \fB\fC\-k, \-\-key fingerprint\fR 56 | Authenticate using the SSH key described by FINGERPRINT. The key must 57 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 58 | .TP 59 | \fB\fC\-l, \-\-limit\fR 60 | Limit number of entries returned per request. 61 | .TP 62 | \fB\fC\-n, \-\-name regexp\fR 63 | Only return entries that have a name matching RegExp. RegExp is a 64 | Javascript Regular Expression. 65 | .TP 66 | \fB\fC\-p, \-\-parallel NUM\fR 67 | Limit concurrent operations to NUM. Default is 50. 68 | .TP 69 | \fB\fC\-s, \-\-size SIZE\fR 70 | Only list objects that are greater than SIZE bytes. 71 | .TP 72 | \fB\fC\-t, \-\-type type\fR 73 | Specify \fB\fCd\fR for directories, and \fB\fCo\fR for objects. If specified, only names of 74 | that type will be returned. 75 | .TP 76 | \fB\fC\-\-maxdepth\fR 77 | Only print items items less than this depth 78 | .TP 79 | \fB\fC\-\-mindepth\fR 80 | Only print items with at least this depth 81 | .TP 82 | \fB\fC\-\-role=ROLE,ROLE,...\fR 83 | Specify which roles to assume for the request. 84 | .TP 85 | \fB\fC\-\-user user\fR 86 | Authenticate as user under account. 87 | .TP 88 | \fB\fC\-u, \-\-url url\fR 89 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 90 | .TP 91 | \fB\fC\-v, \-\-verbose\fR 92 | Print debug output to stderr. Repeat option to increase verbosity. 93 | .SH ENVIRONMENT 94 | .TP 95 | \fB\fCMANTA_USER\fR 96 | In place of \fB\fC\-a, \-\-account\fR\&. 97 | .TP 98 | \fB\fCMANTA_SUBUSER\fR 99 | In place of \fB\fC\-\-user\fR\&. 100 | .TP 101 | \fB\fCMANTA_KEY_ID\fR 102 | In place of \fB\fC\-k, \-\-key\fR\&. 103 | .TP 104 | \fB\fCMANTA_ROLE\fR 105 | In place of \fB\fC\-\-role\fR\&. 106 | .TP 107 | \fB\fCMANTA_URL\fR 108 | In place of \fB\fC\-u, \-\-url\fR\&. 109 | .TP 110 | \fB\fCMANTA_TLS_INSECURE\fR 111 | In place of \fB\fC\-i, \-\-insecure\fR\&. 112 | .PP 113 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 114 | where \fB\fC:login\fR is the account login name. 115 | .SH DIAGNOSTICS 116 | .PP 117 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 118 | output format. As an example of tracing all information about a request, 119 | try: 120 | .PP 121 | .RS 122 | .nf 123 | $ mfind \-vv ~~/stor 2>&1 | bunyan 124 | .fi 125 | .RE 126 | .SH BUGS 127 | .PP 128 | DSA keys do not work when loaded via the SSH agent. 129 | .PP 130 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 131 | -------------------------------------------------------------------------------- /man/man1/mget.1: -------------------------------------------------------------------------------- 1 | .TH mget 1 "March 2019" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mget \- download an object from Manta. 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmget\fR [OPTION...] PATH... 8 | .SH DESCRIPTION 9 | .PP 10 | Retrieves the content of 11 | .BR object (s) 12 | specified by 13 | .BR PATH (s), 14 | and dumps them to 15 | stdout. Note that mget does not perform incremental/resumable downloads, so any 16 | network\-level errors that occur during transfer will result in an incomplete 17 | and/or corrupt output. You should check for an exit status of 0 to know that 18 | the request was successful. 19 | .PP 20 | Note that mget by default will emit a progress meter on stderr. You can 21 | disable this with \fB\fC\-q\fR\&. 22 | .SH EXAMPLES 23 | .PP 24 | Retrieves the given object, with a progress indicator. 25 | .PP 26 | .RS 27 | .nf 28 | $ mget ~~/stor/README.md > /tmp/README.md 29 | .fi 30 | .RE 31 | .PP 32 | Retrieves the given object, with a progress indicator, and stores it in the 33 | file README.md in the current directory. 34 | .PP 35 | .RS 36 | .nf 37 | $ mget \-O ~~/stor/README.md 38 | .fi 39 | .RE 40 | .PP 41 | Finds and fetches a set of Javascript files, and pipes them to less. 42 | .PP 43 | .RS 44 | .nf 45 | $ mfind \-t o \-n '.js$' ~~/stor/foo | xargs mget \-q | less 46 | .fi 47 | .RE 48 | .SH OPTIONS 49 | .TP 50 | \fB\fC\-a, \-\-account login\fR 51 | Authenticate as account (login name). 52 | .TP 53 | \fB\fC\-H, \-\-header='header: value'\fR 54 | Additional HTTP header to include. Can be specified multiple times. Must be 55 | specified for each additional header. 56 | .TP 57 | \fB\fC\-h, \-\-help\fR 58 | Print a help message and exit. 59 | .TP 60 | \fB\fC\-i, \-\-insecure\fR 61 | This option explicitly allows "insecure" SSL connections and transfers. All 62 | SSL connections are attempted to be made secure by using the CA certificate 63 | bundle installed by default. 64 | .TP 65 | \fB\fC\-k, \-\-key fingerprint\fR 66 | Authenticate using the SSH key described by FINGERPRINT. The key must 67 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 68 | .TP 69 | \fB\fC\-\-role=ROLE,ROLE,...\fR 70 | Specify which roles to assume for the request. 71 | .TP 72 | \fB\fC\-o, \-\-output file\fR 73 | Write output to instead of stdout. 74 | .TP 75 | \fB\fC\-O, \-\-remote\-name\fR 76 | Write output to a file using the requested object's name (i.e. the last 77 | element of the full object path) instead of stdout. 78 | .TP 79 | \fB\fC\-q, \-\-quiet\fR 80 | Do not display a progress meter. 81 | .TP 82 | \fB\fC\-\-user user\fR 83 | Authenticate as user under account. 84 | .TP 85 | \fB\fC\-u, \-\-url url\fR 86 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 87 | .TP 88 | \fB\fC\-v, \-\-verbose\fR 89 | Print debug output to stderr. Repeat option to increase verbosity. 90 | .SH ENVIRONMENT 91 | .TP 92 | \fB\fCMANTA_USER\fR 93 | In place of \fB\fC\-a, \-\-account\fR\&. 94 | .TP 95 | \fB\fCMANTA_SUBUSER\fR 96 | In place of \fB\fC\-\-user\fR\&. 97 | .TP 98 | \fB\fCMANTA_KEY_ID\fR 99 | In place of \fB\fC\-k, \-\-key\fR\&. 100 | .TP 101 | \fB\fCMANTA_ROLE\fR 102 | In place of \fB\fC\-\-role\fR\&. 103 | .TP 104 | \fB\fCMANTA_URL\fR 105 | In place of \fB\fC\-u, \-\-url\fR\&. 106 | .TP 107 | \fB\fCMANTA_TLS_INSECURE\fR 108 | In place of \fB\fC\-i, \-\-insecure\fR\&. 109 | .PP 110 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 111 | where \fB\fC:login\fR is the account login name. 112 | .SH DIAGNOSTICS 113 | .PP 114 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 115 | output format. As an example of tracing all information about a request, 116 | try: 117 | .PP 118 | .RS 119 | .nf 120 | $ mget \-vv ~~/stor/foo 2>&1 | bunyan 121 | .fi 122 | .RE 123 | .SH BUGS 124 | .PP 125 | DSA keys do not work when loaded via the SSH agent. 126 | .PP 127 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 128 | -------------------------------------------------------------------------------- /man/man1/minfo.1: -------------------------------------------------------------------------------- 1 | .TH minfo 1 "May 2013" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | minfo \- show HTTP headers for a Manta object 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCminfo\fR [OPTION...] PATH... 8 | .SH DESCRIPTION 9 | .PP 10 | Retrieves the HTTP headers of 11 | .BR object (s) 12 | specified by 13 | .BR PATH (s), 14 | and dumps them to 15 | stdout. Note that minfo does not download any content; use \fB\fCmget\fR for that. 16 | .SH EXAMPLES 17 | .PP 18 | Retrieves HTTP headers for the given object. 19 | .PP 20 | .RS 21 | .nf 22 | $ minfo ~~/stor/README.md 23 | .fi 24 | .RE 25 | .SH OPTIONS 26 | .TP 27 | \fB\fC\-a, \-\-account login\fR 28 | Authenticate as account (login name). 29 | .TP 30 | \fB\fC\-h, \-\-help\fR 31 | Print a help message and exit. 32 | .TP 33 | \fB\fC\-i, \-\-insecure\fR 34 | This option explicitly allows "insecure" SSL connections and transfers. All 35 | SSL connections are attempted to be made secure by using the CA certificate 36 | bundle installed by default. 37 | .TP 38 | \fB\fC\-j, \-\-json\fR 39 | Output object headers in JSON format. Additionally, \fB\fCstatus\fR and \fB\fCstatusCode\fR, 40 | while not technically headers, will be included in the output object. 41 | .TP 42 | \fB\fC\-k, \-\-key fingerprint\fR 43 | Authenticate using the SSH key described by FINGERPRINT. The key must 44 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 45 | .TP 46 | \fB\fC\-\-role=ROLE,ROLE,...\fR 47 | Specify which roles to assume for the request. 48 | .TP 49 | \fB\fC\-\-user user\fR 50 | Authenticate as user under account. 51 | .TP 52 | \fB\fC\-u, \-\-url url\fR 53 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 54 | .TP 55 | \fB\fC\-v, \-\-verbose\fR 56 | Print debug output to stderr. Repeat option to increase verbosity. 57 | .SH ENVIRONMENT 58 | .TP 59 | \fB\fCMANTA_USER\fR 60 | In place of \fB\fC\-a, \-\-account\fR\&. 61 | .TP 62 | \fB\fCMANTA_SUBUSER\fR 63 | In place of \fB\fC\-\-user\fR\&. 64 | .TP 65 | \fB\fCMANTA_KEY_ID\fR 66 | In place of \fB\fC\-k, \-\-key\fR\&. 67 | .TP 68 | \fB\fCMANTA_ROLE\fR 69 | In place of \fB\fC\-\-role\fR\&. 70 | .TP 71 | \fB\fCMANTA_URL\fR 72 | In place of \fB\fC\-u, \-\-url\fR\&. 73 | .TP 74 | \fB\fCMANTA_TLS_INSECURE\fR 75 | In place of \fB\fC\-i, \-\-insecure\fR\&. 76 | .PP 77 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 78 | where \fB\fC:login\fR is the account login name. 79 | .SH DIAGNOSTICS 80 | .PP 81 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 82 | output format. As an example of tracing all information about a request, 83 | try: 84 | .PP 85 | .RS 86 | .nf 87 | $ minfo \-vv ~~/stor/foo 2>&1 | bunyan 88 | .fi 89 | .RE 90 | .SH BUGS 91 | .PP 92 | DSA keys do not work when loaded via the SSH agent. 93 | .PP 94 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 95 | -------------------------------------------------------------------------------- /man/man1/mln.1: -------------------------------------------------------------------------------- 1 | .TH mln 1 "May 2013" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mln \- make link between objects 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmln\fR [OPTION...] TARGET LINK_NAME 8 | .SH DESCRIPTION 9 | .PP 10 | mln creates a link to TARGET with the name LINK_NAME. Links in Manta are 11 | allowed to be created by pointing at an object only, and are semantically 12 | different than a UNIX link (both hard and soft). Links in Manta are essentially 13 | a "snapshot". That is given object \fB\fCA\fR and a link \fB\fCB\fR to \fB\fCA\fR, when \fB\fCA\fR is 14 | overwritten to be \fB\fCA'\fR, \fB\fCB\fR will still return the original value of \fB\fCA\fR\&. 15 | .SH EXAMPLES 16 | .PP 17 | Creates a link from README that snapshots the contents of README.md. 18 | .PP 19 | .RS 20 | .nf 21 | $ mln ~~/stor/README.md ~~/stor/README 22 | .fi 23 | .RE 24 | .SH OPTIONS 25 | .TP 26 | \fB\fC\-a, \-\-account login\fR 27 | Authenticate as account (login name). 28 | .TP 29 | \fB\fC\-h, \-\-help\fR 30 | Print a help message and exit. 31 | .TP 32 | \fB\fC\-i, \-\-insecure\fR 33 | This option explicitly allows "insecure" SSL connections and transfers. All 34 | SSL connections are attempted to be made secure by using the CA certificate 35 | bundle installed by default. 36 | .TP 37 | \fB\fC\-k, \-\-key fingerprint\fR 38 | Authenticate using the SSH key described by FINGERPRINT. The key must 39 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 40 | .TP 41 | \fB\fC\-\-role=ROLE,ROLE,...\fR 42 | Specify which roles to assume for the request. 43 | .TP 44 | \fB\fC\-\-role\-tag=ROLE,ROLE,...\fR 45 | Set the role tags on the created link. 46 | .TP 47 | \fB\fC\-\-user user\fR 48 | Authenticate as user under account. 49 | .TP 50 | \fB\fC\-u, \-\-url url\fR 51 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 52 | .TP 53 | \fB\fC\-v, \-\-verbose\fR 54 | Print debug output to stderr. Repeat option to increase verbosity. 55 | .SH ENVIRONMENT 56 | .TP 57 | \fB\fCMANTA_USER\fR 58 | In place of \fB\fC\-a, \-\-account\fR\&. 59 | .TP 60 | \fB\fCMANTA_SUBUSER\fR 61 | In place of \fB\fC\-\-user\fR\&. 62 | .TP 63 | \fB\fCMANTA_KEY_ID\fR 64 | In place of \fB\fC\-k, \-\-key\fR\&. 65 | .TP 66 | \fB\fCMANTA_ROLE\fR 67 | In place of \fB\fC\-\-role\fR\&. 68 | .TP 69 | \fB\fCMANTA_URL\fR 70 | In place of \fB\fC\-u, \-\-url\fR\&. 71 | .TP 72 | \fB\fCMANTA_TLS_INSECURE\fR 73 | In place of \fB\fC\-i, \-\-insecure\fR\&. 74 | .PP 75 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 76 | where \fB\fC:login\fR is the account login name. 77 | .SH DIAGNOSTICS 78 | .PP 79 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 80 | output format. As an example of tracing all information about a request, 81 | try: 82 | .PP 83 | .RS 84 | .nf 85 | $ mln \-vv ~~/stor/foo 2>&1 | bunyan 86 | .fi 87 | .RE 88 | .SH BUGS 89 | .PP 90 | DSA keys do not work when loaded via the SSH agent. 91 | .PP 92 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 93 | -------------------------------------------------------------------------------- /man/man1/mls.1: -------------------------------------------------------------------------------- 1 | .TH mls 1 "Sep 2018" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mls \- list directory contents. 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmls\fR [OPTION...] [FILE]... 8 | .SH DESCRIPTION 9 | .PP 10 | List information about the FILEs (\fB\fC/:login/stor\fR by default, where \fB\fC:login\fR is 11 | either the login specified by \fB\fC\-a\fR or \fB\fC$MANTA_USER\fR). Entries are sorted by 12 | creation time. Note that \fB\fCdirectories\fR will appear to have a trailing \fB\fC/\fR after 13 | them, while objects will be just the name (unless \fB\fC\-l\fR is specified). 14 | .SH EXAMPLES 15 | .PP 16 | .RS 17 | .nf 18 | $ mls ~~/stor 19 | foo 20 | home/ 21 | README.md 22 | tmp/ 23 | .fi 24 | .RE 25 | .SH OPTIONS 26 | .TP 27 | \fB\fC\-a, \-\-account login\fR 28 | Authenticate as account (login name). 29 | .TP 30 | \fB\fC\-h, \-\-human\-readable\fR 31 | Human readable output when using a long listing format. 32 | .TP 33 | \fB\fC\-\-help\fR 34 | Print a help message and exit. 35 | .TP 36 | \fB\fC\-i, \-\-insecure\fR 37 | This option explicitly allows "insecure" SSL connections and transfers. All 38 | SSL connections are attempted to be made secure by using the CA certificate 39 | bundle installed by default. 40 | .TP 41 | \fB\fC\-j, \-\-json\fR 42 | Output records in JSON, as opposed to human readable form. 43 | .TP 44 | \fB\fC\-k, \-\-key fingerprint\fR 45 | Authenticate using the SSH key described by FINGERPRINT. The key must 46 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 47 | .TP 48 | \fB\fC\-l, \-\-long\fR 49 | Use a long listing format. Note that as Manta does not have group information, 50 | this is like \fB\fCls \-o\fR, not \fB\fCls \-l\fR, in a traditional shell. 51 | .TP 52 | \fB\fC\-m, \-\-marker name\fR 53 | Start listing at name NAME. Useful to paginate through large listings. 54 | .TP 55 | \fB\fC\-r, \-\-reverse\fR 56 | reverse order while sorting 57 | .TP 58 | \fB\fC\-\-role=ROLE,ROLE,...\fR 59 | Specify which roles to assume for the request. 60 | .TP 61 | \fB\fC\-t, \-\-time\fR 62 | sort by modification time, newest first 63 | .TP 64 | \fB\fC\-\-user user\fR 65 | Authenticate as user under account. 66 | .TP 67 | \fB\fC\-u, \-\-url url\fR 68 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 69 | .TP 70 | \fB\fC\-v, \-\-verbose\fR 71 | Print debug output to stderr. Repeat option to increase verbosity. 72 | .SH ENVIRONMENT 73 | .TP 74 | \fB\fCMANTA_USER\fR 75 | In place of \fB\fC\-a, \-\-account\fR\&. 76 | .TP 77 | \fB\fCMANTA_SUBUSER\fR 78 | In place of \fB\fC\-\-user\fR\&. 79 | .TP 80 | \fB\fCMANTA_KEY_ID\fR 81 | In place of \fB\fC\-k, \-\-key\fR\&. 82 | .TP 83 | \fB\fCMANTA_ROLE\fR 84 | In place of \fB\fC\-\-role\fR\&. 85 | .TP 86 | \fB\fCMANTA_URL\fR 87 | In place of \fB\fC\-u, \-\-url\fR\&. 88 | .TP 89 | \fB\fCMANTA_TLS_INSECURE\fR 90 | In place of \fB\fC\-i, \-\-insecure\fR\&. 91 | .PP 92 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 93 | where \fB\fC:login\fR is the account login name. 94 | .SH DIAGNOSTICS 95 | .PP 96 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 97 | output format. As an example of tracing all information about a request, 98 | try: 99 | .PP 100 | .RS 101 | .nf 102 | $ mls \-vv ~~/stor 2>&1 | bunyan 103 | .fi 104 | .RE 105 | .SH BUGS 106 | .PP 107 | DSA keys do not work when loaded via the SSH agent. 108 | .PP 109 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 110 | -------------------------------------------------------------------------------- /man/man1/mmkdir.1: -------------------------------------------------------------------------------- 1 | .TH mmkdir 1 "May 2013" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mmkdir \- make directories 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmmkdir\fR [OPTION...] DIRECTORY... 8 | .SH DESCRIPTION 9 | .PP 10 | Create the 11 | .BR DIRECTORY (ies), 12 | if they do not already exist. 13 | .SH EXAMPLES 14 | .PP 15 | .RS 16 | .nf 17 | $ mmkdir \-p ~~/stor/foo/bar/baz 18 | .fi 19 | .RE 20 | .SH OPTIONS 21 | .TP 22 | \fB\fC\-a, \-\-account login\fR 23 | Authenticate as account (login name). 24 | .TP 25 | \fB\fC\-h, \-\-help\fR 26 | Print a help message and exit. 27 | .TP 28 | \fB\fC\-i, \-\-insecure\fR 29 | This option explicitly allows "insecure" SSL connections and transfers. All 30 | SSL connections are attempted to be made secure by using the CA certificate 31 | bundle installed by default. 32 | .TP 33 | \fB\fC\-k, \-\-key fingerprint\fR 34 | Authenticate using the SSH key described by FINGERPRINT. The key must 35 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 36 | .TP 37 | \fB\fC\-p, \-\-parents\fR 38 | no error if existing, make parent directories as needed. 39 | .TP 40 | \fB\fC\-\-role=ROLE,ROLE,...\fR 41 | Specify which roles to assume for the request. 42 | .TP 43 | \fB\fC\-\-role\-tag=ROLE,ROLE,...\fR 44 | Set the role tags on the created directory. 45 | .TP 46 | \fB\fC\-\-user user\fR 47 | Authenticate as user under account. 48 | .TP 49 | \fB\fC\-u, \-\-url url\fR 50 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 51 | .TP 52 | \fB\fC\-v, \-\-verbose\fR 53 | Print debug output to stderr. Repeat option to increase verbosity. 54 | .SH ENVIRONMENT 55 | .TP 56 | \fB\fCMANTA_USER\fR 57 | In place of \fB\fC\-a, \-\-account\fR\&. 58 | .TP 59 | \fB\fCMANTA_SUBUSER\fR 60 | In place of \fB\fC\-\-user\fR\&. 61 | .TP 62 | \fB\fCMANTA_KEY_ID\fR 63 | In place of \fB\fC\-k, \-\-key\fR\&. 64 | .TP 65 | \fB\fCMANTA_ROLE\fR 66 | In place of \fB\fC\-\-role\fR\&. 67 | .TP 68 | \fB\fCMANTA_URL\fR 69 | In place of \fB\fC\-u, \-\-url\fR\&. 70 | .TP 71 | \fB\fCMANTA_TLS_INSECURE\fR 72 | In place of \fB\fC\-i, \-\-insecure\fR\&. 73 | .PP 74 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 75 | where \fB\fC:login\fR is the account login name. 76 | .SH DIAGNOSTICS 77 | .PP 78 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 79 | output format. As an example of tracing all information about a request, 80 | try: 81 | .PP 82 | .RS 83 | .nf 84 | $ mmkdir \-vv ~~/stor/foo 2>&1 | bunyan 85 | .fi 86 | .RE 87 | .SH BUGS 88 | .PP 89 | DSA keys do not work when loaded via the SSH agent. 90 | .PP 91 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 92 | -------------------------------------------------------------------------------- /man/man1/mput.1: -------------------------------------------------------------------------------- 1 | .TH mput 1 "May 2013" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mput \- create an object 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmput\fR [OPTION...] OBJECT 8 | .SH DESCRIPTION 9 | .PP 10 | mput creates an object specified at the name OBJECT with the contents either 11 | coming from stdin, or from the file specified with \fB\fC\-f\fR\&. mput will attempt to 12 | set the HTTP Content\-Type based on the extension on the object, unless 13 | Content\-Type is specified as an HTTP header. If mput cannot determine the type 14 | based on the extension the default content\-type is usually 15 | \fB\fCapplication/octet\-stream\fR, but this can be overriden by setting the environment 16 | variable \fB\fCMANTA_DEFAULT_CONTENT_TYPE\fR (or passing \fB\fC\-H\fR). 17 | .PP 18 | By default, mput creates two copies of an object; this can be overridden with 19 | \fB\fC\-c\fR\&. Lastly, mput also draws a progress meter by default; this can be disabled 20 | with \fB\fC\-q\fR\&. 21 | .SH EXAMPLES 22 | .PP 23 | Create an object with the contents of foo.txt. Content\-type will be text/plain. 24 | .PP 25 | .RS 26 | .nf 27 | $ mput \-f ./foo.txt ~~/stor/foo.txt 28 | .fi 29 | .RE 30 | .PP 31 | Create the same object from stdin, and set content\-type. 32 | .PP 33 | .RS 34 | .nf 35 | $ cat ./foo.txt | mput \-H 'content\-type: text/plain' ~~/stor/foo.txt 36 | .fi 37 | .RE 38 | .PP 39 | Create the same object, set CORS header, and create 3 copies, with no progress bar: 40 | .PP 41 | .RS 42 | .nf 43 | $ cat ./foo.txt | mput \-H 'content\-type: text/plain' \\ 44 | \-H 'access\-control\-allow\-origin: *' \\ 45 | \-c 3 \-q \\ 46 | ~~/stor/foo.txt 47 | .fi 48 | .RE 49 | .SH OPTIONS 50 | .TP 51 | \fB\fC\-a, \-\-account login\fR 52 | Authenticate as account (login name). 53 | .TP 54 | \fB\fC\-c, \-\-copies file\fR 55 | Create COPIES copies as a replication factor (default 2). 56 | .TP 57 | \fB\fC\-f, \-\-file file\fR 58 | Create contents of object from file. 59 | .TP 60 | \fB\fC\-h, \-\-help\fR 61 | Print a help message and exit. 62 | .TP 63 | \fB\fC\-i, \-\-insecure\fR 64 | This option explicitly allows "insecure" SSL connections and transfers. All 65 | SSL connections are attempted to be made secure by using the CA certificate 66 | bundle installed by default. 67 | .TP 68 | \fB\fC\-k, \-\-key fingerprint\fR 69 | Authenticate using the SSH key described by FINGERPRINT. The key must 70 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 71 | .TP 72 | \fB\fC\-m, \-\-md5\fR 73 | When using \fB\fC\-\-file\fR, this switch instructs mput to first compute the MD5 of 74 | the file and send it in \fB\fCcontent\-md5\fR\&. 75 | .TP 76 | \fB\fC\-p, \-\-parents\fR 77 | Create parent directories as needed. 78 | .TP 79 | \fB\fC\-q, \-\-quiet\fR 80 | Do not display a progress meter. 81 | .TP 82 | \fB\fC\-\-role=ROLE,ROLE,...\fR 83 | Specify which roles to assume for the request. 84 | .TP 85 | \fB\fC\-\-role\-tag=ROLE,ROLE,...\fR 86 | Set the role tags on the created object. 87 | .TP 88 | \fB\fC\-\-user user\fR 89 | Authenticate as user under account. 90 | .TP 91 | \fB\fC\-u, \-\-url url\fR 92 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 93 | .TP 94 | \fB\fC\-v, \-\-verbose\fR 95 | Print debug output to stderr. Repeat option to increase verbosity. 96 | .SH ENVIRONMENT 97 | .TP 98 | \fB\fCMANTA_USER\fR 99 | In place of \fB\fC\-a, \-\-account\fR\&. 100 | .TP 101 | \fB\fCMANTA_SUBUSER\fR 102 | In place of \fB\fC\-\-user\fR\&. 103 | .TP 104 | \fB\fCMANTA_KEY_ID\fR 105 | In place of \fB\fC\-k, \-\-key\fR\&. 106 | .TP 107 | \fB\fCMANTA_ROLE\fR 108 | In place of \fB\fC\-\-role\fR\&. 109 | .TP 110 | \fB\fCMANTA_URL\fR 111 | In place of \fB\fC\-u, \-\-url\fR\&. 112 | .TP 113 | \fB\fCMANTA_TLS_INSECURE\fR 114 | In place of \fB\fC\-i, \-\-insecure\fR\&. 115 | .PP 116 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 117 | where \fB\fC:login\fR is the account login name. 118 | .SH DIAGNOSTICS 119 | .PP 120 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 121 | output format. As an example of tracing all information about a request, 122 | try: 123 | .PP 124 | .RS 125 | .nf 126 | $ mput \-vv ~~/stor/foo 2>&1 | bunyan 127 | .fi 128 | .RE 129 | .SH BUGS 130 | .PP 131 | DSA keys do not work when loaded via the SSH agent. 132 | .PP 133 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 134 | -------------------------------------------------------------------------------- /man/man1/mrm.1: -------------------------------------------------------------------------------- 1 | .TH mrm 1 "August 2018" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mrm \- remove objects or directories 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmrm\fR [OPTION...] OBJECT... 8 | .SH DESCRIPTION 9 | .PP 10 | mrm removes each specified object. By default, it does not remove directories. 11 | .SH EXAMPLES 12 | .PP 13 | Recursively delete all directories and objects under \fB\fC/:login/stor/tmp\fR\&. 14 | .PP 15 | .RS 16 | .nf 17 | $ mrm \-r ~~/stor/tmp 18 | .fi 19 | .RE 20 | .SH OPTIONS 21 | .TP 22 | \fB\fC\-a, \-\-account login\fR 23 | Authenticate as account (login name). 24 | .TP 25 | \fB\fC\-h, \-\-help\fR 26 | Print a help message and exit. 27 | .TP 28 | \fB\fC\-i, \-\-insecure\fR 29 | This option explicitly allows "insecure" SSL connections and transfers. All 30 | SSL connections are attempted to be made secure by using the CA certificate 31 | bundle installed by default. 32 | .TP 33 | \fB\fC\-I, \-\-interactive\fR 34 | Confirm before deleting objects. 35 | .TP 36 | \fB\fC\-k, \-\-key fingerprint\fR 37 | Authenticate using the SSH key described by FINGERPRINT. The key must 38 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 39 | .TP 40 | \fB\fC\-p, \-\-parallel NUM\fR 41 | Limit concurrent operations to NUM. Default is 50. 42 | .TP 43 | \fB\fC\-r, \-\-recursive\fR 44 | Remove directories and their contents recursively. 45 | .TP 46 | \fB\fC\-\-role=ROLE,ROLE,...\fR 47 | Specify which roles to assume for the request. 48 | .TP 49 | \fB\fC\-\-user user\fR 50 | Authenticate as user under account. 51 | .TP 52 | \fB\fC\-u, \-\-url url\fR 53 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 54 | .TP 55 | \fB\fC\-v, \-\-verbose\fR 56 | Print debug output to stderr. Repeat option to increase verbosity. 57 | .SH ENVIRONMENT 58 | .TP 59 | \fB\fCMANTA_USER\fR 60 | In place of \fB\fC\-a, \-\-account\fR\&. 61 | .TP 62 | \fB\fCMANTA_SUBUSER\fR 63 | In place of \fB\fC\-\-user\fR\&. 64 | .TP 65 | \fB\fCMANTA_KEY_ID\fR 66 | In place of \fB\fC\-k, \-\-key\fR\&. 67 | .TP 68 | \fB\fCMANTA_ROLE\fR 69 | In place of \fB\fC\-\-role\fR\&. 70 | .TP 71 | \fB\fCMANTA_URL\fR 72 | In place of \fB\fC\-u, \-\-url\fR\&. 73 | .TP 74 | \fB\fCMANTA_TLS_INSECURE\fR 75 | In place of \fB\fC\-i, \-\-insecure\fR\&. 76 | .PP 77 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 78 | where \fB\fC:login\fR is the account login name. 79 | .SH DIAGNOSTICS 80 | .PP 81 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 82 | output format. As an example of tracing all information about a request, 83 | try: 84 | .PP 85 | .RS 86 | .nf 87 | $ mrm \-vv ~~/stor/foo 2>&1 | bunyan 88 | .fi 89 | .RE 90 | .SH BUGS 91 | .PP 92 | DSA keys do not work when loaded via the SSH agent. 93 | .PP 94 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 95 | -------------------------------------------------------------------------------- /man/man1/mrmdir.1: -------------------------------------------------------------------------------- 1 | .TH mrmdir 1 "August 2018" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | mrmdir \- remove empty directories 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmrmdir\fR [OPTION...] DIRECTORY... 8 | .SH DESCRIPTION 9 | .PP 10 | mrmdir removes each specified directory, if they are empty. 11 | .SH EXAMPLES 12 | .PP 13 | .RS 14 | .nf 15 | $ mrmdir ~~/stor/tmp 16 | .fi 17 | .RE 18 | .SH OPTIONS 19 | .TP 20 | \fB\fC\-a, \-\-account login\fR 21 | Authenticate as account (login name). 22 | .TP 23 | \fB\fC\-h, \-\-help\fR 24 | Print a help message and exit. 25 | .TP 26 | \fB\fC\-i, \-\-insecure\fR 27 | This option explicitly allows "insecure" SSL connections and transfers. All 28 | SSL connections are attempted to be made secure by using the CA certificate 29 | bundle installed by default. 30 | .TP 31 | \fB\fC\-I, \-\-interactive\fR 32 | Confirm before deleting directories. 33 | .TP 34 | \fB\fC\-k, \-\-key fingerprint\fR 35 | Authenticate using the SSH key described by FINGERPRINT. The key must 36 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 37 | .TP 38 | \fB\fC\-\-role=ROLE,ROLE,...\fR 39 | Specify which roles to assume for the request. 40 | .TP 41 | \fB\fC\-\-user user\fR 42 | Authenticate as user under account. 43 | .TP 44 | \fB\fC\-u, \-\-url url\fR 45 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 46 | .TP 47 | \fB\fC\-v, \-\-verbose\fR 48 | Print debug output to stderr. Repeat option to increase verbosity. 49 | .SH ENVIRONMENT 50 | .TP 51 | \fB\fCMANTA_USER\fR 52 | In place of \fB\fC\-a, \-\-account\fR\&. 53 | .TP 54 | \fB\fCMANTA_SUBUSER\fR 55 | In place of \fB\fC\-\-user\fR\&. 56 | .TP 57 | \fB\fCMANTA_KEY_ID\fR 58 | In place of \fB\fC\-k, \-\-key\fR\&. 59 | .TP 60 | \fB\fCMANTA_ROLE\fR 61 | In place of \fB\fC\-\-role\fR\&. 62 | .TP 63 | \fB\fCMANTA_URL\fR 64 | In place of \fB\fC\-u, \-\-url\fR\&. 65 | .TP 66 | \fB\fCMANTA_TLS_INSECURE\fR 67 | In place of \fB\fC\-i, \-\-insecure\fR\&. 68 | .PP 69 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 70 | where \fB\fC:login\fR is the account login name. 71 | .SH DIAGNOSTICS 72 | .PP 73 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 74 | output format. As an example of tracing all information about a request, 75 | try: 76 | .PP 77 | .RS 78 | .nf 79 | $ mrmdir \-vv ~~/stor/foo 2>&1 | bunyan 80 | .fi 81 | .RE 82 | .SH BUGS 83 | .PP 84 | DSA keys do not work when loaded via the SSH agent. 85 | .PP 86 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 87 | -------------------------------------------------------------------------------- /man/man1/msign.1: -------------------------------------------------------------------------------- 1 | .TH msign 1 "December 2018" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | msign \- create a signed URL to a Manta object 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmsign\fR [OPTION...] OBJECT... 8 | .SH DESCRIPTION 9 | .PP 10 | msign takes a list of objects (or directories), and using the credentials from 11 | the environment (whether environment variables or command line switches) creates 12 | time\-expiring URLs that can be shared with others. This is useful to generate 13 | HTML links, for example. 14 | .PP 15 | The default expiration for URLs is 1 hour from \fB\fCnow\fR, but this can be changed 16 | with the \fB\fCexpires\fR option. The expires option is designed to be used in 17 | conjunction with the UNIX date command. In general, you should use the date 18 | command with a modifier (the syntax is different between BSD and GNU forms), and 19 | format the output to epoch time. 20 | .SH EXAMPLES 21 | .PP 22 | Assuming the GNU date command, generate a signed URL that expires in one month: 23 | .PP 24 | .RS 25 | .nf 26 | $ msign \-e $(date \-d "1 month" "+%s") ~~/stor/tmp 27 | .fi 28 | .RE 29 | .PP 30 | On OS X, you would sign this way: 31 | .PP 32 | .RS 33 | .nf 34 | $ msign \-e $(date \-v+1m "+%s") ~~/stor/tmp 35 | .fi 36 | .RE 37 | .PP 38 | You can also use \fB\fC\-E\fR for a friendly relative date format: 39 | .PP 40 | .RS 41 | .nf 42 | $ msign \-E 5s ~~/foo # expires in 5 seconds 43 | $ msign \-E 5m ~~/foo # expires in 5 minutes 44 | $ msign \-E 5h ~~/foo # expires in 5 hours 45 | $ msign \-E 5d ~~/foo # expires in 5 days 46 | $ msign \-E 5w ~~/foo # expires in 5 weeks 47 | $ msign \-E 5y ~~/foo # expires in 5 years 48 | .fi 49 | .RE 50 | .SH OPTIONS 51 | .TP 52 | \fB\fC\-a, \-\-account login\fR 53 | Authenticate as account (login name). 54 | .TP 55 | \fB\fC\-e, \-\-expires expiration\fR 56 | Signed URL should last until EXPIRATION (seconds since epoch). Default is 1 57 | hour from \fB\fCnow\fR\&. 58 | .TP 59 | \fB\fC\-E, \-\-expires\-relative expiration\fR 60 | Signed URL should last until EXPIRATION (relative time spec). Default is 1 61 | hour from \fB\fCnow\fR\&. Time specification format: 62 | .PP 63 | .RS 64 | .nf 65 | [n]s \- seconds from now 66 | [n]m \- minutes from now 67 | [n]h \- hours from now 68 | [n]d \- days from now 69 | [n]w \- weeks from now 70 | [n]y \- years from now 71 | .fi 72 | .RE 73 | .TP 74 | \fB\fC\-h, \-\-help\fR 75 | Print a help message and exit. 76 | .TP 77 | \fB\fC\-i, \-\-insecure\fR 78 | This option explicitly allows "insecure" SSL connections and transfers. All 79 | SSL connections are attempted to be made secure by using the CA certificate 80 | bundle installed by default. 81 | .TP 82 | \fB\fC\-k, \-\-key fingerprint\fR 83 | Authenticate using the SSH key described by FINGERPRINT. The key must 84 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 85 | .TP 86 | \fB\fC\-m, \-\-method http_method\fR 87 | Allow URL to work for the HTTP method specified (default is GET). 88 | .TP 89 | \fB\fC\-\-role=ROLE,ROLE,...\fR 90 | Specify which roles to assume for the request. 91 | .TP 92 | \fB\fC\-\-role\-tag=ROLE,ROLE,...\fR 93 | Set the role tags on objects created with the signed URL. 94 | .TP 95 | \fB\fC\-\-user user\fR 96 | Authenticate as user under account. 97 | .TP 98 | \fB\fC\-u, \-\-url url\fR 99 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 100 | .TP 101 | \fB\fC\-v, \-\-verbose\fR 102 | Print debug output to stderr. Repeat option to increase verbosity. 103 | .SH ENVIRONMENT 104 | .TP 105 | \fB\fCMANTA_USER\fR 106 | In place of \fB\fC\-a, \-\-account\fR\&. 107 | .TP 108 | \fB\fCMANTA_SUBUSER\fR 109 | In place of \fB\fC\-\-user\fR\&. 110 | .TP 111 | \fB\fCMANTA_KEY_ID\fR 112 | In place of \fB\fC\-k, \-\-key\fR\&. 113 | .TP 114 | \fB\fCMANTA_ROLE\fR 115 | In place of \fB\fC\-\-role\fR\&. 116 | .TP 117 | \fB\fCMANTA_URL\fR 118 | In place of \fB\fC\-u, \-\-url\fR\&. 119 | .TP 120 | \fB\fCMANTA_TLS_INSECURE\fR 121 | In place of \fB\fC\-i, \-\-insecure\fR\&. 122 | .PP 123 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 124 | where \fB\fC:login\fR is the account login name. 125 | .SH DIAGNOSTICS 126 | .PP 127 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 128 | output format. As an example of tracing all information about a request, 129 | try: 130 | .PP 131 | .RS 132 | .nf 133 | $ msign \-vv ~~/stor/foo 2>&1 | bunyan 134 | .fi 135 | .RE 136 | .SH BUGS 137 | .PP 138 | DSA keys do not work when loaded via the SSH agent. 139 | .PP 140 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 141 | -------------------------------------------------------------------------------- /man/man1/msync.1: -------------------------------------------------------------------------------- 1 | .TH msync 1 "May 2023" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | msync \- synchronize a directory hierarchy with Manta. 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmsync\fR LOCAL_PATH MANTA_PATH 8 | .PP 9 | \fB\fCmsync\fR \-r MANTA_PATH LOCAL_PATH 10 | .SH DESCRIPTION 11 | .PP 12 | The msync utility synchronizes the contents of a directory between a local 13 | filesystem and manta. By default a local directory will be uploaded to Manta. 14 | Using the \fB\fC\-r\fR flag will reverse the operation, downloading an entire Manta 15 | directory. 16 | .PP 17 | Like rsync, msync will skip files already on the destination by checking the 18 | size (or alternatively the md5 sum). 19 | .SH EXAMPLES 20 | .PP 21 | .RS 22 | .nf 23 | $ msync ./shakespeare/ ~~/stor/plays/shakespeare 24 | building source file list... 25 | source file list built, 1222 files found 26 | /fbulsara/stor/plays/shakespeare/index.html... not found, adding to sync list (1/1222) 27 | /fbulsara/stor/plays/shakespeare/test.html... not found, adding to sync list (2/1222) 28 | /fbulsara/stor/plays/shakespeare/favicon.ico... not found, adding to sync list (3/1222) 29 | /fbulsara/stor/plays/shakespeare/news.html... not found, adding to sync list (4/1222) 30 | \&. . . 31 | /fbulsara/stor/plays/shakespeare/History/2kinghenryvi/2henryvi.2.3.html... synced (1221/1222) 32 | /fbulsara/stor/plays/shakespeare/History/2kinghenryvi/2henryvi.4.8.html... synced (1222/1222) 33 | 34 | 1222 files (24.07 MB) synced successfully, 0 files failed to sync (took 33s 758ms) 35 | done 36 | .fi 37 | .RE 38 | .SH OPTIONS 39 | .TP 40 | \fB\fC\-a, \-\-account=login\fR 41 | Authenticate as account (login name). 42 | .TP 43 | \fB\fC\-c, \-\-copies=copies\fR 44 | Number of copies to make. 45 | .TP 46 | \fB\fC\-f, \-\-file=tarfile\fR 47 | The tar file to extract from. 48 | .TP 49 | \fB\fC\-H, \-\-header=header\fR 50 | HTTP headers to include. 51 | .TP 52 | \fB\fC\-h, \-\-help\fR 53 | Print a help message and exit. 54 | .TP 55 | \fB\fC\-i, \-\-insecure\fR 56 | This option explicitly allows "insecure" SSL connections and transfers. All 57 | SSL connections are attempted to be made secure by using the CA certificate 58 | bundle installed by default. 59 | .TP 60 | \fB\fC\-k fingerprint, \-\-key=fingerprint\fR 61 | Authenticate using the SSH key described by FINGERPRINT. The key must 62 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 63 | .TP 64 | \fB\fC\-p NUM, \-\-parallel=NUM\fR 65 | Limit concurrent operations to NUM. Default is 20. 66 | .TP 67 | \fB\fC\-t, \-\-type type\fR 68 | Specify \fB\fCd\fR for directories, and \fB\fCo\fR for objects. If specified, only names of 69 | that type will be returned. 70 | .TP 71 | \fB\fC\-\-role=ROLE,ROLE,...\fR 72 | Specify which roles to assume for the request. 73 | .TP 74 | \fB\fC\-\-role\-tag=ROLE,ROLE,...\fR 75 | Set the role tags on created objects and directories. 76 | .TP 77 | \fB\fC\-\-user user\fR 78 | Authenticate as user under account. 79 | .TP 80 | \fB\fC\-u, \-\-url url\fR 81 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 82 | .TP 83 | \fB\fC\-v, \-\-verbose\fR 84 | Print debug output to stderr. Repeat option to increase verbosity. 85 | .TP 86 | \fB\fC\-j, \-\-just\-delete\fR 87 | don't send local files, just delete extra remote files. 88 | .TP 89 | \fB\fC\-l, \-\-ignore\-links\fR 90 | ignore symlinks. Note: By default symlinks are followed. The linked file will 91 | be uploaded as an object to Manta. 92 | .TP 93 | \fB\fC\-m, \-\-md5\fR 94 | use md5 instead of file size (slower, but more accurate). 95 | .TP 96 | \fB\fC\-n, \-\-dry\-run\fR 97 | don't perform any remote PUT or DELETE operations. 98 | .TP 99 | \fB\fC\-p CONCURRENCY, \-\-parallel=CONCURRENCY\fR 100 | limit concurrent operations. 101 | .TP 102 | \fB\fC\-q, \-\-quiet\fR 103 | suppress all output. 104 | .TP 105 | \fB\fC\-r, \-\-reverse\fR 106 | manta to local sync. 107 | .SH ENVIRONMENT 108 | .TP 109 | \fB\fCMANTA_USER\fR 110 | In place of \fB\fC\-a, \-\-account\fR\&. 111 | .TP 112 | \fB\fCMANTA_SUBUSER\fR 113 | In place of \fB\fC\-\-user\fR\&. 114 | .TP 115 | \fB\fCMANTA_KEY_ID\fR 116 | In place of \fB\fC\-k, \-\-key\fR\&. 117 | .TP 118 | \fB\fCMANTA_ROLE\fR 119 | In place of \fB\fC\-\-role\fR\&. 120 | .TP 121 | \fB\fCMANTA_URL\fR 122 | In place of \fB\fC\-u, \-\-url\fR\&. 123 | .TP 124 | \fB\fCMANTA_TLS_INSECURE\fR 125 | In place of \fB\fC\-i, \-\-insecure\fR\&. 126 | .PP 127 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 128 | where \fB\fC:login\fR is the account login name. 129 | .SH DIAGNOSTICS 130 | .PP 131 | Unlike other commands, \-v does not output bunyan logs. Instead, it will list 132 | each file status rather than only files that are out of sync. 133 | .SH NOTES 134 | .SH BUGS 135 | .PP 136 | DSA keys do not work when loaded via the SSH agent. 137 | .PP 138 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 139 | -------------------------------------------------------------------------------- /man/man1/muntar.1: -------------------------------------------------------------------------------- 1 | .TH muntar 1 "May 2023" Manta "Manta Commands" 2 | .SH NAME 3 | .PP 4 | muntar \- deprecated; create a directory hierarchy from a tar file 5 | .SH SYNOPSIS 6 | .PP 7 | \fB\fCmuntar\fR \-f tarfile [OPTION...] PATH... 8 | .SH DESCRIPTION 9 | .PP 10 | muntar is deprecated and will be removed in a future release. 11 | .PP 12 | The muntar utility extracts the contents of a tar file and creates 13 | the corresponding objects in the path specified. If the destination 14 | directories do not exist, they are created. 15 | .SH EXAMPLES 16 | .PP 17 | .RS 18 | .nf 19 | $ muntar \-f shakespeare.tar ~~/stor/plays/shakespeare 20 | ~~/stor/plays/shakespeare/README 21 | ~~/stor/plays/shakespeare/comedies/cymbeline 22 | ~~/stor/plays/shakespeare/glossary 23 | \&. . . 24 | ~~/stor/plays/shakespeare/comedies/merrywivesofwindsor 25 | ~~/stor/plays/shakespeare/poetry/rapeoflucrece 26 | ~~/stor/plays/shakespeare/poetry/various 27 | ~~/stor/plays/shakespeare/poetry/sonnets 28 | .fi 29 | .RE 30 | .PP 31 | If the tarball is compressed, you can store it as an object and use muntar 32 | in the compute environment. 33 | .PP 34 | .RS 35 | .nf 36 | $ mput \-f /var/tmp/backup.tar.gz ~~/stor/backup.tar.gz 37 | $ echo ~~/stor/backup.tar.gz | \\ 38 | mjob create \-o \-m gzcat \-m 'muntar \-f $MANTA_INPUT_FILE ~~/stor' 39 | .fi 40 | .RE 41 | .SH OPTIONS 42 | .TP 43 | \fB\fC\-a, \-\-account=login\fR 44 | Authenticate as account (login name). 45 | .TP 46 | \fB\fC\-c, \-\-copies=copies\fR 47 | Number of copies to make. 48 | .TP 49 | \fB\fC\-f, \-\-file=tarfile\fR 50 | The tar file to extract from. 51 | .TP 52 | \fB\fC\-H, \-\-header=header\fR 53 | HTTP headers to include. 54 | .TP 55 | \fB\fC\-h, \-\-help\fR 56 | Print a help message and exit. 57 | .TP 58 | \fB\fC\-i, \-\-insecure\fR 59 | This option explicitly allows "insecure" SSL connections and transfers. All 60 | SSL connections are attempted to be made secure by using the CA certificate 61 | bundle installed by default. 62 | .TP 63 | \fB\fC\-k fingerprint, \-\-key=fingerprint\fR 64 | Authenticate using the SSH key described by FINGERPRINT. The key must 65 | either be in \fB\fC~/.ssh\fR or loaded in the SSH agent via \fB\fCssh\-add\fR\&. 66 | .TP 67 | \fB\fC\-p NUM, \-\-parallel=NUM\fR 68 | Limit concurrent operations to NUM. Default is 20. 69 | .TP 70 | \fB\fC\-t, \-\-type type\fR 71 | Specify \fB\fCd\fR for directories, and \fB\fCo\fR for objects. If specified, only names of 72 | that type will be returned. 73 | .TP 74 | \fB\fC\-\-role=ROLE,ROLE,...\fR 75 | Specify which roles to assume for the request. 76 | .TP 77 | \fB\fC\-\-role\-tag=ROLE,ROLE,...\fR 78 | Set the role tags on created objects and directories. 79 | .TP 80 | \fB\fC\-\-user user\fR 81 | Authenticate as user under account. 82 | .TP 83 | \fB\fC\-u, \-\-url url\fR 84 | Manta base URL (such as \fB\fChttps://us\-central.manta.mnx.io\fR). 85 | .TP 86 | \fB\fC\-v, \-\-verbose\fR 87 | Print debug output to stderr. Repeat option to increase verbosity. 88 | .SH ENVIRONMENT 89 | .TP 90 | \fB\fCMANTA_USER\fR 91 | In place of \fB\fC\-a, \-\-account\fR\&. 92 | .TP 93 | \fB\fCMANTA_SUBUSER\fR 94 | In place of \fB\fC\-\-user\fR\&. 95 | .TP 96 | \fB\fCMANTA_KEY_ID\fR 97 | In place of \fB\fC\-k, \-\-key\fR\&. 98 | .TP 99 | \fB\fCMANTA_ROLE\fR 100 | In place of \fB\fC\-\-role\fR\&. 101 | .TP 102 | \fB\fCMANTA_URL\fR 103 | In place of \fB\fC\-u, \-\-url\fR\&. 104 | .TP 105 | \fB\fCMANTA_TLS_INSECURE\fR 106 | In place of \fB\fC\-i, \-\-insecure\fR\&. 107 | .PP 108 | The shortcut \fB\fC~~\fR is equivalent to \fB\fC/:login\fR 109 | where \fB\fC:login\fR is the account login name. 110 | .SH DIAGNOSTICS 111 | .PP 112 | When using the \fB\fC\-v\fR option, diagnostics will be sent to stderr in bunyan 113 | output format. As an example of tracing all information about a request, 114 | try: 115 | .PP 116 | .RS 117 | .nf 118 | $ mfind \-vv ~~/stor 2>&1 | bunyan 119 | .fi 120 | .RE 121 | .SH NOTES 122 | .SH BUGS 123 | .PP 124 | DSA keys do not work when loaded via the SSH agent. 125 | .PP 126 | Report bugs at Github \[la]https://github.com/TritonDataCenter/node-manta/issues\[ra] 127 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "manta", 3 | "author": "MNX Cloud (mnx.io)", 4 | "description": "Manta Client API", 5 | "homepage": "http://apidocs.tritondatacenter.com/manta", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/TritonDataCenter/node-manta.git" 9 | }, 10 | "version": "5.4.2", 11 | "main": "./lib/index.js", 12 | "dependencies": { 13 | "assert-plus": "^1.0.0", 14 | "backoff": "~2.3.0", 15 | "bunyan": "^1.8.1", 16 | "clone": "~0.1.11", 17 | "cmdln": "4.1.2", 18 | "dashdash": "1.14.1", 19 | "extsprintf": "^1.3.0", 20 | "hogan.js": "~2.0.0", 21 | "humanize-time": "^0.0.3", 22 | "jsprim": "^1.3.0", 23 | "lomstream": "^1.1.0", 24 | "lstream": "~0.0.4", 25 | "mime": "~2.4.4", 26 | "moment": "^2.22.2", 27 | "once": "~1.4.0", 28 | "path-platform": "~0.0.1", 29 | "pretty-bytes": "^1.0.3", 30 | "progbar": "^1.2.1", 31 | "readable-stream": "~1.1.9", 32 | "restify-clients": "~1.6.0", 33 | "showdown": "~1.9.1", 34 | "smartdc-auth": "^2.6.0", 35 | "strsplit": "1.0.0", 36 | "tar": "~2.2.1", 37 | "uuid": "~2.0.2", 38 | "vasync": "^1.6.4", 39 | "verror": "^1.6.1", 40 | "watershed": "^0.3.1" 41 | }, 42 | "devDependencies": { 43 | "forkexec": "^1.0.0", 44 | "semver": "^6.3.0", 45 | "tap": "^12.7.0" 46 | }, 47 | "directories": { 48 | "bin": "./bin", 49 | "lib": "./lib", 50 | "man": "./man/man1" 51 | }, 52 | "engines": { 53 | "node": ">=6" 54 | }, 55 | "license": "MIT" 56 | } 57 | -------------------------------------------------------------------------------- /share/bg_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonDataCenter/node-manta/14d4442250f1bff9aebdb2887c344e762a7445d6/share/bg_graph.png -------------------------------------------------------------------------------- /share/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | color: #333; 10 | background: #f8f8ff 11 | } 12 | 13 | pre .comment, 14 | pre .template_comment, 15 | pre .diff .header, 16 | pre .javadoc { 17 | color: #998; 18 | font-style: italic 19 | } 20 | 21 | pre .keyword, 22 | pre .css .rule .keyword, 23 | pre .winutils, 24 | pre .javascript .title, 25 | pre .nginx .title, 26 | pre .subst, 27 | pre .request, 28 | pre .status { 29 | color: #333; 30 | font-weight: bold 31 | } 32 | 33 | pre .number, 34 | pre .hexcolor, 35 | pre .ruby .constant { 36 | color: #099; 37 | } 38 | 39 | pre .string, 40 | pre .tag .value, 41 | pre .phpdoc, 42 | pre .tex .formula { 43 | color: #d14 44 | } 45 | 46 | pre .title, 47 | pre .id { 48 | color: #900; 49 | font-weight: bold 50 | } 51 | 52 | pre .javascript .title, 53 | pre .lisp .title, 54 | pre .clojure .title, 55 | pre .subst { 56 | font-weight: normal 57 | } 58 | 59 | pre .class .title, 60 | pre .haskell .type, 61 | pre .vhdl .literal, 62 | pre .tex .command { 63 | color: #458; 64 | font-weight: bold 65 | } 66 | 67 | pre .tag, 68 | pre .tag .title, 69 | pre .rules .property, 70 | pre .django .tag .keyword { 71 | color: #000080; 72 | font-weight: normal 73 | } 74 | 75 | pre .attribute, 76 | pre .variable, 77 | pre .lisp .body { 78 | color: #008080 79 | } 80 | 81 | pre .regexp { 82 | color: #009926 83 | } 84 | 85 | pre .class { 86 | color: #458; 87 | font-weight: bold 88 | } 89 | 90 | pre .symbol, 91 | pre .ruby .symbol .string, 92 | pre .lisp .keyword, 93 | pre .tex .special, 94 | pre .prompt { 95 | color: #990073 96 | } 97 | 98 | pre .built_in, 99 | pre .lisp .title, 100 | pre .clojure .built_in { 101 | color: #0086b3 102 | } 103 | 104 | pre .preprocessor, 105 | pre .pi, 106 | pre .doctype, 107 | pre .shebang, 108 | pre .cdata { 109 | color: #999; 110 | font-weight: bold 111 | } 112 | 113 | pre .deletion { 114 | background: #fdd 115 | } 116 | 117 | pre .addition { 118 | background: #dfd 119 | } 120 | 121 | pre .diff .change { 122 | background: #0086b3 123 | } 124 | 125 | pre .chunk { 126 | color: #aaa 127 | } 128 | -------------------------------------------------------------------------------- /test/integration/corpus/259-emptydir.tar: -------------------------------------------------------------------------------- 1 | emptydir/000755 000766 000024 00000000000 12733115753 014664 5ustar00Michael.Zellerstaff000000 000000 -------------------------------------------------------------------------------- /test/integration/corpus/tar1.tar: -------------------------------------------------------------------------------- 1 | subdir1/000755 000766 000024 00000000000 12733047730 014377 5ustar00Michael.Zellerstaff000000 000000 subdir1/test.txt000644 000766 000024 00000000030 12733047730 016110 0ustar00Michael.Zellerstaff000000 000000 jumps over the lazy dog 2 | test.txt000644 000766 000024 00000000024 12733050451 014534 0ustar00Michael.Zellerstaff000000 000000 the quick brown fox 3 | -------------------------------------------------------------------------------- /test/integration/mjob-simple.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | * Copyright 2022 MNX Cloud, Inc. 4 | */ 5 | 6 | /* 7 | * A very simple mjob test: 8 | * 9 | * mjob create --close -or date 10 | */ 11 | 12 | var assert = require('assert-plus'); 13 | var path = require('path'); 14 | var spawn = require('child_process').spawn; 15 | var test = require('tap').test; 16 | var testutils = require('../lib/utils'); 17 | 18 | var logging = require('../lib/logging'); 19 | 20 | 21 | // ---- globals 22 | 23 | var log = logging.createLogger(); 24 | var MJOB = path.resolve(__dirname, '../../bin/mjob'); 25 | 26 | var mantaVersion = testutils.mantaVersion(log); 27 | 28 | var testOpts = { 29 | skip: mantaVersion !== '1' && 30 | 'this Manta does not support jobs' 31 | }; 32 | 33 | // ---- helper functions 34 | 35 | /* 36 | * For some reason that I don't want to chase right now, running the following 37 | * hangs: 38 | * exec('.../mjob create --close -or date', function (err, o, e) { ... }); 39 | * I don't think that should hang. I'm *guessing* that mjob is keeping 40 | * stdin open, but with '--close' it shouldn't be. 41 | * 42 | * So we'll wrap it up using spawn (explicitly closing stdin). 43 | */ 44 | function mjobExec(args, opts, cb) { 45 | assert.arrayOfString(args, 'args'); 46 | if (cb === undefined) { 47 | cb = opts; 48 | opts = {}; 49 | } 50 | assert.object(opts, 'opts'); 51 | assert.func(cb, 'cb'); 52 | 53 | var p = spawn(MJOB, args, opts); 54 | 55 | var stdoutChunks = []; 56 | p.stdout.on('data', function (chunk) { stdoutChunks.push(chunk); }); 57 | 58 | var stderrChunks = []; 59 | p.stderr.on('data', function (chunk) { stderrChunks.push(chunk); }); 60 | 61 | p.on('close', function (code) { 62 | var err = (code 63 | ? new Error('mjob error: exit status ' + code) 64 | : null); 65 | log.trace({err: err, args: args}, 'mjobExec: complete'); 66 | cb(err, stdoutChunks.join(''), stderrChunks.join('')); 67 | }); 68 | 69 | p.stdin.end(); 70 | } 71 | 72 | 73 | // ---- tests 74 | 75 | /* 76 | * Note the usage of '-or "echo hello"' cuddled like that is ensuring we aren't 77 | * hitting . 78 | */ 79 | test('mjob create --close -or "echo hello"', testOpts, function (t) { 80 | var args = ['create', '--close', '-or', 'echo hello']; 81 | mjobExec(args, function (err, stdout, stderr) { 82 | t.ifError(err, err); 83 | t.equal(stderr, '', 'stderr is empty: ' + stderr); 84 | t.equal(stdout, 'hello\n', 'stdout mismatch'); 85 | t.end(); 86 | }); 87 | }); 88 | -------------------------------------------------------------------------------- /test/integration/mmkdir.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | * Copyright 2022 MNX Cloud, Inc. 4 | */ 5 | 6 | /* 7 | * Test the "mmkdir" command. 8 | */ 9 | 10 | var assert = require('assert-plus'); 11 | var forkExecWait = require('forkexec').forkExecWait; 12 | var fs = require('fs'); 13 | var libuuid = require('uuid'); 14 | var path = require('path'); 15 | var test = require('tap').test; 16 | var vasync = require('vasync'); 17 | var sprintf = require('extsprintf').sprintf; 18 | 19 | var logging = require('../lib/logging'); 20 | 21 | 22 | var log = logging.createLogger(); 23 | 24 | var BINDIR = path.resolve(__dirname, '../../bin'); 25 | var MMKDIR = path.resolve(BINDIR, 'mmkdir'); 26 | var MRM = path.resolve(BINDIR, 'mrm'); 27 | var MINFO = path.resolve(BINDIR, 'minfo'); 28 | 29 | var TESTDIR = sprintf('/%s/stor/node-manta-test-mput-%s', 30 | process.env.MANTA_USER || 'admin', 31 | libuuid.v4().split('-')[0]); 32 | 33 | var testOpts = { 34 | skip: !process.env.MANTA_TEST_ROLE && 'MANTA_TEST_ROLE envvar not set' 35 | }; 36 | 37 | 38 | // ---- tests 39 | 40 | /* 41 | * Create a directory using the role-tag option and verify the role-tag header 42 | * is set on the object. This verifies the fix for 43 | * https://github.com/TritonDataCenter/node-manta/issues/333. This test requires 44 | * a role to be configured in triton to work properly so it is condtional 45 | * upon the user setting MANTA_TEST_ROLE in the environment. 46 | */ 47 | test('mmkdir with role-tag', testOpts, function (suite) { 48 | suite.test('mmkdir with --role-tag option', function (t) { 49 | // Expect the role-tag header 50 | var role = process.env.MANTA_TEST_ROLE; 51 | var expectedHeader = 'role-tag: ' + role; 52 | 53 | var argv1 = [ 54 | MMKDIR, 55 | '--role-tag', 56 | role, 57 | TESTDIR 58 | ]; 59 | 60 | var argv2 = [ 61 | MINFO, 62 | TESTDIR 63 | ]; 64 | 65 | forkExecWait({ 66 | argv: argv1 67 | }, function (err, info) { 68 | t.ifError(err, err); 69 | 70 | t.equal(info.stderr, '', 'no stderr'); 71 | 72 | forkExecWait({ 73 | argv: argv2 74 | }, function (err2, info2) { 75 | t.ifError(err2, err2); 76 | t.equal(info2.stderr, '', 'no stderr'); 77 | 78 | var headerIndex = info2.stdout.indexOf(expectedHeader); 79 | t.notEqual(headerIndex, -1, 80 | 'minfo response contains header'); 81 | 82 | t.end(); 83 | }); 84 | }); 85 | }); 86 | 87 | suite.test('cleanup: rm test directory ' + TESTDIR, function (t) { 88 | // Sanity checks that we don't `mrm -r` a non-test dir. 89 | assert.ok(TESTDIR); 90 | assert.ok(TESTDIR.indexOf('node-manta-test') !== -1); 91 | 92 | forkExecWait({ argv: [ MRM, '-r', TESTDIR ]}, function (err) { 93 | t.ifError(err, err); 94 | t.end(); 95 | }); 96 | }); 97 | 98 | suite.end(); 99 | }); 100 | -------------------------------------------------------------------------------- /test/integration/mrmdir.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | */ 4 | 5 | /* 6 | * Test the "mrmdir" command. 7 | */ 8 | 9 | var assert = require('assert-plus'); 10 | var forkExecWait = require('forkexec').forkExecWait; 11 | var libuuid = require('uuid'); 12 | var path = require('path'); 13 | var test = require('tap').test; 14 | var vasync = require('vasync'); 15 | var sprintf = require('extsprintf').sprintf; 16 | 17 | var utils = require('../lib/utils'); 18 | 19 | var BINDIR = path.resolve(__dirname, '../../bin'); 20 | var MMKDIR = path.resolve(BINDIR, 'mmkdir'); 21 | var MRM = path.resolve(BINDIR, 'mrm'); 22 | var MRMDIR = path.resolve(BINDIR, 'mrmdir'); 23 | 24 | var TESTDIR = sprintf('/%s/stor/node-manta-test-mrmdir-%s', 25 | process.env.MANTA_USER || 'admin', 26 | libuuid.v4().split('-')[0]); 27 | 28 | var NUMSUBDIRS = 5; 29 | var SUBDIRS = []; 30 | for (var i = 0; i < NUMSUBDIRS; i++) { 31 | SUBDIRS.push(path.join(TESTDIR, i.toString())); 32 | } 33 | 34 | 35 | // ---- tests 36 | 37 | test('setup: create test tree at ' + TESTDIR, function (t) { 38 | vasync.pipeline({funcs: [ 39 | function (_, cb) { 40 | // create the test directory 41 | forkExecWait({ 42 | argv: [MMKDIR, TESTDIR] 43 | }, cb); 44 | }, 45 | function (_, cb) { 46 | // create sub directories 47 | forkExecWait({ 48 | argv: [MMKDIR].concat(SUBDIRS) 49 | }, cb); 50 | } 51 | ]}, function (err) { 52 | t.ifError(err, err); 53 | t.end(); 54 | }); 55 | }); 56 | 57 | test('mrmdir (no arguments)', function (t) { 58 | forkExecWait({ 59 | argv: [MRMDIR] 60 | }, function (err, info) { 61 | t.ok(err, 'mrmdir should fail'); 62 | t.ok(/^path required/m.test(info.stderr), 'path required in stderr'); 63 | t.end(); 64 | }); 65 | }); 66 | 67 | test('mrmdir -I fails without tty', function (t) { 68 | forkExecWait({ 69 | argv: [MRMDIR, '-I', TESTDIR] 70 | }, function (err, info) { 71 | t.ok(err, 'mrmdir should fail'); 72 | t.ok(/^stdin must be a tty/m.test(info.stderr), 'stdin must be a tty'); 73 | t.end(); 74 | }); 75 | }); 76 | 77 | test('mrmdir 1 directory', function (t) { 78 | var p = SUBDIRS.pop(); 79 | 80 | forkExecWait({ 81 | argv: [MRMDIR, p] 82 | }, function (err) { 83 | t.ifError(err, err); 84 | t.end(); 85 | }); 86 | }); 87 | 88 | test('remove remaining directories', function (t) { 89 | vasync.pipeline({funcs: [ 90 | function (_, cb) { 91 | utils.mls(TESTDIR, function (err, files) { 92 | if (err) { 93 | cb(err); 94 | return; 95 | } 96 | 97 | t.equal(files.length, SUBDIRS.length, 'remaining dirs'); 98 | cb(); 99 | }); 100 | }, 101 | function (_, cb) { 102 | forkExecWait({ 103 | argv: [MRMDIR].concat(SUBDIRS) 104 | }, cb); 105 | }, 106 | function (_, cb) { 107 | utils.mls(TESTDIR, function (err, list) { 108 | if (err) { 109 | cb(err); 110 | return; 111 | } 112 | 113 | var objects = list.filter(function (o) { 114 | return (o.type === 'object'); 115 | }); 116 | 117 | t.equal(objects.length, 0, '0 remaining objects'); 118 | cb(); 119 | }); 120 | } 121 | ]}, function (err) { 122 | t.ifError(err, err); 123 | t.end(); 124 | }); 125 | }); 126 | 127 | test('ensure test tree is empty', function (t) { 128 | utils.mls(TESTDIR, function (err, list) { 129 | if (err) { 130 | t.ifError(err, err); 131 | t.end(); 132 | return; 133 | } 134 | 135 | t.equal(list.length, 0, '0 remaining entities'); 136 | t.end(); 137 | }); 138 | }); 139 | 140 | test('cleanup: rm test tree ' + TESTDIR, function (t) { 141 | // Sanity checks that we don't `mrm -r` a non-test dir. 142 | assert.ok(TESTDIR); 143 | assert.ok(TESTDIR.indexOf('node-manta-test') !== -1); 144 | 145 | forkExecWait({ argv: [MRM, '-r', TESTDIR]}, function (err) { 146 | t.ifError(err, err); 147 | t.end(); 148 | }); 149 | }); 150 | -------------------------------------------------------------------------------- /test/integration/msign.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Joyent, Inc. 3 | */ 4 | 5 | /* 6 | * Test `msign`. 7 | */ 8 | 9 | var f = require('util').format; 10 | var forkExecWait = require('forkexec').forkExecWait; 11 | var path = require('path'); 12 | var test = require('tap').test; 13 | var url = require('url'); 14 | 15 | 16 | // ---- globals 17 | 18 | var BINDIR = path.resolve(__dirname, '../../bin'); 19 | var MSIGN = path.resolve(BINDIR, 'msign'); 20 | 21 | // This doesn't really matter - msign doesn't check to see if the object exists 22 | var PATH = '~~/stor/foo'; 23 | 24 | 25 | // ---- tests 26 | 27 | test('msign (no arguments)', function (t) { 28 | forkExecWait({ 29 | argv: [MSIGN] 30 | }, function (err, info) { 31 | t.ok(err, 'msign should fail'); 32 | t.ok(/^path required/m.test(info.stderr), 'path required in stderr'); 33 | t.end(); 34 | }); 35 | }); 36 | 37 | test(f('msign %s', PATH), function (t) { 38 | var mantaUrl = process.env.MANTA_URL; 39 | 40 | forkExecWait({ 41 | argv: [MSIGN, PATH] 42 | }, function (err, info) { 43 | t.ifError(err, err); 44 | 45 | // should be a signed URL 46 | var uri = info.stdout.trim(); 47 | 48 | t.ok(uri.length > mantaUrl.length, 'uri.length > mantaUrl.length'); 49 | t.equal(uri.slice(0, mantaUrl.length), mantaUrl, 'base URL correct'); 50 | 51 | // ensure query paramaters are present that we expect 52 | var signed = url.parse(uri, true); 53 | var q = signed.query; 54 | t.ok(q, 'query'); 55 | t.ok(q.signature, 'signature'); 56 | t.ok(q.algorithm, 'algorithm'); 57 | t.ok(q.expires, 'expires'); 58 | t.ok(q.keyId, 'keyId'); 59 | 60 | t.end(); 61 | }); 62 | }); 63 | 64 | test(f('msign -e %s', PATH), function (t) { 65 | // 1 minute from now 66 | var expires = Math.floor(Date.now() / 1000) + 60; 67 | 68 | forkExecWait({ 69 | argv: [MSIGN, '-e', expires.toString(), PATH] 70 | }, function (err, info) { 71 | t.ifError(err, err); 72 | 73 | var uri = info.stdout.trim(); 74 | var signed = url.parse(uri, true); 75 | var q = signed.query; 76 | 77 | t.ok(q, 'query'); 78 | t.equal(Number(q.expires), expires, 'expires'); 79 | 80 | t.end(); 81 | }); 82 | }); 83 | 84 | test(f('msign -E 1h %s', PATH), function (t) { 85 | // 1 hour from now 86 | var expires = Math.floor(Date.now() / 1000) + (1 * 60 * 60); 87 | 88 | forkExecWait({ 89 | argv: [MSIGN, '-E', '1h', PATH] 90 | }, function (err, info) { 91 | t.ifError(err, err); 92 | 93 | var uri = info.stdout.trim(); 94 | var signed = url.parse(uri, true); 95 | var q = signed.query; 96 | 97 | /* 98 | * Because there is some time from when we get the current time in this 99 | * test, to when `msign` gets the current time, it is possible that the 100 | * expires date set by `msign` will be a couple seconds ahead of us, so 101 | * allow for a slight variance. 102 | */ 103 | t.ok(q.expires >= expires, 104 | f('q.expires >= expires (%s >= %s)', q.expires, expires)); 105 | t.ok(q.expires < expires + 30, 106 | f('q.expires < expires + 30 (%s < %s + 30)', q.expires, expires)); 107 | 108 | t.end(); 109 | }); 110 | }); 111 | 112 | // Good arguments 113 | [ 114 | '1s', 115 | '1m', 116 | '1h', 117 | '1d', 118 | '1w', 119 | '1y' 120 | ].forEach(function (expires) { 121 | test(f('msign -E %s %s (good argument)', expires, PATH), function (t) { 122 | forkExecWait({ 123 | argv: [MSIGN, '-E', expires, PATH] 124 | }, function (err, info) { 125 | t.ifError(err, err); 126 | t.end(); 127 | }); 128 | }); 129 | }); 130 | 131 | // Bad arguments 132 | [ 133 | 'foo', 134 | '', 135 | '-5s', 136 | '74q', 137 | '0s', 138 | '0m', 139 | '0h', 140 | '0d', 141 | '0w', 142 | '0y' 143 | ].forEach(function (expires) { 144 | test(f('msign -E %s %s (bad argument)', expires, PATH), function (t) { 145 | forkExecWait({ 146 | argv: [MSIGN, '-E', expires, PATH] 147 | }, function (err, info) { 148 | t.ok(err, 'msign should fail'); 149 | t.ok(/invalid expires: /m.test(info.stderr), 150 | 'invalid expires in stderr'); 151 | t.end(); 152 | }); 153 | }); 154 | }); 155 | 156 | test('msign -E and -e together', function (t) { 157 | forkExecWait({ 158 | argv: [MSIGN, '-E', '1h', '-e', '1234567', PATH] 159 | }, function (err, info) { 160 | t.ok(err, 'msign should fail'); 161 | t.ok(/-e and -E cannot be specified together/m.test(info.stderr), 162 | '-e and -E cannot be specified together in stderr'); 163 | t.end(); 164 | }); 165 | }); 166 | -------------------------------------------------------------------------------- /test/integration/muntar.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | * Copyright 2022 MNX Cloud, Inc. 4 | */ 5 | 6 | var exec = require('child_process').exec; 7 | var fs = require('fs'); 8 | var path = require('path'); 9 | 10 | var libuuid = require('uuid'); 11 | var MemoryStream = require('readable-stream/passthrough.js'); 12 | var bunyan = require('bunyan'); 13 | var format = require('util').format; 14 | var test = require('tap').test; 15 | var vasync = require('vasync'); 16 | 17 | var logging = require('../lib/logging'); 18 | var manta = require('../../lib'); 19 | 20 | 21 | /* 22 | * Globals 23 | */ 24 | 25 | var client; 26 | var log = logging.createLogger(); 27 | 28 | var ROOT = '/' + (process.env.MANTA_USER || 'admin') + '/stor'; 29 | var PUBLIC = '/' + (process.env.MANTA_USER || 'admin') + '/public'; 30 | var TSTDIR = ROOT + '/node-manta-test-muntar-' + libuuid.v4().split('-')[0]; 31 | 32 | 33 | /* 34 | * Tests 35 | */ 36 | 37 | test('setup', function (t) { 38 | var url = process.env.MANTA_URL || 'http://localhost:8080'; 39 | var user = process.env.MANTA_USER || 'admin'; 40 | 41 | function createClient(signer) { 42 | // `client` is intentionally global. 43 | client = manta.createClient({ 44 | connectTimeout: 1000, 45 | log: log, 46 | rejectUnauthorized: (process.env.MANTA_TLS_INSECURE ? 47 | false : true), 48 | sign: signer, 49 | url: url, 50 | user: user 51 | }); 52 | 53 | t.end(); 54 | } 55 | 56 | if (process.env.MANTA_KEY_ID) { 57 | createClient(manta.cliSigner({ 58 | user: user, 59 | keyId: process.env.MANTA_KEY_ID 60 | })); 61 | } else { 62 | var f = process.env.SSH_KEY || process.env.HOME + '/.ssh/id_rsa'; 63 | var cmd = 'ssh-keygen -l -f ' + 64 | f + ' ' + 65 | '| awk \'{print $2}\''; 66 | fs.readFile(f, 'utf8', function (err, key) { 67 | if (err) { 68 | t.error(err); 69 | t.end(); 70 | return; 71 | } 72 | 73 | exec(cmd, function (err2, stdout, stderr) { 74 | if (err2) { 75 | t.error(err2); 76 | t.end(); 77 | return; 78 | } 79 | createClient(manta.privateKeySigner({ 80 | key: key, 81 | keyId: stdout.replace('\n', ''), 82 | user: user 83 | })); 84 | }); 85 | }); 86 | } 87 | }); 88 | 89 | 90 | var cases = [ 91 | { 92 | tarpath: 'corpus/tar1.tar', 93 | checks: [ 94 | { 95 | path: 'subdir1/', 96 | type: 'application/x-json-stream; type=directory' 97 | }, 98 | { 99 | path: 'subdir1/test.txt', 100 | type: 'text/plain', 101 | size: 24, 102 | md5: 'jio1WnSoM7CbsXjNHfTqwg==' 103 | }, 104 | { 105 | path: 'test.txt', 106 | type: 'text/plain', 107 | size: 20, 108 | md5: 'c6scKv46Y7irTX2ipN2zUQ==' 109 | } 110 | ] 111 | }, 112 | { 113 | // Skipping, see 114 | // 115 | skip: true, 116 | tarpath: 'corpus/259-emptydir.tar', 117 | checks: [ 118 | { path: 'emptydir/', type: 'directory' } 119 | ] 120 | } 121 | ]; 122 | 123 | cases.forEach(function (c, i) { 124 | if (c.skip) { 125 | return; 126 | } 127 | 128 | var name = format('muntar case %d: %s', i, c.tarpath); 129 | var cmd = format('%s -f %s %s', path.resolve(__dirname, '../../bin/muntar'), 130 | path.resolve(__dirname, c.tarpath), TSTDIR); 131 | log.debug({caseName: name, cmd: cmd}, 'run case'); 132 | 133 | test(name, function (t) { 134 | exec(cmd, function (err, stdout, stderr) { 135 | t.ifError(err); 136 | vasync.forEachPipeline({ 137 | func: function checkOne(check, cb) { 138 | var mpath = path.join(TSTDIR, check.path); 139 | client.info(mpath, function (err2, info) { 140 | t.ifError(err2, err2); 141 | if (!err2) { 142 | t.equal(info.type, check.type, format( 143 | '%s is expected type (%s): %s', 144 | mpath, check.type, info.type)); 145 | if (check.size) { 146 | t.equal(info.size, check.size, format( 147 | '%s is expected size (%s): %s', 148 | mpath, check.size, info.size)); 149 | } 150 | if (check.md5) { 151 | t.equal(info.md5, check.md5, format( 152 | '%s is expected md5 (%s): %s', 153 | mpath, check.md5, info.md5)); 154 | } 155 | } 156 | cb(); 157 | }); 158 | }, 159 | inputs: c.checks 160 | }, function (err3, results) { 161 | client.rmr(TSTDIR, function (rmErr) { 162 | t.ifError(rmErr, rmErr); 163 | t.end(); 164 | }); 165 | }); 166 | }); 167 | }); 168 | }); 169 | 170 | 171 | test('teardown', function (t) { 172 | if (client) { 173 | client.close(); 174 | client = null; 175 | } 176 | t.end(); 177 | }); 178 | -------------------------------------------------------------------------------- /test/lib/logging.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Joyent, Inc. 3 | */ 4 | 5 | /* 6 | * A common logger setup for test files. 7 | */ 8 | 9 | var assert = require('assert-plus'); 10 | var bunyan = require('bunyan'); 11 | var path = require('path'); 12 | var restifyClients = require('restify-clients'); 13 | 14 | function createLogger() { 15 | return (bunyan.createLogger({ 16 | name: path.basename(process.argv[1]), 17 | serializers: restifyClients.bunyan.serializers, 18 | src: true, 19 | streams: [ 20 | { 21 | level: (process.env.TEST_LOG_LEVEL || 'info'), 22 | stream: process.stderr 23 | } 24 | ] 25 | })); 26 | } 27 | 28 | module.exports = { 29 | createLogger: createLogger 30 | }; 31 | -------------------------------------------------------------------------------- /test/lib/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Joyent, Inc. 3 | * Copyright 2022 MNX Cloud, Inc. 4 | */ 5 | 6 | var assert = require('assert-plus'); 7 | var execFileSync = require('child_process').execFileSync; 8 | var format = require('util').format; 9 | var os = require('os'); 10 | var path = require('path'); 11 | 12 | var forkExecWait = require('forkexec').forkExecWait; 13 | var VError = require('verror'); 14 | 15 | var BINDIR = path.resolve(__dirname, '../../bin'); 16 | var MLS = path.resolve(BINDIR, 'mls'); 17 | var MMPU = path.resolve(BINDIR, 'mmpu'); 18 | var MINFO = path.resolve(BINDIR, 'minfo'); 19 | 20 | /* 21 | * Call `mls` on the given path and return a JSON array of objects for each 22 | * object/directory found, or an error 23 | */ 24 | function mls(p, cb) { 25 | assert.string(p, 'p'); 26 | assert.func(cb, 'cb'); 27 | 28 | forkExecWait({ 29 | argv: [MLS, '-j', p] 30 | }, function (err, info) { 31 | if (err) { 32 | cb(err); 33 | return; 34 | } 35 | 36 | var out = info.stdout.trim(); 37 | if (out.length === 0) { 38 | cb(null, []); 39 | return; 40 | } 41 | 42 | var files; 43 | try { 44 | files = out.split('\n').map(function (j) { 45 | return (JSON.parse(j)); 46 | }); 47 | } catch (e) { 48 | cb(e); 49 | return; 50 | } 51 | 52 | cb(null, files); 53 | }); 54 | } 55 | 56 | 57 | /* 58 | * *Synchronously* determine if this Manta supports MPU (multipart upload). 59 | * Doing so synchronously allows one to use the value for tap test() options. 60 | * 61 | * Limitation: This (a) creates a multipart upload object and (b) uses string 62 | * comparison of an error message to determine support. It would be nicer to 63 | * have a lighter-weight and crisper mechanism to check for support. Would 64 | * the presence of `uploads/` in `mls` output suffice? 65 | * 66 | * This returns `true` or `false`. If something unexpected happens, it throws 67 | * an error. 68 | */ 69 | function isMpuEnabledSync(log) { 70 | assert.string(process.env.MANTA_USER, 'process.env.MANTA_USER'); 71 | assert.object(log, 'log'); 72 | 73 | var NOT_SUPPORTED_MSG = 'mmpu create: error: multipart upload is ' + 74 | 'not supported for this Manta deployment'; 75 | 76 | var checkPath = format('/%s/stor/node-manta-is-mmpu-enabled-%s', 77 | process.env.MANTA_USER, os.hostname()); 78 | var uploadUuid; 79 | try { 80 | uploadUuid = execFileSync(MMPU, ['create', checkPath], { 81 | stdio: 'pipe', // to not emit stderr to parent's stderr 82 | encoding: 'utf8' 83 | }).trim(); 84 | } catch (createErr) { 85 | if (createErr.stderr.trim() === NOT_SUPPORTED_MSG) { 86 | return (false); 87 | } else { 88 | throw new VError(createErr, 89 | 'could not determine whether MPU is supported by this Manta'); 90 | } 91 | } 92 | log.trace({uploadUuid: uploadUuid, checkPath: checkPath}, 93 | 'created test MPU upload'); 94 | 95 | // If we get here, then MPU is supported. Before returning let's abort 96 | // the upload we started. 97 | try { 98 | execFileSync(MMPU, ['abort', uploadUuid], {encoding: 'utf8'}); 99 | } catch (abortErr) { 100 | log.trace({err: abortErr, uploadUuid: uploadUuid}, 101 | 'silently ignoring attempt to abort test MPU upload'); 102 | } 103 | 104 | return (true); 105 | } 106 | 107 | function mantaVersion(log) { 108 | assert.string(process.env.MANTA_USER, 'process.env.MANTA_USER'); 109 | assert.object(log, 'log'); 110 | 111 | var checkPath = format('/%s/stor', process.env.MANTA_USER); 112 | var info = JSON.parse(execFileSync(MINFO, ['-j', checkPath], { 113 | stdio: 'pipe', // to not emit stderr to parent's stderr 114 | encoding: 'utf8' 115 | }).trim()); 116 | log.trace(JSON.stringify(info)); 117 | var server = info.server; 118 | if (server === 'Manta') { 119 | return ('1'); 120 | } else { 121 | var s = server.split('/'); 122 | return (s[1]); 123 | } 124 | } 125 | 126 | 127 | module.exports = { 128 | isMpuEnabledSync: isMpuEnabledSync, 129 | mantaVersion: mantaVersion, 130 | mls: mls 131 | }; 132 | -------------------------------------------------------------------------------- /test/unit/completion.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | */ 4 | 5 | /* 6 | * Test that the bash completion generation exits zero and emits output 7 | * that looks somewhat like Bash completion code. 8 | */ 9 | 10 | var fs = require('fs'); 11 | var path = require('path'); 12 | 13 | var forkExecWait = require('forkexec').forkExecWait; 14 | var test = require('tap').test; 15 | 16 | /* 17 | * Globals 18 | */ 19 | 20 | var binDir = path.resolve(__dirname, '../../bin'); 21 | 22 | /* 23 | * Tests 24 | */ 25 | 26 | fs.readdirSync(binDir).forEach(function (name) { 27 | // node-manta#327 completion tests could ignore hidden files 28 | if (name[0] === '.') { 29 | return; 30 | } 31 | 32 | var cmd = path.join(binDir, name); 33 | test(name + ' --completion', function (t) { 34 | forkExecWait({ 35 | argv: [cmd, '--completion'] 36 | }, function (err, info) { 37 | t.ifError(err); 38 | t.equal(info.stderr, '', 39 | 'no stderr output from "' + name + ' --completion"'); 40 | t.ok(/COMPREPLY/.test(info.stdout), 'stdout from "' + name + 41 | ' --completion" looks like Bash completion code'); 42 | t.end(); 43 | }); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /test/unit/options.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | * Copyright 2022 MNX Cloud, Inc. 4 | */ 5 | 6 | /* 7 | * Test the CLI options for different commands 8 | */ 9 | 10 | var forkExecWait = require('forkexec').forkExecWait; 11 | var path = require('path'); 12 | var test = require('tap').test; 13 | var vasync = require('vasync'); 14 | 15 | var BINDIR = path.resolve(__dirname, '../../bin'); 16 | 17 | const ALLCMDS = [ 'mchattr', 'mchmod', 'mfind', 'mget', 'minfo', 18 | 'mln', 'mlogin', 'mls', 'mmd5', 'mmkdir', 'mput', 19 | 'mrm', 'mrmdir', 'msign', 'muntar' 20 | ]; 21 | 22 | // ---- helper functions 23 | 24 | function resolveCommand(cmd) { 25 | var r = path.resolve(BINDIR, cmd); 26 | return (r); 27 | } 28 | 29 | 30 | function forkCmdWithOption(input, option, cb) { 31 | forkExecWait({ 32 | argv: [ input.cmd, 33 | option 34 | ], 35 | env: { MANTA_URL: '', 36 | PATH: process.env.PATH 37 | } 38 | }, function (err, info) { 39 | const t = input.test; 40 | const urlArgMsg = 'url is a required argument'; 41 | 42 | t.ifError(err, err); 43 | t.equal(info.stderr.indexOf(urlArgMsg), -1); 44 | 45 | if (cb) { 46 | cb(); 47 | } 48 | 49 | return; 50 | }); 51 | } 52 | 53 | 54 | function forkHelpOption(cmd, cb) { 55 | forkCmdWithOption(cmd, '--help', cb); 56 | } 57 | 58 | 59 | function forkVersionOption(cmd, cb) { 60 | forkCmdWithOption(cmd, '--version', cb); 61 | } 62 | 63 | 64 | function inputObject(testObj) { 65 | const fn = function mkObject(command) { 66 | const resolvedCommand = resolveCommand(command); 67 | return { cmd: resolvedCommand, 68 | test: testObj 69 | }; 70 | }; 71 | 72 | return (fn); 73 | } 74 | 75 | 76 | // ---- tests 77 | 78 | /* 79 | * Test that specifying the --help option with no manta URL specified does not 80 | * result in a warning about the missing URL. This verifies the fix for 81 | * https://github.com/TritonDataCenter/node-manta/issues/328. 82 | */ 83 | test('Run commands with --help with no manta URL specified', function (t) { 84 | vasync.forEachPipeline({ 85 | inputs: ALLCMDS.map(inputObject(t)), 86 | func: forkHelpOption 87 | }, function (err, results) { 88 | t.end(); 89 | }); 90 | }); 91 | 92 | 93 | /* 94 | * Test that specifying the --version option with no manta URL specified does 95 | * not result in a warning about the missing URL. This verifies the fix for 96 | * https://github.com/TritonDataCenter/node-manta/issues/328. 97 | */ 98 | test('Run commands with --version with no manta URL specified', function (t) { 99 | vasync.forEachPipeline({ 100 | inputs: ALLCMDS.map(inputObject(t)), 101 | func: forkVersionOption 102 | }, function (err, results) { 103 | t.end(); 104 | }); 105 | }); 106 | -------------------------------------------------------------------------------- /test/unit/trackmarker.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | */ 4 | 5 | var test = require('tap').test; 6 | var mod_trackmarker = require('../../lib/trackmarker'); 7 | 8 | 9 | var SCENARIOS = [ 10 | { 11 | type: 'name', 12 | name: 'pages by name', 13 | pages: [ 14 | [ 15 | { name: 'a', mtime: '1000' }, 16 | { name: 'b', mtime: '2000' }, 17 | { name: 'c', mtime: '4000' }, 18 | { name: 'd', mtime: '1000' } 19 | ], 20 | [ 21 | { name: 'd', mtime: '1000' }, 22 | { name: 'e', mtime: '8000' }, 23 | { name: 'f', mtime: '2000' }, 24 | { name: 'g', mtime: '2000' } 25 | ], 26 | [ 27 | { name: 'g', mtime: '2000' } 28 | ] 29 | ], 30 | results: [ 'a', 'b', 'c', 'd', 'e', 'f', 'g' ], 31 | counts: [ 32 | { incl: 1, skip: 0 }, 33 | { incl: 2, skip: 0 }, 34 | { incl: 3, skip: 0 }, 35 | { incl: 4, skip: 0 }, 36 | 37 | { incl: 0, skip: 1 }, 38 | { incl: 1, skip: 1 }, 39 | { incl: 2, skip: 1 }, 40 | { incl: 3, skip: 1 }, 41 | 42 | { incl: 0, skip: 1 }, 43 | { incl: 0, skip: 1, end: true } 44 | ] 45 | }, 46 | { 47 | type: 'mtime', 48 | name: 'pages by mtime', 49 | pages: [ 50 | [ 51 | { name: 'a', mtime: '1000' }, 52 | { name: 'd', mtime: '1000' }, 53 | { name: 'b', mtime: '2000' }, 54 | { name: 'f', mtime: '2000' } 55 | ], 56 | [ 57 | { name: 'b', mtime: '2000' }, 58 | { name: 'f', mtime: '2000' }, 59 | { name: 'g', mtime: '2000' }, 60 | { name: 'c', mtime: '4000' } 61 | ], 62 | [ 63 | { name: 'c', mtime: '4000' }, 64 | { name: 'h', mtime: '4000' }, 65 | { name: 'j', mtime: '5000' }, 66 | { name: 'i', mtime: '6000' } 67 | ] 68 | ], 69 | results: [ 'a', 'd', 'b', 'f', 'g', 'c', 'h', 'j', 'i' ], 70 | counts: [ 71 | { incl: 1, skip: 0 }, 72 | { incl: 2, skip: 0 }, 73 | { incl: 3, skip: 0 }, 74 | { incl: 4, skip: 0 }, 75 | 76 | { incl: 0, skip: 1 }, 77 | { incl: 0, skip: 2 }, 78 | { incl: 1, skip: 2 }, 79 | { incl: 2, skip: 2 }, 80 | 81 | { incl: 0, skip: 1 }, 82 | { incl: 1, skip: 1 }, 83 | { incl: 2, skip: 1 }, 84 | { incl: 3, skip: 1 }, 85 | { incl: 3, skip: 1, end: true } 86 | ] 87 | } 88 | ]; 89 | 90 | function check_scenario(t, scenario, skip_check_number, tm, results) { 91 | var line = scenario.counts[skip_check_number]; 92 | 93 | t.strictEqual(tm.countIncluded(), 94 | line.incl, 95 | 'included count (step ' + skip_check_number + ')'); 96 | t.strictEqual(tm.countSkipped(), 97 | line.skip, 98 | 'skipped count (step ' + skip_check_number + ')'); 99 | t.strictEqual(tm.countTotal(), 100 | tm.countIncluded() + tm.countSkipped(), 101 | 'included and skipped match with total'); 102 | 103 | if (results) { 104 | t.strictEqual(line.end, true, 'at end of scenario'); 105 | t.deepEqual(results, scenario.results, 'expected results'); 106 | } 107 | } 108 | 109 | SCENARIOS.forEach(function (scenario) { 110 | test(scenario.name, function (t) { 111 | var tm = mod_trackmarker.createTrackMarker(scenario.type); 112 | 113 | var results = []; 114 | var count = 0; 115 | 116 | scenario.pages.forEach(function (page, pageidx) { 117 | tm.startPage(); 118 | page.forEach(function (row, rowidx) { 119 | var skip = tm.skipCheck(row.name, row.mtime); 120 | 121 | check_scenario(t, scenario, count++, tm); 122 | 123 | if (!skip) { 124 | results.push(row.name); 125 | } 126 | }); 127 | }); 128 | check_scenario(t, scenario, count++, tm, results); 129 | t.end(); 130 | }); 131 | }); 132 | -------------------------------------------------------------------------------- /test/unit/utils.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Joyent, Inc. 3 | */ 4 | 5 | var f = require('util').format; 6 | 7 | var test = require('tap').test; 8 | 9 | var manta = require('../..'); 10 | 11 | 12 | // a name on the left should match the name on the right 13 | // when escaped. 14 | test('escapePath encoding', function (t) { 15 | var tests = [ 16 | // simple tests, no effect 17 | ['foo', 'foo'], 18 | ['bar', 'bar'], 19 | 20 | // special characters 21 | ['one\rtwo', 'one\\rtwo'], 22 | ['one\ntwo', 'one\\ntwo'], 23 | ['one\ttwo', 'one\\ttwo'], 24 | 25 | // ANSI escape chars 26 | ['red\x1b[31mcolor', 'red\\u001b[31mcolor'] 27 | ]; 28 | 29 | tests.forEach(function (_test) { 30 | var s = _test[0]; 31 | t.equal(manta.escapePath(s), _test[1]); 32 | }); 33 | t.end(); 34 | }); 35 | 36 | test('prettyBytes', function (t) { 37 | var goodTests = [ 38 | [0, '0'], 39 | [1, '1'], 40 | 41 | [1024, '1K'], 42 | [2048, '2K'], 43 | [2058, '2.01K'], 44 | 45 | [12345, '12.06K'], 46 | [123456, '120.56K'], 47 | [1234567, '1.18M'], 48 | [12345678, '11.77M'], 49 | [123456789, '117.74M'], 50 | [1234567890, '1.15G'], 51 | [12345678901, '11.5G'], 52 | [123456789012, '114.98G'], 53 | [1234567890123, '1.12T'], 54 | 55 | [Math.pow(1024, 0), '1'], 56 | [Math.pow(1024, 1), '1K'], 57 | [Math.pow(1024, 2), '1M'], 58 | [Math.pow(1024, 3), '1G'], 59 | [Math.pow(1024, 4), '1T'] 60 | ]; 61 | goodTests.forEach(function (_test) { 62 | var bytes = _test[0]; 63 | var out = _test[1]; 64 | t.equal(manta.prettyBytes(bytes), out, 65 | f('prettyBytes(%d) == "%s"', bytes, out)); 66 | }); 67 | 68 | var badTests = [ 69 | -1, 70 | NaN, 71 | '', 72 | true, 73 | {}, 74 | [], 75 | new Date() 76 | ]; 77 | badTests.forEach(function (value) { 78 | t.throws(function () { 79 | manta.prettyBytes(value); 80 | }, f('prettyBytes(%j) throws', value)); 81 | }); 82 | t.end(); 83 | }); 84 | -------------------------------------------------------------------------------- /tools/changelog-issue-line: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2018 Joyent, Inc. 4 | # Copyright 2022 MNX Cloud, Inc. 5 | # 6 | # Generate a line for the changelog given a GitHub issue number or Jira 7 | # ticket identifier 8 | 9 | github_issue_re='^[1-9][0-9]*$' 10 | jira_ticket_re='^[A-Z]+-[1-9][0-9]*$' 11 | valid_str_re='^[0-9a-zA-Z_-]+$' 12 | exit_code=0 13 | verbosity=0 14 | 15 | verbose() { 16 | if ((verbosity >= 1)); then 17 | echo '>' "$@" >&2 18 | fi 19 | } 20 | 21 | usage() { 22 | local prog=${0##*/} 23 | cat <<-EOF 24 | Usage: $prog [-hv] [-o ] [-r ] issue# [issue2# issue3# ...] 25 | 26 | Generate a line for the changelog given a GitHub issue number or 27 | Jira ticket identifier 28 | 29 | Options 30 | -h print this message and exit 31 | -o GitHub organization, will try to figure this out if 32 | not given 33 | -r GitHub repository, will try to figure this out if not 34 | given 35 | -v verbose output 36 | EOF 37 | } 38 | 39 | while getopts 'ho:r:v' option; do 40 | case "$option" in 41 | h) usage; exit 0;; 42 | o) org=$OPTARG;; 43 | r) repo=$OPTARG;; 44 | v) ((verbosity++));; 45 | *) usage >&2; exit 1;; 46 | esac 47 | done 48 | shift "$((OPTIND - 1))" 49 | 50 | # ensure json is present 51 | if ! json --version &>/dev/null; then 52 | echo 'json must be installed' >&2 53 | exit 1 54 | fi 55 | 56 | # ensure at least one issue passed 57 | if [[ -z $1 ]]; then 58 | usage >&2 59 | exit 1 60 | fi 61 | 62 | # figure out what data we need to continue (ie. what type of issues were given) 63 | # by the user 64 | github_issue_seen=false 65 | jira_ticket_seen=false 66 | for issue in "$@"; do 67 | if $github_issue_seen && $jira_ticket_seen; then 68 | # stop here since we've seen it all 69 | verbose 'all issue types seen, moving on' 70 | break; 71 | fi 72 | 73 | if [[ $issue =~ $github_issue_re ]]; then 74 | verbose "github issue seen: $issue" 75 | github_issue_seen=true 76 | elif [[ $issue =~ $jira_ticket_re ]]; then 77 | verbose "jira ticket seen: $issue" 78 | jira_ticket_seen=true 79 | fi 80 | done 81 | 82 | if $github_issue_seen; then 83 | # find repo or org if not passed in via CLI opts 84 | if [[ -z $repo || -z $org ]]; then 85 | verbose 'attempting to discover github repo or org' 86 | top=$(git rev-parse --show-toplevel) 87 | if [[ -z $top ]]; then 88 | echo 'git top level could not be determined' >&2 89 | exit 1 90 | fi 91 | 92 | pkg=$top/package.json 93 | url=$(json -f "$pkg" repository.url) 94 | if [[ -z $url ]]; then 95 | echo "couldn't read repository.url from $pkg" >&2 96 | exit 1 97 | fi 98 | verbose "found url '$url' in '$pkg'" 99 | 100 | IFS='/:' read -a parts <<< "$url" 101 | 102 | if [[ -z $repo ]]; then 103 | repo=${parts[-1]} 104 | repo=${repo%.git} 105 | fi 106 | 107 | if [[ -z $org ]]; then 108 | org=${parts[-2]} 109 | fi 110 | fi 111 | 112 | # validate repo 113 | if ! [[ -n $repo && $repo =~ $valid_str_re ]]; then 114 | echo "invalid repo: '$repo'" >&2 115 | exit 1 116 | fi 117 | 118 | # validate org 119 | if ! [[ -n $org && $org =~ $valid_str_re ]]; then 120 | echo "invalid org: '$org'" >&2 121 | exit 1 122 | fi 123 | 124 | verbose "org $org, repo $repo" 125 | fi 126 | 127 | # loop issues passed as arguments 128 | for issue in "$@"; do 129 | if [[ $issue =~ $github_issue_re ]]; then 130 | name="$org/$repo#$issue" 131 | issueurl="https://github.com/$org/$repo/issues/$issue" 132 | apiurl="https://api.github.com/repos/$org/$repo/issues/$issue" 133 | 134 | verbose "GET $apiurl" 135 | 136 | title=$(curl -sSL "$apiurl" | json title) 137 | if (($? != 0)) || [[ -z $title ]]; then 138 | echo "failed to find title for $name" >&2 139 | exit_code=1 140 | continue 141 | fi 142 | 143 | echo "- [#$issue]($issueurl) $title" 144 | elif [[ $issue =~ $jira_ticket_re ]]; then 145 | jsonurl="https://smartos.org/bugview/json/$issue" 146 | 147 | verbose "GET $jsonurl" 148 | 149 | json=$(curl -sSL "$jsonurl") 150 | if (($? != 0)) || [[ -z $json ]] || ! json -nq <<< "$json"; then 151 | echo "failed to get data for $issue" >&2 152 | exit_code=1 153 | continue 154 | fi 155 | 156 | summary=$(json summary <<< "$json") 157 | weburl=$(json web_url <<< "$json") 158 | 159 | if [[ -z $summary || -z $weburl ]]; then 160 | echo "failed to get summary or url for $issue" >&2 161 | exit_code=1 162 | continue 163 | fi 164 | 165 | echo "- [$issue]($weburl) $summary" 166 | else 167 | echo "argument not recognized: '$issue'" >&2 168 | exit_code=1 169 | continue 170 | fi 171 | done 172 | 173 | exit "$exit_code" 174 | -------------------------------------------------------------------------------- /tools/jsstyle.conf: -------------------------------------------------------------------------------- 1 | indent=4 2 | doxygen 3 | unparenthesized-return=1 4 | blank-after-start-comment=0 -------------------------------------------------------------------------------- /tools/mk/Makefile.defs: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile -*- 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this 5 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | # 7 | 8 | # 9 | # Copyright (c) 2014, Joyent, Inc. 10 | # Copyright 2022 MNX Cloud, Inc. 11 | # 12 | 13 | # 14 | # Makefile.defs: common defines. 15 | # 16 | # NOTE: This makefile comes from the "eng" repo. It's designed to be dropped 17 | # into other repos as-is without requiring any modifications. If you find 18 | # yourself changing this file, you should instead update the original copy in 19 | # eng.git and then update your repo to use the new version. 20 | # 21 | # This makefile defines some useful defines. Include it at the top of 22 | # your Makefile. 23 | # 24 | # Definitions in this Makefile: 25 | # 26 | # TOP The absolute path to the project directory. The top dir. 27 | # BRANCH The current git branch. 28 | # TIMESTAMP The timestamp for the build. This can be set via 29 | # the TIMESTAMP envvar (used by MG-based builds). 30 | # STAMP A build stamp to use in built package names. 31 | # 32 | 33 | TOP := $(shell pwd) 34 | 35 | # 36 | # Triton-spec'd versioning. 37 | # See "Package Versioning" in Triton's Engineering guide: 38 | # 39 | # 40 | # Need GNU awk for multi-char arg to "-F". 41 | _AWK := $(shell (which gawk >/dev/null && echo gawk) \ 42 | || (which nawk >/dev/null && echo nawk) \ 43 | || echo awk) 44 | BRANCH := $(shell git symbolic-ref HEAD | $(_AWK) -F/ '{print $$3}') 45 | ifeq ($(TIMESTAMP),) 46 | TIMESTAMP := $(shell date -u "+%Y%m%dT%H%M%SZ") 47 | endif 48 | _GITDESCRIBE := g$(shell git describe --all --long --dirty | $(_AWK) -F'-g' '{print $$NF}') 49 | STAMP := $(BRANCH)-$(TIMESTAMP)-$(_GITDESCRIBE) 50 | 51 | # node-gyp will print build info useful for debugging with V=1 52 | export V=1 53 | -------------------------------------------------------------------------------- /tools/mk/Makefile.deps: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile -*- 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this 5 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | # 7 | 8 | # 9 | # Copyright (c) 2014, Joyent, Inc. 10 | # 11 | 12 | # 13 | # Makefile.deps: Makefile for including common tools as dependencies 14 | # 15 | # NOTE: This makefile comes from the "eng" repo. It's designed to be dropped 16 | # into other repos as-is without requiring any modifications. If you find 17 | # yourself changing this file, you should instead update the original copy in 18 | # eng.git and then update your repo to use the new version. 19 | # 20 | # This file is separate from Makefile.targ so that teams can choose 21 | # independently whether to use the common targets in Makefile.targ and the 22 | # common tools here. 23 | # 24 | 25 | # 26 | # javascriptlint 27 | # 28 | JSL_EXEC ?= deps/javascriptlint/build/install/jsl 29 | JSL ?= $(JSL_EXEC) 30 | 31 | $(JSL_EXEC): | deps/javascriptlint/.git 32 | cd deps/javascriptlint && make install 33 | 34 | distclean:: 35 | if [[ -f deps/javascriptlint/Makefile ]]; then \ 36 | cd deps/javascriptlint && make clean; \ 37 | fi 38 | 39 | # 40 | # jsstyle 41 | # 42 | JSSTYLE_EXEC ?= deps/jsstyle/jsstyle 43 | JSSTYLE ?= $(JSSTYLE_EXEC) 44 | 45 | $(JSSTYLE_EXEC): | deps/jsstyle/.git 46 | 47 | # 48 | # restdown 49 | # 50 | RESTDOWN_EXEC ?= deps/restdown/bin/restdown 51 | RESTDOWN ?= python $(RESTDOWN_EXEC) 52 | $(RESTDOWN_EXEC): | deps/restdown/.git 53 | 54 | EXTRA_DOC_DEPS ?= 55 | -------------------------------------------------------------------------------- /tools/mk/Makefile.node_deps.defs: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile -*- 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this 5 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | # 7 | 8 | # 9 | # Copyright (c) 2014, Joyent, Inc. 10 | # 11 | 12 | # 13 | # Makefile.node_deps.defs: Makefile for including npm modules whose sources 14 | # reside inside the repo. This should NOT be used for modules in the npm 15 | # public repo or modules that could be specified with git SHAs. 16 | # 17 | # NOTE: This makefile comes from the "eng" repo. It's designed to be dropped 18 | # into other repos as-is without requiring any modifications. If you find 19 | # yourself changing this file, you should instead update the original copy in 20 | # eng.git and then update your repo to use the new version. 21 | # 22 | 23 | # 24 | # This Makefile takes as input the following make variable: 25 | # 26 | # REPO_MODULES List of relative paths to node modules (i.e., npm 27 | # packages) inside this repo. For example: 28 | # src/node-canative, where there's a binary npm package 29 | # in src/node-canative. 30 | # 31 | # Based on the above, this Makefile defines the following new variables: 32 | # 33 | # REPO_DEPS List of relative paths to the installed modules. For 34 | # example: "node_modules/canative". 35 | # 36 | # The accompanying Makefile.node_deps.targ defines a target that will install 37 | # each of REPO_MODULES into REPO_DEPS and remove REPO_DEPS with "make clean". 38 | # The top-level Makefile is responsible for depending on REPO_DEPS where 39 | # appropriate (usually the "deps" or "all" target). 40 | # 41 | 42 | REPO_DEPS = $(REPO_MODULES:src/node-%=node_modules/%) 43 | CLEAN_FILES += $(REPO_DEPS) 44 | -------------------------------------------------------------------------------- /tools/mk/Makefile.node_deps.targ: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile -*- 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this 5 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | # 7 | 8 | # 9 | # Copyright (c) 2014, Joyent, Inc. 10 | # 11 | 12 | # 13 | # Makefile.node_deps.targ: targets for Makefile.node_deps.defs. 14 | # 15 | # NOTE: This makefile comes from the "eng" repo. It's designed to be dropped 16 | # into other repos as-is without requiring any modifications. If you find 17 | # yourself changing this file, you should instead update the original copy in 18 | # eng.git and then update your repo to use the new version. 19 | # 20 | 21 | NPM_EXEC ?= $(error NPM_EXEC must be defined for Makefile.node_deps.targ) 22 | 23 | node_modules/%: src/node-% | $(NPM_EXEC) 24 | $(NPM) install $< 25 | --------------------------------------------------------------------------------