Skip to content

Commit 2c751dc

Browse files
committed
Releasing version 1.3.13
1 parent 2b5bbe3 commit 2c751dc

File tree

82 files changed

+8536
-2662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+8536
-2662
lines changed

CHANGELOG.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ 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+
1.3.13 - 2018-01-25
9+
====================
10+
11+
Added
12+
-----
13+
* Support for using the ``ObjectReadWithoutList`` public access type when creating and updating buckets
14+
* Support for dynamic groups in Identity Service
15+
* Support for instance principals authentication when calling OCI services. An example of how to use instance principals authentication can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/instance_principals_examples.py>`_.
16+
* Support for configuring idle timeout for listeners in Load Balancer Service
17+
* Support for VNC console connections in Compute Service
18+
719
====================
820
1.3.12 - 2018-01-11
921
====================

docs/api/index.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,58 @@ Load Balancer
216216

217217
.. autoclass:: Signer
218218

219+
=====================
220+
Additional Signers
221+
=====================
222+
223+
.. module:: oci.auth.signers
224+
225+
.. autoclass:: SecurityTokenSigner
226+
:special-members: __init__
227+
:members:
228+
229+
.. autoclass:: X509FederationClientBasedSecurityTokenSigner
230+
:special-members: __init__
231+
:members:
232+
233+
.. autoclass:: InstancePrincipalsSecurityTokenSigner
234+
:special-members: __init__
235+
:members:
236+
237+
============================
238+
X509 Certificate Retrievers
239+
============================
240+
241+
.. module:: oci.auth.certificate_retriever
242+
243+
.. autoclass:: UrlBasedCertificateRetriever
244+
:special-members: __init__
245+
:members:
246+
247+
.. autoclass:: PEMStringCertificateRetriever
248+
:special-members: __init__
249+
:members:
250+
251+
.. autoclass:: FileBasedCertificateRetriever
252+
:special-members: __init__
253+
:members:
254+
255+
====================================
256+
X509 Certificate Federation Client
257+
====================================
258+
259+
.. module:: oci.auth.federation_client
260+
261+
.. autoclass:: X509FederationClient
262+
:special-members: __init__
263+
:members:
264+
265+
.. module:: oci.auth.session_key_supplier
266+
267+
.. autoclass:: SessionKeySupplier
268+
:special-members: __init__
269+
:members:
270+
219271
===========
220272
Utilities
221273
===========

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3+
import datetime
34
import sys
45
import pkg_resources
56
import sphinx_rtd_theme
@@ -22,7 +23,7 @@
2223

2324
# General information about the project.
2425
project = "oci"
25-
copyright = "2016, 2017, Oracle"
26+
copyright = "2016, {}, Oracle".format(datetime.datetime.now().year)
2627
author = "Oracle"
2728

2829
try:

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ To get started, head over to the :ref:`installation instructions <install>` or s
5454
raw-requests
5555
waiters
5656
pagination
57+
sdk-with-proxy
5758
api/index
5859
contributions
5960
notifications

docs/sdk-with-proxy.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. _sdk-with-proxy:
2+
3+
.. raw:: html
4+
5+
<script type='text/javascript'>
6+
var oldDocsHost = 'oracle-bare-metal-cloud-services-python-sdk';
7+
if (window.location.href.indexOf(oldDocsHost) != -1) {
8+
window.location.href = 'https://oracle-bare-metal-cloud-services-python-sdk.readthedocs.io/en/latest/deprecation-notice.html';
9+
}
10+
</script>
11+
12+
Using the SDK with a proxy server
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
The Python SDK uses the `Requests <http://docs.python-requests.org/en/master/>`_ library to make calls to OCI services. If your environment requires you to use a proxy server for outgoing HTTP requests
15+
then you can set this up in the following ways:
16+
17+
* Configuring environment variable as described `here <http://docs.python-requests.org/en/master/user/advanced/#proxies>`_
18+
* Modifying the underlying Requests `Session <http://docs.python-requests.org/en/master/api/#request-sessions>`_ object for a service client
19+
20+
In order to modify the underlying Session object, you can do something similar to:
21+
22+
.. code-block:: python
23+
24+
import oci
25+
26+
config = oci.config.from_file()
27+
compute = oci.core.ComputeClient(config)
28+
29+
compute.base_client.session.proxies = { 'https': 'proxy.example.org:80' }
30+
31+
The key parts are that the underlying Session object can be accessed via ``base_client.session`` and we can then modify the `proxies <http://docs.python-requests.org/en/master/api/#requests.Session.proxies>`_
32+
dictionary to add any required proxies.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# coding: utf-8
2+
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
3+
4+
import oci
5+
6+
compartment_id = '<your compartment id here>'
7+
8+
# By default this will hit the auth service in the region returned by http://169.254.169.254/opc/v1/instance/region on the instance.
9+
signer = oci.auth.signers.InstancePrincipalsSecurityTokenSigner()
10+
11+
# In the base case, configuration does not need to be provided as the region and tenancy are obtained from the InstancePrincipalsSecurityTokenSigner
12+
identity_client = oci.identity.IdentityClient(config={}, signer=signer)
13+
14+
print(identity_client.list_regions().data)
15+
print(identity_client.list_availability_domains(compartment_id=compartment_id).data)
16+
17+
# If you explicitly specify a region in configuration, it will be honoured. In the below example, you can also change the region later by doing:
18+
#
19+
# object_storage_client.base_client.set_region('us-ashburn-1')
20+
#
21+
# You can also explicitly set an endpoint via:
22+
#
23+
# object_storage_client.base_client.set_endpoint('https://<some endpoint>')
24+
object_storage_client = oci.object_storage.ObjectStorageClient(config={'region': 'us-ashburn-1'}, signer=signer)
25+
print(object_storage_client.get_namespace().data)
26+
print(object_storage_client.list_buckets(namespace_name=object_storage_client.get_namespace().data, compartment_id=compartment_id).data)

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ cryptography==2.1.3
55
flake8==3.5.0
66
httpsig_cffi==15.0.0
77
mock==2.0.0
8+
PyJWT==1.5.3
89
pyOpenSSL==17.4.0
910
pytest==3.2.3
1011
pytest-catchlog==1.2.2
@@ -15,4 +16,5 @@ sphinx-rtd-theme==0.1.9
1516
six==1.11.0
1617
sphinx==1.6.4
1718
tox==2.9.1
18-
wheel==0.29.0
19+
vcrpy==1.11.1
20+
wheel==0.29.0

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def open_relative(*path):
3333
"configparser==3.5.0",
3434
"cryptography==2.1.3",
3535
"httpsig_cffi==15.0.0",
36+
"PyJWT==1.5.3",
3637
"pyOpenSSL<=17.4.0",
3738
"python-dateutil==2.5.3",
3839
"pytz==2016.10",

src/oci/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
33

44
from . import audit, core, database, identity, load_balancer, object_storage
5-
from . import config, constants, decorators, exceptions, regions, pagination
5+
from . import auth, config, constants, decorators, exceptions, regions, pagination, retry
66
from .base_client import BaseClient
77
from .request import Request
88
from .response import Response
@@ -12,6 +12,6 @@
1212

1313

1414
__all__ = [
15-
"BaseClient", "Error", "Request", "Response", "Signer", "config", "constants", "decorators", "exceptions", "regions", "wait_until", "pagination",
15+
"BaseClient", "Error", "Request", "Response", "Signer", "config", "constants", "decorators", "exceptions", "regions", "wait_until", "pagination", "auth", "retry",
1616
"audit", "core", "database", "identity", "load_balancer", "object_storage"
1717
]

src/oci/audit/audit_client.py

Lines changed: 69 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
from __future__ import absolute_import
55

6+
import requests # noqa: F401
67
import six
78

9+
from .. import retry # noqa: F401
810
from ..base_client import BaseClient
911
from ..config import get_config_value_or_default, validate_config
1012
from ..signer import Signer
@@ -15,16 +17,19 @@
1517

1618
class AuditClient(object):
1719

18-
def __init__(self, config):
19-
validate_config(config)
20-
signer = Signer(
21-
tenancy=config["tenancy"],
22-
user=config["user"],
23-
fingerprint=config["fingerprint"],
24-
private_key_file_location=config.get("key_file"),
25-
pass_phrase=get_config_value_or_default(config, "pass_phrase"),
26-
private_key_content=config.get("key_content")
27-
)
20+
def __init__(self, config, **kwargs):
21+
validate_config(config, signer=kwargs.get('signer'))
22+
if 'signer' in kwargs:
23+
signer = kwargs['signer']
24+
else:
25+
signer = Signer(
26+
tenancy=config["tenancy"],
27+
user=config["user"],
28+
fingerprint=config["fingerprint"],
29+
private_key_file_location=config.get("key_file"),
30+
pass_phrase=get_config_value_or_default(config, "pass_phrase"),
31+
private_key_content=config.get("key_content")
32+
)
2833
self.base_client = BaseClient("audit", config, signer, audit_type_mapping)
2934

3035
def get_configuration(self, compartment_id, **kwargs):
@@ -42,9 +47,11 @@ def get_configuration(self, compartment_id, **kwargs):
4247
resource_path = "/configuration"
4348
method = "GET"
4449

45-
if kwargs:
50+
expected_kwargs = ["retry_strategy"]
51+
extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs]
52+
if extra_kwargs:
4653
raise ValueError(
47-
"get_configuration got unknown kwargs: {!r}".format(kwargs))
54+
"get_configuration got unknown kwargs: {!r}".format(extra_kwargs))
4855

4956
query_params = {
5057
"compartmentId": compartment_id
@@ -56,12 +63,21 @@ def get_configuration(self, compartment_id, **kwargs):
5663
"content-type": "application/json"
5764
}
5865

59-
return self.base_client.call_api(
60-
resource_path=resource_path,
61-
method=method,
62-
query_params=query_params,
63-
header_params=header_params,
64-
response_type="Configuration")
66+
if 'retry_strategy' in kwargs:
67+
return kwargs['retry_strategy'].make_retrying_call(
68+
self.base_client.call_api,
69+
resource_path=resource_path,
70+
method=method,
71+
query_params=query_params,
72+
header_params=header_params,
73+
response_type="Configuration")
74+
else:
75+
return self.base_client.call_api(
76+
resource_path=resource_path,
77+
method=method,
78+
query_params=query_params,
79+
header_params=header_params,
80+
response_type="Configuration")
6581

6682
def list_events(self, compartment_id, start_time, end_time, **kwargs):
6783
"""
@@ -101,6 +117,7 @@ def list_events(self, compartment_id, start_time, end_time, **kwargs):
101117

102118
# Don't accept unknown kwargs
103119
expected_kwargs = [
120+
"retry_strategy",
104121
"page",
105122
"opc_request_id"
106123
]
@@ -124,12 +141,21 @@ def list_events(self, compartment_id, start_time, end_time, **kwargs):
124141
}
125142
header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing}
126143

127-
return self.base_client.call_api(
128-
resource_path=resource_path,
129-
method=method,
130-
query_params=query_params,
131-
header_params=header_params,
132-
response_type="list[AuditEvent]")
144+
if 'retry_strategy' in kwargs:
145+
return kwargs['retry_strategy'].make_retrying_call(
146+
self.base_client.call_api,
147+
resource_path=resource_path,
148+
method=method,
149+
query_params=query_params,
150+
header_params=header_params,
151+
response_type="list[AuditEvent]")
152+
else:
153+
return self.base_client.call_api(
154+
resource_path=resource_path,
155+
method=method,
156+
query_params=query_params,
157+
header_params=header_params,
158+
response_type="list[AuditEvent]")
133159

134160
def update_configuration(self, compartment_id, update_configuration_details, **kwargs):
135161
"""
@@ -149,9 +175,11 @@ def update_configuration(self, compartment_id, update_configuration_details, **k
149175
resource_path = "/configuration"
150176
method = "PUT"
151177

152-
if kwargs:
178+
expected_kwargs = ["retry_strategy"]
179+
extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs]
180+
if extra_kwargs:
153181
raise ValueError(
154-
"update_configuration got unknown kwargs: {!r}".format(kwargs))
182+
"update_configuration got unknown kwargs: {!r}".format(extra_kwargs))
155183

156184
query_params = {
157185
"compartmentId": compartment_id
@@ -163,9 +191,18 @@ def update_configuration(self, compartment_id, update_configuration_details, **k
163191
"content-type": "application/json"
164192
}
165193

166-
return self.base_client.call_api(
167-
resource_path=resource_path,
168-
method=method,
169-
query_params=query_params,
170-
header_params=header_params,
171-
body=update_configuration_details)
194+
if 'retry_strategy' in kwargs:
195+
return kwargs['retry_strategy'].make_retrying_call(
196+
self.base_client.call_api,
197+
resource_path=resource_path,
198+
method=method,
199+
query_params=query_params,
200+
header_params=header_params,
201+
body=update_configuration_details)
202+
else:
203+
return self.base_client.call_api(
204+
resource_path=resource_path,
205+
method=method,
206+
query_params=query_params,
207+
header_params=header_params,
208+
body=update_configuration_details)

0 commit comments

Comments
 (0)