Skip to content

Commit

Permalink
Merge pull request #76 from oracle/release_2018-07-27
Browse files Browse the repository at this point in the history
Releasing version 2.4.29
  • Loading branch information
vish1 authored Jul 27, 2018
2 parents caccb5d + 9b4b8e3 commit b5d1f5e
Show file tree
Hide file tree
Showing 26 changed files with 616 additions and 27 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ 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.29 - 2018-07-26
---------------------
Added
~~~~~~~~
* Support for Resource Search service (``oci search``)

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

* Ability to set the scheduled backup policy on Boot Volume creation in the Block Storage Service. (``oci bv boot-volume create --backup-policy-id``)

2.4.28 - 2018-07-12
---------------------
Added
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Jinja2==2.9.6
jmespath==0.9.3
ndg-httpsclient==0.4.2
mock==2.0.0
oci==1.4.5
oci==2.0.0
packaging==16.8
pluggy==0.4.0
py==1.4.33
Expand Down
31 changes: 31 additions & 0 deletions scripts/resource_search_example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# This script provides a basic example of how to use the Resource Search Service in the Python CLI.
# will demonstrate:
#
# * List all searchable resource types.
# * Get detail of one resource type.
# * Use free text query to search resources cross resource types.
# * Use structured query to search resources cross resource types.
#
# Requirements for running this script:
# - OCI CLI v2.4.27 or later (you can check this by running oci --version)

set -e

echo "List all searchable resource types"

oci search resource-type list

echo "Get detail of resource type 'Group' "

oci search resource-type get --name "Group"

echo "Search for objects with string 'searchstring' by free text search"

oci search resource free-text-search --text "searchstring"

echo "Search for all resource object by structured query search"

oci search resource structured-search --query-text "query all resources"

echo "Success!"
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def open_relative(*path):


requires = [
'oci==1.4.5',
'oci==2.0.0',
'arrow==0.10.0',
'certifi',
'click==6.7',
Expand All @@ -42,7 +42,6 @@ def open_relative(*path):
'python-dateutil==2.7.3',
'pytz==2016.10',
'retrying==1.3.3',
'requests[security]==2.18.4',
'six==1.11.0',
'terminaltables==3.1.0',
'idna>=2.5,<2.7'
Expand Down
2 changes: 2 additions & 0 deletions src/oci_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .generated import identity_cli # noqa: F401
from .generated import loadbalancer_cli # noqa: F401
from .generated import objectstorage_cli # noqa: F401
from .generated import resourcesearch_cli # noqa: F401
from .generated import virtualnetwork_cli # noqa: F401

from . import aliasing # noqa: F401
Expand All @@ -27,6 +28,7 @@
from . import dns_cli_extended # noqa: F401
from . import identity_cli_extended # noqa: F401
from . import objectstorage_cli_extended # noqa: F401
from . import resourcesearch_cli_extended # noqa: F401
from . import email_cli_extended # noqa: F401
from . import file_filters # noqa: F401
from . import final_command_processor # noqa: F401
Expand Down
15 changes: 13 additions & 2 deletions src/oci_cli/bin/OciTabExpansion.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.

$ociTopLevelCommands = @(
'audit', 'bv', 'ce', 'compute', 'db', 'dns', 'email', 'fs', 'iam', 'lb', 'network', 'os', 'setup'
'audit', 'bv', 'ce', 'compute', 'db', 'dns', 'email', 'fs', 'iam', 'lb', 'network', 'os', 'search', 'setup'
)

$ociSubcommands = @{
Expand Down Expand Up @@ -132,6 +132,9 @@ $ociSubcommands = @{
'os ns' = 'get get-metadata update-metadata'
'os object' = 'bulk-delete bulk-download bulk-upload delete get head list put rename restore restore-status resume-put'
'os preauth-request' = 'create delete get list'
'search' = 'resource resource-type'
'search resource' = 'free-text-search structured-search'
'search resource-type' = 'get list'
'setup' = 'autocomplete config keys oci-cli-rc repair-file-permissions'
}
$script:ociSubcommandKeys = $ociSubcommands.Keys -join '|'
Expand All @@ -145,7 +148,7 @@ $ociCommandsToLongParams = @{
'bv backup get' = 'from-json help volume-backup-id'
'bv backup list' = 'all compartment-id display-name from-json help lifecycle-state limit page page-size sort-by sort-order volume-id'
'bv backup update' = 'defined-tags display-name force freeform-tags from-json help if-match max-wait-seconds volume-backup-id wait-for-state wait-interval-seconds'
'bv boot-volume create' = 'availability-domain boot-volume-backup-id compartment-id defined-tags display-name freeform-tags from-json help max-wait-seconds source-boot-volume-id wait-for-state wait-interval-seconds'
'bv boot-volume create' = 'availability-domain backup-policy-id boot-volume-backup-id compartment-id defined-tags display-name freeform-tags from-json help max-wait-seconds source-boot-volume-id wait-for-state wait-interval-seconds'
'bv boot-volume delete' = 'boot-volume-id force from-json help if-match max-wait-seconds wait-for-state wait-interval-seconds'
'bv boot-volume get' = 'boot-volume-id from-json help'
'bv boot-volume list' = 'all availability-domain compartment-id from-json help limit page page-size volume-group-id'
Expand Down Expand Up @@ -565,6 +568,10 @@ $ociCommandsToLongParams = @{
'os preauth-request delete' = 'bucket-name force from-json help namespace namespace-name par-id'
'os preauth-request get' = 'bucket-name from-json help namespace namespace-name par-id'
'os preauth-request list' = 'all bucket-name from-json help limit namespace namespace-name object-name-prefix page page-size'
'search resource free-text-search' = 'from-json help limit matching-context-type page text'
'search resource structured-search' = 'from-json help limit matching-context-type page query-text'
'search resource-type get' = 'from-json help name'
'search resource-type list' = 'all from-json help limit page page-size'
'setup autocomplete' = 'help'
'setup config' = 'help'
'setup keys' = 'help key-name output-dir overwrite passphrase passphrase-file'
Expand Down Expand Up @@ -1002,6 +1009,10 @@ $ociCommandsToShortParams = @{
'os preauth-request delete' = '? bn h ns'
'os preauth-request get' = '? bn h ns'
'os preauth-request list' = '? bn h ns'
'search resource free-text-search' = '? h'
'search resource structured-search' = '? h'
'search resource-type get' = '? h'
'search resource-type list' = '? h'
'setup autocomplete' = '? h'
'setup config' = '? h'
'setup keys' = '? h'
Expand Down
2 changes: 2 additions & 0 deletions src/oci_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .generated import identity_cli # noqa: F401
from .generated import loadbalancer_cli # noqa: F401
from .generated import objectstorage_cli # noqa: F401
from .generated import resourcesearch_cli # noqa: F401
from .generated import virtualnetwork_cli # noqa: F401

from . import audit_cli_extended # noqa: F401
Expand All @@ -26,6 +27,7 @@
from . import identity_cli_extended # noqa: F401
from . import lb_cli_extended # noqa: F401
from . import objectstorage_cli_extended # noqa: F401
from . import resourcesearch_cli_extended # noqa: F401
from . import final_command_processor # noqa: F401
from . import cli_setup # noqa: F401

Expand Down
5 changes: 4 additions & 1 deletion src/oci_cli/cli_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from oci.identity import IdentityClient
from oci.load_balancer import LoadBalancerClient
from oci.object_storage import ObjectStorageClient
from oci.resource_search import ResourceSearchClient

CLIENT_MAP = {
"audit": AuditClient,
Expand All @@ -27,6 +28,7 @@
"identity": IdentityClient,
"load_balancer": LoadBalancerClient,
"object_storage": ObjectStorageClient,
"resource_search": ResourceSearchClient,
"virtual_network": VirtualNetworkClient
}

Expand All @@ -40,5 +42,6 @@
"file_storage": oci.file_storage.models.file_storage_type_mapping,
"identity": oci.identity.models.identity_type_mapping,
"load_balancer": oci.load_balancer.models.load_balancer_type_mapping,
"object_storage": oci.object_storage.models.object_storage_type_mapping
"object_storage": oci.object_storage.models.object_storage_type_mapping,
"resource_search": oci.resource_search.models.resource_search_type_mapping
}
9 changes: 7 additions & 2 deletions src/oci_cli/cli_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os.path
import pytz
import re
import requests
import six
import stat
import subprocess
Expand All @@ -33,6 +32,7 @@
from .cli_clients import CLIENT_MAP, MODULE_TO_TYPE_MAPPINGS

from oci import exceptions, config, dns, Response
from oci._vendor import requests

from .version import __version__

Expand Down Expand Up @@ -102,7 +102,12 @@
"update_namespace_metadata.command_name": "update-metadata",
"virtual_network_group.command_name": "network",
"virtual_network_group.help": "Networking Service",
"volume_backup_group.command_name": "backup"
"compute_management_group.command_name": "compute-management",
"compute_management_group.help": "Compute Management Service",
"volume_backup_group.command_name": "backup",
"resource_summary_collection_group.command_name": "resource",
"search_resources_structured_search_details.command_name": "structured-search",
"search_resources_free_text_search_details.command_name": "free-text-search"
}


Expand Down
6 changes: 5 additions & 1 deletion src/oci_cli/generated/blockstorage_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def volume_backup_policy_group():
Example: `Uocm:PHX-AD-1`""")
@cli_util.option('--compartment-id', required=True, help="""The OCID of the compartment that contains the boot volume.""")
@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help="""Specifies the boot volume source details for a new boot volume. The volume source is either another boot volume in the same Availability Domain or a boot volume backup. This is a mandatory field for a boot volume.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--backup-policy-id', help="""If provided, specifies the ID of the boot volume backup policy to assign to the newly created boot volume. If omitted, no policy will be assigned.""")
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help="""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
Expand All @@ -108,14 +109,17 @@ def volume_backup_policy_group():
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'core', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'core', 'class': 'dict(str, string)'}, 'source-details': {'module': 'core', 'class': 'BootVolumeSourceDetails'}}, output_type={'module': 'core', 'class': 'BootVolume'})
@cli_util.wrap_exceptions
def create_boot_volume(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, availability_domain, compartment_id, source_details, defined_tags, display_name, freeform_tags, size_in_gbs):
def create_boot_volume(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, availability_domain, compartment_id, source_details, backup_policy_id, defined_tags, display_name, freeform_tags, size_in_gbs):
kwargs = {}

details = {}
details['availabilityDomain'] = availability_domain
details['compartmentId'] = compartment_id
details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details)

if backup_policy_id is not None:
details['backupPolicyId'] = backup_policy_id

if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)

Expand Down
Loading

0 comments on commit b5d1f5e

Please sign in to comment.