Skip to content

Commit 1e1329d

Browse files
authored
Releasing version 3.27.1
Releasing version 3.27.1
2 parents e5b866b + f22620a commit 1e1329d

File tree

8 files changed

+168
-4
lines changed

8 files changed

+168
-4
lines changed

CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ All notable changes to this project will be documented in this file.
66

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

9+
3.27.1 - 2023-05-16
10+
--------------------
11+
Added
12+
~~~~~
13+
* Support for Self Service Integration in the Fusion Application service
14+
15+
* ``oci fusion-apps service-attachment create``
16+
* ``oci fusion-apps service-attachment delete``
17+
* ``oci fusion-apps service-attachment verify``
18+
919
3.27.0 - 2023-05-09
1020
--------------------
1121
Added

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Jinja2==3.0.3
1414
jmespath==0.10.0
1515
ndg-httpsclient==0.4.2
1616
mock==2.0.0
17-
oci==2.101.0
17+
oci==2.102.0
1818
packaging==20.2
1919
pluggy==0.13.0
2020
py==1.10.0

services/fusion_apps/src/oci_cli_fusion_applications/generated/fusionapplications_cli.py

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,62 @@ def create_refresh_activity(ctx, from_json, wait_for_state, max_wait_seconds, wa
564564
cli_util.render_response(result, ctx)
565565

566566

567+
@service_attachment_group.command(name=cli_util.override('fusion_apps.create_service_attachment.command_name', 'create'), help=u"""Attaches a service instance to the fusion pod. \n[Command Reference](createServiceAttachment)""")
568+
@cli_util.option('--service-instance-type', required=True, help=u"""Type of the ServiceInstance being attached.""")
569+
@cli_util.option('--service-instance-id', required=True, help=u"""The service instance OCID of the instance being attached""")
570+
@cli_util.option('--fusion-environment-id', required=True, help=u"""unique FusionEnvironment identifier""")
571+
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
572+
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
573+
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
574+
@json_skeleton_utils.get_cli_json_input_option({})
575+
@cli_util.help_option
576+
@click.pass_context
577+
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
578+
@cli_util.wrap_exceptions
579+
def create_service_attachment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, service_instance_type, service_instance_id, fusion_environment_id):
580+
581+
if isinstance(fusion_environment_id, six.string_types) and len(fusion_environment_id.strip()) == 0:
582+
raise click.UsageError('Parameter --fusion-environment-id cannot be whitespace or empty string')
583+
584+
kwargs = {}
585+
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
586+
587+
_details = {}
588+
_details['serviceInstanceType'] = service_instance_type
589+
_details['serviceInstanceId'] = service_instance_id
590+
591+
client = cli_util.build_client('fusion_apps', 'fusion_applications', ctx)
592+
result = client.create_service_attachment(
593+
fusion_environment_id=fusion_environment_id,
594+
create_service_attachment_details=_details,
595+
**kwargs
596+
)
597+
if wait_for_state:
598+
599+
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
600+
try:
601+
wait_period_kwargs = {}
602+
if max_wait_seconds is not None:
603+
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
604+
if wait_interval_seconds is not None:
605+
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
606+
607+
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
608+
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
609+
except oci.exceptions.MaximumWaitTimeExceeded as e:
610+
# If we fail, we should show an error, but we should still provide the information to the customer
611+
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
612+
cli_util.render_response(result, ctx)
613+
sys.exit(2)
614+
except Exception:
615+
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
616+
cli_util.render_response(result, ctx)
617+
raise
618+
else:
619+
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
620+
cli_util.render_response(result, ctx)
621+
622+
567623
@fusion_environment_group.command(name=cli_util.override('fusion_apps.delete_fusion_environment.command_name', 'delete'), help=u"""Deletes the Fusion environment identified by it's OCID. \n[Command Reference](deleteFusionEnvironment)""")
568624
@cli_util.option('--fusion-environment-id', required=True, help=u"""unique FusionEnvironment identifier""")
569625
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
@@ -782,6 +838,63 @@ def delete_refresh_activity(ctx, from_json, wait_for_state, max_wait_seconds, wa
782838
cli_util.render_response(result, ctx)
783839

784840

841+
@service_attachment_group.command(name=cli_util.override('fusion_apps.delete_service_attachment.command_name', 'delete'), help=u"""Delete a service attachment by identifier \n[Command Reference](deleteServiceAttachment)""")
842+
@cli_util.option('--fusion-environment-id', required=True, help=u"""unique FusionEnvironment identifier""")
843+
@cli_util.option('--service-attachment-id', required=True, help=u"""OCID of the Service Attachment""")
844+
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
845+
@cli_util.confirm_delete_option
846+
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
847+
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
848+
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
849+
@json_skeleton_utils.get_cli_json_input_option({})
850+
@cli_util.help_option
851+
@click.pass_context
852+
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
853+
@cli_util.wrap_exceptions
854+
def delete_service_attachment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fusion_environment_id, service_attachment_id, if_match):
855+
856+
if isinstance(fusion_environment_id, six.string_types) and len(fusion_environment_id.strip()) == 0:
857+
raise click.UsageError('Parameter --fusion-environment-id cannot be whitespace or empty string')
858+
859+
if isinstance(service_attachment_id, six.string_types) and len(service_attachment_id.strip()) == 0:
860+
raise click.UsageError('Parameter --service-attachment-id cannot be whitespace or empty string')
861+
862+
kwargs = {}
863+
if if_match is not None:
864+
kwargs['if_match'] = if_match
865+
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
866+
client = cli_util.build_client('fusion_apps', 'fusion_applications', ctx)
867+
result = client.delete_service_attachment(
868+
fusion_environment_id=fusion_environment_id,
869+
service_attachment_id=service_attachment_id,
870+
**kwargs
871+
)
872+
if wait_for_state:
873+
874+
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
875+
try:
876+
wait_period_kwargs = {}
877+
if max_wait_seconds is not None:
878+
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
879+
if wait_interval_seconds is not None:
880+
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
881+
882+
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
883+
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
884+
except oci.exceptions.MaximumWaitTimeExceeded as e:
885+
# If we fail, we should show an error, but we should still provide the information to the customer
886+
click.echo('Failed to wait until the work request entered the specified state. Please retrieve the work request to find its current state', file=sys.stderr)
887+
cli_util.render_response(result, ctx)
888+
sys.exit(2)
889+
except Exception:
890+
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
891+
cli_util.render_response(result, ctx)
892+
raise
893+
else:
894+
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
895+
cli_util.render_response(result, ctx)
896+
897+
785898
@data_masking_activity_group.command(name=cli_util.override('fusion_apps.get_data_masking_activity.command_name', 'get'), help=u"""Gets a DataMaskingActivity by identifier \n[Command Reference](getDataMaskingActivity)""")
786899
@cli_util.option('--fusion-environment-id', required=True, help=u"""unique FusionEnvironment identifier""")
787900
@cli_util.option('--data-masking-activity-id', required=True, help=u"""Unique DataMasking run identifier.""")
@@ -1963,3 +2076,33 @@ def update_refresh_activity(ctx, from_json, wait_for_state, max_wait_seconds, wa
19632076
else:
19642077
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
19652078
cli_util.render_response(result, ctx)
2079+
2080+
2081+
@service_attachment_group.command(name=cli_util.override('fusion_apps.verify_service_attachment.command_name', 'verify'), help=u"""Verify whether a service instance can be attached to the fusion pod \n[Command Reference](verifyServiceAttachment)""")
2082+
@cli_util.option('--service-instance-type', required=True, help=u"""Type of the ServiceInstance being attached.""")
2083+
@cli_util.option('--service-instance-id', required=True, help=u"""The service instance OCID of the instance being attached""")
2084+
@cli_util.option('--fusion-environment-id', required=True, help=u"""unique FusionEnvironment identifier""")
2085+
@json_skeleton_utils.get_cli_json_input_option({})
2086+
@cli_util.help_option
2087+
@click.pass_context
2088+
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
2089+
@cli_util.wrap_exceptions
2090+
def verify_service_attachment(ctx, from_json, service_instance_type, service_instance_id, fusion_environment_id):
2091+
2092+
if isinstance(fusion_environment_id, six.string_types) and len(fusion_environment_id.strip()) == 0:
2093+
raise click.UsageError('Parameter --fusion-environment-id cannot be whitespace or empty string')
2094+
2095+
kwargs = {}
2096+
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
2097+
2098+
_details = {}
2099+
_details['serviceInstanceType'] = service_instance_type
2100+
_details['serviceInstanceId'] = service_instance_id
2101+
2102+
client = cli_util.build_client('fusion_apps', 'fusion_applications', ctx)
2103+
result = client.verify_service_attachment(
2104+
fusion_environment_id=fusion_environment_id,
2105+
verify_service_attachment_details=_details,
2106+
**kwargs
2107+
)
2108+
cli_util.render_response(result, ctx)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def open_relative(*path):
2929
readme = f.read()
3030

3131
requires = [
32-
'oci==2.101.0',
32+
'oci==2.102.0',
3333
'arrow>=1.0.0',
3434
'certifi',
3535
'click==8.0.4',
@@ -40,7 +40,7 @@ def open_relative(*path):
4040
'six>=1.15.0',
4141
'terminaltables==3.1.0',
4242
'pyOpenSSL>=17.5.0,<24.0.0',
43-
'PyYAML>=5.4,<6',
43+
'PyYAML>=5.4,<=6',
4444
'prompt-toolkit==3.0.29'
4545
]
4646

src/oci_cli/cli_constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,6 @@
7575
SERVICE_ERROR_DOCUMENTATION = 'https://docs.oracle.com/iaas/Content/API/References/apierrors.htm'
7676

7777
GITHUB_CHANGELOG = 'https://github.com/oracle/oci-cli/blob/master/CHANGELOG.rst'
78+
79+
INTERACTIVE_CLI_SUGGESTION_MESSAGE = 'For OCI CLI commands and parameters suggestion, auto completion and ' \
80+
'other useful features, try the Interactive mode by typing `oci -i`.'

src/oci_cli/cli_root.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ def find_latest_release_version(ctx, param, value):
420420
@click.pass_context
421421
def cli(ctx, config_file, profile, cli_rc_file, request_id, region, endpoint, realm_specific_endpoint, cert_bundle, output, query, raw_output, auth, auth_purpose, no_retry, max_retries, generate_full_command_json_input, generate_param_json_input, debug, cli_auto_prompt, connection_timeout, read_timeout, help):
422422

423+
click.exceptions.UsageError.show = cli_util.update_click_help_message
423424
if max_retries and no_retry:
424425
raise click.UsageError('The option --max-retries is not applicable when using the --no-retry flag.')
425426

src/oci_cli/cli_util.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,6 +2605,13 @@ def get_request_endpoint_from_exception_string(exception_string: str):
26052605
return None
26062606

26072607

2608+
def update_click_help_message(self):
2609+
if self.ctx is not None:
2610+
print(self.ctx.get_usage() + '\n')
2611+
print('Error: %s\n' % self.format_message())
2612+
print(cli_constants.INTERACTIVE_CLI_SUGGESTION_MESSAGE)
2613+
2614+
26082615
class CommandExample:
26092616

26102617
def __init__(self, description, usage, output):

src/oci_cli/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
33
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
44

5-
__version__ = '3.27.0'
5+
__version__ = '3.27.1'

0 commit comments

Comments
 (0)