Skip to content

Commit

Permalink
Releasing version 2.88.2
Browse files Browse the repository at this point in the history
Releasing version 2.88.2
  • Loading branch information
oci-dex-release-bot authored Nov 22, 2022
2 parents 6057999 + 3c3ddb6 commit 8c09359
Show file tree
Hide file tree
Showing 32 changed files with 809 additions and 80 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ Change Log
All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog <http://keepachangelog.com/>`_.
====================
2.88.2 - 2022-11-22
====================

Added
-----
* Support for Resource Principals version 2.1 and 2.1.1
* Support for disabling Lazy Imports introduced in version `2.88.1` by setting the environment variable `OCI_PYTHON_SDK_LAZY_IMPORTS_DISABLED` to `True`

Changed
-------
* The upper bound for `cryptography` dependency has changed from `37.0.2` to versions less than `39.0.0`

====================
2.88.1 - 2022-11-15
====================
Expand Down
5 changes: 4 additions & 1 deletion docs/sdk_behaviors/enable_selective_service_imports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ line. For example, the script `here <https://github.com/oracle/oci-python-sdk#a
Deferred imports have been enabled by default in v2.88.1 of the oci-python-sdk when using Python 3.7+.
With deferred imports, only the modules that you explicitly import in your code will be imported,
thereby reducing the initial load time significantly. If you are either using Python 3.6 or using a version older
than v2.88.1, then follow the instructions mentioned in the section above to enable selective imports in your code.
than v2.88.1, then follow the instructions mentioned in the section above to enable selective imports in your code.

PS: If the lazy imports are causing an issue with your code then you can opt-out of this feature by setting the
environment variable `OCI_PYTHON_SDK_LAZY_IMPORTS_DISABLED` to True.
5 changes: 5 additions & 0 deletions examples/showoci/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

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

=====================
22.11.15 - 22.11.15
=====================
* Added privte ip addresses to subnet - json and csv

=====================
22.10.18 - 22.10.18
=====================
Expand Down
7 changes: 2 additions & 5 deletions examples/showoci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,10 @@ and [usage reports](https://docs.oracle.com/en-us/iaas/Content/Billing/Concepts/

## Executing using Cloud Shell:
```
1. install oci sdk package
pip3 install --user oci
2. clone the oci sdk repo
1. clone the oci sdk repo
git clone https://github.com/oracle/oci-python-sdk
3. run showoci with delegation token
2. run showoci with delegation token
cd oci-python-sdk/examples/showoci
python3 showoci.py -dt -ani
```
Expand Down
2 changes: 1 addition & 1 deletion examples/showoci/showoci.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
import contextlib
import os

version = "22.10.18"
version = "22.11.15"

##########################################################################
# check OCI version
Expand Down
4 changes: 4 additions & 0 deletions examples/showoci/showoci_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ def __get_core_network_vcn_subnets(self, vcn_id):

for subnet in subnets:

# get the list of private_ips
private_ips = self.service.search_multi_items(self.service.C_NETWORK, self.service.C_NETWORK_SUBNET_PIP, 'subnet_id', subnet['id'])

# get the list of security lists
sec_lists = []
if 'security_list_ids' in subnet:
Expand Down Expand Up @@ -636,6 +639,7 @@ def __get_core_network_vcn_subnets(self, vcn_id):
'time_created': subnet['time_created'],
'defined_tags': subnet['defined_tags'],
'freeform_tags': subnet['freeform_tags'],
'private_ips': private_ips,
'logs': self.service.get_logging_log(subnet['id'])
})
data.append(val)
Expand Down
35 changes: 34 additions & 1 deletion examples/showoci/showoci_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ def __print_core_network_vcn_subnet(self, subnets, vcn_compartment):
print(self.tabs + self.tabs + "DNS : " + subnet['dns'])
print(self.tabs + self.tabs + "DHCP : " + subnet['dhcp_options'])
print(self.tabs + self.tabs + "Route : " + subnet['route'])
print(self.tabs + self.tabs + "Prv IPs : " + str(len(subnet['private_ips'])) + " Private IPs Allocated")
for s in subnet['security_list']:
print(self.tabs + self.tabs + "Sec List: " + s)

Expand Down Expand Up @@ -3467,6 +3468,7 @@ class ShowOCICSV(object):
csv_network_drg_ipsec_tunnels = []
csv_network_drg_virtual_circuits = []
csv_network_subnet = []
csv_network_subnet_prv_ips = []
csv_network_security_list = []
csv_network_security_group = []
csv_network_routes = []
Expand Down Expand Up @@ -3547,6 +3549,7 @@ def generate_csv(self, data, csv_file_header, add_date_field=True, csv_columns="
self.__export_to_csv_file("block_volumes", self.csv_block_volumes)
self.__export_to_csv_file("block_volumes_backups", self.csv_block_volumes_backups)
self.__export_to_csv_file("network_subnet", self.csv_network_subnet)
self.__export_to_csv_file("network_subnet_prv_ips", self.csv_network_subnet_prv_ips)
self.__export_to_csv_file("network_drgs", self.csv_network_drg)
self.__export_to_csv_file("network_drg_ipsec_tunnels", self.csv_network_drg_ipsec_tunnels)
self.__export_to_csv_file("network_drg_virtual_circuits", self.csv_network_drg_virtual_circuits)
Expand Down Expand Up @@ -3641,7 +3644,7 @@ def __export_to_csv_file(self, file_subject, data):
for row in result:
writer.writerow(row)

print("CSV: " + file_subject.ljust(24) + " --> " + file_name)
print("CSV: " + file_subject.ljust(26) + " --> " + file_name)

except Exception as e:
raise Exception("Error in __export_to_csv_file: " + str(e.args))
Expand Down Expand Up @@ -3870,6 +3873,36 @@ def __csv_core_network_vcn_subnet(self, region_name, subnets, vcn, igw, sgw, nat
'subnet_id': subnet['id']}
self.csv_network_subnet.append(data)

# private ips
for ip in subnet['private_ips']:
data = {'region_name': region_name,
'vcn_name': vcn['display_name'],
'vcn_cidr': vcn['cidr_block'],
'vcn_cidrs': vcn['cidr_blocks'],
'vcn_compartment': vcn['compartment_name'],
'vcn_compartment_path': vcn['compartment_path'],
'subnet_name': subnet['name'],
'subnet_cidr': subnet['cidr_block'],
'subnet_compartment': subnet['compartment_name'],
'subnet_compartment_path': subnet['compartment_path'],
'ip_address': ip['ip_address'],
'display_name': ip['display_name'],
'hostname_label': ip['hostname_label'],
'is_primary': ip['is_primary'],
'time_created': ip['time_created'],
'ip_compartment_name': ip['compartment_name'],
'ip_compartment_path': ip['compartment_path'],
'ip_compartment_id': ip['compartment_id'],
'privateip_id': ip['id'],
'vlan_id': ip['vlan_id'],
'vcn_id': vcn['id'],
'subnet_id': subnet['id'],
'freeform_tags': self.__get_freeform_tags(ip['freeform_tags']),
'defined_tags': self.__get_defined_tags(ip['defined_tags'])
}

self.csv_network_subnet_prv_ips.append(data)

except Exception as e:
self.__print_error("__csv_core_network_vcn_subnet", e)

Expand Down
93 changes: 91 additions & 2 deletions examples/showoci/showoci_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def is_load_basic_network(self):
# class ShowOCIService
##########################################################################
class ShowOCIService(object):
oci_compatible_version = "2.82.0"
oci_compatible_version = "2.88.0"

##########################################################################
# Global Constants
Expand Down Expand Up @@ -164,6 +164,7 @@ class ShowOCIService(object):
C_NETWORK_ROUTE = 'route'
C_NETWORK_DHCP = 'dhcp'
C_NETWORK_SUBNET = 'subnet'
C_NETWORK_SUBNET_PIP = 'private_ips'
C_NETWORK_VC = 'virtualcircuit'
C_NETWORK_PRIVATEIP = 'privateip'
C_NETWORK_DNS_RESOLVERS = 'dns_resolvers'
Expand Down Expand Up @@ -665,6 +666,19 @@ def get_tenancy_id(self):
def get_compartment(self):
return self.data[self.C_IDENTITY][self.C_IDENTITY_COMPARTMENTS]

##########################################################################
# return compartment by id
##########################################################################
def get_compartment_by_id(self, compartment_id):
try:
compartments = self.data[self.C_IDENTITY][self.C_IDENTITY_COMPARTMENTS]
for c in compartments:
if c['id'] == compartment_id:
return c
return {}
except Exception as e:
self.__print_error("get_compartment_by_id", e)

##########################################################################
# return availability domains
##########################################################################
Expand Down Expand Up @@ -2010,7 +2024,6 @@ def __load_identity_availability_domain(self, region_name):
#
# Not done APIs:
# list_allowed_peer_regions_for_remote_peering(**kwargs)
# list_private_ips(**kwargs) - this is performance issue running all subnets
# list_public_ips(scope, compartment_id, **kwargs)
# list_cross_connect_groups(compartment_id, **kwargs)
# list_cross_connect_locations(compartment_id, **kwargs)
Expand Down Expand Up @@ -2044,6 +2057,7 @@ def __load_core_network_main(self):
# if to load all network resources initialize the keys
if self.flags.read_network:
# add the key to the network if not exists
self.__initialize_data_key(self.C_NETWORK, self.C_NETWORK_SUBNET_PIP)
self.__initialize_data_key(self.C_NETWORK, self.C_NETWORK_VLAN)
self.__initialize_data_key(self.C_NETWORK, self.C_NETWORK_SGW)
self.__initialize_data_key(self.C_NETWORK, self.C_NETWORK_NAT)
Expand Down Expand Up @@ -2084,6 +2098,7 @@ def __load_core_network_main(self):
if self.flags.read_network:

# append the data
network[self.C_NETWORK_SUBNET_PIP] += self.__load_core_network_subnet_private_ip(virtual_network, subnets)
network[self.C_NETWORK_VLAN] += self.__load_core_network_vlan(virtual_network, compartments, vcns)
network[self.C_NETWORK_LPG] += self.__load_core_network_lpg(virtual_network, compartments)
network[self.C_NETWORK_SGW] += self.__load_core_network_sgw(virtual_network, compartments)
Expand Down Expand Up @@ -3164,6 +3179,80 @@ def __load_core_network_subnet(self, virtual_network, compartments, vcns):
self.__print_error("__load_core_network_slist", e)
return data

##########################################################################
# data network read private ip for subnet
##########################################################################
def __load_core_network_subnet_private_ip(self, virtual_network, subnets):

data = []
cnt = 0
start_time = time.time()

try:

self.__load_print_status("Subnet Private IPs")

# loop on all subnets
for subnet in subnets:

private_ips = []
try:
private_ips = oci.pagination.list_call_get_all_results(
virtual_network.list_private_ips,
subnet_id=subnet['id'],
retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY
).data

except oci.exceptions.ServiceError as e:
if self.__check_service_error(e.code):
self.__load_print_auth_warning()
continue
raise

print("s", end="")

# loop on all sgws
# sgw = oci.core.models.ServiceGateway
for ip in private_ips:
val = {
'id': str(ip.id),
'compartment_id': str(ip.compartment_id),
'compartment_name': '',
'compartment_path': '',
'display_name': str(ip.display_name),
'hostname_label': str(ip.hostname_label),
'ip_address': str(ip.ip_address),
'is_primary': str(ip.is_primary),
'vlan_id': str(ip.vlan_id),
'subnet_id': str(ip.subnet_id),
'time_created': str(ip.time_created)[0:16],
'vnic_id': str(ip.vnic_id),
'defined_tags': [] if ip.defined_tags is None else ip.defined_tags,
'freeform_tags': [] if ip.freeform_tags is None else ip.freeform_tags,
'region_name': str(self.config['region'])}

# compartment
c = self.get_compartment_by_id(str(ip.compartment_id))
if c:
val['compartment_name'] = c['name']
val['compartment_path'] = c['path']

data.append(val)
cnt += 1

self.__load_print_cnt(cnt, start_time)
return data

except oci.exceptions.RequestException as e:

if self.__check_request_error(e):
return data

raise
except Exception as e:
self.__print_error("__load_core_network_subnet_private_ip", e)
return data

##########################################################################
# data network read sgw
##########################################################################
Expand Down
5 changes: 5 additions & 0 deletions examples/usage_reports_to_adw/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

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

=====================
22.11.22 - 2022.11.22
=====================
* Update the list price API

=====================
22.10.15 - 2022.10.15
=====================
Expand Down
10 changes: 5 additions & 5 deletions examples/usage_reports_to_adw/apex_demo_app/usage.demo.apex.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ whenever sqlerror exit sql.sqlcode rollback
begin
wwv_flow_imp.import_begin (
p_version_yyyy_mm_dd=>'2022.04.12'
,p_release=>'22.1.4'
,p_release=>'22.1.6'
,p_default_workspace_id=>9710643564672463
,p_default_application_id=>100
,p_default_id_offset=>0
Expand All @@ -28,7 +28,7 @@ prompt APPLICATION 100 - OCI Usage and Cost Report
-- Application Export:
-- Application: 100
-- Name: OCI Usage and Cost Report
-- Date and Time: 19:57 Wednesday September 28, 2022
-- Date and Time: 02:17 Wednesday November 16, 2022
-- Exported By: [email protected]
-- Flashback: 0
-- Export Type: Application Export
Expand Down Expand Up @@ -69,7 +69,7 @@ prompt APPLICATION 100 - OCI Usage and Cost Report
-- Reports:
-- E-Mail:
-- Supporting Objects: Excluded
-- Version: 22.1.4
-- Version: 22.1.6
-- Instance ID: 9710412995014033
--

Expand Down Expand Up @@ -106,7 +106,7 @@ wwv_flow_imp.create_flow(
,p_public_user=>'APEX_PUBLIC_USER'
,p_proxy_server=>nvl(wwv_flow_application_install.get_proxy,'')
,p_no_proxy_domains=>nvl(wwv_flow_application_install.get_no_proxy_domains,'')
,p_flow_version=>'Release 22.10.04'
,p_flow_version=>'Release 22.11.22'
,p_flow_status=>'AVAILABLE_W_EDIT_LINK'
,p_flow_unavailable_text=>'This application is currently unavailable at this time.'
,p_exact_substitutions_only=>'Y'
Expand All @@ -128,7 +128,7 @@ wwv_flow_imp.create_flow(
,p_substitution_string_01=>'APP_NAME'
,p_substitution_value_01=>'OCI Usage and Cost Report'
,p_last_updated_by=>'[email protected]'
,p_last_upd_yyyymmddhh24miss=>'20220928195342'
,p_last_upd_yyyymmddhh24miss=>'20221116021420'
,p_file_prefix => nvl(wwv_flow_application_install.get_static_app_file_prefix,'')
,p_files_version=>3
,p_ui_type_name => null
Expand Down
4 changes: 2 additions & 2 deletions examples/usage_reports_to_adw/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ Please check step by step daily report guide - [step_by_step_daily_report.md](st
- ObjectStorageClient.list_objects - Policy OBJECT_INSPECT
- ObjectStorageClient.get_object - Policy OBJECT_READ

## REST API Used:
- https://itra.oraclecloud.com/itas/.anon/myservices/api/v1/products?partNumber=XX
## REST API Used Doc:
- https://docs.oracle.com/en-us/iaas/Content/GSG/Tasks/signingup_topic-Estimating_Costs.htm#accessing_list_pricing

## Python 3 OCI SDK

Expand Down
4 changes: 2 additions & 2 deletions examples/usage_reports_to_adw/setup/check_connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
print(" Okay.")

print("\n Check Access to OCI Public Rates URL (Required Internet Access)...")
api_url = "https://itra.oraclecloud.com/itas/.anon/myservices/api/v1/products?partNumber=B88206"
resp = requests.get(api_url, headers={'X-Oracle-Accept-CurrencyCode': 'USD'})
api_url = "https://apexapps.oracle.com/pls/apex/cetools/api/v1/products/?currencyCode=USD"
resp = requests.get(api_url)
print(" Okay.")

print("\n Check Completed Successfully.")
Expand Down
Empty file modified examples/usage_reports_to_adw/shell_scripts/run_daily_report.sh
100755 → 100644
Empty file.
Empty file modified examples/usage_reports_to_adw/shell_scripts/run_gather_stats.sh
100755 → 100644
Empty file.
Empty file.
Empty file.
Loading

0 comments on commit 8c09359

Please sign in to comment.