Skip to content

Commit 69629cd

Browse files
authored
Releasing version 1.3.1 (#14)
1 parent eedac5e commit 69629cd

35 files changed

+210
-114
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ abandoned/
66
.settings
77
.DS_Store
88
.idea/
9+
*.iml
910
*.pyc
1011
*.egg-info/
1112
.tox/
1213
.cache/
1314
build/
15+
data/
1416
dist/
1517
__pycache__/
1618
env/
1719
docs/_build/
1820
docs/apidocs/
1921
oraclebmc/models/init_*
20-
tests/resources/test_debug.log
22+
tests/resources/test_debug.log

CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ 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.1 - 2017-04-27
9+
====================
10+
11+
-------
12+
Changed
13+
-------
14+
15+
* No longer throwing exceptions for unrecognized enum values returned by services. Any unrecognized enum value returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
16+
717
====================
818
1.3.0 - 2017-04-06
919
====================

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ To get started, head over to the :ref:`installation instructions <install>` or s
3434
installation
3535
configuration
3636
quickstart
37+
parallel-ops
3738
raw-requests
3839
api/index
3940
contributions

docs/installation.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ Service Errors
117117
Any operation resulting in a service error will cause an exception of type oraclebmc.exceptions.ServiceError to be thrown by the SDK. For information about common service errors returned by BMCS, see `API Errors <https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm>`_
118118
.
119119

120-
Oracle Linux Permission Issues
121-
------------------------------
122-
On Oracle Linux 7.3, if you encounter permission issues when running pip install, you might need to use ``sudo``.
123-
124120
SSL/TLS or Certificate Issues
125121
-----------------------------
126122

docs/parallel-ops.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. _parallel-ops:
2+
3+
Parallel Operations
4+
~~~~~~~~~~~~~~~~~~~~~~
5+
The Python SDK supports parallel requests to Oracle Bare Metal Cloud Services. For example, the `object storage upload <https://github.com/oracle/bmcs-python-sdk/blob/master/examples/parallel_upload_to_object_storage.py>`_ example shows how multiple processes can be used to upload files to object storage.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2+
#
3+
# Uploads all files from a local directory to an object storage bucket
4+
# using multiple processes so that the uploads are done in parallel.
5+
#
6+
# Assumptions: Object storage bucket already exists. See object_crud.py for
7+
# an example of creating a bucket.
8+
# Loads configuration from default profile in the default config
9+
# file
10+
11+
import oraclebmc
12+
import os
13+
import argparse
14+
from multiprocessing import Process
15+
from glob import glob
16+
17+
18+
def upload_to_object_storage(config, namespace, bucket, path):
19+
"""
20+
upload_to_object_storage will upload a file to an object storage bucket.
21+
This function is intended to be run as a separate process. The client is
22+
created with each invocation so that the separate processes do
23+
not have a reference to the same client.
24+
25+
:param config: a configuration dictionary used to create ObjectStorageClient
26+
:param namespace: Namespace where the bucket resides
27+
:param bucket: Name of the bucket in which the object will be stored
28+
:param path: path to file to upload to object storage
29+
:rtype: None
30+
"""
31+
with open(path, "rb") as in_file:
32+
name = os.path.basename(path)
33+
ostorage = oraclebmc.object_storage.ObjectStorageClient(config)
34+
ostorage.put_object(namespace,
35+
bucket,
36+
name,
37+
in_file)
38+
print("Finished uploading {}".format(name))
39+
40+
41+
if __name__ == "__main__":
42+
config = oraclebmc.config.from_file()
43+
object_storage = oraclebmc.object_storage.ObjectStorageClient(config)
44+
namespace = object_storage.get_namespace().data
45+
46+
description = "\n".join(["This is an example to show how multiple files can be uploaded to in",
47+
"parallel. The example uses multiple processes.",
48+
"",
49+
"All the files in 'directory' will be uploaded to the object storage bucket",
50+
"specified by 'bucket_name' The default profile will is used.",
51+
"",
52+
"The bucket must already exist. See object_crud.py for a bucket creation",
53+
"example."])
54+
55+
parser = argparse.ArgumentParser(description=description,
56+
formatter_class=argparse.RawDescriptionHelpFormatter)
57+
parser.add_argument(dest='bucket_name',
58+
help="Name of object storage bucket")
59+
parser.add_argument(dest='directory',
60+
help="Path to local directory containing files to upload. Do not include trailing path delimiter.")
61+
args = parser.parse_args()
62+
63+
bucket_name = args.bucket_name
64+
directory = args.directory
65+
if not os.path.isdir(directory):
66+
parser.usage()
67+
else:
68+
dir = directory + os.path.sep + "*"
69+
70+
proc_list = []
71+
for file_path in glob(dir):
72+
print("Starting upload for {}".format(file_path))
73+
p = Process(target=upload_to_object_storage, args=(config,
74+
namespace,
75+
args.bucket_name,
76+
file_path))
77+
p.start()
78+
proc_list.append(p)
79+
80+
for job in proc_list:
81+
job.join()

oraclebmc/core/models/console_history.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ def lifecycle_state(self):
171171
Gets the lifecycle_state of this ConsoleHistory.
172172
The current state of the console history.
173173
174+
Allowed values for this property are: "REQUESTED", "GETTING-HISTORY", "SUCCEEDED", "FAILED", 'UNKNOWN_ENUM_VALUE'.
175+
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
176+
174177
175178
:return: The lifecycle_state of this ConsoleHistory.
176179
:rtype: str
@@ -189,10 +192,7 @@ def lifecycle_state(self, lifecycle_state):
189192
"""
190193
allowed_values = ["REQUESTED", "GETTING-HISTORY", "SUCCEEDED", "FAILED"]
191194
if lifecycle_state not in allowed_values:
192-
raise ValueError(
193-
"Invalid value for `lifecycle_state`, must be one of {0}"
194-
.format(allowed_values)
195-
)
195+
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
196196
self._lifecycle_state = lifecycle_state
197197

198198
@property

oraclebmc/core/models/dhcp_dns_option.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def server_type(self):
7373
7474
__ {{DOC_SERVER_URL}}/Content/Network/Concepts/dns.htm
7575
76+
Allowed values for this property are: "VcnLocal", "VcnLocalPlusInternet", "CustomDnsServer", 'UNKNOWN_ENUM_VALUE'.
77+
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
78+
7679
7780
:return: The server_type of this DhcpDnsOption.
7881
:rtype: str
@@ -106,10 +109,7 @@ def server_type(self, server_type):
106109
"""
107110
allowed_values = ["VcnLocal", "VcnLocalPlusInternet", "CustomDnsServer"]
108111
if server_type not in allowed_values:
109-
raise ValueError(
110-
"Invalid value for `server_type`, must be one of {0}"
111-
.format(allowed_values)
112-
)
112+
server_type = 'UNKNOWN_ENUM_VALUE'
113113
self._server_type = server_type
114114

115115
def __repr__(self):

oraclebmc/core/models/dhcp_options.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def lifecycle_state(self):
115115
Gets the lifecycle_state of this DhcpOptions.
116116
The current state of the set of DHCP options.
117117
118+
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
119+
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
120+
118121
119122
:return: The lifecycle_state of this DhcpOptions.
120123
:rtype: str
@@ -133,10 +136,7 @@ def lifecycle_state(self, lifecycle_state):
133136
"""
134137
allowed_values = ["PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED"]
135138
if lifecycle_state not in allowed_values:
136-
raise ValueError(
137-
"Invalid value for `lifecycle_state`, must be one of {0}"
138-
.format(allowed_values)
139-
)
139+
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
140140
self._lifecycle_state = lifecycle_state
141141

142142
@property

oraclebmc/core/models/drg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def lifecycle_state(self):
109109
Gets the lifecycle_state of this Drg.
110110
The DRG's current state.
111111
112+
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
113+
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
114+
112115
113116
:return: The lifecycle_state of this Drg.
114117
:rtype: str
@@ -127,10 +130,7 @@ def lifecycle_state(self, lifecycle_state):
127130
"""
128131
allowed_values = ["PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED"]
129132
if lifecycle_state not in allowed_values:
130-
raise ValueError(
131-
"Invalid value for `lifecycle_state`, must be one of {0}"
132-
.format(allowed_values)
133-
)
133+
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
134134
self._lifecycle_state = lifecycle_state
135135

136136
@property

0 commit comments

Comments
 (0)