Skip to content

Commit 36cd3e1

Browse files
Merge pull request #765 from oracle-devrel/ws-ocictl
Ws ocictl
2 parents 70c5f97 + 4b2d820 commit 36cd3e1

File tree

11 files changed

+498
-0
lines changed

11 files changed

+498
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# OCICTL. A simple command-line tool for accessing database and compute resources
2+
3+
OCI Cli offers a command line interface to work with OCI resources, like compute instances, databases and object storage. However - as it uses JSON as a main format of displaying information and - in some cases - requires providing an identifier of an OCI component instead of its display name, its direct using may be in such situations considered as not user friendly.
4+
5+
OCICTL is a tool simplifying using OCI Cli. It displays information in a more readable text format and allows for providing display names of components instead of their OCI identifiers. It also makes easier basic management of composite services, like, for example, Base Database Service, which consist of multiple internal components (databases, nodes, etc).
6+
7+
8+
Review Date: 28.01.2024
9+
10+
## Documentation
11+
- User Guide in the doc folder of this repository
12+
13+
# License
14+
15+
Copyright (c) 2023 Oracle and/or its affiliates.
16+
17+
Licensed under the Universal Permissive License (UPL), Version 1.0.
18+
19+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
compute-vm1 compute
2+
compute-vm2 compute
3+
db01 db
4+
adb01 adb
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import sys, json
2+
3+
data = json.load(sys.stdin)['data']
4+
5+
for c in data:
6+
fsize = round(c['size']/(1024),3)
7+
print (c['name'].ljust(30,' ')+" "+c['time-modified'][:19].ljust(25,' ')+f'{fsize:.3f}'.rjust(10)+" KB")
8+
9+
10+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys, json
2+
3+
data = json.loads(sys.argv[1])['data']
4+
5+
for c in data:
6+
print(c[sys.argv[2]])
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import sys, json
2+
3+
data = json.loads(sys.argv[1])['data']
4+
5+
print(data[sys.argv[2]])
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import sys, json
2+
3+
data = json.load(sys.stdin)['data']
4+
5+
for c in data:
6+
print (" db: "+c['pdb-name']+":"+c['open-mode']+":"+c['connection-strings']['pdb-default'].split("/",1)[1])
7+
print (" id: "+c['id'])
8+
print ("")
9+
10+
11+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import sys, json
2+
3+
data = json.load(sys.stdin)['data']
4+
5+
for c in data:
6+
if (len(sys.argv) == 1 or sys.argv[1] == "--long" ):
7+
print(c['display-name']+":"+c['lifecycle-state']+":"+c['id'])
8+
elif (sys.argv[1] == "--names" ):
9+
print(c['display-name'])
10+
else:
11+
print(c['id'])
12+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import sys, json
2+
3+
data = json.load(sys.stdin)
4+
5+
for c in data:
6+
if (len(sys.argv) == 1 or sys.argv[1] == "--long" ):
7+
print(c['displayName']+":"+c['lifecycleState']+":"+c['id'])
8+
elif (sys.argv[1] == "--names" ):
9+
print(c['display-name'])
10+
else:
11+
print(c['id'])
12+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export OCI_NS=<namespace>
2+
export OCI_TID=<tenancy_id>
3+
export OCI_CID=<compartment_id>
4+
export OCICTL_HOME=<directory>/ocictl
5+
export OCICTL_CONFIG=$OCICTL_HOME/etc
6+
export PATH=$PATH:$OCICTL_HOME/sh

0 commit comments

Comments
 (0)