Hub-CLI
This is a set of command line tools to help manage Hub related items/resources in a portal instance
Note: This requires node >= v8.0.0
Installation
npm i -g hub-cli
Commands
purge
This command purges all content belonging to the current user in an org. Seriously.
Exceptions
- items with
typeKeywords: doNotDelete
- groups with
tags: doNotDelete
This command is designed for use by the Hub continuous integration system to clean out a test org. If you use this outside of that context, you are solely responsible for the outcome.
There is no safe-guard on this command - please do NOT use this unless you are really really sure you know what you are doing. There is no "undo".
Usage
hub purge <username> <password> <orgUrl>
ex:
$ hub purge someAdmin somePassword https://org-name.maps.arcgis.com
Options
--item-query
This option injects an AGO item search query to specify the purging scope of non-site items. The default value is -typeKeywords: doNotDelete
.
For example, purging any item with a tag test-fixture
:
$ hub purge --item-query 'tags: test-fixture' someAdmin somePassword https://org-name.maps.arcgis.com
--group-query
This option injects an AGO group search query to specify the purging scope of groups. The default value is -tags: doNotDelete
.
For example, purging any item with a tag test-fixture
:
$ hub purge --group-query 'tags: test-fixture' someAdmin somePassword https://org-name.maps.arcgis.com
--skip-site
Using this flag would skip the purging of sites.
--skip-domain
Using this flag would skip the purging of orphan domains.
Scripting
These commands can also be used from other node scripts.
To do that, install hub-cli
as a dependency of your project...
$ npm i --save hub-cli
Then in your node module, import hub
, and you can access the commands from it...
const hub = require('hub-cli');
hub.purge.execute('someUser', 'somePassword', 'https://yourOrg.maps.arcgis.com');