Skip to content

Commit 62385f5

Browse files
committed
Fix Issue #56
1 parent f1007ec commit 62385f5

10 files changed

+445
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/).
66

7+
## 2.202106.1
8+
### Added
9+
- New commands schemaInstances, securestore, and sbss to list cf/xs services instances of these plan types
10+
711
## 2.202106.1
812
- Merge [mass rename](https://gist.github.com/ThePlenkov/2fc31e05a43a4ec395c9a4d8f6c8276a#gistcomment-3759807) from [@ThePlenkov](https://github.com/ThePlenkov)
913
- Fix [Issue with connecting to XS Advance Database #53](https://github.com/SAP-samples/hana-developer-cli-tool-example/issues/53)

README.md

+60
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,25 @@ Options:
17061706
17071707
![roles example](https://raw.githubusercontent.com/wiki/SAP-samples/hana-developer-cli-tool-example/images/roles.gif)
17081708
1709+
### sbss
1710+
```shell
1711+
hana-cli sbss List all SAP HANA Cloud SBSS service
1712+
instances in your target Space
1713+
[aliases: sbssInstances, sbssinstances, sbssServices, listsbss, sbssservices,
1714+
sbsss]
1715+
Troubleshooting:
1716+
--disableVerbose, --quiet Disable Verbose output - removes all extra
1717+
output that is only helpful to human readable
1718+
interface. Useful for scripting commands.
1719+
[boolean] [default: false]
1720+
--debug, --Debug Debug hana-cli itself by adding output of LOTS
1721+
of intermediate details
1722+
[boolean] [default: false]
1723+
1724+
Options:
1725+
-c, --cf, --cmd Cloud Foundry? [boolean] [default: true]
1726+
```
1727+
17091728
### schemas
17101729
17111730
```shell
@@ -1736,6 +1755,47 @@ Options:
17361755
17371756
![schemas example](https://raw.githubusercontent.com/wiki/SAP-samples/hana-developer-cli-tool-example/images/schemas.gif)
17381757
1758+
### schemaInstances
1759+
1760+
```shell
1761+
hana-cli schemaInstances List all SAP HANA Cloud Schema
1762+
service instances in your target
1763+
Space
1764+
[aliases: schemainstances, schemaServices, listschemas, schemaservices]
1765+
Troubleshooting:
1766+
--disableVerbose, --quiet Disable Verbose output - removes all extra
1767+
output that is only helpful to human readable
1768+
interface. Useful for scripting commands.
1769+
[boolean] [default: false]
1770+
--debug, --Debug Debug hana-cli itself by adding output of LOTS
1771+
of intermediate details
1772+
[boolean] [default: false]
1773+
1774+
Options:
1775+
-c, --cf, --cmd Cloud Foundry? [boolean] [default: true]
1776+
```
1777+
1778+
### securestore
1779+
1780+
```shell
1781+
hana-cli securestore List all SAP HANA Cloud SecureStore
1782+
service instances in your target
1783+
Space
1784+
[aliases: secureStoreInstances, securestoreinstances, secureStoreServices,
1785+
listSecureStore, securestoreservices, securestores]
1786+
Troubleshooting:
1787+
--disableVerbose, --quiet Disable Verbose output - removes all extra
1788+
output that is only helpful to human readable
1789+
interface. Useful for scripting commands.
1790+
[boolean] [default: false]
1791+
--debug, --Debug Debug hana-cli itself by adding output of LOTS
1792+
of intermediate details
1793+
[boolean] [default: false]
1794+
1795+
Options:
1796+
-c, --cf, --cmd Cloud Foundry? [boolean] [default: true]
1797+
```
1798+
17391799
### serviceKey
17401800
17411801
```shell

_i18n/messages.properties

+3
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ copy2DefaultEnv=Copy .env contents to default-env.json and reformat
127127
copy2Env=Copy default-env.json contents to .env and reformat
128128
hcInstances=List all SAP HANA Cloud instances in your target Space
129129
hdiInstances=List all SAP HANA Cloud HDI service instances in your target Space
130+
sbssInstances=List all SAP HANA Cloud SBSS service instances in your target Space
131+
secureStoreInstances=List all SAP HANA Cloud SecureStore service instances in your target Space
132+
schemaInstances=List all SAP HANA Cloud Schema service instances in your target Space
130133
upsInstances=List all Cloud Foundry user provided service instances in your target Space
131134
hc_instance_name=SAP HANA Cloud Instance name
132135
hcStart=Start SAP HANA Cloud instance

bin/cli.js

+3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ require('yargs')
8686
.command(require('./reclaim'))
8787
.command(require('./rick'))
8888
.command(require('./roles'))
89+
.command(require('./hanaCloudSBSSInstances'))
8990
.command(require('./schemas'))
91+
.command(require('./hanaCloudSchemaInstances'))
92+
.command(require('./hanaCloudSecureStoreInstances'))
9093
.command(require('./connectViaServiceKey'))
9194
.command(require('./sequences'))
9295
.command(require('./status'))

bin/hanaCloudSBSSInstances.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const base = require("../utils/base")
2+
3+
exports.command = 'sbss'
4+
exports.aliases = ['sbssInstances', 'sbssinstances', 'sbssServices', 'listsbss', 'sbssservices', 'sbsss']
5+
exports.describe = base.bundle.getText("sbssInstances")
6+
7+
exports.builder = base.getBuilder({
8+
cf: {
9+
alias: ['c', 'cmd'],
10+
desc: base.bundle.getText("cfxs"),
11+
type: 'boolean',
12+
default: true
13+
}
14+
}, false)
15+
16+
exports.handler = (argv) => {
17+
base.promptHandler(argv, listInstances, {
18+
cf: {
19+
description: base.bundle.getText("cfxs"),
20+
type: 'boolean',
21+
default: true,
22+
required: false
23+
}
24+
}, false)
25+
}
26+
27+
async function listInstances(prompts) {
28+
base.debug('listInstances')
29+
try {
30+
let cf = null
31+
if (prompts.cf) {
32+
cf = require("../utils/cf")
33+
} else {
34+
cf = require("../utils/xs")
35+
}
36+
37+
let results = ''
38+
results = await cf.getSbssInstances()
39+
let output = []
40+
if (prompts.cf) {
41+
for (let item of results.resources) {
42+
let outputItem = {}
43+
outputItem.name = item.name
44+
outputItem.created_at = item.created_at
45+
outputItem.last_operation = `${item.last_operation.type} ${item.last_operation.state} @ ${item.last_operation.updated_at}`
46+
output.push(outputItem)
47+
}
48+
} else {
49+
for (let item of results){
50+
let outputItem = {}
51+
outputItem.name = item.serviceInstanceEntity.name
52+
outputItem.last_operation = `${item.serviceInstanceEntity.last_operation.type} ${item.serviceInstanceEntity.last_operation.state} `
53+
output.push(outputItem)
54+
}
55+
}
56+
base.outputTable(output)
57+
return base.end()
58+
} catch (error) {
59+
base.error(error)
60+
}
61+
}

bin/hanaCloudSchemaInstances.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const base = require("../utils/base")
2+
3+
exports.command = 'schemaInstances'
4+
exports.aliases = ['schemainstances', 'schemaServices', 'listschemas', 'schemaservices']
5+
exports.describe = base.bundle.getText("schemaInstances")
6+
7+
exports.builder = base.getBuilder({
8+
cf: {
9+
alias: ['c', 'cmd'],
10+
desc: base.bundle.getText("cfxs"),
11+
type: 'boolean',
12+
default: true
13+
}
14+
}, false)
15+
16+
exports.handler = (argv) => {
17+
base.promptHandler(argv, listInstances, {
18+
cf: {
19+
description: base.bundle.getText("cfxs"),
20+
type: 'boolean',
21+
default: true,
22+
required: false
23+
}
24+
}, false)
25+
}
26+
27+
async function listInstances(prompts) {
28+
base.debug('listInstances')
29+
try {
30+
let cf = null
31+
if (prompts.cf) {
32+
cf = require("../utils/cf")
33+
} else {
34+
cf = require("../utils/xs")
35+
}
36+
37+
let results = ''
38+
results = await cf.getSchemaInstances()
39+
let output = []
40+
if (prompts.cf) {
41+
for (let item of results.resources) {
42+
let outputItem = {}
43+
outputItem.name = item.name
44+
outputItem.created_at = item.created_at
45+
outputItem.last_operation = `${item.last_operation.type} ${item.last_operation.state} @ ${item.last_operation.updated_at}`
46+
output.push(outputItem)
47+
}
48+
} else {
49+
for (let item of results){
50+
let outputItem = {}
51+
outputItem.name = item.serviceInstanceEntity.name
52+
outputItem.last_operation = `${item.serviceInstanceEntity.last_operation.type} ${item.serviceInstanceEntity.last_operation.state} `
53+
output.push(outputItem)
54+
}
55+
}
56+
base.outputTable(output)
57+
return base.end()
58+
} catch (error) {
59+
base.error(error)
60+
}
61+
}

bin/hanaCloudSecureStoreInstances.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const base = require("../utils/base")
2+
3+
exports.command = 'securestore'
4+
exports.aliases = ['secureStoreInstances', 'securestoreinstances', 'secureStoreServices', 'listSecureStore', 'securestoreservices', 'securestores']
5+
exports.describe = base.bundle.getText("secureStoreInstances")
6+
7+
exports.builder = base.getBuilder({
8+
cf: {
9+
alias: ['c', 'cmd'],
10+
desc: base.bundle.getText("cfxs"),
11+
type: 'boolean',
12+
default: true
13+
}
14+
}, false)
15+
16+
exports.handler = (argv) => {
17+
base.promptHandler(argv, listInstances, {
18+
cf: {
19+
description: base.bundle.getText("cfxs"),
20+
type: 'boolean',
21+
default: true,
22+
required: false
23+
}
24+
}, false)
25+
}
26+
27+
async function listInstances(prompts) {
28+
base.debug('listInstances')
29+
try {
30+
let cf = null
31+
if (prompts.cf) {
32+
cf = require("../utils/cf")
33+
} else {
34+
cf = require("../utils/xs")
35+
}
36+
37+
let results = ''
38+
results = await cf.getSecureStoreInstances()
39+
let output = []
40+
if (prompts.cf) {
41+
for (let item of results.resources) {
42+
let outputItem = {}
43+
outputItem.name = item.name
44+
outputItem.created_at = item.created_at
45+
outputItem.last_operation = `${item.last_operation.type} ${item.last_operation.state} @ ${item.last_operation.updated_at}`
46+
output.push(outputItem)
47+
}
48+
} else {
49+
for (let item of results){
50+
let outputItem = {}
51+
outputItem.name = item.serviceInstanceEntity.name
52+
outputItem.last_operation = `${item.serviceInstanceEntity.last_operation.type} ${item.serviceInstanceEntity.last_operation.state} `
53+
output.push(outputItem)
54+
}
55+
}
56+
base.outputTable(output)
57+
return base.end()
58+
} catch (error) {
59+
base.error(error)
60+
}
61+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hana-cli",
3-
"version": "2.202106.1",
3+
"version": "2.202106.2",
44
"description": "HANA Developer Command Line Interface",
55
"main": "index.js",
66
"bin": {

0 commit comments

Comments
 (0)