-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from oracle/release_2018-03-08
Releasing version 1.3.16
- v2.147.0
- v2.146.0
- v2.145.0
- v2.144.1
- v2.144.0
- v2.143.1
- v2.143.0
- v2.142.0
- v2.141.1
- v2.141.0
- v2.140.0
- v2.139.0
- v2.138.1
- v2.138.0
- v2.137.1
- v2.137.0
- v2.136.0
- v2.135.2
- v2.135.1
- v2.135.0
- v2.134.0
- v2.133.0
- v2.132.0
- v2.131.1
- v2.131.0
- v2.130.0
- v2.129.4
- v2.129.3
- v2.129.2
- v2.129.1
- v2.129.0
- v2.128.10
- v2.128.9
- v2.128.2
- v2.128.1
- v2.128.0
- v2.127.0
- v2.126.4
- v2.126.3
- v2.126.2
- v2.126.1
- v2.126.0
- v2.125.3
- v2.125.2
- v2.125.1
- v2.125.0
- v2.124.2
- v2.124.1
- v2.124.0
- v2.123.0
- v2.122.0
- v2.121.1
- v2.121.0
- v2.120.0
- v2.119.1
- v2.119.0
- v2.118.2
- v2.118.1
- v2.118.0
- v2.117.0
- v2.116.0
- v2.115.1
- v2.115.0
- v2.114.0
- v2.113.0
- v2.112.4
- v2.112.3
- v2.112.2
- v2.112.1
- v2.112.0
- v2.111.0
- v2.110.2
- v2.110.1
- v2.110.0
- v2.109.0
- v2.108.0
- v2.107.0
- v2.106.0
- v2.105.0
- v2.104.3
- v2.104.2
- v2.104.1
- v2.104.0
- v2.103.0
- v2.102.0
- v2.101.0
- v2.100.0
- v2.99.1
- v2.99.0
- v2.98.0
- v2.97.0
- v2.96.1
- v2.96.0
- v2.95.0
- v2.94.0
- v2.93.1
- v2.93.0
- v2.92.0
- v2.91.0
- v2.90.4
- v2.90.3
- v2.90.2
- v2.90.1
- v2.90.0
- v2.89.0
- v2.88.2
- v2.88.1
- v2.88.0
- v2.87.0
- v2.86.0
- v2.85.0
- v2.84.0
- v2.83.0
- v2.82.0
- v2.81.0
- v2.80.1
- v2.80.0
- v2.79.0
- v2.78.0
- v2.77.0
- v2.76.0
- v2.75.1
- v2.75.0
- v2.74.0
- v2.73.0
- v2.72.0
- v2.71.0
- v2.70.1
- v2.70.0
- v2.69.0
- v2.68.0
- v2.67.0
- v2.66.0
- v2.65.0
- v2.64.0
- v2.63.0
- v2.62.1
- v2.62.0
- v2.61.0
- v2.60.1
- v2.60.0
- v2.59.0
- v2.58.0
- v2.57.0
- v2.56.0
- v2.55.1
- v2.55.0
- v2.54.1
- v2.54.0
- v2.53.1
- v2.53.0
- v2.52.1
- v2.52.0
- v2.51.0
- v2.50.0
- v2.49.1
- v2.49.0
- v2.48.0
- v2.47.1
- v2.47.0
- v2.46.0
- v2.45.1
- v2.45.0
- v2.44.2
- v2.44.1
- v2.44.0
- v2.43.2
- v2.43.1
- v2.43.0
- v2.42.0
- v2.41.1
- v2.41.0
- v2.40.1
- v2.40.0
- v2.39.1
- v2.39.0
- v2.38.4
- v2.38.3
- v2.38.2
- v2.38.1
- v2.38.0
- v2.37.0
- v2.36.0
- v2.35.1
- v2.35.0
- v2.34.0
- v2.33.0
- v2.32.1
- v2.32.0
- v2.31.2
- v2.31.1
- v2.31.0
- v2.30.0
- v2.29.0
- v2.28.0
- v2.27.0
- v2.26.0
- v2.25.1
- v2.25.0
- v2.24.1
- v2.24.0
- v2.23.5
- v2.23.4
- v2.23.3
- v2.23.2
- v2.23.1
- v2.23.0
- v2.22.0
- v2.21.6
- v2.21.5
- v2.21.4
- v2.21.3
- v2.21.2
- v2.21.1
- v2.21.0
- v2.20.0
- v2.19.0
- v2.18.1
- v2.18.0
- v2.17.2
- v2.17.1
- v2.17.0
- v2.16.1
- v2.16.0
- v2.15.0
- v2.14.3
- v2.14.2
- v2.14.1
- v2.14.0
- v2.13.0
- v2.12.4
- v2.12.3
- v2.12.2
- v2.12.1
- v2.12.0
- v2.11.0
- v2.10.7
- v2.10.6
- v2.10.5
- v2.10.4
- v2.10.3
- v2.10.2
- v2.10.1
- v2.10.0
- v2.9.0
- v2.8.0
- v2.7.1
- v2.7.0
- v2.6.5
- v2.6.4
- v2.6.3
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.0
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.21
- v2.2.20
- v2.2.19
- v2.2.18
- v2.2.17
- v2.2.16
- v2.2.15
- v2.2.14
- v2.2.13
- v2.2.12
- v2.2.11
- v2.2.10
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.1
- v1.4.0
- v1.3.20
- v1.3.19
- v1.3.18
- v1.3.17
- v1.3.16
Showing
48 changed files
with
3,807 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.. _handle-naive-datetime: | ||
|
||
Handling naive datetimes | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
For operations and models which accept a `datetime <https://docs.python.org/3.6/library/datetime.html>`__ object, if a naive | ||
``datetime`` is passed (i.e. one without any ``tzinfo``) then the SDK will interpret the date and time as being UTC. This is | ||
the equivalent of running the following code on the naive ``datetime``: | ||
|
||
.. code-block:: pycon | ||
>>> import datetime | ||
>>> import pytz | ||
>>> my_naive_datetime = datetime.datetime(2001, 1, 1, 12, 30) | ||
>>> my_naive_datetime | ||
datetime.datetime(2001, 1, 1, 12, 30) | ||
>>> pytz.utc.localize(my_naive_datetime) | ||
datetime.datetime(2001, 1, 1, 12, 30, tzinfo=<UTC>) | ||
For aware ``datetime`` objects (i.e. those with a ``tzinfo``), their timezone information will be used as-is. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.. sdk-behaviors: | ||
SDK Behaviors | ||
~~~~~~~~~~~~~~ | ||
This section describes SDK-specific behaviors: | ||
|
||
* :doc:`Handling naive datetimes </sdk_behaviors/handle_naive_datetime>` | ||
* :doc:`Parallel operations </parallel-ops>` | ||
* :doc:`Passing explicit null/None values </pass-explicit-null>` | ||
|
||
.. toctree:: | ||
:hidden: | ||
:maxdepth: 2 | ||
|
||
handle_naive_datetime | ||
/parallel-ops | ||
/pass-explicit-null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# coding: utf-8 | ||
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. | ||
|
||
# This script provides a basic example of how to use the Email Service in the Python SDK. This script accepts two | ||
# will demonstrate: | ||
# | ||
# * Creating, retrieving, listing and deleting email senders | ||
# * Creating, retrieving, listing and deleting email suppressions | ||
# * Obtaining SMTP credentials for your IAM user so that you can send emails. | ||
# See https://docs.us-phoenix-1.oraclecloud.com/Content/Email/Tasks/configuresmtpconnection.htm for more | ||
# information on sending emails | ||
# | ||
# This script accepts three arguments: | ||
# | ||
# * The compartment ID where email senders will be created | ||
# * The address of the email sender | ||
# * The address of the email suppression | ||
# | ||
# Note that email senders are created in the compartment which you specify, but the suppressions are always created at the tenancy | ||
# level. The tenancy will be read from your configuration file. | ||
|
||
import oci | ||
import sys | ||
|
||
# Default config file and profile | ||
config = oci.config.from_file() | ||
email_client = oci.email.EmailClient(config) | ||
identity_client = oci.identity.IdentityClient(config) | ||
|
||
if len(sys.argv) != 4: | ||
raise RuntimeError('This script expects an argument of a compartment OCID, sender email address and suppression email address') | ||
|
||
# The first argument is the name of the script, so start the index at 1 | ||
compartment_id = sys.argv[1] | ||
sender_address = sys.argv[2] | ||
suppression_address = sys.argv[3] | ||
|
||
create_sender_response = email_client.create_sender( | ||
oci.email.models.CreateSenderDetails( | ||
compartment_id=compartment_id, | ||
email_address=sender_address | ||
) | ||
) | ||
print('Created sender:\n{}'.format(create_sender_response.data)) | ||
print('\n=========================\n') | ||
|
||
# A sender has a lifecycle state, so we can wait for it to become available | ||
get_sender_response = oci.wait_until(email_client, email_client.get_sender(create_sender_response.data.id), 'lifecycle_state', 'ACTIVE') | ||
print('Waited for sender to become available:\n{}'.format(get_sender_response.data)) | ||
print('\n=========================\n') | ||
|
||
# We can list all senders, and also provide optional filters and sorts. Here we'll list all | ||
# senders sorted by their email address, and also demonstrate filtering by sender email | ||
# address (an exact match filter) | ||
# | ||
# Listing senders is a paginated operation, so we can use the functions in oci.pagination | ||
senders = oci.pagination.list_call_get_all_results( | ||
email_client.list_senders, | ||
compartment_id, | ||
sort_by='EMAILADDRESS', | ||
sort_order='ASC' | ||
).data | ||
print('Listing senders sorted by email address:') | ||
for s in senders: | ||
print(s) | ||
print('\n=========================\n') | ||
|
||
senders = oci.pagination.list_call_get_all_results( | ||
email_client.list_senders, | ||
compartment_id, | ||
email_address='fake-{}'.format(sender_address) | ||
).data | ||
print('Listing senders filtered by email address - no data expected:') | ||
for s in senders: | ||
print(s) | ||
print('\n=========================\n') | ||
|
||
# Suppressions do not have a lifecycle state, so we don't have to wait on anything after creation | ||
create_suppression_response = email_client.create_suppression( | ||
oci.email.models.CreateSuppressionDetails( | ||
compartment_id=config['tenancy'], | ||
email_address=suppression_address | ||
) | ||
) | ||
print('Created suppression:\n{}'.format(create_suppression_response.data)) | ||
print('\n=========================\n') | ||
|
||
# We can list all suppressions, and also provide optional filters and sorts. Here we'll list all | ||
# suppressions sorted by their time created, and also demonstrate filtering by suppression email | ||
# address (an exact match filter) | ||
# | ||
# Listing senders is a paginated operation, so we can use the functions in oci.pagination | ||
suppressions = oci.pagination.list_call_get_all_results( | ||
email_client.list_suppressions, | ||
config['tenancy'], | ||
sort_by='TIMECREATED', | ||
sort_order='DESC' | ||
).data | ||
print('Listing suppressions sorted by time created:') | ||
for s in suppressions: | ||
print(s) | ||
print('\n=========================\n') | ||
|
||
suppressions = oci.pagination.list_call_get_all_results( | ||
email_client.list_suppressions, | ||
config['tenancy'], | ||
email_address='fake-{}'.format(suppression_address) | ||
).data | ||
print('Listing suppressions filtered by email address - no data expected:') | ||
for s in suppressions: | ||
print(s) | ||
print('\n=========================\n') | ||
|
||
# We can also delete a sender and then wait for it to be deleted. The sender may already be deleted | ||
# by the time we call oci.wait_until, so pass the get_sender_response to the waiter. It is recommended that | ||
# you have a get response prior to calling the delete, INSTEAD OF doing: | ||
# | ||
# oci.wait_until(email_client, email_client.get_sender(sender_id), ...) | ||
# | ||
# When deleting, since the resource may be gone, we set succeed_on_not_found on the waiter so that we consider | ||
# receiving a 404 back from the service as a successful delete | ||
email_client.delete_sender(get_sender_response.data.id) | ||
oci.wait_until(email_client, get_sender_response, 'lifecycle_state', 'DELETED', succeed_on_not_found=True) | ||
print('Deleted sender') | ||
|
||
# Suppressions do not have a lifecycle state, so we don't have to wait on anything after deletion | ||
email_client.delete_suppression(create_suppression_response.data.id) | ||
print('Deleted suppression') | ||
|
||
# In order to send email, we'll need to create an SMTP credential associated with an IAM user. More | ||
# information on sending email can be found here: | ||
# https://docs.us-phoenix-1.oraclecloud.com/Content/Email/Tasks/configuresmtpconnection.htm | ||
# | ||
# Note, also, that an IAM user can only have two active SMTP credentials at any time | ||
# | ||
# Also the password for the SMTP credential is ONLY available in the create response, so you | ||
# should store/save this as it won't be retrievable later | ||
create_smtp_credential_response = identity_client.create_smtp_credential( | ||
oci.identity.models.CreateSmtpCredentialDetails( | ||
description='new credential' | ||
), | ||
user_id=config['user'] | ||
) | ||
print('Created SMTP credential:\n{}'.format(create_smtp_credential_response.data)) | ||
print('\n=========================\n') | ||
|
||
# We can update the description of an SMTP credential | ||
update_smtp_credential_response = identity_client.update_smtp_credential( | ||
config['user'], | ||
create_smtp_credential_response.data.id, | ||
oci.identity.models.UpdateSmtpCredentialDetails( | ||
description='updated credential description' | ||
) | ||
) | ||
print('Updated SMTP credential:\n{}'.format(update_smtp_credential_response.data)) | ||
print('\n=========================\n') | ||
|
||
# We can list the credentials for a user. Note that this is not a paginated operation | ||
list_smtp_credentials_response = identity_client.list_smtp_credentials(config['user']) | ||
print('SMTP credentials for user:\n{}'.format(list_smtp_credentials_response.data)) | ||
print('\n=========================\n') | ||
|
||
identity_client.delete_smtp_credential(config['user'], create_smtp_credential_response.data.id) | ||
print('Deleted SMTP credential') | ||
|
||
print('\nScript Finished') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.