Skip to content

Commit 5f98546

Browse files
author
Rajesh Deshpande
authored
Releasing version 2.2.9
Releasing version 2.2.9
2 parents 58012e5 + 8261620 commit 5f98546

22 files changed

+1247
-94
lines changed

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ 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+
====================
8+
2.2.9 - 2019-05-14
9+
====================
10+
11+
Added
12+
-----
13+
* Support for the Seoul (ICN) region
14+
* Support for logging context fields on data-plane APIs of the Key Management Service
15+
* Support for reverse pagination on list operations of the Email service
16+
* Support for configuring backup retention windows on database backups in the Database service
17+
* Support for subscribed regions in stop_untagged_instances.py on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/stop_untagged_instances.py>`__.
18+
* New services to showoci.py on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/showoci/showoci.py>`__.
19+
720
====================
821
2.2.8 - 2019-05-07
922
====================

README-development.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,23 @@ variables to be set:
6464

6565
* ``OCI_PYSDK_PUBLIC_SSH_KEY_FILE``: path to a public SSH key (.pub file) that will be given access to the instance launched in ``test_launch_instance_tutorial.py``.
6666

67+
68+
Checking Style
69+
==============
70+
The Python SDK adheres to PEP8 style guilds and uses Flake8 to validate style. There are some exceptions and they can
71+
be viewed in the ``setup.cfg`` file.
72+
73+
If you run tox with no environment specified Flake8 will be run. You can also run flake8 with no arguments to check
74+
the style consistency for the whole project. If you want to check a single file you can run flake8 with a path to the
75+
file to check.
76+
77+
.. code-block:: sh
78+
flake8 path/to/python_file_to_check.py
79+
80+
If flake8 is not found, make sure you have ``requirements.txt`` installed into your virtualenv. See the
81+
"Getting Started" section.
82+
83+
6784
Generating Documentation
6885
========================
6986
Sphinx is used for documentation. You can generate HTML locally with the following:

examples/add_API_key.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# coding: utf-8
2+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
3+
14
import oci
25
import sys
36
import os.path

examples/showoci/CHANGELOG.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ 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+
====================
8+
19.5.13 - 2019-05-13
9+
====================
10+
11+
Added
12+
-----
13+
* Option to print nice to screen + JSON file using -sjf switch
14+
* Added summary to JSON output file or screen
15+
* Added Monitoring Service
16+
* Added Notifications Service
17+
* Added Edge Services (Healthcheck)
18+
* Added Announcement
19+
* Added Array check for service availability to support Tokyo
20+
721
====================
822
19.4.23 - 2019-04-23
923
====================

examples/showoci/README.md

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## showoci - Oracle Cloud Infrastructure Reporting Tool
22

3-
SHOWOCI is an reporting tool which uses the Python SDK to extract list of resources from your tenant. It covers more than 80% of OCI components, Output can be printer friendly or JSON file.
3+
SHOWOCI is an reporting tool which uses the Python SDK to extract list of resources from your tenant. It covers most of OCI components, Output can be printer friendly or JSON file.
44

55
Modules Included:
66
- oci.core.VirtualNetworkClient
@@ -17,14 +17,41 @@ Modules Included:
1717
- oci.streaming.StreamAdminClient
1818
- oci.budget.BudgetClient
1919
- oci.autoscaling.AutoScalingClient
20+
- oci.monitoring.MonitoringClient
21+
- oci.ons.NotificationControlPlaneClient
22+
- oci.ons.NotificationDataPlaneClient
23+
- oci.healthchecks.HealthChecksClient
24+
- oci.announcements_service.AnnouncementClient
2025

2126
## OCI User Requirement
2227
Required OCI IAM user with read only privileges:
2328

24-
Inspect privilege will have some limitations especially on object storage sizes
2529
```
2630
ALLOW GROUP ReadOnlyUsers to read all-resources IN TENANCY
2731
```
32+
33+
For restrictive privileges:
34+
35+
```
36+
Allow group ReadOnlyUsers to inspect all-objects in tenancy
37+
Allow group ReadOnlyUsers to read instances in tenancy
38+
Allow group ReadOnlyUsers to read load-balancers in tenancy
39+
Allow group ReadOnlyUsers to read buckets in tenancy
40+
Allow group ReadOnlyUsers to read nat-gateways in tenancy
41+
Allow group ReadOnlyUsers to read public-ips in tenancy
42+
Allow group ReadOnlyUsers to read file-family in tenancy
43+
Allow group ReadOnlyUsers to read instance-configurations in tenancy
44+
45+
# Explanation:
46+
read instances allows - ListInstances
47+
read load-balancers allows - ListBackendSets, ListBackends, GetHealthChecker (for status)
48+
read buckets allows - GetBucket (for size), GetObjectLifecyclePolicy
49+
read nat-gateways allows - ListNatGateways
50+
read public-ips allows - ListPublicIps (not used yet)
51+
read file-family allows - ListExports, ListSnapshots
52+
read instance-configurations allows - GetInstanceConfiguration
53+
54+
```
2855
** DISCLAIMER – This is not official Oracle application
2956

3057
## Installation Guide for Python 3 with OCI SDK
@@ -112,15 +139,17 @@ Execute
112139
```
113140
$ ./showoci.py
114141
115-
usage: showoci [-h] [-a] [-ani] [-b] [-n] [-i] [-c] [-cn] [-o] [-l] [-d] [-f]
116-
[-e] [-s] [-rm] [-so] [-mc] [-nr] [-t PROFILE] [-p PROXY]
117-
[-rg REGION] [-cp COMPART] [-cf CONFIG] [-jf JOUTFILE] [-js]
118-
[-cachef SERVICEFILE] [-caches] [--version]
142+
usage: showoci.py [-h] [-a] [-ani] [-an] [-b] [-n] [-i] [-c] [-cn] [-o] [-l]
143+
[-d] [-f] [-e] [-m] [-s] [-rm] [-so] [-edge] [-mc] [-nr]
144+
[-t PROFILE] [-p PROXY] [-rg REGION] [-cp COMPART]
145+
[-cf CONFIG] [-jf JOUTFILE] [-js] [-sjf SJOUTFILE]
146+
[-cachef SERVICEFILE] [-caches] [--version]
119147
120148
optional arguments:
121149
-h, --help show this help message and exit
122150
-a Print All Resources
123151
-ani Print All Resources but identity
152+
-an Print Announcements
124153
-b Print Budgets
125154
-n Print Network
126155
-i Print Identity
@@ -131,9 +160,11 @@ optional arguments:
131160
-d Print Database
132161
-f Print File Storage
133162
-e Print EMail
163+
-m Print Monitoring and Notifications
134164
-s Print Streams
135165
-rm Print Resource management
136166
-so Print Summary Only
167+
-edge Print Edge Services (Healthcheck)
137168
-mc exclude ManagedCompartmentForPaaS
138169
-nr Not include root compartment
139170
-t PROFILE Config file section to use (tenancy profile)
@@ -143,6 +174,7 @@ optional arguments:
143174
-cf CONFIG Config File
144175
-jf JOUTFILE Output to file (JSON format)
145176
-js Output to screen (JSON format)
177+
-sjf SJOUTFILE Output to screen (nice format) and JSON File
146178
-cachef SERVICEFILE Output Cache to file (JSON format)
147179
-caches Output Cache to screen (JSON format)
148180
--version show program's version number and exit
@@ -695,7 +727,53 @@ Compartment gse00000000 (root):
695727
##############################
696728
--> AdiStream, partitions (1), Created: 2019-04-10 20:42
697729
URL : https://api.cell-1.us-ashburn-1.streaming.oci.oraclecloud.com
698-
730+
731+
##############################
732+
# Monitoring - Alarms #
733+
##############################
734+
--> host_cpu_over_80 (oci_computeagent), Enabled = True, Severity = CRITICAL
735+
Query : CpuUtilization[1m]{resourceDisplayName = "demohost"}.mean() > 80
736+
Topic : adi_topic - adi_topic_desc
737+
738+
739+
##############################
740+
# Notifications - Topics #
741+
##############################
742+
--> adi_topic - adi_topic_desc Created: 2018-12-25 12:00
743+
Sub : EMAIL: [email protected]
744+
745+
##############################
746+
# Edge - Healthcheck #
747+
##############################
748+
--> public_http_check (HTTPS: HEAD), Path = /, Enabled = False
749+
Interval : 30 secs
750+
Targets : 129.213.148.40
751+
VPoints : aws-cdg
752+
753+
--> public_demohost_check (ICMP, Port: 80), Enabled = False
754+
Interval : 30 secs, Timeout = 30 secs
755+
Targets : 129.213.148.40
756+
VPoints : aws-cmh, aws-iad
757+
758+
##############################
759+
# Announcements #
760+
##############################
761+
--> Container Engine for Kubernetes (CN-4368) - PRODUCTION_EVENT_NOTIFICATION, 2019-03-22 12:00
762+
Regions : Multiple Regions
763+
Services : ['Oracle Cloud Infrastructure Container Engine for Kubernetes']
764+
765+
--> Container Engine for Kubernetes (CN-4368) - PRODUCTION_EVENT_NOTIFICATION, 2019-03-22 12:25
766+
Regions : Multiple Regions
767+
Services : ['Oracle Cloud Infrastructure Container Engine for Kubernetes']
768+
769+
--> Container Engine for Kubernetes (CN-4368) - PRODUCTION_EVENT_NOTIFICATION, 2019-03-22 12:25
770+
Regions : Multiple Regions
771+
Services : ['Oracle Cloud Infrastructure Container Engine for Kubernetes']
772+
773+
--> Developer Services : Container Engine for Kubernetes: Node Pool Security List Update (CN-3934) - ACTION_REQUIRED, 2019-02-05 15:00
774+
Regions : All Regions
775+
Services : ['Developer Services : Container Engine for Kubernetes']
776+
699777
##########################################################################################
700778
# Summary - us-ashburn-1 #
701779
##########################################################################################

examples/showoci/showoci.py

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@
4242
# - oci.streaming.StreamAdminClient
4343
# - oci.budget.BudgetClient
4444
# - oci.autoscaling.AutoScalingClient
45+
# - oci.monitoring.MonitoringClient
46+
# - oci.ons.NotificationControlPlaneClient
47+
# - oci.ons.NotificationDataPlaneClient
48+
# - oci.healthchecks.HealthChecksClient
49+
# - oci.announcements_service.AnnouncementClient
4550
#
4651
# Modules Not Yet Covered:
47-
# - oci.ons.NotificationDataPlaneClient
4852
# - oci.waas.WaasClient
49-
# - oci.monitoring.MonitoringClient
50-
# - oci.healthchecks.HealthChecksClient
5153
# - oci.dns.DnsClient
52-
# - oci.announcements_service.AnnouncementClient
5354
#
5455
##########################################################################
5556
from __future__ import print_function
@@ -61,7 +62,7 @@
6162
import argparse
6263
import datetime
6364

64-
version = "19.4.23"
65+
version = "19.5.13"
6566

6667
##########################################################################
6768
# execute_extract
@@ -126,16 +127,33 @@ def execute_extract():
126127
extracted_data = data.process_oci_data()
127128

128129
############################################
129-
# Check output config
130+
# if JSON and screen
131+
############################################
132+
if cmd.sjoutfile:
133+
# print nice
134+
output.print_data(extracted_data)
135+
summary.print_summary(extracted_data)
136+
137+
# Add summary to JSON and print to JSON file
138+
extracted_data.append({'summary': summary.get_summary_json()})
139+
if cmd.sjoutfile.name:
140+
print_to_json_file(output, cmd.sjoutfile.name, extracted_data, "JSON Data")
141+
142+
############################################
143+
# JSON File only
130144
############################################
131-
if cmd.joutfile:
145+
elif cmd.joutfile:
132146
if cmd.joutfile.name:
133-
print_to_json_file(cmd.joutfile.name, extracted_data, "JSON Data")
147+
summary.print_summary(extracted_data)
148+
extracted_data.append({'summary': summary.get_summary_json()})
149+
print_to_json_file(output, cmd.joutfile.name, extracted_data, "JSON Data")
134150

135151
############################################
136-
# print JSON to screen
152+
# JSON to screen only
137153
############################################
138154
elif cmd.joutscr:
155+
summary.print_summary(extracted_data)
156+
extracted_data.append({'summary': summary.get_summary_json()})
139157
print(json.dumps(extracted_data, indent=4, sort_keys=False))
140158

141159
############################################
@@ -193,6 +211,7 @@ def set_parser_arguments():
193211
parser = argparse.ArgumentParser()
194212
parser.add_argument('-a', action='store_true', default=False, dest='all', help='Print All Resources')
195213
parser.add_argument('-ani', action='store_true', default=False, dest='allnoiam', help='Print All Resources but identity')
214+
parser.add_argument('-an', action='store_true', default=False, dest='announcement', help='Print Announcements')
196215
parser.add_argument('-b', action='store_true', default=False, dest='budgets', help='Print Budgets')
197216
parser.add_argument('-n', action='store_true', default=False, dest='network', help='Print Network')
198217
parser.add_argument('-i', action='store_true', default=False, dest='identity', help='Print Identity')
@@ -203,9 +222,11 @@ def set_parser_arguments():
203222
parser.add_argument('-d', action='store_true', default=False, dest='database', help='Print Database')
204223
parser.add_argument('-f', action='store_true', default=False, dest='file', help='Print File Storage')
205224
parser.add_argument('-e', action='store_true', default=False, dest='email', help='Print EMail')
225+
parser.add_argument('-m', action='store_true', default=False, dest='monitoring', help='Print Monitoring and Notifications')
206226
parser.add_argument('-s', action='store_true', default=False, dest='streams', help='Print Streams')
207227
parser.add_argument('-rm', action='store_true', default=False, dest='orm', help='Print Resource management')
208228
parser.add_argument('-so', action='store_true', default=False, dest='sumonly', help='Print Summary Only')
229+
parser.add_argument('-edge', action='store_true', default=False, dest='edge', help='Print Edge Services (Healthcheck)')
209230
parser.add_argument('-mc', action='store_true', default=False, dest='mgdcompart', help='exclude ManagedCompartmentForPaaS')
210231
parser.add_argument('-nr', action='store_true', default=False, dest='noroot', help='Not include root compartment')
211232
parser.add_argument('-t', default="", dest='profile', help='Config file section to use (tenancy profile)')
@@ -215,6 +236,7 @@ def set_parser_arguments():
215236
parser.add_argument('-cf', type=argparse.FileType('r'), dest='config', help="Config File")
216237
parser.add_argument('-jf', type=argparse.FileType('w'), dest='joutfile', help="Output to file (JSON format)")
217238
parser.add_argument('-js', action='store_true', default=False, dest='joutscr', help="Output to screen (JSON format)")
239+
parser.add_argument('-sjf', type=argparse.FileType('w'), dest='sjoutfile', help="Output to screen (nice format) and JSON File")
218240
parser.add_argument('-cachef', type=argparse.FileType('w'), dest='servicefile', help="Output Cache to file (JSON format)")
219241
parser.add_argument('-caches', action='store_true', default=False, dest='servicescr', help="Output Cache to screen (JSON format)")
220242
parser.add_argument('--version', action='version', version='%(prog)s ' + version)
@@ -228,7 +250,7 @@ def set_parser_arguments():
228250
if not (result.all or result.allnoiam or result.network or result.identity or
229251
result.compute or result.object or
230252
result.load or result.database or result.file or result.email or result.orm or result.container or
231-
result.streams or result.budgets):
253+
result.streams or result.budgets or result.monitoring or result.edge or result.announcement):
232254

233255
parser.print_help()
234256

@@ -291,6 +313,15 @@ def set_service_extract_flags(cmd):
291313
if cmd.all or cmd.allnoiam or cmd.budgets:
292314
prm.read_budgets = True
293315

316+
if cmd.all or cmd.allnoiam or cmd.monitoring:
317+
prm.read_monitoring_notifications = True
318+
319+
if cmd.all or cmd.allnoiam or cmd.announcement:
320+
prm.read_announcement = True
321+
322+
if cmd.all or cmd.allnoiam or cmd.edge:
323+
prm.read_edge = True
324+
294325
if cmd.noroot:
295326
prm.read_root_compartment = False
296327

@@ -313,12 +344,12 @@ def set_service_extract_flags(cmd):
313344
############################################
314345
# print data to json file
315346
############################################
316-
def print_to_json_file(file_name, data, header):
347+
def print_to_json_file(output, file_name, data, header):
317348

318349
with open(file_name, 'w') as outfile:
319350
json.dump(data, outfile, indent=4, sort_keys=False)
320351

321-
print(header + " has been exported to " + file_name)
352+
output.print_header(header + " exported to " + file_name, 0)
322353

323354

324355
##########################################################################

0 commit comments

Comments
 (0)