Skip to content

Commit 67b1062

Browse files
authored
Releasing version 2.4.15 (#36)
1 parent 668fb0a commit 67b1062

39 files changed

+2582
-1701
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ All notable changes to this project will be documented in this file.
77
The format is based on `Keep a
88
Changelog <http://keepachangelog.com/>`__.
99

10+
2.4.15 - 2018-01-25
11+
---------------------
12+
Added
13+
~~~~~~~~~~
14+
* Support for using the ``ObjectReadWithoutList`` public access type when creating and updating buckets
15+
* Support for managing dynamic groups (oci iam dynamic-group)
16+
* Support for instance principal auth (using --auth instance_principal option)
17+
1018
2.4.14 - 2018-01-11
1119
--------------------
1220
Added

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Jinja2==2.9.6
1212
jmespath==0.9.3
1313
ndg-httpsclient==0.4.2
1414
mock==2.0.0
15-
oci==1.3.12
15+
oci==1.3.13
1616
packaging==16.8
1717
pluggy==0.4.0
1818
py==1.4.33
@@ -30,4 +30,5 @@ sphinx==1.6.4
3030
sphinx-rtd-theme==0.2.5b1
3131
terminaltables==3.1.0
3232
tox==2.9.1
33+
vcrpy==1.11.1
3334
virtualenv==15.1.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def open_relative(*path):
3030

3131

3232
requires = [
33-
'oci==1.3.12',
33+
'oci==1.3.13',
3434
'arrow==0.10.0',
3535
'certifi',
3636
'click==6.7',

src/oci_cli/bin/OciTabExpansion.ps1

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ $ociSubcommands = @{
3636
'db system' = 'get launch list patch terminate update'
3737
'db system-shape' = 'list'
3838
'db version' = 'list'
39-
'iam' = 'availability-domain compartment customer-secret-key group policy region region-subscription tag tag-namespace user'
39+
'iam' = 'availability-domain compartment customer-secret-key dynamic-group group policy region region-subscription tag tag-namespace user'
4040
'iam availability-domain' = 'list'
4141
'iam compartment' = 'create get list update'
4242
'iam customer-secret-key' = 'create delete list update'
43+
'iam dynamic-group' = 'create delete get list update'
4344
'iam group' = 'add-user create delete get list list-users remove-user update'
4445
'iam policy' = 'create delete get list update'
4546
'iam region' = 'list'
@@ -195,6 +196,11 @@ $ociCommandsToLongParams = @{
195196
'iam customer-secret-key delete' = 'customer-secret-key-id force from-json help if-match user-id'
196197
'iam customer-secret-key list' = 'from-json help user-id'
197198
'iam customer-secret-key update' = 'customer-secret-key-id display-name from-json help if-match user-id'
199+
'iam dynamic-group create' = 'compartment-id description from-json help matching-rule max-wait-seconds name wait-for-state wait-interval-seconds'
200+
'iam dynamic-group delete' = 'dynamic-group-id force from-json help if-match max-wait-seconds wait-for-state wait-interval-seconds'
201+
'iam dynamic-group get' = 'dynamic-group-id from-json help'
202+
'iam dynamic-group list' = 'all compartment-id from-json help limit page page-size'
203+
'iam dynamic-group update' = 'description dynamic-group-id from-json help if-match matching-rule max-wait-seconds wait-for-state wait-interval-seconds'
198204
'iam group add-user' = 'from-json group-id help user-id'
199205
'iam group create' = 'compartment-id defined-tags description freeform-tags from-json help max-wait-seconds name wait-for-state wait-interval-seconds'
200206
'iam group delete' = 'force from-json group-id help if-match max-wait-seconds wait-for-state wait-interval-seconds'
@@ -255,9 +261,9 @@ $ociCommandsToLongParams = @{
255261
'lb certificate list' = 'from-json help load-balancer-id'
256262
'lb health-checker get' = 'backend-set-name from-json help load-balancer-id'
257263
'lb health-checker update' = 'backend-set-name from-json help interval-in-millis load-balancer-id max-wait-seconds port protocol response-body-regex retries return-code timeout-in-millis url-path wait-for-state wait-interval-seconds'
258-
'lb listener create' = 'default-backend-set-name from-json help load-balancer-id max-wait-seconds name port protocol ssl-certificate-name ssl-verify-depth ssl-verify-peer-certificate wait-for-state wait-interval-seconds'
264+
'lb listener create' = 'connection-configuration-idle-timeout default-backend-set-name from-json help load-balancer-id max-wait-seconds name port protocol ssl-certificate-name ssl-verify-depth ssl-verify-peer-certificate wait-for-state wait-interval-seconds'
259265
'lb listener delete' = 'force from-json help listener-name load-balancer-id max-wait-seconds wait-for-state wait-interval-seconds'
260-
'lb listener update' = 'default-backend-set-name force from-json help listener-name load-balancer-id max-wait-seconds port protocol ssl-certificate-name ssl-verify-depth ssl-verify-peer-certificate wait-for-state wait-interval-seconds'
266+
'lb listener update' = 'connection-configuration-idle-timeout default-backend-set-name force from-json help listener-name load-balancer-id max-wait-seconds port protocol ssl-certificate-name ssl-verify-depth ssl-verify-peer-certificate wait-for-state wait-interval-seconds'
261267
'lb load-balancer create' = 'backend-sets certificates compartment-id display-name from-json help is-private listeners max-wait-seconds shape-name subnet-ids wait-for-state wait-interval-seconds'
262268
'lb load-balancer delete' = 'force from-json help load-balancer-id max-wait-seconds wait-for-state wait-interval-seconds'
263269
'lb load-balancer get' = 'from-json help load-balancer-id'
@@ -476,6 +482,11 @@ $ociCommandsToShortParams = @{
476482
'iam customer-secret-key delete' = '? h'
477483
'iam customer-secret-key list' = '? h'
478484
'iam customer-secret-key update' = '? h'
485+
'iam dynamic-group create' = '? c h'
486+
'iam dynamic-group delete' = '? h'
487+
'iam dynamic-group get' = '? h'
488+
'iam dynamic-group list' = '? c h'
489+
'iam dynamic-group update' = '? h'
479490
'iam group add-user' = '? h'
480491
'iam group create' = '? c h'
481492
'iam group delete' = '? h'

src/oci_cli/cli_constants.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# coding: utf-8
2+
# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3+
4+
CLI_RC_FALLBACK_LOCATION = '~/.oci/cli-defaults'
5+
CLI_RC_DEFAULT_LOCATION = '~/.oci/oci_cli_rc'
6+
CLI_RC_CANNED_QUERIES_SECTION_NAME = 'OCI_CLI_CANNED_QUERIES'
7+
CLI_RC_COMMAND_ALIASES_SECTION_NAME = 'OCI_CLI_COMMAND_ALIASES'
8+
CLI_RC_PARAM_ALIASES_SECTION_NAME = 'OCI_CLI_PARAM_ALIASES'
9+
CLI_RC_GENERIC_SETTINGS_SECTION_NAME = 'OCI_CLI_SETTINGS'
10+
11+
OCI_CLI_PROFILE_ENV_VAR = 'OCI_CLI_PROFILE'
12+
CLI_RC_GENERIC_SETTINGS_DEFAULT_PROFILE_KEY = 'default_profile'
13+
CLI_RC_GENERIC_SETTINGS_USE_CLICK_HELP = 'use_click_help'
14+
15+
OCI_CLI_AUTH_ENV_VAR = 'OCI_CLI_AUTH'
16+
OCI_CLI_AUTH_INSTANCE_PRINCIPAL = 'instance_principal'
17+
OCI_CLI_AUTH_API_KEY = 'api_key'

src/oci_cli/cli_root.py

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from . import help_text_producer
1616
from . import cli_util
1717

18+
from . import cli_constants
19+
1820
# Enable WARN logging to surface important warnings attached to loading
1921
# defaults, automatic coercion, or fallback values/endpoints that may impact
2022
# the user's security.
@@ -31,21 +33,12 @@
3133

3234
BMCS_DEPRECATION_NOTICE = """WARNING: Invoking the CLI using 'bmcs' is deprecated and will be removed in future versions, starting in March 2018. To avoid interruption at that time, please move to invoking the CLI using 'oci' instead."""
3335

34-
CLI_RC_FALLBACK_LOCATION = '~/.oci/cli-defaults'
35-
CLI_RC_DEFAULT_LOCATION = '~/.oci/oci_cli_rc'
36-
CLI_RC_CANNED_QUERIES_SECTION_NAME = 'OCI_CLI_CANNED_QUERIES'
37-
CLI_RC_COMMAND_ALIASES_SECTION_NAME = 'OCI_CLI_COMMAND_ALIASES'
38-
CLI_RC_PARAM_ALIASES_SECTION_NAME = 'OCI_CLI_PARAM_ALIASES'
39-
CLI_RC_GENERIC_SETTINGS_SECTION_NAME = 'OCI_CLI_SETTINGS'
40-
41-
OCI_CLI_PROFILE_ENV_VAR = 'OCI_CLI_PROFILE'
42-
CLI_RC_GENERIC_SETTINGS_DEFAULT_PROFILE_KEY = 'default_profile'
43-
CLI_RC_GENERIC_SETTINGS_USE_CLICK_HELP = 'use_click_help'
36+
OCI_CLI_AUTH_CHOICES = [cli_constants.OCI_CLI_AUTH_API_KEY, cli_constants.OCI_CLI_AUTH_INSTANCE_PRINCIPAL]
4437

4538

4639
def eager_load_cli_rc_file(ctx, param, value):
47-
expanded_rc_default_location = os.path.expandvars(os.path.expanduser(CLI_RC_DEFAULT_LOCATION))
48-
expanded_rc_fallback_location = os.path.expandvars(os.path.expanduser(CLI_RC_FALLBACK_LOCATION))
40+
expanded_rc_default_location = os.path.expandvars(os.path.expanduser(cli_constants.CLI_RC_DEFAULT_LOCATION))
41+
expanded_rc_fallback_location = os.path.expandvars(os.path.expanduser(cli_constants.CLI_RC_FALLBACK_LOCATION))
4942

5043
file_location = os.path.expandvars(os.path.expanduser(value))
5144
ctx.obj = {
@@ -92,7 +85,7 @@ def populate_aliases_canned_queries_and_settings(ctx, parser_without_defaults):
9285

9386

9487
def populate_settings(ctx, parser_without_defaults):
95-
raw_settings = get_section_without_defaults(parser_without_defaults, CLI_RC_GENERIC_SETTINGS_SECTION_NAME)
88+
raw_settings = get_section_without_defaults(parser_without_defaults, cli_constants.CLI_RC_GENERIC_SETTINGS_SECTION_NAME)
9689

9790
settings = {}
9891
if raw_settings:
@@ -103,7 +96,7 @@ def populate_settings(ctx, parser_without_defaults):
10396

10497

10598
def populate_command_aliases(ctx, parser_without_defaults):
106-
raw_command_aliases = get_section_without_defaults(parser_without_defaults, CLI_RC_COMMAND_ALIASES_SECTION_NAME)
99+
raw_command_aliases = get_section_without_defaults(parser_without_defaults, cli_constants.CLI_RC_COMMAND_ALIASES_SECTION_NAME)
107100

108101
# Global aliases, e.g. a "ls=list" mapping would mean someone could do "compute image ls" or "os bucket ls" or "network subnet ls". These aliases
109102
# must be a single word only
@@ -130,7 +123,7 @@ def populate_command_aliases(ctx, parser_without_defaults):
130123

131124

132125
def populate_parameter_aliases(ctx, parser_without_defaults):
133-
raw_parameter_aliases = get_section_without_defaults(parser_without_defaults, CLI_RC_PARAM_ALIASES_SECTION_NAME)
126+
raw_parameter_aliases = get_section_without_defaults(parser_without_defaults, cli_constants.CLI_RC_PARAM_ALIASES_SECTION_NAME)
134127

135128
canonical_param_to_alias = {}
136129

@@ -169,7 +162,7 @@ def populate_parameter_aliases(ctx, parser_without_defaults):
169162

170163

171164
def populate_canned_queries(ctx, parser_without_defaults):
172-
raw_canned_queries = get_section_without_defaults(parser_without_defaults, CLI_RC_CANNED_QUERIES_SECTION_NAME)
165+
raw_canned_queries = get_section_without_defaults(parser_without_defaults, cli_constants.CLI_RC_CANNED_QUERIES_SECTION_NAME)
173166

174167
if raw_canned_queries:
175168
ctx.obj['canned_queries'] = dict(raw_canned_queries)
@@ -201,7 +194,7 @@ def get_section_without_defaults(parser_without_defaults, section_name):
201194
default=Sentinel(DEFAULT_PROFILE), show_default=False,
202195
help='The profile in the config file to load. This profile will also be used to locate any default parameter values which have been specified in the OCI CLI-specific configuration file. [default: DEFAULT]')
203196
@click.option('--cli-rc-file', '--defaults-file',
204-
default=CLI_RC_DEFAULT_LOCATION, show_default=True,
197+
default=cli_constants.CLI_RC_DEFAULT_LOCATION, show_default=True,
205198
is_eager=True, callback=eager_load_cli_rc_file,
206199
help='The path to the OCI CLI-specific configuration file, containing parameter default values and other configuration information such as command aliases and predefined queries. The --defaults-file option is deprecated and you should use the --cli-rc-file option instead.')
207200
@click.option('--opc-request-id', '--opc-client-request-id', '--request-id', 'request_id',
@@ -215,6 +208,7 @@ def get_section_without_defaults(parser_without_defaults, section_name):
215208
Queries can be entered directly on the command line or referenced from the [OCI_CLI_COMMAND_ALIASES] section of your configuration file by using the syntax query://<query_name>, for example query://get_id_and_name
216209
""")
217210
@click.option('--raw-output', is_flag=True, help='If the output of a given query is a single string value, this will return the string without surrounding quotes')
211+
@click.option('--auth', type=click.Choice(choices=OCI_CLI_AUTH_CHOICES), help='The type of auth to use for the API request. By default the API key in your config file will be used. This value can also be provided in the {auth_env_var} environment variable.'.format(auth_env_var=cli_constants.OCI_CLI_AUTH_ENV_VAR))
218212
@click.option('--generate-full-command-json-input', is_flag=True, is_eager=True, help="""Prints out a JSON document which represents all possible options that can be provided to this command.
219213
220214
This JSON document can be saved to a file, modified with the appropriate option values, and then passed back via the --from-json option. This provides an alternative to typing options out on the command line.""")
@@ -224,7 +218,7 @@ def get_section_without_defaults(parser_without_defaults, section_name):
224218
@click.option('-d', '--debug', is_flag=True, help='Show additional debug information.')
225219
@click.option('-?', '-h', '--help', is_flag=True, help='Show this message and exit.')
226220
@click.pass_context
227-
def cli(ctx, config_file, profile, defaults_file, request_id, region, endpoint, cert_bundle, output, query, raw_output, generate_full_command_json_input, generate_param_json_input, debug, help):
221+
def cli(ctx, config_file, profile, defaults_file, request_id, region, endpoint, cert_bundle, output, query, raw_output, auth, generate_full_command_json_input, generate_param_json_input, debug, help):
228222
if ctx.command_path == 'bmcs':
229223
click.echo(click.style(BMCS_DEPRECATION_NOTICE, fg='red'), file=sys.stderr)
230224

@@ -241,13 +235,22 @@ def cli(ctx, config_file, profile, defaults_file, request_id, region, endpoint,
241235
#
242236
# --profile cannot be specified as a regular default because we use it to determine which
243237
# section of the default file to read from
244-
if OCI_CLI_PROFILE_ENV_VAR in os.environ:
245-
profile = os.environ[OCI_CLI_PROFILE_ENV_VAR]
246-
elif 'settings' in ctx.obj and CLI_RC_GENERIC_SETTINGS_DEFAULT_PROFILE_KEY in ctx.obj['settings']:
247-
profile = ctx.obj['settings'][CLI_RC_GENERIC_SETTINGS_DEFAULT_PROFILE_KEY]
238+
if cli_constants.OCI_CLI_PROFILE_ENV_VAR in os.environ:
239+
profile = os.environ[cli_constants.OCI_CLI_PROFILE_ENV_VAR]
240+
elif 'settings' in ctx.obj and cli_constants.CLI_RC_GENERIC_SETTINGS_DEFAULT_PROFILE_KEY in ctx.obj['settings']:
241+
profile = ctx.obj['settings'][cli_constants.CLI_RC_GENERIC_SETTINGS_DEFAULT_PROFILE_KEY]
248242
else:
249243
profile = DEFAULT_PROFILE
250244

245+
if auth is None:
246+
# if --auth is not supplied, fallback accordingly:
247+
# - if OCI_CLI_AUTH exists, use that
248+
if cli_constants.OCI_CLI_AUTH_ENV_VAR in os.environ:
249+
if os.environ[cli_constants.OCI_CLI_AUTH_ENV_VAR] in OCI_CLI_AUTH_CHOICES:
250+
auth = os.environ[cli_constants.OCI_CLI_AUTH_ENV_VAR]
251+
else:
252+
raise click.BadParameter('invalid choice: {arg_value}. (choose from {choices})'.format(arg_value=os.environ[cli_constants.OCI_CLI_AUTH_ENV_VAR], choices=', '.join(OCI_CLI_AUTH_CHOICES)), param_hint='OCI_CLI_AUTH')
253+
251254
initial_dict = {
252255
'config_file': config_file,
253256
'profile': profile,
@@ -261,7 +264,8 @@ def cli(ctx, config_file, profile, defaults_file, request_id, region, endpoint,
261264
'raw_output': raw_output,
262265
'generate_full_command_json_input': generate_full_command_json_input,
263266
'generate_param_json_input': generate_param_json_input,
264-
'debug': debug
267+
'debug': debug,
268+
'auth': auth
265269
}
266270

267271
if not ctx.obj:
@@ -273,7 +277,7 @@ def cli(ctx, config_file, profile, defaults_file, request_id, region, endpoint,
273277

274278
if help:
275279
ctx.obj['help'] = True
276-
if is_top_level_help(ctx) and not cli_util.parse_boolean(ctx.obj.get('settings', {}).get(CLI_RC_GENERIC_SETTINGS_USE_CLICK_HELP, False)):
280+
if is_top_level_help(ctx) and not cli_util.parse_boolean(ctx.obj.get('settings', {}).get(cli_constants.CLI_RC_GENERIC_SETTINGS_USE_CLICK_HELP, False)):
277281
help_text_producer.render_help_text(ctx, [sys.argv[1]])
278282

279283

src/oci_cli/cli_setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
from __future__ import print_function
55
import click
6-
from .cli_root import cli, CLI_RC_CANNED_QUERIES_SECTION_NAME, CLI_RC_COMMAND_ALIASES_SECTION_NAME, CLI_RC_PARAM_ALIASES_SECTION_NAME
6+
from .cli_root import cli
7+
from .cli_constants import CLI_RC_CANNED_QUERIES_SECTION_NAME, CLI_RC_COMMAND_ALIASES_SECTION_NAME, CLI_RC_PARAM_ALIASES_SECTION_NAME, CLI_RC_DEFAULT_LOCATION
78
from . import cli_util
8-
from .cli_root import CLI_RC_DEFAULT_LOCATION
99

1010
import base64
1111
import hashlib

0 commit comments

Comments
 (0)