Skip to content

Commit

Permalink
Merge pull request #55 from oracle/release_2018-05-03
Browse files Browse the repository at this point in the history
Releasing version 1.3.20
  • Loading branch information
juanalblue authored May 4, 2018
2 parents c56e082 + e4aa3e0 commit 97e2c7f
Show file tree
Hide file tree
Showing 79 changed files with 5,085 additions and 292 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.

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

====================
1.3.20 - 2018-05-03
====================

Added
-----
* Support for returning names for events in the Audit service
* Support for multiple hostnames per listener in the Load Balancing service
* Helper function for Base64-ing scripts for user_data in launch instance options

* An example of Base64-ing scripts for user_data can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/launch_instance_example.py>`__.

Changed
-------
* Add httpsig_cffi as a vendored package

Fixed
-----
* Multipart object put resume to account when final part is less than part size

====================
1.3.19 - 2018-04-19
====================
Expand Down
10 changes: 10 additions & 0 deletions Thirdpartyreadme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
httpsig_cffi
=============
Copyright (c) 2014 Adam Knight
Copyright (c) 2012 Adam T. Lindsay (original author)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 4 additions & 0 deletions docs/api/load_balancer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ Load Balancer
oci.load_balancer.models.CreateBackendDetails
oci.load_balancer.models.CreateBackendSetDetails
oci.load_balancer.models.CreateCertificateDetails
oci.load_balancer.models.CreateHostnameDetails
oci.load_balancer.models.CreateListenerDetails
oci.load_balancer.models.CreateLoadBalancerDetails
oci.load_balancer.models.CreatePathRouteSetDetails
oci.load_balancer.models.HealthCheckResult
oci.load_balancer.models.HealthChecker
oci.load_balancer.models.HealthCheckerDetails
oci.load_balancer.models.Hostname
oci.load_balancer.models.HostnameDetails
oci.load_balancer.models.IpAddress
oci.load_balancer.models.Listener
oci.load_balancer.models.ListenerDetails
Expand All @@ -55,6 +58,7 @@ Load Balancer
oci.load_balancer.models.UpdateBackendDetails
oci.load_balancer.models.UpdateBackendSetDetails
oci.load_balancer.models.UpdateHealthCheckerDetails
oci.load_balancer.models.UpdateHostnameDetails
oci.load_balancer.models.UpdateListenerDetails
oci.load_balancer.models.UpdateLoadBalancerDetails
oci.load_balancer.models.UpdatePathRouteSetDetails
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CreateHostnameDetails
=====================

.. currentmodule:: oci.load_balancer.models

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

.. currentmodule:: oci.load_balancer.models

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

.. currentmodule:: oci.load_balancer.models

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

.. currentmodule:: oci.load_balancer.models

.. autoclass:: UpdateHostnameDetails
:show-inheritance:
:special-members: __init__
:members:
:undoc-members:
:inherited-members:
2 changes: 2 additions & 0 deletions docs/api/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

.. autofunction:: to_dict

.. autofunction:: file_content_as_launch_instance_user_data

.. autoclass:: Sentinel
42 changes: 23 additions & 19 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,34 @@ The Python SDK supports operations for the following services:

You can install the Python SDK through the Python Package Index (PyPI), or alternatively through GitHub.

**PyPi**
Set up a virtual environment
-----------------------------

Oracle recommends that you run the SDK in a virtual environment with virtualenv. This allows
you to isolate the dependencies for the SDK and avoids any potential conflicts with other Python packages
which may already be installed (e.g. in your system-wide Python).

With Linux, virtualenv is usually in a separate package from the main Python package.
If you need to install virtualenv, use ``pip install virtualenv``.
To create and activate a virtual environment::

virtualenv <environment name>
source <environment name>/bin/activate

For example::

virtualenv oci_sdk_env
source oci_sdk_env/bin/activate

PyPi
-----

To install from `PyPI <https://pypi.python.org/pypi/oci>`_ use the following command::

pip install oci

**GitHub**
GitHub
-------

To install from GitHub:

Expand All @@ -74,23 +95,6 @@ To install from GitHub:
Use ``pip install -U pip`` and then try to install the whl file again.


**Virtual environment (Optional)**

Although optional, Oracle recommends that you run the SDK in a virtual environment with virtualenv.

With Linux, it's usually in a separate package from the main Python package.
If you need to install virtualenv, use pip install virtualenv.
To create and activate a virtual environment::

virtualenv <environment name>
source <environment name>/bin/activate

For example::

virtualenv oci_sdk_env
source oci_sdk_env/bin/activate


=====================
Configuring the SDK
=====================
Expand Down
8 changes: 8 additions & 0 deletions examples/launch_instance/user_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# This file will be Base64-ed and provided as user_data when launching an instance.
# See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/datatypes/LaunchInstanceDetails
# for more information

mkdir /tmp/mydir
touch /tmp/mydir/mytxt.txt
11 changes: 11 additions & 0 deletions examples/launch_instance_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,17 @@ def get_image(compute, operating_system, operating_system_version, shape):
'some_metadata_item': 'some item value'
}

# We can also provide a user_data key in the metadata that will be used by Cloud-Init
# to run custom scripts or provide custom Cloud-Init configuration. The contents of this
# key should be Base64-encoded data and the SDK offers a convenience function to transform
# a file at a given path to that encoded data
#
# See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/datatypes/LaunchInstanceDetails
# for more information
instance_metadata['user_data'] = oci.util.file_content_as_launch_instance_user_data(
'examples/launch_instance/user_data.sh'
)

# Extended metadata differs from normal metadata in that it can support nested maps/dicts. If you are providing
# these, you should consider whether defined and freeform tags on an instance would better meet your use case.
instance_extended_metadata = {
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ configparser==3.5.0
coverage==4.4.1
cryptography==2.1.3
flake8==3.5.0
httpsig_cffi==15.0.0
mock==2.0.0
PyJWT==1.5.3
pyOpenSSL==17.4.0
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def open_relative(*path):
"certifi",
"configparser==3.5.0",
"cryptography==2.1.3",
"httpsig_cffi==15.0.0",
"PyJWT==1.5.3",
"pyOpenSSL<=17.4.0",
"python-dateutil==2.5.3",
Expand Down
4 changes: 4 additions & 0 deletions src/oci/_vendor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# coding: utf-8
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.

from . import httpsig_cffi # noqa: F401
7 changes: 7 additions & 0 deletions src/oci/_vendor/httpsig_cffi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# coding: utf-8
# Modified Work: Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved.
# Original Work: Copyright (c) 2014 Adam Knight
# Original Work: Copyright (c) 2012 Adam T. Lindsay (original author)

from .sign import Signer, HeaderSigner # noqa: F401
from .verify import Verifier, HeaderVerifier # noqa: F401
47 changes: 47 additions & 0 deletions src/oci/_vendor/httpsig_cffi/requests_auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# coding: utf-8
# Modified Work: Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved.
# Original Work: Copyright (c) 2014 Adam Knight
# Original Work: Copyright (c) 2012 Adam T. Lindsay (original author)

from requests.auth import AuthBase
try:
# Python 3
from urllib.parse import urlparse
except ImportError:
# Python 2
from urlparse import urlparse

from .sign import HeaderSigner


class HTTPSignatureAuth(AuthBase):
'''
Sign a request using the http-signature scheme.
https://github.com/joyent/node-http-signature/blob/master/http_signing.md
key_id is the mandatory label indicating to the server which secret to use
secret is the filename of a pem file in the case of rsa, a password string in the case of an hmac algorithm
algorithm is one of the six specified algorithms
headers is a list of http headers to be included in the signing string, defaulting to "Date" alone.
'''
def __init__(self, key_id='', secret='', algorithm=None, headers=None):
headers = headers or []
self.header_signer = HeaderSigner(
key_id=key_id,
secret=secret,
algorithm=algorithm,
headers=headers
)
self.uses_host = 'host' in [h.lower() for h in headers]

def __call__(self, r):
headers = self.header_signer.sign(
r.headers,
# 'Host' header unavailable in request object at this point
# if 'host' header is needed, extract it from the url
host=urlparse(r.url).netloc if self.uses_host else None,
method=r.method,
path=r.path_url
)
r.headers.update(headers)
return r
Loading

0 comments on commit 97e2c7f

Please sign in to comment.