Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ 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.12.3 - 2020-04-07
====================

Added
-----
* Support for changing compartments of runs and applications in the Data Flow service
* Support for getting usage information in the Key Management Vault service
* Support for custom Key Management service endpoints and private endpoints on stream pools in the Streaming service
* Fixed kms_example and added secrets examples

====================
2.12.2 - 2020-03-31
====================
Expand Down
2 changes: 2 additions & 0 deletions docs/api/data_flow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Data Flow
oci.data_flow.models.Application
oci.data_flow.models.ApplicationParameter
oci.data_flow.models.ApplicationSummary
oci.data_flow.models.ChangeApplicationCompartmentDetails
oci.data_flow.models.ChangeRunCompartmentDetails
oci.data_flow.models.CreateApplicationDetails
oci.data_flow.models.CreateRunDetails
oci.data_flow.models.Run
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ChangeApplicationCompartmentDetails
===================================

.. currentmodule:: oci.data_flow.models

.. autoclass:: ChangeApplicationCompartmentDetails
:show-inheritance:
:special-members: __init__
:members:
:undoc-members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ChangeRunCompartmentDetails
===========================

.. currentmodule:: oci.data_flow.models

.. autoclass:: ChangeRunCompartmentDetails
:show-inheritance:
:special-members: __init__
:members:
:undoc-members:
:inherited-members:
1 change: 1 addition & 0 deletions docs/api/key_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ Key Management
oci.key_management.models.UpdateVaultDetails
oci.key_management.models.Vault
oci.key_management.models.VaultSummary
oci.key_management.models.VaultUsage
oci.key_management.models.WrappedImportKey
oci.key_management.models.WrappingKey
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
VaultUsage
==========

.. currentmodule:: oci.key_management.models

.. autoclass:: VaultUsage
:show-inheritance:
:special-members: __init__
:members:
:undoc-members:
:inherited-members:
4 changes: 4 additions & 0 deletions docs/api/streaming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ Streaming
oci.streaming.models.CreateStreamDetails
oci.streaming.models.CreateStreamPoolDetails
oci.streaming.models.Cursor
oci.streaming.models.CustomEncryptionKey
oci.streaming.models.CustomEncryptionKeyDetails
oci.streaming.models.Group
oci.streaming.models.KafkaSettings
oci.streaming.models.Message
oci.streaming.models.PartitionReservation
oci.streaming.models.PrivateEndpointDetails
oci.streaming.models.PrivateEndpointSettings
oci.streaming.models.PutMessagesDetails
oci.streaming.models.PutMessagesDetailsEntry
oci.streaming.models.PutMessagesResult
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CustomEncryptionKey
===================

.. currentmodule:: oci.streaming.models

.. autoclass:: CustomEncryptionKey
:show-inheritance:
:special-members: __init__
:members:
:undoc-members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CustomEncryptionKeyDetails
==========================

.. currentmodule:: oci.streaming.models

.. autoclass:: CustomEncryptionKeyDetails
:show-inheritance:
:special-members: __init__
:members:
:undoc-members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PrivateEndpointDetails
======================

.. currentmodule:: oci.streaming.models

.. autoclass:: PrivateEndpointDetails
:show-inheritance:
:special-members: __init__
:members:
:undoc-members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PrivateEndpointSettings
=======================

.. currentmodule:: oci.streaming.models

.. autoclass:: PrivateEndpointSettings
:show-inheritance:
:special-members: __init__
:members:
:undoc-members:
:inherited-members:
4 changes: 2 additions & 2 deletions examples/kms_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def decrypt_data(key_crypto_client, key_id, encrypted_text):
v_id = vault.id
print(" Created vault {} with id : {}".format(vault.name, vault.id))

updated_vault = update_vault(v_id, VAULT_UPDATE_NAME, vault_client)
updated_vault = update_vault(v_id, VAULT_UPDATE_NAME, vault_client).data
print(" Updated vault {} with name : {}".format(vault.id, updated_vault.name))

change_vault_compartment(v_id, vault_client, target_compartment)
Expand All @@ -301,7 +301,7 @@ def decrypt_data(key_crypto_client, key_id, encrypted_text):
cancel_deletion_vault(v_id, vault_client_composite)

# Create key in given compartment
key = create_key(vault_management_client_composite, KEY_NAME, v_id)
key = create_key(vault_management_client_composite, KEY_NAME, v_id).data
k_id = key.id
print(" Created key {} with id : {}".format(key.name, key.id))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,18 @@ Executing using Cloud Shell:
.. code-block::

1. Create virtual env of python
python -m venv python_venv
python3 -m venv python_venv
source python_venv/bin/activate

2. install oci sdk package
pip install oci

3. clone the oci sdk repo
cd $HOME
git init
git clone https://github.com/oracle/oci-python-sdk

4. Config OCI config file - ~/.oci/config
Please follow SDK config documentation - https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm

5. Execute
4. Execute
cd $HOME/oci-python-sdk/examples/list_ipsec_and_virtual_circuits_in_tenancy
python list_all_ipsec_tunnels_in_tenancy.py
python list_all_virtual_circuits_in_tenancy.py
python list_all_ipsec_tunnels_in_tenancy.py -dt
python list_all_virtual_circuits_in_tenancy.py -dt


Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@
# -t config - Config file section to use (tenancy profile)
# -p proxy - Set Proxy (i.e. www-proxy-server.com:80)
# -ip - Use Instance Principals for Authentication
# -dt - Use Instance Principals with delegation token for cloud shell
##########################################################################
from __future__ import print_function
import sys
import argparse
import datetime
import oci
import json
import os


##########################################################################
Expand Down Expand Up @@ -82,10 +84,10 @@ def check_service_error(code):

##########################################################################
# Create signer for Authentication
# Input - config_profile and is_instance_principals
# Input - config_profile and is_instance_principals and is_delegation_token
# Output - config and signer objects
##########################################################################
def create_signer(config_profile, is_instance_principals):
def create_signer(config_profile, is_instance_principals, is_delegation_token):

# if instance principals authentications
if is_instance_principals:
Expand All @@ -98,8 +100,55 @@ def create_signer(config_profile, is_instance_principals):
print_header("Error obtaining instance principals certificate, aborting")
raise SystemExit

# -----------------------------
# Delegation Token
# -----------------------------
elif is_delegation_token:

try:
# check if env variables OCI_CONFIG_FILE, OCI_CONFIG_PROFILE exist and use them
env_config_file = os.environ.get('OCI_CONFIG_FILE')
env_config_section = os.environ.get('OCI_CONFIG_PROFILE')

# check if file exist
if env_config_file is None or env_config_section is None:
print("*** OCI_CONFIG_FILE and OCI_CONFIG_PROFILE env variables not found, abort. ***")
print("")
raise SystemExit

# check if file exist
if not os.path.isfile(env_config_file):
print("*** Config File " + env_config_file + " does not exist, Abort. ***")
print("")
raise SystemExit

config = oci.config.from_file(env_config_file, env_config_section)
delegation_token_location = config["delegation_token_file"]

with open(delegation_token_location, 'r') as delegation_token_file:
delegation_token = delegation_token_file.read().strip()
# get signer from delegation token
signer = oci.auth.signers.InstancePrincipalsDelegationTokenSigner(delegation_token=delegation_token)

return config, signer

except KeyError:
print("* Key Error obtaining delegation_token_file")
raise SystemExit

except Exception:
raise

# -----------------------------
# config file authentication
# -----------------------------
else:
# check if file exist
if not os.path.isfile(oci.config.DEFAULT_LOCATION):
print("*** Config File " + oci.config.DEFAULT_LOCATION + " does not exist, Abort. ***")
print("")
raise SystemExit

config = oci.config.from_file(
oci.config.DEFAULT_LOCATION,
(config_profile if config_profile else oci.config.DEFAULT_PROFILE)
Expand Down Expand Up @@ -147,6 +196,7 @@ def identity_read_compartments(identity, tenancy):
parser.add_argument('-t', default="", dest='config_profile', help='Config file section to use (tenancy profile)')
parser.add_argument('-p', default="", dest='proxy', help='Set Proxy (i.e. www-proxy-server.com:80) ')
parser.add_argument('-ip', action='store_true', default=False, dest='is_instance_principals', help='Use Instance Principals for Authentication')
parser.add_argument('-dt', action='store_true', default=False, dest='is_delegation_token', help='Use Delegation Token for Authentication')
cmd = parser.parse_args()

# Start print time info
Expand All @@ -156,7 +206,7 @@ def identity_read_compartments(identity, tenancy):
print("Command Line : " + ' '.join(x for x in sys.argv[1:]))

# Identity extract compartments
config, signer = create_signer(cmd.config_profile, cmd.is_instance_principals)
config, signer = create_signer(cmd.config_profile, cmd.is_instance_principals, cmd.is_delegation_token)
compartments = []
tenancy = None
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@
# -t config - Config file section to use (tenancy profile)
# -p proxy - Set Proxy (i.e. www-proxy-server.com:80)
# -ip - Use Instance Principals for Authentication
# -dt - Use Instance Principals with delegation token for cloud shell
##########################################################################
from __future__ import print_function
import sys
import argparse
import datetime
import oci
import json
import os


##########################################################################
Expand Down Expand Up @@ -81,10 +83,10 @@ def check_service_error(code):

##########################################################################
# Create signer for Authentication
# Input - config_profile and is_instance_principals
# Input - config_profile and is_instance_principals and is_delegation_token
# Output - config and signer objects
##########################################################################
def create_signer(config_profile, is_instance_principals):
def create_signer(config_profile, is_instance_principals, is_delegation_token):

# if instance principals authentications
if is_instance_principals:
Expand All @@ -97,8 +99,55 @@ def create_signer(config_profile, is_instance_principals):
print_header("Error obtaining instance principals certificate, aborting")
raise SystemExit

# -----------------------------
# Delegation Token
# -----------------------------
elif is_delegation_token:

try:
# check if env variables OCI_CONFIG_FILE, OCI_CONFIG_PROFILE exist and use them
env_config_file = os.environ.get('OCI_CONFIG_FILE')
env_config_section = os.environ.get('OCI_CONFIG_PROFILE')

# check if file exist
if env_config_file is None or env_config_section is None:
print("*** OCI_CONFIG_FILE and OCI_CONFIG_PROFILE env variables not found, abort. ***")
print("")
raise SystemExit

# check if file exist
if not os.path.isfile(env_config_file):
print("*** Config File " + env_config_file + " does not exist, Abort. ***")
print("")
raise SystemExit

config = oci.config.from_file(env_config_file, env_config_section)
delegation_token_location = config["delegation_token_file"]

with open(delegation_token_location, 'r') as delegation_token_file:
delegation_token = delegation_token_file.read().strip()
# get signer from delegation token
signer = oci.auth.signers.InstancePrincipalsDelegationTokenSigner(delegation_token=delegation_token)

return config, signer

except KeyError:
print("* Key Error obtaining delegation_token_file")
raise SystemExit

except Exception:
raise

# -----------------------------
# config file authentication
# -----------------------------
else:
# check if file exist
if not os.path.isfile(oci.config.DEFAULT_LOCATION):
print("*** Config File " + oci.config.DEFAULT_LOCATION + " does not exist, Abort. ***")
print("")
raise SystemExit

config = oci.config.from_file(
oci.config.DEFAULT_LOCATION,
(config_profile if config_profile else oci.config.DEFAULT_PROFILE)
Expand Down Expand Up @@ -146,16 +195,17 @@ def identity_read_compartments(identity, tenancy):
parser.add_argument('-t', default="", dest='config_profile', help='Config file section to use (tenancy profile)')
parser.add_argument('-p', default="", dest='proxy', help='Set Proxy (i.e. www-proxy-server.com:80) ')
parser.add_argument('-ip', action='store_true', default=False, dest='is_instance_principals', help='Use Instance Principals for Authentication')
parser.add_argument('-dt', action='store_true', default=False, dest='is_delegation_token', help='Use Delegation Token for Authentication')
cmd = parser.parse_args()

# Start print time info
start_time = str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
print_header("Running List IPSecTunnels")
print_header("Running List List Virtual Circuits")
print("Starts at " + str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
print("Command Line : " + ' '.join(x for x in sys.argv[1:]))

# Identity extract compartments
config, signer = create_signer(cmd.config_profile, cmd.is_instance_principals)
config, signer = create_signer(cmd.config_profile, cmd.is_instance_principals, cmd.is_delegation_token)
compartments = []
tenancy = None
try:
Expand Down
Loading