Skip to content

Commit 3128755

Browse files
author
Art Hall III
authored
Merge pull request #73 from oracle/release_2018-09-27
Releasing version 2.0.4
2 parents f641ae5 + 8cb7718 commit 3128755

File tree

65 files changed

+6710
-76
lines changed

Some content is hidden

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

65 files changed

+6710
-76
lines changed

CHANGELOG.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,31 @@ All notable changes to this project will be documented in this file.
55
The format is based on `Keep a Changelog <http://keepachangelog.com/>`_.
66

77
====================
8-
2.0.3 -2018-09-06
8+
2.0.4 - 2018-09-27
9+
====================
10+
11+
Added
12+
-----
13+
* Support for paravirtualized launch mode when importing images in the Compute service
14+
* Support for Key Management service
15+
* Support for encrypting the contents of an Object Storage bucket using a Key Management service key
16+
* Support for specifying a Key Management service key when launching a compute instance in the Compute service
17+
* Support for specifying a Key Management service key when backing up or restoring a block storage volume in the Block Volume service
18+
19+
Fixed
20+
-----
21+
* ObjectStorageClient requires int value for content_length keyword agruement to put_object and upload_part, but the SDK was not converting the type for the Requests library.
22+
23+
====================
24+
2.0.3 - 2018-09-06
925
====================
1026

1127
Added
1228
-----
1329
* Added support for updating metadata fields on an instance in the Compute service
1430

1531
Fixed
16-
-------
32+
-----
1733
* Fixed example wait_for_resource_in_state.py to use existing response objects. The updated example can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/wait_for_resource_in_state.py>`__.
1834

1935
====================

docs/api/core.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Core Services
3030
oci.core.models.BootVolume
3131
oci.core.models.BootVolumeAttachment
3232
oci.core.models.BootVolumeBackup
33+
oci.core.models.BootVolumeKmsKey
3334
oci.core.models.BootVolumeSourceDetails
3435
oci.core.models.BootVolumeSourceFromBootVolumeBackupDetails
3536
oci.core.models.BootVolumeSourceFromBootVolumeDetails
@@ -131,6 +132,7 @@ Core Services
131132
oci.core.models.UdpOptions
132133
oci.core.models.UpdateBootVolumeBackupDetails
133134
oci.core.models.UpdateBootVolumeDetails
135+
oci.core.models.UpdateBootVolumeKmsKeyDetails
134136
oci.core.models.UpdateConsoleHistoryDetails
135137
oci.core.models.UpdateCpeDetails
136138
oci.core.models.UpdateCrossConnectDetails
@@ -157,6 +159,7 @@ Core Services
157159
oci.core.models.UpdateVolumeDetails
158160
oci.core.models.UpdateVolumeGroupBackupDetails
159161
oci.core.models.UpdateVolumeGroupDetails
162+
oci.core.models.UpdateVolumeKmsKeyDetails
160163
oci.core.models.Vcn
161164
oci.core.models.VirtualCircuit
162165
oci.core.models.VirtualCircuitBandwidthShape
@@ -175,6 +178,7 @@ Core Services
175178
oci.core.models.VolumeGroupSourceFromVolumeGroupBackupDetails
176179
oci.core.models.VolumeGroupSourceFromVolumeGroupDetails
177180
oci.core.models.VolumeGroupSourceFromVolumesDetails
181+
oci.core.models.VolumeKmsKey
178182
oci.core.models.VolumeSourceDetails
179183
oci.core.models.VolumeSourceFromVolumeBackupDetails
180184
oci.core.models.VolumeSourceFromVolumeDetails
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
BootVolumeKmsKey
2+
================
3+
4+
.. currentmodule:: oci.core.models
5+
6+
.. autoclass:: BootVolumeKmsKey
7+
:show-inheritance:
8+
:special-members: __init__
9+
:members:
10+
:undoc-members:
11+
:inherited-members:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
UpdateBootVolumeKmsKeyDetails
2+
=============================
3+
4+
.. currentmodule:: oci.core.models
5+
6+
.. autoclass:: UpdateBootVolumeKmsKeyDetails
7+
:show-inheritance:
8+
:special-members: __init__
9+
:members:
10+
:undoc-members:
11+
:inherited-members:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
UpdateVolumeKmsKeyDetails
2+
=========================
3+
4+
.. currentmodule:: oci.core.models
5+
6+
.. autoclass:: UpdateVolumeKmsKeyDetails
7+
:show-inheritance:
8+
:special-members: __init__
9+
:members:
10+
:undoc-members:
11+
:inherited-members:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
VolumeKmsKey
2+
============
3+
4+
.. currentmodule:: oci.core.models
5+
6+
.. autoclass:: VolumeKmsKey
7+
:show-inheritance:
8+
:special-members: __init__
9+
:members:
10+
:undoc-members:
11+
:inherited-members:

docs/upload-manager.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
Uploading Large Objects
1313
~~~~~~~~~~~~~~~~~~~~~~~~
1414

15-
The Object Storage service supports multipart uploads to make large object uploads easier by splitting the large object into parts. The Python SDK supports raw multipart upload operations for advanced use cases, as well as a higher-level upload class that uses the multipart upload APIs. `Managing Multipart Uploads <https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingmultipartuploads.htm>`_ provides links to the APIs used for raw multipart upload operations. Higher-level uploads can be performed using the :py:class:`~oci.object_storage.UploadManager`. The :py:class:`~oci.object_storage.UploadManager` will: split a large object into parts for you, upload the parts in parallel, and then recombine and commit the parts as a single object in Object Storage.
15+
The Object Storage service supports multipart uploads to make large object uploads easier by splitting the large object into parts. The Python SDK supports raw multipart upload operations for advanced use cases, as well as a higher-level upload class that uses the multipart upload APIs. `Using Multipart Uploads <https://docs.cloud.oracle.com/iaas/Content/Object/Tasks/usingmultipartuploads.htm>`_ provides links to the APIs used for raw multipart upload operations. Higher-level uploads can be performed using the :py:class:`~oci.object_storage.UploadManager`. The :py:class:`~oci.object_storage.UploadManager` will: split a large object into parts for you, upload the parts in parallel, and then recombine and commit the parts as a single object in Object Storage.
1616

1717
The `UploadObject <https://github.com/oracle/oci-python-sdk/blob/master/examples/multipart_object_upload.py>`_ example shows how :py:class:`~oci.object_storage.UploadManager` can be used to upload files to object storage.

docs/waiters.rst

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,22 @@
77
}
88
</script>
99

10+
Composite Operations and Waiters
11+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12+
13+
To wait until an attribute of a resource reaches a certain state, you can use composite operations or waiters.
14+
15+
Composite Operations
16+
---------------------
17+
You can use the ``CompositeOperation`` classes in the SDK (e.g. :py:class:`~oci.core.ComputeClientCompositeOperations`)
18+
to perform an action on a resource and wait for it to enter a particular state (or states). The ``CompositeOperation`` classes provide
19+
convenience methods so that you do not have to invoke an operation and then separately invoke a waiter.
20+
21+
An example of using ``CompositeOperation`` classes can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/composite_operations_example.py>`__.
22+
1023
Waiters
11-
~~~~~~~
12-
Sometimes you may need to wait until an attribute of a resource, such as an instance or a VCN, reaches a certain state. An example of this would be launching an instance and then waiting for the instance to become available, or waiting until a subnet in a VCN has been terminated. This waiting can be accomplished by using the :py:func:`~oci.wait_until` function. As an example:
24+
-------
25+
You can also use the :py:func:`~oci.wait_until` function to wait for a resource to enter a particular state. As an example:
1326

1427
.. code-block:: python
1528
@@ -34,33 +47,33 @@ Sometimes you may need to wait until an attribute of a resource, such as an inst
3447
# - The fourth parameter is the desired value. An equality (==) comparison is done
3548
get_instance_response = oci.wait_until(client, client.get_instance(instance_ocid), 'lifecycle_state', 'RUNNING')
3649
37-
Instead of waiting for a single attribute to equal a given value, you can also provide a function reference (either a lambda or a reference to an already defined function) that
38-
can be used to evaluate the response received from the service call. This function should return a truthy value if the waiter should stop waiting, and a falsey value if the waiter
39-
should continue waiting.
50+
Passing a Function Reference
51+
``````````````````````````````
4052

41-
For example, to wait until a volume backup reaches either the "AVAILABLE" or "FAULTY" state :
53+
Instead of waiting for a single attribute to reach a given value, you can use a function reference, such as a Lambda expression or a reference to a defined function, to evaluate the response received from the service call. If this function returns a truthy value, the waiter stops waiting.
4254

43-
.. code-block:: python
55+
For example, to wait until a volume backup reaches either the AVAILABLE or FAULTY state :
4456

45-
oci.wait_until(client, client.get_volume_backup(vol_backup_id), evaluate_response=lambda r: r.data.lifecycle_state in ['AVAILABLE', 'FAULTY'])
57+
* Using a Lambda expression:
4658

47-
Instead of using a lambda, an already defined function can be used:
59+
.. code-block:: python
4860
49-
.. code-block:: python
61+
oci.wait_until(client, client.get_volume_backup(vol_backup_id), evaluate_response=lambda r: r.data.lifecycle_state in ['AVAILABLE', 'FAULTY'])
5062
51-
def should_stop_waiting_volume_backup(response):
52-
return response.data.lifecycle_state in ['AVAILABLE', 'FAULTY']
63+
* Using a defined function:
5364

54-
oci.wait_until(client, client.get_volume_backup(vol_backup_id), evaluate_response=should_stop_waiting_volume_backup)
65+
.. code-block:: python
5566
56-
In addition to the base parameters shown above, the function can accept optional attributes to control the maximum amount of time it will wait for and the time between calls to the service. For more information on the optional parameters, see the documentation on the :py:func:`~oci.wait_until` function.
67+
def should_stop_waiting_volume_backup(response):
68+
return response.data.lifecycle_state in ['AVAILABLE', 'FAULTY']
5769
58-
For a more comprehensive sample, please see our `examples <https://github.com/oracle/oci-python-sdk/blob/master/examples/wait_for_resource_in_state.py>`_ on GitHub.
70+
oci.wait_until(client, client.get_volume_backup(vol_backup_id), evaluate_response=should_stop_waiting_volume_backup)
5971
60-
Composite Operations
61-
---------------------
62-
In addition to using waiters, you can use the ``CompositeOperation`` classes in the SDK (e.g. :py:class:`~oci.core.ComputeClientCompositeOperations`)
63-
to perform an action on a resource and wait for it to enter a particular state (or states). The ``CompositeOperation`` classes provide
64-
convenience methods so that you yourself do not have to invoke an operation and then separately invoke a waiter.
72+
Be aware that if the inner function raises an exception, ``oci.wait_until()`` will not be called. In the preceding example, if ``client.get_volume_backup(volume_backup_id)`` raises an exception, ``oci.wait_until()`` will not be called. This happens even if the inner function raises a Not Found exception and ``succeed_on_not_found=True`` is passed to ``oci.wait_until()``.
73+
74+
Optional Attributes
75+
``````````````````````
6576

66-
An example of using ``CompositeOperation`` classes can be found on `GitHub <https://github.com/oracle/oci-python-sdk/blob/master/examples/composite_operations_example.py>`__.
77+
In addition to these base parameters, ``wait_until()`` can accept optional attributes to control the maximum amount of time it will wait and the time between calls to the service. For more information on the optional parameters, see the documentation on the :py:func:`~oci.wait_until` function.
78+
79+
For a more comprehensive sample, please see our `examples <https://github.com/oracle/oci-python-sdk/blob/master/examples/wait_for_resource_in_state.py>`_ on GitHub.

examples/container_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ def delete_vcn(vn_client, vcn_resources):
482482

483483
# VCNs have default security lists, route tables which cannot be deleted.
484484
# Get the details of the VCN to get the default security list and default route table ids so
485-
# they can be skipped when getting the security lists ans route tables
485+
# they can be skipped when getting the security lists and route tables
486486
response = vn_client.get_vcn(vcn_resources['id'])
487487
default_security_list_id = response.data.default_security_list_id
488488
default_route_table_id = response.data.default_route_table_id

src/oci/__init__.py

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

4-
from . import audit, container_engine, core, database, dns, email, file_storage, identity, load_balancer, object_storage, resource_search
4+
from . import audit, container_engine, core, database, dns, email, file_storage, identity, key_management, load_balancer, object_storage, resource_search
55
from . import auth, config, constants, decorators, exceptions, regions, pagination, retry
66
from .base_client import BaseClient
77
from .request import Request
@@ -13,5 +13,5 @@
1313

1414
__all__ = [
1515
"BaseClient", "Error", "Request", "Response", "Signer", "config", "constants", "decorators", "exceptions", "regions", "wait_until", "pagination", "auth", "retry",
16-
"audit", "container_engine", "core", "database", "dns", "email", "file_storage", "identity", "load_balancer", "object_storage", "resource_search"
16+
"audit", "container_engine", "core", "database", "dns", "email", "file_storage", "identity", "key_management", "load_balancer", "object_storage", "resource_search"
1717
]

src/oci/base_client.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def __init__(self, service, config, signer, type_mapping, **kwargs):
8888

8989
self._endpoint = None
9090
self._base_path = kwargs.get('base_path')
91+
self.service_endpoint_template = kwargs.get('service_endpoint_template')
9192

9293
if self.regional_client:
9394
if kwargs.get('service_endpoint'):
@@ -101,11 +102,12 @@ def __init__(self, service, config, signer, type_mapping, **kwargs):
101102

102103
self.endpoint = regions.endpoint_for(
103104
service,
105+
service_endpoint_template=self.service_endpoint_template,
104106
region=region_to_use,
105107
endpoint=config.get('endpoint'))
106108
else:
107109
if not kwargs.get('service_endpoint'):
108-
raise ValueError('An endpoint must be provided for a non-regional service client')
110+
raise exceptions.MissingEndpointForNonRegionalServiceClientError('An endpoint must be provided for a non-regional service client')
109111
self.endpoint = kwargs.get('service_endpoint')
110112

111113
self.service = service
@@ -141,7 +143,7 @@ def endpoint(self, endpoint):
141143

142144
def set_region(self, region):
143145
if self.regional_client:
144-
self.endpoint = regions.endpoint_for(self.service, region=region)
146+
self.endpoint = regions.endpoint_for(self.service, service_endpoint_template=self.service_endpoint_template, region=region)
145147
else:
146148
raise TypeError('Setting the region is not allowed for non-regional service clients. You must instead set the endpoint')
147149

@@ -173,6 +175,12 @@ def call_api(self, resource_path, method,
173175

174176
header_params = header_params or {}
175177

178+
# ObjectStorage PutObject and UploadPart require Content-Length as
179+
# int, but requests requires it as a string. All the headers
180+
# have been prepared for serialization at this point
181+
if header_params.get('Content-Length', missing) is not missing:
182+
header_params['Content-Length'] = str(header_params['Content-Length'])
183+
176184
header_params[constants.HEADER_CLIENT_INFO] = USER_INFO
177185
header_params[constants.HEADER_USER_AGENT] = self.user_agent
178186

0 commit comments

Comments
 (0)