Skip to content

Commit

Permalink
Releasing version 1.3.1 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mross22 authored Apr 28, 2017
1 parent eedac5e commit 69629cd
Showing 35 changed files with 210 additions and 114 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -6,15 +6,17 @@ abandoned/
.settings
.DS_Store
.idea/
*.iml
*.pyc
*.egg-info/
.tox/
.cache/
build/
data/
dist/
__pycache__/
env/
docs/_build/
docs/apidocs/
oraclebmc/models/init_*
tests/resources/test_debug.log
tests/resources/test_debug.log
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog <http://keepachangelog.com/>`_.

====================
1.3.1 - 2017-04-27
====================

-------
Changed
-------

* 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'.

====================
1.3.0 - 2017-04-06
====================
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ To get started, head over to the :ref:`installation instructions <install>` or s
installation
configuration
quickstart
parallel-ops
raw-requests
api/index
contributions
4 changes: 0 additions & 4 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -117,10 +117,6 @@ Service Errors
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>`_
.

Oracle Linux Permission Issues
------------------------------
On Oracle Linux 7.3, if you encounter permission issues when running pip install, you might need to use ``sudo``.

SSL/TLS or Certificate Issues
-----------------------------

5 changes: 5 additions & 0 deletions docs/parallel-ops.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. _parallel-ops:

Parallel Operations
~~~~~~~~~~~~~~~~~~~~~~
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.
81 changes: 81 additions & 0 deletions examples/parallel_upload_to_object_storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Uploads all files from a local directory to an object storage bucket
# using multiple processes so that the uploads are done in parallel.
#
# Assumptions: Object storage bucket already exists. See object_crud.py for
# an example of creating a bucket.
# Loads configuration from default profile in the default config
# file

import oraclebmc
import os
import argparse
from multiprocessing import Process
from glob import glob


def upload_to_object_storage(config, namespace, bucket, path):
"""
upload_to_object_storage will upload a file to an object storage bucket.
This function is intended to be run as a separate process. The client is
created with each invocation so that the separate processes do
not have a reference to the same client.
:param config: a configuration dictionary used to create ObjectStorageClient
:param namespace: Namespace where the bucket resides
:param bucket: Name of the bucket in which the object will be stored
:param path: path to file to upload to object storage
:rtype: None
"""
with open(path, "rb") as in_file:
name = os.path.basename(path)
ostorage = oraclebmc.object_storage.ObjectStorageClient(config)
ostorage.put_object(namespace,
bucket,
name,
in_file)
print("Finished uploading {}".format(name))


if __name__ == "__main__":
config = oraclebmc.config.from_file()
object_storage = oraclebmc.object_storage.ObjectStorageClient(config)
namespace = object_storage.get_namespace().data

description = "\n".join(["This is an example to show how multiple files can be uploaded to in",
"parallel. The example uses multiple processes.",
"",
"All the files in 'directory' will be uploaded to the object storage bucket",
"specified by 'bucket_name' The default profile will is used.",
"",
"The bucket must already exist. See object_crud.py for a bucket creation",
"example."])

parser = argparse.ArgumentParser(description=description,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument(dest='bucket_name',
help="Name of object storage bucket")
parser.add_argument(dest='directory',
help="Path to local directory containing files to upload. Do not include trailing path delimiter.")
args = parser.parse_args()

bucket_name = args.bucket_name
directory = args.directory
if not os.path.isdir(directory):
parser.usage()
else:
dir = directory + os.path.sep + "*"

proc_list = []
for file_path in glob(dir):
print("Starting upload for {}".format(file_path))
p = Process(target=upload_to_object_storage, args=(config,
namespace,
args.bucket_name,
file_path))
p.start()
proc_list.append(p)

for job in proc_list:
job.join()
8 changes: 4 additions & 4 deletions oraclebmc/core/models/console_history.py
Original file line number Diff line number Diff line change
@@ -171,6 +171,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this ConsoleHistory.
The current state of the console history.
Allowed values for this property are: "REQUESTED", "GETTING-HISTORY", "SUCCEEDED", "FAILED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this ConsoleHistory.
:rtype: str
@@ -189,10 +192,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["REQUESTED", "GETTING-HISTORY", "SUCCEEDED", "FAILED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/dhcp_dns_option.py
Original file line number Diff line number Diff line change
@@ -73,6 +73,9 @@ def server_type(self):
__ {{DOC_SERVER_URL}}/Content/Network/Concepts/dns.htm
Allowed values for this property are: "VcnLocal", "VcnLocalPlusInternet", "CustomDnsServer", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The server_type of this DhcpDnsOption.
:rtype: str
@@ -106,10 +109,7 @@ def server_type(self, server_type):
"""
allowed_values = ["VcnLocal", "VcnLocalPlusInternet", "CustomDnsServer"]
if server_type not in allowed_values:
raise ValueError(
"Invalid value for `server_type`, must be one of {0}"
.format(allowed_values)
)
server_type = 'UNKNOWN_ENUM_VALUE'
self._server_type = server_type

def __repr__(self):
8 changes: 4 additions & 4 deletions oraclebmc/core/models/dhcp_options.py
Original file line number Diff line number Diff line change
@@ -115,6 +115,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this DhcpOptions.
The current state of the set of DHCP options.
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this DhcpOptions.
:rtype: str
@@ -133,10 +136,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/drg.py
Original file line number Diff line number Diff line change
@@ -109,6 +109,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this Drg.
The DRG's current state.
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this Drg.
:rtype: str
@@ -127,10 +130,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/drg_attachment.py
Original file line number Diff line number Diff line change
@@ -139,6 +139,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this DrgAttachment.
The DRG attachment's current state.
Allowed values for this property are: "ATTACHING", "ATTACHED", "DETACHING", "DETACHED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this DrgAttachment.
:rtype: str
@@ -157,10 +160,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["ATTACHING", "ATTACHED", "DETACHING", "DETACHED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/image.py
Original file line number Diff line number Diff line change
@@ -179,6 +179,9 @@ def id(self, id):
def lifecycle_state(self):
"""
Gets the lifecycle_state of this Image.
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "DISABLED", "DELETED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this Image.
:rtype: str
@@ -195,10 +198,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["PROVISIONING", "AVAILABLE", "DISABLED", "DELETED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/instance.py
Original file line number Diff line number Diff line change
@@ -253,6 +253,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this Instance.
The current state of the instance.
Allowed values for this property are: "PROVISIONING", "RUNNING", "STARTING", "STOPPING", "STOPPED", "CREATING_IMAGE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this Instance.
:rtype: str
@@ -271,10 +274,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["PROVISIONING", "RUNNING", "STARTING", "STOPPING", "STOPPED", "CREATING_IMAGE", "TERMINATING", "TERMINATED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/internet_gateway.py
Original file line number Diff line number Diff line change
@@ -141,6 +141,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this InternetGateway.
The Internet Gateway's current state.
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this InternetGateway.
:rtype: str
@@ -159,10 +162,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/ip_sec_connection.py
Original file line number Diff line number Diff line change
@@ -166,6 +166,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this IPSecConnection.
The IPSec connection's current state.
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this IPSecConnection.
:rtype: str
@@ -184,10 +187,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/route_table.py
Original file line number Diff line number Diff line change
@@ -115,6 +115,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this RouteTable.
The route table's current state.
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this RouteTable.
:rtype: str
@@ -133,10 +136,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
8 changes: 4 additions & 4 deletions oraclebmc/core/models/security_list.py
Original file line number Diff line number Diff line change
@@ -166,6 +166,9 @@ def lifecycle_state(self):
Gets the lifecycle_state of this SecurityList.
The security list's current state.
Allowed values for this property are: "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The lifecycle_state of this SecurityList.
:rtype: str
@@ -184,10 +187,7 @@ def lifecycle_state(self, lifecycle_state):
"""
allowed_values = ["PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED"]
if lifecycle_state not in allowed_values:
raise ValueError(
"Invalid value for `lifecycle_state`, must be one of {0}"
.format(allowed_values)
)
lifecycle_state = 'UNKNOWN_ENUM_VALUE'
self._lifecycle_state = lifecycle_state

@property
Loading

0 comments on commit 69629cd

Please sign in to comment.