Skip to content

Commit 5d14cfc

Browse files
authored
Releasing version 3.29.3
Releasing version 3.29.3
2 parents de095e1 + 25fa9f3 commit 5d14cfc

File tree

23 files changed

+12314
-7570
lines changed

23 files changed

+12314
-7570
lines changed

CHANGELOG.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,63 @@ All notable changes to this project will be documented in this file.
66

77
The format is based on `Keep a Changelog <http://keepachangelog.com/>`__.
88

9+
3.29.3 - 2023-07-11
10+
--------------------
11+
Added
12+
~~~~~
13+
14+
* Support for optional parameters in the Application Performance Monitoring Synthetic service
15+
16+
* ``oci apm-synthetics monitor create-browser-monitor --is-default-snapshot-enabled --verify-response-codes``
17+
* ``oci apm-synthetics monitor create-rest-monitor --client-certificate-details``
18+
* ``oci apm-synthetics monitor create-scripted-browser-monitor --is-default-snapshot-enabled``
19+
* ``oci apm-synthetics monitor create-scripted-rest-monitor --req-authentication-scheme --verify-response-codes``
20+
* ``oci apm-synthetics monitor update-browser-monitor --is-default-snapshot-enabled --verify-response-codes``
21+
* ``oci apm-synthetics monitor update-rest-monitor ---client-certificate-details``
22+
* ``oci apm-synthetics monitor update-scripted-browser-monitor ---is-default-snapshot-enabled``
23+
* ``oci apm-synthetics monitor update-scripted-rest-monitor --req-authentication-scheme --verify-response-codes``
24+
25+
* Support for new commands in the OSP Gateway service
26+
27+
* ``oci osp-gateway address-rule-service address-rule get``
28+
* ``oci osp-gateway address-service address``
29+
30+
* AI Document Service
31+
32+
* Support for new commands
33+
34+
* ``oci ai-document analyze-document-result``
35+
* ``oci ai-document model patch``
36+
37+
* Support for new optional parameters
38+
39+
* ``oci ai-document model create --alias-name --component-models``
40+
41+
* Support for workload mapping processing in the Container Engine service
42+
43+
* ``oci ce workload-mapping``
44+
* ``oci ce workload-mapping-summary``
45+
46+
* Support for new commands in the Data Integration service
47+
48+
* ``oci data-integration composite-state get``
49+
* ``oci data-integration export-request``
50+
* ``oci data-integration export-request-summary-collection list-export-requests``
51+
* ``oci data-integration import-request``
52+
* ``oci data-integration import-request-summary-collection list-import-requests``
53+
* ``oci data-integration data-entity create-entity-shape-create-entity-shape-from-object``
54+
* ``oci data-integration workspace delete-export-request``
55+
* ``oci data-integration workspace delete-import-request``
56+
* ``oci data-integration workspace update-export-request``
57+
* ``oci data-integration workspace update-import-request``
58+
59+
* Support for new optional parameter --kms-key-id in updating and creating backup and volume backup's envelope key in Core services
60+
61+
* ``oci bv backup create --kms-key-id``
62+
* ``oci bv backup update --kms-key-id``
63+
* ``oci bv boot-volume-backup create --kms-key-id``
64+
* ``oci bv boot-volume-backup update --kms-key-id``
65+
966
3.29.2 - 2023-06-27
1067
--------------------
1168
Added

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Try the interactive features anytime with the ``-i`` option:
2626

2727
oci -i
2828

29+
.. image:: images/animation.png
30+
:width: 1000
31+
:alt: Alternative text
32+
2933
Read more on `OCI Documentation`__.
3034

3135
__ https://docs.oracle.com/iaas/Content/API/SDKDocs/cliusing_topic-Using_Interactive_Mode.htm

requirements.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ certifi
88
cffi>=1.9.1
99
click==8.0.4
1010
coverage==4.5.2
11-
cryptography>=3.2.1,<40.0.0
11+
cryptography>=3.2.1,<42.0.0
1212
httpsig-cffi==15.0.0
1313
Jinja2==3.0.3
1414
jmespath==0.10.0
1515
ndg-httpsclient==0.4.2
1616
mock==2.0.0
17-
oci==2.105.0
17+
oci==2.106.0
1818
packaging==20.2
1919
pluggy==0.13.0
2020
py==1.10.0
@@ -27,7 +27,8 @@ pytest==7.1.2; python_version >= '3.10'
2727
pytest-cov==2.5.1
2828
python-dateutil>=2.5.3,<3.0.0
2929
pytz>=2016.10
30-
requests==2.21.0
30+
requests==2.21.0; python_version == '3.6'
31+
requests==2.31.0; python_version > '3.6'
3132
six>=1.15.0
3233
sphinx==3.3.0
3334
sphinx-rtd-theme==0.4.3
@@ -42,4 +43,6 @@ PyYAML>=5.4,<=6
4243
docutils==0.15.2
4344
prompt-toolkit==3.0.29
4445
setuptools>65.5.1; python_version > '3.6'
45-
setuptools==59.6.0; python_version == '3.6'
46+
setuptools==59.6.0; python_version == '3.6'
47+
# this is required because of python 3.6 requests dependency version bound
48+
urllib3<=1.26.15

scripts/examples/project_o/README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# o - a smart oci-cli wrapper
2+
<!-- Project o - helper smart wrapper oci cli user experience -->
3+
24
**`o`** helps you use the Oracle Cloud Infrastructure's `oci` command line interface. With **`o`** you can
35
- quickly find a command and get usage info
46
- simply run commands using *resource names*, not OCIDs
@@ -7,7 +9,7 @@
79
**`o`** uses shortcuts for *everything*. All commands, parameters, and resource names have intuitive, *automatic* shortcuts.
810
You can run most commands with no scripting. Say goodbye to saving OCIDs to variables.
911

10-
**``O``** instantly transforms this:
12+
**``o``** instantly transforms this:
1113
```
1214
$ o list subn -c sales -v west -a
1315
```
@@ -41,10 +43,12 @@ To install, get **``o``** from github, place it in your PATH (perhaps in the sam
4143
o_src=https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/examples/project_o/o
4244
where=$(which oci) && to=${where%ci} && curl -so $to $o_src && chmod +x $to
4345
```
44-
**`O`** version 1.6 runs in **Windows** PowerShell or Command shell, but installation not automated. Get **`o`**
46+
#### Windows
47+
**`o`** version 1.6 and later runs in Windows PowerShell or Command shell, but installation not automated. To try it, use this curl command to get **`o`**. Then copy it to somewhere in your PATH.
4548
```
4649
curl -o o.py https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/examples/project_o/o
4750
```
51+
Update your PATHEXT to make it execute as `o` instead of `o.py`.
4852

4953
#### Setup
5054

@@ -86,8 +90,8 @@ This will get a fresh list of all compartments in the tenancy, which is a great
8690
- identical names can be resolved by using a substring from the OCID
8791
- for example, ``-c ujfa`` would specify the *sales* compartment. The last four to six characters will uniquely identify most resources.
8892
- handy when your resource names contain spaces or special characters
89-
- support [complex type] parameters where a list of OCIDs is expected
90-
- comma-separated resource names are converted to a JSON list
93+
- support ``--*-ids`` parameters where a list of OCIDs is expected, e.g. ``--security-list-ids``
94+
- comma-separated list of resource names is converted to a JSON list of OCIDs
9195
- simplify [datetime] parameters
9296
- ``--start-time today`` beginning (midnight) of current day (UTC)
9397
- ``--start-time today-36h`` - the day before yesterday at Noon
@@ -160,6 +164,13 @@ This will get a fresh list of all compartments in the tenancy, which is a great
160164
- Added “reg" column to identify region key in default table output
161165
- This is not shown nor available in csv or text formats.
162166
- Region isn't in the resource data for most data types. **o** is extracting it from the ocid
167+
- **o** runs on *Windows* PowerShell and Command shell. Not fully tested, but the basics appear to work.
168+
169+
#### New in version 1.9 (2023-07-05)
170+
- "Best match" command selection adjusted to accept shorter input for commands in common, core services. This was needed because oci-cli supports more services and more commands than before, making it more difficult to find unambiguous shortcuts.
171+
- More shortcuts for `o structured-search --query-text` where clauses:
172+
- Use `c` or `l` for "compartment" or "lifeCycleState", followed by `=` or `!=` and the name of a compartment or lifeCycleState. Don't worry about quotation marks around terms. E.g.
173+
- `query all resources where (c = sales || c = kevco) && l != terminated`
163174

164175
## How **``o``** works
165176
- **``o``** compares your input with thousands of ``oci`` commands, and uses an fuzzy matching to find the command you want.

scripts/examples/project_o/o

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ if (sys.platform != "win32"):
2121
import fcntl
2222
import errno
2323
import datetime
24-
VERSION = "1.8"
25-
UPDATED = "2023-06-12"
24+
VERSION = "1.9"
25+
UPDATED = "2023-07-05"
2626

2727
# ==============================================================================
2828
# Global variables
@@ -283,6 +283,7 @@ and I'll do this for you:
283283
o iam compartment list -c <tenancy-ocid> -ciis true -all .
284284
o iam ad list -c <tenancy-ocid> .
285285
o iam region-subscription list .
286+
o iam compartment get -c <tenancy-id> .
286287
""")
287288

288289
# To be extra helpful, get likely tenancy ocid from oci config file
@@ -302,15 +303,18 @@ and I'll do this for you:
302303
print("Tenancy name:", sys.argv[2])
303304
print(bold('Setting up your ' + ocids_file_name + ' file:'))
304305
print(bold('\nGetting compartment names and ocids...'), end='')
305-
if run_command(sys.argv[0] + ' -o name iam compartment list -c ' + sys.argv[1] + ' -ciis true -all .'):
306+
ocmd = sys.argv[0]
307+
if ' ' in sys.argv[0]:
308+
ocmd = '"' + sys.argv[0] + '"'
309+
if run_command(ocmd + ' -o name iam compartment list -c ' + sys.argv[1] + ' -ciis true -all .'):
306310
print('\nThat didn\'t work. Your account may need additional privileges.')
307311
exit(0)
308312
print(bold('\nGetting availability domains...'), end='')
309-
run_command(sys.argv[0] + ' -o name iam ad list -c ' + sys.argv[1] + ' .')
313+
run_command(ocmd + ' -o name iam ad list -c ' + sys.argv[1] + ' .')
310314
print(bold('\nGetting regions...'), end='')
311-
run_command(sys.argv[0] + ' -o name iam region-subscription list .')
315+
run_command(ocmd + ' -o name iam region-subscription list .')
312316
print(bold('\nGetting tenancy name from root compartment...'), end='')
313-
if run_command(sys.argv[0] + ' -o name iam compartment get -c ' + sys.argv[1] + ' .'):
317+
if run_command(ocmd + ' -o name iam compartment get -c ' + sys.argv[1] + ' .'):
314318
# compartment get on tenancy failed; try saving a stub for tenancy
315319
print("\nCould not get root compartment.")
316320
tenancy_name = input(bold("Enter tenancy name: "))
@@ -440,12 +444,16 @@ def get_new_ocids_from_returned_items(items):
440444
"""
441445

442446
# special case for region list - save the whole list in one entry
443-
if 'oci iam region list' in oci_command_line:
447+
if 'oci iam region' in oci_command_line and ' list' in oci_command_line:
448+
if 'region-key' in items[0]:
449+
region_list = [{'key': i['region-key'], 'name': i['region-name']} for i in items]
450+
else:
451+
region_list = items
444452
return {'regionlist': {
445453
'type': 'regionlist',
446454
'alias': 'regionlist',
447455
'id': 'regionlist',
448-
'data': items}}
456+
'data': region_list}}
449457

450458
if oci_command_line.startswith('oci search'):
451459
for i in items:
@@ -557,7 +565,7 @@ def show_command(c, full=False, prefix='oci '):
557565
print(' optional\t' + re.sub(r' -', r'\n\t\t-', c['optional']))
558566
if show_help:
559567
print(' global\t' + re.sub(r'\n', r'\n ',
560-
textwrap.fill(global_options, width=60, break_on_hyphens=False)))
568+
textwrap.fill(global_options, width=60, break_on_hyphens=False)) + '\n')
561569

562570
# ==============================================================================
563571

@@ -597,7 +605,7 @@ def args_match_command(c, params):
597605
# look for word starting with arg
598606
if ' ' + a in action or '-' + a in action:
599607
# Scratch out this match
600-
action = re.sub(' ' + r'(\S+-)*' + a + r'(\S+)', ' ', action, count=1)
608+
action = re.sub(' ' + r'(\S)*?' + a + r'(\S)*?' + ' ', ' ', action, count=1)
601609
continue
602610

603611
# look for rlc -> really-long-command
@@ -899,6 +907,8 @@ def get_matching_ocid(option, value):
899907
opt_type = 'organizationsentity'
900908
elif opt_type == 'routedistribution':
901909
opt_type = 'drgroutedistribution'
910+
elif opt_type == 'session':
911+
opt_type = 'bastionsession'
902912
# Add new idtypes to the above when the --whatever-id does not match ocid1.whatevs...
903913

904914
matches = [item for k, item in ocid.items() if
@@ -973,7 +983,7 @@ def value_parameter(option, value):
973983
if not v:
974984
continue
975985
o = get_matching_ocid(option, v)
976-
idlist.append(v)
986+
idlist.append(o)
977987
return repr(json.dumps(idlist))
978988

979989
# Assist with datetime parameters
@@ -995,16 +1005,23 @@ def value_parameter(option, value):
9951005

9961006
# Special help with structured-search --search-query "where compartmentId = ocid"
9971007
if option == '--query-text':
998-
match = re.findall(r"(\bc\w*) *= *('*\w+'*)", value, flags=re.IGNORECASE)
1008+
match = re.findall(r"(\b[cl]\w*) *!*= *('*\"*[-_/\w]+'*\"*)", value, flags=re.IGNORECASE)
9991009
for (m, spec) in match:
10001010
if m.lower() == 'compartmentid'[:len(m)]:
10011011
if m.lower() != 'compartmentid':
1002-
value = re.sub(r'\b' + m + r'\b', 'compartmentId', value)
1003-
if spec.startswith("'"):
1004-
spec = spec[1:-1]
1005-
o = get_matching_ocid('compartment', spec)
1006-
if o != spec:
1007-
value = re.sub(spec, "'" + o + "'", value)
1012+
value = re.sub(r'\b' + m + r'\b', 'compartmentId', value, count=1)
1013+
if spec.startswith("'") or spec.startswith('"'):
1014+
spec = spec[1:-1]
1015+
o = get_matching_ocid('compartment', spec)
1016+
if o == spec:
1017+
value = re.sub(spec, "'" + spec + "'", value, count=1)
1018+
else:
1019+
value = re.sub(spec, "'" + o + "'", value, count=1)
1020+
elif m.lower() == 'lifecyclestate'[:len(m)]:
1021+
if m.lower() != 'lifecyclestate':
1022+
value = re.sub(r'\b' + m + r'\b', 'lifecycleState', value, count=1)
1023+
if not (spec.startswith("'") or spec.startswith('"')):
1024+
value = re.sub(spec, "'" + spec + "'", value)
10081025

10091026
return value
10101027

@@ -1141,14 +1158,14 @@ def set_column_widths(fields, out_sep, item_list):
11411158
# ==============================================================================
11421159

11431160

1144-
def show_column_headers(out_fields, sep):
1161+
def show_column_headers(out_fields, sep, reg=False):
11451162
if quiet > 1:
11461163
return
11471164
if sep == '|':
11481165
for k in out_fields:
11491166
# print(bold(column[k]['format'].format(k)), end=' ', file=sys.stderr)
11501167
try:
1151-
if k == 'id' and user_out_spec == default_out_spec:
1168+
if reg and k == 'id' and user_out_spec == default_out_spec:
11521169
print(bold(' reg'), end=' ', file=sys.stderr)
11531170
print(bold(column[k]['format'].format(k.split(".")[-1])),
11541171
end=' ', file=sys.stderr)
@@ -1206,7 +1223,7 @@ def get_field_from_item(field, item):
12061223
# ==============================================================================
12071224

12081225

1209-
def show_item(item, fields, sep):
1226+
def show_item(item, fields, sep, reg=False):
12101227
"""Report result in user specified -o format."""
12111228

12121229
out = []
@@ -1225,8 +1242,8 @@ def show_item(item, fields, sep):
12251242
else:
12261243
out.append(value)
12271244
else:
1228-
if field == 'id' and sep == '|' and user_out_spec == default_out_spec and 'ocid' in value:
1229-
out.append(' ' + value.split('.')[3])
1245+
if reg and field == 'id' and sep == '|' and user_out_spec == default_out_spec and 'ocid' in value:
1246+
out.append(' ' + (value.split('.')[3]))
12301247
out.append(column[field]['format'].format(re.sub(r'[{}\'[\]\n]', '', value)[
12311248
column[field]['offset']:]))
12321249

@@ -1341,6 +1358,11 @@ def output(jsonOut):
13411358
# Below we format and display the data.
13421359
# ==========================================================================
13431360

1361+
reg_in_ocid = False
1362+
try:
1363+
reg_in_ocid = len(results[0]['id'].split('.')[3]) > 0
1364+
except (KeyError, IndexError):
1365+
pass
13441366
if not user_out_spec:
13451367
print(json.dumps(jsonOut, indent=4))
13461368
return results
@@ -1358,9 +1380,9 @@ def output(jsonOut):
13581380
set_column_widths(out_fields, out_sep, results)
13591381
if debug > 1: print("COLUMN:", column) # noqa: E701
13601382
# Then output header and requested fields from item_list
1361-
show_column_headers(out_fields, out_sep)
1383+
show_column_headers(out_fields, out_sep, reg=reg_in_ocid)
13621384
for item in results:
1363-
show_item(item, out_fields, out_sep)
1385+
show_item(item, out_fields, out_sep, reg=reg_in_ocid)
13641386

13651387
# Any extra non-'data' key-values? Send to stdout
13661388
if type(jsonOut) is dict and jsonOut.keys() != ['data']:
@@ -1977,14 +1999,12 @@ ncw = command_words[0] if command_words else len(CLI_params)
19771999
options_in_args = len(command_words) > 0
19782000

19792001
# Prioritize core services above others.
1980-
priority_services = ('compute ', 'bv ', 'os ', 'network ', 'iam ', 'db ')
2002+
priority_services = ('compute ', 'bv ', 'os ', 'network ', 'iam ', 'db ', 'resource-manager')
19812003

19822004
# Find matching commands. Sort by priority, then by command length.
19832005
matches = sorted([c for c in command if args_match_command(c, CLI_params[:ncw])],
1984-
key=lambda c: (len(c['action']) if len(c['action']) < 25 else int(round(len(c['action']) / 10.) * 10.))
1985-
if c['action'].startswith(priority_services)
1986-
else (1.5 * len(c['action']) if len(c['action']) < 25 else 1.5 * int(round(len(c['action']) / 10.) * 10.)),
1987-
reverse=True)
2006+
key=lambda c: (not c['action'].startswith(priority_services),
2007+
len(c['action'])), reverse=True)
19882008

19892009
# ==============================================================================
19902010
# Take action - either show help or 'go' run the command

0 commit comments

Comments
 (0)