Skip to content

Commit 096a48d

Browse files
authored
Merge pull request #38 from oracle/release_2017-12-11
Releasing version 1.3.11
2 parents 2d5523d + 8805137 commit 096a48d

File tree

261 files changed

+1910
-416
lines changed

Some content is hidden

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

261 files changed

+1910
-416
lines changed

CHANGELOG.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ 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.11 - 2017-12-11
9+
====================
10+
11+
Added
12+
-----
13+
* Support for public peering for FastConnect
14+
* Support for specifying an authorized entity name in a Letter of Authority
15+
* Support for showing a list of bandwidth shapes for a specific provider (the ``list_fast_connect_provider_virtual_circuit_bandwidth_shapes`` in ``VirtualNetworkClient``)
16+
17+
Changed
18+
-------
19+
* Audit events now have a ``response_payload`` attribute which contains metadata of interest. For example, the OCID of a resource
20+
21+
Deprecated
22+
-----------
23+
* The ``list_virtual_circuit_bandwidth_shapes`` operation in ``VirtualNetworkClient`` has been deprecated. Use the ``list_fast_connect_provider_virtual_circuit_bandwidth_shapes`` operation instead
24+
* When using ``CreateVirtualCircuitDetails``, supplying a ``provider_name`` is deprecated and ``provider_service_id`` should be used instead
25+
726
====================
827
1.3.10 - 2017-11-27
928
====================

docs/api/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ Load Balancer
226226

227227
.. autoclass:: Sentinel
228228

229+
===========
230+
Waiters
231+
===========
232+
233+
.. module:: oci
234+
235+
.. autofunction:: wait_until
236+
229237
=========
230238
Request
231239
=========

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ To get started, head over to the :ref:`installation instructions <install>` or s
5252
pass-explicit-null
5353
upload-manager
5454
raw-requests
55+
waiters
5556
api/index
5657
contributions
5758
notifications

docs/waiters.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. raw:: html
2+
3+
<script type='text/javascript'>
4+
var oldDocsHost = 'oracle-bare-metal-cloud-services-python-sdk';
5+
if (window.location.href.indexOf(oldDocsHost) != -1) {
6+
window.location.href = 'https://oracle-bare-metal-cloud-services-python-sdk.readthedocs.io/en/latest/deprecation-notice.html';
7+
}
8+
</script>
9+
10+
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:
13+
14+
.. code-block:: python
15+
16+
import oci
17+
18+
config = oci.config.from_file()
19+
client = oci.core.ComputeClient(config)
20+
21+
response = client.launch_instance(...)
22+
instance_ocid = response.data.id
23+
24+
# We will get returned the result of the last get_instance call (in this case the one where the lifecycle state has moved to available).
25+
# We can inspect the .data attribute of this (i.e. get_instance_response.data) to get information about the instance
26+
#
27+
# Some items to note about the parameters provided:
28+
#
29+
# - The first parameter is the client we'll use to call the service to retrieve data
30+
# - The second parameter is the result of a service call. The wait_until function uses this to determine what service operation needs to be called. In the case below
31+
# it will keep calling client.get_instance(instance_ocid) until the instance reaches the desired state
32+
# - The third parameter is the name of the attribute we will check. The object we will check against is the result of calling .data on the result of the service call.
33+
# Please consult the API reference for available attribute names you can use
34+
# - The fourth parameter is the desired value. An equality (==) comparison is done
35+
get_instance_response = oci.wait_until(client, client.get_instance(instance_ocid), 'lifecycle_state', 'RUNNING')
36+
37+
38+
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.
39+
40+
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.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2+
#
3+
# This script provides an example on how to use waiters in the Python SDK to block/wait until a resource (e.g. an instance, a VCN)
4+
# reaches a certain state.
5+
6+
import oci
7+
8+
# Default config file and profile
9+
config = oci.config.from_file()
10+
compartment_id = '<Your compartment OCID here>'
11+
availability_domain = '<An availability domain, e.g. crmS:IAD-AD-1, here>'
12+
second_availability_domain = '<An availability domain, e.g. crmS:IAD-AD-2, here. This should be different to availability_domain>'
13+
14+
virtual_network_client = oci.core.VirtualNetworkClient(config)
15+
load_balancer_client = oci.load_balancer.LoadBalancerClient(config)
16+
17+
# This creates a VCN and then waits until the VCN's lifecycle state is AVAILABLE
18+
print('Creating VCN')
19+
result = virtual_network_client.create_vcn(oci.core.models.CreateVcnDetails(cidr_block='10.0.0.0/16', display_name='WaitForResourceExampleVcn', compartment_id=compartment_id))
20+
vcn_ocid = result.data.id
21+
get_vcn_response = oci.wait_until(virtual_network_client, virtual_network_client.get_vcn(vcn_ocid), 'lifecycle_state', 'AVAILABLE')
22+
print(get_vcn_response.data)
23+
24+
# This creates a subnet in the VCN and waits until the subnet's lifecycle state is AVAILABLE
25+
print('Creating Subnet 1')
26+
result = virtual_network_client.create_subnet(
27+
oci.core.models.CreateSubnetDetails(
28+
compartment_id=compartment_id,
29+
availability_domain=availability_domain,
30+
display_name='WaitForResourceExampleSubnet',
31+
vcn_id=vcn_ocid,
32+
cidr_block='10.0.0.0/24'
33+
)
34+
)
35+
subnet_ocid = result.data.id
36+
get_subnet_response = oci.wait_until(virtual_network_client, virtual_network_client.get_subnet(subnet_ocid), 'lifecycle_state', 'AVAILABLE')
37+
print(get_subnet_response.data)
38+
39+
print('Creating Subnet 2')
40+
result = virtual_network_client.create_subnet(
41+
oci.core.models.CreateSubnetDetails(
42+
compartment_id=compartment_id,
43+
availability_domain=second_availability_domain,
44+
display_name='WaitForResourceExampleSubnet2',
45+
vcn_id=vcn_ocid,
46+
cidr_block='10.0.1.0/24'
47+
)
48+
)
49+
subnet_two_ocid = result.data.id
50+
get_subnet_response = oci.wait_until(virtual_network_client, virtual_network_client.get_subnet(subnet_two_ocid), 'lifecycle_state', 'AVAILABLE')
51+
print(get_subnet_response.data)
52+
53+
# Now we create a load balancer and wait until it has been created. Load balancers work slightly differently in that the create_load_balancer call
54+
# returns a work request and it is the work request whose state we should wait on (we wait until it has succeeded)
55+
print('Creating Load Balancer')
56+
create_load_balancer_details = oci.load_balancer.models.CreateLoadBalancerDetails(
57+
compartment_id=compartment_id,
58+
display_name='WaitForResourceExampleLB',
59+
shape_name='100Mbps',
60+
subnet_ids=[subnet_ocid, subnet_two_ocid],
61+
backend_sets={
62+
'WaitExampleBackSet': oci.load_balancer.models.BackendSetDetails(
63+
policy='ROUND_ROBIN',
64+
health_checker=oci.load_balancer.models.HealthCheckerDetails(
65+
protocol='HTTP',
66+
url_path='/',
67+
port=80,
68+
retries=1,
69+
timeout_in_millis=100,
70+
interval_in_millis=1000,
71+
),
72+
session_persistence_configuration=oci.load_balancer.models.SessionPersistenceConfigurationDetails(cookie_name='*', disable_fallback=False)
73+
)
74+
}
75+
)
76+
result = load_balancer_client.create_load_balancer(create_load_balancer_details)
77+
work_request_id = result.headers['opc-work-request-id']
78+
get_work_request_response = oci.wait_until(load_balancer_client, load_balancer_client.get_work_request(work_request_id), 'lifecycle_state', 'SUCCEEDED')
79+
print(get_work_request_response.data)
80+
load_balancer_ocid = get_work_request_response.data.load_balancer_id
81+
82+
# Here we delete the load balancer. Note that on the waiter we use the optional succeed_on_not_found and set it to True. This meants that if we get a
83+
# 404 back from the service when checking the load balancer's state, instead of throwing an exception we will return successfully. This flag will typically
84+
# only be useful for delete/terminate scenarios and its normal default is False.
85+
print('Deleting Load Balancer')
86+
load_balancer_client.delete_backend_set(load_balancer_ocid, 'WaitExampleBackSet')
87+
load_balancer_client.delete_load_balancer(load_balancer_ocid)
88+
oci.wait_until(load_balancer_client, load_balancer_client.get_load_balancer(load_balancer_ocid), 'lifecycle_state', 'TERMINATED', succeed_on_not_found=True)
89+
90+
print('Deleting Subnet 1')
91+
virtual_network_client.delete_subnet(subnet_ocid)
92+
oci.wait_until(virtual_network_client, virtual_network_client.get_subnet(subnet_ocid), 'lifecycle_state', 'TERMINATED', succeed_on_not_found=True)
93+
94+
print('Deleting Subnet 2')
95+
virtual_network_client.delete_subnet(subnet_two_ocid)
96+
oci.wait_until(virtual_network_client, virtual_network_client.get_subnet(subnet_two_ocid), 'lifecycle_state', 'TERMINATED', succeed_on_not_found=True)
97+
98+
print('Deleting VCN')
99+
virtual_network_client.delete_vcn(vcn_ocid)
100+
oci.wait_until(virtual_network_client, virtual_network_client.get_vcn(vcn_ocid), 'lifecycle_state', 'TERMINATED', succeed_on_not_found=True)

src/oci/audit/models/audit_event.py

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

44

5-
from ...util import formatted_flat_dict
5+
from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401
66
from ...decorators import init_model_state_from_kwargs
77

88

@@ -86,6 +86,10 @@ def __init__(self, **kwargs):
8686
The value to assign to the response_time property of this AuditEvent.
8787
:type response_time: datetime
8888
89+
:param response_payload:
90+
The value to assign to the response_payload property of this AuditEvent.
91+
:type response_payload: dict(str, object)
92+
8993
"""
9094
self.swagger_types = {
9195
'tenant_id': 'str',
@@ -105,7 +109,8 @@ def __init__(self, **kwargs):
105109
'request_resource': 'str',
106110
'response_headers': 'dict(str, list[str])',
107111
'response_status': 'str',
108-
'response_time': 'datetime'
112+
'response_time': 'datetime',
113+
'response_payload': 'dict(str, object)'
109114
}
110115

111116
self.attribute_map = {
@@ -126,7 +131,8 @@ def __init__(self, **kwargs):
126131
'request_resource': 'requestResource',
127132
'response_headers': 'responseHeaders',
128133
'response_status': 'responseStatus',
129-
'response_time': 'responseTime'
134+
'response_time': 'responseTime',
135+
'response_payload': 'responsePayload'
130136
}
131137

132138
self._tenant_id = None
@@ -147,6 +153,7 @@ def __init__(self, **kwargs):
147153
self._response_headers = None
148154
self._response_status = None
149155
self._response_time = None
156+
self._response_payload = None
150157

151158
@property
152159
def tenant_id(self):
@@ -588,6 +595,30 @@ def response_time(self, response_time):
588595
"""
589596
self._response_time = response_time
590597

598+
@property
599+
def response_payload(self):
600+
"""
601+
Gets the response_payload of this AuditEvent.
602+
Metadata of interest from the response payload. For example, the OCID of a resource.
603+
604+
605+
:return: The response_payload of this AuditEvent.
606+
:rtype: dict(str, object)
607+
"""
608+
return self._response_payload
609+
610+
@response_payload.setter
611+
def response_payload(self, response_payload):
612+
"""
613+
Sets the response_payload of this AuditEvent.
614+
Metadata of interest from the response payload. For example, the OCID of a resource.
615+
616+
617+
:param response_payload: The response_payload of this AuditEvent.
618+
:type: dict(str, object)
619+
"""
620+
self._response_payload = response_payload
621+
591622
def __repr__(self):
592623
return formatted_flat_dict(self)
593624

src/oci/audit/models/configuration.py

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

44

5-
from ...util import formatted_flat_dict
5+
from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401
66
from ...decorators import init_model_state_from_kwargs
77

88

src/oci/audit/models/update_configuration_details.py

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

44

5-
from ...util import formatted_flat_dict
5+
from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401
66
from ...decorators import init_model_state_from_kwargs
77

88

src/oci/core/compute_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,6 +2036,7 @@ def terminate_instance(self, instance_id, **kwargs):
20362036
20372037
:param bool preserve_boot_volume: (optional)
20382038
Specifies whether to delete or preserve the boot volume when terminating an instance.
2039+
The default value is false.
20392040
20402041
:return: A :class:`~oci.response.Response` object with data of type None
20412042
:rtype: :class:`~oci.response.Response`

src/oci/core/models/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from .attach_volume_details import AttachVolumeDetails
1010
from .boot_volume import BootVolume
1111
from .boot_volume_attachment import BootVolumeAttachment
12+
from .bulk_add_virtual_circuit_public_prefixes_details import BulkAddVirtualCircuitPublicPrefixesDetails
13+
from .bulk_delete_virtual_circuit_public_prefixes_details import BulkDeleteVirtualCircuitPublicPrefixesDetails
1214
from .capture_console_history_details import CaptureConsoleHistoryDetails
1315
from .connect_local_peering_gateways_details import ConnectLocalPeeringGatewaysDetails
1416
from .console_history import ConsoleHistory
@@ -30,6 +32,7 @@
3032
from .create_subnet_details import CreateSubnetDetails
3133
from .create_vcn_details import CreateVcnDetails
3234
from .create_virtual_circuit_details import CreateVirtualCircuitDetails
35+
from .create_virtual_circuit_public_prefix_details import CreateVirtualCircuitPublicPrefixDetails
3336
from .create_vnic_details import CreateVnicDetails
3437
from .create_volume_backup_details import CreateVolumeBackupDetails
3538
from .create_volume_details import CreateVolumeDetails
@@ -39,6 +42,7 @@
3942
from .cross_connect_mapping import CrossConnectMapping
4043
from .cross_connect_port_speed_shape import CrossConnectPortSpeedShape
4144
from .cross_connect_status import CrossConnectStatus
45+
from .delete_virtual_circuit_public_prefix_details import DeleteVirtualCircuitPublicPrefixDetails
4246
from .dhcp_dns_option import DhcpDnsOption
4347
from .dhcp_option import DhcpOption
4448
from .dhcp_options import DhcpOptions
@@ -106,6 +110,7 @@
106110
from .vcn import Vcn
107111
from .virtual_circuit import VirtualCircuit
108112
from .virtual_circuit_bandwidth_shape import VirtualCircuitBandwidthShape
113+
from .virtual_circuit_public_prefix import VirtualCircuitPublicPrefix
109114
from .vnic import Vnic
110115
from .vnic_attachment import VnicAttachment
111116
from .volume import Volume
@@ -123,6 +128,8 @@
123128
"AttachVolumeDetails": AttachVolumeDetails,
124129
"BootVolume": BootVolume,
125130
"BootVolumeAttachment": BootVolumeAttachment,
131+
"BulkAddVirtualCircuitPublicPrefixesDetails": BulkAddVirtualCircuitPublicPrefixesDetails,
132+
"BulkDeleteVirtualCircuitPublicPrefixesDetails": BulkDeleteVirtualCircuitPublicPrefixesDetails,
126133
"CaptureConsoleHistoryDetails": CaptureConsoleHistoryDetails,
127134
"ConnectLocalPeeringGatewaysDetails": ConnectLocalPeeringGatewaysDetails,
128135
"ConsoleHistory": ConsoleHistory,
@@ -144,6 +151,7 @@
144151
"CreateSubnetDetails": CreateSubnetDetails,
145152
"CreateVcnDetails": CreateVcnDetails,
146153
"CreateVirtualCircuitDetails": CreateVirtualCircuitDetails,
154+
"CreateVirtualCircuitPublicPrefixDetails": CreateVirtualCircuitPublicPrefixDetails,
147155
"CreateVnicDetails": CreateVnicDetails,
148156
"CreateVolumeBackupDetails": CreateVolumeBackupDetails,
149157
"CreateVolumeDetails": CreateVolumeDetails,
@@ -153,6 +161,7 @@
153161
"CrossConnectMapping": CrossConnectMapping,
154162
"CrossConnectPortSpeedShape": CrossConnectPortSpeedShape,
155163
"CrossConnectStatus": CrossConnectStatus,
164+
"DeleteVirtualCircuitPublicPrefixDetails": DeleteVirtualCircuitPublicPrefixDetails,
156165
"DhcpDnsOption": DhcpDnsOption,
157166
"DhcpOption": DhcpOption,
158167
"DhcpOptions": DhcpOptions,
@@ -220,6 +229,7 @@
220229
"Vcn": Vcn,
221230
"VirtualCircuit": VirtualCircuit,
222231
"VirtualCircuitBandwidthShape": VirtualCircuitBandwidthShape,
232+
"VirtualCircuitPublicPrefix": VirtualCircuitPublicPrefix,
223233
"Vnic": Vnic,
224234
"VnicAttachment": VnicAttachment,
225235
"Volume": Volume,

0 commit comments

Comments
 (0)