Skip to content

Commit 47a8bcc

Browse files
authored
Releasing version 2.2.16
Releasing version 2.2.16
2 parents cbd7517 + c5422d3 commit 47a8bcc

30 files changed

+901
-38
lines changed

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ 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+
2.2.16 - 2019-07-02
9+
====================
10+
11+
Added
12+
-----
13+
* Support for moving images, instance configurations, and instance pools across compartments in Core Services
14+
* Support for moving autoscaling configurations across compartments in the Compute Autoscaling service
15+
16+
Fixed
17+
-----
18+
* Fixed a bug where the Streaming service's endpoints in Tokyo, Seoul, and future regions were not reachable from the SDK
19+
720
====================
821
2.2.15 - 2019-06-25
922
====================

docs/api/autoscaling.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Autoscaling
2424
oci.autoscaling.models.AutoScalingPolicy
2525
oci.autoscaling.models.AutoScalingPolicySummary
2626
oci.autoscaling.models.Capacity
27+
oci.autoscaling.models.ChangeAutoScalingCompartmentDetails
2728
oci.autoscaling.models.Condition
2829
oci.autoscaling.models.CreateAutoScalingConfigurationDetails
2930
oci.autoscaling.models.CreateAutoScalingPolicyDetails
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ChangeAutoScalingCompartmentDetails
2+
===================================
3+
4+
.. currentmodule:: oci.autoscaling.models
5+
6+
.. autoclass:: ChangeAutoScalingCompartmentDetails
7+
:show-inheritance:
8+
:special-members: __init__
9+
:members:
10+
:undoc-members:
11+
:inherited-members:

docs/api/core.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ Core Services
5252
oci.core.models.CaptureConsoleHistoryDetails
5353
oci.core.models.ChangeBootVolumeBackupCompartmentDetails
5454
oci.core.models.ChangeBootVolumeCompartmentDetails
55+
oci.core.models.ChangeImageCompartmentDetails
56+
oci.core.models.ChangeInstanceConfigurationCompartmentDetails
57+
oci.core.models.ChangeInstancePoolCompartmentDetails
5558
oci.core.models.ChangeNatGatewayCompartmentDetails
5659
oci.core.models.ChangeServiceGatewayCompartmentDetails
5760
oci.core.models.ChangeVolumeBackupCompartmentDetails
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ChangeImageCompartmentDetails
2+
=============================
3+
4+
.. currentmodule:: oci.core.models
5+
6+
.. autoclass:: ChangeImageCompartmentDetails
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+
ChangeInstanceConfigurationCompartmentDetails
2+
=============================================
3+
4+
.. currentmodule:: oci.core.models
5+
6+
.. autoclass:: ChangeInstanceConfigurationCompartmentDetails
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+
ChangeInstancePoolCompartmentDetails
2+
====================================
3+
4+
.. currentmodule:: oci.core.models
5+
6+
.. autoclass:: ChangeInstancePoolCompartmentDetails
7+
:show-inheritance:
8+
:special-members: __init__
9+
:members:
10+
:undoc-members:
11+
:inherited-members:

docs/logging.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,26 @@
1010
Logging
1111
~~~~~~~
1212

13-
The Python SDK uses Python's `logging <https://docs.python.org/3.6/library/logging.html>`_ module.
13+
The Python SDK uses Python's `logging <https://docs.python.org/3.6/library/logging.html>`_ module.
1414

1515
Loggers for the Python SDK are ordered hierarchically, with the top level being ``oci`` (or ``oraclebmc`` if you are using the legacy OracleBMC package).
1616

1717
Logger names are of the form ``<hierarchy>.<id>`` where the ``<hierarchy>`` is similar to ``oci.base_client`` and ``<id>`` is the result of Python's built-in ``id()`` function. The implication of this is that different instances of the same class have different loggers.
1818

19+
The following code snippet is an example for configuring debug level logging for the oci package:
20+
21+
.. code-block:: python
22+
import oci
23+
import logging
24+
25+
# Enable debug logging
26+
logging.getLogger('oci').setLevel(logging.DEBUG)
27+
28+
# Rest of code ...
29+
1930
Request Logging
2031
================
21-
Logging of the requests which the Python SDK sends to Oracle Cloud Infrastructure services can be enabled by setting the ``log_requests`` attribute to ``True`` in your configuration. This could be done in your configuration file, for example:
32+
Request logging can be enabled for more detailed debugging information. Request logging outputs the requests that the Python SDK sends to Oracle Cloud Infrastructure services. This option can be enabled by setting the configuration attribute ``log_requests`` to ``True``. Alternatively, request logging can be enabled in your configuration file. For example:
2233

2334
.. code-block:: text
2435
@@ -43,9 +54,11 @@ Or programmatically, for example:
4354
"log_requests": True
4455
}
4556
57+
Request logging enables debugging information in the Python http module. This debugging information can be quite verbose and the output will go to standard out. This http module does not use Python's logging module.
58+
4659
Once you have request logging in your config, you can create the appropriate logging handler(s) for your use case. For example to log to an output stream such as ``stderr`` you could do:
4760

48-
.. code-block:: python
61+
.. code-block:: python
4962
5063
import oci
5164
import logging
@@ -60,9 +73,10 @@ Once you have request logging in your config, you can create the appropriate log
6073
# This call will emit log information to stderr
6174
client.list_regions()
6275
63-
Note that request logging occurs at the following levels:
76+
The oci module has logging at the following levels:
6477

6578
* ``INFO``: Request method and request URL
6679
* ``DEBUG``: Request headers and body, and response headers
6780

81+
6882
The raw response body is not logged.

examples/database/adb_example.py

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

44
import oci
5+
import time
56

67
# Overview of Autonomous Data Warehouse
78
# https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/adboverview.htm
@@ -26,6 +27,8 @@ def create_adb(db_client):
2627
adb_request.display_name = "PYSDK-ADB-EXAMPLE"
2728
adb_request.db_workload = "OLTP"
2829
adb_request.license_model = adb_request.LICENSE_MODEL_BRING_YOUR_OWN_LICENSE
30+
# For demonstration, we just passed the password here but for Production code you should have a better
31+
# way to pass the password like env variable or commandline
2932
adb_request.admin_password = "Welcome1!SDK"
3033
adb_request.is_auto_scaling_enabled = True
3134

@@ -38,8 +41,8 @@ def create_adb(db_client):
3841
return adb_response.data.id
3942

4043

44+
# Delete the autonomous database
4145
def delete_adb(db_client, adb_id):
42-
# Delete the autonomous database
4346
response = db_client.delete_autonomous_database(adb_id)
4447
print(response)
4548

@@ -62,8 +65,50 @@ def update_adb(db_client, adb_id):
6265
return adb_response.data.id
6366

6467

68+
def update_adb_acl(db_client, adb_id):
69+
# Update adb Access Control List
70+
adb_request = oci.database.models.UpdateAutonomousDatabaseDetails()
71+
72+
adb_request.whitelisted_ips = ["1.1.1.1/28", "3.3.3.3"]
73+
74+
adb_response = db_client.update_autonomous_database(adb_id,
75+
update_autonomous_database_details=adb_request,
76+
retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY)
77+
78+
print("ATP Shared instance Access Control List is being changed {}".format(adb_response.data.id))
79+
80+
return adb_response.data.id
81+
82+
83+
def update_adb_licesnse_type(db_client, adb_id):
84+
# Update adb Licesnse Type
85+
adb_request = oci.database.models.UpdateAutonomousDatabaseDetails()
86+
87+
adb_request.license_model = adb_request.LICENSE_MODEL_LICENSE_INCLUDED
88+
89+
adb_response = db_client.update_autonomous_database(adb_id,
90+
update_autonomous_database_details=adb_request,
91+
retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY)
92+
93+
print("ATP Shared instance License Type is being changed {}".format(adb_response.data.id))
94+
95+
return adb_response.data.id
96+
97+
6598
if __name__ == "__main__":
6699
# Initialize the client
67100
db_client = oci.database.DatabaseClient(config)
101+
# Create adb
68102
adb_id = create_adb(db_client)
103+
# sleep 5 mins
104+
time.sleep(300)
105+
# Update adb acl with specific adb_id.
106+
update_adb_acl(db_client, adb_id)
107+
# sleep 5 mins
108+
time.sleep(300)
109+
# Update adb license type
110+
update_adb_licesnse_type(db_client, adb_id)
111+
# sleep 5 mins
112+
time.sleep(300)
113+
# Delete adb
69114
delete_adb(db_client, adb_id)

src/oci/autoscaling/auto_scaling_client.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,108 @@ def __init__(self, config, **kwargs):
8181
self.base_client = BaseClient("auto_scaling", config, signer, autoscaling_type_mapping, **base_client_init_kwargs)
8282
self.retry_strategy = kwargs.get('retry_strategy')
8383

84+
def change_auto_scaling_configuration_compartment(self, auto_scaling_configuration_id, change_compartment_details, **kwargs):
85+
"""
86+
ChangeAutoScalingConfigurationCompartment
87+
Moves an autoscaling configuration into a different compartment within the same tenancy. For information
88+
about moving resources between compartments, see
89+
`Moving Resources to a Different Compartment`__.
90+
91+
When you move an autoscaling configuration to a different compartment, associated resources such as instance
92+
pools are not moved.
93+
94+
__ https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes
95+
96+
97+
:param str auto_scaling_configuration_id: (required)
98+
The `OCID`__ of the autoscaling configuration.
99+
100+
__ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm
101+
102+
:param ChangeAutoScalingCompartmentDetails change_compartment_details: (required)
103+
Request to change the compartment of given autoscaling configuration.
104+
105+
:param str opc_request_id: (optional)
106+
107+
:param str if_match: (optional)
108+
For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
109+
parameter to the value of the etag from a previous GET or POST response for that resource. The resource
110+
will be updated or deleted only if the etag you provide matches the resource's current etag value.
111+
112+
:param str opc_retry_token: (optional)
113+
A token that uniquely identifies a request so it can be retried in case of a timeout or
114+
server error without risk of executing that same action again. Retry tokens expire after 24
115+
hours, but can be invalidated before then due to conflicting operations (for example, if a resource
116+
has been deleted and purged from the system, then a retry of the original creation request
117+
may be rejected).
118+
119+
:param obj retry_strategy: (optional)
120+
A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
121+
122+
This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY`
123+
is also available. The specifics of the default retry strategy are described `here <https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/sdk_behaviors/retries.html>`__.
124+
125+
To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.
126+
127+
:return: A :class:`~oci.response.Response` object with data of type None
128+
:rtype: :class:`~oci.response.Response`
129+
"""
130+
resource_path = "/autoScalingConfigurations/{autoScalingConfigurationId}/actions/changeCompartment"
131+
method = "POST"
132+
133+
# Don't accept unknown kwargs
134+
expected_kwargs = [
135+
"retry_strategy",
136+
"opc_request_id",
137+
"if_match",
138+
"opc_retry_token"
139+
]
140+
extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs]
141+
if extra_kwargs:
142+
raise ValueError(
143+
"change_auto_scaling_configuration_compartment got unknown kwargs: {!r}".format(extra_kwargs))
144+
145+
path_params = {
146+
"autoScalingConfigurationId": auto_scaling_configuration_id
147+
}
148+
149+
path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing}
150+
151+
for (k, v) in six.iteritems(path_params):
152+
if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0):
153+
raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k))
154+
155+
header_params = {
156+
"accept": "application/json",
157+
"content-type": "application/json",
158+
"opc-request-id": kwargs.get("opc_request_id", missing),
159+
"if-match": kwargs.get("if_match", missing),
160+
"opc-retry-token": kwargs.get("opc_retry_token", missing)
161+
}
162+
header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing and v is not None}
163+
164+
retry_strategy = self.retry_strategy
165+
if kwargs.get('retry_strategy'):
166+
retry_strategy = kwargs.get('retry_strategy')
167+
168+
if retry_strategy:
169+
if not isinstance(retry_strategy, retry.NoneRetryStrategy):
170+
self.base_client.add_opc_retry_token_if_needed(header_params)
171+
return retry_strategy.make_retrying_call(
172+
self.base_client.call_api,
173+
resource_path=resource_path,
174+
method=method,
175+
path_params=path_params,
176+
header_params=header_params,
177+
body=change_compartment_details)
178+
else:
179+
return self.base_client.call_api(
180+
resource_path=resource_path,
181+
method=method,
182+
path_params=path_params,
183+
header_params=header_params,
184+
body=change_compartment_details)
185+
84186
def create_auto_scaling_configuration(self, create_auto_scaling_configuration_details, **kwargs):
85187
"""
86188
CreateAutoScalingConfiguration

0 commit comments

Comments
 (0)