Skip to content

Commit

Permalink
Merge pull request #91 from oracle/release_2018-10-04
Browse files Browse the repository at this point in the history
Releasing version 2.4.34
  • Loading branch information
paul-hummel-oracle authored Oct 4, 2018
2 parents 38688a2 + b47055d commit 70d7dd2
Show file tree
Hide file tree
Showing 37 changed files with 3,311 additions and 506 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,37 @@ All notable changes to this project will be documented in this file.

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

2.4.34 - 2018-10-04
---------------------
Added
~~~~~~~~
* Support to consume Image Catalog Listings as part of Compute Service

* (``oci compute pic listing``)
* (``oci compute pic version``)
* (``oci compute pic agreements``)
* (``oci compute pic subscription``)

* Support for Cross Region Copy in Object Storage.

* (``oci os object copy --bucket-name --source-object-name --destination-region --destination-namespace --destination-bucket --destination-object``)

* An example on using the feature can be found on `GitHub <https://github.com/oracle/oci-cli/blob/master/scripts/examples/copy_object_example.sh>`__

* Support for Object Lifecycle Management as part of the Object Storage service.

* (``oci os object-lifecycle-policy put``)
* (``oci os object-lifecycle-policy get``)
* (``oci os object-lifecycle-policy delete``)

* Support for network address translation gateway in Networking service

* (``oci network nat-gateway create``)
* (``oci network nat-gateway delete``)
* (``oci network nat-gateway get``)
* (``oci network nat-gateway list``)
* (``oci network nat-gateway update``)

2.4.33 - 2018-09-27
---------------------
Added
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Jinja2==2.9.6
jmespath==0.9.3
ndg-httpsclient==0.4.2
mock==2.0.0
oci==2.0.4
oci==2.0.5
packaging==16.8
pluggy==0.4.0
py==1.4.33
Expand Down
41 changes: 41 additions & 0 deletions scripts/examples/copy_object_example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
# This script provides an example of how to copy an object in object storage.
#
# Requirements for running this script:
# - OCI CLI v2.4.33 or later (you can check this by running oci --version)
# - jq (https://stedolan.github.io/jq/) for JSON querying and manipulation of CLI output. This may be a useful utility in general
# and may help cater to scenarios which can't be wholly addressed by the --query option in the CLI
set -e

COMPARTMENT_ID=""
SOURCE_BUCKET=""
SOURCE_OBJECT=""
DEST_BUCKET=""
DEST_OBJECT=""

echo "Fetching namespace."
NAMESPACE=$(oci os ns get | jq -r .data)
echo "Using namespace '$NAMESPACE'."

WORK_REQUEST_ID=$(oci os object copy --bucket-name $SOURCE_BUCKET --source-object-name $SOURCE_OBJECT --destination-region us-phoenix-1 --destination-namespace $NAMESPACE --destination-bucket $DEST_BUCKET --destination-object-name $DEST_OBJECT | jq -r '."opc-work-request-id"')
echo "Work request ID is $WORK_REQUEST_ID."

while true; do

WORK_REQUEST_STATE=$(oci os work-request get --work-request-id $WORK_REQUEST_ID | jq -r .data.status)
if [ "$WORK_REQUEST_STATE" == "COMPLETED" ]; then
echo "Copy has completed."
break
elif [ "$WORK_REQUEST_STATE" == "FAILED" ]; then
echo "Copy has failed."
break
elif [ "$WORK_REQUEST_STATE" == "CANCELED" ]; then
echo "Copy has been canceled."
break
else
echo "Copy is still in $WORK_REQUEST_STATE state."
sleep 5
fi

done
38 changes: 38 additions & 0 deletions scripts/examples/pic_listing_example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
# This script provides an example of how use the consumer listings CLI in terms of:
# - Retrieving a listing
# - Retrieving at most 8 resource versions available for the listing
#
# It displays a short summary of the listing and resource versions of a listing.
#
# For more help with specific consumer listing commands with, see:
# oci compute pic -h
#
# Requirements for running this script:
# - OCI CLI v2.4.33 or later (you can check this by running oci --version)
# - jq (https://stedolan.github.io/jq/) for JSON querying and manipulation of CLI output. This may be a useful utility in general
# and may help cater to scenarios which can't be wholly addressed by the --query option in the CLI

set -e

echo "Fetching data from pic catalog listing"

# Fetch a listing and get all the relevant fields
pic_list=$(oci compute pic listing list --limit 1 --sort-order ASC 2>/dev/null)
listing_id=$(printf "%s" $pic_list | jq -r '.data[0]."listing-id"')
display_name=$(printf "%s" $pic_list | jq -r '.data[0]."display-name"')
publisher_name=$(printf "%s" $pic_list | jq -r '.data[0]."publisher-name"')
summary=$(printf "%s" $pic_list | jq -r '.data[0]."summary"')

# Get the last 8 resource versions sorted by publish date
echo "Fetching data from pic catalog listing version"
resource_version_list=$(oci compute pic version list --listing-id $listing_id --sort-order ASC --limit 8)
resource_versions=$(printf "%s" $resource_version_list | jq '.data[] | ."listing-resource-version"' | paste -s -d, -)

echo ""
echo "Listing Id : $listing_id"
echo "Display Name : $display_name"
echo "Publisher Name : $publisher_name"
echo "Summary : $summary"
echo "Versions : [$resource_versions]"
38 changes: 38 additions & 0 deletions scripts/examples/pic_subscription_example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
# This script provides an example of how use the consumer listings CLI in terms of:
# - Retrieving a listing
# - Retrieving a resource versions available for the listing
# - Creating a subscription for the listing and version
#
# It displays a short summary of the listing and resource versions of a listing.
#
# For more help with specific consumer listing commands with, see:
# oci compute pic -h
#
# Requirements for running this script:
# - OCI CLI v2.4.33 or later (you can check this by running oci --version)
# - jq (https://stedolan.github.io/jq/) for JSON querying and manipulation of CLI output. This may be a useful utility in general
# and may help cater to scenarios which can't be wholly addressed by the --query option in the CLI

set -e

# TODO: Fill in your compartment-id
compartment_id={COMPARTMENT-ID}

echo 'Fetching listing id'
listing_id=$(oci compute pic listing list --limit 1 --sort-order ASC 2>/dev/null | jq -r '.data[0]."listing-id"')

echo "Fetching version for the listing: $listing_id"
resource_version=$(oci compute pic version list --listing-id $listing_id --limit 1 | jq -r '.data[0]."listing-resource-version"')

echo "Fetching agreements for listing:$listing_id and version:$resource_version"
agreements=$(oci compute pic agreements get --listing-id "$listing_id" --resource-version "$resource_version")
signature=$(printf "%s" $agreements | jq -r '.data."signature"')
time_ret=$(printf "%s" $agreements | jq -r '.data."time-retrieved"' | sed -e 's/000+00:00/Z/')
eula_link=$(printf "%s" $agreements | jq -r '.data."eula-link"')
oracle_tou_link=$(printf "%s" $agreements | jq -r '.data."oracle-terms-of-use-link"')

echo 'Creating subscription'
oci compute pic subscription create --compartment-id "$compartment_id" --listing-id "$listing_id" --resource-version "$resource_version" \
--signature "$signature" --oracle-tou-link "$oracle_tou_link" --time-retrieved "$time_ret" --eula-link "$eula_link"
4 changes: 2 additions & 2 deletions scripts/examples/tagging_example.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
# This script provides an example of how use tags in the CLI in terms of:
# This script provides an example of how to use tags in the CLI in terms of:
#
# - Managing tag namespaces and tags by performing create, read (get/list) and update operations on them
# - Applying tags to resources
Expand Down Expand Up @@ -250,4 +250,4 @@ oci iam tag-namespace retire --tag-namespace-id $TAG_NAMESPACE_ID
echo "Listing tags in the namespace to confirm they have been retired"
oci iam tag list --tag-namespace-id $TAG_NAMESPACE_ID --all

echo "DONE"
echo "DONE"
79 changes: 79 additions & 0 deletions scripts/examples/write_object_lifecycle_policy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
# This script provides an example of how to create an object lifecycle policy on a bucket.
#
# Requirements for running this script:
# - OCI CLI v2.4.33 or later (you can check this by running oci --version)
# - jq (https://stedolan.github.io/jq/) for JSON querying and manipulation of CLI output. This may be a useful utility in general
# and may help cater to scenarios which can't be wholly addressed by the --query option in the CLI
set -e

COMPARTMENT_ID="" # Your compartment OCID
BUCKET_NAME="" # Bucket to apply the object lifecycle policy to

if [[ -z $COMPARTMENT_ID || -z $BUCKET_NAME ]]; then
echo "Arguments required. Set arguments at top of script."
exit 1
fi

echo "Fetching namespace."
NAMESPACE_NAME=$(oci os ns get | jq -r .data)
if [[ -z $NAMESPACE_NAME ]]; then
echo "Couldn't read namespace. Check your credentials."
exit 1
fi
echo "Using namespace '$NAMESPACE_NAME'."

echo "Creating bucket."
oci os bucket create --namespace-name $NAMESPACE_NAME --name $BUCKET_NAME --compartment-id $COMPARTMENT_ID --storage-tier Standard
echo "Created bucket."

# An object lifecycle policy's rules needs to be uploaded as a JSON array. Each element in the array is a rule with this structure:
#
# {
# "action": "string",
# "isEnabled": true,
# "name": "string",
# "objectNameFilter": {
# "inclusionPrefixes": [
# "string",
# "string"
# ]
# },
# "timeAmount": 0,
# "timeUnit": "string"
# }
#
# (Use `oci os object-lifecycle-policy put --generate-param-json-input items` to generate the structure of the rule array.)
#
# An explanation of each element:
# - action: The action to take on objects matching this rule. Valid values are "ARCHIVE" and "DELETE"
# - isEnabled: A boolean that can be used to temporarily disable a rule.
# - name: A user-friendly name for the rule. This element has no effect on the rule's execution.
# - objectNameFilter: An object that allows filtering object names. A rule with a missing or empty filter will match all objects.
# - inclusionPrefixes: An array of string object name prefixes that will match desired objects in the bucket. For example, "/tmp/".
# - timeAmount: An integer amount of time, specified in terms of the timeUnit below. For example, 90 DAYS.
# - timeUnit: The unit of time to interpret timeAmount in terms of. Valid values are "DAYS" and "YEARS".
#
# A full lifecycle policy is an array of these rules. You may, for example, have one rule that archives objects after 30 days, and
# another that deletes objects after 120 days. If an object matches both of these rules, it will be deleted.
#
# A valid example lifecycle policy exists in write_object_lifecycle_policy_example/object_lifecycle_policy.json
# It will archive objects whose names begin with "/tmp/" when they reach one day old (rounded to midnight UTC), and all others after
# 30 days.
echo "Writing lifecycle policy."
oci os object-lifecycle-policy put --namespace $NAMESPACE_NAME --bucket-name $BUCKET_NAME --items file://scripts/examples/write_object_lifecycle_policy_example/object_lifecycle_policy.json
echo "Object lifecycle policy created successfully."

echo "Retrieving lifecycle policy."
oci os object-lifecycle-policy get --namespace $NAMESPACE_NAME --bucket-name $BUCKET_NAME
echo "Retrieved lifecycle policy."

# Overwriting or deleting a lifecycle policy immediately cancels any in-progress execution of the old policy.
echo "Deleting lifecycle policy."
oci os object-lifecycle-policy delete --namespace $NAMESPACE_NAME --bucket-name $BUCKET_NAME
echo "Deleted lifecycle policy."

echo "Deleting bucket."
oci os bucket delete --namespace $NAMESPACE_NAME --bucket-name $BUCKET_NAME
echo "Deleted bucket."
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
{
"action": "ARCHIVE",
"isEnabled": true,
"name": "archive-all-objects-after-30-days",
"timeAmount": 30,
"timeUnit": "DAYS"
},
{
"action": "ARCHIVE",
"isEnabled": true,
"name": "archive-tmp-objects-after-1-day",
"objectNameFilter": {
"inclusionPrefixes": [
"/tmp/"
]
},
"timeAmount": 1,
"timeUnit": "DAYS"
}
]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def open_relative(*path):
readme = f.read()

requires = [
'oci==2.0.4',
'oci==2.0.5',
'arrow==0.10.0',
'certifi',
'click==6.7',
Expand Down
Loading

0 comments on commit 70d7dd2

Please sign in to comment.