From 4e5bbf7c2edd5117dc6c244698c13aaa31863def Mon Sep 17 00:00:00 2001 From: OCI DEX Release Bot Automation Date: Tue, 22 Sep 2026 07:33:14 +0000 Subject: [PATCH] Releasing version 3.94.0 Co-authored-by: Harsh Kumar --- CHANGELOG.rst | 76 + requirements.txt | 2 +- .../generated/datasafe_cli.py | 1256 +++++++++- .../tests/util/generated/command_to_api.py | 18 + .../generated/datascience_cli.py | 66 +- services/distributed_database/__init__.py | 2 +- services/distributed_database/src/__init__.py | 2 +- .../__init__.py | 2 +- .../generated/__init__.py | 2 +- .../generated/client_mappings.py | 2 +- .../distributedautonomousdbservice_cli.py | 473 ++-- .../oci_cli_distributed_database/__init__.py | 2 +- .../generated/__init__.py | 2 +- .../distributed_database_service_cli.py | 2 +- .../__init__.py | 2 +- .../generated/__init__.py | 2 +- .../generated/client_mappings.py | 2 +- ...distributeddbprivateendpointservice_cli.py | 100 +- .../__init__.py | 2 +- .../generated/__init__.py | 2 +- .../generated/client_mappings.py | 2 +- .../generated/distributeddbservice_cli.py | 481 ++-- .../__init__.py | 2 +- .../generated/__init__.py | 2 +- .../generated/client_mappings.py | 2 +- .../distributeddbworkrequestservice_cli.py | 6 +- .../distributed_database/tests/__init__.py | 2 +- .../distributedautonomousdbservice_cli.py | 1489 ----------- .../__init__.py | 4 - .../generated/__init__.py | 4 - .../distributed_database_v26_service_cli.py | 14 - .../__init__.py | 4 - .../generated/__init__.py | 4 - ...distributeddbprivateendpointservice_cli.py | 515 ---- .../__init__.py | 4 - .../generated/__init__.py | 4 - .../generated/distributeddbservice_cli.py | 1364 ---------- .../__init__.py | 4 - .../generated/__init__.py | 4 - .../tests/__init__.py | 4 - .../tests/util/generated/command_to_api.py | 9 - services/functions/__init__.py | 2 +- services/functions/src/__init__.py | 2 +- .../src/oci_cli_functions/__init__.py | 2 +- .../functions_cli_extended.py | 40 +- .../oci_cli_functions/generated/__init__.py | 2 +- .../generated/fn_service_cli.py | 4 +- .../src/oci_cli_functions_invoke/__init__.py | 2 +- .../generated/__init__.py | 2 +- .../generated/client_mappings.py | 2 +- .../generated/functionsinvoke_cli.py | 2 +- .../oci_cli_functions_management/__init__.py | 2 +- .../functionsmanagement_cli_extended.py | 526 +++- .../generated/__init__.py | 2 +- .../generated/client_mappings.py | 2 +- .../generated/functionsmanagement_cli.py | 2227 +++++++++++------ .../__init__.py | 2 +- .../generated}/__init__.py | 2 +- .../generated/client_mappings.py | 12 +- .../generated/workrequestmanagement_cli.py} | 122 +- services/functions/tests/__init__.py | 2 +- .../tests/unit/test_functions_extended.py | 529 +++- .../tests/util/generated/command_to_api.py | 21 +- .../generated/generativeai_cli.py | 444 ++++ .../tests/util/generated/command_to_api.py | 7 + .../__init__.py | 2 +- .../generated/__init__.py | 2 +- .../generated/administratorartifact_cli.py | 63 + .../generated/client_mappings.py | 12 +- .../__init__.py | 4 + .../generated/__init__.py | 4 + .../generated/administratorpublisher_cli.py | 54 + .../generated/client_mappings.py | 12 +- .../__init__.py | 4 + .../generated/__init__.py | 4 + .../generated/client_mappings.py | 12 +- .../generated/marketplaceadministrator_cli.py | 888 +++++++ .../marketplace_publisher_service_cli.py | 14 + .../generated/marketplacepublisher_cli.py | 623 ++++- .../tests/util/generated/command_to_api.py | 7 + setup.py | 2 +- src/oci_cli/cli_util.py | 3 + src/oci_cli/service_mapping.py | 5 - src/oci_cli/version.py | 2 +- tests/resources/json_ignore_command_list.txt | 5 +- 85 files changed, 6579 insertions(+), 5044 deletions(-) delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/distributedautonomousdbservice_cli.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_database_v26/__init__.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_database_v26/generated/__init__.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_database_v26/generated/distributed_database_v26_service_cli.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/__init__.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/__init__.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/distributeddbprivateendpointservice_cli.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_db_service/__init__.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/__init__.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/distributeddbservice_cli.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/__init__.py delete mode 100644 services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/__init__.py delete mode 100644 services/distributed_database_v26/tests/__init__.py delete mode 100644 services/distributed_database_v26/tests/util/generated/command_to_api.py rename services/{distributed_database_v26 => functions/src/oci_cli_work_request_management}/__init__.py (92%) rename services/{distributed_database_v26/src => functions/src/oci_cli_work_request_management/generated}/__init__.py (92%) rename services/{distributed_database_v26/src/oci_cli_distributed_db_service => functions/src/oci_cli_work_request_management}/generated/client_mappings.py (54%) rename services/{distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/distributeddbworkrequestservice_cli.py => functions/src/oci_cli_work_request_management/generated/workrequestmanagement_cli.py} (56%) rename services/{distributed_database_v26/src/oci_cli_distributed_autonomous_db_service => marketplace_publisher/src/oci_cli_administrator_artifact}/__init__.py (92%) rename services/{distributed_database_v26/src/oci_cli_distributed_autonomous_db_service => marketplace_publisher/src/oci_cli_administrator_artifact}/generated/__init__.py (92%) create mode 100644 services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/administratorartifact_cli.py rename services/{distributed_database_v26/src/oci_cli_distributed_autonomous_db_service => marketplace_publisher/src/oci_cli_administrator_artifact}/generated/client_mappings.py (53%) create mode 100644 services/marketplace_publisher/src/oci_cli_administrator_publisher/__init__.py create mode 100644 services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/__init__.py create mode 100644 services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/administratorpublisher_cli.py rename services/{distributed_database_v26/src/oci_cli_distributed_db_work_request_service => marketplace_publisher/src/oci_cli_administrator_publisher}/generated/client_mappings.py (53%) create mode 100644 services/marketplace_publisher/src/oci_cli_marketplace_administrator/__init__.py create mode 100644 services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/__init__.py rename services/{distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service => marketplace_publisher/src/oci_cli_marketplace_administrator}/generated/client_mappings.py (52%) create mode 100644 services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/marketplaceadministrator_cli.py create mode 100644 services/marketplace_publisher/src/oci_cli_marketplace_publisher/generated/marketplace_publisher_service_cli.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 88272026b..53e985abb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,82 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__. +3.94.0 - 2026-09-22 +------------------- +Added +~~~~~ +* Support for Crypto Posture Assessment lifecycle, reporting, and analysis operations in Data Safe service. + + * ``oci data-safe crypto-assessment`` + +* Support for Recurrence Maintenance Windows through new ``maintenance-window-schedule`` fields in APM Availability Monitoring service. + + * ``oci apm-synthetics monitor`` + +* Marketplace Publisher + + * Support for Administrator Artifact, Administrator Publisher, Customer Instance Report Export, and Marketplace Administrator operations. + + * ``oci marketplace-publisher administrator-artifact`` + * ``oci marketplace-publisher administrator-publisher`` + * ``oci marketplace-publisher customer-instance-report-export`` + * ``oci marketplace-publisher marketplace-administrator`` + * ``oci marketplace-publisher publisher create`` + * ``oci marketplace-publisher listing-revision update-listing-revision-banner-content`` + + * Support for new optional parameters ``--instance-ocid``, ``--listing-id``, ``--package-version``, ``--realm``, ``--region-parameterconflict``, ``--shape``, ``--status``, ``--tenant-admin-domain``, ``--time-instance-creation-from-date``, ``--time-instance-creation-to-date``, ``--time-instance-termination-from-date`` and ``--time-instance-termination-to-date`` for listing customer instance report records. + + * ``oci marketplace-publisher customer-instance-report-record-collection list-customer-instance-report-records`` + + * Support for new optional parameters for listing revision and listing revision attachment commands. + + * ``oci marketplace-publisher listing-revision create-listing-revision-create-oci-listing-revision-details --demo-url --partner-registration-url --self-paced-training-url --term-id`` + * ``oci marketplace-publisher listing-revision update-listing-revision-update-oci-listing-revision-details --demo-url --partner-registration-url --self-paced-training-url --term-id`` + * ``oci marketplace-publisher listing-revision-attachment create-listing-revision-attachment-create-customer-success-attachment --source-type`` + * ``oci marketplace-publisher listing-revision-attachment create-listing-revision-attachment-create-related-document-attachment-details --is-oracle-users-only --source-type --source-url`` + * ``oci marketplace-publisher listing-revision-attachment create-listing-revision-attachment-create-review-support-document-attachment --source-type`` + * ``oci marketplace-publisher listing-revision-attachment create-listing-revision-attachment-create-screen-shot-attachment-details --source-type`` + * ``oci marketplace-publisher listing-revision-attachment create-listing-revision-attachment-create-supported-service-attachment --source-type`` + +* Functions service + + * Support for source-specific function creation and update commands. + + * ``oci fn function`` + + * Support for Functions Runtime resources. + + * ``oci fn runtime`` + * ``oci fn runtime-version`` + +* Support for Bring Your Own Reservations for several create and update operations via ``capacityReservationIds`` in Data Science service + + * ``oci data-science compute-target`` + * ``oci data-science job`` + * ``oci data-science job-run`` + * ``oci data-science model-deployment`` + * ``oci data-science notebook-session`` + * ``oci data-science project`` + * ``oci data-science work-request`` + +* Support for Routing Profiles and Model Discovery in Generative AI service. + + * ``oci generative-ai routing-profile`` + * ``oci generative-ai routing-profile-collection`` + * ``oci generative-ai model-discovery-collection`` + +Changed +~~~~~~~ +* [BREAKING] CLI group renamed from ``oci distributed-database-v26`` to ``oci distributed-database`` for Globally Distributed Database service + +* ``--credentials`` is now an optional parameter for reactivating a previously deactivated target database in Data Safe service + + * ``oci data-safe target-database activate`` + +* [BREAKING] Removed required parameter ``--date-range`` for listing customer instance report records in Marketplace Publisher service + + * ``oci marketplace-publisher customer-instance-report-record-collection list-customer-instance-report-records`` + 3.93.0 - 2026-09-15 ------------------- Added diff --git a/requirements.txt b/requirements.txt index 265e7f589..faa15b093 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ jmespath>=0.10.0,<=1.0.1 importlib-metadata; python_version < '3.8' ndg-httpsclient==0.4.2 mock==2.0.0 -oci==2.186.0 +oci==2.187.0 packaging==20.2; python_version < '3.7' packaging>=21.0,<25.0; python_version >= '3.7' and python_version < '3.9' packaging>=22.0,<25.0; python_version >= '3.9' diff --git a/services/data_safe/src/oci_cli_data_safe/generated/datasafe_cli.py b/services/data_safe/src/oci_cli_data_safe/generated/datasafe_cli.py index 57ad9a718..0e22c769b 100644 --- a/services/data_safe/src/oci_cli_data_safe/generated/datasafe_cli.py +++ b/services/data_safe/src/oci_cli_data_safe/generated/datasafe_cli.py @@ -558,6 +558,12 @@ def unified_audit_policy_collection_group(): pass +@click.command(cli_util.override('data_safe.crypto_assessment_group.command_name', 'crypto-assessment'), cls=CommandGroupWithAlias, help="""A crypto assessment that provides insight into database cryptographic posture. The assessment evaluates data and network encryption, certificates, key management, backups, and quantum-readiness settings for a target database.""") +@cli_util.help_option_group +def crypto_assessment_group(): + pass + + @click.command(cli_util.override('data_safe.report_summary_group.command_name', 'report-summary'), cls=CommandGroupWithAlias, help="""Description of report.""") @cli_util.help_option_group def report_summary_group(): @@ -659,13 +665,14 @@ def target_alert_policy_association_summary_group(): data_safe_root_group.add_command(security_policy_entry_state_collection_group) data_safe_root_group.add_command(unified_audit_policy_definition_group) data_safe_root_group.add_command(unified_audit_policy_collection_group) +data_safe_root_group.add_command(crypto_assessment_group) data_safe_root_group.add_command(report_summary_group) data_safe_root_group.add_command(target_alert_policy_association_summary_group) @target_database_group.command(name=cli_util.override('data_safe.activate_target_database.command_name', 'activate'), help=u"""Reactivates a previously deactivated Data Safe target database. \n[Command Reference](activateTargetDatabase)""") -@cli_util.option('--credentials', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--target-database-id', required=True, help=u"""The OCID of the Data Safe target database.""") +@cli_util.option('--credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "SUSPENDING", "SUSPENDED"]), 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 ACCEPTED --wait-for-state SUSPENDED 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.""") @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.""") @@ -675,7 +682,7 @@ def target_alert_policy_association_summary_group(): @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'credentials': {'module': 'data_safe', 'class': 'Credentials'}}) @cli_util.wrap_exceptions -def activate_target_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, credentials, target_database_id, if_match): +def activate_target_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, target_database_id, credentials, if_match): if isinstance(target_database_id, six.string_types) and len(target_database_id.strip()) == 0: raise click.UsageError('Parameter --target-database-id cannot be whitespace or empty string') @@ -686,7 +693,9 @@ def activate_target_database(ctx, from_json, wait_for_state, max_wait_seconds, w kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) + + if credentials is not None: + _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) client = cli_util.build_client('data_safe', 'data_safe', ctx) result = client.activate_target_database( @@ -2006,6 +2015,67 @@ def change_audit_profile_compartment(ctx, from_json, wait_for_state, max_wait_se cli_util.render_response(result, ctx) +@crypto_assessment_group.command(name=cli_util.override('data_safe.change_crypto_assessment_compartment.command_name', 'change-compartment'), help=u"""Moves the specified saved crypto assessment into a different compartment. Only `SAVED` crypto assessments are supported. \n[Command Reference](changeCryptoAssessmentCompartment)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment where you want to move the crypto assessment.""") +@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.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "SUSPENDING", "SUSPENDED"]), 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 ACCEPTED --wait-for-state SUSPENDED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def change_crypto_assessment_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, crypto_assessment_id, compartment_id, if_match): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.change_crypto_assessment_compartment( + crypto_assessment_id=crypto_assessment_id, + change_crypto_assessment_compartment_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @data_safe_private_endpoint_group.command(name=cli_util.override('data_safe.change_data_safe_private_endpoint_compartment.command_name', 'change-compartment'), help=u"""Moves the Data Safe private endpoint and its dependent resources to the specified compartment. \n[Command Reference](changeDataSafePrivateEndpointCompartment)""") @cli_util.option('--data-safe-private-endpoint-id', required=True, help=u"""The OCID of the private endpoint.""") @cli_util.option('--compartment-id', help=u"""The OCID of the new compartment.""") @@ -7484,6 +7554,62 @@ def delete_audit_trail(ctx, from_json, wait_for_state, max_wait_seconds, wait_in cli_util.render_response(result, ctx) +@crypto_assessment_group.command(name=cli_util.override('data_safe.delete_crypto_assessment.command_name', 'delete'), help=u"""Deletes the specified saved crypto assessment. Only assessments of type `SAVED` can be deleted. Attempts to delete a `LATEST` assessment return `400 InvalidParameter`. \n[Command Reference](deleteCryptoAssessment)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@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.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "SUSPENDING", "SUSPENDED"]), 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 ACCEPTED --wait-for-state SUSPENDED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_crypto_assessment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, crypto_assessment_id, if_match): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.delete_crypto_assessment( + crypto_assessment_id=crypto_assessment_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + 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) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @data_safe_private_endpoint_group.command(name=cli_util.override('data_safe.delete_data_safe_private_endpoint.command_name', 'delete'), help=u"""Deletes the specified Data Safe private endpoint. \n[Command Reference](deleteDataSafePrivateEndpoint)""") @cli_util.option('--data-safe-private-endpoint-id', required=True, help=u"""The OCID of the private endpoint.""") @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.""") @@ -9259,6 +9385,60 @@ def discover_audit_trails(ctx, from_json, wait_for_state, max_wait_seconds, wait cli_util.render_response(result, ctx) +@crypto_assessment_group.command(name=cli_util.override('data_safe.download_crypto_assessment_report.command_name', 'download-crypto-assessment-report'), help=u"""Downloads the report of the specified crypto assessment. To download the crypto assessment report, it needs to be generated first. Please use GenerateCryptoAssessmentReport to generate a downloadable report in the preferred format (PDF, XLS). \n[Command Reference](downloadCryptoAssessmentReport)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@cli_util.option('--format', required=True, type=custom_types.CliCaseInsensitiveChoice(["PDF", "XLS"]), help=u"""Format of the crypto assessment report.""") +@cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def download_crypto_assessment_report(ctx, from_json, file, crypto_assessment_id, format, if_match): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['format'] = format + + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.download_crypto_assessment_report( + crypto_assessment_id=crypto_assessment_id, + download_crypto_assessment_report_details=_details, + **kwargs + ) + + # If outputting to stdout we don't want to print a progress bar because it will get mixed up with the output + # Also we need a non-zero Content-Length in order to display a meaningful progress bar + bar = None + if hasattr(file, 'name') and file.name != '' and 'Content-Length' in result.headers: + content_length = int(result.headers['Content-Length']) + if content_length > 0: + bar = click.progressbar(length=content_length, label='Downloading file') + + try: + if bar: + bar.__enter__() + + # TODO: Make the download size a configurable option + # use decode_content=True to automatically unzip service responses (this should be overridden for object storage) + for chunk in result.data.raw.stream(cli_constants.MEBIBYTE, decode_content=True): + if bar: + bar.update(len(chunk)) + file.write(chunk) + finally: + if bar: + bar.render_finish() + file.close() + + @sensitive_data_model_group.command(name=cli_util.override('data_safe.download_discovery_report.command_name', 'download-discovery-report'), help=u"""Downloads an already-generated discovery report. Note that the GenerateDiscoveryReportForDownload operation is a prerequisite for the DownloadDiscoveryReport operation. Use GenerateDiscoveryReportForDownload to generate a discovery report file and then use DownloadDiscoveryReport to download the generated file. By default, it downloads report for all the columns in a sensitive data model. Use the discoveryJobId attribute to download report for a specific discovery job. \n[Command Reference](downloadDiscoveryReport)""") @cli_util.option('--sensitive-data-model-id', required=True, help=u"""The OCID of the sensitive data model.""") @cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") @@ -9801,6 +9981,67 @@ def enable_data_safe_configuration(ctx, from_json, wait_for_state, max_wait_seco cli_util.render_response(result, ctx) +@crypto_assessment_group.command(name=cli_util.override('data_safe.generate_crypto_assessment_report.command_name', 'generate-crypto-assessment-report'), help=u"""Generates the report of the specified crypto assessment. Supported output formats are PDF and XLS. \n[Command Reference](generateCryptoAssessmentReport)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@cli_util.option('--format', required=True, type=custom_types.CliCaseInsensitiveChoice(["PDF", "XLS"]), help=u"""Format of the crypto assessment report.""") +@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.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "SUSPENDING", "SUSPENDED"]), 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 ACCEPTED --wait-for-state SUSPENDED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def generate_crypto_assessment_report(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, crypto_assessment_id, format, if_match): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['format'] = format + + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.generate_crypto_assessment_report( + crypto_assessment_id=crypto_assessment_id, + generate_crypto_assessment_report_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @sensitive_data_model_group.command(name=cli_util.override('data_safe.generate_discovery_report_for_download.command_name', 'generate-discovery-report-for-download'), help=u"""Generates a downloadable discovery report. It's a prerequisite for the DownloadDiscoveryReport operation. Use this endpoint to generate a discovery report file and then use DownloadDiscoveryReport to download the generated file. By default, it generates report for all the columns in a sensitive data model. Use the discoveryJobId attribute to generate report for a specific discovery job. \n[Command Reference](generateDiscoveryReportForDownload)""") @cli_util.option('--sensitive-data-model-id', required=True, help=u"""The OCID of the sensitive data model.""") @cli_util.option('--report-format', required=True, type=custom_types.CliCaseInsensitiveChoice(["PDF", "XLS"]), help=u"""Format of the report.""") @@ -10070,7 +10311,7 @@ def generate_masking_report_for_download(ctx, from_json, wait_for_state, max_wai @on_prem_connector_group.command(name=cli_util.override('data_safe.generate_on_prem_connector_configuration.command_name', 'generate-on-prem-connector-configuration'), help=u"""Creates and downloads the configuration of the specified on-premises connector. \n[Command Reference](generateOnPremConnectorConfiguration)""") -@cli_util.option('--password', required=True, help=u"""The password to encrypt the keys inside the wallet included as part of the configuration. The password must be between 12 and 30 characters long and must contain atleast 1 uppercase, 1 lowercase, 1 numeric, and 1 special character.""") +@cli_util.option('--password', required=True, help=u"""The password to encrypt the keys inside the wallet included as part of the configuration. The password must be between 15 and 30 characters long and must contain atleast 1 uppercase, 1 lowercase, 1 numeric, and 1 special character.""") @cli_util.option('--on-prem-connector-id', required=True, help=u"""The OCID of the on-premises connector.""") @cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") @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.""") @@ -10705,6 +10946,62 @@ def get_compatible_formats_for_sensitive_types(ctx, from_json, compartment_id, c cli_util.render_response(result, ctx) +@crypto_assessment_group.command(name=cli_util.override('data_safe.get_crypto_assessment.command_name', 'get'), help=u"""Gets the details of the specified crypto assessment. \n[Command Reference](getCryptoAssessment)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'data_safe', 'class': 'CryptoAssessment'}) +@cli_util.wrap_exceptions +def get_crypto_assessment(ctx, from_json, crypto_assessment_id): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.get_crypto_assessment( + crypto_assessment_id=crypto_assessment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.get_crypto_assessment_sqlnet_parameters.command_name', 'get-crypto-assessment-sqlnet-parameters'), help=u"""Gets SQLNET.ORA parameter values and quantum-readiness evaluation for the specified crypto assessment. \n[Command Reference](getCryptoAssessmentSqlnetParameters)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@cli_util.option('--parameter', help=u"""A filter to return only the SQLNET parameter with the specified name.""") +@cli_util.option('--quantum-readiness', type=custom_types.CliCaseInsensitiveChoice(["RESISTANT", "NOT_RESISTANT", "NOT_AVAILABLE", "NOT_APPLICABLE", "NOT_SUPPORTED"]), help=u"""Filters SQLNET parameters by quantum-readiness category.""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentSqlnetParameters'}) +@cli_util.wrap_exceptions +def get_crypto_assessment_sqlnet_parameters(ctx, from_json, crypto_assessment_id, parameter, quantum_readiness, limit, page): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + if parameter is not None: + kwargs['parameter'] = parameter + if quantum_readiness is not None: + kwargs['quantum_readiness'] = quantum_readiness + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.get_crypto_assessment_sqlnet_parameters( + crypto_assessment_id=crypto_assessment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @data_safe_configuration_group.command(name=cli_util.override('data_safe.get_data_safe_configuration.command_name', 'get'), help=u"""Gets the details of the Data Safe configuration. \n[Command Reference](getDataSafeConfiguration)""") @cli_util.option('--compartment-id', help=u"""A filter to return the Data Safe configuration for the specified tenancy OCID.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -11837,7 +12134,7 @@ def get_work_request(ctx, from_json, work_request_id): @cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") @cli_util.option('--scim-query', help=u"""The scimQuery query parameter accepts filter expressions that use the syntax described in Section 3.2.2.2 of the System for Cross-Domain Identity Management (SCIM) specification, which is available at [RFC3339]. In SCIM filtering expressions, text, date, and time values must be enclosed in quotation marks, with date and time values using ISO-8601 format. (Numeric and boolean values should not be quoted.) -**Example:** | query=(timeCreated ge \"2021-06-04T01:00:26.000Z\") and (targetNames eq \"target_1\") query=(featureDetails.userName eq \"user\") and (targetNames eq \"target_1\") Supported fields: severity status alertType targetIds targetNames operationTime lifecycleState displayName timeCreated timeUpdated featureDetails.* (* can be any field in nestedStrMap in Feature Attributes in Alert Summary. For example - userName,object,clientHostname,osUserName,clientIPs,clientId,commandText,commandParam,clientProgram,objectType,targetOwner)""") +**Example:** | (timeCreated ge \"2021-06-04T01:00:26.000Z\") and (targetNames eq \"target_1\") (featureDetails.userName eq \"user\") and (targetNames eq \"target_1\") Supported fields: severity status alertType targetIds targetNames operationTime lifecycleState displayName timeCreated timeUpdated featureDetails.* (* can be any field in nestedStrMap in Feature Attributes in Alert Summary. For example - userName,object,clientHostname,osUserName,clientIPs,clientId,commandText,commandParam,clientProgram,objectType,targetOwner)""") @cli_util.option('--summary-field', type=custom_types.CliCaseInsensitiveChoice(["alertType", "targetIds", "targetNames", "alertSeverity", "alertStatus", "timeCreated", "policyId", "open", "closed", "critical", "high", "medium", "low", "alertcount", "alertPolicyRuleKey", "alertPolicyRuleName", "throttled"]), multiple=True, help=u"""Specifies a subset of summarized fields to be returned in the response.""") @cli_util.option('--group-by', type=custom_types.CliCaseInsensitiveChoice(["alertType", "targetIds", "targetNames", "alertSeverity", "alertStatus", "timeCreated", "policyId", "alertPolicyRuleKey", "alertPolicyRuleName"]), multiple=True, help=u"""A groupBy can only be used in combination with summaryField parameter. A groupBy value has to be a subset of the values mentioned in summaryField parameter.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @@ -12053,7 +12350,7 @@ def list_alert_policy_rules(ctx, from_json, all_pages, page_size, alert_policy_i @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["displayName", "timeCreated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. If no value is specified timeCreated is default.""") @cli_util.option('--scim-query', help=u"""The scimQuery query parameter accepts filter expressions that use the syntax described in Section 3.2.2.2 of the System for Cross-Domain Identity Management (SCIM) specification, which is available at [RFC3339]. In SCIM filtering expressions, text, date, and time values must be enclosed in quotation marks, with date and time values using ISO-8601 format. (Numeric and boolean values should not be quoted.) -**Example:** | query=(timeCreated ge \"2021-06-04T01:00:26.000Z\") and (targetNames eq \"target_1\") query=(featureDetails.userName eq \"user\") and (targetNames eq \"target_1\") Supported fields: severity status alertType targetIds targetNames operationTime lifecycleState displayName timeCreated timeUpdated featureDetails.* (* can be any field in nestedStrMap in Feature Attributes in Alert Summary. For example - userName,object,clientHostname,osUserName,clientIPs,clientId,commandText,commandParam,clientProgram,objectType,targetOwner)""") +**Example:** | (timeCreated ge \"2021-06-04T01:00:26.000Z\") and (targetNames eq \"target_1\") (featureDetails.userName eq \"user\") and (targetNames eq \"target_1\") Supported fields: severity status alertType targetIds targetNames operationTime lifecycleState displayName timeCreated timeUpdated featureDetails.* (* can be any field in nestedStrMap in Feature Attributes in Alert Summary. For example - userName,object,clientHostname,osUserName,clientIPs,clientId,commandText,commandParam,clientProgram,objectType,targetOwner)""") @cli_util.option('--field', type=custom_types.CliCaseInsensitiveChoice(["id", "displayName", "alertType", "targetIds", "targetNames", "severity", "status", "operationTime", "operation", "operationStatus", "timeCreated", "timeUpdated", "policyId", "lifecycleState"]), multiple=True, help=u"""Specifies a subset of fields to be returned in the response.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @@ -13265,31 +13562,773 @@ def list_columns(ctx, from_json, all_pages, page_size, target_database_id, limit cli_util.render_response(result, ctx) -@data_safe_private_endpoint_group.command(name=cli_util.override('data_safe.list_data_safe_private_endpoints.command_name', 'list'), help=u"""Gets a list of Data Safe private endpoints. \n[Command Reference](listDataSafePrivateEndpoints)""") +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_backup_sets.command_name', 'list-crypto-assessment-backup-sets'), help=u"""Gets backup set summaries across targets in a compartment. Use assessmentId to narrow results to one crypto assessment. \n[Command Reference](listCryptoAssessmentBackupSets)""") @cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") -@cli_util.option('--display-name', help=u"""A filter to return only resources that match the specified display name.""") -@cli_util.option('--vcn-id', help=u"""A filter to return only resources that match the specified VCN OCID.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NA"]), help=u"""A filter to return only resources that match the specified lifecycle state.""") -@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") -@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["TIMECREATED", "DISPLAYNAME"]), help=u"""The field used for sorting. Only one sorting order (sortOrder) can be specified. The default order for TIMECREATED is descending. The default order for DISPLAYNAME is ascending. The DISPLAYNAME sort order is case sensitive.""") @cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") @cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--assessment-id', help=u"""A filter to return only resources associated with the specified crypto assessment OCID.""") +@cli_util.option('--assessment-type', type=custom_types.CliCaseInsensitiveChoice(["LATEST", "SAVED"]), help=u"""A filter to return targets from assessments of the specified type.""") +@cli_util.option('--target-id', help=u"""A filter to return only inventory rows associated with the specified target OCID.""") +@cli_util.option('--target-ids', multiple=True, help=u"""A filter to return only resources associated with any of the specified target OCIDs.""") +@cli_util.option('--backup-set-key', help=u"""Filters backup set summary rows to an exact matching backupSetKey.""") +@cli_util.option('--is-encrypted', type=click.BOOL, help=u"""Filters backup set summary rows by whether the backup set is encrypted.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["setStamp", "backupSetKey", "sizeInGBs", "timeCreated"]), help=u"""The field used to sort backup set results.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'target-ids': {'module': 'data_safe', 'class': 'list[string]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'data_safe', 'class': 'list[DataSafePrivateEndpointSummary]'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'target-ids': {'module': 'data_safe', 'class': 'list[string]'}}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentBackupSetCollection'}) @cli_util.wrap_exceptions -def list_data_safe_private_endpoints(ctx, from_json, all_pages, page_size, compartment_id, display_name, vcn_id, lifecycle_state, limit, page, sort_order, sort_by, compartment_id_in_subtree, access_level): +def list_crypto_assessment_backup_sets(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, access_level, assessment_id, assessment_type, target_id, target_ids, backup_set_key, is_encrypted, sort_by, sort_order, limit, page): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') kwargs = {} - if display_name is not None: + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree + if access_level is not None: + kwargs['access_level'] = access_level + if assessment_id is not None: + kwargs['assessment_id'] = assessment_id + if assessment_type is not None: + kwargs['assessment_type'] = assessment_type + if target_id is not None: + kwargs['target_id'] = target_id + if target_ids is not None and len(target_ids) > 0: + kwargs['target_ids'] = target_ids + if backup_set_key is not None: + kwargs['backup_set_key'] = backup_set_key + if is_encrypted is not None: + kwargs['is_encrypted'] = is_encrypted + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessment_backup_sets, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessment_backup_sets, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_crypto_assessment_backup_sets( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_cbom_items.command_name', 'list-crypto-assessment-cbom-items'), help=u"""Lists the CBOM items for the specified crypto assessment. \n[Command Reference](listCryptoAssessmentCbomItems)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentCbomItemCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessment_cbom_items(ctx, from_json, all_pages, crypto_assessment_id): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.list_crypto_assessment_cbom_items( + crypto_assessment_id=crypto_assessment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_certificates.command_name', 'list-crypto-assessment-certificates'), help=u"""Lists certificates discovered across targets in a compartment, including target, wallet location, issuer, subject, validity window, expiry bucket, public key type, and status so expiring or weak certificates can be identified and prioritized. \n[Command Reference](listCryptoAssessmentCertificates)""") +@cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") +@cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--assessment-id', help=u"""A filter to return only resources associated with the specified crypto assessment OCID.""") +@cli_util.option('--assessment-type', type=custom_types.CliCaseInsensitiveChoice(["LATEST", "SAVED"]), help=u"""A filter to return targets from assessments of the specified type.""") +@cli_util.option('--target-id', help=u"""A filter to return only inventory rows associated with the specified target OCID.""") +@cli_util.option('--target-ids', multiple=True, help=u"""A filter to return only resources associated with any of the specified target OCIDs.""") +@cli_util.option('--certificate-type', type=custom_types.CliCaseInsensitiveChoice(["SERVER", "USER", "TRUSTED"]), multiple=True, help=u"""A filter to return only certificates of any of the specified types.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["VALID", "EXPIRING_SOON", "EXPIRED", "INVALID", "IN_USE"]), multiple=True, help=u"""A filter to return only certificates with any of the specified statuses.""") +@cli_util.option('--public-key-type', multiple=True, help=u"""A filter to return only certificates with any of the specified public key types. Stored values are normalized forms such as RSA2048, RSA4096, or EC256.""") +@cli_util.option('--signature-algorithm', multiple=True, help=u"""A filter to return only certificates whose signature algorithm contains any of the specified values. For example, use SHA1 to match SHA1-based certificate signatures.""") +@cli_util.option('--expiry-bucket', help=u"""A filter to return only certificates in the specified expiry bucket. Supported values are 0_15, 15_30, 30_60, 60_90, and 90_PLUS.""") +@cli_util.option('--days-to-expiry', type=click.INT, help=u"""A filter to return certificates whose validTill timestamp is on or before the current time plus the specified number of days. Negative values are allowed and filter certificates that expired on or before that many days ago.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeValidUntil", "subject"]), help=u"""The field used to sort certificate results.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({'target-ids': {'module': 'data_safe', 'class': 'list[string]'}, 'public-key-type': {'module': 'data_safe', 'class': 'list[string]'}, 'signature-algorithm': {'module': 'data_safe', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'target-ids': {'module': 'data_safe', 'class': 'list[string]'}, 'public-key-type': {'module': 'data_safe', 'class': 'list[string]'}, 'signature-algorithm': {'module': 'data_safe', 'class': 'list[string]'}}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentCertificateCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessment_certificates(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, access_level, assessment_id, assessment_type, target_id, target_ids, certificate_type, status, public_key_type, signature_algorithm, expiry_bucket, days_to_expiry, sort_by, sort_order, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree + if access_level is not None: + kwargs['access_level'] = access_level + if assessment_id is not None: + kwargs['assessment_id'] = assessment_id + if assessment_type is not None: + kwargs['assessment_type'] = assessment_type + if target_id is not None: + kwargs['target_id'] = target_id + if target_ids is not None and len(target_ids) > 0: + kwargs['target_ids'] = target_ids + if certificate_type is not None and len(certificate_type) > 0: + kwargs['certificate_type'] = certificate_type + if status is not None and len(status) > 0: + kwargs['status'] = status + if public_key_type is not None and len(public_key_type) > 0: + kwargs['public_key_type'] = public_key_type + if signature_algorithm is not None and len(signature_algorithm) > 0: + kwargs['signature_algorithm'] = signature_algorithm + if expiry_bucket is not None: + kwargs['expiry_bucket'] = expiry_bucket + if days_to_expiry is not None: + kwargs['days_to_expiry'] = days_to_expiry + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessment_certificates, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessment_certificates, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_crypto_assessment_certificates( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_finding_analytics.command_name', 'list-crypto-assessment-finding-analytics'), help=u"""Lists findings in a compartment with the number of affected targets. \n[Command Reference](listCryptoAssessmentFindingAnalytics)""") +@cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") +@cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--category', type=custom_types.CliCaseInsensitiveChoice(["NETWORK_ENCRYPTION", "DATA_ENCRYPTION", "CERTIFICATES_AND_KEY_MANAGEMENT", "BACKUP_AND_EXPORT_ENCRYPTION", "POST_QUANTUM_READINESS", "NOT_SUPPORTED"]), help=u"""A filter to return only findings in the specified category key.""") +@cli_util.option('--finding-key', multiple=True, help=u"""A filter to return only findings with any of the specified finding keys.""") +@cli_util.option('--is-quantum-readiness-check', type=click.BOOL, help=u"""A filter to return only findings that are or are not part of quantum-readiness checks.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["targetCount", "priority"]), help=u"""The field used to sort finding analytics results.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({'finding-key': {'module': 'data_safe', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'finding-key': {'module': 'data_safe', 'class': 'list[string]'}}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentFindingAnalyticsCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessment_finding_analytics(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, access_level, category, finding_key, is_quantum_readiness_check, sort_by, sort_order, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree + if access_level is not None: + kwargs['access_level'] = access_level + if category is not None: + kwargs['category'] = category + if finding_key is not None and len(finding_key) > 0: + kwargs['finding_key'] = finding_key + if is_quantum_readiness_check is not None: + kwargs['is_quantum_readiness_check'] = is_quantum_readiness_check + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessment_finding_analytics, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessment_finding_analytics, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_crypto_assessment_finding_analytics( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_finding_targets.command_name', 'list-crypto-assessment-finding-targets'), help=u"""For a selected finding, lists targets where it occurs in assessments. \n[Command Reference](listCryptoAssessmentFindingTargets)""") +@cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") +@cli_util.option('--finding-key', required=True, multiple=True, help=u"""The finding keys for which target occurrences are listed.""") +@cli_util.option('--assessment-type', type=custom_types.CliCaseInsensitiveChoice(["LATEST", "SAVED"]), help=u"""A filter to return targets from assessments of the specified type.""") +@cli_util.option('--target-id', help=u"""Filters results to targets with an exact matching target OCID.""") +@cli_util.option('--target-ids', multiple=True, help=u"""A filter to return only resources associated with any of the specified target OCIDs.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["PASS", "FAIL", "ERROR", "EVALUATE", "NOT_AVAILABLE", "NOT_APPLICABLE", "NOT_SUPPORTED"]), help=u"""A filter to return only finding target rows with the specified status.""") +@cli_util.option('--is-quantum-readiness-check', type=click.BOOL, help=u"""A filter to return only findings that are or are not part of quantum-readiness checks.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["targetId", "databaseVersion"]), help=u"""The field used to sort finding target results.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") +@cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({'finding-key': {'module': 'data_safe', 'class': 'list[string]'}, 'target-ids': {'module': 'data_safe', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'finding-key': {'module': 'data_safe', 'class': 'list[string]'}, 'target-ids': {'module': 'data_safe', 'class': 'list[string]'}}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentFindingTargetCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessment_finding_targets(ctx, from_json, all_pages, page_size, compartment_id, finding_key, assessment_type, target_id, target_ids, status, is_quantum_readiness_check, sort_by, sort_order, compartment_id_in_subtree, access_level, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if assessment_type is not None: + kwargs['assessment_type'] = assessment_type + if target_id is not None: + kwargs['target_id'] = target_id + if target_ids is not None and len(target_ids) > 0: + kwargs['target_ids'] = target_ids + if status is not None: + kwargs['status'] = status + if is_quantum_readiness_check is not None: + kwargs['is_quantum_readiness_check'] = is_quantum_readiness_check + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree + if access_level is not None: + kwargs['access_level'] = access_level + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessment_finding_targets, + compartment_id=compartment_id, + finding_key=finding_key, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessment_finding_targets, + limit, + page_size, + compartment_id=compartment_id, + finding_key=finding_key, + **kwargs + ) + else: + result = client.list_crypto_assessment_finding_targets( + compartment_id=compartment_id, + finding_key=finding_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_findings.command_name', 'list-crypto-assessment-findings'), help=u"""Lists crypto deviation findings for the specified crypto assessment. \n[Command Reference](listCryptoAssessmentFindings)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@cli_util.option('--finding-key', help=u"""A filter to return only findings with the specified finding key.""") +@cli_util.option('--title', help=u"""A filter to return only findings with the specified title.""") +@cli_util.option('--category', type=custom_types.CliCaseInsensitiveChoice(["NETWORK_ENCRYPTION", "DATA_ENCRYPTION", "CERTIFICATES_AND_KEY_MANAGEMENT", "BACKUP_AND_EXPORT_ENCRYPTION", "POST_QUANTUM_READINESS", "NOT_SUPPORTED"]), help=u"""A filter to return only findings in the specified category key.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["PASS", "FAIL", "ERROR", "EVALUATE", "NOT_AVAILABLE", "NOT_APPLICABLE", "NOT_SUPPORTED"]), help=u"""A filter to return only findings with the specified status.""") +@cli_util.option('--is-quantum-readiness-check', type=click.BOOL, help=u"""A filter to return only findings that are or are not part of quantum-readiness checks.""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentFindingCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessment_findings(ctx, from_json, all_pages, page_size, crypto_assessment_id, finding_key, title, category, status, is_quantum_readiness_check, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + if finding_key is not None: + kwargs['finding_key'] = finding_key + if title is not None: + kwargs['title'] = title + if category is not None: + kwargs['category'] = category + if status is not None: + kwargs['status'] = status + if is_quantum_readiness_check is not None: + kwargs['is_quantum_readiness_check'] = is_quantum_readiness_check + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessment_findings, + crypto_assessment_id=crypto_assessment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessment_findings, + limit, + page_size, + crypto_assessment_id=crypto_assessment_id, + **kwargs + ) + else: + result = client.list_crypto_assessment_findings( + crypto_assessment_id=crypto_assessment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_keys.command_name', 'list-crypto-assessment-keys'), help=u"""Gets a paginated list of cryptographic keys across targets in a compartment. Use assessmentId to narrow results to one crypto assessment. \n[Command Reference](listCryptoAssessmentKeys)""") +@cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") +@cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--assessment-id', help=u"""A filter to return only resources associated with the specified crypto assessment OCID.""") +@cli_util.option('--assessment-type', type=custom_types.CliCaseInsensitiveChoice(["LATEST", "SAVED"]), help=u"""A filter to return targets from assessments of the specified type.""") +@cli_util.option('--target-id', help=u"""A filter to return only inventory rows associated with the specified target OCID.""") +@cli_util.option('--target-ids', multiple=True, help=u"""A filter to return only resources associated with any of the specified target OCIDs.""") +@cli_util.option('--feature', type=custom_types.CliCaseInsensitiveChoice(["TDE", "TLS", "NNE"]), help=u"""A filter to return only records for the specified feature.""") +@cli_util.option('--key-id', help=u"""Filters key results to rows with an exact matching keyId.""") +@cli_util.option('--key-type', type=custom_types.CliCaseInsensitiveChoice(["MASTER_KEY", "ENCRYPTION_KEY"]), help=u"""Filters key results to rows with the specified key type.""") +@cli_util.option('--key-manager-type', type=custom_types.CliCaseInsensitiveChoice(["FILE", "OKV", "HSM", "NOT_CONFIGURED", "NOT_APPLICABLE", "NOT_AVAILABLE", "UNKNOWN", "NOT_SUPPORTED"]), multiple=True, help=u"""Filters key results to rows whose primary or secondary keystore type matches any of the specified key manager types.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated"]), help=u"""The field used to sort key results.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({'target-ids': {'module': 'data_safe', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'target-ids': {'module': 'data_safe', 'class': 'list[string]'}}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentKeyCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessment_keys(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, access_level, assessment_id, assessment_type, target_id, target_ids, feature, key_id, key_type, key_manager_type, sort_by, sort_order, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree + if access_level is not None: + kwargs['access_level'] = access_level + if assessment_id is not None: + kwargs['assessment_id'] = assessment_id + if assessment_type is not None: + kwargs['assessment_type'] = assessment_type + if target_id is not None: + kwargs['target_id'] = target_id + if target_ids is not None and len(target_ids) > 0: + kwargs['target_ids'] = target_ids + if feature is not None: + kwargs['feature'] = feature + if key_id is not None: + kwargs['key_id'] = key_id + if key_type is not None: + kwargs['key_type'] = key_type + if key_manager_type is not None and len(key_manager_type) > 0: + kwargs['key_manager_type'] = key_manager_type + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessment_keys, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessment_keys, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_crypto_assessment_keys( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_tde_objects.command_name', 'list-crypto-assessment-tde-objects'), help=u"""Lists TDE object encryption summaries across targets in a compartment. Use assessmentId to narrow results to one crypto assessment, and objectType to return either tablespace-level or column-level TDE observations. \n[Command Reference](listCryptoAssessmentTdeObjects)""") +@cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") +@cli_util.option('--object-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["TABLESPACE", "COLUMN"]), help=u"""A required filter to return only TDE objects of the specified type.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") +@cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--assessment-id', help=u"""A filter to return only resources associated with the specified crypto assessment OCID.""") +@cli_util.option('--assessment-type', type=custom_types.CliCaseInsensitiveChoice(["LATEST", "SAVED"]), help=u"""A filter to return targets from assessments of the specified type.""") +@cli_util.option('--target-id', help=u"""A filter to return only inventory rows associated with the specified target OCID.""") +@cli_util.option('--target-ids', multiple=True, help=u"""A filter to return only resources associated with any of the specified target OCIDs.""") +@cli_util.option('--quantum-readiness', type=custom_types.CliCaseInsensitiveChoice(["RESISTANT", "NOT_RESISTANT", "NOT_AVAILABLE", "NOT_APPLICABLE", "NOT_SUPPORTED"]), help=u"""Filters TDE object summary rows by quantum-readiness category.""") +@cli_util.option('--encryption-observed', multiple=True, help=u"""Filters TDE object summary rows by any of the specified observed encryption algorithms.""") +@cli_util.option('--encryption-status', type=custom_types.CliCaseInsensitiveChoice(["ENCRYPTED", "UNENCRYPTED", "NOT_SUPPORTED"]), help=u"""Filters TDE object summary rows by derived encryption status. NOT_SUPPORTED maps to rows where encryptionObserved is NOT_SUPPORTED, UNENCRYPTED maps to rows where encryptionObserved is null or NONE, and ENCRYPTED maps to rows where the observed encryption algorithm is any other value.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["tablespaceName", "columnName", "quantumReadiness"]), help=u"""The field used to sort TDE object summary results.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({'target-ids': {'module': 'data_safe', 'class': 'list[string]'}, 'encryption-observed': {'module': 'data_safe', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'target-ids': {'module': 'data_safe', 'class': 'list[string]'}, 'encryption-observed': {'module': 'data_safe', 'class': 'list[string]'}}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentTdeObjectCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessment_tde_objects(ctx, from_json, all_pages, page_size, compartment_id, object_type, compartment_id_in_subtree, access_level, assessment_id, assessment_type, target_id, target_ids, quantum_readiness, encryption_observed, encryption_status, sort_by, sort_order, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree + if access_level is not None: + kwargs['access_level'] = access_level + if assessment_id is not None: + kwargs['assessment_id'] = assessment_id + if assessment_type is not None: + kwargs['assessment_type'] = assessment_type + if target_id is not None: + kwargs['target_id'] = target_id + if target_ids is not None and len(target_ids) > 0: + kwargs['target_ids'] = target_ids + if quantum_readiness is not None: + kwargs['quantum_readiness'] = quantum_readiness + if encryption_observed is not None and len(encryption_observed) > 0: + kwargs['encryption_observed'] = encryption_observed + if encryption_status is not None: + kwargs['encryption_status'] = encryption_status + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessment_tde_objects, + compartment_id=compartment_id, + object_type=object_type, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessment_tde_objects, + limit, + page_size, + compartment_id=compartment_id, + object_type=object_type, + **kwargs + ) + else: + result = client.list_crypto_assessment_tde_objects( + compartment_id=compartment_id, + object_type=object_type, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessment_wallets.command_name', 'list-crypto-assessment-wallets'), help=u"""Gets wallet details across targets in a compartment. Use assessmentId to narrow results to one crypto assessment. \n[Command Reference](listCryptoAssessmentWallets)""") +@cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") +@cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--assessment-id', help=u"""A filter to return only resources associated with the specified crypto assessment OCID.""") +@cli_util.option('--assessment-type', type=custom_types.CliCaseInsensitiveChoice(["LATEST", "SAVED"]), help=u"""A filter to return targets from assessments of the specified type.""") +@cli_util.option('--target-id', help=u"""A filter to return only inventory rows associated with the specified target OCID.""") +@cli_util.option('--target-ids', multiple=True, help=u"""A filter to return only resources associated with any of the specified target OCIDs.""") +@cli_util.option('--feature', type=custom_types.CliCaseInsensitiveChoice(["TDE", "TLS", "NNE", "ZDLRA"]), help=u"""A filter to return only wallets for the specified feature.""") +@cli_util.option('--wallet-encryption-algorithm', multiple=True, help=u"""A filter to return only wallets whose encryption algorithm exactly matches any of the specified values, case-insensitively.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["feature", "timeCreated"]), help=u"""The field used to sort wallet results.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({'target-ids': {'module': 'data_safe', 'class': 'list[string]'}, 'wallet-encryption-algorithm': {'module': 'data_safe', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'target-ids': {'module': 'data_safe', 'class': 'list[string]'}, 'wallet-encryption-algorithm': {'module': 'data_safe', 'class': 'list[string]'}}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentWalletCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessment_wallets(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, access_level, assessment_id, assessment_type, target_id, target_ids, feature, wallet_encryption_algorithm, sort_by, sort_order, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree + if access_level is not None: + kwargs['access_level'] = access_level + if assessment_id is not None: + kwargs['assessment_id'] = assessment_id + if assessment_type is not None: + kwargs['assessment_type'] = assessment_type + if target_id is not None: + kwargs['target_id'] = target_id + if target_ids is not None and len(target_ids) > 0: + kwargs['target_ids'] = target_ids + if feature is not None: + kwargs['feature'] = feature + if wallet_encryption_algorithm is not None and len(wallet_encryption_algorithm) > 0: + kwargs['wallet_encryption_algorithm'] = wallet_encryption_algorithm + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessment_wallets, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessment_wallets, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_crypto_assessment_wallets( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@crypto_assessment_group.command(name=cli_util.override('data_safe.list_crypto_assessments.command_name', 'list'), help=u"""Gets a list of crypto assessments with filtering and pagination support. \n[Command Reference](listCryptoAssessments)""") +@cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") +@cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the specified display name.""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["LATEST", "SAVED"]), help=u"""A filter to return only crypto assessments that match the specified type.""") +@cli_util.option('--assessment-id', help=u"""A filter to return only resources associated with the specified crypto assessment OCID.""") +@cli_util.option('--target-id', help=u"""A filter to return only crypto assessments associated with the specified target OCID. When provided, targetType must also be specified.""") +@cli_util.option('--target-ids', multiple=True, help=u"""A filter to return only resources associated with any of the specified target OCIDs.""") +@cli_util.option('--target-database-group-id', help=u"""A filter to return the target database group that matches the specified OCID.""") +@cli_util.option('--target-type', type=custom_types.CliCaseInsensitiveChoice(["TARGET_DATABASE", "TARGET_DATABASE_GROUP"]), help=u"""A filter to return crypto assessments belonging to the specified target type. `ListCryptoAssessments` returns assessment rows; use `targetDatabaseGroupId` to list the underlying target database assessments for a group.""") +@cli_util.option('--posture-category', type=custom_types.CliCaseInsensitiveChoice(["QUANTUM_RESISTANT", "QUANTUM_CAPABLE", "UPGRADE_RECOMMENDED"]), multiple=True, help=u"""A filter to return only crypto assessments that match any of the specified posture categories.""") +@cli_util.option('--is-assessment-scheduled', type=click.BOOL, help=u"""A filter to return only crypto assessments whose scheduled execution state matches the specified value.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only resources that match the specified lifecycle state.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["issueCount", "timeCreated", "timeUpdated"]), help=u"""The field used to sort crypto assessments. You can specify only one sort order (sortOrder).""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({'target-ids': {'module': 'data_safe', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'target-ids': {'module': 'data_safe', 'class': 'list[string]'}}, output_type={'module': 'data_safe', 'class': 'CryptoAssessmentCollection'}) +@cli_util.wrap_exceptions +def list_crypto_assessments(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, access_level, display_name, type, assessment_id, target_id, target_ids, target_database_group_id, target_type, posture_category, is_assessment_scheduled, lifecycle_state, sort_by, sort_order, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree + if access_level is not None: + kwargs['access_level'] = access_level + if display_name is not None: + kwargs['display_name'] = display_name + if type is not None: + kwargs['type'] = type + if assessment_id is not None: + kwargs['assessment_id'] = assessment_id + if target_id is not None: + kwargs['target_id'] = target_id + if target_ids is not None and len(target_ids) > 0: + kwargs['target_ids'] = target_ids + if target_database_group_id is not None: + kwargs['target_database_group_id'] = target_database_group_id + if target_type is not None: + kwargs['target_type'] = target_type + if posture_category is not None and len(posture_category) > 0: + kwargs['posture_category'] = posture_category + if is_assessment_scheduled is not None: + kwargs['is_assessment_scheduled'] = is_assessment_scheduled + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('data_safe', 'data_safe', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_crypto_assessments, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_crypto_assessments, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_crypto_assessments( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@data_safe_private_endpoint_group.command(name=cli_util.override('data_safe.list_data_safe_private_endpoints.command_name', 'list'), help=u"""Gets a list of Data Safe private endpoints. \n[Command Reference](listDataSafePrivateEndpoints)""") +@cli_util.option('--compartment-id', required=True, help=u"""A filter to return only resources that match the specified compartment OCID.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the specified display name.""") +@cli_util.option('--vcn-id', help=u"""A filter to return only resources that match the specified VCN OCID.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NA"]), help=u"""A filter to return only resources that match the specified lifecycle state.""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of items to return per page in a paginated \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The page token representing the page at which to start retrieving results. It is usually retrieved from a previous \"List\" call. For details about how pagination works, see [List Pagination].""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["TIMECREATED", "DISPLAYNAME"]), help=u"""The field used for sorting. Only one sorting order (sortOrder) can be specified. The default order for TIMECREATED is descending. The default order for DISPLAYNAME is ascending. The DISPLAYNAME sort order is case sensitive.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.""") +@cli_util.option('--access-level', type=custom_types.CliCaseInsensitiveChoice(["RESTRICTED", "ACCESSIBLE"]), help=u"""Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). When set to RESTRICTED permissions are checked and no partial results are displayed.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'data_safe', 'class': 'list[DataSafePrivateEndpointSummary]'}) +@cli_util.wrap_exceptions +def list_data_safe_private_endpoints(ctx, from_json, all_pages, page_size, compartment_id, display_name, vcn_id, lifecycle_state, limit, page, sort_order, sort_by, compartment_id_in_subtree, access_level): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if display_name is not None: kwargs['display_name'] = display_name if vcn_id is not None: kwargs['vcn_id'] = vcn_id @@ -15605,9 +16644,9 @@ def list_referential_relations(ctx, from_json, all_pages, page_size, sensitive_d @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC).""") @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["TIMECREATED", "DISPLAYNAME", "DISPLAYORDER"]), help=u"""The field used for sorting. Only one sorting parameter order (sortOrder) can be specified. The default order for TIMECREATED is descending. The default order for DISPLAYNAME is ascending. The DISPLAYNAME sort order is case sensitive.""") @cli_util.option('--is-seeded', type=click.BOOL, help=u"""A boolean flag indicating to list seeded report definitions. Set this parameter to get list of seeded report definitions.""") -@cli_util.option('--data-source', type=custom_types.CliCaseInsensitiveChoice(["EVENTS", "ALERTS", "SECURITY_ASSESSMENT", "VIOLATIONS", "ALLOWED_SQL"]), help=u"""Specifies the name of a resource that provides data for the report. For example alerts, events.""") +@cli_util.option('--data-source', type=custom_types.CliCaseInsensitiveChoice(["EVENTS", "ALERTS", "SECURITY_ASSESSMENT", "CRYPTO_ASSESSMENT", "VIOLATIONS", "ALLOWED_SQL"]), help=u"""Specifies the name of a resource that provides data for the report. For example alerts, events.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""An optional filter to return only resources that match the specified lifecycle state.""") -@cli_util.option('--category', type=custom_types.CliCaseInsensitiveChoice(["CUSTOM_REPORTS", "SUMMARY", "ACTIVITY_AUDITING"]), help=u"""An optional filter to return only resources that match the specified category.""") +@cli_util.option('--category', type=custom_types.CliCaseInsensitiveChoice(["CUSTOM_REPORTS", "SUMMARY", "ACTIVITY_AUDITING", "CRYPTO_ASSESSMENT"]), help=u"""An optional filter to return only resources that match the specified category.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -15689,7 +16728,7 @@ def list_report_definitions(ctx, from_json, all_pages, page_size, compartment_id **Example:** 2016-12-19T16:39:57.600Z""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["UPDATING", "ACTIVE", "CREATING", "FAILED"]), help=u"""An optional filter to return only resources that match the specified lifecycle state.""") @cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["GENERATED", "SCHEDULED"]), help=u"""An optional filter to return only resources that match the specified type.""") -@cli_util.option('--data-source', type=custom_types.CliCaseInsensitiveChoice(["EVENTS", "ALERTS", "SECURITY_ASSESSMENT", "VIOLATIONS", "ALLOWED_SQL"]), help=u"""Specifies the name of a resource that provides data for the report. For example alerts, events.""") +@cli_util.option('--data-source', type=custom_types.CliCaseInsensitiveChoice(["EVENTS", "ALERTS", "SECURITY_ASSESSMENT", "CRYPTO_ASSESSMENT", "VIOLATIONS", "ALLOWED_SQL"]), help=u"""Specifies the name of a resource that provides data for the report. For example alerts, events.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -20344,6 +21383,87 @@ def purge_sql_collection_logs(ctx, from_json, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) +@crypto_assessment_group.command(name=cli_util.override('data_safe.refresh_crypto_assessment.command_name', 'refresh'), help=u"""Runs a crypto assessment, refreshes the latest assessment, and saves it for future reference. This operation runs with a cryptoAssessmentId of type LATEST. Before you start, first call the ListCryptoAssessments operation with filter \"type = latest\" to get the crypto assessment ID for the target's latest assessment. \n[Command Reference](refreshCryptoAssessment)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@cli_util.option('--compartment-id', help=u"""This field is ignored when refreshing a crypto assessment.""") +@cli_util.option('--display-name', help=u"""The display name of the crypto assessment.""") +@cli_util.option('--description', help=u"""The description of the crypto assessment.""") +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags] + +Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) +@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.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "SUSPENDING", "SUSPENDED"]), 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 ACCEPTED --wait-for-state SUSPENDED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'data_safe', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_safe', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'data_safe', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_safe', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def refresh_crypto_assessment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, crypto_assessment_id, compartment_id, display_name, description, freeform_tags, defined_tags, if_match): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if compartment_id is not None: + _details['compartmentId'] = compartment_id + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.refresh_crypto_assessment( + crypto_assessment_id=crypto_assessment_id, + run_crypto_assessment_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @database_security_config_group.command(name=cli_util.override('data_safe.refresh_database_security_configuration.command_name', 'refresh'), help=u"""Refreshes the specified database security configuration. \n[Command Reference](refreshDatabaseSecurityConfiguration)""") @cli_util.option('--database-security-config-id', required=True, help=u"""The OCID of the database security configuration resource.""") @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.""") @@ -20401,7 +21521,7 @@ def refresh_database_security_configuration(ctx, from_json, wait_for_state, max_ @security_assessment_group.command(name=cli_util.override('data_safe.refresh_security_assessment.command_name', 'refresh'), help=u"""Runs a security assessment, refreshes the latest assessment, and saves it for future reference. The assessment runs with a securityAssessmentId of type LATEST. Before you start, first call the ListSecurityAssessments operation with filter \"type = latest\" to get the security assessment id for the target's latest assessment. \n[Command Reference](refreshSecurityAssessment)""") @cli_util.option('--security-assessment-id', required=True, help=u"""The OCID of the security assessment.""") -@cli_util.option('--compartment-id', help=u"""The OCID of the compartment that contains the security assessment.""") +@cli_util.option('--compartment-id', help=u"""This field is ignored when refreshing a security assessment.""") @cli_util.option('--display-name', help=u"""The display name of the security assessment.""") @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags] @@ -20643,7 +21763,7 @@ def refresh_target_database(ctx, from_json, wait_for_state, max_wait_seconds, wa @user_assessment_group.command(name=cli_util.override('data_safe.refresh_user_assessment.command_name', 'refresh'), help=u"""Refreshes the latest assessment and saves it for future reference. This operation runs with a userAssessmentId of type LATEST. Before you start, first call the ListUserAssessments operation with filter \"type = latest\" to get the user assessment ID for the target's latest assessment. \n[Command Reference](refreshUserAssessment)""") @cli_util.option('--user-assessment-id', required=True, help=u"""The OCID of the user assessment.""") -@cli_util.option('--compartment-id', help=u"""The OCID of the compartment that contains the user assessment.""") +@cli_util.option('--compartment-id', help=u"""This field is ignored when refreshing a user assessment.""") @cli_util.option('--description', help=u"""The description of the user assessment.""") @cli_util.option('--display-name', help=u"""The display name of the user assessment.""") @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags] @@ -22309,6 +23429,96 @@ def update_audit_trail(ctx, from_json, force, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) +@crypto_assessment_group.command(name=cli_util.override('data_safe.update_crypto_assessment.command_name', 'update'), help=u"""Updates one or more attributes of the specified crypto assessment. \n[Command Reference](updateCryptoAssessment)""") +@cli_util.option('--crypto-assessment-id', required=True, help=u"""The OCID of the crypto assessment.""") +@cli_util.option('--display-name', help=u"""The display name of the crypto assessment.""") +@cli_util.option('--schedule', help=u"""Updates the schedule associated with this latest crypto assessment. The schedule uses the format: ; + +For v1, the version-specific schedule format is: + +Specify either day-of-week for weekly schedules or day-of-month for monthly schedules. Do not specify both. For monthly schedules, day-of-month must be between 1 and 28. If the service generates a default monthly schedule for an assessment created on day 29, 30, or 31 of a month, it uses day 28. Schedule updates are supported only for assessments of type LATEST.""") +@cli_util.option('--is-assessment-scheduled', type=click.BOOL, help=u"""Indicates whether scheduled execution is active for this latest crypto assessment. When set to true, the existing schedule is used unless a new schedule is provided. When set to false, the schedule value is retained but scheduled execution is paused. Schedule state updates are supported only for assessments of type LATEST.""") +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags] + +Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) +@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.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "SUSPENDING", "SUSPENDED"]), 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 ACCEPTED --wait-for-state SUSPENDED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'data_safe', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_safe', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'data_safe', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_safe', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_crypto_assessment(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, crypto_assessment_id, display_name, schedule, is_assessment_scheduled, freeform_tags, defined_tags, if_match): + + if isinstance(crypto_assessment_id, six.string_types) and len(crypto_assessment_id.strip()) == 0: + raise click.UsageError('Parameter --crypto-assessment-id cannot be whitespace or empty string') + if not force: + if freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if display_name is not None: + _details['displayName'] = display_name + + if schedule is not None: + _details['schedule'] = schedule + + if is_assessment_scheduled is not None: + _details['isAssessmentScheduled'] = is_assessment_scheduled + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + client = cli_util.build_client('data_safe', 'data_safe', ctx) + result = client.update_crypto_assessment( + crypto_assessment_id=crypto_assessment_id, + update_crypto_assessment_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @data_safe_private_endpoint_group.command(name=cli_util.override('data_safe.update_data_safe_private_endpoint.command_name', 'update'), help=u"""Updates one or more attributes of the specified Data Safe private endpoint. \n[Command Reference](updateDataSafePrivateEndpoint)""") @cli_util.option('--data-safe-private-endpoint-id', required=True, help=u"""The OCID of the private endpoint.""") @cli_util.option('--display-name', help=u"""The display name of the private endpoint.""") diff --git a/services/data_safe/tests/util/generated/command_to_api.py b/services/data_safe/tests/util/generated/command_to_api.py index ce7909b81..3b03b75f0 100644 --- a/services/data_safe/tests/util/generated/command_to_api.py +++ b/services/data_safe/tests/util/generated/command_to_api.py @@ -21,6 +21,7 @@ "data_safe.change_audit_archive_retrieval_compartment": "oci.data_safe.DataSafeClient.change_audit_archive_retrieval_compartment", "data_safe.change_audit_policy_compartment": "oci.data_safe.DataSafeClient.change_audit_policy_compartment", "data_safe.change_audit_profile_compartment": "oci.data_safe.DataSafeClient.change_audit_profile_compartment", + "data_safe.change_crypto_assessment_compartment": "oci.data_safe.DataSafeClient.change_crypto_assessment_compartment", "data_safe.change_data_safe_private_endpoint_compartment": "oci.data_safe.DataSafeClient.change_data_safe_private_endpoint_compartment", "data_safe.change_database_security_config_compartment": "oci.data_safe.DataSafeClient.change_database_security_config_compartment", "data_safe.change_discovery_job_compartment": "oci.data_safe.DataSafeClient.change_discovery_job_compartment", @@ -88,6 +89,7 @@ "data_safe.delete_audit_archive_retrieval": "oci.data_safe.DataSafeClient.delete_audit_archive_retrieval", "data_safe.delete_audit_profile": "oci.data_safe.DataSafeClient.delete_audit_profile", "data_safe.delete_audit_trail": "oci.data_safe.DataSafeClient.delete_audit_trail", + "data_safe.delete_crypto_assessment": "oci.data_safe.DataSafeClient.delete_crypto_assessment", "data_safe.delete_data_safe_private_endpoint": "oci.data_safe.DataSafeClient.delete_data_safe_private_endpoint", "data_safe.delete_discovery_job": "oci.data_safe.DataSafeClient.delete_discovery_job", "data_safe.delete_discovery_job_result": "oci.data_safe.DataSafeClient.delete_discovery_job_result", @@ -121,6 +123,7 @@ "data_safe.delete_user_assessment": "oci.data_safe.DataSafeClient.delete_user_assessment", "data_safe.deploy_security_policy_deployment": "oci.data_safe.DataSafeClient.deploy_security_policy_deployment", "data_safe.discover_audit_trails": "oci.data_safe.DataSafeClient.discover_audit_trails", + "data_safe.download_crypto_assessment_report": "oci.data_safe.DataSafeClient.download_crypto_assessment_report", "data_safe.download_discovery_report": "oci.data_safe.DataSafeClient.download_discovery_report", "data_safe.download_masking_log": "oci.data_safe.DataSafeClient.download_masking_log", "data_safe.download_masking_policy": "oci.data_safe.DataSafeClient.download_masking_policy", @@ -131,6 +134,7 @@ "data_safe.download_sensitive_types_export": "oci.data_safe.DataSafeClient.download_sensitive_types_export", "data_safe.download_user_assessment_report": "oci.data_safe.DataSafeClient.download_user_assessment_report", "data_safe.enable_data_safe_configuration": "oci.data_safe.DataSafeClient.enable_data_safe_configuration", + "data_safe.generate_crypto_assessment_report": "oci.data_safe.DataSafeClient.generate_crypto_assessment_report", "data_safe.generate_discovery_report_for_download": "oci.data_safe.DataSafeClient.generate_discovery_report_for_download", "data_safe.generate_health_report": "oci.data_safe.DataSafeClient.generate_health_report", "data_safe.generate_masking_policy_for_download": "oci.data_safe.DataSafeClient.generate_masking_policy_for_download", @@ -151,6 +155,8 @@ "data_safe.get_audit_trail": "oci.data_safe.DataSafeClient.get_audit_trail", "data_safe.get_compatible_formats_for_data_types": "oci.data_safe.DataSafeClient.get_compatible_formats_for_data_types", "data_safe.get_compatible_formats_for_sensitive_types": "oci.data_safe.DataSafeClient.get_compatible_formats_for_sensitive_types", + "data_safe.get_crypto_assessment": "oci.data_safe.DataSafeClient.get_crypto_assessment", + "data_safe.get_crypto_assessment_sqlnet_parameters": "oci.data_safe.DataSafeClient.get_crypto_assessment_sqlnet_parameters", "data_safe.get_data_safe_configuration": "oci.data_safe.DataSafeClient.get_data_safe_configuration", "data_safe.get_data_safe_private_endpoint": "oci.data_safe.DataSafeClient.get_data_safe_private_endpoint", "data_safe.get_database_security_config": "oci.data_safe.DataSafeClient.get_database_security_config", @@ -216,6 +222,16 @@ "data_safe.list_checks": "oci.data_safe.DataSafeClient.list_checks", "data_safe.list_collected_audit_volumes": "oci.data_safe.DataSafeClient.list_collected_audit_volumes", "data_safe.list_columns": "oci.data_safe.DataSafeClient.list_columns", + "data_safe.list_crypto_assessment_backup_sets": "oci.data_safe.DataSafeClient.list_crypto_assessment_backup_sets", + "data_safe.list_crypto_assessment_cbom_items": "oci.data_safe.DataSafeClient.list_crypto_assessment_cbom_items", + "data_safe.list_crypto_assessment_certificates": "oci.data_safe.DataSafeClient.list_crypto_assessment_certificates", + "data_safe.list_crypto_assessment_finding_analytics": "oci.data_safe.DataSafeClient.list_crypto_assessment_finding_analytics", + "data_safe.list_crypto_assessment_finding_targets": "oci.data_safe.DataSafeClient.list_crypto_assessment_finding_targets", + "data_safe.list_crypto_assessment_findings": "oci.data_safe.DataSafeClient.list_crypto_assessment_findings", + "data_safe.list_crypto_assessment_keys": "oci.data_safe.DataSafeClient.list_crypto_assessment_keys", + "data_safe.list_crypto_assessment_tde_objects": "oci.data_safe.DataSafeClient.list_crypto_assessment_tde_objects", + "data_safe.list_crypto_assessment_wallets": "oci.data_safe.DataSafeClient.list_crypto_assessment_wallets", + "data_safe.list_crypto_assessments": "oci.data_safe.DataSafeClient.list_crypto_assessments", "data_safe.list_data_safe_private_endpoints": "oci.data_safe.DataSafeClient.list_data_safe_private_endpoints", "data_safe.list_database_security_configs": "oci.data_safe.DataSafeClient.list_database_security_configs", "data_safe.list_database_table_access_entries": "oci.data_safe.DataSafeClient.list_database_table_access_entries", @@ -310,6 +326,7 @@ "data_safe.patch_target_alert_policy_association": "oci.data_safe.DataSafeClient.patch_target_alert_policy_association", "data_safe.provision_audit_policy": "oci.data_safe.DataSafeClient.provision_audit_policy", "data_safe.purge_sql_collection_logs": "oci.data_safe.DataSafeClient.purge_sql_collection_logs", + "data_safe.refresh_crypto_assessment": "oci.data_safe.DataSafeClient.refresh_crypto_assessment", "data_safe.refresh_database_security_configuration": "oci.data_safe.DataSafeClient.refresh_database_security_configuration", "data_safe.refresh_security_assessment": "oci.data_safe.DataSafeClient.refresh_security_assessment", "data_safe.refresh_security_policy_deployment": "oci.data_safe.DataSafeClient.refresh_security_policy_deployment", @@ -339,6 +356,7 @@ "data_safe.update_audit_policy": "oci.data_safe.DataSafeClient.update_audit_policy", "data_safe.update_audit_profile": "oci.data_safe.DataSafeClient.update_audit_profile", "data_safe.update_audit_trail": "oci.data_safe.DataSafeClient.update_audit_trail", + "data_safe.update_crypto_assessment": "oci.data_safe.DataSafeClient.update_crypto_assessment", "data_safe.update_data_safe_private_endpoint": "oci.data_safe.DataSafeClient.update_data_safe_private_endpoint", "data_safe.update_database_security_config": "oci.data_safe.DataSafeClient.update_database_security_config", "data_safe.update_finding": "oci.data_safe.DataSafeClient.update_finding", diff --git a/services/data_science/src/oci_cli_data_science/generated/datascience_cli.py b/services/data_science/src/oci_cli_data_science/generated/datascience_cli.py index ba9671a76..cfcff55ef 100644 --- a/services/data_science/src/oci_cli_data_science/generated/datascience_cli.py +++ b/services/data_science/src/oci_cli_data_science/generated/datascience_cli.py @@ -1851,16 +1851,17 @@ def create_job_default_job_configuration_details(ctx, from_json, wait_for_state, @cli_util.option('--job-node-configuration-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--job-infrastructure-configuration-details-capacity-reservation-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""This specifies the list of [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--job-infrastructure-configuration-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "FAILED", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'job-configuration-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-environment-configuration-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-log-configuration-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'job-node-configuration-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'job-configuration-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-environment-configuration-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-log-configuration-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'job-node-configuration-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-capacity-reservation-ids': {'module': 'data_science', 'class': 'list[string]'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-configuration-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-environment-configuration-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-log-configuration-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'job-node-configuration-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'Job'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-configuration-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-environment-configuration-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-log-configuration-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'job-node-configuration-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-capacity-reservation-ids': {'module': 'data_science', 'class': 'list[string]'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'Job'}) @cli_util.wrap_exceptions -def create_job_multi_node_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_configuration_details, job_environment_configuration_details, job_log_configuration_details, job_storage_mount_configuration_details_list, job_node_configuration_details, freeform_tags, defined_tags, job_infrastructure_configuration_details_job_shape_config_details): +def create_job_multi_node_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_configuration_details, job_environment_configuration_details, job_log_configuration_details, job_storage_mount_configuration_details_list, job_node_configuration_details, freeform_tags, defined_tags, job_infrastructure_configuration_details_capacity_reservation_ids, job_infrastructure_configuration_details_job_shape_config_details): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1899,6 +1900,9 @@ def create_job_multi_node_job_infrastructure_configuration_details(ctx, from_jso if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_details_capacity_reservation_ids is not None: + _details['jobInfrastructureConfigurationDetails']['capacityReservationIds'] = cli_util.parse_json_parameter("job_infrastructure_configuration_details_capacity_reservation_ids", job_infrastructure_configuration_details_capacity_reservation_ids) + if job_infrastructure_configuration_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_details_job_shape_config_details", job_infrastructure_configuration_details_job_shape_config_details) @@ -2043,6 +2047,7 @@ def create_job_empty_job_infrastructure_configuration_details(ctx, from_json, wa @cli_util.option('--job-node-configuration-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--job-infrastructure-configuration-details-capacity-reservation-id', help=u"""This specifies the [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""") @cli_util.option('--job-infrastructure-configuration-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "FAILED", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -2052,7 +2057,7 @@ def create_job_empty_job_infrastructure_configuration_details(ctx, from_json, wa @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-configuration-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-environment-configuration-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-log-configuration-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'job-node-configuration-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'Job'}) @cli_util.wrap_exceptions -def create_job_managed_egress_standalone_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_configuration_details, job_environment_configuration_details, job_log_configuration_details, job_storage_mount_configuration_details_list, job_node_configuration_details, freeform_tags, defined_tags, job_infrastructure_configuration_details_job_shape_config_details): +def create_job_managed_egress_standalone_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_configuration_details, job_environment_configuration_details, job_log_configuration_details, job_storage_mount_configuration_details_list, job_node_configuration_details, freeform_tags, defined_tags, job_infrastructure_configuration_details_capacity_reservation_id, job_infrastructure_configuration_details_job_shape_config_details): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2091,6 +2096,9 @@ def create_job_managed_egress_standalone_job_infrastructure_configuration_detail if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_details_capacity_reservation_id is not None: + _details['jobInfrastructureConfigurationDetails']['capacityReservationId'] = job_infrastructure_configuration_details_capacity_reservation_id + if job_infrastructure_configuration_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_details_job_shape_config_details", job_infrastructure_configuration_details_job_shape_config_details) @@ -2240,6 +2248,7 @@ def create_job_managed_compute_cluster_job_infrastructure_configuration_details( @cli_util.option('--job-node-configuration-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--job-infrastructure-configuration-details-capacity-reservation-id', help=u"""This specifies the [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""") @cli_util.option('--job-infrastructure-configuration-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "FAILED", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -2249,7 +2258,7 @@ def create_job_managed_compute_cluster_job_infrastructure_configuration_details( @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-configuration-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-environment-configuration-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-log-configuration-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'job-node-configuration-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'Job'}) @cli_util.wrap_exceptions -def create_job_standalone_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_subnet_id, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_configuration_details, job_environment_configuration_details, job_log_configuration_details, job_storage_mount_configuration_details_list, job_node_configuration_details, freeform_tags, defined_tags, job_infrastructure_configuration_details_job_shape_config_details): +def create_job_standalone_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_subnet_id, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_configuration_details, job_environment_configuration_details, job_log_configuration_details, job_storage_mount_configuration_details_list, job_node_configuration_details, freeform_tags, defined_tags, job_infrastructure_configuration_details_capacity_reservation_id, job_infrastructure_configuration_details_job_shape_config_details): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2289,6 +2298,9 @@ def create_job_standalone_job_infrastructure_configuration_details(ctx, from_jso if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_details_capacity_reservation_id is not None: + _details['jobInfrastructureConfigurationDetails']['capacityReservationId'] = job_infrastructure_configuration_details_capacity_reservation_id + if job_infrastructure_configuration_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_details_job_shape_config_details", job_infrastructure_configuration_details_job_shape_config_details) @@ -3003,16 +3015,17 @@ def create_job_run_ocir_container_job_environment_configuration_details(ctx, fro @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--opc-parent-rpt-url', help=u"""URL to fetch the Resource Principal Token from the parent resource.""") +@cli_util.option('--job-infrastructure-configuration-override-details-capacity-reservation-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""This specifies the list of [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--job-infrastructure-configuration-override-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "DELETED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'job-configuration-override-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-log-configuration-override-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-environment-configuration-override-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-node-configuration-override-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'job-storage-mount-configuration-override-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-override-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'job-configuration-override-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-log-configuration-override-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-environment-configuration-override-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-node-configuration-override-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'job-storage-mount-configuration-override-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-override-details-capacity-reservation-ids': {'module': 'data_science', 'class': 'list[string]'}, 'job-infrastructure-configuration-override-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-configuration-override-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-log-configuration-override-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-environment-configuration-override-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-node-configuration-override-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'job-storage-mount-configuration-override-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-override-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'JobRun'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-configuration-override-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-log-configuration-override-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-environment-configuration-override-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-node-configuration-override-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'job-storage-mount-configuration-override-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-override-details-capacity-reservation-ids': {'module': 'data_science', 'class': 'list[string]'}, 'job-infrastructure-configuration-override-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'JobRun'}) @cli_util.wrap_exceptions -def create_job_run_multi_node_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_id, job_infrastructure_configuration_override_details_shape_name, job_infrastructure_configuration_override_details_block_storage_size_in_gbs, display_name, job_configuration_override_details, job_log_configuration_override_details, job_environment_configuration_override_details, job_node_configuration_override_details, job_storage_mount_configuration_override_details_list, freeform_tags, defined_tags, opc_parent_rpt_url, job_infrastructure_configuration_override_details_job_shape_config_details): +def create_job_run_multi_node_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_id, job_infrastructure_configuration_override_details_shape_name, job_infrastructure_configuration_override_details_block_storage_size_in_gbs, display_name, job_configuration_override_details, job_log_configuration_override_details, job_environment_configuration_override_details, job_node_configuration_override_details, job_storage_mount_configuration_override_details_list, freeform_tags, defined_tags, opc_parent_rpt_url, job_infrastructure_configuration_override_details_capacity_reservation_ids, job_infrastructure_configuration_override_details_job_shape_config_details): kwargs = {} if opc_parent_rpt_url is not None: @@ -3051,6 +3064,9 @@ def create_job_run_multi_node_job_infrastructure_configuration_details(ctx, from if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_override_details_capacity_reservation_ids is not None: + _details['jobInfrastructureConfigurationOverrideDetails']['capacityReservationIds'] = cli_util.parse_json_parameter("job_infrastructure_configuration_override_details_capacity_reservation_ids", job_infrastructure_configuration_override_details_capacity_reservation_ids) + if job_infrastructure_configuration_override_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationOverrideDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_override_details_job_shape_config_details", job_infrastructure_configuration_override_details_job_shape_config_details) @@ -3197,6 +3213,7 @@ def create_job_run_empty_job_infrastructure_configuration_details(ctx, from_json @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--opc-parent-rpt-url', help=u"""URL to fetch the Resource Principal Token from the parent resource.""") +@cli_util.option('--job-infrastructure-configuration-override-details-capacity-reservation-id', help=u"""This specifies the [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""") @cli_util.option('--job-infrastructure-configuration-override-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "DELETED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -3206,7 +3223,7 @@ def create_job_run_empty_job_infrastructure_configuration_details(ctx, from_json @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-configuration-override-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-log-configuration-override-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-environment-configuration-override-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-node-configuration-override-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'job-storage-mount-configuration-override-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-override-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'JobRun'}) @cli_util.wrap_exceptions -def create_job_run_managed_egress_standalone_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_id, job_infrastructure_configuration_override_details_shape_name, job_infrastructure_configuration_override_details_block_storage_size_in_gbs, display_name, job_configuration_override_details, job_log_configuration_override_details, job_environment_configuration_override_details, job_node_configuration_override_details, job_storage_mount_configuration_override_details_list, freeform_tags, defined_tags, opc_parent_rpt_url, job_infrastructure_configuration_override_details_job_shape_config_details): +def create_job_run_managed_egress_standalone_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_id, job_infrastructure_configuration_override_details_shape_name, job_infrastructure_configuration_override_details_block_storage_size_in_gbs, display_name, job_configuration_override_details, job_log_configuration_override_details, job_environment_configuration_override_details, job_node_configuration_override_details, job_storage_mount_configuration_override_details_list, freeform_tags, defined_tags, opc_parent_rpt_url, job_infrastructure_configuration_override_details_capacity_reservation_id, job_infrastructure_configuration_override_details_job_shape_config_details): kwargs = {} if opc_parent_rpt_url is not None: @@ -3245,6 +3262,9 @@ def create_job_run_managed_egress_standalone_job_infrastructure_configuration_de if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_override_details_capacity_reservation_id is not None: + _details['jobInfrastructureConfigurationOverrideDetails']['capacityReservationId'] = job_infrastructure_configuration_override_details_capacity_reservation_id + if job_infrastructure_configuration_override_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationOverrideDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_override_details_job_shape_config_details", job_infrastructure_configuration_override_details_job_shape_config_details) @@ -3396,6 +3416,7 @@ def create_job_run_managed_compute_cluster_job_infrastructure_configuration_deta @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--opc-parent-rpt-url', help=u"""URL to fetch the Resource Principal Token from the parent resource.""") +@cli_util.option('--job-infrastructure-configuration-override-details-capacity-reservation-id', help=u"""This specifies the [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""") @cli_util.option('--job-infrastructure-configuration-override-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "DELETED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -3405,7 +3426,7 @@ def create_job_run_managed_compute_cluster_job_infrastructure_configuration_deta @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-configuration-override-details': {'module': 'data_science', 'class': 'JobConfigurationDetails'}, 'job-log-configuration-override-details': {'module': 'data_science', 'class': 'JobLogConfigurationDetails'}, 'job-environment-configuration-override-details': {'module': 'data_science', 'class': 'JobEnvironmentConfigurationDetails'}, 'job-node-configuration-override-details': {'module': 'data_science', 'class': 'JobNodeConfigurationDetails'}, 'job-storage-mount-configuration-override-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-override-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'JobRun'}) @cli_util.wrap_exceptions -def create_job_run_standalone_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_id, job_infrastructure_configuration_override_details_shape_name, job_infrastructure_configuration_override_details_subnet_id, job_infrastructure_configuration_override_details_block_storage_size_in_gbs, display_name, job_configuration_override_details, job_log_configuration_override_details, job_environment_configuration_override_details, job_node_configuration_override_details, job_storage_mount_configuration_override_details_list, freeform_tags, defined_tags, opc_parent_rpt_url, job_infrastructure_configuration_override_details_job_shape_config_details): +def create_job_run_standalone_job_infrastructure_configuration_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, project_id, compartment_id, job_id, job_infrastructure_configuration_override_details_shape_name, job_infrastructure_configuration_override_details_subnet_id, job_infrastructure_configuration_override_details_block_storage_size_in_gbs, display_name, job_configuration_override_details, job_log_configuration_override_details, job_environment_configuration_override_details, job_node_configuration_override_details, job_storage_mount_configuration_override_details_list, freeform_tags, defined_tags, opc_parent_rpt_url, job_infrastructure_configuration_override_details_capacity_reservation_id, job_infrastructure_configuration_override_details_job_shape_config_details): kwargs = {} if opc_parent_rpt_url is not None: @@ -3445,6 +3466,9 @@ def create_job_run_standalone_job_infrastructure_configuration_details(ctx, from if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_override_details_capacity_reservation_id is not None: + _details['jobInfrastructureConfigurationOverrideDetails']['capacityReservationId'] = job_infrastructure_configuration_override_details_capacity_reservation_id + if job_infrastructure_configuration_override_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationOverrideDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_override_details_job_shape_config_details", job_infrastructure_configuration_override_details_job_shape_config_details) @@ -11389,17 +11413,18 @@ def update_job(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_int @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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 is updated or deleted only if the `etag` you provide matches the resource's current `etag` value.""") +@cli_util.option('--job-infrastructure-configuration-details-capacity-reservation-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""This specifies the list of [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--job-infrastructure-configuration-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "FAILED", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-capacity-reservation-ids': {'module': 'data_science', 'class': 'list[string]'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'Job'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-capacity-reservation-ids': {'module': 'data_science', 'class': 'list[string]'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'Job'}) @cli_util.wrap_exceptions -def update_job_multi_node_job_infrastructure_configuration_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, job_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_storage_mount_configuration_details_list, freeform_tags, defined_tags, if_match, job_infrastructure_configuration_details_job_shape_config_details): +def update_job_multi_node_job_infrastructure_configuration_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, job_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_storage_mount_configuration_details_list, freeform_tags, defined_tags, if_match, job_infrastructure_configuration_details_capacity_reservation_ids, job_infrastructure_configuration_details_job_shape_config_details): if isinstance(job_id, six.string_types) and len(job_id.strip()) == 0: raise click.UsageError('Parameter --job-id cannot be whitespace or empty string') @@ -11433,6 +11458,9 @@ def update_job_multi_node_job_infrastructure_configuration_details(ctx, from_jso if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_details_capacity_reservation_ids is not None: + _details['jobInfrastructureConfigurationDetails']['capacityReservationIds'] = cli_util.parse_json_parameter("job_infrastructure_configuration_details_capacity_reservation_ids", job_infrastructure_configuration_details_capacity_reservation_ids) + if job_infrastructure_configuration_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_details_job_shape_config_details", job_infrastructure_configuration_details_job_shape_config_details) @@ -11567,6 +11595,7 @@ def update_job_empty_job_infrastructure_configuration_details(ctx, from_json, fo @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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 is updated or deleted only if the `etag` you provide matches the resource's current `etag` value.""") +@cli_util.option('--job-infrastructure-configuration-details-capacity-reservation-id', help=u"""This specifies the [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""") @cli_util.option('--job-infrastructure-configuration-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "FAILED", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state DELETED 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.""") @@ -11577,7 +11606,7 @@ def update_job_empty_job_infrastructure_configuration_details(ctx, from_json, fo @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'Job'}) @cli_util.wrap_exceptions -def update_job_managed_egress_standalone_job_infrastructure_configuration_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, job_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_storage_mount_configuration_details_list, freeform_tags, defined_tags, if_match, job_infrastructure_configuration_details_job_shape_config_details): +def update_job_managed_egress_standalone_job_infrastructure_configuration_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, job_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_storage_mount_configuration_details_list, freeform_tags, defined_tags, if_match, job_infrastructure_configuration_details_capacity_reservation_id, job_infrastructure_configuration_details_job_shape_config_details): if isinstance(job_id, six.string_types) and len(job_id.strip()) == 0: raise click.UsageError('Parameter --job-id cannot be whitespace or empty string') @@ -11611,6 +11640,9 @@ def update_job_managed_egress_standalone_job_infrastructure_configuration_detail if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_details_capacity_reservation_id is not None: + _details['jobInfrastructureConfigurationDetails']['capacityReservationId'] = job_infrastructure_configuration_details_capacity_reservation_id + if job_infrastructure_configuration_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_details_job_shape_config_details", job_infrastructure_configuration_details_job_shape_config_details) @@ -11750,6 +11782,7 @@ def update_job_managed_compute_cluster_job_infrastructure_configuration_details( @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. See [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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 is updated or deleted only if the `etag` you provide matches the resource's current `etag` value.""") +@cli_util.option('--job-infrastructure-configuration-details-capacity-reservation-id', help=u"""This specifies the [OCID] of the customer-managed compute capacity reservation to be used for launching jobs.""") @cli_util.option('--job-infrastructure-configuration-details-job-shape-config-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "FAILED", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state DELETED 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.""") @@ -11760,7 +11793,7 @@ def update_job_managed_compute_cluster_job_infrastructure_configuration_details( @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'job-storage-mount-configuration-details-list': {'module': 'data_science', 'class': 'list[StorageMountConfigurationDetails]'}, 'freeform-tags': {'module': 'data_science', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'data_science', 'class': 'dict(str, dict(str, object))'}, 'job-infrastructure-configuration-details-job-shape-config-details': {'module': 'data_science', 'class': 'JobShapeConfigDetails'}}, output_type={'module': 'data_science', 'class': 'Job'}) @cli_util.wrap_exceptions -def update_job_standalone_job_infrastructure_configuration_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, job_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_subnet_id, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_storage_mount_configuration_details_list, freeform_tags, defined_tags, if_match, job_infrastructure_configuration_details_job_shape_config_details): +def update_job_standalone_job_infrastructure_configuration_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, job_id, job_infrastructure_configuration_details_shape_name, job_infrastructure_configuration_details_subnet_id, job_infrastructure_configuration_details_block_storage_size_in_gbs, display_name, description, job_storage_mount_configuration_details_list, freeform_tags, defined_tags, if_match, job_infrastructure_configuration_details_capacity_reservation_id, job_infrastructure_configuration_details_job_shape_config_details): if isinstance(job_id, six.string_types) and len(job_id.strip()) == 0: raise click.UsageError('Parameter --job-id cannot be whitespace or empty string') @@ -11795,6 +11828,9 @@ def update_job_standalone_job_infrastructure_configuration_details(ctx, from_jso if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if job_infrastructure_configuration_details_capacity_reservation_id is not None: + _details['jobInfrastructureConfigurationDetails']['capacityReservationId'] = job_infrastructure_configuration_details_capacity_reservation_id + if job_infrastructure_configuration_details_job_shape_config_details is not None: _details['jobInfrastructureConfigurationDetails']['jobShapeConfigDetails'] = cli_util.parse_json_parameter("job_infrastructure_configuration_details_job_shape_config_details", job_infrastructure_configuration_details_job_shape_config_details) diff --git a/services/distributed_database/__init__.py b/services/distributed_database/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/__init__.py +++ b/services/distributed_database/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/__init__.py b/services/distributed_database/src/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/__init__.py +++ b/services/distributed_database/src/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/__init__.py b/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/__init__.py b/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/client_mappings.py b/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/client_mappings.py index b2ce8fe2c..79189a594 100644 --- a/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/client_mappings.py +++ b/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/client_mappings.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 import oci from oci_cli.cli_clients import CLIENT_MAP diff --git a/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/distributedautonomousdbservice_cli.py b/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/distributedautonomousdbservice_cli.py index a1cb090c5..c416e8212 100644 --- a/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/distributedautonomousdbservice_cli.py +++ b/services/distributed_database/src/oci_cli_distributed_autonomous_db_service/generated/distributedautonomousdbservice_cli.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 from __future__ import print_function import click @@ -47,7 +47,7 @@ def distributed_database_group(): @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.add_distributed_autonomous_database_gds_control_node.command_name', 'add'), help=u"""Add new Global database services control(GDS CTL) node for the Globally distributed autonomous database. \n[Command Reference](addDistributedAutonomousDatabaseGdsControlNode)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @cli_util.option('--public-ssh-key', required=True, help=u"""The public sshKey for Global database services control(GDS CTL) node.""") @cli_util.option('--subnet-id', help=u"""The [OCID] of the subnet on which the Global database services control(GDS CTL) node should be created.""") @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.""") @@ -113,7 +113,7 @@ def add_distributed_autonomous_database_gds_control_node(ctx, from_json, wait_fo @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.change_distributed_autonomous_database_compartment.command_name', 'change-compartment'), help=u"""Move the Globally distributed autonomous database and its dependent resources to the specified compartment. \n[Command Reference](changeDistributedAutonomousDatabaseCompartment)""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the resource to.""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -173,7 +173,7 @@ def change_distributed_autonomous_database_compartment(ctx, from_json, wait_for_ @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.change_distributed_autonomous_db_backup_config.command_name', 'change-distributed-autonomous-db-backup-config'), help=u"""Change the DbBackupConfig for the Globally distributed autonomous database. \n[Command Reference](changeDistributedAutonomousDbBackupConfig)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @cli_util.option('--db-backup-config', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @@ -233,10 +233,69 @@ def change_distributed_autonomous_db_backup_config(ctx, from_json, wait_for_stat cli_util.render_response(result, ctx) +@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.configure_distributed_autonomous_database_auto_resource_management.command_name', 'configure-distributed-autonomous-database-auto-resource-management'), help=u"""Configure autoResourceManagement options for the Globally distributed autonomous database. \n[Command Reference](configureDistributedAutonomousDatabaseAutoResourceManagement)""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") +@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""Flag indicating if autoResourceManagement is enabled or disabled.""") +@cli_util.option('--cool-off-period-in-minutes', type=click.INT, help=u"""Time period to wait for the database to get stable after autoResourceManagement event.""") +@cli_util.option('--max-move-ru-attempts', type=click.INT, help=u"""Maximum number of move replication unit attempts allowed within the configured period per database.""") +@cli_util.option('--max-move-ru-unit', type=custom_types.CliCaseInsensitiveChoice(["HOUR", "DAY"]), help=u"""Time unit applicable to maxMoveRuAttempts.""") +@cli_util.option('--mode', type=custom_types.CliCaseInsensitiveChoice(["AUTOMATIC", "RECOMMENDATION"]), help=u"""Mode of autoResourceManagement execution.""") +@cli_util.option('--action-type', type=custom_types.CliCaseInsensitiveChoice(["MOVE"]), help=u"""The action that will be taken when autoResourceManagement is triggered.""") +@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of notification topic ids [OCIDs] to receive autoResourceManagement events.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--stream-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of stream ids [OCIDs] that receive shard-related telemetry.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'stream-ids': {'module': 'distributed_database', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'stream-ids': {'module': 'distributed_database', 'class': 'list[string]'}}, output_type={'module': 'distributed_database', 'class': 'DistributedAutonomousDatabaseAutoResourceManagementDetails'}) +@cli_util.wrap_exceptions +def configure_distributed_autonomous_database_auto_resource_management(ctx, from_json, distributed_autonomous_database_id, is_enabled, cool_off_period_in_minutes, max_move_ru_attempts, max_move_ru_unit, mode, action_type, notification_topic_ids, stream_ids, if_match): + + if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: + raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['isEnabled'] = is_enabled + + if cool_off_period_in_minutes is not None: + _details['coolOffPeriodInMinutes'] = cool_off_period_in_minutes + + if max_move_ru_attempts is not None: + _details['maxMoveRuAttempts'] = max_move_ru_attempts + + if max_move_ru_unit is not None: + _details['maxMoveRuUnit'] = max_move_ru_unit + + if mode is not None: + _details['mode'] = mode + + if action_type is not None: + _details['actionType'] = action_type + + if notification_topic_ids is not None: + _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) + + if stream_ids is not None: + _details['streamIds'] = cli_util.parse_json_parameter("stream_ids", stream_ids) + + client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) + result = client.configure_distributed_autonomous_database_auto_resource_management( + distributed_autonomous_database_id=distributed_autonomous_database_id, + configure_distributed_autonomous_database_auto_resource_management_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.configure_distributed_autonomous_database_gsm_wallet.command_name', 'configure-distributed-autonomous-database-gsm-wallet'), help=u"""Configure wallets on Global Service Manager(GSM) instances for a Globally distributed autonomous database. \n[Command Reference](configureDistributedAutonomousDatabaseGsmWallet)""") @cli_util.option('--certificate-id', required=True, help=u"""The [OCID] of the cluster certificate.""") @cli_util.option('--ca-bundle-id', required=True, help=u"""The [OCID] of the ca bundle id.""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -299,7 +358,7 @@ def configure_distributed_autonomous_database_gsm_wallet(ctx, from_json, wait_fo @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.configure_distributed_autonomous_database_gsms.command_name', 'configure-distributed-autonomous-database-gsms'), help=u"""Configure new Global Service Manager(GSM aka shard manager) instances for the Globally distributed autonomous database. \n[Command Reference](configureDistributedAutonomousDatabaseGsms)""") @cli_util.option('--old-gsm-names', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Names of old global service manager(GSM) instances corresponding to which new GSM instances need to be configured.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--is-latest-gsm-image', required=True, type=click.BOOL, help=u"""Flag to indicate if new global service manager(GSM) instances shall use latest image or re-use image used by existing GSM instances.""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -360,7 +419,7 @@ def configure_distributed_autonomous_database_gsms(ctx, from_json, wait_for_stat @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.configure_distributed_autonomous_database_sharding.command_name', 'configure-distributed-autonomous-database-sharding'), help=u"""Once all components of Globally distributed autonomous database are provisioned, this api shall be invoked to configure sharding on the Globally distributed autonomous database. Note that this 'ConfigureSharding' API also needs to be invoked after successfully adding a new shard to the Globally distributed autonomous database using PATCH api. If this API is not invoked after successfully adding a new shard, then that new shard will not be a participant in sharding topology of the Globally distributed autonomous database. \n[Command Reference](configureDistributedAutonomousDatabaseSharding)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @cli_util.option('--is-rebalance-required', type=click.BOOL, help=u"""The flag to indicate whether chunks need to be re-balanced. This flag is not applicable for USER-defined sharding type.""") @cli_util.option('--certificate-id', help=u"""The ID of the cluster certificate.""") @cli_util.option('--ca-bundle-id', help=u"""The ID of the Ca Bundle.""") @@ -429,33 +488,45 @@ def configure_distributed_autonomous_database_sharding(ctx, from_json, wait_for_ @cli_util.option('--database-version', required=True, help=u"""Oracle Database version for the shards and catalog used in Globally distributed autonomous database.""") @cli_util.option('--prefix', required=True, help=u"""Unique name prefix for the Globally distributed autonomous databases. Only alpha-numeric values are allowed. First character has to be a letter followed by any combination of letter and number.""") @cli_util.option('--private-endpoint-ids', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] of the private endpoint associated with Globally distributed autonomous database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--sharding-method', required=True, type=custom_types.CliCaseInsensitiveChoice(["USER", "SYSTEM"]), help=u"""Sharding Methods for the Globally distributed autonomous database.""") -@cli_util.option('--db-workload', required=True, type=custom_types.CliCaseInsensitiveChoice(["OLTP", "DW"]), help=u"""Possible workload types. Currently only OLTP workload type is supported.""") +@cli_util.option('--db-workload-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["OLTP", "DW"]), help=u"""Possible workload types. Currently only OLTP workload type is supported.""") @cli_util.option('--character-set', required=True, help=u"""The character set for the database.""") @cli_util.option('--ncharacter-set', required=True, help=u"""The national character set for the database.""") @cli_util.option('--listener-port', required=True, type=click.INT, help=u"""The listener port number for the Globally distributed autonomous database. The listener port number has to be unique for a customer tenancy across all distributed autonomous databases. Same port number should not be re-used for any other distributed autonomous database.""") @cli_util.option('--ons-port-local', required=True, type=click.INT, help=u"""Ons local port number for Globally distributed autonomous database. The onsPortLocal has to be unique for a customer tenancy across all distributed autonomous databases. Same port number should not be re-used for any other distributed autonomous database.""") @cli_util.option('--ons-port-remote', required=True, type=click.INT, help=u"""Ons remote port number for Globally distributed autonomous database. The onsPortRemote has to be unique for a customer tenancy across all distributed autonomous databases. Same port number should not be re-used for any other distributed autonomous database.""") -@cli_util.option('--db-deployment-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ADB_D"]), help=u"""The distributed autonomous database deployment type.""") -@cli_util.option('--shard-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of shards for the Globally distributed autonomous database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--catalog-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of catalog for the Globally distributed autonomous database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--chunks', type=click.INT, help=u"""Number of chunks in a shardspace. The value of chunks must be greater than 2 times the size of the largest shardgroup in any shardspace. Chunks is required to be provided for distributed autonomous databases being created with SYSTEM shardingMethod. For USER shardingMethod, chunks should not be set in create payload.""") +@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] for the notification topics associated with the globally distributed autonomous database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--listener-port-tls', type=click.INT, help=u"""The TLS listener port number for Globally distributed autonomous database. The TLS listener port number has to be unique for a customer tenancy across all distributed autonomous databases. Same port number should not be re-used for any other distributed autonomous database. The listenerPortTls is mandatory for dedicated infrastructure based distributed autonomous databases.""") -@cli_util.option('--replication-method', type=custom_types.CliCaseInsensitiveChoice(["RAFT", "DG"]), help=u"""The Replication method for Globally distributed autonomous database. Use RAFT for Raft based replication. With RAFT replication, shards cannot have peers details set on them. In case shards need to have peers, please do not set RAFT replicationMethod. For all non RAFT replication cases (with or without peers), please set replicationMethod as DG or do not set any value for replicationMethod.""") -@cli_util.option('--replication-factor', type=click.INT, help=u"""The Replication factor for RAFT replication based Globally distributed autonomous database. Currently supported values are 3, 5 and 7.""") -@cli_util.option('--replication-unit', type=click.INT, help=u"""The replication unit count for RAFT based distributed autonomous database. For RAFT replication based Globally distributed autonomous database, the value should be at least twice the number of shards.""") +@cli_util.option('--system-chunk-count', type=click.INT, help=u"""Count of chunks associated with system raft clusters or system data guard databases.""") +@cli_util.option('--system-raft-replication-unit-count', type=click.INT, help=u"""Number of replication units associated with system raft clusters.""") +@cli_util.option('--composite-raft-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of composite raft shards. + +This option is a JSON list with items of type CreateAutonomousCompositeRaftShardSpaceDetails. For documentation on CreateAutonomousCompositeRaftShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/CreateAutonomousCompositeRaftShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--composite-data-guard-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of composite data guard shard spaces. + +This option is a JSON list with items of type CreateAutonomousCompositeDataGuardShardSpaceDetails. For documentation on CreateAutonomousCompositeDataGuardShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/CreateAutonomousCompositeDataGuardShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--system-raft-clusters', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of system raft clusters. + +This option is a JSON list with items of type CreateAutonomousSystemRaftClusterDetails. For documentation on CreateAutonomousSystemRaftClusterDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/CreateAutonomousSystemRaftClusterDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--system-data-guard-databases', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--user-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of user defined shard spaces. + +This option is a JSON list with items of type CreateAutonomousUserShardSpaceDetails. For documentation on CreateAutonomousUserShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/CreateAutonomousUserShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--db-backup-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--vcn-nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of network security group (NSG) details to be associated with the distributed autonomous database. + +This option is a JSON list with items of type VcnNsgIdsDetails. For documentation on VcnNsgIdsDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/VcnNsgIdsDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @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.""") -@json_skeleton_utils.get_cli_json_input_option({'private-endpoint-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'shard-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedAutonomousDatabaseShardDetails]'}, 'catalog-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedAutonomousDatabaseCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database', 'class': 'DistributedAutonomousDbBackupConfig'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'private-endpoint-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'composite-raft-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateAutonomousCompositeRaftShardSpaceDetails]'}, 'composite-data-guard-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateAutonomousCompositeDataGuardShardSpaceDetails]'}, 'system-raft-clusters': {'module': 'distributed_database', 'class': 'list[CreateAutonomousSystemRaftClusterDetails]'}, 'system-data-guard-databases': {'module': 'distributed_database', 'class': 'CreateAutonomousSystemDataGuardDatabaseDetails'}, 'user-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateAutonomousUserShardSpaceDetails]'}, 'catalog-details': {'module': 'distributed_database', 'class': 'list[CreateAutonomousCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database', 'class': 'DistributedAutonomousDbBackupConfig'}, 'vcn-nsg-ids': {'module': 'distributed_database', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'private-endpoint-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'shard-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedAutonomousDatabaseShardDetails]'}, 'catalog-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedAutonomousDatabaseCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database', 'class': 'DistributedAutonomousDbBackupConfig'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedAutonomousDatabase'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'private-endpoint-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'composite-raft-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateAutonomousCompositeRaftShardSpaceDetails]'}, 'composite-data-guard-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateAutonomousCompositeDataGuardShardSpaceDetails]'}, 'system-raft-clusters': {'module': 'distributed_database', 'class': 'list[CreateAutonomousSystemRaftClusterDetails]'}, 'system-data-guard-databases': {'module': 'distributed_database', 'class': 'CreateAutonomousSystemDataGuardDatabaseDetails'}, 'user-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateAutonomousUserShardSpaceDetails]'}, 'catalog-details': {'module': 'distributed_database', 'class': 'list[CreateAutonomousCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database', 'class': 'DistributedAutonomousDbBackupConfig'}, 'vcn-nsg-ids': {'module': 'distributed_database', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedAutonomousDatabase'}) @cli_util.wrap_exceptions -def create_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, database_version, prefix, private_endpoint_ids, sharding_method, db_workload, character_set, ncharacter_set, listener_port, ons_port_local, ons_port_remote, db_deployment_type, shard_details, catalog_details, chunks, listener_port_tls, replication_method, replication_factor, replication_unit, db_backup_config, freeform_tags, defined_tags): +def create_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, database_version, prefix, private_endpoint_ids, db_workload_type, character_set, ncharacter_set, listener_port, ons_port_local, ons_port_remote, catalog_details, notification_topic_ids, listener_port_tls, system_chunk_count, system_raft_replication_unit_count, composite_raft_shard_spaces, composite_data_guard_shard_spaces, system_raft_clusters, system_data_guard_databases, user_shard_spaces, db_backup_config, vcn_nsg_ids, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -466,35 +537,47 @@ def create_distributed_autonomous_database(ctx, from_json, wait_for_state, max_w _details['databaseVersion'] = database_version _details['prefix'] = prefix _details['privateEndpointIds'] = cli_util.parse_json_parameter("private_endpoint_ids", private_endpoint_ids) - _details['shardingMethod'] = sharding_method - _details['dbWorkload'] = db_workload + _details['dbWorkloadType'] = db_workload_type _details['characterSet'] = character_set _details['ncharacterSet'] = ncharacter_set _details['listenerPort'] = listener_port _details['onsPortLocal'] = ons_port_local _details['onsPortRemote'] = ons_port_remote - _details['dbDeploymentType'] = db_deployment_type - _details['shardDetails'] = cli_util.parse_json_parameter("shard_details", shard_details) _details['catalogDetails'] = cli_util.parse_json_parameter("catalog_details", catalog_details) - if chunks is not None: - _details['chunks'] = chunks + if notification_topic_ids is not None: + _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) if listener_port_tls is not None: _details['listenerPortTls'] = listener_port_tls - if replication_method is not None: - _details['replicationMethod'] = replication_method + if system_chunk_count is not None: + _details['systemChunkCount'] = system_chunk_count + + if system_raft_replication_unit_count is not None: + _details['systemRaftReplicationUnitCount'] = system_raft_replication_unit_count + + if composite_raft_shard_spaces is not None: + _details['compositeRaftShardSpaces'] = cli_util.parse_json_parameter("composite_raft_shard_spaces", composite_raft_shard_spaces) + + if composite_data_guard_shard_spaces is not None: + _details['compositeDataGuardShardSpaces'] = cli_util.parse_json_parameter("composite_data_guard_shard_spaces", composite_data_guard_shard_spaces) - if replication_factor is not None: - _details['replicationFactor'] = replication_factor + if system_raft_clusters is not None: + _details['systemRaftClusters'] = cli_util.parse_json_parameter("system_raft_clusters", system_raft_clusters) - if replication_unit is not None: - _details['replicationUnit'] = replication_unit + if system_data_guard_databases is not None: + _details['systemDataGuardDatabases'] = cli_util.parse_json_parameter("system_data_guard_databases", system_data_guard_databases) + + if user_shard_spaces is not None: + _details['userShardSpaces'] = cli_util.parse_json_parameter("user_shard_spaces", user_shard_spaces) if db_backup_config is not None: _details['dbBackupConfig'] = cli_util.parse_json_parameter("db_backup_config", db_backup_config) + if vcn_nsg_ids is not None: + _details['vcnNsgIds'] = cli_util.parse_json_parameter("vcn_nsg_ids", vcn_nsg_ids) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -537,7 +620,7 @@ def create_distributed_autonomous_database(ctx, from_json, wait_for_state, max_w @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.delete_distributed_autonomous_database.command_name', 'delete'), help=u"""Terminate the given Globally distributed autonomous databases. \n[Command Reference](deleteDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @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.""") @cli_util.confirm_delete_option @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @@ -592,114 +675,8 @@ def delete_distributed_autonomous_database(ctx, from_json, wait_for_state, max_w cli_util.render_response(result, ctx) -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.download_distributed_autonomous_database_gsm_certificate_signing_request.command_name', 'download-distributed-autonomous-database-gsm-certificate-signing-request'), help=u"""Generate the common certificate signing request for GSMs. Download the .csr file from API response. Users can use this .csr file to generate the CA signed certificate, and as a next step use 'uploadSignedCertificateAndGenerateWallet' API to upload the CA signed certificate to GSM, and generate wallets for the GSM instances of the Globally distributed autonomous database. \n[Command Reference](downloadDistributedAutonomousDatabaseGsmCertificateSigningRequest)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") -@cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def download_distributed_autonomous_database_gsm_certificate_signing_request(ctx, from_json, file, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) - result = client.download_distributed_autonomous_database_gsm_certificate_signing_request( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - - # If outputting to stdout we don't want to print a progress bar because it will get mixed up with the output - # Also we need a non-zero Content-Length in order to display a meaningful progress bar - bar = None - if hasattr(file, 'name') and file.name != '' and 'Content-Length' in result.headers: - content_length = int(result.headers['Content-Length']) - if content_length > 0: - bar = click.progressbar(length=content_length, label='Downloading file') - - try: - if bar: - bar.__enter__() - - # TODO: Make the download size a configurable option - # use decode_content=True to automatically unzip service responses (this should be overridden for object storage) - for chunk in result.data.raw.stream(cli_constants.MEBIBYTE, decode_content=True): - if bar: - bar.update(len(chunk)) - file.write(chunk) - finally: - if bar: - bar.render_finish() - file.close() - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.generate_distributed_autonomous_database_gsm_certificate_signing_request.command_name', 'generate-distributed-autonomous-database-gsm-certificate-signing-request'), help=u"""Generate the certificate signing request for GSM instances of the Globally distributed autonomous database. Once certificate signing request is generated, then customers can download the certificate signing request using 'downloadGsmCertificateSigningRequest' api call. \n[Command Reference](generateDistributedAutonomousDatabaseGsmCertificateSigningRequest)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") -@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.""") -@cli_util.option('--ca-bundle-id', help=u"""The ID of the Ca Bundle.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def generate_distributed_autonomous_database_gsm_certificate_signing_request(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match, ca_bundle_id): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - if ca_bundle_id is not None: - kwargs['ca_bundle_id'] = ca_bundle_id - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) - result = client.generate_distributed_autonomous_database_gsm_certificate_signing_request( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.generate_distributed_autonomous_database_wallet.command_name', 'generate-distributed-autonomous-database-wallet'), help=u"""Generate the wallet associated with Globally distributed autonomous database. \n[Command Reference](generateDistributedAutonomousDatabaseWallet)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @cli_util.option('--password', required=True, help=u"""The password to encrypt the keys inside the wallet. The password must be at least 8 characters long and must include at least 1 letter and either 1 numeric character or 1 special character.""") @cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") @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.""") @@ -753,8 +730,8 @@ def generate_distributed_autonomous_database_wallet(ctx, from_json, file, distri @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.get_distributed_autonomous_database.command_name', 'get'), help=u"""Gets the details of the Globally distributed autonomous database identified by given id. \n[Command Reference](getDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") -@cli_util.option('--metadata', help=u"""Comma separated names of argument corresponding to which metadata need to be retrived.""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") +@cli_util.option('--metadata', help=u"""Comma-separated argument names for which metadata should be retrieved.""") @cli_util.option('--if-none-match', help=u"""For conditional requests. In the GET call for a resource, set the `If-None-Match` header to the value of the ETag from a previous GET (or POST or PUT) response for that resource. The server will return with either a 304 Not Modified response if the resource has not changed, or a 200 OK response with the updated representation.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @@ -781,7 +758,7 @@ def get_distributed_autonomous_database(ctx, from_json, distributed_autonomous_d @distributed_database_group.command(name=cli_util.override('distributed_autonomous_db_service.get_distributed_autonomous_database_raft_metric.command_name', 'get-distributed-autonomous-database-raft-metric'), help=u"""Operation to retrieve RAFT metrics for the Globally distributed autonomous database. If the Globally distributed autonomous database is not RAFT based then empty response is returned from the API. \n[Command Reference](getDistributedAutonomousDatabaseRaftMetric)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context @@ -802,17 +779,44 @@ def get_distributed_autonomous_database_raft_metric(ctx, from_json, distributed_ cli_util.render_response(result, ctx) +@distributed_database_group.command(name=cli_util.override('distributed_autonomous_db_service.get_distributed_autonomous_database_ru_change_log.command_name', 'get-distributed-autonomous-database-ru-change-log'), help=u"""Operation to retrieve move RU invocation history and status for the Globally distributed autonomous database. Results are ordered by created timestamp in descending order. \n[Command Reference](getDistributedAutonomousDatabaseRuChangeLog)""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") +@cli_util.option('--source-shard-name', help=u"""The source shard name to filter RU change log entries.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database', 'class': 'DistributedAutonomousDatabaseRuChangeLog'}) +@cli_util.wrap_exceptions +def get_distributed_autonomous_database_ru_change_log(ctx, from_json, distributed_autonomous_database_id, source_shard_name): + + if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: + raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') + + kwargs = {} + if source_shard_name is not None: + kwargs['source_shard_name'] = source_shard_name + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) + result = client.get_distributed_autonomous_database_ru_change_log( + distributed_autonomous_database_id=distributed_autonomous_database_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @distributed_autonomous_database_collection_group.command(name=cli_util.override('distributed_autonomous_db_service.list_distributed_autonomous_databases.command_name', 'list-distributed-autonomous-databases'), help=u"""List of Globally distributed autonomous databases. \n[Command Reference](listDistributedAutonomousDatabases)""") @cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""When set to true, returns resources in the specified compartment and in all of its child compartments recursively. Defaults to false.""") @cli_util.option('--private-endpoint-id', help=u"""A filter to return only resources that are associated with the given privateEndpointId.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), help=u"""A filter to return only resources whose lifecycleState matches the specified value.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "timeUpdated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--is-auto-resource-management-enabled', type=click.BOOL, help=u"""A filter to return only resources where autoResourceManagement is enabled when set to `true`, or disabled when set to `false`. If omitted, no autoResourceManagement-based filtering is applied.""") @cli_util.option('--display-name', help=u"""A filter to return only Globally distributed autonomous databases that match the entire name given. The match is not case sensitive.""") -@cli_util.option('--db-deployment-type', type=custom_types.CliCaseInsensitiveChoice(["ADB_D"]), help=u"""A filter to return only resources their dbDeploymentType matches the given dbDeploymentType.""") -@cli_util.option('--metadata', help=u"""Comma separated names of argument corresponding to which metadata need to be retrived.""") +@cli_util.option('--db-deployment-type', help=u"""A filter to return only resources whose dbDeploymentType matches the specified value.""") +@cli_util.option('--metadata', help=u"""Comma-separated argument names for which metadata should be retrieved.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -820,12 +824,14 @@ def get_distributed_autonomous_database_raft_metric(ctx, from_json, distributed_ @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database', 'class': 'DistributedAutonomousDatabaseCollection'}) @cli_util.wrap_exceptions -def list_distributed_autonomous_databases(ctx, from_json, all_pages, page_size, compartment_id, private_endpoint_id, lifecycle_state, limit, page, sort_order, sort_by, display_name, db_deployment_type, metadata): +def list_distributed_autonomous_databases(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, private_endpoint_id, lifecycle_state, limit, page, sort_order, sort_by, is_auto_resource_management_enabled, display_name, db_deployment_type, metadata): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree if private_endpoint_id is not None: kwargs['private_endpoint_id'] = private_endpoint_id if lifecycle_state is not None: @@ -838,6 +844,8 @@ def list_distributed_autonomous_databases(ctx, from_json, all_pages, page_size, kwargs['sort_order'] = sort_order if sort_by is not None: kwargs['sort_by'] = sort_by + if is_auto_resource_management_enabled is not None: + kwargs['is_auto_resource_management_enabled'] = is_auto_resource_management_enabled if display_name is not None: kwargs['display_name'] = display_name if db_deployment_type is not None: @@ -872,7 +880,7 @@ def list_distributed_autonomous_databases(ctx, from_json, all_pages, page_size, @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.move_distributed_autonomous_database_replication_unit.command_name', 'move-distributed-autonomous-database-replication-unit'), help=u"""Move the replication units for RAFT based globally distributed autonomous database from source shard to destination shard. \n[Command Reference](moveDistributedAutonomousDatabaseReplicationUnit)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @cli_util.option('--source-shard-name', required=True, help=u"""The name of the source shard from which to move the chunks out to other shards.""") @cli_util.option('--destination-shard-name', help=u"""The name of the destination shard to which the chunks moved out from source shard should be relocate to.""") @cli_util.option('--replication-units', type=custom_types.CLI_COMPLEX_TYPE, help=u"""For RAFT databases please provide replication unit numbers to be moved from source shard to destination shard.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -941,10 +949,10 @@ def move_distributed_autonomous_database_replication_unit(ctx, from_json, wait_f @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.patch_distributed_autonomous_database.command_name', 'patch'), help=u"""Patch operation to add, remove or update shards to the Globally distributed autonomous database topology. In single patch operation, multiple shards can be either added, or removed or updated. Combination of inserts, update and remove in single operation is not allowed. \n[Command Reference](patchDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @cli_util.option('--items', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of patch instructions. -This option is a JSON list with items of type PatchInstruction. For documentation on PatchInstruction please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20250101/datatypes/PatchInstruction.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +This option is a JSON list with items of type PatchInstruction. For documentation on PatchInstruction please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/PatchInstruction.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1006,9 +1014,8 @@ def patch_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wa @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.recreate_failed_distributed_autonomous_database_resource.command_name', 'recreate-failed-distributed-autonomous-database-resource'), help=u"""Recreate the failed resource for the Globally Distributed Autonomous Database. \n[Command Reference](recreateFailedDistributedAutonomousDatabaseResource)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") -@cli_util.option('--resource-name', required=True, help=u"""Specify the name of Shard, Catalog or GSM.""") -@cli_util.option('--shard-group', help=u"""The shardGroup name example Shardgroupa, Shardgroupb.""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") +@cli_util.option('--resource-name', required=True, help=u"""Specify the name of the shard, catalog, or GSM.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1018,14 +1025,12 @@ def patch_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wa @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def recreate_failed_distributed_autonomous_database_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, resource_name, shard_group, if_match): +def recreate_failed_distributed_autonomous_database_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, resource_name, if_match): if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') kwargs = {} - if shard_group is not None: - kwargs['shard_group'] = shard_group if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1066,17 +1071,18 @@ def recreate_failed_distributed_autonomous_database_resource(ctx, from_json, wai @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.rotate_distributed_autonomous_database_passwords.command_name', 'rotate-distributed-autonomous-database-passwords'), help=u"""Rotate the gsmuser and gsmcatuser passwords for shards and catalog of the Globally distributed autonomous database. This operation will also remove GdsCtlNodes if present. \n[Command Reference](rotateDistributedAutonomousDatabasePasswords)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") +@cli_util.option('--database-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of shard or catalog password rotation details.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @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.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'database-details': {'module': 'distributed_database', 'class': 'list[RotateDistributedAutonomousDatabaseDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'database-details': {'module': 'distributed_database', 'class': 'list[RotateDistributedAutonomousDatabaseDetails]'}}) @cli_util.wrap_exceptions -def rotate_distributed_autonomous_database_passwords(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): +def rotate_distributed_autonomous_database_passwords(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, database_details, if_match): if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') @@ -1085,9 +1091,14 @@ def rotate_distributed_autonomous_database_passwords(ctx, from_json, wait_for_st if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['databaseDetails'] = cli_util.parse_json_parameter("database_details", database_details) + client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) result = client.rotate_distributed_autonomous_database_passwords( distributed_autonomous_database_id=distributed_autonomous_database_id, + rotate_distributed_autonomous_database_passwords_details=_details, **kwargs ) if wait_for_state: @@ -1120,8 +1131,8 @@ def rotate_distributed_autonomous_database_passwords(ctx, from_json, wait_for_st cli_util.render_response(result, ctx) -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.start_distributed_autonomous_database.command_name', 'start'), help=u"""Start the shards, catalog and GSMs of Globally distributed autonomous database. \n[Command Reference](startDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.scale_distributed_autonomous_database_gsms.command_name', 'scale-distributed-autonomous-database-gsms'), help=u"""Scale global service manager(GSM aka shard director) instances for the Globally distributed autonomous database. \n[Command Reference](scaleDistributedAutonomousDatabaseGsms)""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1131,7 +1142,7 @@ def rotate_distributed_autonomous_database_passwords(ctx, from_json, wait_for_st @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def start_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): +def scale_distributed_autonomous_database_gsms(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') @@ -1140,9 +1151,13 @@ def start_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wa if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) - result = client.start_distributed_autonomous_database( + result = client.scale_distributed_autonomous_database_gsms( distributed_autonomous_database_id=distributed_autonomous_database_id, + scale_distributed_autonomous_database_gsms_details=_details, **kwargs ) if wait_for_state: @@ -1175,8 +1190,8 @@ def start_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wa cli_util.render_response(result, ctx) -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.stop_distributed_autonomous_database.command_name', 'stop'), help=u"""Stop the shards, catalog and GSM instances for the Globally distributed autonomous database. \n[Command Reference](stopDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.start_distributed_autonomous_database.command_name', 'start'), help=u"""Start the shards, catalog, GSMs and GDSCTL instances of Globally distributed autonomous database. \n[Command Reference](startDistributedAutonomousDatabase)""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1186,7 +1201,7 @@ def start_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wa @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def stop_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): +def start_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') @@ -1196,7 +1211,7 @@ def stop_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wai kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) - result = client.stop_distributed_autonomous_database( + result = client.start_distributed_autonomous_database( distributed_autonomous_database_id=distributed_autonomous_database_id, **kwargs ) @@ -1230,94 +1245,85 @@ def stop_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wai cli_util.render_response(result, ctx) -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.update_distributed_autonomous_database.command_name', 'update'), help=u"""Updates the configuration of the Globally distributed autonomous database. \n[Command Reference](updateDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") -@cli_util.option('--display-name', help=u"""Display name of the Globally distributed autonomous database.""") -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.stop_distributed_autonomous_database.command_name', 'stop'), help=u"""Stop the shards, catalog, GSMs and GDSCTL instances for the Globally distributed autonomous database. \n[Command Reference](stopDistributedAutonomousDatabase)""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @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.""") -@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state CREATING 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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedAutonomousDatabase'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def update_distributed_autonomous_database(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, display_name, freeform_tags, defined_tags, if_match): +def stop_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - if not force: - if freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): - ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if display_name is not None: - _details['displayName'] = display_name - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) - result = client.update_distributed_autonomous_database( + result = client.stop_distributed_autonomous_database( distributed_autonomous_database_id=distributed_autonomous_database_id, - update_distributed_autonomous_database_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_distributed_autonomous_database') and callable(getattr(client, 'get_distributed_autonomous_database')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_distributed_autonomous_database(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.upload_distributed_autonomous_database_signed_certificate_and_generate_wallet.command_name', 'upload-distributed-autonomous-database-signed-certificate-and-generate-wallet'), help=u"""Upload the CA signed certificate to the GSM instances and generate wallets for GSM instances of the Globally distributed autonomous database. Customer shall provide the CA signed certificate key details by adding the certificate in request body. \n[Command Reference](uploadDistributedAutonomousDatabaseSignedCertificateAndGenerateWallet)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") -@cli_util.option('--ca-signed-certificate', required=True, help=u"""The CA signed certificate key.""") +@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.update_distributed_autonomous_database.command_name', 'update'), help=u"""Updates the configuration of the Globally distributed autonomous database. \n[Command Reference](updateDistributedAutonomousDatabase)""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") +@cli_util.option('--display-name', help=u"""Display name of the Globally distributed autonomous database.""") +@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] for the notification topics associated with the globally distributed autonomous database. Pass an empty list (`[]`) to remove existing notification topics (set `notificationTopicIds` to empty).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state CREATING 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.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedAutonomousDatabase'}) @cli_util.wrap_exceptions -def upload_distributed_autonomous_database_signed_certificate_and_generate_wallet(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, ca_signed_certificate, if_match): +def update_distributed_autonomous_database(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, display_name, notification_topic_ids, freeform_tags, defined_tags, if_match): if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') + if not force: + if notification_topic_ids or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to notification-topic-ids and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() kwargs = {} if if_match is not None: @@ -1325,46 +1331,53 @@ def upload_distributed_autonomous_database_signed_certificate_and_generate_walle kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['caSignedCertificate'] = ca_signed_certificate + + if display_name is not None: + _details['displayName'] = display_name + + if notification_topic_ids is not None: + _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) client = cli_util.build_client('distributed_database', 'distributed_autonomous_db_service', ctx) - result = client.upload_distributed_autonomous_database_signed_certificate_and_generate_wallet( + result = client.update_distributed_autonomous_database( distributed_autonomous_database_id=distributed_autonomous_database_id, - upload_distributed_autonomous_database_signed_certificate_and_generate_wallet_details=_details, + update_distributed_autonomous_database_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_distributed_autonomous_database') and callable(getattr(client, 'get_distributed_autonomous_database')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_distributed_autonomous_database(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.validate_distributed_autonomous_database_ca_bundle.command_name', 'validate-distributed-autonomous-database-ca-bundle'), help=u"""Validate the CA Bundles consistency of the globally distributed autonomous database. \n[Command Reference](validateDistributedAutonomousDatabaseCaBundle)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1419,10 +1432,8 @@ def validate_distributed_autonomous_database_ca_bundle(ctx, from_json, wait_for_ @distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.validate_distributed_autonomous_database_network.command_name', 'validate-distributed-autonomous-database-network'), help=u"""Validate the network connectivity between components of the globally distributed autonomous database. \n[Command Reference](validateDistributedAutonomousDatabaseNetwork)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier""") +@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") @cli_util.option('--is-surrogate', type=click.BOOL, help=u"""Determines the surrogates check. Default is true.""") -@cli_util.option('--resource-name', help=u"""Specify the name of shard or catalog.""") -@cli_util.option('--shard-group', help=u"""The shardGroup name example Shardgroupa, Shardgroupb.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1432,7 +1443,7 @@ def validate_distributed_autonomous_database_ca_bundle(ctx, from_json, wait_for_ @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def validate_distributed_autonomous_database_network(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, is_surrogate, resource_name, shard_group, if_match): +def validate_distributed_autonomous_database_network(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, is_surrogate, if_match): if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') @@ -1440,10 +1451,6 @@ def validate_distributed_autonomous_database_network(ctx, from_json, wait_for_st kwargs = {} if is_surrogate is not None: kwargs['is_surrogate'] = is_surrogate - if resource_name is not None: - kwargs['resource_name'] = resource_name - if shard_group is not None: - kwargs['shard_group'] = shard_group if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) diff --git a/services/distributed_database/src/oci_cli_distributed_database/__init__.py b/services/distributed_database/src/oci_cli_distributed_database/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_database/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_database/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_database/generated/__init__.py b/services/distributed_database/src/oci_cli_distributed_database/generated/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_database/generated/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_database/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_database/generated/distributed_database_service_cli.py b/services/distributed_database/src/oci_cli_distributed_database/generated/distributed_database_service_cli.py index 35de4536b..8f1580d19 100644 --- a/services/distributed_database/src/oci_cli_distributed_database/generated/distributed_database_service_cli.py +++ b/services/distributed_database/src/oci_cli_distributed_database/generated/distributed_database_service_cli.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 from oci_cli.cli_root import cli from oci_cli import cli_util diff --git a/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/__init__.py b/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/__init__.py b/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/client_mappings.py b/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/client_mappings.py index 7537d93ce..ad4dd8df5 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/client_mappings.py +++ b/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/client_mappings.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 import oci from oci_cli.cli_clients import CLIENT_MAP diff --git a/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/distributeddbprivateendpointservice_cli.py b/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/distributeddbprivateendpointservice_cli.py index fec936692..3f961dd25 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/distributeddbprivateendpointservice_cli.py +++ b/services/distributed_database/src/oci_cli_distributed_db_private_endpoint_service/generated/distributeddbprivateendpointservice_cli.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 from __future__ import print_function import click @@ -105,18 +105,20 @@ def change_distributed_database_private_endpoint_compartment(ctx, from_json, wai @cli_util.option('--subnet-id', required=True, help=u"""Identifier of the customer subnet against which private endpoint is to be created.""") @cli_util.option('--display-name', required=True, help=u"""Private endpoint display name.""") @cli_util.option('--description', help=u"""DistributedDatabasePrivateEndpoint description.""") -@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The OCIDs of the network security groups that the private endpoint belongs to.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--vcn-nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of network security group (NSG) details to be associated with the private endpoint. + +This option is a JSON list with items of type VcnNsgIdsDetails. For documentation on VcnNsgIdsDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbprivateendpointservice/20260101/datatypes/VcnNsgIdsDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @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.""") -@json_skeleton_utils.get_cli_json_input_option({'nsg-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'vcn-nsg-ids': {'module': 'distributed_database', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'nsg-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabasePrivateEndpoint'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'vcn-nsg-ids': {'module': 'distributed_database', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabasePrivateEndpoint'}) @cli_util.wrap_exceptions -def create_distributed_database_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, subnet_id, display_name, description, nsg_ids, freeform_tags, defined_tags): +def create_distributed_database_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, subnet_id, display_name, description, vcn_nsg_ids, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -129,8 +131,8 @@ def create_distributed_database_private_endpoint(ctx, from_json, wait_for_state, if description is not None: _details['description'] = description - if nsg_ids is not None: - _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) + if vcn_nsg_ids is not None: + _details['vcnNsgIds'] = cli_util.parse_json_parameter("vcn_nsg_ids", vcn_nsg_ids) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -256,6 +258,7 @@ def get_distributed_database_private_endpoint(ctx, from_json, distributed_databa @distributed_database_private_endpoint_collection_group.command(name=cli_util.override('distributed_db_private_endpoint_service.list_distributed_database_private_endpoints.command_name', 'list-distributed-database-private-endpoints'), help=u"""List of DistributedDatabasePrivateEndpoints. \n[Command Reference](listDistributedDatabasePrivateEndpoints)""") @cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""When set to true, returns resources in the specified compartment and in all of its child compartments recursively. Defaults to false.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") @@ -269,12 +272,14 @@ def get_distributed_database_private_endpoint(ctx, from_json, distributed_databa @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabasePrivateEndpointCollection'}) @cli_util.wrap_exceptions -def list_distributed_database_private_endpoints(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, limit, page, sort_order, sort_by, display_name): +def list_distributed_database_private_endpoints(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, lifecycle_state, limit, page, sort_order, sort_by, display_name): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state if limit is not None: @@ -314,6 +319,71 @@ def list_distributed_database_private_endpoints(ctx, from_json, all_pages, page_ cli_util.render_response(result, ctx) +@distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.patch_distributed_database_private_endpoint.command_name', 'patch'), help=u"""Patch operation to update VCN network security group (NSG) IDs associated with the DistributedDatabasePrivateEndpoint. \n[Command Reference](patchDistributedDatabasePrivateEndpoint)""") +@cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") +@cli_util.option('--items', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of patch instructions. + +This option is a JSON list with items of type PatchInstruction. For documentation on PatchInstruction please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbprivateendpointservice/20260101/datatypes/PatchInstruction.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@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.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'items': {'module': 'distributed_database', 'class': 'list[PatchInstruction]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'items': {'module': 'distributed_database', 'class': 'list[PatchInstruction]'}}) +@cli_util.wrap_exceptions +def patch_distributed_database_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_private_endpoint_id, items, if_match): + + if isinstance(distributed_database_private_endpoint_id, six.string_types) and len(distributed_database_private_endpoint_id.strip()) == 0: + raise click.UsageError('Parameter --distributed-database-private-endpoint-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if items is not None: + _details['items'] = cli_util.parse_json_parameter("items", items) + + client = cli_util.build_client('distributed_database', 'distributed_db_private_endpoint_service', ctx) + result = client.patch_distributed_database_private_endpoint( + distributed_database_private_endpoint_id=distributed_database_private_endpoint_id, + patch_distributed_database_private_endpoint_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.reinstate_proxy_instance.command_name', 'reinstate-proxy-instance'), help=u"""Reinstates the proxy instance associated with the DistributedDatabasePrivateEndpoint. \n[Command Reference](reinstateProxyInstance)""") @cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") @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.""") @@ -373,7 +443,6 @@ def reinstate_proxy_instance(ctx, from_json, wait_for_state, max_wait_seconds, w @cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") @cli_util.option('--display-name', help=u"""Display name for DistributedDatabasePrivateEndpoint""") @cli_util.option('--description', help=u"""DistributedDatabasePrivateEndpoint description.""") -@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The OCIDs of the network security groups that the private endpoint belongs to.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @@ -381,18 +450,18 @@ def reinstate_proxy_instance(ctx, from_json, wait_for_state, max_wait_seconds, w @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state CREATING 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'nsg-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'nsg-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabasePrivateEndpoint'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabasePrivateEndpoint'}) @cli_util.wrap_exceptions -def update_distributed_database_private_endpoint(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_private_endpoint_id, display_name, description, nsg_ids, freeform_tags, defined_tags, if_match): +def update_distributed_database_private_endpoint(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_private_endpoint_id, display_name, description, freeform_tags, defined_tags, if_match): if isinstance(distributed_database_private_endpoint_id, six.string_types) and len(distributed_database_private_endpoint_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-private-endpoint-id cannot be whitespace or empty string') if not force: - if nsg_ids or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to nsg-ids and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -408,9 +477,6 @@ def update_distributed_database_private_endpoint(ctx, from_json, force, wait_for if description is not None: _details['description'] = description - if nsg_ids is not None: - _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) - if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) diff --git a/services/distributed_database/src/oci_cli_distributed_db_service/__init__.py b/services/distributed_database/src/oci_cli_distributed_db_service/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_service/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_db_service/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_db_service/generated/__init__.py b/services/distributed_database/src/oci_cli_distributed_db_service/generated/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_service/generated/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_db_service/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_db_service/generated/client_mappings.py b/services/distributed_database/src/oci_cli_distributed_db_service/generated/client_mappings.py index 43ed3411e..49fca1a06 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_service/generated/client_mappings.py +++ b/services/distributed_database/src/oci_cli_distributed_db_service/generated/client_mappings.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 import oci from oci_cli.cli_clients import CLIENT_MAP diff --git a/services/distributed_database/src/oci_cli_distributed_db_service/generated/distributeddbservice_cli.py b/services/distributed_database/src/oci_cli_distributed_db_service/generated/distributeddbservice_cli.py index 987553e02..7cb6c329a 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_service/generated/distributeddbservice_cli.py +++ b/services/distributed_database/src/oci_cli_distributed_db_service/generated/distributeddbservice_cli.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 from __future__ import print_function import click @@ -40,7 +40,7 @@ def distributed_database_group(): @distributed_database_group.command(name=cli_util.override('distributed_db_service.add_distributed_database_gds_control_node.command_name', 'add'), help=u"""Add new Global database services control(GDS CTL) node for the Globally distributed database. \n[Command Reference](addDistributedDatabaseGdsControlNode)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @cli_util.option('--public-ssh-key', required=True, help=u"""The public sshKey for Global database services control(GDS CTL) node.""") @cli_util.option('--subnet-id', help=u"""The [OCID] of the subnet on which the Global database services control(GDS CTL) node should be created.""") @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.""") @@ -106,7 +106,7 @@ def add_distributed_database_gds_control_node(ctx, from_json, wait_for_state, ma @distributed_database_group.command(name=cli_util.override('distributed_db_service.change_distributed_database_compartment.command_name', 'change-compartment'), help=u"""Move the Globally distributed database and its dependent resources to the specified compartment. \n[Command Reference](changeDistributedDatabaseCompartment)""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the resource to.""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -166,7 +166,7 @@ def change_distributed_database_compartment(ctx, from_json, wait_for_state, max_ @distributed_database_group.command(name=cli_util.override('distributed_db_service.change_distributed_db_backup_config.command_name', 'change-distributed-db-backup-config'), help=u"""Change the DbBackupConfig for the Globally distributed database. \n[Command Reference](changeDistributedDbBackupConfig)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @cli_util.option('--db-backup-config', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @@ -226,10 +226,69 @@ def change_distributed_db_backup_config(ctx, from_json, wait_for_state, max_wait cli_util.render_response(result, ctx) +@distributed_database_group.command(name=cli_util.override('distributed_db_service.configure_distributed_database_auto_resource_management.command_name', 'configure-distributed-database-auto-resource-management'), help=u"""Configure autoResourceManagement options for the Globally distributed database. \n[Command Reference](configureDistributedDatabaseAutoResourceManagement)""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") +@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""Flag indicating if autoResourceManagement is enabled or disabled.""") +@cli_util.option('--cool-off-period-in-minutes', type=click.INT, help=u"""Time period to wait for the database to get stable after autoResourceManagement event.""") +@cli_util.option('--max-move-ru-attempts', type=click.INT, help=u"""Maximum number of move replication unit attempts allowed within the configured period per database.""") +@cli_util.option('--max-move-ru-unit', type=custom_types.CliCaseInsensitiveChoice(["HOUR", "DAY"]), help=u"""Time unit applicable to maxMoveRuAttempts.""") +@cli_util.option('--mode', type=custom_types.CliCaseInsensitiveChoice(["AUTOMATIC", "RECOMMENDATION"]), help=u"""Mode of autoResourceManagement execution.""") +@cli_util.option('--action-type', type=custom_types.CliCaseInsensitiveChoice(["MOVE"]), help=u"""The action that will be taken when autoResourceManagement is triggered.""") +@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of notification topic ids [OCIDs] to receive autoResourceManagement events.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--stream-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of stream ids [OCIDs] that receive shard-related telemetry.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'stream-ids': {'module': 'distributed_database', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'stream-ids': {'module': 'distributed_database', 'class': 'list[string]'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabaseAutoResourceManagementDetails'}) +@cli_util.wrap_exceptions +def configure_distributed_database_auto_resource_management(ctx, from_json, distributed_database_id, is_enabled, cool_off_period_in_minutes, max_move_ru_attempts, max_move_ru_unit, mode, action_type, notification_topic_ids, stream_ids, if_match): + + if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: + raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['isEnabled'] = is_enabled + + if cool_off_period_in_minutes is not None: + _details['coolOffPeriodInMinutes'] = cool_off_period_in_minutes + + if max_move_ru_attempts is not None: + _details['maxMoveRuAttempts'] = max_move_ru_attempts + + if max_move_ru_unit is not None: + _details['maxMoveRuUnit'] = max_move_ru_unit + + if mode is not None: + _details['mode'] = mode + + if action_type is not None: + _details['actionType'] = action_type + + if notification_topic_ids is not None: + _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) + + if stream_ids is not None: + _details['streamIds'] = cli_util.parse_json_parameter("stream_ids", stream_ids) + + client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) + result = client.configure_distributed_database_auto_resource_management( + distributed_database_id=distributed_database_id, + configure_distributed_database_auto_resource_management_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + @distributed_database_group.command(name=cli_util.override('distributed_db_service.configure_distributed_database_gsms.command_name', 'configure-distributed-database-gsms'), help=u"""Configure new Global Service Manager(GSM aka shard manager) instances for the Globally distributed database. \n[Command Reference](configureDistributedDatabaseGsms)""") @cli_util.option('--old-gsm-names', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Names of old global service manager(GSM) instances corresponding to which new GSM instances need to be configured.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--is-latest-gsm-image', required=True, type=click.BOOL, help=u"""Flag to indicate if new global service manager(GSM) instances shall use latest image or re-use image used by existing GSM instances.""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -290,7 +349,7 @@ def configure_distributed_database_gsms(ctx, from_json, wait_for_state, max_wait @distributed_database_group.command(name=cli_util.override('distributed_db_service.configure_distributed_database_sharding.command_name', 'configure-distributed-database-sharding'), help=u"""Once all components of Globally distributed database are provisioned, and signed GSM certificates are successfully uploaded, this api shall be invoked to configure sharding on the Globally distributed database. Note that this 'ConfigureSharding' API also needs to be invoked after successfully adding a new shard to the Globally distributed database using PATCH api. If this API is not invoked after successfully adding a new shard, then that new shard will not be a participant in sharding topology of the Globally distributed database. \n[Command Reference](configureDistributedDatabaseSharding)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @cli_util.option('--is-rebalance-required', type=click.BOOL, help=u"""The flag to indicate whether chunks need to be re-balanced. This flag is not applicable for USER-defined sharding type.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @@ -352,35 +411,47 @@ def configure_distributed_database_sharding(ctx, from_json, wait_for_state, max_ @cli_util.option('--display-name', required=True, help=u"""The display name of the Globally distributed database.""") @cli_util.option('--database-version', required=True, help=u"""Oracle Database version for the shards and catalog used in Globally distributed database.""") @cli_util.option('--prefix', required=True, help=u"""Unique name prefix for the Globally distributed databases. Only alpha-numeric values are allowed. First character has to be a letter followed by any combination of letter and number.""") -@cli_util.option('--private-endpoint-ids', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] of the private endpoint associated with Globally distributed autonomous database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--sharding-method', required=True, type=custom_types.CliCaseInsensitiveChoice(["USER", "SYSTEM"]), help=u"""Sharding Methods for the Globally distributed database.""") +@cli_util.option('--private-endpoint-ids', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] of the private endpoints associated with the Globally distributed database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--character-set', required=True, help=u"""The character set for the database.""") @cli_util.option('--ncharacter-set', required=True, help=u"""The national character set for the database.""") @cli_util.option('--listener-port', required=True, type=click.INT, help=u"""The listener port number for the Globally distributed database. The listener port number has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database.""") @cli_util.option('--ons-port-local', required=True, type=click.INT, help=u"""The ons local port number for the Globally distributed database. The onsPortLocal has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database.""") @cli_util.option('--ons-port-remote', required=True, type=click.INT, help=u"""The ons remote port number for the Globally distributed database. The onsPortRemote has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database.""") -@cli_util.option('--db-deployment-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["EXADB_XS"]), help=u"""The distributed database deployment type.""") -@cli_util.option('--shard-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of shards for the Globally distributed database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--catalog-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of catalog for the Globally distributed database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--chunks', type=click.INT, help=u"""Number of chunks in a shardspace. The value of chunks must be greater than 2 times the size of the largest shardgroup in any shardspace. Chunks is required to be provided for distributed databases being created with SYSTEM shardingMethod. For USER shardingMethod, chunks should not be set in create payload.""") -@cli_util.option('--listener-port-tls', type=click.INT, help=u"""The TLS listener port number for the Globally distributed database. The TLS listener port number has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database. For BASE_DB and EXADB_XS based distributed databases, tls is not supported hence the listenerPortTls is not needed to be provided in create payload.""") -@cli_util.option('--scan-listener-port', type=click.INT, help=u"""The TCP Single Client Access Name (SCAN) port for clusters created for Globally distributed database. The scanListenerPort number should only be provided if shard and catalog have source type NEW_VAULT_AND_CLUSTER. If shard and catalog have source type NEW_VAULT_AND_CLUSTER and scanListenerPort is not provided then the scanListenerPort will default to value 1521.""") -@cli_util.option('--replication-method', type=custom_types.CliCaseInsensitiveChoice(["RAFT", "DG"]), help=u"""The Replication method for Globally distributed database. Use RAFT for Raft based replication. With RAFT replication, shards cannot have peers details set on them. In case shards need to have peers, please do not set RAFT replicationMethod. For all non RAFT replication cases (with or without peers), please set replicationMethod as DG or do not set any value for replicationMethod.""") -@cli_util.option('--replication-factor', type=click.INT, help=u"""The Replication factor for RAFT replication based Globally distributed database. Currently supported values are 3, 5 and 7.""") -@cli_util.option('--replication-unit', type=click.INT, help=u"""The replication unit count for RAFT based distributed database. For RAFT replication based Globally distributed database, the value should be at least twice the number of shards.""") +@cli_util.option('--catalog-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of catalog details for the Globally distributed database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] for the notification topics associated with the globally distributed database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--listener-port-tls', type=click.INT, help=u"""The TLS listener port number for the Globally distributed database. The TLS listener port number has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database. For EXADB based distributed databases, tls is not supported hence the listenerPortTls is not needed to be provided in create payload.""") +@cli_util.option('--scan-listener-port', type=click.INT, help=u"""TCP SCAN listener port for new clusters to be created. Applicable only when shard and catalog source types are XS_NEW_VAULT_AND_CLUSTER or XS_NEW_CLUSTER. Defaults to 1521 when not provided.""") +@cli_util.option('--system-chunk-count', type=click.INT, help=u"""Count of chunks associated with system raft clusters or system data guard databases.""") +@cli_util.option('--system-raft-replication-unit-count', type=click.INT, help=u"""Number of replication units associated with system raft clusters.""") +@cli_util.option('--composite-raft-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of composite raft shards. + +This option is a JSON list with items of type CreateCompositeRaftShardSpaceDetails. For documentation on CreateCompositeRaftShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/CreateCompositeRaftShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--composite-data-guard-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of composite data guard shard spaces. + +This option is a JSON list with items of type CreateCompositeDataGuardShardSpaceDetails. For documentation on CreateCompositeDataGuardShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/CreateCompositeDataGuardShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--system-raft-clusters', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of system raft clusters. + +This option is a JSON list with items of type CreateSystemRaftClusterDetails. For documentation on CreateSystemRaftClusterDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/CreateSystemRaftClusterDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--system-data-guard-databases', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--user-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of user defined shard spaces. + +This option is a JSON list with items of type CreateUserShardSpaceDetails. For documentation on CreateUserShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/CreateUserShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--gsm-ssh-public-key', help=u"""The SSH public key for Global service manager instances.""") @cli_util.option('--db-backup-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--vcn-nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of network security group (NSG) details to be associated with the distributed database. + +This option is a JSON list with items of type VcnNsgIdsDetails. For documentation on VcnNsgIdsDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/VcnNsgIdsDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @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.""") -@json_skeleton_utils.get_cli_json_input_option({'private-endpoint-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'shard-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedDatabaseShardDetails]'}, 'catalog-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedDatabaseCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database', 'class': 'DistributedDbBackupConfig'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'private-endpoint-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'composite-raft-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateCompositeRaftShardSpaceDetails]'}, 'composite-data-guard-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateCompositeDataGuardShardSpaceDetails]'}, 'system-raft-clusters': {'module': 'distributed_database', 'class': 'list[CreateSystemRaftClusterDetails]'}, 'system-data-guard-databases': {'module': 'distributed_database', 'class': 'CreateSystemDataGuardDatabaseDetails'}, 'user-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateUserShardSpaceDetails]'}, 'catalog-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedDatabaseCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database', 'class': 'DistributedDbBackupConfig'}, 'vcn-nsg-ids': {'module': 'distributed_database', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'private-endpoint-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'shard-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedDatabaseShardDetails]'}, 'catalog-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedDatabaseCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database', 'class': 'DistributedDbBackupConfig'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabase'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'private-endpoint-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'composite-raft-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateCompositeRaftShardSpaceDetails]'}, 'composite-data-guard-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateCompositeDataGuardShardSpaceDetails]'}, 'system-raft-clusters': {'module': 'distributed_database', 'class': 'list[CreateSystemRaftClusterDetails]'}, 'system-data-guard-databases': {'module': 'distributed_database', 'class': 'CreateSystemDataGuardDatabaseDetails'}, 'user-shard-spaces': {'module': 'distributed_database', 'class': 'list[CreateUserShardSpaceDetails]'}, 'catalog-details': {'module': 'distributed_database', 'class': 'list[CreateDistributedDatabaseCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database', 'class': 'DistributedDbBackupConfig'}, 'vcn-nsg-ids': {'module': 'distributed_database', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabase'}) @cli_util.wrap_exceptions -def create_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, database_version, prefix, private_endpoint_ids, sharding_method, character_set, ncharacter_set, listener_port, ons_port_local, ons_port_remote, db_deployment_type, shard_details, catalog_details, chunks, listener_port_tls, scan_listener_port, replication_method, replication_factor, replication_unit, gsm_ssh_public_key, db_backup_config, freeform_tags, defined_tags): +def create_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, database_version, prefix, private_endpoint_ids, character_set, ncharacter_set, listener_port, ons_port_local, ons_port_remote, catalog_details, notification_topic_ids, listener_port_tls, scan_listener_port, system_chunk_count, system_raft_replication_unit_count, composite_raft_shard_spaces, composite_data_guard_shard_spaces, system_raft_clusters, system_data_guard_databases, user_shard_spaces, gsm_ssh_public_key, db_backup_config, vcn_nsg_ids, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -391,18 +462,15 @@ def create_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds _details['databaseVersion'] = database_version _details['prefix'] = prefix _details['privateEndpointIds'] = cli_util.parse_json_parameter("private_endpoint_ids", private_endpoint_ids) - _details['shardingMethod'] = sharding_method _details['characterSet'] = character_set _details['ncharacterSet'] = ncharacter_set _details['listenerPort'] = listener_port _details['onsPortLocal'] = ons_port_local _details['onsPortRemote'] = ons_port_remote - _details['dbDeploymentType'] = db_deployment_type - _details['shardDetails'] = cli_util.parse_json_parameter("shard_details", shard_details) _details['catalogDetails'] = cli_util.parse_json_parameter("catalog_details", catalog_details) - if chunks is not None: - _details['chunks'] = chunks + if notification_topic_ids is not None: + _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) if listener_port_tls is not None: _details['listenerPortTls'] = listener_port_tls @@ -410,14 +478,26 @@ def create_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds if scan_listener_port is not None: _details['scanListenerPort'] = scan_listener_port - if replication_method is not None: - _details['replicationMethod'] = replication_method + if system_chunk_count is not None: + _details['systemChunkCount'] = system_chunk_count + + if system_raft_replication_unit_count is not None: + _details['systemRaftReplicationUnitCount'] = system_raft_replication_unit_count + + if composite_raft_shard_spaces is not None: + _details['compositeRaftShardSpaces'] = cli_util.parse_json_parameter("composite_raft_shard_spaces", composite_raft_shard_spaces) - if replication_factor is not None: - _details['replicationFactor'] = replication_factor + if composite_data_guard_shard_spaces is not None: + _details['compositeDataGuardShardSpaces'] = cli_util.parse_json_parameter("composite_data_guard_shard_spaces", composite_data_guard_shard_spaces) - if replication_unit is not None: - _details['replicationUnit'] = replication_unit + if system_raft_clusters is not None: + _details['systemRaftClusters'] = cli_util.parse_json_parameter("system_raft_clusters", system_raft_clusters) + + if system_data_guard_databases is not None: + _details['systemDataGuardDatabases'] = cli_util.parse_json_parameter("system_data_guard_databases", system_data_guard_databases) + + if user_shard_spaces is not None: + _details['userShardSpaces'] = cli_util.parse_json_parameter("user_shard_spaces", user_shard_spaces) if gsm_ssh_public_key is not None: _details['gsmSshPublicKey'] = gsm_ssh_public_key @@ -425,6 +505,9 @@ def create_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds if db_backup_config is not None: _details['dbBackupConfig'] = cli_util.parse_json_parameter("db_backup_config", db_backup_config) + if vcn_nsg_ids is not None: + _details['vcnNsgIds'] = cli_util.parse_json_parameter("vcn_nsg_ids", vcn_nsg_ids) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -466,9 +549,8 @@ def create_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds cli_util.render_response(result, ctx) -@distributed_database_group.command(name=cli_util.override('distributed_db_service.delete_distributed_database.command_name', 'delete'), help=u"""Terminate the given Globally distributed databases. For an EXADB_XS based distributed database, if the parameter mustDeleteInfra is set to true, then the VmCluster and DbStorageVault associated with each shard and catalog will also be deleted. \n[Command Reference](deleteDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") -@cli_util.option('--must-delete-infra', type=click.BOOL, help=u"""The flag to indicate if infra like VmCluster & DbStorageVault associated with the resource should be deleted.""") +@distributed_database_group.command(name=cli_util.override('distributed_db_service.delete_distributed_database.command_name', 'delete'), help=u"""Terminate the given Globally distributed database. \n[Command Reference](deleteDistributedDatabase)""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @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.""") @cli_util.confirm_delete_option @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @@ -479,14 +561,12 @@ def create_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def delete_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, must_delete_infra, if_match): +def delete_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') kwargs = {} - if must_delete_infra is not None: - kwargs['must_delete_infra'] = must_delete_infra if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -525,113 +605,8 @@ def delete_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds cli_util.render_response(result, ctx) -@distributed_database_group.command(name=cli_util.override('distributed_db_service.download_distributed_database_gsm_certificate_signing_request.command_name', 'download-distributed-database-gsm-certificate-signing-request'), help=u"""Generate the common certificate signing request for GSMs. Download the .csr file from API response. Users can use this .csr file to generate the CA signed certificate, and as a next step use 'uploadSignedCertificateAndGenerateWallet' API to upload the CA signed certificate to GSM, and generate wallets for the GSM instances of the Globally distributed database. \n[Command Reference](downloadDistributedDatabaseGsmCertificateSigningRequest)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") -@cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def download_distributed_database_gsm_certificate_signing_request(ctx, from_json, file, distributed_database_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) - result = client.download_distributed_database_gsm_certificate_signing_request( - distributed_database_id=distributed_database_id, - **kwargs - ) - - # If outputting to stdout we don't want to print a progress bar because it will get mixed up with the output - # Also we need a non-zero Content-Length in order to display a meaningful progress bar - bar = None - if hasattr(file, 'name') and file.name != '' and 'Content-Length' in result.headers: - content_length = int(result.headers['Content-Length']) - if content_length > 0: - bar = click.progressbar(length=content_length, label='Downloading file') - - try: - if bar: - bar.__enter__() - - # TODO: Make the download size a configurable option - # use decode_content=True to automatically unzip service responses (this should be overridden for object storage) - for chunk in result.data.raw.stream(cli_constants.MEBIBYTE, decode_content=True): - if bar: - bar.update(len(chunk)) - file.write(chunk) - finally: - if bar: - bar.render_finish() - file.close() - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.generate_distributed_database_gsm_certificate_signing_request.command_name', 'generate-distributed-database-gsm-certificate-signing-request'), help=u"""Generate the certificate signing request for GSM instances of the Globally distributed database. Once certificate signing request is generated, then customers can download the certificate signing request using 'downloadGsmCertificateSigningRequest' api call. \n[Command Reference](generateDistributedDatabaseGsmCertificateSigningRequest)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") -@cli_util.option('--ca-bundle-id', required=True, help=u"""The ID of the Ca Bundle.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def generate_distributed_database_gsm_certificate_signing_request(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, ca_bundle_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) - result = client.generate_distributed_database_gsm_certificate_signing_request( - distributed_database_id=distributed_database_id, - ca_bundle_id=ca_bundle_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - @distributed_database_group.command(name=cli_util.override('distributed_db_service.generate_distributed_database_wallet.command_name', 'generate-distributed-database-wallet'), help=u"""Generate the wallet associated with Globally distributed database. \n[Command Reference](generateDistributedDatabaseWallet)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @cli_util.option('--password', required=True, help=u"""The password to encrypt the keys inside the wallet. The password must be at least 8 characters long and must include at least 1 letter and either 1 numeric character or 1 special character.""") @cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") @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.""") @@ -685,8 +660,8 @@ def generate_distributed_database_wallet(ctx, from_json, file, distributed_datab @distributed_database_group.command(name=cli_util.override('distributed_db_service.get_distributed_database.command_name', 'get'), help=u"""Gets the details of the Globally distributed database identified by given id. \n[Command Reference](getDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") -@cli_util.option('--metadata', help=u"""Comma separated names of argument corresponding to which metadata need to be retrived.""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") +@cli_util.option('--metadata', help=u"""Comma-separated argument names for which metadata should be retrieved.""") @cli_util.option('--if-none-match', help=u"""For conditional requests. In the GET call for a resource, set the `If-None-Match` header to the value of the ETag from a previous GET (or POST or PUT) response for that resource. The server will return with either a 304 Not Modified response if the resource has not changed, or a 200 OK response with the updated representation.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @@ -713,7 +688,7 @@ def get_distributed_database(ctx, from_json, distributed_database_id, metadata, @distributed_database_group.command(name=cli_util.override('distributed_db_service.get_distributed_database_raft_metric.command_name', 'get-distributed-database-raft-metric'), help=u"""Operation to retrieve RAFT metrics for the Globally distributed database. If the Globally distributed database is not RAFT based then empty response is returned from the API. \n[Command Reference](getDistributedDatabaseRaftMetric)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context @@ -734,17 +709,44 @@ def get_distributed_database_raft_metric(ctx, from_json, distributed_database_id cli_util.render_response(result, ctx) +@distributed_database_group.command(name=cli_util.override('distributed_db_service.get_distributed_database_ru_change_log.command_name', 'get-distributed-database-ru-change-log'), help=u"""Operation to retrieve move RU invocation history and status for the Globally distributed database. Results are ordered by created timestamp in descending order. \n[Command Reference](getDistributedDatabaseRuChangeLog)""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") +@cli_util.option('--source-shard-name', help=u"""The source shard name to filter RU change log entries.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabaseRuChangeLog'}) +@cli_util.wrap_exceptions +def get_distributed_database_ru_change_log(ctx, from_json, distributed_database_id, source_shard_name): + + if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: + raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') + + kwargs = {} + if source_shard_name is not None: + kwargs['source_shard_name'] = source_shard_name + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) + result = client.get_distributed_database_ru_change_log( + distributed_database_id=distributed_database_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @distributed_database_collection_group.command(name=cli_util.override('distributed_db_service.list_distributed_databases.command_name', 'list-distributed-databases'), help=u"""List of Globally distributed databases. \n[Command Reference](listDistributedDatabases)""") @cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""When set to true, returns resources in the specified compartment and in all of its child compartments recursively. Defaults to false.""") @cli_util.option('--private-endpoint-id', help=u"""A filter to return only resources that are associated with the given privateEndpointId.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), help=u"""A filter to return only resources whose lifecycleState matches the specified value.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "timeUpdated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--is-auto-resource-management-enabled', type=click.BOOL, help=u"""A filter to return only resources where autoResourceManagement is enabled when set to `true`, or disabled when set to `false`. If omitted, no autoResourceManagement-based filtering is applied.""") @cli_util.option('--display-name', help=u"""A filter to return only Globally distributed databases that match the entire name given. The match is not case sensitive.""") -@cli_util.option('--db-deployment-type', type=custom_types.CliCaseInsensitiveChoice(["EXADB_XS"]), help=u"""A filter to return only resources their dbDeploymentType matches the given dbDeploymentType.""") -@cli_util.option('--metadata', help=u"""Comma separated names of argument corresponding to which metadata need to be retrived.""") +@cli_util.option('--db-deployment-type', help=u"""A filter to return only resources whose dbDeploymentType matches the specified value.""") +@cli_util.option('--metadata', help=u"""Comma-separated argument names for which metadata should be retrieved.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -752,12 +754,14 @@ def get_distributed_database_raft_metric(ctx, from_json, distributed_database_id @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabaseCollection'}) @cli_util.wrap_exceptions -def list_distributed_databases(ctx, from_json, all_pages, page_size, compartment_id, private_endpoint_id, lifecycle_state, limit, page, sort_order, sort_by, display_name, db_deployment_type, metadata): +def list_distributed_databases(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, private_endpoint_id, lifecycle_state, limit, page, sort_order, sort_by, is_auto_resource_management_enabled, display_name, db_deployment_type, metadata): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') kwargs = {} + if compartment_id_in_subtree is not None: + kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree if private_endpoint_id is not None: kwargs['private_endpoint_id'] = private_endpoint_id if lifecycle_state is not None: @@ -770,6 +774,8 @@ def list_distributed_databases(ctx, from_json, all_pages, page_size, compartment kwargs['sort_order'] = sort_order if sort_by is not None: kwargs['sort_by'] = sort_by + if is_auto_resource_management_enabled is not None: + kwargs['is_auto_resource_management_enabled'] = is_auto_resource_management_enabled if display_name is not None: kwargs['display_name'] = display_name if db_deployment_type is not None: @@ -804,7 +810,7 @@ def list_distributed_databases(ctx, from_json, all_pages, page_size, compartment @distributed_database_group.command(name=cli_util.override('distributed_db_service.move_distributed_database_replication_unit.command_name', 'move-distributed-database-replication-unit'), help=u"""Move the replication units for RAFT based globally distributed database from source shard to destination shard. \n[Command Reference](moveDistributedDatabaseReplicationUnit)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @cli_util.option('--source-shard-name', required=True, help=u"""The name of the source shard from which to move the chunks out to other shards.""") @cli_util.option('--destination-shard-name', help=u"""The name of the destination shard to which the chunks moved out from source shard should be relocate to.""") @cli_util.option('--replication-units', type=custom_types.CLI_COMPLEX_TYPE, help=u"""For RAFT databases please provide replication unit numbers to be moved from source shard to destination shard.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -872,11 +878,11 @@ def move_distributed_database_replication_unit(ctx, from_json, wait_for_state, m cli_util.render_response(result, ctx) -@distributed_database_group.command(name=cli_util.override('distributed_db_service.patch_distributed_database.command_name', 'patch'), help=u"""Patch operation to add, remove or update shards to the Globally distributed database topology. In single patch operation, multiple shards can be either added, or removed or updated. Combination of inserts, update and remove in single operation is not allowed. For an EXADB_XS based distributed database, removing a shard with the parameter mustDeleteInfra set to true will also delete the associated VmCluster and DbStorageVault. \n[Command Reference](patchDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@distributed_database_group.command(name=cli_util.override('distributed_db_service.patch_distributed_database.command_name', 'patch'), help=u"""Patch operation to add, remove or update shards to the Globally distributed database topology. In single patch operation, multiple shards can be either added, or removed or updated. Combination of inserts, update and remove in single operation is not allowed. \n[Command Reference](patchDistributedDatabase)""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @cli_util.option('--items', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of patch instructions. -This option is a JSON list with items of type PatchInstruction. For documentation on PatchInstruction please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20250101/datatypes/PatchInstruction.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +This option is a JSON list with items of type PatchInstruction. For documentation on PatchInstruction please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/PatchInstruction.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -938,9 +944,8 @@ def patch_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, @distributed_database_group.command(name=cli_util.override('distributed_db_service.recreate_failed_distributed_database_resource.command_name', 'recreate-failed-distributed-database-resource'), help=u"""Recreate the failed resource for the Globally Distributed Database. \n[Command Reference](recreateFailedDistributedDatabaseResource)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") -@cli_util.option('--resource-name', required=True, help=u"""Specify the name of Shard, Catalog or GSM.""") -@cli_util.option('--shard-group', help=u"""The shardGroup name example Shardgroupa, Shardgroupb.""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") +@cli_util.option('--resource-name', required=True, help=u"""Specify the name of the shard, catalog, or GSM.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -950,14 +955,12 @@ def patch_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def recreate_failed_distributed_database_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, resource_name, shard_group, if_match): +def recreate_failed_distributed_database_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, resource_name, if_match): if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') kwargs = {} - if shard_group is not None: - kwargs['shard_group'] = shard_group if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -998,17 +1001,18 @@ def recreate_failed_distributed_database_resource(ctx, from_json, wait_for_state @distributed_database_group.command(name=cli_util.override('distributed_db_service.rotate_distributed_database_passwords.command_name', 'rotate-distributed-database-passwords'), help=u"""Rotate the gsmuser and gsmcatuser passwords for shards and catalog of the Globally distributed database. This operation will also remove GdsCtlNodes if present. \n[Command Reference](rotateDistributedDatabasePasswords)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") +@cli_util.option('--database-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of shard or catalog password rotation details.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @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.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'database-details': {'module': 'distributed_database', 'class': 'list[RotateDistributedDatabaseDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'database-details': {'module': 'distributed_database', 'class': 'list[RotateDistributedDatabaseDetails]'}}) @cli_util.wrap_exceptions -def rotate_distributed_database_passwords(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): +def rotate_distributed_database_passwords(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, database_details, if_match): if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') @@ -1017,9 +1021,14 @@ def rotate_distributed_database_passwords(ctx, from_json, wait_for_state, max_wa if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['databaseDetails'] = cli_util.parse_json_parameter("database_details", database_details) + client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) result = client.rotate_distributed_database_passwords( distributed_database_id=distributed_database_id, + rotate_distributed_database_passwords_details=_details, **kwargs ) if wait_for_state: @@ -1052,8 +1061,8 @@ def rotate_distributed_database_passwords(ctx, from_json, wait_for_state, max_wa cli_util.render_response(result, ctx) -@distributed_database_group.command(name=cli_util.override('distributed_db_service.start_distributed_database.command_name', 'start'), help=u"""Start the shards, catalog and GSMs of Globally distributed database. \n[Command Reference](startDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@distributed_database_group.command(name=cli_util.override('distributed_db_service.scale_distributed_database_gsms.command_name', 'scale-distributed-database-gsms'), help=u"""Scale global service manager(GSM aka shard manager) instances for the Globally distributed database. \n[Command Reference](scaleDistributedDatabaseGsms)""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1063,7 +1072,7 @@ def rotate_distributed_database_passwords(ctx, from_json, wait_for_state, max_wa @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def start_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): +def scale_distributed_database_gsms(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') @@ -1072,9 +1081,13 @@ def start_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) - result = client.start_distributed_database( + result = client.scale_distributed_database_gsms( distributed_database_id=distributed_database_id, + scale_distributed_database_gsms_details=_details, **kwargs ) if wait_for_state: @@ -1107,8 +1120,8 @@ def start_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) -@distributed_database_group.command(name=cli_util.override('distributed_db_service.stop_distributed_database.command_name', 'stop'), help=u"""Stop the shards, catalog and GSM instances for the Globally distributed database. \n[Command Reference](stopDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@distributed_database_group.command(name=cli_util.override('distributed_db_service.start_distributed_database.command_name', 'start'), help=u"""Start the shards, catalog, GSMs and GDSCTL instances of Globally distributed database. \n[Command Reference](startDistributedDatabase)""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1118,7 +1131,7 @@ def start_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def stop_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): +def start_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') @@ -1128,7 +1141,7 @@ def stop_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) - result = client.stop_distributed_database( + result = client.start_distributed_database( distributed_database_id=distributed_database_id, **kwargs ) @@ -1162,94 +1175,85 @@ def stop_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) -@distributed_database_group.command(name=cli_util.override('distributed_db_service.update_distributed_database.command_name', 'update'), help=u"""Updates the configuration of the Globally distributed database. \n[Command Reference](updateDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") -@cli_util.option('--display-name', help=u"""Display name of the Globally distributed database.""") -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@distributed_database_group.command(name=cli_util.override('distributed_db_service.stop_distributed_database.command_name', 'stop'), help=u"""Stop the shards, catalog, GSMs and GDSCTL instances for the Globally distributed database. \n[Command Reference](stopDistributedDatabase)""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @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.""") -@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state CREATING 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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabase'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def update_distributed_database(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, display_name, freeform_tags, defined_tags, if_match): +def stop_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - if not force: - if freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): - ctx.abort() kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if display_name is not None: - _details['displayName'] = display_name - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) - result = client.update_distributed_database( + result = client.stop_distributed_database( distributed_database_id=distributed_database_id, - update_distributed_database_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_distributed_database') and callable(getattr(client, 'get_distributed_database')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_distributed_database(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@distributed_database_group.command(name=cli_util.override('distributed_db_service.upload_distributed_database_signed_certificate_and_generate_wallet.command_name', 'upload-distributed-database-signed-certificate-and-generate-wallet'), help=u"""Upload the CA signed certificate to the GSM instances and generate wallets for GSM instances of the Globally distributed database. Customer shall provide the CA signed certificate key details by adding the certificate in request body. \n[Command Reference](uploadDistributedDatabaseSignedCertificateAndGenerateWallet)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") -@cli_util.option('--ca-signed-certificate', required=True, help=u"""The CA signed certificate key.""") +@distributed_database_group.command(name=cli_util.override('distributed_db_service.update_distributed_database.command_name', 'update'), help=u"""Updates the configuration of the Globally distributed database. \n[Command Reference](updateDistributedDatabase)""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") +@cli_util.option('--display-name', help=u"""Display name of the Globally distributed database.""") +@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] for the notification topics associated with the globally distributed database. Pass an empty list (`[]`) to remove existing notification topics (set `notificationTopicIds` to empty).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state CREATING 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.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-topic-ids': {'module': 'distributed_database', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database', 'class': 'DistributedDatabase'}) @cli_util.wrap_exceptions -def upload_distributed_database_signed_certificate_and_generate_wallet(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, ca_signed_certificate, if_match): +def update_distributed_database(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, display_name, notification_topic_ids, freeform_tags, defined_tags, if_match): if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') + if not force: + if notification_topic_ids or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to notification-topic-ids and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() kwargs = {} if if_match is not None: @@ -1257,49 +1261,54 @@ def upload_distributed_database_signed_certificate_and_generate_wallet(ctx, from kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['caSignedCertificate'] = ca_signed_certificate + + if display_name is not None: + _details['displayName'] = display_name + + if notification_topic_ids is not None: + _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) client = cli_util.build_client('distributed_database', 'distributed_db_service', ctx) - result = client.upload_distributed_database_signed_certificate_and_generate_wallet( + result = client.update_distributed_database( distributed_database_id=distributed_database_id, - upload_distributed_database_signed_certificate_and_generate_wallet_details=_details, + update_distributed_database_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_distributed_database') and callable(getattr(client, 'get_distributed_database')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_distributed_database(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) @distributed_database_group.command(name=cli_util.override('distributed_db_service.validate_distributed_database_network.command_name', 'validate-distributed-database-network'), help=u"""Validate the network connectivity between components of the globally distributed database. \n[Command Reference](validateDistributedDatabaseNetwork)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier""") +@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") @cli_util.option('--is-surrogate', type=click.BOOL, help=u"""Determines the surrogates check. Default is true.""") -@cli_util.option('--resource-name', help=u"""Specify the name of shard or catalog.""") -@cli_util.option('--shard-group', help=u"""The shardGroup name example Shardgroupa, Shardgroupb.""") @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.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") @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.""") @@ -1309,7 +1318,7 @@ def upload_distributed_database_signed_certificate_and_generate_wallet(ctx, from @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def validate_distributed_database_network(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, is_surrogate, resource_name, shard_group, if_match): +def validate_distributed_database_network(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, is_surrogate, if_match): if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') @@ -1317,10 +1326,6 @@ def validate_distributed_database_network(ctx, from_json, wait_for_state, max_wa kwargs = {} if is_surrogate is not None: kwargs['is_surrogate'] = is_surrogate - if resource_name is not None: - kwargs['resource_name'] = resource_name - if shard_group is not None: - kwargs['shard_group'] = shard_group if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) diff --git a/services/distributed_database/src/oci_cli_distributed_db_work_request_service/__init__.py b/services/distributed_database/src/oci_cli_distributed_db_work_request_service/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_work_request_service/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_db_work_request_service/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/__init__.py b/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/__init__.py +++ b/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/client_mappings.py b/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/client_mappings.py index 818fdd2cf..fce64be63 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/client_mappings.py +++ b/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/client_mappings.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 import oci from oci_cli.cli_clients import CLIENT_MAP diff --git a/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/distributeddbworkrequestservice_cli.py b/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/distributeddbworkrequestservice_cli.py index 2237c57da..1547dde2b 100644 --- a/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/distributeddbworkrequestservice_cli.py +++ b/services/distributed_database/src/oci_cli_distributed_db_work_request_service/generated/distributeddbworkrequestservice_cli.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 from __future__ import print_function import click @@ -72,7 +72,7 @@ def get_work_request(ctx, from_json, work_request_id): @cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeAccepted is descending.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timestamp"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timestamp is descending.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @@ -129,7 +129,7 @@ def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_ @cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeAccepted is descending.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timestamp"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timestamp is descending.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") diff --git a/services/distributed_database/tests/__init__.py b/services/distributed_database/tests/__init__.py index efe31a955..7293131c0 100644 --- a/services/distributed_database/tests/__init__.py +++ b/services/distributed_database/tests/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20250101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/distributedautonomousdbservice_cli.py b/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/distributedautonomousdbservice_cli.py deleted file mode 100644 index b7a38fd49..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/distributedautonomousdbservice_cli.py +++ /dev/null @@ -1,1489 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 - -from __future__ import print_function -import click -import oci # noqa: F401 -import six # noqa: F401 -import sys # noqa: F401 -from oci_cli import cli_constants # noqa: F401 -from oci_cli import cli_util -from oci_cli import json_skeleton_utils -from oci_cli import custom_types # noqa: F401 -from oci_cli.aliasing import CommandGroupWithAlias -from services.distributed_database_v26.src.oci_cli_distributed_database_v26.generated import distributed_database_v26_service_cli - - -@click.command(cli_util.override('distributed_autonomous_db_service.distributed_autonomous_db_service_root_group.command_name', 'distributed-autonomous-db-service'), cls=CommandGroupWithAlias, help=cli_util.override('distributed_autonomous_db_service.distributed_autonomous_db_service_root_group.help', """Use the Globally Distributed Database service APIs to create and manage the Globally distributed databases."""), short_help=cli_util.override('distributed_autonomous_db_service.distributed_autonomous_db_service_root_group.short_help', """Globally Distributed Database""")) -@cli_util.help_option_group -def distributed_autonomous_db_service_root_group(): - pass - - -@click.command(cli_util.override('distributed_autonomous_db_service.distributed_autonomous_database_collection_group.command_name', 'distributed-autonomous-database-collection'), cls=CommandGroupWithAlias, help="""Collection of Globally distributed autonomous databases.""") -@cli_util.help_option_group -def distributed_autonomous_database_collection_group(): - pass - - -@click.command(cli_util.override('distributed_autonomous_db_service.distributed_autonomous_database_group.command_name', 'distributed-autonomous-database'), cls=CommandGroupWithAlias, help="""Globally distributed autonomous database.""") -@cli_util.help_option_group -def distributed_autonomous_database_group(): - pass - - -@click.command(cli_util.override('distributed_autonomous_db_service.distributed_database_group.command_name', 'distributed-database'), cls=CommandGroupWithAlias, help="""Globally distributed database.""") -@cli_util.help_option_group -def distributed_database_group(): - pass - - -distributed_database_v26_service_cli.distributed_database_v26_service_group.add_command(distributed_autonomous_db_service_root_group) -distributed_autonomous_db_service_root_group.add_command(distributed_autonomous_database_collection_group) -distributed_autonomous_db_service_root_group.add_command(distributed_autonomous_database_group) -distributed_autonomous_db_service_root_group.add_command(distributed_database_group) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.add_distributed_autonomous_database_gds_control_node.command_name', 'add'), help=u"""Add new Global database services control(GDS CTL) node for the Globally distributed autonomous database. \n[Command Reference](addDistributedAutonomousDatabaseGdsControlNode)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--public-ssh-key', required=True, help=u"""The public sshKey for Global database services control(GDS CTL) node.""") -@cli_util.option('--subnet-id', help=u"""The [OCID] of the subnet on which the Global database services control(GDS CTL) node should be created.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def add_distributed_autonomous_database_gds_control_node(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, public_ssh_key, subnet_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['publicSshKey'] = public_ssh_key - - if subnet_id is not None: - _details['subnetId'] = subnet_id - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.add_distributed_autonomous_database_gds_control_node( - distributed_autonomous_database_id=distributed_autonomous_database_id, - add_distributed_autonomous_database_gds_control_node_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.change_distributed_autonomous_database_compartment.command_name', 'change-compartment'), help=u"""Move the Globally distributed autonomous database and its dependent resources to the specified compartment. \n[Command Reference](changeDistributedAutonomousDatabaseCompartment)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the resource to.""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def change_distributed_autonomous_database_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['compartmentId'] = compartment_id - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.change_distributed_autonomous_database_compartment( - distributed_autonomous_database_id=distributed_autonomous_database_id, - change_distributed_autonomous_database_compartment_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.change_distributed_autonomous_db_backup_config.command_name', 'change-distributed-autonomous-db-backup-config'), help=u"""Change the DbBackupConfig for the Globally distributed autonomous database. \n[Command Reference](changeDistributedAutonomousDbBackupConfig)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--db-backup-config', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'db-backup-config': {'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDbBackupConfig'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'db-backup-config': {'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDbBackupConfig'}}) -@cli_util.wrap_exceptions -def change_distributed_autonomous_db_backup_config(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, db_backup_config, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['dbBackupConfig'] = cli_util.parse_json_parameter("db_backup_config", db_backup_config) - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.change_distributed_autonomous_db_backup_config( - distributed_autonomous_database_id=distributed_autonomous_database_id, - change_distributed_autonomous_db_backup_config_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.configure_distributed_autonomous_database_auto_resource_management.command_name', 'configure-distributed-autonomous-database-auto-resource-management'), help=u"""Configure autoResourceManagement options for the Globally distributed autonomous database. \n[Command Reference](configureDistributedAutonomousDatabaseAutoResourceManagement)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""Flag indicating if autoResourceManagement is enabled or disabled.""") -@cli_util.option('--cool-off-period-in-minutes', type=click.INT, help=u"""Time period to wait for the database to get stable after autoResourceManagement event.""") -@cli_util.option('--max-move-ru-attempts', type=click.INT, help=u"""Maximum number of move replication unit attempts allowed within the configured period per database.""") -@cli_util.option('--max-move-ru-unit', type=custom_types.CliCaseInsensitiveChoice(["HOUR", "DAY"]), help=u"""Time unit applicable to maxMoveRuAttempts.""") -@cli_util.option('--mode', type=custom_types.CliCaseInsensitiveChoice(["AUTOMATIC", "RECOMMENDATION"]), help=u"""Mode of autoResourceManagement execution.""") -@cli_util.option('--action-type', type=custom_types.CliCaseInsensitiveChoice(["MOVE"]), help=u"""The action that will be taken when autoResourceManagement is triggered.""") -@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of notification topic ids [OCIDs] to receive autoResourceManagement events.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--stream-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of stream ids [OCIDs] that receive shard-related telemetry.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'stream-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'stream-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDatabaseAutoResourceManagementDetails'}) -@cli_util.wrap_exceptions -def configure_distributed_autonomous_database_auto_resource_management(ctx, from_json, distributed_autonomous_database_id, is_enabled, cool_off_period_in_minutes, max_move_ru_attempts, max_move_ru_unit, mode, action_type, notification_topic_ids, stream_ids, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['isEnabled'] = is_enabled - - if cool_off_period_in_minutes is not None: - _details['coolOffPeriodInMinutes'] = cool_off_period_in_minutes - - if max_move_ru_attempts is not None: - _details['maxMoveRuAttempts'] = max_move_ru_attempts - - if max_move_ru_unit is not None: - _details['maxMoveRuUnit'] = max_move_ru_unit - - if mode is not None: - _details['mode'] = mode - - if action_type is not None: - _details['actionType'] = action_type - - if notification_topic_ids is not None: - _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) - - if stream_ids is not None: - _details['streamIds'] = cli_util.parse_json_parameter("stream_ids", stream_ids) - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.configure_distributed_autonomous_database_auto_resource_management( - distributed_autonomous_database_id=distributed_autonomous_database_id, - configure_distributed_autonomous_database_auto_resource_management_details=_details, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.configure_distributed_autonomous_database_gsm_wallet.command_name', 'configure-distributed-autonomous-database-gsm-wallet'), help=u"""Configure wallets on Global Service Manager(GSM) instances for a Globally distributed autonomous database. \n[Command Reference](configureDistributedAutonomousDatabaseGsmWallet)""") -@cli_util.option('--certificate-id', required=True, help=u"""The [OCID] of the cluster certificate.""") -@cli_util.option('--ca-bundle-id', required=True, help=u"""The [OCID] of the ca bundle id.""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def configure_distributed_autonomous_database_gsm_wallet(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, certificate_id, ca_bundle_id, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['certificateId'] = certificate_id - _details['caBundleId'] = ca_bundle_id - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.configure_distributed_autonomous_database_gsm_wallet( - distributed_autonomous_database_id=distributed_autonomous_database_id, - configure_distributed_autonomous_database_gsm_wallet_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.configure_distributed_autonomous_database_gsms.command_name', 'configure-distributed-autonomous-database-gsms'), help=u"""Configure new Global Service Manager(GSM aka shard manager) instances for the Globally distributed autonomous database. \n[Command Reference](configureDistributedAutonomousDatabaseGsms)""") -@cli_util.option('--old-gsm-names', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Names of old global service manager(GSM) instances corresponding to which new GSM instances need to be configured.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--is-latest-gsm-image', required=True, type=click.BOOL, help=u"""Flag to indicate if new global service manager(GSM) instances shall use latest image or re-use image used by existing GSM instances.""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'old-gsm-names': {'module': 'distributed_database_v26', 'class': 'list[string]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'old-gsm-names': {'module': 'distributed_database_v26', 'class': 'list[string]'}}) -@cli_util.wrap_exceptions -def configure_distributed_autonomous_database_gsms(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, old_gsm_names, is_latest_gsm_image, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['oldGsmNames'] = cli_util.parse_json_parameter("old_gsm_names", old_gsm_names) - _details['isLatestGsmImage'] = is_latest_gsm_image - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.configure_distributed_autonomous_database_gsms( - distributed_autonomous_database_id=distributed_autonomous_database_id, - configure_distributed_autonomous_database_gsms_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.configure_distributed_autonomous_database_sharding.command_name', 'configure-distributed-autonomous-database-sharding'), help=u"""Once all components of Globally distributed autonomous database are provisioned, this api shall be invoked to configure sharding on the Globally distributed autonomous database. Note that this 'ConfigureSharding' API also needs to be invoked after successfully adding a new shard to the Globally distributed autonomous database using PATCH api. If this API is not invoked after successfully adding a new shard, then that new shard will not be a participant in sharding topology of the Globally distributed autonomous database. \n[Command Reference](configureDistributedAutonomousDatabaseSharding)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--is-rebalance-required', type=click.BOOL, help=u"""The flag to indicate whether chunks need to be re-balanced. This flag is not applicable for USER-defined sharding type.""") -@cli_util.option('--certificate-id', help=u"""The ID of the cluster certificate.""") -@cli_util.option('--ca-bundle-id', help=u"""The ID of the Ca Bundle.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def configure_distributed_autonomous_database_sharding(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, is_rebalance_required, certificate_id, ca_bundle_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if is_rebalance_required is not None: - kwargs['is_rebalance_required'] = is_rebalance_required - if certificate_id is not None: - kwargs['certificate_id'] = certificate_id - if ca_bundle_id is not None: - kwargs['ca_bundle_id'] = ca_bundle_id - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.configure_distributed_autonomous_database_sharding( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.create_distributed_autonomous_database.command_name', 'create'), help=u"""Creates a Globally distributed autonomous database. \n[Command Reference](createDistributedAutonomousDatabase)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the Globally distributed autonomous database compartment.""") -@cli_util.option('--display-name', required=True, help=u"""The display name of the Globally distributed autonomous database.""") -@cli_util.option('--database-version', required=True, help=u"""Oracle Database version for the shards and catalog used in Globally distributed autonomous database.""") -@cli_util.option('--prefix', required=True, help=u"""Unique name prefix for the Globally distributed autonomous databases. Only alpha-numeric values are allowed. First character has to be a letter followed by any combination of letter and number.""") -@cli_util.option('--private-endpoint-ids', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] of the private endpoint associated with Globally distributed autonomous database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--db-workload-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["OLTP", "DW"]), help=u"""Possible workload types. Currently only OLTP workload type is supported.""") -@cli_util.option('--character-set', required=True, help=u"""The character set for the database.""") -@cli_util.option('--ncharacter-set', required=True, help=u"""The national character set for the database.""") -@cli_util.option('--listener-port', required=True, type=click.INT, help=u"""The listener port number for the Globally distributed autonomous database. The listener port number has to be unique for a customer tenancy across all distributed autonomous databases. Same port number should not be re-used for any other distributed autonomous database.""") -@cli_util.option('--ons-port-local', required=True, type=click.INT, help=u"""Ons local port number for Globally distributed autonomous database. The onsPortLocal has to be unique for a customer tenancy across all distributed autonomous databases. Same port number should not be re-used for any other distributed autonomous database.""") -@cli_util.option('--ons-port-remote', required=True, type=click.INT, help=u"""Ons remote port number for Globally distributed autonomous database. The onsPortRemote has to be unique for a customer tenancy across all distributed autonomous databases. Same port number should not be re-used for any other distributed autonomous database.""") -@cli_util.option('--catalog-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of catalog for the Globally distributed autonomous database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] for the notification topics associated with the globally distributed autonomous database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--listener-port-tls', type=click.INT, help=u"""The TLS listener port number for Globally distributed autonomous database. The TLS listener port number has to be unique for a customer tenancy across all distributed autonomous databases. Same port number should not be re-used for any other distributed autonomous database. The listenerPortTls is mandatory for dedicated infrastructure based distributed autonomous databases.""") -@cli_util.option('--system-chunk-count', type=click.INT, help=u"""Count of chunks associated with system raft clusters or system data guard databases.""") -@cli_util.option('--system-raft-replication-unit-count', type=click.INT, help=u"""Number of replication units associated with system raft clusters.""") -@cli_util.option('--composite-raft-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of composite raft shards. - -This option is a JSON list with items of type CreateAutonomousCompositeRaftShardSpaceDetails. For documentation on CreateAutonomousCompositeRaftShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/CreateAutonomousCompositeRaftShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--composite-data-guard-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of composite data guard shard spaces. - -This option is a JSON list with items of type CreateAutonomousCompositeDataGuardShardSpaceDetails. For documentation on CreateAutonomousCompositeDataGuardShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/CreateAutonomousCompositeDataGuardShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--system-raft-clusters', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of system raft clusters. - -This option is a JSON list with items of type CreateAutonomousSystemRaftClusterDetails. For documentation on CreateAutonomousSystemRaftClusterDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/CreateAutonomousSystemRaftClusterDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--system-data-guard-databases', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--user-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of user defined shard spaces. - -This option is a JSON list with items of type CreateAutonomousUserShardSpaceDetails. For documentation on CreateAutonomousUserShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/CreateAutonomousUserShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--db-backup-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--vcn-nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of network security group (NSG) details to be associated with the distributed autonomous database. - -This option is a JSON list with items of type VcnNsgIdsDetails. For documentation on VcnNsgIdsDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/VcnNsgIdsDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'private-endpoint-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'composite-raft-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousCompositeRaftShardSpaceDetails]'}, 'composite-data-guard-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousCompositeDataGuardShardSpaceDetails]'}, 'system-raft-clusters': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousSystemRaftClusterDetails]'}, 'system-data-guard-databases': {'module': 'distributed_database_v26', 'class': 'CreateAutonomousSystemDataGuardDatabaseDetails'}, 'user-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousUserShardSpaceDetails]'}, 'catalog-details': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDbBackupConfig'}, 'vcn-nsg-ids': {'module': 'distributed_database_v26', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'private-endpoint-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'composite-raft-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousCompositeRaftShardSpaceDetails]'}, 'composite-data-guard-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousCompositeDataGuardShardSpaceDetails]'}, 'system-raft-clusters': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousSystemRaftClusterDetails]'}, 'system-data-guard-databases': {'module': 'distributed_database_v26', 'class': 'CreateAutonomousSystemDataGuardDatabaseDetails'}, 'user-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousUserShardSpaceDetails]'}, 'catalog-details': {'module': 'distributed_database_v26', 'class': 'list[CreateAutonomousCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDbBackupConfig'}, 'vcn-nsg-ids': {'module': 'distributed_database_v26', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDatabase'}) -@cli_util.wrap_exceptions -def create_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, database_version, prefix, private_endpoint_ids, db_workload_type, character_set, ncharacter_set, listener_port, ons_port_local, ons_port_remote, catalog_details, notification_topic_ids, listener_port_tls, system_chunk_count, system_raft_replication_unit_count, composite_raft_shard_spaces, composite_data_guard_shard_spaces, system_raft_clusters, system_data_guard_databases, user_shard_spaces, db_backup_config, vcn_nsg_ids, freeform_tags, defined_tags): - - kwargs = {} - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['compartmentId'] = compartment_id - _details['displayName'] = display_name - _details['databaseVersion'] = database_version - _details['prefix'] = prefix - _details['privateEndpointIds'] = cli_util.parse_json_parameter("private_endpoint_ids", private_endpoint_ids) - _details['dbWorkloadType'] = db_workload_type - _details['characterSet'] = character_set - _details['ncharacterSet'] = ncharacter_set - _details['listenerPort'] = listener_port - _details['onsPortLocal'] = ons_port_local - _details['onsPortRemote'] = ons_port_remote - _details['catalogDetails'] = cli_util.parse_json_parameter("catalog_details", catalog_details) - - if notification_topic_ids is not None: - _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) - - if listener_port_tls is not None: - _details['listenerPortTls'] = listener_port_tls - - if system_chunk_count is not None: - _details['systemChunkCount'] = system_chunk_count - - if system_raft_replication_unit_count is not None: - _details['systemRaftReplicationUnitCount'] = system_raft_replication_unit_count - - if composite_raft_shard_spaces is not None: - _details['compositeRaftShardSpaces'] = cli_util.parse_json_parameter("composite_raft_shard_spaces", composite_raft_shard_spaces) - - if composite_data_guard_shard_spaces is not None: - _details['compositeDataGuardShardSpaces'] = cli_util.parse_json_parameter("composite_data_guard_shard_spaces", composite_data_guard_shard_spaces) - - if system_raft_clusters is not None: - _details['systemRaftClusters'] = cli_util.parse_json_parameter("system_raft_clusters", system_raft_clusters) - - if system_data_guard_databases is not None: - _details['systemDataGuardDatabases'] = cli_util.parse_json_parameter("system_data_guard_databases", system_data_guard_databases) - - if user_shard_spaces is not None: - _details['userShardSpaces'] = cli_util.parse_json_parameter("user_shard_spaces", user_shard_spaces) - - if db_backup_config is not None: - _details['dbBackupConfig'] = cli_util.parse_json_parameter("db_backup_config", db_backup_config) - - if vcn_nsg_ids is not None: - _details['vcnNsgIds'] = cli_util.parse_json_parameter("vcn_nsg_ids", vcn_nsg_ids) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.create_distributed_autonomous_database( - create_distributed_autonomous_database_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.delete_distributed_autonomous_database.command_name', 'delete'), help=u"""Terminate the given Globally distributed autonomous databases. \n[Command Reference](deleteDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@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.""") -@cli_util.confirm_delete_option -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def delete_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.delete_distributed_autonomous_database( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - 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) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.generate_distributed_autonomous_database_wallet.command_name', 'generate-distributed-autonomous-database-wallet'), help=u"""Generate the wallet associated with Globally distributed autonomous database. \n[Command Reference](generateDistributedAutonomousDatabaseWallet)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--password', required=True, help=u"""The password to encrypt the keys inside the wallet. The password must be at least 8 characters long and must include at least 1 letter and either 1 numeric character or 1 special character.""") -@cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def generate_distributed_autonomous_database_wallet(ctx, from_json, file, distributed_autonomous_database_id, password, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['password'] = password - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.generate_distributed_autonomous_database_wallet( - distributed_autonomous_database_id=distributed_autonomous_database_id, - generate_distributed_autonomous_database_wallet_details=_details, - **kwargs - ) - - # If outputting to stdout we don't want to print a progress bar because it will get mixed up with the output - # Also we need a non-zero Content-Length in order to display a meaningful progress bar - bar = None - if hasattr(file, 'name') and file.name != '' and 'Content-Length' in result.headers: - content_length = int(result.headers['Content-Length']) - if content_length > 0: - bar = click.progressbar(length=content_length, label='Downloading file') - - try: - if bar: - bar.__enter__() - - # TODO: Make the download size a configurable option - # use decode_content=True to automatically unzip service responses (this should be overridden for object storage) - for chunk in result.data.raw.stream(cli_constants.MEBIBYTE, decode_content=True): - if bar: - bar.update(len(chunk)) - file.write(chunk) - finally: - if bar: - bar.render_finish() - file.close() - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.get_distributed_autonomous_database.command_name', 'get'), help=u"""Gets the details of the Globally distributed autonomous database identified by given id. \n[Command Reference](getDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--metadata', help=u"""Comma-separated argument names for which metadata should be retrieved.""") -@cli_util.option('--if-none-match', help=u"""For conditional requests. In the GET call for a resource, set the `If-None-Match` header to the value of the ETag from a previous GET (or POST or PUT) response for that resource. The server will return with either a 304 Not Modified response if the resource has not changed, or a 200 OK response with the updated representation.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDatabase'}) -@cli_util.wrap_exceptions -def get_distributed_autonomous_database(ctx, from_json, distributed_autonomous_database_id, metadata, if_none_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if metadata is not None: - kwargs['metadata'] = metadata - if if_none_match is not None: - kwargs['if_none_match'] = if_none_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.get_distributed_autonomous_database( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_autonomous_db_service.get_distributed_autonomous_database_raft_metric.command_name', 'get-distributed-autonomous-database-raft-metric'), help=u"""Operation to retrieve RAFT metrics for the Globally distributed autonomous database. If the Globally distributed autonomous database is not RAFT based then empty response is returned from the API. \n[Command Reference](getDistributedAutonomousDatabaseRaftMetric)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDatabaseRaftMetric'}) -@cli_util.wrap_exceptions -def get_distributed_autonomous_database_raft_metric(ctx, from_json, distributed_autonomous_database_id): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.get_distributed_autonomous_database_raft_metric( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_autonomous_db_service.get_distributed_autonomous_database_ru_change_log.command_name', 'get-distributed-autonomous-database-ru-change-log'), help=u"""Operation to retrieve move RU invocation history and status for the Globally distributed autonomous database. Results are ordered by created timestamp in descending order. \n[Command Reference](getDistributedAutonomousDatabaseRuChangeLog)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--source-shard-name', help=u"""The source shard name to filter RU change log entries.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDatabaseRuChangeLog'}) -@cli_util.wrap_exceptions -def get_distributed_autonomous_database_ru_change_log(ctx, from_json, distributed_autonomous_database_id, source_shard_name): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if source_shard_name is not None: - kwargs['source_shard_name'] = source_shard_name - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.get_distributed_autonomous_database_ru_change_log( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_collection_group.command(name=cli_util.override('distributed_autonomous_db_service.list_distributed_autonomous_databases.command_name', 'list-distributed-autonomous-databases'), help=u"""List of Globally distributed autonomous databases. \n[Command Reference](listDistributedAutonomousDatabases)""") -@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") -@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""When set to true, returns resources in the specified compartment and in all of its child compartments recursively. Defaults to false.""") -@cli_util.option('--private-endpoint-id', help=u"""A filter to return only resources that are associated with the given privateEndpointId.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), help=u"""A filter to return only resources whose lifecycleState matches the specified value.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "timeUpdated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") -@cli_util.option('--is-auto-resource-management-enabled', type=click.BOOL, help=u"""A filter to return only resources where autoResourceManagement is enabled when set to `true`, or disabled when set to `false`. If omitted, no autoResourceManagement-based filtering is applied.""") -@cli_util.option('--display-name', help=u"""A filter to return only Globally distributed autonomous databases that match the entire name given. The match is not case sensitive.""") -@cli_util.option('--db-deployment-type', help=u"""A filter to return only resources whose dbDeploymentType matches the specified value.""") -@cli_util.option('--metadata', help=u"""Comma-separated argument names for which metadata should be retrieved.""") -@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") -@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDatabaseCollection'}) -@cli_util.wrap_exceptions -def list_distributed_autonomous_databases(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, private_endpoint_id, lifecycle_state, limit, page, sort_order, sort_by, is_auto_resource_management_enabled, display_name, db_deployment_type, metadata): - - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') - - kwargs = {} - if compartment_id_in_subtree is not None: - kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree - if private_endpoint_id is not None: - kwargs['private_endpoint_id'] = private_endpoint_id - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state - if limit is not None: - kwargs['limit'] = limit - if page is not None: - kwargs['page'] = page - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if is_auto_resource_management_enabled is not None: - kwargs['is_auto_resource_management_enabled'] = is_auto_resource_management_enabled - if display_name is not None: - kwargs['display_name'] = display_name - if db_deployment_type is not None: - kwargs['db_deployment_type'] = db_deployment_type - if metadata is not None: - kwargs['metadata'] = metadata - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size - - result = cli_util.list_call_get_all_results( - client.list_distributed_autonomous_databases, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_distributed_autonomous_databases, - limit, - page_size, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_distributed_autonomous_databases( - compartment_id=compartment_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.move_distributed_autonomous_database_replication_unit.command_name', 'move-distributed-autonomous-database-replication-unit'), help=u"""Move the replication units for RAFT based globally distributed autonomous database from source shard to destination shard. \n[Command Reference](moveDistributedAutonomousDatabaseReplicationUnit)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--source-shard-name', required=True, help=u"""The name of the source shard from which to move the chunks out to other shards.""") -@cli_util.option('--destination-shard-name', help=u"""The name of the destination shard to which the chunks moved out from source shard should be relocate to.""") -@cli_util.option('--replication-units', type=custom_types.CLI_COMPLEX_TYPE, help=u"""For RAFT databases please provide replication unit numbers to be moved from source shard to destination shard.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'replication-units': {'module': 'distributed_database_v26', 'class': 'list[integer]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'replication-units': {'module': 'distributed_database_v26', 'class': 'list[integer]'}}) -@cli_util.wrap_exceptions -def move_distributed_autonomous_database_replication_unit(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, source_shard_name, destination_shard_name, replication_units, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['sourceShardName'] = source_shard_name - - if destination_shard_name is not None: - _details['destinationShardName'] = destination_shard_name - - if replication_units is not None: - _details['replicationUnits'] = cli_util.parse_json_parameter("replication_units", replication_units) - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.move_distributed_autonomous_database_replication_unit( - distributed_autonomous_database_id=distributed_autonomous_database_id, - move_distributed_autonomous_database_replication_unit_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.patch_distributed_autonomous_database.command_name', 'patch'), help=u"""Patch operation to add, remove or update shards to the Globally distributed autonomous database topology. In single patch operation, multiple shards can be either added, or removed or updated. Combination of inserts, update and remove in single operation is not allowed. \n[Command Reference](patchDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--items', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of patch instructions. - -This option is a JSON list with items of type PatchInstruction. For documentation on PatchInstruction please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributedautonomousdbservice/20260101/datatypes/PatchInstruction.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'items': {'module': 'distributed_database_v26', 'class': 'list[PatchInstruction]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'items': {'module': 'distributed_database_v26', 'class': 'list[PatchInstruction]'}}) -@cli_util.wrap_exceptions -def patch_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, items, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if items is not None: - _details['items'] = cli_util.parse_json_parameter("items", items) - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.patch_distributed_autonomous_database( - distributed_autonomous_database_id=distributed_autonomous_database_id, - patch_distributed_autonomous_database_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.recreate_failed_distributed_autonomous_database_resource.command_name', 'recreate-failed-distributed-autonomous-database-resource'), help=u"""Recreate the failed resource for the Globally Distributed Autonomous Database. \n[Command Reference](recreateFailedDistributedAutonomousDatabaseResource)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--resource-name', required=True, help=u"""Specify the name of the shard, catalog, or GSM.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def recreate_failed_distributed_autonomous_database_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, resource_name, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.recreate_failed_distributed_autonomous_database_resource( - distributed_autonomous_database_id=distributed_autonomous_database_id, - resource_name=resource_name, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.rotate_distributed_autonomous_database_passwords.command_name', 'rotate-distributed-autonomous-database-passwords'), help=u"""Rotate the gsmuser and gsmcatuser passwords for shards and catalog of the Globally distributed autonomous database. This operation will also remove GdsCtlNodes if present. \n[Command Reference](rotateDistributedAutonomousDatabasePasswords)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--database-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of shard or catalog password rotation details.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'database-details': {'module': 'distributed_database_v26', 'class': 'list[RotateDistributedAutonomousDatabaseDetails]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'database-details': {'module': 'distributed_database_v26', 'class': 'list[RotateDistributedAutonomousDatabaseDetails]'}}) -@cli_util.wrap_exceptions -def rotate_distributed_autonomous_database_passwords(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, database_details, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['databaseDetails'] = cli_util.parse_json_parameter("database_details", database_details) - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.rotate_distributed_autonomous_database_passwords( - distributed_autonomous_database_id=distributed_autonomous_database_id, - rotate_distributed_autonomous_database_passwords_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.scale_distributed_autonomous_database_gsms.command_name', 'scale-distributed-autonomous-database-gsms'), help=u"""Scale global service manager(GSM aka shard director) instances for the Globally distributed autonomous database. \n[Command Reference](scaleDistributedAutonomousDatabaseGsms)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def scale_distributed_autonomous_database_gsms(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.scale_distributed_autonomous_database_gsms( - distributed_autonomous_database_id=distributed_autonomous_database_id, - scale_distributed_autonomous_database_gsms_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.start_distributed_autonomous_database.command_name', 'start'), help=u"""Start the shards, catalog, GSMs and GDSCTL instances of Globally distributed autonomous database. \n[Command Reference](startDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def start_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.start_distributed_autonomous_database( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.stop_distributed_autonomous_database.command_name', 'stop'), help=u"""Stop the shards, catalog, GSMs and GDSCTL instances for the Globally distributed autonomous database. \n[Command Reference](stopDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def stop_distributed_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.stop_distributed_autonomous_database( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.update_distributed_autonomous_database.command_name', 'update'), help=u"""Updates the configuration of the Globally distributed autonomous database. \n[Command Reference](updateDistributedAutonomousDatabase)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--display-name', help=u"""Display name of the Globally distributed autonomous database.""") -@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] for the notification topics associated with the globally distributed autonomous database. Pass an empty list (`[]`) to remove existing notification topics (set `notificationTopicIds` to empty).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state CREATING 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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedAutonomousDatabase'}) -@cli_util.wrap_exceptions -def update_distributed_autonomous_database(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, display_name, notification_topic_ids, freeform_tags, defined_tags, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - if not force: - if notification_topic_ids or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to notification-topic-ids and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): - ctx.abort() - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if display_name is not None: - _details['displayName'] = display_name - - if notification_topic_ids is not None: - _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.update_distributed_autonomous_database( - distributed_autonomous_database_id=distributed_autonomous_database_id, - update_distributed_autonomous_database_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_distributed_autonomous_database') and callable(getattr(client, 'get_distributed_autonomous_database')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_distributed_autonomous_database(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.validate_distributed_autonomous_database_ca_bundle.command_name', 'validate-distributed-autonomous-database-ca-bundle'), help=u"""Validate the CA Bundles consistency of the globally distributed autonomous database. \n[Command Reference](validateDistributedAutonomousDatabaseCaBundle)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def validate_distributed_autonomous_database_ca_bundle(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.validate_distributed_autonomous_database_ca_bundle( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_autonomous_database_group.command(name=cli_util.override('distributed_autonomous_db_service.validate_distributed_autonomous_database_network.command_name', 'validate-distributed-autonomous-database-network'), help=u"""Validate the network connectivity between components of the globally distributed autonomous database. \n[Command Reference](validateDistributedAutonomousDatabaseNetwork)""") -@cli_util.option('--distributed-autonomous-database-id', required=True, help=u"""Globally distributed autonomous database identifier.""") -@cli_util.option('--is-surrogate', type=click.BOOL, help=u"""Determines the surrogates check. Default is true.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def validate_distributed_autonomous_database_network(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_autonomous_database_id, is_surrogate, if_match): - - if isinstance(distributed_autonomous_database_id, six.string_types) and len(distributed_autonomous_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-autonomous-database-id cannot be whitespace or empty string') - - kwargs = {} - if is_surrogate is not None: - kwargs['is_surrogate'] = is_surrogate - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_autonomous_db_service', ctx) - result = client.validate_distributed_autonomous_database_network( - distributed_autonomous_database_id=distributed_autonomous_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) diff --git a/services/distributed_database_v26/src/oci_cli_distributed_database_v26/__init__.py b/services/distributed_database_v26/src/oci_cli_distributed_database_v26/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_database_v26/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_database_v26/generated/__init__.py b/services/distributed_database_v26/src/oci_cli_distributed_database_v26/generated/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_database_v26/generated/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_database_v26/generated/distributed_database_v26_service_cli.py b/services/distributed_database_v26/src/oci_cli_distributed_database_v26/generated/distributed_database_v26_service_cli.py deleted file mode 100644 index edacdf34d..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_database_v26/generated/distributed_database_v26_service_cli.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 - -from oci_cli.cli_root import cli -from oci_cli import cli_util -from oci_cli.aliasing import CommandGroupWithAlias - - -@cli.command(cli_util.override('distributed_db_work_request_service.distributed_database_v26_service_group.command_name', 'distributed-database-v26'), cls=CommandGroupWithAlias, help=cli_util.override('distributed_db_work_request_service.distributed_database_v26_service_group.help', """Use the Globally Distributed Database service APIs to create and manage the Globally distributed databases."""), short_help=cli_util.override('distributed_db_work_request_service.distributed_database_v26_service_group.short_help', """Globally Distributed Database""")) -@cli_util.help_option_group -def distributed_database_v26_service_group(): - pass diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/__init__.py b/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/__init__.py b/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/distributeddbprivateendpointservice_cli.py b/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/distributeddbprivateendpointservice_cli.py deleted file mode 100644 index 8880dc10c..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/distributeddbprivateendpointservice_cli.py +++ /dev/null @@ -1,515 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 - -from __future__ import print_function -import click -import oci # noqa: F401 -import six # noqa: F401 -import sys # noqa: F401 -from oci_cli import cli_constants # noqa: F401 -from oci_cli import cli_util -from oci_cli import json_skeleton_utils -from oci_cli import custom_types # noqa: F401 -from oci_cli.aliasing import CommandGroupWithAlias -from services.distributed_database_v26.src.oci_cli_distributed_database_v26.generated import distributed_database_v26_service_cli - - -@click.command(cli_util.override('distributed_db_private_endpoint_service.distributed_db_private_endpoint_service_root_group.command_name', 'distributed-db-private-endpoint-service'), cls=CommandGroupWithAlias, help=cli_util.override('distributed_db_private_endpoint_service.distributed_db_private_endpoint_service_root_group.help', """Use the Globally Distributed Database service APIs to create and manage the Globally distributed databases."""), short_help=cli_util.override('distributed_db_private_endpoint_service.distributed_db_private_endpoint_service_root_group.short_help', """Globally Distributed Database""")) -@cli_util.help_option_group -def distributed_db_private_endpoint_service_root_group(): - pass - - -@click.command(cli_util.override('distributed_db_private_endpoint_service.distributed_database_private_endpoint_collection_group.command_name', 'distributed-database-private-endpoint-collection'), cls=CommandGroupWithAlias, help="""Collection of private endpoints.""") -@cli_util.help_option_group -def distributed_database_private_endpoint_collection_group(): - pass - - -@click.command(cli_util.override('distributed_db_private_endpoint_service.distributed_database_private_endpoint_group.command_name', 'distributed-database-private-endpoint'), cls=CommandGroupWithAlias, help="""DistributedDatabasePrivateEndpoint resource.""") -@cli_util.help_option_group -def distributed_database_private_endpoint_group(): - pass - - -distributed_database_v26_service_cli.distributed_database_v26_service_group.add_command(distributed_db_private_endpoint_service_root_group) -distributed_db_private_endpoint_service_root_group.add_command(distributed_database_private_endpoint_collection_group) -distributed_db_private_endpoint_service_root_group.add_command(distributed_database_private_endpoint_group) - - -@distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.change_distributed_database_private_endpoint_compartment.command_name', 'change-compartment'), help=u"""Moves the DistributedDatabasePrivateEndpoint to the specified compartment. \n[Command Reference](changeDistributedDatabasePrivateEndpointCompartment)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the resource to.""") -@cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def change_distributed_database_private_endpoint_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, distributed_database_private_endpoint_id, if_match): - - if isinstance(distributed_database_private_endpoint_id, six.string_types) and len(distributed_database_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-private-endpoint-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['compartmentId'] = compartment_id - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_private_endpoint_service', ctx) - result = client.change_distributed_database_private_endpoint_compartment( - distributed_database_private_endpoint_id=distributed_database_private_endpoint_id, - change_distributed_database_private_endpoint_compartment_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.create_distributed_database_private_endpoint.command_name', 'create'), help=u"""Creates a DistributedDatabasePrivateEndpoint. \n[Command Reference](createDistributedDatabasePrivateEndpoint)""") -@cli_util.option('--compartment-id', required=True, help=u"""Identifier of the compartment where private endpoint is to be created.""") -@cli_util.option('--subnet-id', required=True, help=u"""Identifier of the customer subnet against which private endpoint is to be created.""") -@cli_util.option('--display-name', required=True, help=u"""Private endpoint display name.""") -@cli_util.option('--description', help=u"""DistributedDatabasePrivateEndpoint description.""") -@cli_util.option('--vcn-nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of network security group (NSG) details to be associated with the private endpoint. - -This option is a JSON list with items of type VcnNsgIdsDetails. For documentation on VcnNsgIdsDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbprivateendpointservice/20260101/datatypes/VcnNsgIdsDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'vcn-nsg-ids': {'module': 'distributed_database_v26', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'vcn-nsg-ids': {'module': 'distributed_database_v26', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabasePrivateEndpoint'}) -@cli_util.wrap_exceptions -def create_distributed_database_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, subnet_id, display_name, description, vcn_nsg_ids, freeform_tags, defined_tags): - - kwargs = {} - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['compartmentId'] = compartment_id - _details['subnetId'] = subnet_id - _details['displayName'] = display_name - - if description is not None: - _details['description'] = description - - if vcn_nsg_ids is not None: - _details['vcnNsgIds'] = cli_util.parse_json_parameter("vcn_nsg_ids", vcn_nsg_ids) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_private_endpoint_service', ctx) - result = client.create_distributed_database_private_endpoint( - create_distributed_database_private_endpoint_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.delete_distributed_database_private_endpoint.command_name', 'delete'), help=u"""Deletes the given DistributedDatabasePrivateEndpoint. \n[Command Reference](deleteDistributedDatabasePrivateEndpoint)""") -@cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") -@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.""") -@cli_util.confirm_delete_option -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def delete_distributed_database_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_private_endpoint_id, if_match): - - if isinstance(distributed_database_private_endpoint_id, six.string_types) and len(distributed_database_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-private-endpoint-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_private_endpoint_service', ctx) - result = client.delete_distributed_database_private_endpoint( - distributed_database_private_endpoint_id=distributed_database_private_endpoint_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - 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) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.get_distributed_database_private_endpoint.command_name', 'get'), help=u"""Get the DistributedDatabasePrivateEndpoint resource. \n[Command Reference](getDistributedDatabasePrivateEndpoint)""") -@cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") -@cli_util.option('--if-none-match', help=u"""For conditional requests. In the GET call for a resource, set the `If-None-Match` header to the value of the ETag from a previous GET (or POST or PUT) response for that resource. The server will return with either a 304 Not Modified response if the resource has not changed, or a 200 OK response with the updated representation.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabasePrivateEndpoint'}) -@cli_util.wrap_exceptions -def get_distributed_database_private_endpoint(ctx, from_json, distributed_database_private_endpoint_id, if_none_match): - - if isinstance(distributed_database_private_endpoint_id, six.string_types) and len(distributed_database_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-private-endpoint-id cannot be whitespace or empty string') - - kwargs = {} - if if_none_match is not None: - kwargs['if_none_match'] = if_none_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_private_endpoint_service', ctx) - result = client.get_distributed_database_private_endpoint( - distributed_database_private_endpoint_id=distributed_database_private_endpoint_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_private_endpoint_collection_group.command(name=cli_util.override('distributed_db_private_endpoint_service.list_distributed_database_private_endpoints.command_name', 'list-distributed-database-private-endpoints'), help=u"""List of DistributedDatabasePrivateEndpoints. \n[Command Reference](listDistributedDatabasePrivateEndpoints)""") -@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") -@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""When set to true, returns resources in the specified compartment and in all of its child compartments recursively. Defaults to false.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "timeUpdated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") -@cli_util.option('--display-name', help=u"""A filter to return only private endpoint that match the entire name given. The match is not case sensitive.""") -@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") -@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabasePrivateEndpointCollection'}) -@cli_util.wrap_exceptions -def list_distributed_database_private_endpoints(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, lifecycle_state, limit, page, sort_order, sort_by, display_name): - - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') - - kwargs = {} - if compartment_id_in_subtree is not None: - kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state - if limit is not None: - kwargs['limit'] = limit - if page is not None: - kwargs['page'] = page - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if display_name is not None: - kwargs['display_name'] = display_name - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_private_endpoint_service', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size - - result = cli_util.list_call_get_all_results( - client.list_distributed_database_private_endpoints, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_distributed_database_private_endpoints, - limit, - page_size, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_distributed_database_private_endpoints( - compartment_id=compartment_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.patch_distributed_database_private_endpoint.command_name', 'patch'), help=u"""Patch operation to update VCN network security group (NSG) IDs associated with the DistributedDatabasePrivateEndpoint. \n[Command Reference](patchDistributedDatabasePrivateEndpoint)""") -@cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") -@cli_util.option('--items', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of patch instructions. - -This option is a JSON list with items of type PatchInstruction. For documentation on PatchInstruction please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbprivateendpointservice/20260101/datatypes/PatchInstruction.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'items': {'module': 'distributed_database_v26', 'class': 'list[PatchInstruction]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'items': {'module': 'distributed_database_v26', 'class': 'list[PatchInstruction]'}}) -@cli_util.wrap_exceptions -def patch_distributed_database_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_private_endpoint_id, items, if_match): - - if isinstance(distributed_database_private_endpoint_id, six.string_types) and len(distributed_database_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-private-endpoint-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if items is not None: - _details['items'] = cli_util.parse_json_parameter("items", items) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_private_endpoint_service', ctx) - result = client.patch_distributed_database_private_endpoint( - distributed_database_private_endpoint_id=distributed_database_private_endpoint_id, - patch_distributed_database_private_endpoint_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.reinstate_proxy_instance.command_name', 'reinstate-proxy-instance'), help=u"""Reinstates the proxy instance associated with the DistributedDatabasePrivateEndpoint. \n[Command Reference](reinstateProxyInstance)""") -@cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def reinstate_proxy_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_private_endpoint_id, if_match): - - if isinstance(distributed_database_private_endpoint_id, six.string_types) and len(distributed_database_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-private-endpoint-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_private_endpoint_service', ctx) - result = client.reinstate_proxy_instance( - distributed_database_private_endpoint_id=distributed_database_private_endpoint_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_private_endpoint_group.command(name=cli_util.override('distributed_db_private_endpoint_service.update_distributed_database_private_endpoint.command_name', 'update'), help=u"""Updates the configuration of DistributedDatabasePrivateEndpoint. \n[Command Reference](updateDistributedDatabasePrivateEndpoint)""") -@cli_util.option('--distributed-database-private-endpoint-id', required=True, help=u"""Distributed Database PrivateEndpoint identifier""") -@cli_util.option('--display-name', help=u"""Display name for DistributedDatabasePrivateEndpoint""") -@cli_util.option('--description', help=u"""DistributedDatabasePrivateEndpoint description.""") -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state CREATING 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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabasePrivateEndpoint'}) -@cli_util.wrap_exceptions -def update_distributed_database_private_endpoint(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_private_endpoint_id, display_name, description, freeform_tags, defined_tags, if_match): - - if isinstance(distributed_database_private_endpoint_id, six.string_types) and len(distributed_database_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-private-endpoint-id cannot be whitespace or empty string') - if not force: - if freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): - ctx.abort() - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if display_name is not None: - _details['displayName'] = display_name - - if description is not None: - _details['description'] = description - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_private_endpoint_service', ctx) - result = client.update_distributed_database_private_endpoint( - distributed_database_private_endpoint_id=distributed_database_private_endpoint_id, - update_distributed_database_private_endpoint_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_distributed_database_private_endpoint') and callable(getattr(client, 'get_distributed_database_private_endpoint')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_distributed_database_private_endpoint(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_service/__init__.py b/services/distributed_database_v26/src/oci_cli_distributed_db_service/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_service/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/__init__.py b/services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/distributeddbservice_cli.py b/services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/distributeddbservice_cli.py deleted file mode 100644 index 269bbfc6d..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/distributeddbservice_cli.py +++ /dev/null @@ -1,1364 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 - -from __future__ import print_function -import click -import oci # noqa: F401 -import six # noqa: F401 -import sys # noqa: F401 -from oci_cli import cli_constants # noqa: F401 -from oci_cli import cli_util -from oci_cli import json_skeleton_utils -from oci_cli import custom_types # noqa: F401 -from oci_cli.aliasing import CommandGroupWithAlias -from services.distributed_database_v26.src.oci_cli_distributed_database_v26.generated import distributed_database_v26_service_cli - - -@click.command(cli_util.override('distributed_db_service.distributed_db_service_root_group.command_name', 'distributed-db-service'), cls=CommandGroupWithAlias, help=cli_util.override('distributed_db_service.distributed_db_service_root_group.help', """Use the Globally Distributed Database service APIs to create and manage the Globally distributed databases."""), short_help=cli_util.override('distributed_db_service.distributed_db_service_root_group.short_help', """Globally Distributed Database""")) -@cli_util.help_option_group -def distributed_db_service_root_group(): - pass - - -@click.command(cli_util.override('distributed_db_service.distributed_database_collection_group.command_name', 'distributed-database-collection'), cls=CommandGroupWithAlias, help="""Collection of Globally distributed databases.""") -@cli_util.help_option_group -def distributed_database_collection_group(): - pass - - -@click.command(cli_util.override('distributed_db_service.distributed_database_group.command_name', 'distributed-database'), cls=CommandGroupWithAlias, help="""Globally distributed database.""") -@cli_util.help_option_group -def distributed_database_group(): - pass - - -distributed_database_v26_service_cli.distributed_database_v26_service_group.add_command(distributed_db_service_root_group) -distributed_db_service_root_group.add_command(distributed_database_collection_group) -distributed_db_service_root_group.add_command(distributed_database_group) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.add_distributed_database_gds_control_node.command_name', 'add'), help=u"""Add new Global database services control(GDS CTL) node for the Globally distributed database. \n[Command Reference](addDistributedDatabaseGdsControlNode)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--public-ssh-key', required=True, help=u"""The public sshKey for Global database services control(GDS CTL) node.""") -@cli_util.option('--subnet-id', help=u"""The [OCID] of the subnet on which the Global database services control(GDS CTL) node should be created.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def add_distributed_database_gds_control_node(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, public_ssh_key, subnet_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['publicSshKey'] = public_ssh_key - - if subnet_id is not None: - _details['subnetId'] = subnet_id - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.add_distributed_database_gds_control_node( - distributed_database_id=distributed_database_id, - add_distributed_database_gds_control_node_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.change_distributed_database_compartment.command_name', 'change-compartment'), help=u"""Move the Globally distributed database and its dependent resources to the specified compartment. \n[Command Reference](changeDistributedDatabaseCompartment)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the resource to.""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def change_distributed_database_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, distributed_database_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['compartmentId'] = compartment_id - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.change_distributed_database_compartment( - distributed_database_id=distributed_database_id, - change_distributed_database_compartment_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.change_distributed_db_backup_config.command_name', 'change-distributed-db-backup-config'), help=u"""Change the DbBackupConfig for the Globally distributed database. \n[Command Reference](changeDistributedDbBackupConfig)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--db-backup-config', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'db-backup-config': {'module': 'distributed_database_v26', 'class': 'DistributedDbBackupConfig'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'db-backup-config': {'module': 'distributed_database_v26', 'class': 'DistributedDbBackupConfig'}}) -@cli_util.wrap_exceptions -def change_distributed_db_backup_config(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, db_backup_config, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['dbBackupConfig'] = cli_util.parse_json_parameter("db_backup_config", db_backup_config) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.change_distributed_db_backup_config( - distributed_database_id=distributed_database_id, - change_distributed_db_backup_config_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.configure_distributed_database_auto_resource_management.command_name', 'configure-distributed-database-auto-resource-management'), help=u"""Configure autoResourceManagement options for the Globally distributed database. \n[Command Reference](configureDistributedDatabaseAutoResourceManagement)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""Flag indicating if autoResourceManagement is enabled or disabled.""") -@cli_util.option('--cool-off-period-in-minutes', type=click.INT, help=u"""Time period to wait for the database to get stable after autoResourceManagement event.""") -@cli_util.option('--max-move-ru-attempts', type=click.INT, help=u"""Maximum number of move replication unit attempts allowed within the configured period per database.""") -@cli_util.option('--max-move-ru-unit', type=custom_types.CliCaseInsensitiveChoice(["HOUR", "DAY"]), help=u"""Time unit applicable to maxMoveRuAttempts.""") -@cli_util.option('--mode', type=custom_types.CliCaseInsensitiveChoice(["AUTOMATIC", "RECOMMENDATION"]), help=u"""Mode of autoResourceManagement execution.""") -@cli_util.option('--action-type', type=custom_types.CliCaseInsensitiveChoice(["MOVE"]), help=u"""The action that will be taken when autoResourceManagement is triggered.""") -@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of notification topic ids [OCIDs] to receive autoResourceManagement events.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--stream-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of stream ids [OCIDs] that receive shard-related telemetry.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'stream-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'stream-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabaseAutoResourceManagementDetails'}) -@cli_util.wrap_exceptions -def configure_distributed_database_auto_resource_management(ctx, from_json, distributed_database_id, is_enabled, cool_off_period_in_minutes, max_move_ru_attempts, max_move_ru_unit, mode, action_type, notification_topic_ids, stream_ids, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['isEnabled'] = is_enabled - - if cool_off_period_in_minutes is not None: - _details['coolOffPeriodInMinutes'] = cool_off_period_in_minutes - - if max_move_ru_attempts is not None: - _details['maxMoveRuAttempts'] = max_move_ru_attempts - - if max_move_ru_unit is not None: - _details['maxMoveRuUnit'] = max_move_ru_unit - - if mode is not None: - _details['mode'] = mode - - if action_type is not None: - _details['actionType'] = action_type - - if notification_topic_ids is not None: - _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) - - if stream_ids is not None: - _details['streamIds'] = cli_util.parse_json_parameter("stream_ids", stream_ids) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.configure_distributed_database_auto_resource_management( - distributed_database_id=distributed_database_id, - configure_distributed_database_auto_resource_management_details=_details, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.configure_distributed_database_gsms.command_name', 'configure-distributed-database-gsms'), help=u"""Configure new Global Service Manager(GSM aka shard manager) instances for the Globally distributed database. \n[Command Reference](configureDistributedDatabaseGsms)""") -@cli_util.option('--old-gsm-names', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Names of old global service manager(GSM) instances corresponding to which new GSM instances need to be configured.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--is-latest-gsm-image', required=True, type=click.BOOL, help=u"""Flag to indicate if new global service manager(GSM) instances shall use latest image or re-use image used by existing GSM instances.""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'old-gsm-names': {'module': 'distributed_database_v26', 'class': 'list[string]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'old-gsm-names': {'module': 'distributed_database_v26', 'class': 'list[string]'}}) -@cli_util.wrap_exceptions -def configure_distributed_database_gsms(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, old_gsm_names, is_latest_gsm_image, distributed_database_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['oldGsmNames'] = cli_util.parse_json_parameter("old_gsm_names", old_gsm_names) - _details['isLatestGsmImage'] = is_latest_gsm_image - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.configure_distributed_database_gsms( - distributed_database_id=distributed_database_id, - configure_distributed_database_gsms_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.configure_distributed_database_sharding.command_name', 'configure-distributed-database-sharding'), help=u"""Once all components of Globally distributed database are provisioned, and signed GSM certificates are successfully uploaded, this api shall be invoked to configure sharding on the Globally distributed database. Note that this 'ConfigureSharding' API also needs to be invoked after successfully adding a new shard to the Globally distributed database using PATCH api. If this API is not invoked after successfully adding a new shard, then that new shard will not be a participant in sharding topology of the Globally distributed database. \n[Command Reference](configureDistributedDatabaseSharding)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--is-rebalance-required', type=click.BOOL, help=u"""The flag to indicate whether chunks need to be re-balanced. This flag is not applicable for USER-defined sharding type.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def configure_distributed_database_sharding(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, is_rebalance_required, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if is_rebalance_required is not None: - kwargs['is_rebalance_required'] = is_rebalance_required - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.configure_distributed_database_sharding( - distributed_database_id=distributed_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.create_distributed_database.command_name', 'create'), help=u"""Creates a Globally distributed database. \n[Command Reference](createDistributedDatabase)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the Globally distributed database compartment.""") -@cli_util.option('--display-name', required=True, help=u"""The display name of the Globally distributed database.""") -@cli_util.option('--database-version', required=True, help=u"""Oracle Database version for the shards and catalog used in Globally distributed database.""") -@cli_util.option('--prefix', required=True, help=u"""Unique name prefix for the Globally distributed databases. Only alpha-numeric values are allowed. First character has to be a letter followed by any combination of letter and number.""") -@cli_util.option('--private-endpoint-ids', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] of the private endpoints associated with the Globally distributed database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--character-set', required=True, help=u"""The character set for the database.""") -@cli_util.option('--ncharacter-set', required=True, help=u"""The national character set for the database.""") -@cli_util.option('--listener-port', required=True, type=click.INT, help=u"""The listener port number for the Globally distributed database. The listener port number has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database.""") -@cli_util.option('--ons-port-local', required=True, type=click.INT, help=u"""The ons local port number for the Globally distributed database. The onsPortLocal has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database.""") -@cli_util.option('--ons-port-remote', required=True, type=click.INT, help=u"""The ons remote port number for the Globally distributed database. The onsPortRemote has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database.""") -@cli_util.option('--catalog-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of catalog details for the Globally distributed database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] for the notification topics associated with the globally distributed database.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--listener-port-tls', type=click.INT, help=u"""The TLS listener port number for the Globally distributed database. The TLS listener port number has to be unique for a customer tenancy across all distributed databases. Same port number should not be re-used for any other distributed database. For EXADB based distributed databases, tls is not supported hence the listenerPortTls is not needed to be provided in create payload.""") -@cli_util.option('--scan-listener-port', type=click.INT, help=u"""TCP SCAN listener port for new clusters to be created. Applicable only when shard and catalog source types are XS_NEW_VAULT_AND_CLUSTER or XS_NEW_CLUSTER. Defaults to 1521 when not provided.""") -@cli_util.option('--system-chunk-count', type=click.INT, help=u"""Count of chunks associated with system raft clusters or system data guard databases.""") -@cli_util.option('--system-raft-replication-unit-count', type=click.INT, help=u"""Number of replication units associated with system raft clusters.""") -@cli_util.option('--composite-raft-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of composite raft shards. - -This option is a JSON list with items of type CreateCompositeRaftShardSpaceDetails. For documentation on CreateCompositeRaftShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/CreateCompositeRaftShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--composite-data-guard-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of composite data guard shard spaces. - -This option is a JSON list with items of type CreateCompositeDataGuardShardSpaceDetails. For documentation on CreateCompositeDataGuardShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/CreateCompositeDataGuardShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--system-raft-clusters', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of system raft clusters. - -This option is a JSON list with items of type CreateSystemRaftClusterDetails. For documentation on CreateSystemRaftClusterDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/CreateSystemRaftClusterDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--system-data-guard-databases', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--user-shard-spaces', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of user defined shard spaces. - -This option is a JSON list with items of type CreateUserShardSpaceDetails. For documentation on CreateUserShardSpaceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/CreateUserShardSpaceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--gsm-ssh-public-key', help=u"""The SSH public key for Global service manager instances.""") -@cli_util.option('--db-backup-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--vcn-nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of network security group (NSG) details to be associated with the distributed database. - -This option is a JSON list with items of type VcnNsgIdsDetails. For documentation on VcnNsgIdsDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/VcnNsgIdsDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'private-endpoint-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'composite-raft-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateCompositeRaftShardSpaceDetails]'}, 'composite-data-guard-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateCompositeDataGuardShardSpaceDetails]'}, 'system-raft-clusters': {'module': 'distributed_database_v26', 'class': 'list[CreateSystemRaftClusterDetails]'}, 'system-data-guard-databases': {'module': 'distributed_database_v26', 'class': 'CreateSystemDataGuardDatabaseDetails'}, 'user-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateUserShardSpaceDetails]'}, 'catalog-details': {'module': 'distributed_database_v26', 'class': 'list[CreateDistributedDatabaseCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database_v26', 'class': 'DistributedDbBackupConfig'}, 'vcn-nsg-ids': {'module': 'distributed_database_v26', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'private-endpoint-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'composite-raft-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateCompositeRaftShardSpaceDetails]'}, 'composite-data-guard-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateCompositeDataGuardShardSpaceDetails]'}, 'system-raft-clusters': {'module': 'distributed_database_v26', 'class': 'list[CreateSystemRaftClusterDetails]'}, 'system-data-guard-databases': {'module': 'distributed_database_v26', 'class': 'CreateSystemDataGuardDatabaseDetails'}, 'user-shard-spaces': {'module': 'distributed_database_v26', 'class': 'list[CreateUserShardSpaceDetails]'}, 'catalog-details': {'module': 'distributed_database_v26', 'class': 'list[CreateDistributedDatabaseCatalogDetails]'}, 'db-backup-config': {'module': 'distributed_database_v26', 'class': 'DistributedDbBackupConfig'}, 'vcn-nsg-ids': {'module': 'distributed_database_v26', 'class': 'list[VcnNsgIdsDetails]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabase'}) -@cli_util.wrap_exceptions -def create_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, database_version, prefix, private_endpoint_ids, character_set, ncharacter_set, listener_port, ons_port_local, ons_port_remote, catalog_details, notification_topic_ids, listener_port_tls, scan_listener_port, system_chunk_count, system_raft_replication_unit_count, composite_raft_shard_spaces, composite_data_guard_shard_spaces, system_raft_clusters, system_data_guard_databases, user_shard_spaces, gsm_ssh_public_key, db_backup_config, vcn_nsg_ids, freeform_tags, defined_tags): - - kwargs = {} - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['compartmentId'] = compartment_id - _details['displayName'] = display_name - _details['databaseVersion'] = database_version - _details['prefix'] = prefix - _details['privateEndpointIds'] = cli_util.parse_json_parameter("private_endpoint_ids", private_endpoint_ids) - _details['characterSet'] = character_set - _details['ncharacterSet'] = ncharacter_set - _details['listenerPort'] = listener_port - _details['onsPortLocal'] = ons_port_local - _details['onsPortRemote'] = ons_port_remote - _details['catalogDetails'] = cli_util.parse_json_parameter("catalog_details", catalog_details) - - if notification_topic_ids is not None: - _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) - - if listener_port_tls is not None: - _details['listenerPortTls'] = listener_port_tls - - if scan_listener_port is not None: - _details['scanListenerPort'] = scan_listener_port - - if system_chunk_count is not None: - _details['systemChunkCount'] = system_chunk_count - - if system_raft_replication_unit_count is not None: - _details['systemRaftReplicationUnitCount'] = system_raft_replication_unit_count - - if composite_raft_shard_spaces is not None: - _details['compositeRaftShardSpaces'] = cli_util.parse_json_parameter("composite_raft_shard_spaces", composite_raft_shard_spaces) - - if composite_data_guard_shard_spaces is not None: - _details['compositeDataGuardShardSpaces'] = cli_util.parse_json_parameter("composite_data_guard_shard_spaces", composite_data_guard_shard_spaces) - - if system_raft_clusters is not None: - _details['systemRaftClusters'] = cli_util.parse_json_parameter("system_raft_clusters", system_raft_clusters) - - if system_data_guard_databases is not None: - _details['systemDataGuardDatabases'] = cli_util.parse_json_parameter("system_data_guard_databases", system_data_guard_databases) - - if user_shard_spaces is not None: - _details['userShardSpaces'] = cli_util.parse_json_parameter("user_shard_spaces", user_shard_spaces) - - if gsm_ssh_public_key is not None: - _details['gsmSshPublicKey'] = gsm_ssh_public_key - - if db_backup_config is not None: - _details['dbBackupConfig'] = cli_util.parse_json_parameter("db_backup_config", db_backup_config) - - if vcn_nsg_ids is not None: - _details['vcnNsgIds'] = cli_util.parse_json_parameter("vcn_nsg_ids", vcn_nsg_ids) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.create_distributed_database( - create_distributed_database_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.delete_distributed_database.command_name', 'delete'), help=u"""Terminate the given Globally distributed database. \n[Command Reference](deleteDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@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.""") -@cli_util.confirm_delete_option -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def delete_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.delete_distributed_database( - distributed_database_id=distributed_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - 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) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.generate_distributed_database_wallet.command_name', 'generate-distributed-database-wallet'), help=u"""Generate the wallet associated with Globally distributed database. \n[Command Reference](generateDistributedDatabaseWallet)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--password', required=True, help=u"""The password to encrypt the keys inside the wallet. The password must be at least 8 characters long and must include at least 1 letter and either 1 numeric character or 1 special character.""") -@cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def generate_distributed_database_wallet(ctx, from_json, file, distributed_database_id, password, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['password'] = password - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.generate_distributed_database_wallet( - distributed_database_id=distributed_database_id, - generate_distributed_database_wallet_details=_details, - **kwargs - ) - - # If outputting to stdout we don't want to print a progress bar because it will get mixed up with the output - # Also we need a non-zero Content-Length in order to display a meaningful progress bar - bar = None - if hasattr(file, 'name') and file.name != '' and 'Content-Length' in result.headers: - content_length = int(result.headers['Content-Length']) - if content_length > 0: - bar = click.progressbar(length=content_length, label='Downloading file') - - try: - if bar: - bar.__enter__() - - # TODO: Make the download size a configurable option - # use decode_content=True to automatically unzip service responses (this should be overridden for object storage) - for chunk in result.data.raw.stream(cli_constants.MEBIBYTE, decode_content=True): - if bar: - bar.update(len(chunk)) - file.write(chunk) - finally: - if bar: - bar.render_finish() - file.close() - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.get_distributed_database.command_name', 'get'), help=u"""Gets the details of the Globally distributed database identified by given id. \n[Command Reference](getDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--metadata', help=u"""Comma-separated argument names for which metadata should be retrieved.""") -@cli_util.option('--if-none-match', help=u"""For conditional requests. In the GET call for a resource, set the `If-None-Match` header to the value of the ETag from a previous GET (or POST or PUT) response for that resource. The server will return with either a 304 Not Modified response if the resource has not changed, or a 200 OK response with the updated representation.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabase'}) -@cli_util.wrap_exceptions -def get_distributed_database(ctx, from_json, distributed_database_id, metadata, if_none_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if metadata is not None: - kwargs['metadata'] = metadata - if if_none_match is not None: - kwargs['if_none_match'] = if_none_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.get_distributed_database( - distributed_database_id=distributed_database_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.get_distributed_database_raft_metric.command_name', 'get-distributed-database-raft-metric'), help=u"""Operation to retrieve RAFT metrics for the Globally distributed database. If the Globally distributed database is not RAFT based then empty response is returned from the API. \n[Command Reference](getDistributedDatabaseRaftMetric)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabaseRaftMetric'}) -@cli_util.wrap_exceptions -def get_distributed_database_raft_metric(ctx, from_json, distributed_database_id): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.get_distributed_database_raft_metric( - distributed_database_id=distributed_database_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.get_distributed_database_ru_change_log.command_name', 'get-distributed-database-ru-change-log'), help=u"""Operation to retrieve move RU invocation history and status for the Globally distributed database. Results are ordered by created timestamp in descending order. \n[Command Reference](getDistributedDatabaseRuChangeLog)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--source-shard-name', help=u"""The source shard name to filter RU change log entries.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabaseRuChangeLog'}) -@cli_util.wrap_exceptions -def get_distributed_database_ru_change_log(ctx, from_json, distributed_database_id, source_shard_name): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if source_shard_name is not None: - kwargs['source_shard_name'] = source_shard_name - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.get_distributed_database_ru_change_log( - distributed_database_id=distributed_database_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_collection_group.command(name=cli_util.override('distributed_db_service.list_distributed_databases.command_name', 'list-distributed-databases'), help=u"""List of Globally distributed databases. \n[Command Reference](listDistributedDatabases)""") -@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") -@cli_util.option('--compartment-id-in-subtree', type=click.BOOL, help=u"""When set to true, returns resources in the specified compartment and in all of its child compartments recursively. Defaults to false.""") -@cli_util.option('--private-endpoint-id', help=u"""A filter to return only resources that are associated with the given privateEndpointId.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), help=u"""A filter to return only resources whose lifecycleState matches the specified value.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "timeUpdated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") -@cli_util.option('--is-auto-resource-management-enabled', type=click.BOOL, help=u"""A filter to return only resources where autoResourceManagement is enabled when set to `true`, or disabled when set to `false`. If omitted, no autoResourceManagement-based filtering is applied.""") -@cli_util.option('--display-name', help=u"""A filter to return only Globally distributed databases that match the entire name given. The match is not case sensitive.""") -@cli_util.option('--db-deployment-type', help=u"""A filter to return only resources whose dbDeploymentType matches the specified value.""") -@cli_util.option('--metadata', help=u"""Comma-separated argument names for which metadata should be retrieved.""") -@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") -@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabaseCollection'}) -@cli_util.wrap_exceptions -def list_distributed_databases(ctx, from_json, all_pages, page_size, compartment_id, compartment_id_in_subtree, private_endpoint_id, lifecycle_state, limit, page, sort_order, sort_by, is_auto_resource_management_enabled, display_name, db_deployment_type, metadata): - - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') - - kwargs = {} - if compartment_id_in_subtree is not None: - kwargs['compartment_id_in_subtree'] = compartment_id_in_subtree - if private_endpoint_id is not None: - kwargs['private_endpoint_id'] = private_endpoint_id - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state - if limit is not None: - kwargs['limit'] = limit - if page is not None: - kwargs['page'] = page - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if is_auto_resource_management_enabled is not None: - kwargs['is_auto_resource_management_enabled'] = is_auto_resource_management_enabled - if display_name is not None: - kwargs['display_name'] = display_name - if db_deployment_type is not None: - kwargs['db_deployment_type'] = db_deployment_type - if metadata is not None: - kwargs['metadata'] = metadata - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size - - result = cli_util.list_call_get_all_results( - client.list_distributed_databases, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_distributed_databases, - limit, - page_size, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_distributed_databases( - compartment_id=compartment_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.move_distributed_database_replication_unit.command_name', 'move-distributed-database-replication-unit'), help=u"""Move the replication units for RAFT based globally distributed database from source shard to destination shard. \n[Command Reference](moveDistributedDatabaseReplicationUnit)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--source-shard-name', required=True, help=u"""The name of the source shard from which to move the chunks out to other shards.""") -@cli_util.option('--destination-shard-name', help=u"""The name of the destination shard to which the chunks moved out from source shard should be relocate to.""") -@cli_util.option('--replication-units', type=custom_types.CLI_COMPLEX_TYPE, help=u"""For RAFT databases please provide replication unit numbers to be moved from source shard to destination shard.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'replication-units': {'module': 'distributed_database_v26', 'class': 'list[integer]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'replication-units': {'module': 'distributed_database_v26', 'class': 'list[integer]'}}) -@cli_util.wrap_exceptions -def move_distributed_database_replication_unit(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, source_shard_name, destination_shard_name, replication_units, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['sourceShardName'] = source_shard_name - - if destination_shard_name is not None: - _details['destinationShardName'] = destination_shard_name - - if replication_units is not None: - _details['replicationUnits'] = cli_util.parse_json_parameter("replication_units", replication_units) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.move_distributed_database_replication_unit( - distributed_database_id=distributed_database_id, - move_distributed_database_replication_unit_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.patch_distributed_database.command_name', 'patch'), help=u"""Patch operation to add, remove or update shards to the Globally distributed database topology. In single patch operation, multiple shards can be either added, or removed or updated. Combination of inserts, update and remove in single operation is not allowed. \n[Command Reference](patchDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--items', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of patch instructions. - -This option is a JSON list with items of type PatchInstruction. For documentation on PatchInstruction please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/distributeddbservice/20260101/datatypes/PatchInstruction.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'items': {'module': 'distributed_database_v26', 'class': 'list[PatchInstruction]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'items': {'module': 'distributed_database_v26', 'class': 'list[PatchInstruction]'}}) -@cli_util.wrap_exceptions -def patch_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, items, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if items is not None: - _details['items'] = cli_util.parse_json_parameter("items", items) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.patch_distributed_database( - distributed_database_id=distributed_database_id, - patch_distributed_database_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.recreate_failed_distributed_database_resource.command_name', 'recreate-failed-distributed-database-resource'), help=u"""Recreate the failed resource for the Globally Distributed Database. \n[Command Reference](recreateFailedDistributedDatabaseResource)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--resource-name', required=True, help=u"""Specify the name of the shard, catalog, or GSM.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def recreate_failed_distributed_database_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, resource_name, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.recreate_failed_distributed_database_resource( - distributed_database_id=distributed_database_id, - resource_name=resource_name, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.rotate_distributed_database_passwords.command_name', 'rotate-distributed-database-passwords'), help=u"""Rotate the gsmuser and gsmcatuser passwords for shards and catalog of the Globally distributed database. This operation will also remove GdsCtlNodes if present. \n[Command Reference](rotateDistributedDatabasePasswords)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--database-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of shard or catalog password rotation details.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'database-details': {'module': 'distributed_database_v26', 'class': 'list[RotateDistributedDatabaseDetails]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'database-details': {'module': 'distributed_database_v26', 'class': 'list[RotateDistributedDatabaseDetails]'}}) -@cli_util.wrap_exceptions -def rotate_distributed_database_passwords(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, database_details, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['databaseDetails'] = cli_util.parse_json_parameter("database_details", database_details) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.rotate_distributed_database_passwords( - distributed_database_id=distributed_database_id, - rotate_distributed_database_passwords_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.scale_distributed_database_gsms.command_name', 'scale-distributed-database-gsms'), help=u"""Scale global service manager(GSM aka shard manager) instances for the Globally distributed database. \n[Command Reference](scaleDistributedDatabaseGsms)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def scale_distributed_database_gsms(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.scale_distributed_database_gsms( - distributed_database_id=distributed_database_id, - scale_distributed_database_gsms_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.start_distributed_database.command_name', 'start'), help=u"""Start the shards, catalog, GSMs and GDSCTL instances of Globally distributed database. \n[Command Reference](startDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def start_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.start_distributed_database( - distributed_database_id=distributed_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.stop_distributed_database.command_name', 'stop'), help=u"""Stop the shards, catalog, GSMs and GDSCTL instances for the Globally distributed database. \n[Command Reference](stopDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def stop_distributed_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.stop_distributed_database( - distributed_database_id=distributed_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.update_distributed_database.command_name', 'update'), help=u"""Updates the configuration of the Globally distributed database. \n[Command Reference](updateDistributedDatabase)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--display-name', help=u"""Display name of the Globally distributed database.""") -@cli_util.option('--notification-topic-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The collection of [OCID] for the notification topics associated with the globally distributed database. Pass an empty list (`[]`) to remove existing notification topics (set `notificationTopicIds` to empty).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@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.""") -@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "FAILED", "NEEDS_ATTENTION", "INACTIVE", "DELETING", "DELETED", "UPDATING", "CREATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state CREATING 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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-topic-ids': {'module': 'distributed_database_v26', 'class': 'list[string]'}, 'freeform-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'distributed_database_v26', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'distributed_database_v26', 'class': 'DistributedDatabase'}) -@cli_util.wrap_exceptions -def update_distributed_database(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, display_name, notification_topic_ids, freeform_tags, defined_tags, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - if not force: - if notification_topic_ids or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to notification-topic-ids and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): - ctx.abort() - - kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if display_name is not None: - _details['displayName'] = display_name - - if notification_topic_ids is not None: - _details['notificationTopicIds'] = cli_util.parse_json_parameter("notification_topic_ids", notification_topic_ids) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.update_distributed_database( - distributed_database_id=distributed_database_id, - update_distributed_database_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_distributed_database') and callable(getattr(client, 'get_distributed_database')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_distributed_database(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) - - -@distributed_database_group.command(name=cli_util.override('distributed_db_service.validate_distributed_database_network.command_name', 'validate-distributed-database-network'), help=u"""Validate the network connectivity between components of the globally distributed database. \n[Command Reference](validateDistributedDatabaseNetwork)""") -@cli_util.option('--distributed-database-id', required=True, help=u"""Globally distributed database identifier.""") -@cli_util.option('--is-surrogate', type=click.BOOL, help=u"""Determines the surrogates check. Default is true.""") -@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.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), 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 ACCEPTED --wait-for-state NEEDS_ATTENTION 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.""") -@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.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def validate_distributed_database_network(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, distributed_database_id, is_surrogate, if_match): - - if isinstance(distributed_database_id, six.string_types) and len(distributed_database_id.strip()) == 0: - raise click.UsageError('Parameter --distributed-database-id cannot be whitespace or empty string') - - kwargs = {} - if is_surrogate is not None: - kwargs['is_surrogate'] = is_surrogate - if if_match is not None: - kwargs['if_match'] = if_match - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_service', ctx) - result = client.validate_distributed_database_network( - distributed_database_id=distributed_database_id, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) - cli_util.render_response(result, ctx) - raise - else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) - cli_util.render_response(result, ctx) diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/__init__.py b/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/__init__.py b/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/tests/__init__.py b/services/distributed_database_v26/tests/__init__.py deleted file mode 100644 index 7293131c0..000000000 --- a/services/distributed_database_v26/tests/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 diff --git a/services/distributed_database_v26/tests/util/generated/command_to_api.py b/services/distributed_database_v26/tests/util/generated/command_to_api.py deleted file mode 100644 index 575f45c5b..000000000 --- a/services/distributed_database_v26/tests/util/generated/command_to_api.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. - -SDK_client_map = { - "distributed_db_work_request_service.get_work_request": "oci.distributed_database_v26.DistributedDbWorkRequestServiceClient.get_work_request", - "distributed_db_work_request_service.list_work_request_errors": "oci.distributed_database_v26.DistributedDbWorkRequestServiceClient.list_work_request_errors", - "distributed_db_work_request_service.list_work_request_logs": "oci.distributed_database_v26.DistributedDbWorkRequestServiceClient.list_work_request_logs", - "distributed_db_work_request_service.list_work_requests": "oci.distributed_database_v26.DistributedDbWorkRequestServiceClient.list_work_requests", -} diff --git a/services/functions/__init__.py b/services/functions/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/__init__.py +++ b/services/functions/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/src/__init__.py b/services/functions/src/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/src/__init__.py +++ b/services/functions/src/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/src/oci_cli_functions/__init__.py b/services/functions/src/oci_cli_functions/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/src/oci_cli_functions/__init__.py +++ b/services/functions/src/oci_cli_functions/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/src/oci_cli_functions/functions_cli_extended.py b/services/functions/src/oci_cli_functions/functions_cli_extended.py index c24ad6c67..f401bbe13 100644 --- a/services/functions/src/oci_cli_functions/functions_cli_extended.py +++ b/services/functions/src/oci_cli_functions/functions_cli_extended.py @@ -8,11 +8,24 @@ from services.functions.src.oci_cli_functions.generated import fn_service_cli from services.functions.src.oci_cli_functions_management.generated import functionsmanagement_cli from services.functions.src.oci_cli_functions_invoke.generated import functionsinvoke_cli +from services.functions.src.oci_cli_work_request_management.generated import workrequestmanagement_cli from oci_cli import cli_constants # noqa: F401 from oci_cli import cli_util from oci_cli import json_skeleton_utils -cli_util.SERVICES_REQUIRING_ENDPOINTS.append("functions_invoke") + +def _add_service_requiring_endpoint(service_name): + if service_name not in cli_util.SERVICES_REQUIRING_ENDPOINTS: + cli_util.SERVICES_REQUIRING_ENDPOINTS.append(service_name) + + +def _safe_pop(command_group, command_name): + if command_name in command_group.commands: + command_group.commands.pop(command_name) + + +_add_service_requiring_endpoint("functions_invoke") +_add_service_requiring_endpoint("work_request_management") # Change from: # oci functions functions-management application change-compartment @@ -60,11 +73,36 @@ fn_service_cli.fn_service_group.add_command(functionsmanagement_cli.pbf_listing_group) fn_service_cli.fn_service_group.add_command(functionsmanagement_cli.triggers_collection_group) fn_service_cli.fn_service_group.add_command(functionsmanagement_cli.pbf_listing_version_group) + +# Expose runtime commands as `oci fn runtime` and `oci fn runtime-version`. +# Remove generated command names from all relevant groups first so interactive +# completion does not suggest the raw generated names. +_safe_pop(fn_service_cli.fn_service_group, 'functions-runtime') +_safe_pop(fn_service_cli.fn_service_group, 'functions-runtime-version') +_safe_pop(functionsmanagement_cli.functions_management_root_group, 'functions-runtime') +_safe_pop(functionsmanagement_cli.functions_management_root_group, 'functions-runtime-version') +functionsmanagement_cli.functions_runtime_group.name = 'runtime' +functionsmanagement_cli.functions_runtime_version_group.name = 'runtime-version' +fn_service_cli.fn_service_group.add_command(functionsmanagement_cli.functions_runtime_group) +fn_service_cli.fn_service_group.add_command(functionsmanagement_cli.functions_runtime_version_group) fn_service_cli.fn_service_group.commands.pop(functionsmanagement_cli.functions_management_root_group.name) functionsmanagement_cli.function_group.add_command(functionsinvoke_cli.functions_invoke_root_group) fn_service_cli.fn_service_group.commands.pop(functionsinvoke_cli.functions_invoke_root_group.name) functionsmanagement_cli.function_group.commands.pop(functionsinvoke_cli.functions_invoke_root_group.name) +# Flatten work-request commands directly under `oci fn`. +_safe_pop(fn_service_cli.fn_service_group, workrequestmanagement_cli.work_request_management_root_group.name) +fn_service_cli.fn_service_group.add_command(workrequestmanagement_cli.work_request_group) +fn_service_cli.fn_service_group.add_command(workrequestmanagement_cli.work_request_error_group) +fn_service_cli.fn_service_group.add_command(workrequestmanagement_cli.work_request_log_entry_group) +_safe_pop(workrequestmanagement_cli.work_request_group, 'cancel') +cli_util.rename_command( + fn_service_cli, + workrequestmanagement_cli.work_request_log_entry_group, + workrequestmanagement_cli.list_work_request_logs, + 'list' +) + @cli_util.copy_params_from_generated_command(functionsinvoke_cli.invoke_function, params_to_exclude=['invoke_function_body']) @functionsmanagement_cli.function_group.command(name='invoke', help=u"""Invokes a function""") diff --git a/services/functions/src/oci_cli_functions/generated/__init__.py b/services/functions/src/oci_cli_functions/generated/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/src/oci_cli_functions/generated/__init__.py +++ b/services/functions/src/oci_cli_functions/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/src/oci_cli_functions/generated/fn_service_cli.py b/services/functions/src/oci_cli_functions/generated/fn_service_cli.py index d496d3ea0..77c981064 100644 --- a/services/functions/src/oci_cli_functions/generated/fn_service_cli.py +++ b/services/functions/src/oci_cli_functions/generated/fn_service_cli.py @@ -1,14 +1,14 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 from oci_cli.cli_root import cli from oci_cli import cli_util from oci_cli.aliasing import CommandGroupWithAlias -@cli.command(cli_util.override('functions_management.fn_service_group.command_name', 'fn'), cls=CommandGroupWithAlias, help=cli_util.override('functions_management.fn_service_group.help', """API for the Functions service."""), short_help=cli_util.override('functions_management.fn_service_group.short_help', """Functions Service API""")) +@cli.command(cli_util.override('work_request_management.fn_service_group.command_name', 'fn'), cls=CommandGroupWithAlias, help=cli_util.override('work_request_management.fn_service_group.help', """API for the Functions service."""), short_help=cli_util.override('work_request_management.fn_service_group.short_help', """Functions Service API""")) @cli_util.help_option_group def fn_service_group(): pass diff --git a/services/functions/src/oci_cli_functions_invoke/__init__.py b/services/functions/src/oci_cli_functions_invoke/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/src/oci_cli_functions_invoke/__init__.py +++ b/services/functions/src/oci_cli_functions_invoke/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/src/oci_cli_functions_invoke/generated/__init__.py b/services/functions/src/oci_cli_functions_invoke/generated/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/src/oci_cli_functions_invoke/generated/__init__.py +++ b/services/functions/src/oci_cli_functions_invoke/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/src/oci_cli_functions_invoke/generated/client_mappings.py b/services/functions/src/oci_cli_functions_invoke/generated/client_mappings.py index ad8ddd4fa..807f65c7a 100644 --- a/services/functions/src/oci_cli_functions_invoke/generated/client_mappings.py +++ b/services/functions/src/oci_cli_functions_invoke/generated/client_mappings.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 import oci from oci_cli.cli_clients import CLIENT_MAP diff --git a/services/functions/src/oci_cli_functions_invoke/generated/functionsinvoke_cli.py b/services/functions/src/oci_cli_functions_invoke/generated/functionsinvoke_cli.py index d3aa241cd..08ac7b1db 100644 --- a/services/functions/src/oci_cli_functions_invoke/generated/functionsinvoke_cli.py +++ b/services/functions/src/oci_cli_functions_invoke/generated/functionsinvoke_cli.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 from __future__ import print_function import click diff --git a/services/functions/src/oci_cli_functions_management/__init__.py b/services/functions/src/oci_cli_functions_management/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/src/oci_cli_functions_management/__init__.py +++ b/services/functions/src/oci_cli_functions_management/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/src/oci_cli_functions_management/functionsmanagement_cli_extended.py b/services/functions/src/oci_cli_functions_management/functionsmanagement_cli_extended.py index dd2e6f9d7..8e339f911 100644 --- a/services/functions/src/oci_cli_functions_management/functionsmanagement_cli_extended.py +++ b/services/functions/src/oci_cli_functions_management/functionsmanagement_cli_extended.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016, 2023, Oracle and/or its affiliates. +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. # # This software is dual-licensed to you under the Universal Permissive License # (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License @@ -20,139 +20,501 @@ # See the License for the specific language governing permissions and # limitations under the License. # coding: utf-8 -import click # noqa: F401 -import json # noqa: F401 + +import base64 +import json +import os + +import click +from oci_cli import cli_util +from oci_cli import custom_types +from oci_cli import json_skeleton_utils +from oci_cli.aliasing import CommandGroupWithAlias from services.functions.src.oci_cli_functions_management.generated import functionsmanagement_cli -from oci_cli import cli_util # noqa: F401 -from oci_cli import custom_types # noqa: F401 -from oci_cli import json_skeleton_utils # noqa: F401 -# Remove create-function-constant-provisioned-concurrency-config from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_constant_provisioned_concurrency_config.name) +BUCKET_NAME_HELP = 'The name of the Object Storage bucket.' +NAMESPACE_HELP = 'The Object Storage namespace.' +OBJECT_NAME_HELP = 'The name of the Object Storage object.' +OBJECT_VERSION_ID_HELP = 'VersionId used to identify a particular version of the object.' +FUNCTIONS_RUNTIME_NAME_HELP = 'The name of the FunctionsRuntime this function is associated with.' +FUNCTIONS_RUNTIME_VERSION_ID_HELP = 'The OCID of the FunctionsRuntime version used when runtime config type is MANUAL.' +RUNTIME_CONFIG_HELP = 'The runtime configuration type to use for this archive function. Accepted values are: FUNCTION_UPDATE, MANUAL.' +HANDLER_HELP = 'The function handler that is executed when the function is invoked.' +ARCHIVE_FILE_HELP = 'Path to the .zip or .jar archive file of the function code.' +IMAGE_HELP = 'The full path to the Docker image for a container-image function.' +IMAGE_DIGEST_HELP = 'An optional digest for the Docker image.' +PBF_LISTING_ID_HELP = 'The OCID of the pre-built function listing.' +PROVISIONED_CONCURRENCY_HELP = 'Provisioned concurrency configuration for this function.' +ARCHIVE_FUNCTION_GROUP_HELP = 'Commands for functions created from archive sources.' +OBJECT_STORAGE_ARCHIVE_GROUP_HELP = 'Commands for functions using an archive stored in Object Storage.' +DIRECT_ARCHIVE_GROUP_HELP = 'Commands for functions using a directly provided archive file.' +RUNTIME_CONFIG_FUNCTION_UPDATE = 'FUNCTION_UPDATE' +RUNTIME_CONFIG_MANUAL = 'MANUAL' -# Remove update-function-constant-provisioned-concurrency-config from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_constant_provisioned_concurrency_config.name) +FUNCTION_COMPLEX_TYPES = { + 'config': {'module': 'functions', 'class': 'dict(str, string)'}, + 'provisioned-concurrency': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, + 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, + 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, + 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, + 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, + 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'} +} -# Remove create-function-none-provisioned-concurrency-config from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_none_provisioned_concurrency_config.name) +def _safe_pop(command_group, command_name): + if command_name in command_group.commands: + command_group.commands.pop(command_name) -# Remove update-function-none-provisioned-concurrency-config from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_none_provisioned_concurrency_config.name) +def _pop_function_command_if_present(attr_name): + if hasattr(functionsmanagement_cli, attr_name): + _safe_pop(functionsmanagement_cli.function_group, getattr(functionsmanagement_cli, attr_name).name) -@cli_util.copy_params_from_generated_command(functionsmanagement_cli.create_function, params_to_exclude=['provisioned_concurrency_config']) -@functionsmanagement_cli.function_group.command(name=functionsmanagement_cli.create_function.name, help=functionsmanagement_cli.create_function.help) -@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=u"""This is a complex type whose value must be valid JSON. The value can be provided as a string on the command line or passed in as a file using -the file://path/to/file syntax. -The --generate-param-json-input option can be used to generate an example of the JSON which must be provided. We recommend storing this example -in a file, modifying it as needed and then passing it back in via the file:// syntax.""") -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) -@cli_util.wrap_exceptions -def create_function_extended(ctx, **kwargs): +def _normalize_provisioned_concurrency(kwargs): if 'provisioned_concurrency' in kwargs: - kwargs['provisioned_concurrency_config'] = kwargs['provisioned_concurrency'] - kwargs.pop('provisioned_concurrency') + kwargs['provisioned_concurrency_config'] = kwargs.pop('provisioned_concurrency') - if not (kwargs.get('source_details') or kwargs.get('image')): - raise click.UsageError('Must specify --source-details or --image.') - source_details = {} - if kwargs.get('source_details') is not None: - source_details = cli_util.parse_json_parameter("source_details", kwargs.get('source_details')) +def _invoke_create(ctx, kwargs, source_details): + _normalize_provisioned_concurrency(kwargs) + kwargs['source_details'] = json.dumps(source_details) + ctx.invoke(functionsmanagement_cli.create_function, **kwargs) - if source_details.get('pbfListingId') and kwargs.get('image'): - raise click.UsageError('Cannot specify both pbfListingId (in --source-details) and --image.') - ctx.invoke(functionsmanagement_cli.create_function, **kwargs) +def _invoke_update(ctx, kwargs, source_details=None): + _normalize_provisioned_concurrency(kwargs) + if source_details is not None: + kwargs['source_details'] = json.dumps(source_details) + ctx.invoke(functionsmanagement_cli.update_function, **kwargs) -@cli_util.copy_params_from_generated_command(functionsmanagement_cli.update_function, params_to_exclude=['provisioned_concurrency_config']) -@functionsmanagement_cli.function_group.command(name=functionsmanagement_cli.update_function.name, help=functionsmanagement_cli.update_function.help) -@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=u"""This is a complex type whose value must be valid JSON. The value can be provided as a string on the command line or passed in as a file using -the file://path/to/file syntax. +def _add_if_present(payload, payload_key, value): + if value is not None: + payload[payload_key] = value -The --generate-param-json-input option can be used to generate an example of the JSON which must be provided. We recommend storing this example -in a file, modifying it as needed and then passing it back in via the file:// syntax.""") -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) -@cli_util.wrap_exceptions -def update_function_extended(ctx, **kwargs): - if 'provisioned_concurrency' in kwargs: - kwargs['provisioned_concurrency_config'] = kwargs['provisioned_concurrency'] - kwargs.pop('provisioned_concurrency') - ctx.invoke(functionsmanagement_cli.update_function, **kwargs) +def _read_archive_file_value(archive_file): + if archive_file is None: + return None + + archive_file_path = archive_file + if archive_file.lower().startswith('file://'): + archive_file_path = archive_file[len('file://'):] + + archive_file_path = os.path.expandvars(os.path.expanduser(archive_file_path)) + if not os.path.exists(archive_file_path): + raise click.UsageError("Archive file '{}' does not exist.".format(archive_file)) + + if not archive_file_path.lower().endswith(('.zip', '.jar')): + raise click.UsageError("Archive file '{}' must be a .zip or .jar file.".format(archive_file)) + + with open(archive_file_path, 'rb') as archive: + return base64.b64encode(archive.read()).decode('utf-8') + + +def _build_object_storage_archive_details(kwargs, include_if_empty=True): + archive_source_details = {'archiveSourceType': 'OBJECT_STORAGE_ARCHIVE'} + + for option_key, payload_key in [ + ('bucket_name', 'bucketName'), + ('namespace', 'namespace'), + ('object_name', 'objectName'), + ('object_version_id', 'objectVersionId') + ]: + option_value = kwargs.pop(option_key, None) + if option_value is not None: + archive_source_details[payload_key] = option_value + + if not include_if_empty and len(archive_source_details) == 1: + return None + + return archive_source_details -# Remove create-function-pre-built-function-source-details from oci fn function -# functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_pre_built_function_source_details.name) +def _build_direct_archive_details(kwargs, include_if_empty=True): + archive_file = _read_archive_file_value(kwargs.pop('archive_file', None)) + if archive_file is None and not include_if_empty: + return None + return { + 'archiveSourceType': 'DIRECT_ARCHIVE', + 'archiveFile': archive_file + } -# Remove create-function-none-failure-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_none_failure_destination_details.name) +def _build_fn_update_runtime_config(kwargs, include_if_empty=True): + functions_runtime_name = kwargs.pop('functions_runtime_name', None) + if functions_runtime_name is None and not include_if_empty: + return None -# Remove create-function-notification-failure-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_notification_failure_destination_details.name) + return { + 'runtimeConfigType': 'FUNCTION_UPDATE', + 'functionsRuntimeName': functions_runtime_name + } -# Remove create-function-queue-failure-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_queue_failure_destination_details.name) +def _build_manual_runtime_config(kwargs, functions_runtime_name_required, include_if_empty=True): + functions_runtime_version_id = kwargs.pop('functions_runtime_version_id', None) + functions_runtime_name = kwargs.pop('functions_runtime_name', None) + if not include_if_empty and functions_runtime_name is None and functions_runtime_version_id is None: + return None -# Remove create-function-stream-failure-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_stream_failure_destination_details.name) + runtime_config = { + 'runtimeConfigType': 'MANUAL', + 'functionsRuntimeVersionId': functions_runtime_version_id + } + if functions_runtime_name_required or functions_runtime_name is not None: + runtime_config['functionsRuntimeName'] = functions_runtime_name -# Remove update-function-none-failure-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_none_failure_destination_details.name) + return runtime_config -# Remove update-function-notification-failure-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_notification_failure_destination_details.name) +def _get_update_archive_source_type(kwargs): + archive_file_provided = kwargs.get('archive_file') is not None + object_storage_option_keys = ['bucket_name', 'namespace', 'object_name', 'object_version_id'] + object_storage_options_provided = [option_key for option_key in object_storage_option_keys if kwargs.get(option_key) is not None] + if archive_file_provided and object_storage_options_provided: + raise click.UsageError( + 'Cannot specify --archive-file with Object Storage archive options: --bucket-name, --namespace, --object-name, --object-version-id.' + ) -# Remove update-function-queue-failure-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_queue_failure_destination_details.name) + if object_storage_options_provided: + required_object_storage_option_keys = ['bucket_name', 'namespace', 'object_name'] + missing_required_options = [ + '--' + option_key.replace('_', '-') + for option_key in required_object_storage_option_keys + if kwargs.get(option_key) is None + ] + if missing_required_options: + raise click.UsageError( + 'Must specify --bucket-name, --namespace and --object-name together when using Object Storage archive options.' + ) + return 'OBJECT_STORAGE_ARCHIVE' + if archive_file_provided: + return 'DIRECT_ARCHIVE' -# Remove update-function-stream-failure-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_stream_failure_destination_details.name) + return None -# Remove create-function-none-success-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_none_success_destination_details.name) +def _build_update_archive_source_details(kwargs): + archive_source_type = _get_update_archive_source_type(kwargs) + if archive_source_type == 'OBJECT_STORAGE_ARCHIVE': + kwargs.pop('archive_file', None) + return _build_object_storage_archive_details(kwargs, include_if_empty=False) -# Remove create-function-notification-success-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_notification_success_destination_details.name) + if archive_source_type == 'DIRECT_ARCHIVE': + for option_key in ['bucket_name', 'namespace', 'object_name', 'object_version_id']: + kwargs.pop(option_key, None) + return _build_direct_archive_details(kwargs, include_if_empty=False) + for option_key in ['bucket_name', 'namespace', 'object_name', 'object_version_id', 'archive_file']: + kwargs.pop(option_key, None) + return None -# Remove create-function-queue-success-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_queue_success_destination_details.name) +def _build_update_runtime_config(ctx, kwargs): + runtime_config_type = kwargs.pop('runtime_config', None) + functions_runtime_name = kwargs.pop('functions_runtime_name', None) + functions_runtime_version_id = kwargs.pop('functions_runtime_version_id', None) -# Remove create-function-stream-success-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.create_function_stream_success_destination_details.name) + if runtime_config_type is None: + if (functions_runtime_name is not None or functions_runtime_version_id is not None) and not _is_generating_json_skeleton(ctx): + raise click.UsageError( + 'Must specify --runtime-config when using --functions-runtime-name or --functions-runtime-version-id.' + ) + return None + + if runtime_config_type == RUNTIME_CONFIG_FUNCTION_UPDATE: + if functions_runtime_name is None and not _is_generating_json_skeleton(ctx): + raise click.UsageError('Must specify --functions-runtime-name when --runtime-config is FUNCTION_UPDATE.') + return { + 'runtimeConfigType': RUNTIME_CONFIG_FUNCTION_UPDATE, + 'functionsRuntimeName': functions_runtime_name + } + + if runtime_config_type == RUNTIME_CONFIG_MANUAL: + if functions_runtime_version_id is None: + missing_options = ['--functions-runtime-version-id'] + else: + missing_options = [] + if missing_options and not _is_generating_json_skeleton(ctx): + raise click.UsageError( + 'Must specify --functions-runtime-version-id when --runtime-config is MANUAL.' + ) + runtime_config = { + 'runtimeConfigType': RUNTIME_CONFIG_MANUAL, + 'functionsRuntimeVersionId': functions_runtime_version_id + } + if functions_runtime_name is not None: + runtime_config['functionsRuntimeName'] = functions_runtime_name + return runtime_config + + return None + + +def _build_archive_source_details(archive_source_details, runtime_config, kwargs): + source_details = { + 'sourceType': 'ARCHIVE' + } + + if archive_source_details is not None: + source_details['archiveSourceDetails'] = archive_source_details + if runtime_config is not None: + source_details['runtimeConfig'] = runtime_config + + handler = kwargs.pop('handler', None) + _add_if_present(source_details, 'handler', handler) + + return source_details + + +def _build_container_source_details(kwargs, image_required): + source_details = {'sourceType': 'CONTAINER_IMAGE'} + + image = kwargs.pop('image', None) + if image_required or image is not None: + source_details['image'] = image + + image_digest = kwargs.pop('image_digest', None) + _add_if_present(source_details, 'imageDigest', image_digest) + + return source_details + + +def _is_generating_json_skeleton(ctx): + return ctx.obj.get('generate_full_command_json_input') or ctx.obj.get('generate_param_json_input') + + +def _require_option_for_execution(ctx, kwargs, option_key, option_name, command_name): + if _is_generating_json_skeleton(ctx): + return + if kwargs.get(option_key) is None: + raise click.UsageError('Must specify {} when using {}.'.format(option_name, command_name)) + + +# Remove generated function commands replaced by the preferred type-aware command hierarchy. +for attr in [ + 'create_function', + 'update_function', + 'create_function_create_archive_function_source_details', + 'create_function_create_container_image_function_source_details', + 'create_function_create_pre_built_function_source_details', + 'update_function_update_archive_function_source_details', + 'update_function_update_container_image_function_source_details' +]: + _pop_function_command_if_present(attr) + + +# Remove generated flattening variants already hidden by this extended command surface. +for attr in [ + 'create_function_none_provisioned_concurrency_config', + 'create_function_constant_provisioned_concurrency_config', + 'update_function_none_provisioned_concurrency_config', + 'update_function_constant_provisioned_concurrency_config', + 'create_function_none_failure_destination_details', + 'create_function_notification_failure_destination_details', + 'create_function_queue_failure_destination_details', + 'create_function_stream_failure_destination_details', + 'update_function_none_failure_destination_details', + 'update_function_notification_failure_destination_details', + 'update_function_queue_failure_destination_details', + 'update_function_stream_failure_destination_details', + 'create_function_none_success_destination_details', + 'create_function_notification_success_destination_details', + 'create_function_queue_success_destination_details', + 'create_function_stream_success_destination_details', + 'update_function_none_success_destination_details', + 'update_function_notification_success_destination_details', + 'update_function_queue_success_destination_details', + 'update_function_stream_success_destination_details' +]: + _pop_function_command_if_present(attr) + + +@click.group(name='create', cls=CommandGroupWithAlias, help=functionsmanagement_cli.create_function.help) +@cli_util.help_option_group +def function_create_group(): + pass -# Remove update-function-none-success-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_none_success_destination_details.name) +@click.group(name='update', cls=CommandGroupWithAlias, help=functionsmanagement_cli.update_function.help) +@cli_util.help_option_group +def function_update_group(): + pass -# Remove update-function-notification-success-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_notification_success_destination_details.name) +functionsmanagement_cli.function_group.add_command(function_create_group) +functionsmanagement_cli.function_group.add_command(function_update_group) -# Remove update-function-queue-success-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_queue_success_destination_details.name) +@function_create_group.group(name='archive-function', cls=CommandGroupWithAlias, help=ARCHIVE_FUNCTION_GROUP_HELP) +@cli_util.help_option_group +def create_archive_function_group(): + pass -# Remove update-function-stream-success-destination-details from oci fn function -functionsmanagement_cli.function_group.commands.pop(functionsmanagement_cli.update_function_stream_success_destination_details.name) + +@create_archive_function_group.group(name='object-storage', cls=CommandGroupWithAlias, help=OBJECT_STORAGE_ARCHIVE_GROUP_HELP) +@cli_util.help_option_group +def create_archive_object_storage_group(): + pass + + +@create_archive_function_group.group(name='direct-archive', cls=CommandGroupWithAlias, help=DIRECT_ARCHIVE_GROUP_HELP) +@cli_util.help_option_group +def create_archive_direct_archive_group(): + pass + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.create_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@create_archive_object_storage_group.command(name='fn-update-runtime-config', help=functionsmanagement_cli.create_function.help) +@cli_util.option('--bucket-name', required=True, help=BUCKET_NAME_HELP) +@cli_util.option('--namespace', required=True, help=NAMESPACE_HELP) +@cli_util.option('--object-name', required=True, help=OBJECT_NAME_HELP) +@cli_util.option('--object-version-id', help=OBJECT_VERSION_ID_HELP) +@cli_util.option('--functions-runtime-name', required=True, help=FUNCTIONS_RUNTIME_NAME_HELP) +@cli_util.option('--handler', help=HANDLER_HELP) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def create_archive_object_storage_fn_update_runtime_config(ctx, **kwargs): + source_details = _build_archive_source_details( + _build_object_storage_archive_details(kwargs), + _build_fn_update_runtime_config(kwargs), + kwargs + ) + _invoke_create(ctx, kwargs, source_details) + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.create_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@create_archive_object_storage_group.command(name='manual-runtime-config', help=functionsmanagement_cli.create_function.help) +@cli_util.option('--bucket-name', required=True, help=BUCKET_NAME_HELP) +@cli_util.option('--namespace', required=True, help=NAMESPACE_HELP) +@cli_util.option('--object-name', required=True, help=OBJECT_NAME_HELP) +@cli_util.option('--object-version-id', help=OBJECT_VERSION_ID_HELP) +@cli_util.option('--functions-runtime-name', required=True, help=FUNCTIONS_RUNTIME_NAME_HELP) +@cli_util.option('--functions-runtime-version-id', required=True, help=FUNCTIONS_RUNTIME_VERSION_ID_HELP) +@cli_util.option('--handler', help=HANDLER_HELP) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def create_archive_object_storage_manual_runtime_config(ctx, **kwargs): + source_details = _build_archive_source_details( + _build_object_storage_archive_details(kwargs), + _build_manual_runtime_config(kwargs, functions_runtime_name_required=True), + kwargs + ) + _invoke_create(ctx, kwargs, source_details) + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.create_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@create_archive_direct_archive_group.command(name='fn-update-runtime-config', help=functionsmanagement_cli.create_function.help) +@cli_util.option('--archive-file', required=True, help=ARCHIVE_FILE_HELP) +@cli_util.option('--functions-runtime-name', required=True, help=FUNCTIONS_RUNTIME_NAME_HELP) +@cli_util.option('--handler', help=HANDLER_HELP) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def create_archive_direct_archive_fn_update_runtime_config(ctx, **kwargs): + source_details = _build_archive_source_details( + _build_direct_archive_details(kwargs), + _build_fn_update_runtime_config(kwargs), + kwargs + ) + _invoke_create(ctx, kwargs, source_details) + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.create_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@create_archive_direct_archive_group.command(name='manual-runtime-config', help=functionsmanagement_cli.create_function.help) +@cli_util.option('--archive-file', required=True, help=ARCHIVE_FILE_HELP) +@cli_util.option('--functions-runtime-name', required=True, help=FUNCTIONS_RUNTIME_NAME_HELP) +@cli_util.option('--functions-runtime-version-id', required=True, help=FUNCTIONS_RUNTIME_VERSION_ID_HELP) +@cli_util.option('--handler', help=HANDLER_HELP) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def create_archive_direct_archive_manual_runtime_config(ctx, **kwargs): + source_details = _build_archive_source_details( + _build_direct_archive_details(kwargs), + _build_manual_runtime_config(kwargs, functions_runtime_name_required=True), + kwargs + ) + _invoke_create(ctx, kwargs, source_details) + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.create_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@function_create_group.command(name='container-function', help=functionsmanagement_cli.create_function.help) +@cli_util.option('--image', required=True, help=IMAGE_HELP) +@cli_util.option('--image-digest', help=IMAGE_DIGEST_HELP) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def create_container_function(ctx, **kwargs): + _invoke_create(ctx, kwargs, _build_container_source_details(kwargs, image_required=True)) + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.create_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@function_create_group.command(name='pbf-function', help=functionsmanagement_cli.create_function.help) +@cli_util.option('--pbf-listing-id', required=True, help=PBF_LISTING_ID_HELP) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def create_pbf_function(ctx, **kwargs): + source_details = { + 'sourceType': 'PRE_BUILT_FUNCTIONS', + 'pbfListingId': kwargs.pop('pbf_listing_id') + } + _invoke_create(ctx, kwargs, source_details) + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.update_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@function_update_group.command(name='archive-function', help=functionsmanagement_cli.update_function.help) +@cli_util.option('--bucket-name', help=BUCKET_NAME_HELP) +@cli_util.option('--namespace', help=NAMESPACE_HELP) +@cli_util.option('--object-name', help=OBJECT_NAME_HELP) +@cli_util.option('--object-version-id', help=OBJECT_VERSION_ID_HELP) +@cli_util.option('--functions-runtime-name', help=FUNCTIONS_RUNTIME_NAME_HELP) +@cli_util.option('--functions-runtime-version-id', help=FUNCTIONS_RUNTIME_VERSION_ID_HELP) +@cli_util.option('--archive-file', help=ARCHIVE_FILE_HELP) +@cli_util.option('--runtime-config', type=custom_types.CliCaseInsensitiveChoice([RUNTIME_CONFIG_FUNCTION_UPDATE, RUNTIME_CONFIG_MANUAL]), help=RUNTIME_CONFIG_HELP) +@cli_util.option('--handler', help=HANDLER_HELP) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def update_archive_function(ctx, **kwargs): + source_details = _build_archive_source_details( + _build_update_archive_source_details(kwargs), + _build_update_runtime_config(ctx, kwargs), + kwargs + ) + _invoke_update(ctx, kwargs, source_details) + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.update_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@function_update_group.command(name='container-function', help=functionsmanagement_cli.update_function.help) +@cli_util.option('--image', help=IMAGE_HELP) +@cli_util.option('--image-digest', help=IMAGE_DIGEST_HELP) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def update_container_function(ctx, **kwargs): + _invoke_update(ctx, kwargs, _build_container_source_details(kwargs, image_required=False)) + + +@cli_util.copy_params_from_generated_command(functionsmanagement_cli.update_function, params_to_exclude=['source_details', 'provisioned_concurrency_config']) +@function_update_group.command(name='pbf-function', help=functionsmanagement_cli.update_function.help) +@cli_util.option('--provisioned-concurrency', type=custom_types.CLI_COMPLEX_TYPE, help=PROVISIONED_CONCURRENCY_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types=FUNCTION_COMPLEX_TYPES) +def update_pbf_function(ctx, **kwargs): + _invoke_update(ctx, kwargs) diff --git a/services/functions/src/oci_cli_functions_management/generated/__init__.py b/services/functions/src/oci_cli_functions_management/generated/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/src/oci_cli_functions_management/generated/__init__.py +++ b/services/functions/src/oci_cli_functions_management/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/src/oci_cli_functions_management/generated/client_mappings.py b/services/functions/src/oci_cli_functions_management/generated/client_mappings.py index 8c53200a4..7f7ad1653 100644 --- a/services/functions/src/oci_cli_functions_management/generated/client_mappings.py +++ b/services/functions/src/oci_cli_functions_management/generated/client_mappings.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 import oci from oci_cli.cli_clients import CLIENT_MAP diff --git a/services/functions/src/oci_cli_functions_management/generated/functionsmanagement_cli.py b/services/functions/src/oci_cli_functions_management/generated/functionsmanagement_cli.py index 641dee1fa..ec16bcf55 100644 --- a/services/functions/src/oci_cli_functions_management/generated/functionsmanagement_cli.py +++ b/services/functions/src/oci_cli_functions_management/generated/functionsmanagement_cli.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 from __future__ import print_function import click @@ -22,31 +22,43 @@ def functions_management_root_group(): pass -@click.command(cli_util.override('functions_management.pbf_listing_group.command_name', 'pbf-listing'), cls=CommandGroupWithAlias, help="""Note: Deprecated. Use the new resource model APIs instead. PbfListing resources provide details about the available PBFs for consumption by the user. This resource contains details about PBF's functionality, policies required, configuration parameters expected etc.""") +@click.command(cli_util.override('functions_management.pbf_listing_group.command_name', 'pbf-listing'), cls=CommandGroupWithAlias, help="""PbfListing resources provide details about the available PBFs for consumption by the user. This resource contains details about PBF's functionality, policies required, configuration parameters expected etc.""") @cli_util.help_option_group def pbf_listing_group(): pass -@click.command(cli_util.override('functions_management.application_group.command_name', 'application'), cls=CommandGroupWithAlias, help="""Note: Deprecated. Use the new resource model APIs instead. An application contains functions and defined attributes shared between those functions, such as network configuration and configuration. Avoid entering confidential information.""") +@click.command(cli_util.override('functions_management.application_group.command_name', 'application'), cls=CommandGroupWithAlias, help="""An application contains functions and defined attributes shared between those functions, such as network configuration and configuration. Avoid entering confidential information.""") @cli_util.help_option_group def application_group(): pass -@click.command(cli_util.override('functions_management.function_group.command_name', 'function'), cls=CommandGroupWithAlias, help="""Note: Deprecated. Use the new resource model APIs instead. A function resource defines the code (Docker image) and configuration for a specific function. Functions are defined in applications. Avoid entering confidential information.""") +@click.command(cli_util.override('functions_management.function_group.command_name', 'function'), cls=CommandGroupWithAlias, help="""A function resource defines the code (Docker image) and configuration for a specific function. Functions are defined in applications. Avoid entering confidential information.""") @cli_util.help_option_group def function_group(): pass -@click.command(cli_util.override('functions_management.triggers_collection_group.command_name', 'triggers-collection'), cls=CommandGroupWithAlias, help="""Note: Deprecated. Use the new resource model APIs instead. Results of a Trigger search. Contains boh TriggerSummary items and other information, such as metadata.""") +@click.command(cli_util.override('functions_management.triggers_collection_group.command_name', 'triggers-collection'), cls=CommandGroupWithAlias, help="""Results of a Trigger search. Contains boh TriggerSummary items and other information, such as metadata.""") @cli_util.help_option_group def triggers_collection_group(): pass -@click.command(cli_util.override('functions_management.pbf_listing_version_group.command_name', 'pbf-listing-version'), cls=CommandGroupWithAlias, help="""Note: Deprecated. Use the new resource model APIs instead. This represents a version of a PbfListing. Each new update from the publisher or the change in the image will result in the creation of new PbfListingVersion resource creation. This is a sub-resource of a PbfListing.""") +@click.command(cli_util.override('functions_management.functions_runtime_version_group.command_name', 'functions-runtime-version'), cls=CommandGroupWithAlias, help="""This represents a version of a FunctionsRuntime. Each new functional update to a FunctionsRuntime from the Functions team will change the image that will result in the creation of new FunctionsRuntimeVersion resource creation. This is a sub-resource of a FunctionsRuntime.""") +@cli_util.help_option_group +def functions_runtime_version_group(): + pass + + +@click.command(cli_util.override('functions_management.functions_runtime_group.command_name', 'functions-runtime'), cls=CommandGroupWithAlias, help="""FunctionsRuntime resources provide details about the available runtimes for consumption by the user. This resource contains details about the runtimes supported language and os etc.""") +@cli_util.help_option_group +def functions_runtime_group(): + pass + + +@click.command(cli_util.override('functions_management.pbf_listing_version_group.command_name', 'pbf-listing-version'), cls=CommandGroupWithAlias, help="""This represents a version of a PbfListing. Each new update from the publisher or the change in the image will result in the creation of new PbfListingVersion resource creation. This is a sub-resource of a PbfListing.""") @cli_util.help_option_group def pbf_listing_version_group(): pass @@ -57,19 +69,24 @@ def pbf_listing_version_group(): functions_management_root_group.add_command(application_group) functions_management_root_group.add_command(function_group) functions_management_root_group.add_command(triggers_collection_group) +functions_management_root_group.add_command(functions_runtime_version_group) +functions_management_root_group.add_command(functions_runtime_group) functions_management_root_group.add_command(pbf_listing_version_group) -@application_group.command(name=cli_util.override('functions_management.change_application_compartment.command_name', 'change-compartment'), help=u"""Note: Deprecated. Use the new operation instead. Moves an application into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources Between Compartments]. \n[Command Reference](changeApplicationCompartment)""") +@application_group.command(name=cli_util.override('functions_management.change_application_compartment.command_name', 'change-compartment'), help=u"""Moves an application into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources Between Compartments]. \n[Command Reference](changeApplicationCompartment)""") @cli_util.option('--application-id', required=True, help=u"""The [OCID] of this application.""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment into which the resource should be moved.""") @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.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def change_application_compartment(ctx, from_json, application_id, compartment_id, if_match): +def change_application_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, application_id, compartment_id, if_match): if isinstance(application_id, six.string_types) and len(application_id.strip()) == 0: raise click.UsageError('Parameter --application-id cannot be whitespace or empty string') @@ -88,10 +105,37 @@ def change_application_compartment(ctx, from_json, application_id, compartment_i change_application_compartment_details=_details, **kwargs ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@application_group.command(name=cli_util.override('functions_management.create_application.command_name', 'create'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new application.\" \n[Command Reference](createApplication)""") +@application_group.command(name=cli_util.override('functions_management.create_application.command_name', 'create'), help=u"""Creates a new application. \n[Command Reference](createApplication)""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment to create the application within.""") @cli_util.option('--display-name', required=True, help=u"""The display name of the application. The display name must be unique within the compartment containing the application. Avoid entering confidential information.""") @cli_util.option('--subnet-ids', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""The [OCID]s of the subnets in which to run functions in the application.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -117,9 +161,9 @@ def change_application_compartment(ctx, from_json, application_id, compartment_i @cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Security attributes for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"enforce\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") @json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'subnet-ids': {'module': 'functions', 'class': 'list[string]'}, 'network-security-group-ids': {'module': 'functions', 'class': 'list[string]'}, 'trace-config': {'module': 'functions', 'class': 'ApplicationTraceConfig'}, 'logging': {'module': 'functions', 'class': 'ApplicationLoggingConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'image-policy-config': {'module': 'functions', 'class': 'ImagePolicyConfig'}, 'security-attributes': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context @@ -172,37 +216,39 @@ def create_application(ctx, from_json, wait_for_state, max_wait_seconds, wait_in ) if wait_for_state: - if hasattr(client, 'get_application') and callable(getattr(client, 'get_application')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_application(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function.command_name', 'create'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function.command_name', 'create'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` @@ -220,15 +266,15 @@ def create_application(ctx, from_json, wait_for_state, max_wait_seconds, wait_in @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags): +def create_function(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -236,17 +282,9 @@ def create_function(ctx, from_json, wait_for_state, max_wait_seconds, wait_inter _details = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) - if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -281,37 +319,39 @@ def create_function(ctx, from_json, wait_for_state, max_wait_seconds, wait_inter ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_pre_built_function_source_details.command_name', 'create-function-pre-built-function-source-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_create_pre_built_function_source_details.command_name', 'create-function-create-pre-built-function-source-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--source-details-pbf-listing-id', required=True, help=u"""The [OCID] of the PbfListing this function is sourced from.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` @@ -329,15 +369,15 @@ def create_function(ctx, from_json, wait_for_state, max_wait_seconds, wait_inter @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") @json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_pre_built_function_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, source_details_pbf_listing_id, image, image_digest, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags): +def create_function_create_pre_built_function_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, source_details_pbf_listing_id, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -349,12 +389,6 @@ def create_function_pre_built_function_source_details(ctx, from_json, wait_for_s _details['memoryInMBs'] = memory_in_mbs _details['sourceDetails']['pbfListingId'] = source_details_pbf_listing_id - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -391,43 +425,47 @@ def create_function_pre_built_function_source_details(ctx, from_json, wait_for_s ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_none_provisioned_concurrency_config.command_name', 'create-function-none-provisioned-concurrency-config'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_create_archive_function_source_details.command_name', 'create-function-create-archive-function-source-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details-archive-source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details-runtime-config', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") +@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -438,33 +476,27 @@ def create_function_pre_built_function_source_details(ctx, from_json, wait_for_s @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--source-details-handler', help=u"""The function handler that is executed when the function is invoked. The value of this field depends on the runtime used""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'source-details-archive-source-details': {'module': 'functions', 'class': 'CreateArchiveSourceDetails'}, 'source-details-runtime-config': {'module': 'functions', 'class': 'CreateRuntimeConfig'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'source-details-archive-source-details': {'module': 'functions', 'class': 'CreateArchiveSourceDetails'}, 'source-details-runtime-config': {'module': 'functions', 'class': 'CreateRuntimeConfig'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_none_provisioned_concurrency_config(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, image, image_digest, source_details, config, timeout_in_seconds, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags): +def create_function_create_archive_function_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, source_details_archive_source_details, source_details_runtime_config, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags, source_details_handler): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['provisionedConcurrencyConfig'] = {} + _details['sourceDetails'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id _details['memoryInMBs'] = memory_in_mbs - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['sourceDetails']['archiveSourceDetails'] = cli_util.parse_json_parameter("source_details_archive_source_details", source_details_archive_source_details) + _details['sourceDetails']['runtimeConfig'] = cli_util.parse_json_parameter("source_details_runtime_config", source_details_runtime_config) if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -472,6 +504,9 @@ def create_function_none_provisioned_concurrency_config(ctx, from_json, wait_for if timeout_in_seconds is not None: _details['timeoutInSeconds'] = timeout_in_seconds + if provisioned_concurrency_config is not None: + _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) + if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds @@ -490,7 +525,10 @@ def create_function_none_provisioned_concurrency_config(ctx, from_json, wait_for if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['provisionedConcurrencyConfig']['strategy'] = 'NONE' + if source_details_handler is not None: + _details['sourceDetails']['handler'] = source_details_handler + + _details['sourceDetails']['sourceType'] = 'ARCHIVE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -499,44 +537,46 @@ def create_function_none_provisioned_concurrency_config(ctx, from_json, wait_for ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_constant_provisioned_concurrency_config.command_name', 'create-function-constant-provisioned-concurrency-config'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_create_container_image_function_source_details.command_name', 'create-function-create-container-image-function-source-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--provisioned-concurrency-config-count', required=True, type=click.INT, help=u"""Configuration specifying a constant amount of provisioned concurrency.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details-image', required=True, help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") +@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -547,34 +587,26 @@ def create_function_none_provisioned_concurrency_config(ctx, from_json, wait_for @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--source-details-image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_constant_provisioned_concurrency_config(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, provisioned_concurrency_config_count, image, image_digest, source_details, config, timeout_in_seconds, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags): +def create_function_create_container_image_function_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, source_details_image, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags, source_details_image_digest): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['provisionedConcurrencyConfig'] = {} + _details['sourceDetails'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id _details['memoryInMBs'] = memory_in_mbs - _details['provisionedConcurrencyConfig']['count'] = provisioned_concurrency_config_count - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['sourceDetails']['image'] = source_details_image if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -582,6 +614,9 @@ def create_function_constant_provisioned_concurrency_config(ctx, from_json, wait if timeout_in_seconds is not None: _details['timeoutInSeconds'] = timeout_in_seconds + if provisioned_concurrency_config is not None: + _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) + if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds @@ -600,7 +635,10 @@ def create_function_constant_provisioned_concurrency_config(ctx, from_json, wait if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['provisionedConcurrencyConfig']['strategy'] = 'CONSTANT' + if source_details_image_digest is not None: + _details['sourceDetails']['imageDigest'] = source_details_image_digest + + _details['sourceDetails']['sourceType'] = 'CONTAINER_IMAGE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -609,46 +647,47 @@ def create_function_constant_provisioned_concurrency_config(ctx, from_json, wait ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_stream_failure_destination_details.command_name', 'create-function-stream-failure-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_none_provisioned_concurrency_config.command_name', 'create-function-none-provisioned-concurrency-config'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--failure-destination-stream-id', required=True, help=u"""The [OCID] of the stream.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") -@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") +@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. @@ -657,34 +696,25 @@ def create_function_constant_provisioned_concurrency_config(ctx, from_json, wait @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_stream_failure_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, failure_destination_stream_id, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags): +def create_function_none_provisioned_concurrency_config(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, config, timeout_in_seconds, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['failureDestination'] = {} + _details['provisionedConcurrencyConfig'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - _details['failureDestination']['streamId'] = failure_destination_stream_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -692,12 +722,12 @@ def create_function_stream_failure_destination_details(ctx, from_json, wait_for_ if timeout_in_seconds is not None: _details['timeoutInSeconds'] = timeout_in_seconds - if provisioned_concurrency_config is not None: - _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) - if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds + if failure_destination is not None: + _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + if success_destination is not None: _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) @@ -710,7 +740,7 @@ def create_function_stream_failure_destination_details(ctx, from_json, wait_for_ if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['failureDestination']['kind'] = 'STREAM' + _details['provisionedConcurrencyConfig']['strategy'] = 'NONE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -719,46 +749,48 @@ def create_function_stream_failure_destination_details(ctx, from_json, wait_for_ ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_queue_failure_destination_details.command_name', 'create-function-queue-failure-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_constant_provisioned_concurrency_config.command_name', 'create-function-constant-provisioned-concurrency-config'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--failure-destination-queue-id', required=True, help=u"""The [OCID] of the queue.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--provisioned-concurrency-config-count', required=True, type=click.INT, help=u"""Configuration specifying a constant amount of provisioned concurrency.""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") -@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") +@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. @@ -767,35 +799,26 @@ def create_function_stream_failure_destination_details(ctx, from_json, wait_for_ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--failure-destination-channel-id', help=u"""The ID of the channel in the queue.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_queue_failure_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, failure_destination_queue_id, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags, failure_destination_channel_id): +def create_function_constant_provisioned_concurrency_config(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, provisioned_concurrency_config_count, config, timeout_in_seconds, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['failureDestination'] = {} + _details['provisionedConcurrencyConfig'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - _details['failureDestination']['queueId'] = failure_destination_queue_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['provisionedConcurrencyConfig']['count'] = provisioned_concurrency_config_count if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -803,12 +826,12 @@ def create_function_queue_failure_destination_details(ctx, from_json, wait_for_s if timeout_in_seconds is not None: _details['timeoutInSeconds'] = timeout_in_seconds - if provisioned_concurrency_config is not None: - _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) - if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds + if failure_destination is not None: + _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + if success_destination is not None: _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) @@ -821,10 +844,7 @@ def create_function_queue_failure_destination_details(ctx, from_json, wait_for_s if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - if failure_destination_channel_id is not None: - _details['failureDestination']['channelId'] = failure_destination_channel_id - - _details['failureDestination']['kind'] = 'QUEUE' + _details['provisionedConcurrencyConfig']['strategy'] = 'CONSTANT' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -833,38 +853,40 @@ def create_function_queue_failure_destination_details(ctx, from_json, wait_for_s ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_notification_failure_destination_details.command_name', 'create-function-notification-failure-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_stream_failure_destination_details.command_name', 'create-function-stream-failure-destination-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--failure-destination-topic-id', required=True, help=u"""The [OCID] of the topic.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--failure-destination-stream-id', required=True, help=u"""The [OCID] of the stream.""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` @@ -881,15 +903,15 @@ def create_function_queue_failure_destination_details(ctx, from_json, wait_for_s @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_notification_failure_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, failure_destination_topic_id, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags): +def create_function_stream_failure_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, failure_destination_stream_id, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -898,17 +920,9 @@ def create_function_notification_failure_destination_details(ctx, from_json, wai _details['failureDestination'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - _details['failureDestination']['topicId'] = failure_destination_topic_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['failureDestination']['streamId'] = failure_destination_stream_id if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -934,7 +948,7 @@ def create_function_notification_failure_destination_details(ctx, from_json, wai if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['failureDestination']['kind'] = 'NOTIFICATION' + _details['failureDestination']['kind'] = 'STREAM' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -943,37 +957,40 @@ def create_function_notification_failure_destination_details(ctx, from_json, wai ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_none_failure_destination_details.command_name', 'create-function-none-failure-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_queue_failure_destination_details.command_name', 'create-function-queue-failure-destination-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--failure-destination-queue-id', required=True, help=u"""The [OCID] of the queue.""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` @@ -990,15 +1007,16 @@ def create_function_notification_failure_destination_details(ctx, from_json, wai @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--failure-destination-channel-id', help=u"""The ID of the channel in the queue.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_none_failure_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags): +def create_function_queue_failure_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, failure_destination_queue_id, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags, failure_destination_channel_id): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1007,16 +1025,9 @@ def create_function_none_failure_destination_details(ctx, from_json, wait_for_st _details['failureDestination'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['failureDestination']['queueId'] = failure_destination_queue_id if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -1042,7 +1053,10 @@ def create_function_none_failure_destination_details(ctx, from_json, wait_for_st if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['failureDestination']['kind'] = 'NONE' + if failure_destination_channel_id is not None: + _details['failureDestination']['channelId'] = failure_destination_channel_id + + _details['failureDestination']['kind'] = 'QUEUE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -1051,38 +1065,40 @@ def create_function_none_failure_destination_details(ctx, from_json, wait_for_st ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_stream_success_destination_details.command_name', 'create-function-stream-success-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_notification_failure_destination_details.command_name', 'create-function-notification-failure-destination-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--success-destination-stream-id', required=True, help=u"""The [OCID] of the stream.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--failure-destination-topic-id', required=True, help=u"""The [OCID] of the topic.""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` @@ -1091,7 +1107,7 @@ def create_function_none_failure_destination_details(ctx, from_json, wait_for_st @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") @cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") -@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. @@ -1099,34 +1115,26 @@ def create_function_none_failure_destination_details(ctx, from_json, wait_for_st @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_stream_success_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, success_destination_stream_id, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags): +def create_function_notification_failure_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, failure_destination_topic_id, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['successDestination'] = {} + _details['failureDestination'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - _details['successDestination']['streamId'] = success_destination_stream_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['failureDestination']['topicId'] = failure_destination_topic_id if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -1140,8 +1148,8 @@ def create_function_stream_success_destination_details(ctx, from_json, wait_for_ if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds - if failure_destination is not None: - _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + if success_destination is not None: + _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) @@ -1152,7 +1160,7 @@ def create_function_stream_success_destination_details(ctx, from_json, wait_for_ if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['successDestination']['kind'] = 'STREAM' + _details['failureDestination']['kind'] = 'NOTIFICATION' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -1161,38 +1169,39 @@ def create_function_stream_success_destination_details(ctx, from_json, wait_for_ ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_notification_success_destination_details.command_name', 'create-function-notification-success-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_none_failure_destination_details.command_name', 'create-function-none-failure-destination-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--success-destination-topic-id', required=True, help=u"""The [OCID] of the topic.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` @@ -1201,7 +1210,7 @@ def create_function_stream_success_destination_details(ctx, from_json, wait_for_ @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") @cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") -@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. @@ -1209,34 +1218,25 @@ def create_function_stream_success_destination_details(ctx, from_json, wait_for_ @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_notification_success_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, success_destination_topic_id, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags): +def create_function_none_failure_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['successDestination'] = {} + _details['failureDestination'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - _details['successDestination']['topicId'] = success_destination_topic_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -1250,8 +1250,8 @@ def create_function_notification_success_destination_details(ctx, from_json, wai if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds - if failure_destination is not None: - _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + if success_destination is not None: + _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) @@ -1262,7 +1262,7 @@ def create_function_notification_success_destination_details(ctx, from_json, wai if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['successDestination']['kind'] = 'NOTIFICATION' + _details['failureDestination']['kind'] = 'NONE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -1271,38 +1271,40 @@ def create_function_notification_success_destination_details(ctx, from_json, wai ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_queue_success_destination_details.command_name', 'create-function-queue-success-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_stream_success_destination_details.command_name', 'create-function-stream-success-destination-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--success-destination-queue-id', required=True, help=u"""The [OCID] of the queue.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--success-destination-stream-id', required=True, help=u"""The [OCID] of the stream.""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` @@ -1319,16 +1321,15 @@ def create_function_notification_success_destination_details(ctx, from_json, wai @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--success-destination-channel-id', help=u"""The ID of the channel in the queue.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_queue_success_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, success_destination_queue_id, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags, success_destination_channel_id): +def create_function_stream_success_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, success_destination_stream_id, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1337,17 +1338,9 @@ def create_function_queue_success_destination_details(ctx, from_json, wait_for_s _details['successDestination'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - _details['successDestination']['queueId'] = success_destination_queue_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['successDestination']['streamId'] = success_destination_stream_id if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -1373,10 +1366,7 @@ def create_function_queue_success_destination_details(ctx, from_json, wait_for_s if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - if success_destination_channel_id is not None: - _details['successDestination']['channelId'] = success_destination_channel_id - - _details['successDestination']['kind'] = 'QUEUE' + _details['successDestination']['kind'] = 'STREAM' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -1385,37 +1375,40 @@ def create_function_queue_success_destination_details(ctx, from_json, wait_for_s ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.create_function_none_success_destination_details.command_name', 'create-function-none-success-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Creates a new function.\" \n[Command Reference](createFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_notification_success_destination_details.command_name', 'create-function-notification-success-destination-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") @cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") @cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") -@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--success-destination-topic-id', required=True, help=u"""The [OCID] of the topic.""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` @@ -1432,15 +1425,15 @@ def create_function_queue_success_destination_details(ctx, from_json, wait_for_s @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'FunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def create_function_none_success_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, memory_in_mbs, image, image_digest, source_details, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags): +def create_function_notification_success_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, success_destination_topic_id, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1449,16 +1442,9 @@ def create_function_none_success_destination_details(ctx, from_json, wait_for_st _details['successDestination'] = {} _details['displayName'] = display_name _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) _details['memoryInMBs'] = memory_in_mbs - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest - - if source_details is not None: - _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['successDestination']['topicId'] = success_destination_topic_id if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) @@ -1484,7 +1470,7 @@ def create_function_none_success_destination_details(ctx, from_json, wait_for_st if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['successDestination']['kind'] = 'NONE' + _details['successDestination']['kind'] = 'NOTIFICATION' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.create_function( @@ -1493,101 +1479,307 @@ def create_function_none_success_destination_details(ctx, from_json, wait_for_st ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@application_group.command(name=cli_util.override('functions_management.delete_application.command_name', 'delete'), help=u"""Note: Deprecated. Use the new operation instead. Deletes an application. \n[Command Reference](deleteApplication)""") -@cli_util.option('--application-id', required=True, help=u"""The [OCID] of this application.""") -@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.""") -@cli_util.confirm_delete_option -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@function_group.command(name=cli_util.override('functions_management.create_function_queue_success_destination_details.command_name', 'create-function-queue-success-destination-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") +@cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") +@cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") +@cli_util.option('--success-destination-queue-id', required=True, help=u"""The [OCID] of the queue.""") +@cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. + +Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` + +The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") +@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") +@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. + +Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) +@cli_util.option('--success-destination-channel-id', help=u"""The ID of the channel in the queue.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) @cli_util.wrap_exceptions -def delete_application(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, application_id, if_match): - - if isinstance(application_id, six.string_types) and len(application_id.strip()) == 0: - raise click.UsageError('Parameter --application-id cannot be whitespace or empty string') +def create_function_queue_success_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, success_destination_queue_id, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags, success_destination_channel_id): kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('functions', 'functions_management', ctx) - result = client.delete_application( - application_id=application_id, - **kwargs - ) - if wait_for_state: - if hasattr(client, 'get_application') and callable(getattr(client, 'get_application')): - try: - wait_period_kwargs = {} - if max_wait_seconds is not None: - wait_period_kwargs['max_wait_seconds'] = max_wait_seconds - if wait_interval_seconds is not None: - wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + _details = {} + _details['successDestination'] = {} + _details['displayName'] = display_name + _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['memoryInMBs'] = memory_in_mbs + _details['successDestination']['queueId'] = success_destination_queue_id - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - oci.wait_until(client, client.get_application(application_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs) - except oci.exceptions.ServiceError as e: - # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the - # outcome of a delete operation it is possible that the resource is already gone and so the initial service call - # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising - # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument - # succeed_on_not_found=True to the waiter). - # - # Any non-404 should still result in the exception being thrown. - if e.status == 404: - pass - else: - raise - except oci.exceptions.MaximumWaitTimeExceeded as e: - # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr) - cli_util.render_response(result, ctx) - sys.exit(2) - except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + if config is not None: + _details['config'] = cli_util.parse_json_parameter("config", config) + + if timeout_in_seconds is not None: + _details['timeoutInSeconds'] = timeout_in_seconds + + if provisioned_concurrency_config is not None: + _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) + + if detached_mode_timeout_in_seconds is not None: + _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds + + if failure_destination is not None: + _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + + if trace_config is not None: + _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if success_destination_channel_id is not None: + _details['successDestination']['channelId'] = success_destination_channel_id + + _details['successDestination']['kind'] = 'QUEUE' + + client = cli_util.build_client('functions', 'functions_management', ctx) + result = client.create_function( + create_function_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.delete_function.command_name', 'delete'), help=u"""Note: Deprecated. Use the new operation instead. Deletes a function. \n[Command Reference](deleteFunction)""") +@function_group.command(name=cli_util.override('functions_management.create_function_none_success_destination_details.command_name', 'create-function-none-success-destination-details'), help=u"""Creates a new function. \n[Command Reference](createFunction)""") +@cli_util.option('--display-name', required=True, help=u"""The display name of the function. The display name must be unique within the application containing the function. Avoid entering confidential information.""") +@cli_util.option('--application-id', required=True, help=u"""The OCID of the application this function belongs to.""") +@cli_util.option('--source-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--memory-in-mbs', required=True, type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") +@cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. + +Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` + +The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") +@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") +@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. + +Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'source-details': {'module': 'functions', 'class': 'CreateFunctionSourceDetails'}, 'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@cli_util.wrap_exceptions +def create_function_none_success_destination_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, application_id, source_details, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['successDestination'] = {} + _details['displayName'] = display_name + _details['applicationId'] = application_id + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + _details['memoryInMBs'] = memory_in_mbs + + if config is not None: + _details['config'] = cli_util.parse_json_parameter("config", config) + + if timeout_in_seconds is not None: + _details['timeoutInSeconds'] = timeout_in_seconds + + if provisioned_concurrency_config is not None: + _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) + + if detached_mode_timeout_in_seconds is not None: + _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds + + if failure_destination is not None: + _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + + if trace_config is not None: + _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + _details['successDestination']['kind'] = 'NONE' + + client = cli_util.build_client('functions', 'functions_management', ctx) + result = client.create_function( + create_function_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@application_group.command(name=cli_util.override('functions_management.delete_application.command_name', 'delete'), help=u"""Deletes an application. \n[Command Reference](deleteApplication)""") +@cli_util.option('--application-id', required=True, help=u"""The [OCID] of this application.""") +@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.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_application(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, application_id, if_match): + + if isinstance(application_id, six.string_types) and len(application_id.strip()) == 0: + raise click.UsageError('Parameter --application-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('functions', 'functions_management', ctx) + result = client.delete_application( + application_id=application_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + 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) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@function_group.command(name=cli_util.override('functions_management.delete_function.command_name', 'delete'), help=u"""Deletes a function. \n[Command Reference](deleteFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") @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.""") @cli_util.confirm_delete_option -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context @@ -1609,43 +1801,35 @@ def delete_function(ctx, from_json, wait_for_state, max_wait_seconds, wait_inter ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - oci.wait_until(client, client.get_function(function_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs) - except oci.exceptions.ServiceError as e: - # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the - # outcome of a delete operation it is possible that the resource is already gone and so the initial service call - # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising - # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument - # succeed_on_not_found=True to the waiter). - # - # Any non-404 should still result in the exception being thrown. - if e.status == 404: - pass - else: - raise + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr) + 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) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@application_group.command(name=cli_util.override('functions_management.get_application.command_name', 'get'), help=u"""Note: Deprecated. Use the new operation instead. \"Retrieves an application.\" \n[Command Reference](getApplication)""") +@application_group.command(name=cli_util.override('functions_management.get_application.command_name', 'get'), help=u"""Retrieves an application. \n[Command Reference](getApplication)""") @cli_util.option('--application-id', required=True, help=u"""The [OCID] of this application.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @@ -1667,7 +1851,7 @@ def get_application(ctx, from_json, application_id): cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.get_function.command_name', 'get'), help=u"""Note: Deprecated. Use the new operation instead. \"Retrieves a function.\" \n[Command Reference](getFunction)""") +@function_group.command(name=cli_util.override('functions_management.get_function.command_name', 'get'), help=u"""Retrieves a function. \n[Command Reference](getFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @@ -1689,7 +1873,51 @@ def get_function(ctx, from_json, function_id): cli_util.render_response(result, ctx) -@pbf_listing_group.command(name=cli_util.override('functions_management.get_pbf_listing.command_name', 'get'), help=u"""Note: Deprecated. Use the new operation instead. Fetches a Pre-built Function(PBF) Listing. Returns a PbfListing response model. \n[Command Reference](getPbfListing)""") +@functions_runtime_group.command(name=cli_util.override('functions_management.get_functions_runtime.command_name', 'get'), help=u"""Fetches a FunctionsRuntime by ID. Returns a FunctionsRuntime response model. \n[Command Reference](getFunctionsRuntime)""") +@cli_util.option('--functions-runtime-id', required=True, help=u"""unique FunctionsRuntime identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'functions', 'class': 'FunctionsRuntime'}) +@cli_util.wrap_exceptions +def get_functions_runtime(ctx, from_json, functions_runtime_id): + + if isinstance(functions_runtime_id, six.string_types) and len(functions_runtime_id.strip()) == 0: + raise click.UsageError('Parameter --functions-runtime-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('functions', 'functions_management', ctx) + result = client.get_functions_runtime( + functions_runtime_id=functions_runtime_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@functions_runtime_version_group.command(name=cli_util.override('functions_management.get_functions_runtime_version.command_name', 'get'), help=u"""Fetches a FunctionsRuntimeVersion by ID. Returns a FunctionsRuntimeVersion response model. \n[Command Reference](getFunctionsRuntimeVersion)""") +@cli_util.option('--functions-runtime-version-id', required=True, help=u"""unique FunctionsRuntimeVersion identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'functions', 'class': 'FunctionsRuntimeVersion'}) +@cli_util.wrap_exceptions +def get_functions_runtime_version(ctx, from_json, functions_runtime_version_id): + + if isinstance(functions_runtime_version_id, six.string_types) and len(functions_runtime_version_id.strip()) == 0: + raise click.UsageError('Parameter --functions-runtime-version-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('functions', 'functions_management', ctx) + result = client.get_functions_runtime_version( + functions_runtime_version_id=functions_runtime_version_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@pbf_listing_group.command(name=cli_util.override('functions_management.get_pbf_listing.command_name', 'get'), help=u"""Fetches a Pre-built Function(PBF) Listing. Returns a PbfListing response model. \n[Command Reference](getPbfListing)""") @cli_util.option('--pbf-listing-id', required=True, help=u"""unique PbfListing identifier""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @@ -1711,7 +1939,7 @@ def get_pbf_listing(ctx, from_json, pbf_listing_id): cli_util.render_response(result, ctx) -@pbf_listing_version_group.command(name=cli_util.override('functions_management.get_pbf_listing_version.command_name', 'get'), help=u"""Note: Deprecated. Use the new operation instead. Gets a PbfListingVersion by identifier for a PbfListing. \n[Command Reference](getPbfListingVersion)""") +@pbf_listing_version_group.command(name=cli_util.override('functions_management.get_pbf_listing_version.command_name', 'get'), help=u"""Gets a PbfListingVersion by identifier for a PbfListing. \n[Command Reference](getPbfListingVersion)""") @cli_util.option('--pbf-listing-version-id', required=True, help=u"""unique PbfListingVersion identifier""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @@ -1733,7 +1961,7 @@ def get_pbf_listing_version(ctx, from_json, pbf_listing_version_id): cli_util.render_response(result, ctx) -@application_group.command(name=cli_util.override('functions_management.list_applications.command_name', 'list'), help=u"""Note: Deprecated. Use the new operation instead. \"Lists applications for a compartment.\" \n[Command Reference](listApplications)""") +@application_group.command(name=cli_util.override('functions_management.list_applications.command_name', 'list'), help=u"""Lists applications for a compartment. \n[Command Reference](listApplications)""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to which this resource belongs.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. 1 is the minimum, 50 is the maximum. @@ -1804,7 +2032,7 @@ def list_applications(ctx, from_json, all_pages, page_size, compartment_id, limi cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.list_functions.command_name', 'list'), help=u"""Note: Deprecated. Use the new operation instead. \"Lists functions for an application.\" \n[Command Reference](listFunctions)""") +@function_group.command(name=cli_util.override('functions_management.list_functions.command_name', 'list'), help=u"""Lists functions for an application. \n[Command Reference](listFunctions)""") @cli_util.option('--application-id', required=True, help=u"""The [OCID] of the application to which this function belongs.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. 1 is the minimum, 50 is the maximum. @@ -1875,7 +2103,160 @@ def list_functions(ctx, from_json, all_pages, page_size, application_id, limit, cli_util.render_response(result, ctx) -@pbf_listing_version_group.command(name=cli_util.override('functions_management.list_pbf_listing_versions.command_name', 'list'), help=u"""Note: Deprecated. Use the new operation instead. Fetches a wrapped list of all Pre-built Function(PBF) Listing versions. Returns a PbfListingVersionCollection containing an array of PbfListingVersionSummary response models. +@functions_runtime_version_group.command(name=cli_util.override('functions_management.list_functions_runtime_versions.command_name', 'list'), help=u"""Fetches a wrapped list of all FunctionsRuntimeVersions. Returns a FunctionsRuntimeVersionCollection containing an array of FunctionsRuntimeVersionSummary response models. \n[Command Reference](listFunctionsRuntimeVersions)""") +@cli_util.option('--functions-runtime-id', help=u"""unique FunctionsRuntime identifier""") +@cli_util.option('--functions-runtime-name', help=u"""A filter to return only resources that match the entire FunctionsRuntime name given.""") +@cli_util.option('--functions-runtime-version-id', help=u"""unique FunctionsRuntimeVersion identifier""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire FunctionsRuntimeVersion name given.""") +@cli_util.option('--os-version', help=u"""A filter to return only resources that match the entire osVersion name given.""") +@cli_util.option('--language-version', help=u"""A filter to return only resources that match the entire languageVersion name given.""") +@cli_util.option('--is-current-version', type=click.BOOL, help=u"""Matches the current version associated with a FunctionsRuntime.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "name"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for name is ascending.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. 1 is the minimum, 50 is the maximum. + +Default: 10""") +@cli_util.option('--page', help=u"""The pagination token for a list query returned by a previous operation""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""Specifies sort order. + +* **ASC:** Ascending sort order. * **DESC:** Descending sort order.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'functions', 'class': 'FunctionsRuntimeVersionCollection'}) +@cli_util.wrap_exceptions +def list_functions_runtime_versions(ctx, from_json, all_pages, page_size, functions_runtime_id, functions_runtime_name, functions_runtime_version_id, display_name, os_version, language_version, is_current_version, lifecycle_state, sort_by, limit, page, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if functions_runtime_id is not None: + kwargs['functions_runtime_id'] = functions_runtime_id + if functions_runtime_name is not None: + kwargs['functions_runtime_name'] = functions_runtime_name + if functions_runtime_version_id is not None: + kwargs['functions_runtime_version_id'] = functions_runtime_version_id + if display_name is not None: + kwargs['display_name'] = display_name + if os_version is not None: + kwargs['os_version'] = os_version + if language_version is not None: + kwargs['language_version'] = language_version + if is_current_version is not None: + kwargs['is_current_version'] = is_current_version + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if sort_by is not None: + kwargs['sort_by'] = sort_by + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('functions', 'functions_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_functions_runtime_versions, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_functions_runtime_versions, + limit, + page_size, + **kwargs + ) + else: + result = client.list_functions_runtime_versions( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@functions_runtime_group.command(name=cli_util.override('functions_management.list_functions_runtimes.command_name', 'list'), help=u"""Fetches a wrapped list of all FunctionsRuntimes. Returns a FunctionsRuntimeCollection containing an array of FunctionsRuntimeSummary response models. \n[Command Reference](listFunctionsRuntimes)""") +@cli_util.option('--functions-runtime-id', help=u"""unique FunctionsRuntime identifier""") +@cli_util.option('--name', help=u"""A filter to return only resources that match the entire FunctionsRuntime name given.""") +@cli_util.option('--name-contains', help=u"""A filter to return only resources that contain the supplied filter text in the FunctionsRuntime name given.""") +@cli_util.option('--name-starts-with', help=u"""A filter to return only resources that start with the supplied filter text in the FunctionsRuntime name given.""") +@cli_util.option('--os', help=u"""A filter to return only resources that match the entire os name given.""") +@cli_util.option('--language', help=u"""A filter to return only resources that match the entire language name given.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE"]), help=u"""A filter to return only resources where their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. 1 is the minimum, 50 is the maximum. + +Default: 10""") +@cli_util.option('--page', help=u"""The pagination token for a list query returned by a previous operation""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""Specifies sort order. + +* **ASC:** Ascending sort order. * **DESC:** Descending sort order.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "name", "timeDeprecated", "timeDecommissioned"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for name is ascending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'functions', 'class': 'FunctionsRuntimeCollection'}) +@cli_util.wrap_exceptions +def list_functions_runtimes(ctx, from_json, all_pages, page_size, functions_runtime_id, name, name_contains, name_starts_with, os, language, lifecycle_state, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if functions_runtime_id is not None: + kwargs['functions_runtime_id'] = functions_runtime_id + if name is not None: + kwargs['name'] = name + if name_contains is not None: + kwargs['name_contains'] = name_contains + if name_starts_with is not None: + kwargs['name_starts_with'] = name_starts_with + if os is not None: + kwargs['os'] = os + if language is not None: + kwargs['language'] = language + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('functions', 'functions_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_functions_runtimes, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_functions_runtimes, + limit, + page_size, + **kwargs + ) + else: + result = client.list_functions_runtimes( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@pbf_listing_version_group.command(name=cli_util.override('functions_management.list_pbf_listing_versions.command_name', 'list'), help=u"""Fetches a wrapped list of all Pre-built Function(PBF) Listing versions. Returns a PbfListingVersionCollection containing an array of PbfListingVersionSummary response models. Note that the PbfListingIdentifier must be provided as a query parameter, otherwise an exception shall be thrown. \n[Command Reference](listPbfListingVersions)""") @cli_util.option('--pbf-listing-id', required=True, help=u"""unique PbfListing identifier""") @@ -1947,7 +2328,7 @@ def list_pbf_listing_versions(ctx, from_json, all_pages, page_size, pbf_listing_ cli_util.render_response(result, ctx) -@pbf_listing_group.command(name=cli_util.override('functions_management.list_pbf_listings.command_name', 'list'), help=u"""Note: Deprecated. Use the new operation instead. Fetches a wrapped list of all Pre-built Function(PBF) Listings. Returns a PbfListingCollection containing an array of PbfListingSummary response models. \n[Command Reference](listPbfListings)""") +@pbf_listing_group.command(name=cli_util.override('functions_management.list_pbf_listings.command_name', 'list'), help=u"""Fetches a wrapped list of all Pre-built Function(PBF) Listings. Returns a PbfListingCollection containing an array of PbfListingSummary response models. \n[Command Reference](listPbfListings)""") @cli_util.option('--pbf-listing-id', help=u"""unique PbfListing identifier""") @cli_util.option('--name', help=u"""A filter to return only resources that match the entire PBF name given.""") @cli_util.option('--name-contains', help=u"""A filter to return only resources that contain the supplied filter text in the PBF name given.""") @@ -2019,7 +2400,7 @@ def list_pbf_listings(ctx, from_json, all_pages, page_size, pbf_listing_id, name cli_util.render_response(result, ctx) -@triggers_collection_group.command(name=cli_util.override('functions_management.list_triggers.command_name', 'list-triggers'), help=u"""Note: Deprecated. Use the new operation instead. Returns a list of Triggers. \n[Command Reference](listTriggers)""") +@triggers_collection_group.command(name=cli_util.override('functions_management.list_triggers.command_name', 'list-triggers'), help=u"""Returns a list of Triggers. \n[Command Reference](listTriggers)""") @cli_util.option('--name', help=u"""A filter to return only resources that match the service trigger source of a PBF.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. 1 is the minimum, 50 is the maximum. @@ -2073,46 +2454,267 @@ def list_triggers(ctx, from_json, all_pages, page_size, name, limit, page, sort_ cli_util.render_response(result, ctx) -@application_group.command(name=cli_util.override('functions_management.update_application.command_name', 'update'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies an application\" \n[Command Reference](updateApplication)""") -@cli_util.option('--application-id', required=True, help=u"""The [OCID] of this application.""") -@cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Application configuration. These values are passed on to the function as environment variables, functions may override application configuration. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. +@application_group.command(name=cli_util.override('functions_management.update_application.command_name', 'update'), help=u"""Modifies an application \n[Command Reference](updateApplication)""") +@cli_util.option('--application-id', required=True, help=u"""The [OCID] of this application.""") +@cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Application configuration. These values are passed on to the function as environment variables, functions may override application configuration. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. + +Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` + +The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--network-security-group-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The [OCID]s of the Network Security Groups to add the application to.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--syslog-url', help=u"""A syslog URL to which to send all function logs. Supports tcp, udp, and tcp+tls. The syslog URL must be reachable from all of the subnets configured for the application. Note: If you enable the OCI Logging service for this application, the syslogUrl value is ignored. Function logs are sent to the OCI Logging service, and not to the syslog URL. + +Example: `tcp://logserver.myserver:1234`""") +@cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--logging', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. + +Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) +@cli_util.option('--image-policy-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Security attributes for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. + +Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"enforce\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@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.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'network-security-group-ids': {'module': 'functions', 'class': 'list[string]'}, 'trace-config': {'module': 'functions', 'class': 'ApplicationTraceConfig'}, 'logging': {'module': 'functions', 'class': 'ApplicationLoggingConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'image-policy-config': {'module': 'functions', 'class': 'ImagePolicyConfig'}, 'security-attributes': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'network-security-group-ids': {'module': 'functions', 'class': 'list[string]'}, 'trace-config': {'module': 'functions', 'class': 'ApplicationTraceConfig'}, 'logging': {'module': 'functions', 'class': 'ApplicationLoggingConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'image-policy-config': {'module': 'functions', 'class': 'ImagePolicyConfig'}, 'security-attributes': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_application(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, application_id, config, network_security_group_ids, syslog_url, trace_config, logging, freeform_tags, defined_tags, image_policy_config, security_attributes, if_match): + + if isinstance(application_id, six.string_types) and len(application_id.strip()) == 0: + raise click.UsageError('Parameter --application-id cannot be whitespace or empty string') + if not force: + if config or network_security_group_ids or trace_config or logging or freeform_tags or defined_tags or image_policy_config or security_attributes: + if not click.confirm("WARNING: Updates to config and network-security-group-ids and trace-config and logging and freeform-tags and defined-tags and image-policy-config and security-attributes will replace any existing values. Are you sure you want to continue?"): + ctx.abort() + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if config is not None: + _details['config'] = cli_util.parse_json_parameter("config", config) + + if network_security_group_ids is not None: + _details['networkSecurityGroupIds'] = cli_util.parse_json_parameter("network_security_group_ids", network_security_group_ids) + + if syslog_url is not None: + _details['syslogUrl'] = syslog_url + + if trace_config is not None: + _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + + if logging is not None: + _details['logging'] = cli_util.parse_json_parameter("logging", logging) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if image_policy_config is not None: + _details['imagePolicyConfig'] = cli_util.parse_json_parameter("image_policy_config", image_policy_config) + + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + + client = cli_util.build_client('functions', 'functions_management', ctx) + result = client.update_application( + application_id=application_id, + update_application_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@function_group.command(name=cli_util.override('functions_management.update_function.command_name', 'update'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") +@cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") +@cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") +@cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. + +Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` + +The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") +@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") +@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) +@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.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_function(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): + + if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: + raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') + if not force: + if config or provisioned_concurrency_config or failure_destination or success_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and success-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if memory_in_mbs is not None: + _details['memoryInMBs'] = memory_in_mbs + + if config is not None: + _details['config'] = cli_util.parse_json_parameter("config", config) + + if timeout_in_seconds is not None: + _details['timeoutInSeconds'] = timeout_in_seconds + + if provisioned_concurrency_config is not None: + _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) + + if detached_mode_timeout_in_seconds is not None: + _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds + + if failure_destination is not None: + _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + + if success_destination is not None: + _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) + + if trace_config is not None: + _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + client = cli_util.build_client('functions', 'functions_management', ctx) + result = client.update_function( + function_id=function_id, + update_function_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@function_group.command(name=cli_util.override('functions_management.update_function_none_provisioned_concurrency_config.command_name', 'update-function-none-provisioned-concurrency-config'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") +@cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") +@cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") +@cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. Example: `{\"MY_FUNCTION_CONFIG\": \"ConfVal\"}` The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--network-security-group-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The [OCID]s of the Network Security Groups to add the application to.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--syslog-url', help=u"""A syslog URL to which to send all function logs. Supports tcp, udp, and tcp+tls. The syslog URL must be reachable from all of the subnets configured for the application. Note: If you enable the OCI Logging service for this application, the syslogUrl value is ignored. Function logs are sent to the OCI Logging service, and not to the syslog URL. - -Example: `tcp://logserver.myserver:1234`""") +@cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") +@cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") +@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--logging', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. - -Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) -@cli_util.option('--image-policy-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Security attributes for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. - -Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"enforce\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'network-security-group-ids': {'module': 'functions', 'class': 'list[string]'}, 'trace-config': {'module': 'functions', 'class': 'ApplicationTraceConfig'}, 'logging': {'module': 'functions', 'class': 'ApplicationLoggingConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'image-policy-config': {'module': 'functions', 'class': 'ImagePolicyConfig'}, 'security-attributes': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'network-security-group-ids': {'module': 'functions', 'class': 'list[string]'}, 'trace-config': {'module': 'functions', 'class': 'ApplicationTraceConfig'}, 'logging': {'module': 'functions', 'class': 'ApplicationLoggingConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'image-policy-config': {'module': 'functions', 'class': 'ImagePolicyConfig'}, 'security-attributes': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Application'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_application(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, application_id, config, network_security_group_ids, syslog_url, trace_config, logging, freeform_tags, defined_tags, image_policy_config, security_attributes, if_match): +def update_function_none_provisioned_concurrency_config(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, memory_in_mbs, config, timeout_in_seconds, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): - if isinstance(application_id, six.string_types) and len(application_id.strip()) == 0: - raise click.UsageError('Parameter --application-id cannot be whitespace or empty string') + if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: + raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or network_security_group_ids or trace_config or logging or freeform_tags or defined_tags or image_policy_config or security_attributes: - if not click.confirm("WARNING: Updates to config and network-security-group-ids and trace-config and logging and freeform-tags and defined-tags and image-policy-config and security-attributes will replace any existing values. Are you sure you want to continue?"): + if config or failure_destination or success_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and failure-destination and success-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2121,21 +2723,31 @@ def update_application(ctx, from_json, force, wait_for_state, max_wait_seconds, kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} + _details['provisionedConcurrencyConfig'] = {} + + if memory_in_mbs is not None: + _details['memoryInMBs'] = memory_in_mbs if config is not None: _details['config'] = cli_util.parse_json_parameter("config", config) - if network_security_group_ids is not None: - _details['networkSecurityGroupIds'] = cli_util.parse_json_parameter("network_security_group_ids", network_security_group_ids) + if timeout_in_seconds is not None: + _details['timeoutInSeconds'] = timeout_in_seconds - if syslog_url is not None: - _details['syslogUrl'] = syslog_url + if detached_mode_timeout_in_seconds is not None: + _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds + + if failure_destination is not None: + _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + + if success_destination is not None: + _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) - if logging is not None: - _details['logging'] = cli_util.parse_json_parameter("logging", logging) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -2143,48 +2755,47 @@ def update_application(ctx, from_json, force, wait_for_state, max_wait_seconds, if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - if image_policy_config is not None: - _details['imagePolicyConfig'] = cli_util.parse_json_parameter("image_policy_config", image_policy_config) - - if security_attributes is not None: - _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + _details['provisionedConcurrencyConfig']['strategy'] = 'NONE' client = cli_util.build_client('functions', 'functions_management', ctx) - result = client.update_application( - application_id=application_id, - update_application_details=_details, + result = client.update_function( + function_id=function_id, + update_function_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_application') and callable(getattr(client, 'get_application')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_application(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function.command_name', 'update'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_constant_provisioned_concurrency_config.command_name', 'update-function-constant-provisioned-concurrency-config'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") +@cli_util.option('--provisioned-concurrency-config-count', required=True, type=click.INT, help=u"""Configuration specifying a constant amount of provisioned concurrency.""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -2192,32 +2803,32 @@ def update_application(ctx, from_json, force, wait_for_state, max_wait_seconds, The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") -@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_constant_provisioned_concurrency_config(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, provisioned_concurrency_config_count, memory_in_mbs, config, timeout_in_seconds, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or failure_destination or success_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or failure_destination or success_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and failure-destination and success-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2226,12 +2837,8 @@ def update_function(ctx, from_json, force, wait_for_state, max_wait_seconds, wai kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['provisionedConcurrencyConfig'] = {} + _details['provisionedConcurrencyConfig']['count'] = provisioned_concurrency_config_count if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -2242,9 +2849,6 @@ def update_function(ctx, from_json, force, wait_for_state, max_wait_seconds, wai if timeout_in_seconds is not None: _details['timeoutInSeconds'] = timeout_in_seconds - if provisioned_concurrency_config is not None: - _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) - if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds @@ -2257,12 +2861,17 @@ def update_function(ctx, from_json, force, wait_for_state, max_wait_seconds, wai if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + _details['provisionedConcurrencyConfig']['strategy'] = 'CONSTANT' + client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( function_id=function_id, @@ -2271,34 +2880,37 @@ def update_function(ctx, from_json, force, wait_for_state, max_wait_seconds, wai ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_none_provisioned_concurrency_config.command_name', 'update-function-none-provisioned-concurrency-config'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_stream_failure_destination_details.command_name', 'update-function-stream-failure-destination-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") +@cli_util.option('--failure-destination-stream-id', required=True, help=u"""The [OCID] of the stream.""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -2306,31 +2918,32 @@ def update_function(ctx, from_json, force, wait_for_state, max_wait_seconds, wai The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") +@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") -@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_none_provisioned_concurrency_config(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_stream_failure_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, failure_destination_stream_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or failure_destination or success_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and failure-destination and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or success_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and success-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2339,13 +2952,8 @@ def update_function_none_provisioned_concurrency_config(ctx, from_json, force, w kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['provisionedConcurrencyConfig'] = {} - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['failureDestination'] = {} + _details['failureDestination']['streamId'] = failure_destination_stream_id if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -2356,25 +2964,28 @@ def update_function_none_provisioned_concurrency_config(ctx, from_json, force, w if timeout_in_seconds is not None: _details['timeoutInSeconds'] = timeout_in_seconds + if provisioned_concurrency_config is not None: + _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) + if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds - if failure_destination is not None: - _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) - if success_destination is not None: _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['provisionedConcurrencyConfig']['strategy'] = 'NONE' + _details['failureDestination']['kind'] = 'STREAM' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -2384,35 +2995,37 @@ def update_function_none_provisioned_concurrency_config(ctx, from_json, force, w ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_constant_provisioned_concurrency_config.command_name', 'update-function-constant-provisioned-concurrency-config'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_queue_failure_destination_details.command_name', 'update-function-queue-failure-destination-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--provisioned-concurrency-config-count', required=True, type=click.INT, help=u"""Configuration specifying a constant amount of provisioned concurrency.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") +@cli_util.option('--failure-destination-queue-id', required=True, help=u"""The [OCID] of the queue.""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -2420,31 +3033,33 @@ def update_function_none_provisioned_concurrency_config(ctx, from_json, force, w The maximum size for all configuration keys and values is limited to 4KB. This is measured as the sum of octets necessary to represent each key and value in UTF-8.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") +@cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") -@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") +@cli_util.option('--failure-destination-channel-id', help=u"""The ID of the channel in the queue.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_constant_provisioned_concurrency_config(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, provisioned_concurrency_config_count, image, image_digest, memory_in_mbs, config, timeout_in_seconds, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_queue_failure_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, failure_destination_queue_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, source_details, freeform_tags, defined_tags, if_match, failure_destination_channel_id): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or failure_destination or success_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and failure-destination and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or success_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and success-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2453,14 +3068,8 @@ def update_function_constant_provisioned_concurrency_config(ctx, from_json, forc kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['provisionedConcurrencyConfig'] = {} - _details['provisionedConcurrencyConfig']['count'] = provisioned_concurrency_config_count - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['failureDestination'] = {} + _details['failureDestination']['queueId'] = failure_destination_queue_id if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -2471,25 +3080,31 @@ def update_function_constant_provisioned_concurrency_config(ctx, from_json, forc if timeout_in_seconds is not None: _details['timeoutInSeconds'] = timeout_in_seconds + if provisioned_concurrency_config is not None: + _details['provisionedConcurrencyConfig'] = cli_util.parse_json_parameter("provisioned_concurrency_config", provisioned_concurrency_config) + if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds - if failure_destination is not None: - _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) - if success_destination is not None: _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['provisionedConcurrencyConfig']['strategy'] = 'CONSTANT' + if failure_destination_channel_id is not None: + _details['failureDestination']['channelId'] = failure_destination_channel_id + + _details['failureDestination']['kind'] = 'QUEUE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -2499,35 +3114,37 @@ def update_function_constant_provisioned_concurrency_config(ctx, from_json, forc ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_stream_failure_destination_details.command_name', 'update-function-stream-failure-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_notification_failure_destination_details.command_name', 'update-function-notification-failure-destination-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--failure-destination-stream-id', required=True, help=u"""The [OCID] of the stream.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") +@cli_util.option('--failure-destination-topic-id', required=True, help=u"""The [OCID] of the topic.""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -2539,27 +3156,28 @@ def update_function_constant_provisioned_concurrency_config(ctx, from_json, forc @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_stream_failure_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, failure_destination_stream_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_notification_failure_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, failure_destination_topic_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or success_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or success_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and success-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2569,13 +3187,7 @@ def update_function_stream_failure_destination_details(ctx, from_json, force, wa _details = {} _details['failureDestination'] = {} - _details['failureDestination']['streamId'] = failure_destination_stream_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['failureDestination']['topicId'] = failure_destination_topic_id if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -2598,13 +3210,16 @@ def update_function_stream_failure_destination_details(ctx, from_json, force, wa if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['failureDestination']['kind'] = 'STREAM' + _details['failureDestination']['kind'] = 'NOTIFICATION' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -2614,35 +3229,36 @@ def update_function_stream_failure_destination_details(ctx, from_json, force, wa ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_queue_failure_destination_details.command_name', 'update-function-queue-failure-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_none_failure_destination_details.command_name', 'update-function-none-failure-destination-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--failure-destination-queue-id', required=True, help=u"""The [OCID] of the queue.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -2654,28 +3270,28 @@ def update_function_stream_failure_destination_details(ctx, from_json, force, wa @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") -@cli_util.option('--failure-destination-channel-id', help=u"""The ID of the channel in the queue.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_queue_failure_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, failure_destination_queue_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags, if_match, failure_destination_channel_id): +def update_function_none_failure_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or success_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or success_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and success-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2685,13 +3301,6 @@ def update_function_queue_failure_destination_details(ctx, from_json, force, wai _details = {} _details['failureDestination'] = {} - _details['failureDestination']['queueId'] = failure_destination_queue_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -2714,16 +3323,16 @@ def update_function_queue_failure_destination_details(ctx, from_json, force, wai if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - if failure_destination_channel_id is not None: - _details['failureDestination']['channelId'] = failure_destination_channel_id - - _details['failureDestination']['kind'] = 'QUEUE' + _details['failureDestination']['kind'] = 'NONE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -2733,35 +3342,37 @@ def update_function_queue_failure_destination_details(ctx, from_json, force, wai ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_notification_failure_destination_details.command_name', 'update-function-notification-failure-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_stream_success_destination_details.command_name', 'update-function-stream-success-destination-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--failure-destination-topic-id', required=True, help=u"""The [OCID] of the topic.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") +@cli_util.option('--success-destination-stream-id', required=True, help=u"""The [OCID] of the stream.""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -2771,29 +3382,30 @@ def update_function_queue_failure_destination_details(ctx, from_json, force, wai @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") @cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") -@cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_notification_failure_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, failure_destination_topic_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_stream_success_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, success_destination_stream_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or success_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or failure_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2802,14 +3414,8 @@ def update_function_notification_failure_destination_details(ctx, from_json, for kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['failureDestination'] = {} - _details['failureDestination']['topicId'] = failure_destination_topic_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['successDestination'] = {} + _details['successDestination']['streamId'] = success_destination_stream_id if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -2826,19 +3432,22 @@ def update_function_notification_failure_destination_details(ctx, from_json, for if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds - if success_destination is not None: - _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) + if failure_destination is not None: + _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['failureDestination']['kind'] = 'NOTIFICATION' + _details['successDestination']['kind'] = 'STREAM' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -2848,34 +3457,37 @@ def update_function_notification_failure_destination_details(ctx, from_json, for ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_none_failure_destination_details.command_name', 'update-function-none-failure-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_notification_success_destination_details.command_name', 'update-function-notification-success-destination-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") +@cli_util.option('--success-destination-topic-id', required=True, help=u"""The [OCID] of the topic.""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -2885,29 +3497,30 @@ def update_function_notification_failure_destination_details(ctx, from_json, for @cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Timeout for executions of the function. Value in seconds.""") @cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") -@cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_none_failure_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, success_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_notification_success_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, success_destination_topic_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or success_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or failure_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2916,13 +3529,8 @@ def update_function_none_failure_destination_details(ctx, from_json, force, wait kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['failureDestination'] = {} - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['successDestination'] = {} + _details['successDestination']['topicId'] = success_destination_topic_id if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -2939,19 +3547,22 @@ def update_function_none_failure_destination_details(ctx, from_json, force, wait if detached_mode_timeout_in_seconds is not None: _details['detachedModeTimeoutInSeconds'] = detached_mode_timeout_in_seconds - if success_destination is not None: - _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) + if failure_destination is not None: + _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['failureDestination']['kind'] = 'NONE' + _details['successDestination']['kind'] = 'NOTIFICATION' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -2961,35 +3572,37 @@ def update_function_none_failure_destination_details(ctx, from_json, force, wait ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_stream_success_destination_details.command_name', 'update-function-stream-success-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_queue_success_destination_details.command_name', 'update-function-queue-success-destination-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--success-destination-stream-id', required=True, help=u"""The [OCID] of the stream.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") +@cli_util.option('--success-destination-queue-id', required=True, help=u"""The [OCID] of the queue.""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -3001,27 +3614,29 @@ def update_function_none_failure_destination_details(ctx, from_json, force, wait @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") +@cli_util.option('--success-destination-channel-id', help=u"""The ID of the channel in the queue.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_stream_success_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, success_destination_stream_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_queue_success_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, success_destination_queue_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, source_details, freeform_tags, defined_tags, if_match, success_destination_channel_id): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or failure_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or failure_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -3031,13 +3646,7 @@ def update_function_stream_success_destination_details(ctx, from_json, force, wa _details = {} _details['successDestination'] = {} - _details['successDestination']['streamId'] = success_destination_stream_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['successDestination']['queueId'] = success_destination_queue_id if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -3060,13 +3669,19 @@ def update_function_stream_success_destination_details(ctx, from_json, force, wa if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['successDestination']['kind'] = 'STREAM' + if success_destination_channel_id is not None: + _details['successDestination']['channelId'] = success_destination_channel_id + + _details['successDestination']['kind'] = 'QUEUE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -3076,35 +3691,36 @@ def update_function_stream_success_destination_details(ctx, from_json, force, wa ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_notification_success_destination_details.command_name', 'update-function-notification-success-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_none_success_destination_details.command_name', 'update-function-none-success-destination-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--success-destination-topic-id', required=True, help=u"""The [OCID] of the topic.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -3116,27 +3732,28 @@ def update_function_stream_success_destination_details(ctx, from_json, force, wa @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'source-details': {'module': 'functions', 'class': 'UpdateFunctionSourceDetails'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_notification_success_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, success_destination_topic_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_none_success_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, source_details, freeform_tags, defined_tags, if_match): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or failure_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or failure_destination or trace_config or source_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and trace-config and source-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -3146,13 +3763,6 @@ def update_function_notification_success_destination_details(ctx, from_json, for _details = {} _details['successDestination'] = {} - _details['successDestination']['topicId'] = success_destination_topic_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -3175,13 +3785,16 @@ def update_function_notification_success_destination_details(ctx, from_json, for if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) + if source_details is not None: + _details['sourceDetails'] = cli_util.parse_json_parameter("source_details", source_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['successDestination']['kind'] = 'NOTIFICATION' + _details['successDestination']['kind'] = 'NONE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -3191,35 +3804,36 @@ def update_function_notification_success_destination_details(ctx, from_json, for ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_queue_success_destination_details.command_name', 'update-function-queue-success-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_update_container_image_function_source_details.command_name', 'update-function-update-container-image-function-source-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--success-destination-queue-id', required=True, help=u"""The [OCID] of the queue.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -3230,29 +3844,31 @@ def update_function_notification_success_destination_details(ctx, from_json, for @cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") -@cli_util.option('--success-destination-channel-id', help=u"""The ID of the channel in the queue.""") +@cli_util.option('--source-details-image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") +@cli_util.option('--source-details-image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. If no value is specified, the digest currently associated with the image in the OCI Registry will be used. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_function_queue_success_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, success_destination_queue_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags, if_match, success_destination_channel_id): +def update_function_update_container_image_function_source_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags, if_match, source_details_image, source_details_image_digest): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or failure_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or failure_destination or success_destination or trace_config or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -3261,14 +3877,7 @@ def update_function_queue_success_destination_details(ctx, from_json, force, wai kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['successDestination'] = {} - _details['successDestination']['queueId'] = success_destination_queue_id - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['sourceDetails'] = {} if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -3288,6 +3897,9 @@ def update_function_queue_success_destination_details(ctx, from_json, force, wai if failure_destination is not None: _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + if success_destination is not None: + _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) + if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) @@ -3297,10 +3909,13 @@ def update_function_queue_success_destination_details(ctx, from_json, force, wai if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - if success_destination_channel_id is not None: - _details['successDestination']['channelId'] = success_destination_channel_id + if source_details_image is not None: + _details['sourceDetails']['image'] = source_details_image - _details['successDestination']['kind'] = 'QUEUE' + if source_details_image_digest is not None: + _details['sourceDetails']['imageDigest'] = source_details_image_digest + + _details['sourceDetails']['sourceType'] = 'CONTAINER_IMAGE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -3310,34 +3925,36 @@ def update_function_queue_success_destination_details(ctx, from_json, force, wai ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@function_group.command(name=cli_util.override('functions_management.update_function_none_success_destination_details.command_name', 'update-function-none-success-destination-details'), help=u"""Note: Deprecated. Use the new operation instead. \"Modifies a function\" \n[Command Reference](updateFunction)""") +@function_group.command(name=cli_util.override('functions_management.update_function_update_archive_function_source_details.command_name', 'update-function-update-archive-function-source-details'), help=u"""Modifies a function \n[Command Reference](updateFunction)""") @cli_util.option('--function-id', required=True, help=u"""The [OCID] of this function.""") -@cli_util.option('--image', help=u"""The qualified name of the Docker image to use in the function, including the image tag. The image should be in the OCI Registry that is in the same region as the function itself. If an image is specified but no value for imageDigest is provided, the digest currently associated with the image tag in the OCI Registry will be used. Example: `phx.ocir.io/ten/functions/function:0.0.1`""") -@cli_util.option('--image-digest', help=u"""The image digest for the version of the image that will be pulled when invoking this function. Example: `sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7`""") @cli_util.option('--memory-in-mbs', type=click.INT, help=u"""Maximum usable memory for the function (MiB).""") @cli_util.option('--config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Function configuration. These values are passed on to the function as environment variables, this overrides application configuration values. Keys must be ASCII strings consisting solely of letters, digits, and the '_' (underscore) character, and must not begin with a digit. Values should be limited to printable unicode characters. @@ -3348,28 +3965,32 @@ def update_function_queue_success_destination_details(ctx, from_json, force, wai @cli_util.option('--provisioned-concurrency-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--detached-mode-timeout-in-seconds', type=click.INT, help=u"""Timeout for detached function invocations. Value in seconds.""") @cli_util.option('--failure-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--success-destination', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--trace-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) @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.""") +@cli_util.option('--source-details-archive-source-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-details-handler', help=u"""The function handler that is executed when the function is invoked. The value of this field depends on the runtime used""") +@cli_util.option('--source-details-runtime-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'source-details-archive-source-details': {'module': 'functions', 'class': 'UpdateArchiveSourceDetails'}, 'source-details-runtime-config': {'module': 'functions', 'class': 'UpdateRuntimeConfig'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'functions', 'class': 'Function'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'config': {'module': 'functions', 'class': 'dict(str, string)'}, 'provisioned-concurrency-config': {'module': 'functions', 'class': 'FunctionProvisionedConcurrencyConfig'}, 'failure-destination': {'module': 'functions', 'class': 'FailureDestinationDetails'}, 'success-destination': {'module': 'functions', 'class': 'SuccessDestinationDetails'}, 'trace-config': {'module': 'functions', 'class': 'FunctionTraceConfig'}, 'freeform-tags': {'module': 'functions', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'functions', 'class': 'dict(str, dict(str, object))'}, 'source-details-archive-source-details': {'module': 'functions', 'class': 'UpdateArchiveSourceDetails'}, 'source-details-runtime-config': {'module': 'functions', 'class': 'UpdateRuntimeConfig'}}) @cli_util.wrap_exceptions -def update_function_none_success_destination_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, image, image_digest, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, trace_config, freeform_tags, defined_tags, if_match): +def update_function_update_archive_function_source_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, function_id, memory_in_mbs, config, timeout_in_seconds, provisioned_concurrency_config, detached_mode_timeout_in_seconds, failure_destination, success_destination, trace_config, freeform_tags, defined_tags, if_match, source_details_archive_source_details, source_details_handler, source_details_runtime_config): if isinstance(function_id, six.string_types) and len(function_id.strip()) == 0: raise click.UsageError('Parameter --function-id cannot be whitespace or empty string') if not force: - if config or provisioned_concurrency_config or failure_destination or trace_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if config or provisioned_concurrency_config or failure_destination or success_destination or trace_config or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to config and provisioned-concurrency-config and failure-destination and success-destination and trace-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -3378,13 +3999,7 @@ def update_function_none_success_destination_details(ctx, from_json, force, wait kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['successDestination'] = {} - - if image is not None: - _details['image'] = image - - if image_digest is not None: - _details['imageDigest'] = image_digest + _details['sourceDetails'] = {} if memory_in_mbs is not None: _details['memoryInMBs'] = memory_in_mbs @@ -3404,6 +4019,9 @@ def update_function_none_success_destination_details(ctx, from_json, force, wait if failure_destination is not None: _details['failureDestination'] = cli_util.parse_json_parameter("failure_destination", failure_destination) + if success_destination is not None: + _details['successDestination'] = cli_util.parse_json_parameter("success_destination", success_destination) + if trace_config is not None: _details['traceConfig'] = cli_util.parse_json_parameter("trace_config", trace_config) @@ -3413,7 +4031,16 @@ def update_function_none_success_destination_details(ctx, from_json, force, wait if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['successDestination']['kind'] = 'NONE' + if source_details_archive_source_details is not None: + _details['sourceDetails']['archiveSourceDetails'] = cli_util.parse_json_parameter("source_details_archive_source_details", source_details_archive_source_details) + + if source_details_handler is not None: + _details['sourceDetails']['handler'] = source_details_handler + + if source_details_runtime_config is not None: + _details['sourceDetails']['runtimeConfig'] = cli_util.parse_json_parameter("source_details_runtime_config", source_details_runtime_config) + + _details['sourceDetails']['sourceType'] = 'ARCHIVE' client = cli_util.build_client('functions', 'functions_management', ctx) result = client.update_function( @@ -3423,25 +4050,29 @@ def update_function_none_success_destination_details(ctx, from_json, force, wait ) if wait_for_state: - if hasattr(client, 'get_function') and callable(getattr(client, 'get_function')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_function(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) diff --git a/services/distributed_database_v26/__init__.py b/services/functions/src/oci_cli_work_request_management/__init__.py similarity index 92% rename from services/distributed_database_v26/__init__.py rename to services/functions/src/oci_cli_work_request_management/__init__.py index 7293131c0..376112c90 100644 --- a/services/distributed_database_v26/__init__.py +++ b/services/functions/src/oci_cli_work_request_management/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/distributed_database_v26/src/__init__.py b/services/functions/src/oci_cli_work_request_management/generated/__init__.py similarity index 92% rename from services/distributed_database_v26/src/__init__.py rename to services/functions/src/oci_cli_work_request_management/generated/__init__.py index 7293131c0..376112c90 100644 --- a/services/distributed_database_v26/src/__init__.py +++ b/services/functions/src/oci_cli_work_request_management/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/client_mappings.py b/services/functions/src/oci_cli_work_request_management/generated/client_mappings.py similarity index 54% rename from services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/client_mappings.py rename to services/functions/src/oci_cli_work_request_management/generated/client_mappings.py index 33751ae73..45a4c4e22 100644 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_service/generated/client_mappings.py +++ b/services/functions/src/oci_cli_work_request_management/generated/client_mappings.py @@ -1,14 +1,14 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 import oci from oci_cli.cli_clients import CLIENT_MAP from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.distributed_database_v26 import DistributedDbServiceClient +from oci.functions import WorkRequestManagementClient -MODULE_TO_TYPE_MAPPINGS["distributed_database_v26"] = oci.distributed_database_v26.models.distributed_database_v26_type_mapping -if CLIENT_MAP.get("distributed_database_v26") is None: - CLIENT_MAP["distributed_database_v26"] = {} -CLIENT_MAP["distributed_database_v26"]["distributed_db_service"] = DistributedDbServiceClient +MODULE_TO_TYPE_MAPPINGS["functions"] = oci.functions.models.functions_type_mapping +if CLIENT_MAP.get("functions") is None: + CLIENT_MAP["functions"] = {} +CLIENT_MAP["functions"]["work_request_management"] = WorkRequestManagementClient diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/distributeddbworkrequestservice_cli.py b/services/functions/src/oci_cli_work_request_management/generated/workrequestmanagement_cli.py similarity index 56% rename from services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/distributeddbworkrequestservice_cli.py rename to services/functions/src/oci_cli_work_request_management/generated/workrequestmanagement_cli.py index 84405389b..b71c6333f 100644 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/distributeddbworkrequestservice_cli.py +++ b/services/functions/src/oci_cli_work_request_management/generated/workrequestmanagement_cli.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 from __future__ import print_function import click @@ -13,45 +13,71 @@ from oci_cli import json_skeleton_utils from oci_cli import custom_types # noqa: F401 from oci_cli.aliasing import CommandGroupWithAlias -from services.distributed_database_v26.src.oci_cli_distributed_database_v26.generated import distributed_database_v26_service_cli +from services.functions.src.oci_cli_functions.generated import fn_service_cli -@click.command(cli_util.override('distributed_db_work_request_service.distributed_db_work_request_service_root_group.command_name', 'distributed-db-work-request-service'), cls=CommandGroupWithAlias, help=cli_util.override('distributed_db_work_request_service.distributed_db_work_request_service_root_group.help', """Use the Globally Distributed Database service APIs to create and manage the Globally distributed databases."""), short_help=cli_util.override('distributed_db_work_request_service.distributed_db_work_request_service_root_group.short_help', """Globally Distributed Database""")) +@click.command(cli_util.override('work_request_management.work_request_management_root_group.command_name', 'work-request-management'), cls=CommandGroupWithAlias, help=cli_util.override('work_request_management.work_request_management_root_group.help', """API for the Functions service."""), short_help=cli_util.override('work_request_management.work_request_management_root_group.short_help', """Functions Service API""")) @cli_util.help_option_group -def distributed_db_work_request_service_root_group(): +def work_request_management_root_group(): pass -@click.command(cli_util.override('distributed_db_work_request_service.work_request_error_group.command_name', 'work-request-error'), cls=CommandGroupWithAlias, help="""An error encountered while executing a work request.""") +@click.command(cli_util.override('work_request_management.work_request_error_group.command_name', 'work-request-error'), cls=CommandGroupWithAlias, help="""An error encountered while performing an operation that is tracked by a work request.""") @cli_util.help_option_group def work_request_error_group(): pass -@click.command(cli_util.override('distributed_db_work_request_service.work_request_log_entry_group.command_name', 'work-request-log-entry'), cls=CommandGroupWithAlias, help="""A log message from the execution of a work request.""") +@click.command(cli_util.override('work_request_management.work_request_log_entry_group.command_name', 'work-request-log-entry'), cls=CommandGroupWithAlias, help="""A log message from performing an operation that is tracked by a work request.""") @cli_util.help_option_group def work_request_log_entry_group(): pass -@click.command(cli_util.override('distributed_db_work_request_service.work_request_group.command_name', 'work-request'), cls=CommandGroupWithAlias, help="""A description of workrequest status""") +@click.command(cli_util.override('work_request_management.work_request_group.command_name', 'work-request'), cls=CommandGroupWithAlias, help="""An asynchronous work request. Work requests help you monitor long-running operations. When you start a long-running operation, the service creates a work request. A work request is an activity log that lets you track each step in the operation's progress. Each work request has an OCID that lets you interact with it programmatically and use it for automation.""") @cli_util.help_option_group def work_request_group(): pass -distributed_database_v26_service_cli.distributed_database_v26_service_group.add_command(distributed_db_work_request_service_root_group) -distributed_db_work_request_service_root_group.add_command(work_request_error_group) -distributed_db_work_request_service_root_group.add_command(work_request_log_entry_group) -distributed_db_work_request_service_root_group.add_command(work_request_group) +fn_service_cli.fn_service_group.add_command(work_request_management_root_group) +work_request_management_root_group.add_command(work_request_error_group) +work_request_management_root_group.add_command(work_request_log_entry_group) +work_request_management_root_group.add_command(work_request_group) -@work_request_group.command(name=cli_util.override('distributed_db_work_request_service.get_work_request.command_name', 'get'), help=u"""Gets details of the work request with the given ID. \n[Command Reference](getWorkRequest)""") -@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") +@work_request_group.command(name=cli_util.override('work_request_management.cancel_work_request.command_name', 'cancel'), help=u"""Cancels a work request. \n[Command Reference](cancelWorkRequest)""") +@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous work request.""") +@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.""") +@cli_util.confirm_delete_option @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'WorkRequest'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def cancel_work_request(ctx, from_json, work_request_id, if_match): + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('functions', 'work_request_management', ctx) + result = client.cancel_work_request( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_group.command(name=cli_util.override('work_request_management.get_work_request.command_name', 'get'), help=u"""Gets the details of a work request. \n[Command Reference](getWorkRequest)""") +@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous work request.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'functions', 'class': 'WorkRequest'}) @cli_util.wrap_exceptions def get_work_request(ctx, from_json, work_request_id): @@ -60,7 +86,7 @@ def get_work_request(ctx, from_json, work_request_id): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_work_request_service', ctx) + client = cli_util.build_client('functions', 'work_request_management', ctx) result = client.get_work_request( work_request_id=work_request_id, **kwargs @@ -68,18 +94,22 @@ def get_work_request(ctx, from_json, work_request_id): cli_util.render_response(result, ctx) -@work_request_error_group.command(name=cli_util.override('distributed_db_work_request_service.list_work_request_errors.command_name', 'list'), help=u"""Returns a (paginated) list of errors for the work request with the given ID. \n[Command Reference](listWorkRequestErrors)""") -@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") -@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timestamp"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timestamp is descending.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@work_request_error_group.command(name=cli_util.override('work_request_management.list_work_request_errors.command_name', 'list'), help=u"""Lists the errors for a work request. \n[Command Reference](listWorkRequestErrors)""") +@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous work request.""") +@cli_util.option('--page', help=u"""The pagination token for a list query returned by a previous operation""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. 1 is the minimum, 50 is the maximum. + +Default: 10""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timestamp"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for `timestamp` is descending.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""Specifies sort order. + +* **ASC:** Ascending sort order. * **DESC:** Descending sort order.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'WorkRequestErrorCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'functions', 'class': 'WorkRequestErrorCollection'}) @cli_util.wrap_exceptions def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_id, page, limit, sort_by, sort_order): @@ -99,7 +129,7 @@ def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_ if sort_order is not None: kwargs['sort_order'] = sort_order kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_work_request_service', ctx) + client = cli_util.build_client('functions', 'work_request_management', ctx) if all_pages: if page_size: kwargs['limit'] = page_size @@ -125,18 +155,22 @@ def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_ cli_util.render_response(result, ctx) -@work_request_log_entry_group.command(name=cli_util.override('distributed_db_work_request_service.list_work_request_logs.command_name', 'list-work-request-logs'), help=u"""Returns a (paginated) list of logs for the work request with the given ID. \n[Command Reference](listWorkRequestLogs)""") -@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") -@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timestamp"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timestamp is descending.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@work_request_log_entry_group.command(name=cli_util.override('work_request_management.list_work_request_logs.command_name', 'list-work-request-logs'), help=u"""Lists the logs for a work request. \n[Command Reference](listWorkRequestLogs)""") +@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous work request.""") +@cli_util.option('--page', help=u"""The pagination token for a list query returned by a previous operation""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. 1 is the minimum, 50 is the maximum. + +Default: 10""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timestamp"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for `timestamp` is descending.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""Specifies sort order. + +* **ASC:** Ascending sort order. * **DESC:** Descending sort order.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'WorkRequestLogEntryCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'functions', 'class': 'WorkRequestLogEntryCollection'}) @cli_util.wrap_exceptions def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id, page, limit, sort_by, sort_order): @@ -156,7 +190,7 @@ def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id if sort_order is not None: kwargs['sort_order'] = sort_order kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_work_request_service', ctx) + client = cli_util.build_client('functions', 'work_request_management', ctx) if all_pages: if page_size: kwargs['limit'] = page_size @@ -182,21 +216,25 @@ def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id cli_util.render_response(result, ctx) -@work_request_group.command(name=cli_util.override('distributed_db_work_request_service.list_work_requests.command_name', 'list'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listWorkRequests)""") -@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") -@cli_util.option('--work-request-id', help=u"""The ID of the asynchronous work request.""") -@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "NEEDS_ATTENTION"]), help=u"""A filter to return only resources their lifecycleState matches the given OperationStatus.""") -@cli_util.option('--resource-id', help=u"""The ID of the resource affected by the work request.""") -@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeAccepted is descending.""") +@work_request_group.command(name=cli_util.override('work_request_management.list_work_requests.command_name', 'list'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listWorkRequests)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to which this resource belongs.""") +@cli_util.option('--work-request-id', help=u"""The [OCID] of the asynchronous work request.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help=u"""A filter to return only the resources that match the given lifecycle state.""") +@cli_util.option('--resource-id', help=u"""The [OCID] of the resource affected by the work request.""") +@cli_util.option('--page', help=u"""The pagination token for a list query returned by a previous operation""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. 1 is the minimum, 50 is the maximum. + +Default: 10""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""Specifies sort order. + +* **ASC:** Ascending sort order. * **DESC:** Descending sort order.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for `timeAccepted` is descending.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'distributed_database_v26', 'class': 'WorkRequestSummaryCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'functions', 'class': 'WorkRequestSummaryCollection'}) @cli_util.wrap_exceptions def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, work_request_id, status, resource_id, page, limit, sort_order, sort_by): @@ -219,7 +257,7 @@ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, wor if sort_by is not None: kwargs['sort_by'] = sort_by kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('distributed_database_v26', 'distributed_db_work_request_service', ctx) + client = cli_util.build_client('functions', 'work_request_management', ctx) if all_pages: if page_size: kwargs['limit'] = page_size diff --git a/services/functions/tests/__init__.py b/services/functions/tests/__init__.py index 2d8b7ac10..376112c90 100644 --- a/services/functions/tests/__init__.py +++ b/services/functions/tests/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181201 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260325 diff --git a/services/functions/tests/unit/test_functions_extended.py b/services/functions/tests/unit/test_functions_extended.py index 798abd9dc..64056f571 100644 --- a/services/functions/tests/unit/test_functions_extended.py +++ b/services/functions/tests/unit/test_functions_extended.py @@ -1,32 +1,81 @@ +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. +# +# This software is dual-licensed to you under the Universal Permissive License +# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License +# 2.0 as shown at https://www.apache.org/licenses/LICENSE-2.0. You may choose +# either license. +# +# If you elect to accept the software under the Apache License, Version 2.0, +# the following applies: +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # coding: utf-8 -# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. -# 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. +import base64 +import json +import os +import tempfile import unittest + +import click + from tests import util +from services.functions.src.oci_cli_functions_management import functionsmanagement_cli_extended as functions_ext # pytest -s services/functions/tests/unit/test_functions_extended.py class TestFunctions(unittest.TestCase): - def setUp(self): - pass + + def _assert_output_contains(self, command, expected): + result = util.invoke_command(command) + for item in expected: + assert item in result.output + return result + + def _assert_output_does_not_contain(self, command, unexpected): + result = util.invoke_command(command) + for item in unexpected: + assert item not in result.output + return result + + def _required_options(self, command): + return sorted('--' + option.name.replace('_', '-') for option in command.params if getattr(option, 'required', False)) def test_fn(self): - result = util.invoke_command(['fn']) - assert 'application' in result.output - assert 'function' in result.output - assert 'pbf-listing' in result.output - assert 'pbf-listing-version' in result.output - assert 'trigger' in result.output + result = self._assert_output_contains( + ['fn'], + [ + 'application', + 'function', + 'pbf-listing', + 'pbf-listing-version', + 'runtime', + 'runtime-version', + 'trigger', + 'work-request', + 'work-request-error', + 'work-request-log-entry' + ] + ) + assert 'functions-runtime' not in result.output + assert 'functions-runtime-version' not in result.output + assert 'work-request-management' not in result.output def test_fn_application(self): - result = util.invoke_command(['fn', 'application']) - assert 'create' in result.output - assert 'delete' in result.output - assert 'update' in result.output - assert 'list' in result.output - assert 'get' in result.output - assert 'change-compartment' in result.output + self._assert_output_contains( + ['fn', 'application'], + ['create', 'delete', 'update', 'list', 'get', 'change-compartment'] + ) def test_application_create(self): result = util.invoke_command(['fn', 'application', 'create']) @@ -66,46 +115,190 @@ def test_application_change_compartment(self): assert '--application-id' in result.output def test_fn_function(self): - result = util.invoke_command(['fn', 'function']) - assert 'create' in result.output - assert 'delete' in result.output - assert 'update' in result.output - assert 'list' in result.output - assert 'get' in result.output - assert 'invoke' in result.output + self._assert_output_contains( + ['fn', 'function'], + ['create', 'delete', 'update', 'list', 'get', 'invoke'] + ) - def test_function_create(self): - result = util.invoke_command(['fn', 'function', 'create']) + def test_function_create_group(self): + self._assert_output_contains( + ['fn', 'function', 'create'], + ['archive-function', 'container-function', 'pbf-function'] + ) + + def test_function_update_group(self): + self._assert_output_contains( + ['fn', 'function', 'update'], + ['archive-function', 'container-function', 'pbf-function'] + ) + + def test_function_create_archive_object_storage_fn_update_required_options(self): + result = util.invoke_command(['fn', 'function', 'create', 'archive-function', 'object-storage', 'fn-update-runtime-config']) assert 'Error: Missing option(s)' in result.output - assert '--display-name' in result.output - assert '--application-id' in result.output - assert '--memory-in-mbs' in result.output - result = util.invoke_command(['fn', 'function', 'create', '--memory-in-mbs', 'x']) - assert "Error: Invalid value for '--memory-in-mbs': 'x' is not a valid integer" in result.output - result = util.invoke_command(['fn', 'function', 'create', '--config']) - assert 'Error: Option \'--config\' requires an argument' in result.output - result = util.invoke_command(['fn', 'function', 'create', '--display-name', 'test', '--application-id', 'dummyOcid', '--memory-in-mbs', '512', - '--image', 'dummyImage', '--source-details', '{"sourceType": "PRE_BUILT_FUNCTIONS","pbfListingId": "ocid1"}']) - assert 'Cannot specify both pbfListingId (in --source-details) and --image.' in result.output - result = util.invoke_command(['fn', 'function', 'create', '--display-name', 'test', - '--application-id', 'dummyOcid', '--memory-in-mbs', '512']) - assert 'Must specify --source-details or --image.' in result.output + for option in ['--application-id', '--display-name', '--memory-in-mbs', '--bucket-name', '--namespace', '--object-name', '--functions-runtime-name']: + assert option in result.output - def test_function_delete(self): - result = util.invoke_command(['fn', 'function', 'delete']) + def test_function_create_archive_object_storage_manual_required_options(self): + result = util.invoke_command(['fn', 'function', 'create', 'archive-function', 'object-storage', 'manual-runtime-config']) assert 'Error: Missing option(s)' in result.output - assert '--function-id' in result.output + for option in ['--application-id', '--display-name', '--memory-in-mbs', '--bucket-name', '--namespace', '--object-name', '--functions-runtime-name', '--functions-runtime-version-id']: + assert option in result.output - def test_function_update(self): - result = util.invoke_command(['fn', 'function', 'update']) + def test_function_create_archive_direct_archive_fn_update_required_options(self): + result = util.invoke_command(['fn', 'function', 'create', 'archive-function', 'direct-archive', 'fn-update-runtime-config']) + assert 'Error: Missing option(s)' in result.output + for option in ['--application-id', '--display-name', '--memory-in-mbs', '--archive-file', '--functions-runtime-name']: + assert option in result.output + + def test_function_create_archive_direct_archive_manual_required_options(self): + result = util.invoke_command(['fn', 'function', 'create', 'archive-function', 'direct-archive', 'manual-runtime-config']) + assert 'Error: Missing option(s)' in result.output + for option in ['--application-id', '--display-name', '--memory-in-mbs', '--archive-file', '--functions-runtime-name', '--functions-runtime-version-id']: + assert option in result.output + + def test_function_create_container_required_options(self): + result = util.invoke_command(['fn', 'function', 'create', 'container-function']) + assert 'Error: Missing option(s)' in result.output + for option in ['--application-id', '--display-name', '--memory-in-mbs', '--image']: + assert option in result.output + + def test_function_create_pbf_required_options(self): + result = util.invoke_command(['fn', 'function', 'create', 'pbf-function']) + assert 'Error: Missing option(s)' in result.output + for option in ['--application-id', '--display-name', '--memory-in-mbs', '--pbf-listing-id']: + assert option in result.output + + def test_function_update_archive_required_options(self): + update_archive_command = functions_ext.function_update_group.commands['archive-function'] + update_archive_options = [option.opts[0] for option in update_archive_command.params if option.opts] + + for option in [ + '--bucket-name', + '--namespace', + '--object-name', + '--object-version-id', + '--functions-runtime-name', + '--functions-runtime-version-id', + '--archive-file', + '--runtime-config' + ]: + assert option in update_archive_options + + assert '--archive-file' not in self._required_options(update_archive_command) + assert '--runtime-config' not in self._required_options(update_archive_command) + + result = util.invoke_command(['fn', 'function', 'update', 'archive-function', '--help']) + assert 'object-storage' not in result.output + assert 'direct-archive' not in result.output + assert 'fn-update-runtime-config' not in result.output + assert 'manual-runtime-config' not in result.output + + def test_function_update_archive_runtime_validation(self): + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--function-id', 'fnid', + '--functions-runtime-name', 'java17.ol9' + ]) + assert 'Must specify --runtime-config when using --functions-runtime-name or --functions-runtime-version-id.' in result.output + + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--function-id', 'fnid', + '--functions-runtime-version-id', 'runtime-version-id' + ]) + assert 'Must specify --runtime-config when using --functions-runtime-name or --functions-runtime-version-id.' in result.output + + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--function-id', 'fnid', + '--runtime-config', 'FUNCTION_UPDATE' + ]) + assert 'Must specify --functions-runtime-name when --runtime-config is FUNCTION_UPDATE.' in result.output + + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--function-id', 'fnid', + '--runtime-config', 'MANUAL' + ]) + assert 'Must specify --functions-runtime-version-id when --runtime-config is MANUAL.' in result.output + + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--function-id', 'fnid', + '--runtime-config', 'manual' + ]) + assert 'invalid choice' not in result.output + assert 'Must specify --functions-runtime-version-id when --runtime-config is MANUAL.' in result.output + + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--generate-full-command-json-input' + ]) + assert result.exit_code == 0 + assert 'functionId' in result.output + + def test_function_update_archive_source_validation(self): + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--function-id', 'fnid', + '--bucket-name', 'bucket' + ]) + assert 'Must specify --bucket-name, --namespace and --object-name together when using Object Storage archive options.' in result.output + + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--function-id', 'fnid', + '--object-version-id', 'version' + ]) + assert 'Must specify --bucket-name, --namespace and --object-name together when using Object Storage archive options.' in result.output + + result = util.invoke_command([ + 'fn', 'function', 'update', 'archive-function', + '--function-id', 'fnid', + '--archive-file', '/tmp/function.zip', + '--bucket-name', 'bucket', + '--namespace', 'namespace', + '--object-name', 'object' + ]) + assert 'Cannot specify --archive-file with Object Storage archive options' in result.output + + def test_function_update_container_and_pbf_options(self): + container_command = functions_ext.function_update_group.commands['container-function'] + pbf_command = functions_ext.function_update_group.commands['pbf-function'] + + result = util.invoke_command(['fn', 'function', 'update', 'container-function', '--generate-full-command-json-input']) + assert result.exit_code == 0 + assert 'functionId' in result.output + + result = util.invoke_command(['fn', 'function', 'update', 'pbf-function', '--generate-full-command-json-input']) + assert result.exit_code == 0 + assert 'functionId' in result.output + + assert '--image' not in self._required_options(container_command) + + pbf_options = [option.opts[0] for option in pbf_command.params if option.opts] + assert '--pbf-listing-id' not in pbf_options + + def test_function_extended_commands_generate_param_json_input(self): + for command in [ + ['fn', 'function', 'create', 'container-function'], + ['fn', 'function', 'create', 'pbf-function'], + ['fn', 'function', 'update', 'archive-function'], + ['fn', 'function', 'update', 'container-function'], + ['fn', 'function', 'update', 'pbf-function'] + ]: + result = util.invoke_command(command + ['--generate-param-json-input', 'config']) + assert result.exit_code == 0 + assert 'string' in result.output + + result = util.invoke_command(command + ['--generate-param-json-input', 'provisioned-concurrency']) + assert result.exit_code == 0 + assert 'strategy' in result.output + + def test_function_delete(self): + result = util.invoke_command(['fn', 'function', 'delete']) assert 'Error: Missing option(s)' in result.output assert '--function-id' in result.output - result = util.invoke_command(['fn', 'function', 'update', '--memory-in-mbs', 'x']) - assert "Error: Invalid value for '--memory-in-mbs': 'x' is not a valid integer" in result.output - result = util.invoke_command(['fn', 'function', 'update', '--image']) - assert 'Error: Option \'--image\' requires an argument' in result.output - result = util.invoke_command(['fn', 'function', 'update', '--config']) - assert 'Error: Option \'--config\' requires an argument' in result.output def test_function_list(self): result = util.invoke_command(['fn', 'function', 'list']) @@ -128,10 +321,25 @@ def test_function_invoke(self): result = util.invoke_command(['fn', 'function', 'invoke', '--fn-invoke-type', 'x']) assert "Error: Invalid value for '--fn-invoke-type': invalid choice: x. (choose from detached, sync)" in result.output + def test_fn_runtime(self): + self._assert_output_contains(['fn', 'runtime'], ['get', 'list']) + + def test_fn_runtime_version(self): + self._assert_output_contains(['fn', 'runtime-version'], ['get', 'list']) + + def test_fn_work_request(self): + result = self._assert_output_contains(['fn', 'work-request'], ['get', 'list']) + assert 'cancel' not in result.output + + def test_fn_work_request_error(self): + self._assert_output_contains(['fn', 'work-request-error'], ['list']) + + def test_fn_work_request_log_entry(self): + result = self._assert_output_contains(['fn', 'work-request-log-entry'], ['list']) + assert 'list-work-request-logs' not in result.output + def test_fn_pbf_listing(self): - result = util.invoke_command(['fn', 'pbf-listing']) - assert 'get' in result.output - assert 'list' in result.output + self._assert_output_contains(['fn', 'pbf-listing'], ['get', 'list']) def test_fn_pbf_listing_get(self): result = util.invoke_command(['fn', 'pbf-listing', 'get']) @@ -139,9 +347,7 @@ def test_fn_pbf_listing_get(self): assert '--pbf-listing-id' in result.output def test_fn_pbf_listing_version(self): - result = util.invoke_command(['fn', 'pbf-listing-version']) - assert 'get' in result.output - assert 'list' in result.output + self._assert_output_contains(['fn', 'pbf-listing-version'], ['get', 'list']) def test_fn_pbf_listing_version_get(self): result = util.invoke_command(['fn', 'pbf-listing-version', 'get']) @@ -154,5 +360,212 @@ def test_fn_pbf_listing_version_list(self): assert '--pbf-listing-id' in result.output def test_fn_trigger(self): - result = util.invoke_command(['fn', 'trigger']) - assert 'list' in result.output + self._assert_output_contains(['fn', 'trigger'], ['list']) + + def test_archive_update_omits_empty_archive_source_details(self): + object_storage_payload = functions_ext._build_archive_source_details( + functions_ext._build_object_storage_archive_details({ + 'bucket_name': None, + 'namespace': None, + 'object_name': None, + 'object_version_id': None + }, include_if_empty=False), + functions_ext._build_fn_update_runtime_config({'functions_runtime_name': 'python312.ol9'}), + {'handler': None} + ) + assert object_storage_payload == { + 'sourceType': 'ARCHIVE', + 'runtimeConfig': { + 'runtimeConfigType': 'FUNCTION_UPDATE', + 'functionsRuntimeName': 'python312.ol9' + } + } + + direct_archive_payload = functions_ext._build_archive_source_details( + functions_ext._build_direct_archive_details({'archive_file': None}, include_if_empty=False), + functions_ext._build_fn_update_runtime_config({'functions_runtime_name': 'python312.ol9'}), + {'handler': None} + ) + assert direct_archive_payload == { + 'sourceType': 'ARCHIVE', + 'runtimeConfig': { + 'runtimeConfigType': 'FUNCTION_UPDATE', + 'functionsRuntimeName': 'python312.ol9' + } + } + + def test_update_archive_function_builds_object_storage_payload(self): + update_archive_command = functions_ext.function_update_group.commands['archive-function'] + captured = {} + + class DummyCtx(click.Context): + def invoke(self, command, **kwargs): + captured['command'] = command.name + captured['kwargs'] = kwargs + + with DummyCtx(update_archive_command, obj={ + 'debug': False, + 'parameter_aliases': {}, + 'parameter_lookup_heirarchy': [], + 'generate_full_command_json_input': None, + 'generate_param_json_input': None, + 'default_values_from_file': {} + }): + functions_ext.update_archive_function.callback( + function_id='fnid', + bucket_name='bucket', + namespace='namespace', + object_name='function.zip', + object_version_id='version', + archive_file=None, + runtime_config='MANUAL', + functions_runtime_name=None, + functions_runtime_version_id='runtime-version-id', + handler='handler.entrypoint', + memory_in_mbs=1024, + provisioned_concurrency=None + ) + + source_details = json.loads(captured['kwargs']['source_details']) + assert source_details == { + 'sourceType': 'ARCHIVE', + 'archiveSourceDetails': { + 'archiveSourceType': 'OBJECT_STORAGE_ARCHIVE', + 'bucketName': 'bucket', + 'namespace': 'namespace', + 'objectName': 'function.zip', + 'objectVersionId': 'version' + }, + 'runtimeConfig': { + 'runtimeConfigType': 'MANUAL', + 'functionsRuntimeVersionId': 'runtime-version-id' + }, + 'handler': 'handler.entrypoint' + } + assert captured['kwargs']['function_id'] == 'fnid' + + def test_update_archive_function_builds_direct_archive_payload(self): + update_archive_command = functions_ext.function_update_group.commands['archive-function'] + captured = {} + + class DummyCtx(click.Context): + def invoke(self, command, **kwargs): + captured['command'] = command.name + captured['kwargs'] = kwargs + + with tempfile.NamedTemporaryFile(suffix='.zip', delete=False) as temp_zip: + temp_zip.write(b'ZIP_BYTES') + zip_path = temp_zip.name + + try: + with DummyCtx(update_archive_command, obj={ + 'debug': False, + 'parameter_aliases': {}, + 'parameter_lookup_heirarchy': [], + 'generate_full_command_json_input': None, + 'generate_param_json_input': None, + 'default_values_from_file': {} + }): + functions_ext.update_archive_function.callback( + function_id='fnid', + bucket_name=None, + namespace=None, + object_name=None, + object_version_id=None, + archive_file=zip_path, + runtime_config='FUNCTION_UPDATE', + functions_runtime_name='python312.ol9', + functions_runtime_version_id=None, + handler=None, + memory_in_mbs=1024, + provisioned_concurrency=None + ) + finally: + os.remove(zip_path) + + source_details = json.loads(captured['kwargs']['source_details']) + assert source_details == { + 'sourceType': 'ARCHIVE', + 'archiveSourceDetails': { + 'archiveSourceType': 'DIRECT_ARCHIVE', + 'archiveFile': base64.b64encode(b'ZIP_BYTES').decode('utf-8') + }, + 'runtimeConfig': { + 'runtimeConfigType': 'FUNCTION_UPDATE', + 'functionsRuntimeName': 'python312.ol9' + } + } + + def test_direct_archive_file_encodes_zip_and_jar_paths(self): + with tempfile.NamedTemporaryFile(suffix='.zip', delete=False) as temp_zip: + temp_zip.write(b'ZIP_BYTES') + zip_path = temp_zip.name + with tempfile.NamedTemporaryFile(suffix='.jar', delete=False) as temp_jar: + temp_jar.write(b'JAR_BYTES') + jar_path = temp_jar.name + try: + from_zip = functions_ext._build_direct_archive_details({'archive_file': zip_path}) + assert from_zip == { + 'archiveSourceType': 'DIRECT_ARCHIVE', + 'archiveFile': base64.b64encode(b'ZIP_BYTES').decode('utf-8') + } + + from_file_uri = functions_ext._build_direct_archive_details({'archive_file': 'file://' + zip_path}) + assert from_file_uri == { + 'archiveSourceType': 'DIRECT_ARCHIVE', + 'archiveFile': base64.b64encode(b'ZIP_BYTES').decode('utf-8') + } + + from_jar = functions_ext._build_direct_archive_details({'archive_file': jar_path}) + assert from_jar == { + 'archiveSourceType': 'DIRECT_ARCHIVE', + 'archiveFile': base64.b64encode(b'JAR_BYTES').decode('utf-8') + } + finally: + os.remove(zip_path) + os.remove(jar_path) + + def test_direct_archive_file_rejects_invalid_path_and_extension(self): + try: + functions_ext._build_direct_archive_details({'archive_file': '/tmp/non-existent-function-archive.zip'}) + assert False, 'Expected UsageError for missing archive file' + except click.UsageError as error: + assert "does not exist" in str(error) + + with tempfile.NamedTemporaryFile(suffix='.txt', delete=False) as temp_txt: + temp_txt.write(b'NOT_ARCHIVE') + txt_path = temp_txt.name + try: + functions_ext._build_direct_archive_details({'archive_file': txt_path}) + assert False, 'Expected UsageError for unsupported archive extension' + except click.UsageError as error: + assert 'must be a .zip or .jar file' in str(error) + finally: + os.remove(txt_path) + + def test_pbf_update_does_not_send_source_details(self): + pbf_command = functions_ext.function_update_group.commands['pbf-function'] + captured = {} + + class DummyCtx(click.Context): + def invoke(self, command, **kwargs): + captured['command'] = command.name + captured['kwargs'] = kwargs + + with DummyCtx(pbf_command, obj={ + 'debug': False, + 'parameter_aliases': {}, + 'parameter_lookup_heirarchy': [], + 'generate_full_command_json_input': None, + 'generate_param_json_input': None, + 'default_values_from_file': {} + }): + functions_ext.update_pbf_function.callback( + function_id='fnid', + memory_in_mbs=1024, + provisioned_concurrency=None + ) + + assert 'source_details' not in captured['kwargs'] + assert captured['kwargs']['function_id'] == 'fnid' + assert captured['kwargs']['memory_in_mbs'] == 1024 diff --git a/services/functions/tests/util/generated/command_to_api.py b/services/functions/tests/util/generated/command_to_api.py index d083134cb..5b793e3e0 100644 --- a/services/functions/tests/util/generated/command_to_api.py +++ b/services/functions/tests/util/generated/command_to_api.py @@ -2,20 +2,9 @@ # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. SDK_client_map = { - "functions_management.change_application_compartment": "oci.functions.FunctionsManagementClient.change_application_compartment", - "functions_management.create_application": "oci.functions.FunctionsManagementClient.create_application", - "functions_management.create_function": "oci.functions.FunctionsManagementClient.create_function", - "functions_management.delete_application": "oci.functions.FunctionsManagementClient.delete_application", - "functions_management.delete_function": "oci.functions.FunctionsManagementClient.delete_function", - "functions_management.get_application": "oci.functions.FunctionsManagementClient.get_application", - "functions_management.get_function": "oci.functions.FunctionsManagementClient.get_function", - "functions_management.get_pbf_listing": "oci.functions.FunctionsManagementClient.get_pbf_listing", - "functions_management.get_pbf_listing_version": "oci.functions.FunctionsManagementClient.get_pbf_listing_version", - "functions_management.list_applications": "oci.functions.FunctionsManagementClient.list_applications", - "functions_management.list_functions": "oci.functions.FunctionsManagementClient.list_functions", - "functions_management.list_pbf_listing_versions": "oci.functions.FunctionsManagementClient.list_pbf_listing_versions", - "functions_management.list_pbf_listings": "oci.functions.FunctionsManagementClient.list_pbf_listings", - "functions_management.list_triggers": "oci.functions.FunctionsManagementClient.list_triggers", - "functions_management.update_application": "oci.functions.FunctionsManagementClient.update_application", - "functions_management.update_function": "oci.functions.FunctionsManagementClient.update_function", + "work_request_management.cancel_work_request": "oci.functions.WorkRequestManagementClient.cancel_work_request", + "work_request_management.get_work_request": "oci.functions.WorkRequestManagementClient.get_work_request", + "work_request_management.list_work_request_errors": "oci.functions.WorkRequestManagementClient.list_work_request_errors", + "work_request_management.list_work_request_logs": "oci.functions.WorkRequestManagementClient.list_work_request_logs", + "work_request_management.list_work_requests": "oci.functions.WorkRequestManagementClient.list_work_requests", } diff --git a/services/generative_ai/src/oci_cli_generative_ai/generated/generativeai_cli.py b/services/generative_ai/src/oci_cli_generative_ai/generated/generativeai_cli.py index 7dc702d49..27dc35d2e 100644 --- a/services/generative_ai/src/oci_cli_generative_ai/generated/generativeai_cli.py +++ b/services/generative_ai/src/oci_cli_generative_ai/generated/generativeai_cli.py @@ -92,6 +92,12 @@ def vector_store_connector_group(): pass +@click.command(cli_util.override('generative_ai.model_discovery_collection_group.command_name', 'model-discovery-collection'), cls=CommandGroupWithAlias, help="""A paginated collection of model discovery results. Each item represents a model along with its capabilities and regional availability.""") +@cli_util.help_option_group +def model_discovery_collection_group(): + pass + + @click.command(cli_util.override('generative_ai.endpoint_group.command_name', 'endpoint'), cls=CommandGroupWithAlias, help="""To host a custom model for inference, create an endpoint for that model on a dedicated AI cluster of type HOSTING. To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator who gives OCI resource access to users. See [Getting Started with Policies] and [Getting Access to Generative AI Resources].""") @@ -108,6 +114,12 @@ def semantic_store_group(): pass +@click.command(cli_util.override('generative_ai.routing_profile_collection_group.command_name', 'routing-profile-collection'), cls=CommandGroupWithAlias, help="""Results of a routing profile search. Contains RoutingProfileSummary items and other information such as metadata.""") +@cli_util.help_option_group +def routing_profile_collection_group(): + pass + + @click.command(cli_util.override('generative_ai.vector_store_connector_ingestion_logs_collection_group.command_name', 'vector-store-connector-ingestion-logs-collection'), cls=CommandGroupWithAlias, help="""Results of a VectorStoreConnector Ingestion Log search.""") @cli_util.help_option_group def vector_store_connector_ingestion_logs_collection_group(): @@ -220,6 +232,14 @@ def generative_ai_project_collection_group(): pass +@click.command(cli_util.override('generative_ai.routing_profile_group.command_name', 'routing-profile'), cls=CommandGroupWithAlias, help="""A routing profile is a reusable set of policies that controls how Smart Router selects a target region and model for inference traffic. It can scope routing to allowed regions and allowed models. + +To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator who gives OCI resource access to users. See [Getting Started with Policies] and [Getting Access to Generative AI Resources].""") +@cli_util.help_option_group +def routing_profile_group(): + pass + + @click.command(cli_util.override('generative_ai.api_key_group.command_name', 'api-key'), cls=CommandGroupWithAlias, help="""ApiKeys are resources used to access GenAI models. You must be authorized through an IAM policy to use any API operations. If you're not authorized, contact an administrator who manages OCI resource access. See [Getting Started with Policies] and [Getting Access to Generative AI Resources].""") @cli_util.help_option_group def api_key_group(): @@ -258,8 +278,10 @@ def imported_model_collection_group(): generative_ai_root_group.add_command(vector_store_connector_file_sync_collection_group) generative_ai_root_group.add_command(work_request_group) generative_ai_root_group.add_command(vector_store_connector_group) +generative_ai_root_group.add_command(model_discovery_collection_group) generative_ai_root_group.add_command(endpoint_group) generative_ai_root_group.add_command(semantic_store_group) +generative_ai_root_group.add_command(routing_profile_collection_group) generative_ai_root_group.add_command(vector_store_connector_ingestion_logs_collection_group) generative_ai_root_group.add_command(work_request_error_group) generative_ai_root_group.add_command(file_sync_ingestion_logs_collection_group) @@ -277,6 +299,7 @@ def imported_model_collection_group(): generative_ai_root_group.add_command(model_collection_group) generative_ai_root_group.add_command(generative_ai_private_endpoint_group) generative_ai_root_group.add_command(generative_ai_project_collection_group) +generative_ai_root_group.add_command(routing_profile_group) generative_ai_root_group.add_command(api_key_group) generative_ai_root_group.add_command(dedicated_ai_cluster_group) generative_ai_root_group.add_command(hosted_application_storage_group) @@ -838,6 +861,37 @@ def change_model_compartment(ctx, from_json, model_id, compartment_id, if_match) cli_util.render_response(result, ctx) +@routing_profile_group.command(name=cli_util.override('generative_ai.change_routing_profile_compartment.command_name', 'change-compartment'), help=u"""Moves a routing profile into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeRoutingProfileCompartment)""") +@cli_util.option('--routing-profile-id', required=True, help=u"""The [OCID] of the routing profile.""") +@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment to move the routing profile to.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def change_routing_profile_compartment(ctx, from_json, routing_profile_id, compartment_id, if_match): + + if isinstance(routing_profile_id, six.string_types) and len(routing_profile_id.strip()) == 0: + raise click.UsageError('Parameter --routing-profile-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + result = client.change_routing_profile_compartment( + routing_profile_id=routing_profile_id, + change_routing_profile_compartment_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + @semantic_store_group.command(name=cli_util.override('generative_ai.change_semantic_store_compartment.command_name', 'change-compartment'), help=u"""Moves a SemanticStore into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeSemanticStoreCompartment)""") @cli_util.option('--semantic-store-id', required=True, help=u"""The [OCID] of the SemanticStore.""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the SemanticStore to.""") @@ -2146,6 +2200,81 @@ def create_model(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval cli_util.render_response(result, ctx) +@routing_profile_group.command(name=cli_util.override('generative_ai.create_routing_profile.command_name', 'create'), help=u"""Creates a routing profile. \n[Command Reference](createRoutingProfile)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable.""") +@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment in which to create the routing profile.""") +@cli_util.option('--description', help=u"""An optional description of the routing profile.""") +@cli_util.option('--region-routing-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--model-routing-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. + +Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CREATING", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --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.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'region-routing-policy': {'module': 'generative_ai', 'class': 'RegionRoutingPolicy'}, 'model-routing-policy': {'module': 'generative_ai', 'class': 'ModelRoutingPolicy'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'region-routing-policy': {'module': 'generative_ai', 'class': 'RegionRoutingPolicy'}, 'model-routing-policy': {'module': 'generative_ai', 'class': 'ModelRoutingPolicy'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai', 'class': 'RoutingProfile'}) +@cli_util.wrap_exceptions +def create_routing_profile(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, description, region_routing_policy, model_routing_policy, freeform_tags, defined_tags): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['displayName'] = display_name + _details['compartmentId'] = compartment_id + + if description is not None: + _details['description'] = description + + if region_routing_policy is not None: + _details['regionRoutingPolicy'] = cli_util.parse_json_parameter("region_routing_policy", region_routing_policy) + + if model_routing_policy is not None: + _details['modelRoutingPolicy'] = cli_util.parse_json_parameter("model_routing_policy", model_routing_policy) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + result = client.create_routing_profile( + create_routing_profile_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_routing_profile') and callable(getattr(client, 'get_routing_profile')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_routing_profile(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @semantic_store_group.command(name=cli_util.override('generative_ai.create_semantic_store.command_name', 'create'), help=u"""Creates a SemanticStore. \n[Command Reference](createSemanticStore)""") @cli_util.option('--compartment-id', required=True, help=u"""Owning compartment [OCID] for a SemanticStore.""") @cli_util.option('--display-name', required=True, help=u"""A user-friendly name.""") @@ -3968,6 +4097,70 @@ def delete_model(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval cli_util.render_response(result, ctx) +@routing_profile_group.command(name=cli_util.override('generative_ai.delete_routing_profile.command_name', 'delete'), help=u"""Deletes a routing profile. \n[Command Reference](deleteRoutingProfile)""") +@cli_util.option('--routing-profile-id', required=True, help=u"""The [OCID] of the routing profile.""") +@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.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CREATING", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --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.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_routing_profile(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, routing_profile_id, if_match): + + if isinstance(routing_profile_id, six.string_types) and len(routing_profile_id.strip()) == 0: + raise click.UsageError('Parameter --routing-profile-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + result = client.delete_routing_profile( + routing_profile_id=routing_profile_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_routing_profile') and callable(getattr(client, 'get_routing_profile')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + oci.wait_until(client, client.get_routing_profile(routing_profile_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs) + except oci.exceptions.ServiceError as e: + # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the + # outcome of a delete operation it is possible that the resource is already gone and so the initial service call + # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising + # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument + # succeed_on_not_found=True to the waiter). + # + # Any non-404 should still result in the exception being thrown. + if e.status == 404: + pass + else: + raise + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @semantic_store_group.command(name=cli_util.override('generative_ai.delete_semantic_store.command_name', 'delete'), help=u"""Deletes a semanticStore. \n[Command Reference](deleteSemanticStore)""") @cli_util.option('--semantic-store-id', required=True, help=u"""The [OCID] of the SemanticStore.""") @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.""") @@ -4322,6 +4515,28 @@ def get_model(ctx, from_json, model_id): cli_util.render_response(result, ctx) +@routing_profile_group.command(name=cli_util.override('generative_ai.get_routing_profile.command_name', 'get'), help=u"""Gets information about a routing profile. \n[Command Reference](getRoutingProfile)""") +@cli_util.option('--routing-profile-id', required=True, help=u"""The [OCID] of the routing profile.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'generative_ai', 'class': 'RoutingProfile'}) +@cli_util.wrap_exceptions +def get_routing_profile(ctx, from_json, routing_profile_id): + + if isinstance(routing_profile_id, six.string_types) and len(routing_profile_id.strip()) == 0: + raise click.UsageError('Parameter --routing-profile-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + result = client.get_routing_profile( + routing_profile_id=routing_profile_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @semantic_store_group.command(name=cli_util.override('generative_ai.get_semantic_store.command_name', 'get'), help=u"""Gets information about a semanticStore. \n[Command Reference](getSemanticStore)""") @cli_util.option('--semantic-store-id', required=True, help=u"""The [OCID] of the SemanticStore.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -5080,6 +5295,84 @@ def list_imported_models(ctx, from_json, all_pages, page_size, compartment_id, v cli_util.render_response(result, ctx) +@model_discovery_collection_group.command(name=cli_util.override('generative_ai.list_model_discovery.command_name', 'list-model-discovery'), help=u"""Retrieves a list of models along with their capabilities, supported features, and deployment availability. Results can be filtered by attributes such as region, realm, model identifier, supported inference APIs, serving modes, and access type. \n[Command Reference](listModelDiscovery)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--realm', multiple=True, help=u"""A filter to return only resources whose realm matches the given realm.""") +@cli_util.option('--region-parameterconflict', multiple=True, help=u"""A filter to return only resources whose region matches the given region.""") +@cli_util.option('--model-id', help=u"""A filter to return only resources whose model identifier matches the given modelId.""") +@cli_util.option('--serving-mode', type=custom_types.CliCaseInsensitiveChoice(["ON_DEMAND", "DEDICATED"]), multiple=True, help=u"""A filter to return only resources whose serving modes match the given servingModes.""") +@cli_util.option('--api-capability', multiple=True, help=u"""Filter models that support any of the specified API capabilities.""") +@cli_util.option('--capability', type=custom_types.CliCaseInsensitiveChoice(["TEXT_GENERATION", "TEXT_SUMMARIZATION", "TEXT_EMBEDDINGS", "FINE_TUNE", "CHAT", "TEXT_RERANK", "TEXT_TO_IMAGE", "IMAGE_TEXT_TO_IMAGE", "IMAGE_TEXT_TO_TEXT", "IMAGE_TEXT_TO_VIDEO", "IMAGE_TO_IMAGE", "REALTIME", "AUDIO_TO_AUDIO", "AUDIO_TO_TEXT", "TEXT_TO_AUDIO", "TEXT_TO_VIDEO"]), multiple=True, help=u"""A filter to return only resources their capability matches the given capability.""") +@cli_util.option('--model-access', type=custom_types.CliCaseInsensitiveChoice(["HOSTED", "PROXY"]), multiple=True, help=u"""Filter models by access type.""") +@cli_util.option('--is-deprecated', type=click.BOOL, help=u"""If true, return only deprecated models; if false, exclude deprecated models.""") +@cli_util.option('--is-on-demand-retired', type=click.BOOL, help=u"""Filter models based on on-demand retirement status.""") +@cli_util.option('--is-dedicated-retired', type=click.BOOL, help=u"""Filter models based on dedicated retirement status.""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({'realm': {'module': 'generative_ai', 'class': 'list[string]'}, 'region-parameterconflict': {'module': 'generative_ai', 'class': 'list[string]'}, 'api-capability': {'module': 'generative_ai', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'realm': {'module': 'generative_ai', 'class': 'list[string]'}, 'region-parameterconflict': {'module': 'generative_ai', 'class': 'list[string]'}, 'api-capability': {'module': 'generative_ai', 'class': 'list[string]'}}, output_type={'module': 'generative_ai', 'class': 'ModelDiscoveryCollection'}) +@cli_util.wrap_exceptions +def list_model_discovery(ctx, from_json, all_pages, page_size, compartment_id, realm, region_parameterconflict, model_id, serving_mode, api_capability, capability, model_access, is_deprecated, is_on_demand_retired, is_dedicated_retired, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if realm is not None and len(realm) > 0: + kwargs['realm'] = realm + if region_parameterconflict is not None and len(region_parameterconflict) > 0: + kwargs['region'] = region_parameterconflict + if model_id is not None: + kwargs['model_id'] = model_id + if serving_mode is not None and len(serving_mode) > 0: + kwargs['serving_mode'] = serving_mode + if api_capability is not None and len(api_capability) > 0: + kwargs['api_capability'] = api_capability + if capability is not None and len(capability) > 0: + kwargs['capability'] = capability + if model_access is not None and len(model_access) > 0: + kwargs['model_access'] = model_access + if is_deprecated is not None: + kwargs['is_deprecated'] = is_deprecated + if is_on_demand_retired is not None: + kwargs['is_on_demand_retired'] = is_on_demand_retired + if is_dedicated_retired is not None: + kwargs['is_dedicated_retired'] = is_dedicated_retired + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_model_discovery, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_model_discovery, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_model_discovery( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @model_collection_group.command(name=cli_util.override('generative_ai.list_models.command_name', 'list-models'), help=u"""Lists the models in a specific compartment. Includes pretrained base models and fine-tuned custom models. \n[Command Reference](listModels)""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") @cli_util.option('--vendor', help=u"""A filter to return only resources that match the entire vendor given.""") @@ -5149,6 +5442,69 @@ def list_models(ctx, from_json, all_pages, page_size, compartment_id, vendor, ca cli_util.render_response(result, ctx) +@routing_profile_collection_group.command(name=cli_util.override('generative_ai.list_routing_profiles.command_name', 'list-routing-profiles'), help=u"""Lists the routing profiles of a specific compartment. \n[Command Reference](listRoutingProfiles)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CREATING", "UPDATING", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only resources whose lifecycle state matches the given value.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the given display name exactly.""") +@cli_util.option('--id', help=u"""The [OCID] of the routing profile.""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination].""") +@cli_util.option('--page', help=u"""For list pagination. The value of the opc-next-page response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["displayName", "timeCreated"]), help=u"""The field to sort by. You can provide only one sort order. Default order for `timeCreated` is descending. Default order for `displayName` is ascending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'generative_ai', 'class': 'RoutingProfileCollection'}) +@cli_util.wrap_exceptions +def list_routing_profiles(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if id is not None: + kwargs['id'] = id + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_routing_profiles, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_routing_profiles, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_routing_profiles( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @semantic_store_collection_group.command(name=cli_util.override('generative_ai.list_semantic_stores.command_name', 'list-semantic-stores'), help=u"""Lists the SemanticStores given specific filter. \n[Command Reference](listSemanticStores)""") @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment in which to list resources.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CREATING", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help=u"""A filter to return only resources whose lifecycle state matches the given array.""") @@ -6697,6 +7053,94 @@ def update_model(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_i cli_util.render_response(result, ctx) +@routing_profile_group.command(name=cli_util.override('generative_ai.update_routing_profile.command_name', 'update'), help=u"""Updates the properties of a routing profile. \n[Command Reference](updateRoutingProfile)""") +@cli_util.option('--routing-profile-id', required=True, help=u"""The [OCID] of the routing profile.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable.""") +@cli_util.option('--description', help=u"""An optional description of the routing profile.""") +@cli_util.option('--region-routing-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--model-routing-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. + +Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""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) +@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.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CREATING", "UPDATING", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --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.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'region-routing-policy': {'module': 'generative_ai', 'class': 'RegionRoutingPolicy'}, 'model-routing-policy': {'module': 'generative_ai', 'class': 'ModelRoutingPolicy'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'region-routing-policy': {'module': 'generative_ai', 'class': 'RegionRoutingPolicy'}, 'model-routing-policy': {'module': 'generative_ai', 'class': 'ModelRoutingPolicy'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai', 'class': 'RoutingProfile'}) +@cli_util.wrap_exceptions +def update_routing_profile(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, routing_profile_id, display_name, description, region_routing_policy, model_routing_policy, freeform_tags, defined_tags, if_match): + + if isinstance(routing_profile_id, six.string_types) and len(routing_profile_id.strip()) == 0: + raise click.UsageError('Parameter --routing-profile-id cannot be whitespace or empty string') + if not force: + if region_routing_policy or model_routing_policy or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to region-routing-policy and model-routing-policy and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if region_routing_policy is not None: + _details['regionRoutingPolicy'] = cli_util.parse_json_parameter("region_routing_policy", region_routing_policy) + + if model_routing_policy is not None: + _details['modelRoutingPolicy'] = cli_util.parse_json_parameter("model_routing_policy", model_routing_policy) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + result = client.update_routing_profile( + routing_profile_id=routing_profile_id, + update_routing_profile_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_routing_profile') and callable(getattr(client, 'get_routing_profile')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_routing_profile(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @semantic_store_group.command(name=cli_util.override('generative_ai.update_semantic_store.command_name', 'update'), help=u"""Updates the properties of a SemanticStore. \n[Command Reference](updateSemanticStore)""") @cli_util.option('--semantic-store-id', required=True, help=u"""The [OCID] of the SemanticStore.""") @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") diff --git a/services/generative_ai/tests/util/generated/command_to_api.py b/services/generative_ai/tests/util/generated/command_to_api.py index cf9e2e5de..69d34deb6 100644 --- a/services/generative_ai/tests/util/generated/command_to_api.py +++ b/services/generative_ai/tests/util/generated/command_to_api.py @@ -14,6 +14,7 @@ "generative_ai.change_hosted_application_storage_compartment": "oci.generative_ai.GenerativeAiClient.change_hosted_application_storage_compartment", "generative_ai.change_imported_model_compartment": "oci.generative_ai.GenerativeAiClient.change_imported_model_compartment", "generative_ai.change_model_compartment": "oci.generative_ai.GenerativeAiClient.change_model_compartment", + "generative_ai.change_routing_profile_compartment": "oci.generative_ai.GenerativeAiClient.change_routing_profile_compartment", "generative_ai.change_semantic_store_compartment": "oci.generative_ai.GenerativeAiClient.change_semantic_store_compartment", "generative_ai.create_api_key": "oci.generative_ai.GenerativeAiClient.create_api_key", "generative_ai.create_dedicated_ai_cluster": "oci.generative_ai.GenerativeAiClient.create_dedicated_ai_cluster", @@ -26,6 +27,7 @@ "generative_ai.create_hosted_deployment": "oci.generative_ai.GenerativeAiClient.create_hosted_deployment", "generative_ai.create_imported_model": "oci.generative_ai.GenerativeAiClient.create_imported_model", "generative_ai.create_model": "oci.generative_ai.GenerativeAiClient.create_model", + "generative_ai.create_routing_profile": "oci.generative_ai.GenerativeAiClient.create_routing_profile", "generative_ai.create_semantic_store": "oci.generative_ai.GenerativeAiClient.create_semantic_store", "generative_ai.create_vector_store_connector": "oci.generative_ai.GenerativeAiClient.create_vector_store_connector", "generative_ai.create_vector_store_connector_file_sync": "oci.generative_ai.GenerativeAiClient.create_vector_store_connector_file_sync", @@ -41,6 +43,7 @@ "generative_ai.delete_hosted_deployment_artifact": "oci.generative_ai.GenerativeAiClient.delete_hosted_deployment_artifact", "generative_ai.delete_imported_model": "oci.generative_ai.GenerativeAiClient.delete_imported_model", "generative_ai.delete_model": "oci.generative_ai.GenerativeAiClient.delete_model", + "generative_ai.delete_routing_profile": "oci.generative_ai.GenerativeAiClient.delete_routing_profile", "generative_ai.delete_semantic_store": "oci.generative_ai.GenerativeAiClient.delete_semantic_store", "generative_ai.delete_vector_store_connector": "oci.generative_ai.GenerativeAiClient.delete_vector_store_connector", "generative_ai.get_api_key": "oci.generative_ai.GenerativeAiClient.get_api_key", @@ -54,6 +57,7 @@ "generative_ai.get_hosted_deployment": "oci.generative_ai.GenerativeAiClient.get_hosted_deployment", "generative_ai.get_imported_model": "oci.generative_ai.GenerativeAiClient.get_imported_model", "generative_ai.get_model": "oci.generative_ai.GenerativeAiClient.get_model", + "generative_ai.get_routing_profile": "oci.generative_ai.GenerativeAiClient.get_routing_profile", "generative_ai.get_semantic_store": "oci.generative_ai.GenerativeAiClient.get_semantic_store", "generative_ai.get_vector_store_connector": "oci.generative_ai.GenerativeAiClient.get_vector_store_connector", "generative_ai.get_vector_store_connector_file_sync": "oci.generative_ai.GenerativeAiClient.get_vector_store_connector_file_sync", @@ -69,7 +73,9 @@ "generative_ai.list_hosted_applications_iam": "oci.generative_ai.GenerativeAiClient.list_hosted_applications_iam", "generative_ai.list_hosted_deployments": "oci.generative_ai.GenerativeAiClient.list_hosted_deployments", "generative_ai.list_imported_models": "oci.generative_ai.GenerativeAiClient.list_imported_models", + "generative_ai.list_model_discovery": "oci.generative_ai.GenerativeAiClient.list_model_discovery", "generative_ai.list_models": "oci.generative_ai.GenerativeAiClient.list_models", + "generative_ai.list_routing_profiles": "oci.generative_ai.GenerativeAiClient.list_routing_profiles", "generative_ai.list_semantic_stores": "oci.generative_ai.GenerativeAiClient.list_semantic_stores", "generative_ai.list_vector_store_connector_file_sync_ingestion_logs": "oci.generative_ai.GenerativeAiClient.list_vector_store_connector_file_sync_ingestion_logs", "generative_ai.list_vector_store_connector_file_syncs": "oci.generative_ai.GenerativeAiClient.list_vector_store_connector_file_syncs", @@ -90,6 +96,7 @@ "generative_ai.update_hosted_deployment": "oci.generative_ai.GenerativeAiClient.update_hosted_deployment", "generative_ai.update_imported_model": "oci.generative_ai.GenerativeAiClient.update_imported_model", "generative_ai.update_model": "oci.generative_ai.GenerativeAiClient.update_model", + "generative_ai.update_routing_profile": "oci.generative_ai.GenerativeAiClient.update_routing_profile", "generative_ai.update_semantic_store": "oci.generative_ai.GenerativeAiClient.update_semantic_store", "generative_ai.update_vector_store_connector": "oci.generative_ai.GenerativeAiClient.update_vector_store_connector", } diff --git a/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/__init__.py b/services/marketplace_publisher/src/oci_cli_administrator_artifact/__init__.py similarity index 92% rename from services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/__init__.py rename to services/marketplace_publisher/src/oci_cli_administrator_artifact/__init__.py index 7293131c0..15afc1d95 100644 --- a/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/__init__.py +++ b/services/marketplace_publisher/src/oci_cli_administrator_artifact/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/__init__.py b/services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/__init__.py similarity index 92% rename from services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/__init__.py rename to services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/__init__.py index 7293131c0..15afc1d95 100644 --- a/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/__init__.py +++ b/services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/__init__.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 diff --git a/services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/administratorartifact_cli.py b/services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/administratorartifact_cli.py new file mode 100644 index 000000000..c43f2e05f --- /dev/null +++ b/services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/administratorartifact_cli.py @@ -0,0 +1,63 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 + +from __future__ import print_function +import click +import oci # noqa: F401 +import six # noqa: F401 +import sys # noqa: F401 +from oci_cli import cli_constants # noqa: F401 +from oci_cli import cli_util +from oci_cli import json_skeleton_utils +from oci_cli import custom_types # noqa: F401 +from oci_cli.aliasing import CommandGroupWithAlias +from services.marketplace_publisher.src.oci_cli_marketplace_publisher.generated import marketplace_publisher_service_cli + + +@click.command(cli_util.override('administrator_artifact.administrator_artifact_root_group.command_name', 'administrator-artifact'), cls=CommandGroupWithAlias, help=cli_util.override('administrator_artifact.administrator_artifact_root_group.help', """Use the Marketplace Publisher API to manage the publishing of applications in Oracle Cloud Infrastructure Marketplace."""), short_help=cli_util.override('administrator_artifact.administrator_artifact_root_group.short_help', """MarketplacePublisherService API""")) +@cli_util.help_option_group +def administrator_artifact_root_group(): + pass + + +@click.command(cli_util.override('administrator_artifact.admin_publisher_group.command_name', 'admin-publisher'), cls=CommandGroupWithAlias, help="""The model for a publisher details.""") +@cli_util.help_option_group +def admin_publisher_group(): + pass + + +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(administrator_artifact_root_group) +administrator_artifact_root_group.add_command(admin_publisher_group) + + +@admin_publisher_group.command(name=cli_util.override('administrator_artifact.update_admin_artifact_status.command_name', 'update-admin-artifact-status'), help=u"""Updates the specified Artifact Status identified by the id. \n[Command Reference](updateAdminArtifactStatus)""") +@cli_util.option('--new-status', required=True, help=u"""The new status for the artifact.""") +@cli_util.option('--artifact-id', required=True, help=u"""artifact OCID""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'Artifact'}) +@cli_util.wrap_exceptions +def update_admin_artifact_status(ctx, from_json, new_status, artifact_id, if_match): + + if isinstance(artifact_id, six.string_types) and len(artifact_id.strip()) == 0: + raise click.UsageError('Parameter --artifact-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['newStatus'] = new_status + + client = cli_util.build_client('marketplace_publisher', 'administrator_artifact', ctx) + result = client.update_admin_artifact_status( + artifact_id=artifact_id, + update_admin_artifact_status_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) diff --git a/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/client_mappings.py b/services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/client_mappings.py similarity index 53% rename from services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/client_mappings.py rename to services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/client_mappings.py index 3a9b10432..eb662911c 100644 --- a/services/distributed_database_v26/src/oci_cli_distributed_autonomous_db_service/generated/client_mappings.py +++ b/services/marketplace_publisher/src/oci_cli_administrator_artifact/generated/client_mappings.py @@ -1,14 +1,14 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 import oci from oci_cli.cli_clients import CLIENT_MAP from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.distributed_database_v26 import DistributedAutonomousDbServiceClient +from oci.marketplace_publisher import AdministratorArtifactClient -MODULE_TO_TYPE_MAPPINGS["distributed_database_v26"] = oci.distributed_database_v26.models.distributed_database_v26_type_mapping -if CLIENT_MAP.get("distributed_database_v26") is None: - CLIENT_MAP["distributed_database_v26"] = {} -CLIENT_MAP["distributed_database_v26"]["distributed_autonomous_db_service"] = DistributedAutonomousDbServiceClient +MODULE_TO_TYPE_MAPPINGS["marketplace_publisher"] = oci.marketplace_publisher.models.marketplace_publisher_type_mapping +if CLIENT_MAP.get("marketplace_publisher") is None: + CLIENT_MAP["marketplace_publisher"] = {} +CLIENT_MAP["marketplace_publisher"]["administrator_artifact"] = AdministratorArtifactClient diff --git a/services/marketplace_publisher/src/oci_cli_administrator_publisher/__init__.py b/services/marketplace_publisher/src/oci_cli_administrator_publisher/__init__.py new file mode 100644 index 000000000..15afc1d95 --- /dev/null +++ b/services/marketplace_publisher/src/oci_cli_administrator_publisher/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 diff --git a/services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/__init__.py b/services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/__init__.py new file mode 100644 index 000000000..15afc1d95 --- /dev/null +++ b/services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 diff --git a/services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/administratorpublisher_cli.py b/services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/administratorpublisher_cli.py new file mode 100644 index 000000000..de4e5b718 --- /dev/null +++ b/services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/administratorpublisher_cli.py @@ -0,0 +1,54 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 + +from __future__ import print_function +import click +import oci # noqa: F401 +import six # noqa: F401 +import sys # noqa: F401 +from oci_cli import cli_constants # noqa: F401 +from oci_cli import cli_util +from oci_cli import json_skeleton_utils +from oci_cli import custom_types # noqa: F401 +from oci_cli.aliasing import CommandGroupWithAlias +from services.marketplace_publisher.src.oci_cli_marketplace_publisher.generated import marketplace_publisher_service_cli + + +@click.command(cli_util.override('administrator_publisher.administrator_publisher_root_group.command_name', 'administrator-publisher'), cls=CommandGroupWithAlias, help=cli_util.override('administrator_publisher.administrator_publisher_root_group.help', """Use the Marketplace Publisher API to manage the publishing of applications in Oracle Cloud Infrastructure Marketplace."""), short_help=cli_util.override('administrator_publisher.administrator_publisher_root_group.short_help', """MarketplacePublisherService API""")) +@cli_util.help_option_group +def administrator_publisher_root_group(): + pass + + +@click.command(cli_util.override('administrator_publisher.admin_publisher_group.command_name', 'admin-publisher'), cls=CommandGroupWithAlias, help="""The model for a publisher details.""") +@cli_util.help_option_group +def admin_publisher_group(): + pass + + +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(administrator_publisher_root_group) +administrator_publisher_root_group.add_command(admin_publisher_group) + + +@admin_publisher_group.command(name=cli_util.override('administrator_publisher.get_admin_publisher.command_name', 'get'), help=u"""Gets a Publisher by identifier \n[Command Reference](getAdminPublisher)""") +@cli_util.option('--publisher-id', required=True, help=u"""Publisher OCID""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminPublisher'}) +@cli_util.wrap_exceptions +def get_admin_publisher(ctx, from_json, publisher_id): + + if isinstance(publisher_id, six.string_types) and len(publisher_id.strip()) == 0: + raise click.UsageError('Parameter --publisher-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'administrator_publisher', ctx) + result = client.get_admin_publisher( + publisher_id=publisher_id, + **kwargs + ) + cli_util.render_response(result, ctx) diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/client_mappings.py b/services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/client_mappings.py similarity index 53% rename from services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/client_mappings.py rename to services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/client_mappings.py index ddfdeb853..44c805e2d 100644 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_work_request_service/generated/client_mappings.py +++ b/services/marketplace_publisher/src/oci_cli_administrator_publisher/generated/client_mappings.py @@ -1,14 +1,14 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 import oci from oci_cli.cli_clients import CLIENT_MAP from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.distributed_database_v26 import DistributedDbWorkRequestServiceClient +from oci.marketplace_publisher import AdministratorPublisherClient -MODULE_TO_TYPE_MAPPINGS["distributed_database_v26"] = oci.distributed_database_v26.models.distributed_database_v26_type_mapping -if CLIENT_MAP.get("distributed_database_v26") is None: - CLIENT_MAP["distributed_database_v26"] = {} -CLIENT_MAP["distributed_database_v26"]["distributed_db_work_request_service"] = DistributedDbWorkRequestServiceClient +MODULE_TO_TYPE_MAPPINGS["marketplace_publisher"] = oci.marketplace_publisher.models.marketplace_publisher_type_mapping +if CLIENT_MAP.get("marketplace_publisher") is None: + CLIENT_MAP["marketplace_publisher"] = {} +CLIENT_MAP["marketplace_publisher"]["administrator_publisher"] = AdministratorPublisherClient diff --git a/services/marketplace_publisher/src/oci_cli_marketplace_administrator/__init__.py b/services/marketplace_publisher/src/oci_cli_marketplace_administrator/__init__.py new file mode 100644 index 000000000..15afc1d95 --- /dev/null +++ b/services/marketplace_publisher/src/oci_cli_marketplace_administrator/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 diff --git a/services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/__init__.py b/services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/__init__.py new file mode 100644 index 000000000..15afc1d95 --- /dev/null +++ b/services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 diff --git a/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/client_mappings.py b/services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/client_mappings.py similarity index 52% rename from services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/client_mappings.py rename to services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/client_mappings.py index c2a131aad..4a56e5869 100644 --- a/services/distributed_database_v26/src/oci_cli_distributed_db_private_endpoint_service/generated/client_mappings.py +++ b/services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/client_mappings.py @@ -1,14 +1,14 @@ # coding: utf-8 # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20260101 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 import oci from oci_cli.cli_clients import CLIENT_MAP from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.distributed_database_v26 import DistributedDbPrivateEndpointServiceClient +from oci.marketplace_publisher import MarketplaceAdministratorClient -MODULE_TO_TYPE_MAPPINGS["distributed_database_v26"] = oci.distributed_database_v26.models.distributed_database_v26_type_mapping -if CLIENT_MAP.get("distributed_database_v26") is None: - CLIENT_MAP["distributed_database_v26"] = {} -CLIENT_MAP["distributed_database_v26"]["distributed_db_private_endpoint_service"] = DistributedDbPrivateEndpointServiceClient +MODULE_TO_TYPE_MAPPINGS["marketplace_publisher"] = oci.marketplace_publisher.models.marketplace_publisher_type_mapping +if CLIENT_MAP.get("marketplace_publisher") is None: + CLIENT_MAP["marketplace_publisher"] = {} +CLIENT_MAP["marketplace_publisher"]["marketplace_administrator"] = MarketplaceAdministratorClient diff --git a/services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/marketplaceadministrator_cli.py b/services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/marketplaceadministrator_cli.py new file mode 100644 index 000000000..91861b887 --- /dev/null +++ b/services/marketplace_publisher/src/oci_cli_marketplace_administrator/generated/marketplaceadministrator_cli.py @@ -0,0 +1,888 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 + +from __future__ import print_function +import click +import oci # noqa: F401 +import six # noqa: F401 +import sys # noqa: F401 +from oci_cli import cli_constants # noqa: F401 +from oci_cli import cli_util +from oci_cli import json_skeleton_utils +from oci_cli import custom_types # noqa: F401 +from oci_cli.aliasing import CommandGroupWithAlias +from services.marketplace_publisher.src.oci_cli_marketplace_publisher.generated import marketplace_publisher_service_cli + + +@click.command(cli_util.override('marketplace_administrator.marketplace_administrator_root_group.command_name', 'marketplace-administrator'), cls=CommandGroupWithAlias, help=cli_util.override('marketplace_administrator.marketplace_administrator_root_group.help', """Use the Marketplace Publisher API to manage the publishing of applications in Oracle Cloud Infrastructure Marketplace."""), short_help=cli_util.override('marketplace_administrator.marketplace_administrator_root_group.short_help', """MarketplacePublisherService API""")) +@cli_util.help_option_group +def marketplace_administrator_root_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_listing_revision_package_collection_group.command_name', 'admin-listing-revision-package-collection'), cls=CommandGroupWithAlias, help="""Results of package search. Contains Package items.""") +@cli_util.help_option_group +def admin_listing_revision_package_collection_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_term_version_group.command_name', 'admin-term-version'), cls=CommandGroupWithAlias, help="""Model object for the term version details.""") +@cli_util.help_option_group +def admin_term_version_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_term_collection_group.command_name', 'admin-term-collection'), cls=CommandGroupWithAlias, help="""Results of the term search. Contains term items.""") +@cli_util.help_option_group +def admin_term_collection_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_work_request_summary_group.command_name', 'admin-work-request-summary'), cls=CommandGroupWithAlias, help="""A summary of the status of a work request.""") +@cli_util.help_option_group +def admin_work_request_summary_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_listing_revision_attachment_collection_group.command_name', 'admin-listing-revision-attachment-collection'), cls=CommandGroupWithAlias, help="""Results of the listing attachments search. Contains attachment items.""") +@cli_util.help_option_group +def admin_listing_revision_attachment_collection_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_listing_group.command_name', 'admin-listing'), cls=CommandGroupWithAlias, help="""The model for the Admin Marketplace Publisher listing.""") +@cli_util.help_option_group +def admin_listing_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.market_group.command_name', 'market'), cls=CommandGroupWithAlias, help="""The model for the market details.""") +@cli_util.help_option_group +def market_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_publisher_sku_collection_group.command_name', 'admin-publisher-sku-collection'), cls=CommandGroupWithAlias, help="""Results of admin listing SKU retrieval. Contains SKU items.""") +@cli_util.help_option_group +def admin_publisher_sku_collection_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_artifact_collection_group.command_name', 'admin-artifact-collection'), cls=CommandGroupWithAlias, help="""Results of the artifact search. Contains the artifact items.""") +@cli_util.help_option_group +def admin_artifact_collection_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_term_version_collection_group.command_name', 'admin-term-version-collection'), cls=CommandGroupWithAlias, help="""Results of the term version search. Contains term version items.""") +@cli_util.help_option_group +def admin_term_version_collection_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_listing_revision_collection_group.command_name', 'admin-listing-revision-collection'), cls=CommandGroupWithAlias, help="""Results of admin listing revision search. Contains Listing revision items.""") +@cli_util.help_option_group +def admin_listing_revision_collection_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_listing_revision_group.command_name', 'admin-listing-revision'), cls=CommandGroupWithAlias, help="""The model for an Oracle Cloud Infrastructure Marketplace Publisher listing revision.""") +@cli_util.help_option_group +def admin_listing_revision_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_artifact_group.command_name', 'admin-artifact'), cls=CommandGroupWithAlias, help="""Base model object for the artifacts.""") +@cli_util.help_option_group +def admin_artifact_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_listing_revision_attachment_group.command_name', 'admin-listing-revision-attachment'), cls=CommandGroupWithAlias, help="""A attachment for the listing revision. User can provide an external URL/upload a file""") +@cli_util.help_option_group +def admin_listing_revision_attachment_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_listing_revision_package_group.command_name', 'admin-listing-revision-package'), cls=CommandGroupWithAlias, help="""A base object for all types of listing revision packages.""") +@cli_util.help_option_group +def admin_listing_revision_package_group(): + pass + + +@click.command(cli_util.override('marketplace_administrator.admin_term_group.command_name', 'admin-term'), cls=CommandGroupWithAlias, help="""Base model object for the admin term.""") +@cli_util.help_option_group +def admin_term_group(): + pass + + +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(marketplace_administrator_root_group) +marketplace_administrator_root_group.add_command(admin_listing_revision_package_collection_group) +marketplace_administrator_root_group.add_command(admin_term_version_group) +marketplace_administrator_root_group.add_command(admin_term_collection_group) +marketplace_administrator_root_group.add_command(admin_work_request_summary_group) +marketplace_administrator_root_group.add_command(admin_listing_revision_attachment_collection_group) +marketplace_administrator_root_group.add_command(admin_listing_group) +marketplace_administrator_root_group.add_command(market_group) +marketplace_administrator_root_group.add_command(admin_publisher_sku_collection_group) +marketplace_administrator_root_group.add_command(admin_artifact_collection_group) +marketplace_administrator_root_group.add_command(admin_term_version_collection_group) +marketplace_administrator_root_group.add_command(admin_listing_revision_collection_group) +marketplace_administrator_root_group.add_command(admin_listing_revision_group) +marketplace_administrator_root_group.add_command(admin_artifact_group) +marketplace_administrator_root_group.add_command(admin_listing_revision_attachment_group) +marketplace_administrator_root_group.add_command(admin_listing_revision_package_group) +marketplace_administrator_root_group.add_command(admin_term_group) + + +@admin_listing_revision_group.command(name=cli_util.override('marketplace_administrator.change_listing_revision_status_to_new.command_name', 'change-listing-revision-status-to-new'), help=u"""Change the Listing Revision status to New \n[Command Reference](changeListingRevisionStatusToNew)""") +@cli_util.option('--listing-revision-id', required=True, help=u"""listing revision""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminListingRevision'}) +@cli_util.wrap_exceptions +def change_listing_revision_status_to_new(ctx, from_json, listing_revision_id, if_match): + + if isinstance(listing_revision_id, six.string_types) and len(listing_revision_id.strip()) == 0: + raise click.UsageError('Parameter --listing-revision-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.change_listing_revision_status_to_new( + listing_revision_id=listing_revision_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@market_group.command(name=cli_util.override('marketplace_administrator.create_market.command_name', 'create'), help=u"""Creates a new Market. \n[Command Reference](createMarket)""") +@cli_util.option('--name', required=True, help=u"""The name of the market.""") +@cli_util.option('--code', required=True, help=u"""The code of the market.""") +@cli_util.option('--category-code', required=True, help=u"""The category code of the market.""") +@cli_util.option('--bill-to-countries', type=custom_types.CLI_COMPLEX_TYPE, help=u"""bill to countries for the market. + +This option is a JSON list with items of type BillToCountry. For documentation on BillToCountry please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/marketplaceadministrator/20241201/datatypes/BillToCountry.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'bill-to-countries': {'module': 'marketplace_publisher', 'class': 'list[BillToCountry]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'bill-to-countries': {'module': 'marketplace_publisher', 'class': 'list[BillToCountry]'}}) +@cli_util.wrap_exceptions +def create_market(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, name, code, category_code, bill_to_countries): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['name'] = name + _details['code'] = code + _details['categoryCode'] = category_code + + if bill_to_countries is not None: + _details['billToCountries'] = cli_util.parse_json_parameter("bill_to_countries", bill_to_countries) + + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.create_market( + create_market_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@admin_artifact_group.command(name=cli_util.override('marketplace_administrator.get_admin_artifact.command_name', 'get'), help=u"""Gets the specified artifact's information. \n[Command Reference](getAdminArtifact)""") +@cli_util.option('--artifact-id', required=True, help=u"""artifact OCID""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminArtifact'}) +@cli_util.wrap_exceptions +def get_admin_artifact(ctx, from_json, artifact_id): + + if isinstance(artifact_id, six.string_types) and len(artifact_id.strip()) == 0: + raise click.UsageError('Parameter --artifact-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.get_admin_artifact( + artifact_id=artifact_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_listing_group.command(name=cli_util.override('marketplace_administrator.get_admin_listing.command_name', 'get'), help=u"""Returns details of the Listing. \n[Command Reference](getAdminListing)""") +@cli_util.option('--listing-id', required=True, help=u"""listing OCID""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminListing'}) +@cli_util.wrap_exceptions +def get_admin_listing(ctx, from_json, listing_id): + + if isinstance(listing_id, six.string_types) and len(listing_id.strip()) == 0: + raise click.UsageError('Parameter --listing-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.get_admin_listing( + listing_id=listing_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_listing_revision_group.command(name=cli_util.override('marketplace_administrator.get_admin_listing_revision.command_name', 'get'), help=u"""Returns details of the Listing revision. \n[Command Reference](getAdminListingRevision)""") +@cli_util.option('--listing-revision-id', required=True, help=u"""listing revision""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminListingRevision'}) +@cli_util.wrap_exceptions +def get_admin_listing_revision(ctx, from_json, listing_revision_id): + + if isinstance(listing_revision_id, six.string_types) and len(listing_revision_id.strip()) == 0: + raise click.UsageError('Parameter --listing-revision-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.get_admin_listing_revision( + listing_revision_id=listing_revision_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_listing_revision_attachment_group.command(name=cli_util.override('marketplace_administrator.get_admin_listing_revision_attachment.command_name', 'get'), help=u"""Get the details of the specified listing revision attachment. \n[Command Reference](getAdminListingRevisionAttachment)""") +@cli_util.option('--listing-revision-attachment-id', required=True, help=u"""attachment OCID""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminListingRevisionAttachment'}) +@cli_util.wrap_exceptions +def get_admin_listing_revision_attachment(ctx, from_json, listing_revision_attachment_id): + + if isinstance(listing_revision_attachment_id, six.string_types) and len(listing_revision_attachment_id.strip()) == 0: + raise click.UsageError('Parameter --listing-revision-attachment-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.get_admin_listing_revision_attachment( + listing_revision_attachment_id=listing_revision_attachment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_listing_revision_package_group.command(name=cli_util.override('marketplace_administrator.get_admin_listing_revision_package.command_name', 'get'), help=u"""Get the details of the specified version of a package. \n[Command Reference](getAdminListingRevisionPackage)""") +@cli_util.option('--listing-revision-package-id', required=True, help=u"""Unique listing revision package identifier.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminListingRevisionPackage'}) +@cli_util.wrap_exceptions +def get_admin_listing_revision_package(ctx, from_json, listing_revision_package_id): + + if isinstance(listing_revision_package_id, six.string_types) and len(listing_revision_package_id.strip()) == 0: + raise click.UsageError('Parameter --listing-revision-package-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.get_admin_listing_revision_package( + listing_revision_package_id=listing_revision_package_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_term_group.command(name=cli_util.override('marketplace_administrator.get_admin_term.command_name', 'get'), help=u"""Gets a Term by identifier \n[Command Reference](getAdminTerm)""") +@cli_util.option('--term-id', required=True, help=u"""term OCID""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminTerm'}) +@cli_util.wrap_exceptions +def get_admin_term(ctx, from_json, term_id): + + if isinstance(term_id, six.string_types) and len(term_id.strip()) == 0: + raise click.UsageError('Parameter --term-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.get_admin_term( + term_id=term_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_term_version_group.command(name=cli_util.override('marketplace_administrator.get_admin_term_version.command_name', 'get'), help=u"""Gets a Term Version by the identifier \n[Command Reference](getAdminTermVersion)""") +@cli_util.option('--term-version-id', required=True, help=u"""term version OCID""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminTermVersion'}) +@cli_util.wrap_exceptions +def get_admin_term_version(ctx, from_json, term_version_id): + + if isinstance(term_version_id, six.string_types) and len(term_version_id.strip()) == 0: + raise click.UsageError('Parameter --term-version-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + result = client.get_admin_term_version( + term_version_id=term_version_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_artifact_collection_group.command(name=cli_util.override('marketplace_administrator.list_admin_artifacts.command_name', 'list-admin-artifacts'), help=u"""Lists the artifacts in your compartment. You must specify your compartment's OCID as the value for the compartment ID. For information about OCIDs, see Resource Identifiers (Content/General/Concepts/identifiers.htm). \n[Command Reference](listAdminArtifacts)""") +@cli_util.option('--compartment-id', help=u"""The unique identifier for the compartment.""") +@cli_util.option('--publisher-id', help=u"""Unique publisher identifier.""") +@cli_util.option('--artifact-type', type=custom_types.CliCaseInsensitiveChoice(["CONTAINER_IMAGE", "HELM_CHART", "MACHINE_IMAGE", "STACK"]), help=u"""A filter to return only artifacts with specific type.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only artifacts with their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["IN_PROGRESS", "AVAILABLE", "UNAVAILABLE"]), help=u"""A filter to return only artifacts with specific status.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "timeUpdated", "displayName"]), help=u"""The field to sort admin artifacts by. The default order for timeCreated and timeUpdated is descending. The default order for displayName is ascending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminArtifactCollection'}) +@cli_util.wrap_exceptions +def list_admin_artifacts(ctx, from_json, all_pages, page_size, compartment_id, publisher_id, artifact_type, lifecycle_state, display_name, status, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if publisher_id is not None: + kwargs['publisher_id'] = publisher_id + if artifact_type is not None: + kwargs['artifact_type'] = artifact_type + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if status is not None: + kwargs['status'] = status + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_admin_artifacts, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_admin_artifacts, + limit, + page_size, + **kwargs + ) + else: + result = client.list_admin_artifacts( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_listing_revision_attachment_collection_group.command(name=cli_util.override('marketplace_administrator.list_admin_listing_revision_attachments.command_name', 'list-admin-listing-revision-attachments'), help=u"""Gets the list of attachments for a listing revision \n[Command Reference](listAdminListingRevisionAttachments)""") +@cli_util.option('--listing-revision-id', required=True, help=u"""OCID of the listing revision.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED"]), help=u"""A filter to return only attachments their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--compartment-id', help=u"""The unique identifier for the compartment.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminListingRevisionAttachmentCollection'}) +@cli_util.wrap_exceptions +def list_admin_listing_revision_attachments(ctx, from_json, all_pages, page_size, listing_revision_id, display_name, lifecycle_state, compartment_id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if display_name is not None: + kwargs['display_name'] = display_name + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_admin_listing_revision_attachments, + listing_revision_id=listing_revision_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_admin_listing_revision_attachments, + limit, + page_size, + listing_revision_id=listing_revision_id, + **kwargs + ) + else: + result = client.list_admin_listing_revision_attachments( + listing_revision_id=listing_revision_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_listing_revision_package_collection_group.command(name=cli_util.override('marketplace_administrator.list_admin_listing_revision_packages.command_name', 'list-admin-listing-revision-packages'), help=u"""Gets the list of packages for a listing revision. \n[Command Reference](listAdminListingRevisionPackages)""") +@cli_util.option('--listing-revision-id', required=True, help=u"""OCID of the listing revision.""") +@cli_util.option('--compartment-id', help=u"""The unique identifier for the compartment.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only packages their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminListingRevisionPackageCollection'}) +@cli_util.wrap_exceptions +def list_admin_listing_revision_packages(ctx, from_json, all_pages, page_size, listing_revision_id, compartment_id, display_name, lifecycle_state, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if display_name is not None: + kwargs['display_name'] = display_name + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_admin_listing_revision_packages, + listing_revision_id=listing_revision_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_admin_listing_revision_packages, + limit, + page_size, + listing_revision_id=listing_revision_id, + **kwargs + ) + else: + result = client.list_admin_listing_revision_packages( + listing_revision_id=listing_revision_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_listing_revision_collection_group.command(name=cli_util.override('marketplace_administrator.list_admin_listing_revisions.command_name', 'list-admin-listing-revisions'), help=u"""Returns a list of all the Listing revisions. \n[Command Reference](listAdminListingRevisions)""") +@cli_util.option('--listing-id', help=u"""listing OCID""") +@cli_util.option('--compartment-id', help=u"""The unique identifier for the compartment.""") +@cli_util.option('--listing-type', type=custom_types.CliCaseInsensitiveChoice(["OCI_APPLICATION", "LEAD_GENERATION", "SERVICE"]), help=u"""A filter to return listings based on their type""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--publisher-id', help=u"""Unique publisher identifier.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only listing revisions their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--listing-revision-status', type=custom_types.CliCaseInsensitiveChoice(["NEW", "PENDING_REVIEW", "REVIEW_IN_PROGRESS", "REJECTED", "APPROVED", "PUBLISH_IN_PROGRESS", "PUBLISH_FAILED", "PUBLISHED", "PUBLISH_AS_PRIVATE_FAILED", "PUBLISHED_AS_PRIVATE", "PUBLISH_AS_PRIVATE_IN_PROGRESS", "UNPUBLISH_IN_PROGRESS", "UNPUBLISHED"]), help=u"""A filter to return only listing revisions their status matches the given listing revision status.""") +@cli_util.option('--status-csv', help=u"""Comma-separated listing revision status values used to filter OpenSearch admin listing revision results.""") +@cli_util.option('--product', help=u"""Product value used to filter OpenSearch admin listing revision results.""") +@cli_util.option('--time-created-after', type=custom_types.CLI_DATETIME, help=u"""Filters data created after the specified date.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-updated-after', type=custom_types.CLI_DATETIME, help=u"""Filters data updated after the specified date.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "timeUpdated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for timeUpdated is descending. Default order for displayName is ascending.""") +@cli_util.option('--pricing-type', help=u"""Optional pricing type filter for listing admin listing revisions. This filter is only applied when dataSource is opensearch.""") +@cli_util.option('--is-private-offer-enabled', type=click.BOOL, help=u"""Optional private offer enabled filter for listing admin listing revisions. This filter is only applied when dataSource is opensearch.""") +@cli_util.option('--data-source', help=u"""Optional source for listing admin listing revisions. Use opensearch to read from OpenSearch.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminListingRevisionCollection'}) +@cli_util.wrap_exceptions +def list_admin_listing_revisions(ctx, from_json, all_pages, page_size, listing_id, compartment_id, listing_type, display_name, publisher_id, lifecycle_state, listing_revision_status, status_csv, product, time_created_after, time_updated_after, limit, page, sort_order, sort_by, pricing_type, is_private_offer_enabled, data_source): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if listing_id is not None: + kwargs['listing_id'] = listing_id + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if listing_type is not None: + kwargs['listing_type'] = listing_type + if display_name is not None: + kwargs['display_name'] = display_name + if publisher_id is not None: + kwargs['publisher_id'] = publisher_id + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if listing_revision_status is not None: + kwargs['listing_revision_status'] = listing_revision_status + if status_csv is not None: + kwargs['status_csv'] = status_csv + if product is not None: + kwargs['product'] = product + if time_created_after is not None: + kwargs['time_created_after'] = time_created_after + if time_updated_after is not None: + kwargs['time_updated_after'] = time_updated_after + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if pricing_type is not None: + kwargs['pricing_type'] = pricing_type + if is_private_offer_enabled is not None: + kwargs['is_private_offer_enabled'] = is_private_offer_enabled + if data_source is not None: + kwargs['data_source'] = data_source + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_admin_listing_revisions, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_admin_listing_revisions, + limit, + page_size, + **kwargs + ) + else: + result = client.list_admin_listing_revisions( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_publisher_sku_collection_group.command(name=cli_util.override('marketplace_administrator.list_admin_publisher_skus.command_name', 'list-admin-publisher-skus'), help=u"""Retrieve a list of publisher SKUs \n[Command Reference](listAdminPublisherSkus)""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminPublisherSkuCollection'}) +@cli_util.wrap_exceptions +def list_admin_publisher_skus(ctx, from_json, all_pages, page_size, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_admin_publisher_skus, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_admin_publisher_skus, + limit, + page_size, + **kwargs + ) + else: + result = client.list_admin_publisher_skus( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_term_version_collection_group.command(name=cli_util.override('marketplace_administrator.list_admin_term_versions.command_name', 'list-admin-term-versions'), help=u"""Returns a list of the publisher term versions. \n[Command Reference](listAdminTermVersions)""") +@cli_util.option('--term-id', required=True, help=u"""term OCID""") +@cli_util.option('--compartment-id', help=u"""The unique identifier for the compartment.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminTermVersionCollection'}) +@cli_util.wrap_exceptions +def list_admin_term_versions(ctx, from_json, all_pages, page_size, term_id, compartment_id, limit, page, sort_order, sort_by, display_name): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if display_name is not None: + kwargs['display_name'] = display_name + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_admin_term_versions, + term_id=term_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_admin_term_versions, + limit, + page_size, + term_id=term_id, + **kwargs + ) + else: + result = client.list_admin_term_versions( + term_id=term_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_term_collection_group.command(name=cli_util.override('marketplace_administrator.list_admin_terms.command_name', 'list-admin-terms'), help=u"""Returns a list of the publisher terms. \n[Command Reference](listAdminTerms)""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--compartment-id', help=u"""The unique identifier for the compartment.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--name', help=u"""A filter to return only resources that match the entire name given.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminTermCollection'}) +@cli_util.wrap_exceptions +def list_admin_terms(ctx, from_json, all_pages, page_size, limit, page, compartment_id, sort_order, sort_by, name): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if name is not None: + kwargs['name'] = name + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_admin_terms, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_admin_terms, + limit, + page_size, + **kwargs + ) + else: + result = client.list_admin_terms( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@admin_work_request_summary_group.command(name=cli_util.override('marketplace_administrator.list_admin_work_requests.command_name', 'list-admin-work-requests'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listAdminWorkRequests)""") +@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--work-request-id', help=u"""The ID of the asynchronous work request.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help=u"""A filter to return only resources their lifecycleState matches the given OperationStatus.""") +@cli_util.option('--resource-id', help=u"""The ID of the resource affected by the work request.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeAccepted is descending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'AdminWorkRequestSummaryCollection'}) +@cli_util.wrap_exceptions +def list_admin_work_requests(ctx, from_json, all_pages, page_size, compartment_id, work_request_id, status, resource_id, page, limit, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if work_request_id is not None: + kwargs['work_request_id'] = work_request_id + if status is not None: + kwargs['status'] = status + if resource_id is not None: + kwargs['resource_id'] = resource_id + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_administrator', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_admin_work_requests, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_admin_work_requests, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_admin_work_requests( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) diff --git a/services/marketplace_publisher/src/oci_cli_marketplace_publisher/generated/marketplace_publisher_service_cli.py b/services/marketplace_publisher/src/oci_cli_marketplace_publisher/generated/marketplace_publisher_service_cli.py new file mode 100644 index 000000000..594242a28 --- /dev/null +++ b/services/marketplace_publisher/src/oci_cli_marketplace_publisher/generated/marketplace_publisher_service_cli.py @@ -0,0 +1,14 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20241201 + +from oci_cli.cli_root import cli +from oci_cli import cli_util +from oci_cli.aliasing import CommandGroupWithAlias + + +@cli.command(cli_util.override('marketplace_publisher.marketplace_publisher_service_group.command_name', 'marketplace-publisher'), cls=CommandGroupWithAlias, help=cli_util.override('marketplace_publisher.marketplace_publisher_service_group.help', """Use the Marketplace Publisher API to manage the publishing of applications in Oracle Cloud Infrastructure Marketplace."""), short_help=cli_util.override('marketplace_publisher.marketplace_publisher_service_group.short_help', """MarketplacePublisherService API""")) +@cli_util.help_option_group +def marketplace_publisher_service_group(): + pass diff --git a/services/marketplace_publisher/src/oci_cli_marketplace_publisher/generated/marketplacepublisher_cli.py b/services/marketplace_publisher/src/oci_cli_marketplace_publisher/generated/marketplacepublisher_cli.py index d8d721f17..aebbf6c5e 100644 --- a/services/marketplace_publisher/src/oci_cli_marketplace_publisher/generated/marketplacepublisher_cli.py +++ b/services/marketplace_publisher/src/oci_cli_marketplace_publisher/generated/marketplacepublisher_cli.py @@ -8,15 +8,15 @@ import oci # noqa: F401 import six # noqa: F401 import sys # noqa: F401 -from oci_cli.cli_root import cli from oci_cli import cli_constants # noqa: F401 from oci_cli import cli_util from oci_cli import json_skeleton_utils from oci_cli import custom_types # noqa: F401 from oci_cli.aliasing import CommandGroupWithAlias +from services.marketplace_publisher.src.oci_cli_marketplace_publisher.generated import marketplace_publisher_service_cli -@cli.command(cli_util.override('marketplace_publisher.marketplace_publisher_root_group.command_name', 'marketplace-publisher'), cls=CommandGroupWithAlias, help=cli_util.override('marketplace_publisher.marketplace_publisher_root_group.help', """Use the Marketplace Publisher API to manage the publishing of applications in Oracle Cloud Infrastructure Marketplace."""), short_help=cli_util.override('marketplace_publisher.marketplace_publisher_root_group.short_help', """MarketplacePublisherService API""")) +@click.command(cli_util.override('marketplace_publisher.marketplace_publisher_root_group.command_name', 'marketplace-publisher'), cls=CommandGroupWithAlias, help=cli_util.override('marketplace_publisher.marketplace_publisher_root_group.help', """Use the Marketplace Publisher API to manage the publishing of applications in Oracle Cloud Infrastructure Marketplace."""), short_help=cli_util.override('marketplace_publisher.marketplace_publisher_root_group.short_help', """MarketplacePublisherService API""")) @cli_util.help_option_group def marketplace_publisher_root_group(): pass @@ -100,6 +100,12 @@ def term_group(): pass +@click.command(cli_util.override('marketplace_publisher.customer_instance_report_export_collection_group.command_name', 'customer-instance-report-export-collection'), cls=CommandGroupWithAlias, help="""Customer Instance Report export collection.""") +@cli_util.help_option_group +def customer_instance_report_export_collection_group(): + pass + + @click.command(cli_util.override('marketplace_publisher.listing_group.command_name', 'listing'), cls=CommandGroupWithAlias, help="""The model for the Marketplace Publisher listing.""") @cli_util.help_option_group def listing_group(): @@ -130,6 +136,12 @@ def customer_instance_report_record_collection_group(): pass +@click.command(cli_util.override('marketplace_publisher.customer_instance_report_export_group.command_name', 'customer-instance-report-export'), cls=CommandGroupWithAlias, help="""The model for a Customer Instance Report export.""") +@cli_util.help_option_group +def customer_instance_report_export_group(): + pass + + @click.command(cli_util.override('marketplace_publisher.product_group.command_name', 'product'), cls=CommandGroupWithAlias, help="""The model for the product details.""") @cli_util.help_option_group def product_group(): @@ -238,6 +250,7 @@ def listing_revision_package_group(): pass +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(marketplace_publisher_root_group) marketplace_publisher_root_group.add_command(market_collection_group) marketplace_publisher_root_group.add_command(listing_collection_group) marketplace_publisher_root_group.add_command(work_request_group) @@ -251,11 +264,13 @@ def listing_revision_package_group(): marketplace_publisher_root_group.add_command(work_request_error_group) marketplace_publisher_root_group.add_command(supported_currency_collection_group) marketplace_publisher_root_group.add_command(term_group) +marketplace_publisher_root_group.add_command(customer_instance_report_export_collection_group) marketplace_publisher_root_group.add_command(listing_group) marketplace_publisher_root_group.add_command(listing_revision_note_collection_group) marketplace_publisher_root_group.add_command(listing_revision_note_group) marketplace_publisher_root_group.add_command(supported_shape_collection_group) marketplace_publisher_root_group.add_command(customer_instance_report_record_collection_group) +marketplace_publisher_root_group.add_command(customer_instance_report_export_group) marketplace_publisher_root_group.add_command(product_group) marketplace_publisher_root_group.add_command(support_doc_group) marketplace_publisher_root_group.add_command(listing_revision_group) @@ -274,6 +289,46 @@ def listing_revision_package_group(): marketplace_publisher_root_group.add_command(category_collection_group) marketplace_publisher_root_group.add_command(category_group) marketplace_publisher_root_group.add_command(listing_revision_package_group) +# oci marketplace_publisher marketplace_publisher --> oci marketplace_publisher +marketplace_publisher_service_cli.marketplace_publisher_service_group.commands.pop(marketplace_publisher_root_group.name) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(market_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(work_request_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(support_doc_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(lead_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(publisher_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(artifact_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(term_version_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(disbursement_report_record_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_revision_attachment_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(work_request_error_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(supported_currency_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(term_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(customer_instance_report_export_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_revision_note_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_revision_note_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(supported_shape_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(customer_instance_report_record_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(customer_instance_report_export_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(product_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(support_doc_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_revision_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(product_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(work_request_log_entry_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(term_version_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(term_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(artifact_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(lead_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(market_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_revision_package_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(available_service_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_revision_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_revision_attachment_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(publisher_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(category_collection_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(category_group) +marketplace_publisher_service_cli.marketplace_publisher_service_group.add_command(listing_revision_package_group) @term_version_group.command(name=cli_util.override('marketplace_publisher.activate_term_version.command_name', 'activate'), help=u"""Mark the Term Version identified by the id as active \n[Command Reference](activateTermVersion)""") @@ -1147,7 +1202,7 @@ def create_artifact_create_machine_image_artifact_details(ctx, from_json, wait_f You must also specify a *name* for the listing and cannot be updated later. -You must also specify a *packageType* for the listing. Allowed values are CONTAINER_IMAGE and HELM_CHART +You must also specify a *packageType* for the listing. Allowed values are CONTAINER_IMAGE, HELM_CHART, COMPUTE_IMAGE, TERRAFORM_STACK and SAAS After you send your request, the new object's `lifecycleState` will be CREATING. Before using the object, first make sure its `lifecycleState` has changed to ACTIVE. \n[Command Reference](createListing)""") @cli_util.option('--compartment-id', required=True, help=u"""The unique identifier for the compartment.""") @@ -1352,10 +1407,14 @@ def create_listing_revision(ctx, from_json, wait_for_state, max_wait_seconds, wa @cli_util.option('--pricing-plans', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Pricing Plans provider by publisher. This option is a JSON list with items of type PricingPlan. For documentation on PricingPlan please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/marketplacepublisher/20241201/datatypes/PricingPlan.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--partner-registration-url', help=u"""The url provided by partner for the registration of subscription.""") +@cli_util.option('--term-id', help=u"""The unique id of the term attached to the listing.""") @cli_util.option('--vanity-url', help=u"""Custom link to the listing""") @cli_util.option('--recommended-service-provider-listing-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""OCIDs of service listings attached to lead gen listing""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--availability-and-pricing-policy', help=u"""Listing availability and Pricing Policy statement.""") @cli_util.option('--is-rover-exportable', type=click.BOOL, help=u"""Is this listing rover exportable""") +@cli_util.option('--demo-url', help=u"""Url to demo of the listing""") +@cli_util.option('--self-paced-training-url', help=u"""Url to training resources of the listing""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -1364,7 +1423,7 @@ def create_listing_revision(ctx, from_json, wait_for_state, max_wait_seconds, wa @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'content-language': {'module': 'marketplace_publisher', 'class': 'LanguageItem'}, 'supportedlanguages': {'module': 'marketplace_publisher', 'class': 'list[LanguageItem]'}, 'support-contacts': {'module': 'marketplace_publisher', 'class': 'list[SupportContact]'}, 'support-links': {'module': 'marketplace_publisher', 'class': 'list[NamedLink]'}, 'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}, 'version-details': {'module': 'marketplace_publisher', 'class': 'VersionDetails'}, 'products': {'module': 'marketplace_publisher', 'class': 'list[ListingProduct]'}, 'pricing-plans': {'module': 'marketplace_publisher', 'class': 'list[PricingPlan]'}, 'recommended-service-provider-listing-ids': {'module': 'marketplace_publisher', 'class': 'list[string]'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevision'}) @cli_util.wrap_exceptions -def create_listing_revision_create_oci_listing_revision_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_id, headline, pricing_type, products, display_name, tagline, keywords, short_description, usage_information, long_description, content_language, supportedlanguages, support_contacts, support_links, status, freeform_tags, defined_tags, version_details, system_requirements, pricing_plans, vanity_url, recommended_service_provider_listing_ids, availability_and_pricing_policy, is_rover_exportable): +def create_listing_revision_create_oci_listing_revision_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_id, headline, pricing_type, products, display_name, tagline, keywords, short_description, usage_information, long_description, content_language, supportedlanguages, support_contacts, support_links, status, freeform_tags, defined_tags, version_details, system_requirements, pricing_plans, partner_registration_url, term_id, vanity_url, recommended_service_provider_listing_ids, availability_and_pricing_policy, is_rover_exportable, demo_url, self_paced_training_url): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1423,6 +1482,12 @@ def create_listing_revision_create_oci_listing_revision_details(ctx, from_json, if pricing_plans is not None: _details['pricingPlans'] = cli_util.parse_json_parameter("pricing_plans", pricing_plans) + if partner_registration_url is not None: + _details['partnerRegistrationUrl'] = partner_registration_url + + if term_id is not None: + _details['termId'] = term_id + if vanity_url is not None: _details['vanityUrl'] = vanity_url @@ -1435,6 +1500,12 @@ def create_listing_revision_create_oci_listing_revision_details(ctx, from_json, if is_rover_exportable is not None: _details['isRoverExportable'] = is_rover_exportable + if demo_url is not None: + _details['demoUrl'] = demo_url + + if self_paced_training_url is not None: + _details['selfPacedTrainingUrl'] = self_paced_training_url + _details['listingType'] = 'OCI_APPLICATION' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -1826,6 +1897,7 @@ def create_listing_revision_attachment(ctx, from_json, wait_for_state, max_wait_ @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--url', help=u"""Optional url to service information""") +@cli_util.option('--source-type', help=u"""The specified attachment type is Internal or External.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -1834,7 +1906,7 @@ def create_listing_revision_attachment(ctx, from_json, wait_for_state, max_wait_ @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevisionAttachment'}) @cli_util.wrap_exceptions -def create_listing_revision_attachment_create_supported_service_attachment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, service_name, type, display_name, description, freeform_tags, defined_tags, url): +def create_listing_revision_attachment_create_supported_service_attachment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, service_name, type, display_name, description, freeform_tags, defined_tags, url, source_type): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1859,6 +1931,9 @@ def create_listing_revision_attachment_create_supported_service_attachment(ctx, if url is not None: _details['url'] = url + if source_type is not None: + _details['sourceType'] = source_type + _details['attachmentType'] = 'SUPPORTED_SERVICES' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -1898,6 +1973,7 @@ def create_listing_revision_attachment_create_supported_service_attachment(ctx, @cli_util.option('--description', help=u"""Description for this specified attachment.""") @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-type', help=u"""The specified attachment type is Internal or External.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -1906,7 +1982,7 @@ def create_listing_revision_attachment_create_supported_service_attachment(ctx, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevisionAttachment'}) @cli_util.wrap_exceptions -def create_listing_revision_attachment_create_screen_shot_attachment_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, display_name, description, freeform_tags, defined_tags): +def create_listing_revision_attachment_create_screen_shot_attachment_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, display_name, description, freeform_tags, defined_tags, source_type): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1926,6 +2002,9 @@ def create_listing_revision_attachment_create_screen_shot_attachment_details(ctx if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if source_type is not None: + _details['sourceType'] = source_type + _details['attachmentType'] = 'SCREENSHOT' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -1968,6 +2047,7 @@ def create_listing_revision_attachment_create_screen_shot_attachment_details(ctx @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--url', help=u"""Optional url to success story""") @cli_util.option('--product-codes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of product codes for success story""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-type', help=u"""The specified attachment type is Internal or External.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -1976,7 +2056,7 @@ def create_listing_revision_attachment_create_screen_shot_attachment_details(ctx @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}, 'product-codes': {'module': 'marketplace_publisher', 'class': 'list[string]'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevisionAttachment'}) @cli_util.wrap_exceptions -def create_listing_revision_attachment_create_customer_success_attachment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, customer_name, display_name, description, freeform_tags, defined_tags, url, product_codes): +def create_listing_revision_attachment_create_customer_success_attachment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, customer_name, display_name, description, freeform_tags, defined_tags, url, product_codes, source_type): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2003,6 +2083,9 @@ def create_listing_revision_attachment_create_customer_success_attachment(ctx, f if product_codes is not None: _details['productCodes'] = cli_util.parse_json_parameter("product_codes", product_codes) + if source_type is not None: + _details['sourceType'] = source_type + _details['attachmentType'] = 'CUSTOMER_SUCCESS' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -2044,6 +2127,7 @@ def create_listing_revision_attachment_create_customer_success_attachment(ctx, f @cli_util.option('--description', help=u"""Description for this specified attachment.""") @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-type', help=u"""The specified attachment type is Internal or External.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -2052,7 +2136,7 @@ def create_listing_revision_attachment_create_customer_success_attachment(ctx, f @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevisionAttachment'}) @cli_util.wrap_exceptions -def create_listing_revision_attachment_create_review_support_document_attachment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, document_name, template_code, display_name, description, freeform_tags, defined_tags): +def create_listing_revision_attachment_create_review_support_document_attachment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, document_name, template_code, display_name, description, freeform_tags, defined_tags, source_type): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2074,6 +2158,9 @@ def create_listing_revision_attachment_create_review_support_document_attachment if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if source_type is not None: + _details['sourceType'] = source_type + _details['attachmentType'] = 'REVIEW_SUPPORT_DOCUMENT' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -2183,6 +2270,9 @@ def create_listing_revision_attachment_create_video_attachment_details(ctx, from @cli_util.option('--description', help=u"""Description for this specified attachment.""") @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-url', help=u"""The document URL of the listing revision attachment.""") +@cli_util.option('--source-type', help=u"""The specified attachment type is Internal or External.""") +@cli_util.option('--is-oracle-users-only', type=click.BOOL, help=u"""Identifies whether the attachment is for Internal Oracle Users or external users as well.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED 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.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -2191,7 +2281,7 @@ def create_listing_revision_attachment_create_video_attachment_details(ctx, from @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevisionAttachment'}) @cli_util.wrap_exceptions -def create_listing_revision_attachment_create_related_document_attachment_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, document_category, display_name, description, freeform_tags, defined_tags): +def create_listing_revision_attachment_create_related_document_attachment_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, document_category, display_name, description, freeform_tags, defined_tags, source_url, source_type, is_oracle_users_only): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2212,6 +2302,15 @@ def create_listing_revision_attachment_create_related_document_attachment_detail if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if source_url is not None: + _details['sourceUrl'] = source_url + + if source_type is not None: + _details['sourceType'] = source_type + + if is_oracle_users_only is not None: + _details['isOracleUsersOnly'] = is_oracle_users_only + _details['attachmentType'] = 'RELATED_DOCUMENT' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -2381,6 +2480,59 @@ def create_listing_revision_package(ctx, from_json, wait_for_state, max_wait_sec cli_util.render_response(result, ctx) +@publisher_group.command(name=cli_util.override('marketplace_publisher.create_publisher.command_name', 'create'), help=u"""Creates a new publisher \n[Command Reference](createPublisher)""") +@cli_util.option('--email', required=True, help=u"""Email address of the publisher.""") +@cli_util.option('--business-phone-number', required=True, help=u"""The business phone number of the publisher.""") +@cli_util.option('--company-name', required=True, help=u"""The company name of the publisher.""") +@cli_util.option('--company-description', required=True, help=u"""The company name of the publisher.""") +@cli_util.option('--employee-count', required=True, type=click.INT, help=u"""Count of employees in publisher's company""") +@cli_util.option('--opn-number', required=True, help=u"""OPN membership number of the publisher""") +@cli_util.option('--year-founded', required=True, type=click.INT, help=u"""The year the publisher's company or organization was founded.""") +@cli_util.option('--city', required=True, help=u"""City""") +@cli_util.option('--state', required=True, help=u"""State""") +@cli_util.option('--country', required=True, help=u"""Country""") +@cli_util.option('--website', required=True, help=u"""The publisher's website.""") +@cli_util.option('--contact-phone-number', required=True, help=u"""The contact phone number of the publisher.""") +@cli_util.option('--contact-email', required=True, help=u"""The contact email address of the publisher.""") +@cli_util.option('--compartment-id', required=True, help=u"""The tenancy(compartment) OCID of the publisher.""") +@cli_util.option('--solution-description', help=u"""A description of the publisher solutions.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'Publisher'}) +@cli_util.wrap_exceptions +def create_publisher(ctx, from_json, email, business_phone_number, company_name, company_description, employee_count, opn_number, year_founded, city, state, country, website, contact_phone_number, contact_email, compartment_id, solution_description): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['email'] = email + _details['businessPhoneNumber'] = business_phone_number + _details['companyName'] = company_name + _details['companyDescription'] = company_description + _details['employeeCount'] = employee_count + _details['opnNumber'] = opn_number + _details['yearFounded'] = year_founded + _details['city'] = city + _details['state'] = state + _details['country'] = country + _details['website'] = website + _details['contactPhoneNumber'] = contact_phone_number + _details['contactEmail'] = contact_email + _details['compartmentId'] = compartment_id + + if solution_description is not None: + _details['solutionDescription'] = solution_description + + client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) + result = client.create_publisher( + create_publisher_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + @term_group.command(name=cli_util.override('marketplace_publisher.create_term.command_name', 'create'), help=u"""Creates a new Term. \n[Command Reference](createTerm)""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the publisher's compartment.""") @cli_util.option('--name', required=True, help=u"""The name of the term.""") @@ -2550,6 +2702,70 @@ def delete_artifact(ctx, from_json, wait_for_state, max_wait_seconds, wait_inter cli_util.render_response(result, ctx) +@customer_instance_report_export_group.command(name=cli_util.override('marketplace_publisher.delete_customer_instance_report_export.command_name', 'delete'), help=u"""Deletes a generated Customer Instance Report export. \n[Command Reference](deleteCustomerInstanceReportExport)""") +@cli_util.option('--customer-instance-report-export-id', required=True, help=u"""Customer Instance Report export identifier.""") +@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.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["IN_PROGRESS", "ACCEPTED", "FAILED", "NEEDS_ATTENTION", "SUCCEEDED", "CANCELED", "WAITING", "CANCELING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state IN_PROGRESS --wait-for-state CANCELING 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.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_customer_instance_report_export(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, customer_instance_report_export_id, if_match): + + if isinstance(customer_instance_report_export_id, six.string_types) and len(customer_instance_report_export_id.strip()) == 0: + raise click.UsageError('Parameter --customer-instance-report-export-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) + result = client.delete_customer_instance_report_export( + customer_instance_report_export_id=customer_instance_report_export_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_customer_instance_report_export') and callable(getattr(client, 'get_customer_instance_report_export')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + oci.wait_until(client, client.get_customer_instance_report_export(customer_instance_report_export_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs) + except oci.exceptions.ServiceError as e: + # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the + # outcome of a delete operation it is possible that the resource is already gone and so the initial service call + # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising + # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument + # succeed_on_not_found=True to the waiter). + # + # Any non-404 should still result in the exception being thrown. + if e.status == 404: + pass + else: + raise + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @listing_group.command(name=cli_util.override('marketplace_publisher.delete_listing.command_name', 'delete'), help=u"""Deletes a listing by the identifier \n[Command Reference](deleteListing)""") @cli_util.option('--listing-id', required=True, help=u"""listing OCID""") @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.""") @@ -2998,6 +3214,119 @@ def delete_term_version(ctx, from_json, wait_for_state, max_wait_seconds, wait_i cli_util.render_response(result, ctx) +@customer_instance_report_export_group.command(name=cli_util.override('marketplace_publisher.generate_customer_instance_report_export.command_name', 'generate'), help=u"""Generates a new asynchronous Customer Instance Report export for the selected filters. \n[Command Reference](generateCustomerInstanceReportExport)""") +@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment for the export.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order for the generated export.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["INSTANCE_ID"]), help=u"""The field to sort by.""") +@cli_util.option('--name', help=u"""A filter to return only report records that match the listing name.""") +@cli_util.option('--listing-id', help=u"""A filter to return only report records that match the listing OCID.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["PROVISIONING", "RUNNING", "STOPPED", "TERMINATING", "TERMINATED", "DISABLED", "STARTING", "STOPPING", "SNAPSHOTTING"]), help=u"""A filter to return only report records that match the instance status.""") +@cli_util.option('--shape', help=u"""A filter to return only report records that match the instance shape.""") +@cli_util.option('--region-parameterconflict', help=u"""A filter to return only report records that match the instance region.""") +@cli_util.option('--realm', help=u"""A filter to return only report records that match the instance realm.""") +@cli_util.option('--tenant-admin-domain', help=u"""A filter to return only report records that match the tenant administrator email domain.""") +@cli_util.option('--package-version', help=u"""A filter to return only report records that match the package version.""") +@cli_util.option('--instance-id', help=u"""A filter to return only report records that match the instance OCID.""") +@cli_util.option('--time-instance-creation-from-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive earliest instance creation time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-creation-to-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive latest instance creation time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-termination-from-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive earliest instance termination time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-termination-to-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive latest instance termination time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "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 ACCEPTED --wait-for-state CANCELED 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.""") +@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.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def generate_customer_instance_report_export(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, sort_order, sort_by, name, listing_id, status, shape, region_parameterconflict, realm, tenant_admin_domain, package_version, instance_id, time_instance_creation_from_date, time_instance_creation_to_date, time_instance_termination_from_date, time_instance_termination_to_date): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + + if sort_order is not None: + _details['sortOrder'] = sort_order + + if sort_by is not None: + _details['sortBy'] = sort_by + + if name is not None: + _details['name'] = name + + if listing_id is not None: + _details['listingId'] = listing_id + + if status is not None: + _details['status'] = status + + if shape is not None: + _details['shape'] = shape + + if region_parameterconflict is not None: + _details['region'] = region_parameterconflict + + if realm is not None: + _details['realm'] = realm + + if tenant_admin_domain is not None: + _details['tenantAdminDomain'] = tenant_admin_domain + + if package_version is not None: + _details['packageVersion'] = package_version + + if instance_id is not None: + _details['instanceId'] = instance_id + + if time_instance_creation_from_date is not None: + _details['timeInstanceCreationFromDate'] = time_instance_creation_from_date + + if time_instance_creation_to_date is not None: + _details['timeInstanceCreationToDate'] = time_instance_creation_to_date + + if time_instance_termination_from_date is not None: + _details['timeInstanceTerminationFromDate'] = time_instance_termination_from_date + + if time_instance_termination_to_date is not None: + _details['timeInstanceTerminationToDate'] = time_instance_termination_to_date + + client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) + result = client.generate_customer_instance_report_export( + generate_customer_instance_report_export_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @artifact_group.command(name=cli_util.override('marketplace_publisher.get_artifact.command_name', 'get'), help=u"""Gets the specified artifact's information. \n[Command Reference](getArtifact)""") @cli_util.option('--artifact-id', required=True, help=u"""artifact OCID""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -3044,6 +3373,50 @@ def get_category(ctx, from_json, category_code, compartment_id): cli_util.render_response(result, ctx) +@customer_instance_report_export_group.command(name=cli_util.override('marketplace_publisher.get_customer_instance_report_export.command_name', 'get'), help=u"""Gets details for a specific Customer Instance Report export. \n[Command Reference](getCustomerInstanceReportExport)""") +@cli_util.option('--customer-instance-report-export-id', required=True, help=u"""Customer Instance Report export identifier.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'CustomerInstanceReportExport'}) +@cli_util.wrap_exceptions +def get_customer_instance_report_export(ctx, from_json, customer_instance_report_export_id): + + if isinstance(customer_instance_report_export_id, six.string_types) and len(customer_instance_report_export_id.strip()) == 0: + raise click.UsageError('Parameter --customer-instance-report-export-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) + result = client.get_customer_instance_report_export( + customer_instance_report_export_id=customer_instance_report_export_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@customer_instance_report_export_group.command(name=cli_util.override('marketplace_publisher.get_customer_instance_report_export_content.command_name', 'get-customer-instance-report-export-content'), help=u"""Downloads the generated Customer Instance Report CSV for the specified export. \n[Command Reference](getCustomerInstanceReportExportContent)""") +@cli_util.option('--customer-instance-report-export-id', required=True, help=u"""Customer Instance Report export identifier.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def get_customer_instance_report_export_content(ctx, from_json, customer_instance_report_export_id): + + if isinstance(customer_instance_report_export_id, six.string_types) and len(customer_instance_report_export_id.strip()) == 0: + raise click.UsageError('Parameter --customer-instance-report-export-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) + result = client.get_customer_instance_report_export_content( + customer_instance_report_export_id=customer_instance_report_export_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @lead_group.command(name=cli_util.override('marketplace_publisher.get_lead.command_name', 'get'), help=u"""Gets the details for a lead. \n[Command Reference](getLead)""") @cli_util.option('--lead-id', required=True, help=u"""Lead ID""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -3690,14 +4063,118 @@ def list_categories(ctx, from_json, all_pages, page_size, compartment_id, limit, cli_util.render_response(result, ctx) +@customer_instance_report_export_collection_group.command(name=cli_util.override('marketplace_publisher.list_customer_instance_report_exports.command_name', 'list-customer-instance-report-exports'), help=u"""Lists existing Customer Instance Report exports for the caller. \n[Command Reference](listCustomerInstanceReportExports)""") +@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "fileName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for fileName is ascending.""") +@cli_util.option('--name', help=u"""A filter to return only resources that match the entire name given.""") +@cli_util.option('--listing-id', help=u"""Listing OCID to query resource against.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["PROVISIONING", "RUNNING", "STOPPED", "TERMINATING", "TERMINATED", "DISABLED", "STARTING", "STOPPING", "SNAPSHOTTING"]), help=u"""A filter to return only report records that match the instance status.""") +@cli_util.option('--shape', help=u"""A filter to return only report records that match the instance shape.""") +@cli_util.option('--region-parameterconflict', help=u"""A filter to return only report records that match the instance region.""") +@cli_util.option('--realm', help=u"""A filter to return only report records that match the instance realm.""") +@cli_util.option('--tenant-admin-domain', help=u"""A filter to return only report records that match the tenant administrator domain.""") +@cli_util.option('--package-version', help=u"""A filter to return only report records that match the package version.""") +@cli_util.option('--instance-ocid', help=u"""A filter to return only report records that match the instance OCID.""") +@cli_util.option('--time-instance-creation-from-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive earliest instance creation time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-creation-to-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive latest instance creation time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-termination-from-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive earliest instance termination time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-termination-to-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive latest instance termination time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'CustomerInstanceReportExportCollection'}) +@cli_util.wrap_exceptions +def list_customer_instance_report_exports(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_order, sort_by, name, listing_id, status, shape, region_parameterconflict, realm, tenant_admin_domain, package_version, instance_ocid, time_instance_creation_from_date, time_instance_creation_to_date, time_instance_termination_from_date, time_instance_termination_to_date): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if name is not None: + kwargs['name'] = name + if listing_id is not None: + kwargs['listing_id'] = listing_id + if status is not None: + kwargs['status'] = status + if shape is not None: + kwargs['shape'] = shape + if region_parameterconflict is not None: + kwargs['region'] = region_parameterconflict + if realm is not None: + kwargs['realm'] = realm + if tenant_admin_domain is not None: + kwargs['tenant_admin_domain'] = tenant_admin_domain + if package_version is not None: + kwargs['package_version'] = package_version + if instance_ocid is not None: + kwargs['instance_ocid'] = instance_ocid + if time_instance_creation_from_date is not None: + kwargs['time_instance_creation_from_date'] = time_instance_creation_from_date + if time_instance_creation_to_date is not None: + kwargs['time_instance_creation_to_date'] = time_instance_creation_to_date + if time_instance_termination_from_date is not None: + kwargs['time_instance_termination_from_date'] = time_instance_termination_from_date + if time_instance_termination_to_date is not None: + kwargs['time_instance_termination_to_date'] = time_instance_termination_to_date + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_customer_instance_report_exports, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_customer_instance_report_exports, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_customer_instance_report_exports( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @customer_instance_report_record_collection_group.command(name=cli_util.override('marketplace_publisher.list_customer_instance_report_records.command_name', 'list-customer-instance-report-records'), help=u"""List customer instance report records \n[Command Reference](listCustomerInstanceReportRecords)""") @cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") -@cli_util.option('--date-range', required=True, type=custom_types.CliCaseInsensitiveChoice(["THIS_WEEK", "LAST_WEEK", "THIS_MONTH", "LAST_MONTH", "LAST_THREE_MONTHS"]), help=u"""The date range of the report""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["INSTANCE_ID"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for instance_id is ascending.""") @cli_util.option('--name', help=u"""A filter to return only resources that match the entire name given.""") +@cli_util.option('--listing-id', help=u"""Listing OCID to query resource against.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["PROVISIONING", "RUNNING", "STOPPED", "TERMINATING", "TERMINATED", "DISABLED", "STARTING", "STOPPING", "SNAPSHOTTING"]), help=u"""A filter to return only report records that match the instance status.""") +@cli_util.option('--shape', help=u"""A filter to return only report records that match the instance shape.""") +@cli_util.option('--region-parameterconflict', help=u"""A filter to return only report records that match the instance region.""") +@cli_util.option('--realm', help=u"""A filter to return only report records that match the instance realm.""") +@cli_util.option('--tenant-admin-domain', help=u"""A filter to return only report records that match the tenant administrator domain.""") +@cli_util.option('--package-version', help=u"""A filter to return only report records that match the package version.""") +@cli_util.option('--instance-ocid', help=u"""A filter to return only report records that match the instance OCID.""") +@cli_util.option('--time-instance-creation-from-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive earliest instance creation time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-creation-to-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive latest instance creation time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-termination-from-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive earliest instance termination time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-instance-termination-to-date', type=custom_types.CLI_DATETIME, help=u"""The inclusive latest instance termination time, in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -3705,7 +4182,7 @@ def list_categories(ctx, from_json, all_pages, page_size, compartment_id, limit, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'CustomerInstanceReportRecordCollection'}) @cli_util.wrap_exceptions -def list_customer_instance_report_records(ctx, from_json, all_pages, page_size, compartment_id, date_range, limit, page, sort_order, sort_by, name): +def list_customer_instance_report_records(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_order, sort_by, name, listing_id, status, shape, region_parameterconflict, realm, tenant_admin_domain, package_version, instance_ocid, time_instance_creation_from_date, time_instance_creation_to_date, time_instance_termination_from_date, time_instance_termination_to_date): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') @@ -3721,6 +4198,30 @@ def list_customer_instance_report_records(ctx, from_json, all_pages, page_size, kwargs['sort_by'] = sort_by if name is not None: kwargs['name'] = name + if listing_id is not None: + kwargs['listing_id'] = listing_id + if status is not None: + kwargs['status'] = status + if shape is not None: + kwargs['shape'] = shape + if region_parameterconflict is not None: + kwargs['region'] = region_parameterconflict + if realm is not None: + kwargs['realm'] = realm + if tenant_admin_domain is not None: + kwargs['tenant_admin_domain'] = tenant_admin_domain + if package_version is not None: + kwargs['package_version'] = package_version + if instance_ocid is not None: + kwargs['instance_ocid'] = instance_ocid + if time_instance_creation_from_date is not None: + kwargs['time_instance_creation_from_date'] = time_instance_creation_from_date + if time_instance_creation_to_date is not None: + kwargs['time_instance_creation_to_date'] = time_instance_creation_to_date + if time_instance_termination_from_date is not None: + kwargs['time_instance_termination_from_date'] = time_instance_termination_from_date + if time_instance_termination_to_date is not None: + kwargs['time_instance_termination_to_date'] = time_instance_termination_to_date kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) if all_pages: @@ -3730,7 +4231,6 @@ def list_customer_instance_report_records(ctx, from_json, all_pages, page_size, result = cli_util.list_call_get_all_results( client.list_customer_instance_report_records, compartment_id=compartment_id, - date_range=date_range, **kwargs ) elif limit is not None: @@ -3739,13 +4239,11 @@ def list_customer_instance_report_records(ctx, from_json, all_pages, page_size, limit, page_size, compartment_id=compartment_id, - date_range=date_range, **kwargs ) else: result = client.list_customer_instance_report_records( compartment_id=compartment_id, - date_range=date_range, **kwargs ) cli_util.render_response(result, ctx) @@ -3753,7 +4251,7 @@ def list_customer_instance_report_records(ctx, from_json, all_pages, page_size, @disbursement_report_record_collection_group.command(name=cli_util.override('marketplace_publisher.list_disbursement_report_records.command_name', 'list-disbursement-report-records'), help=u"""List disbursement report records \n[Command Reference](listDisbursementReportRecords)""") @cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") -@cli_util.option('--date-range', required=True, type=custom_types.CliCaseInsensitiveChoice(["LAST_MONTH", "LAST_THREE_MONTHS"]), help=u"""The date range of the report""") +@cli_util.option('--date-range', required=True, type=custom_types.CliCaseInsensitiveChoice(["LAST_MONTH", "LAST_THREE_MONTHS", "LAST_SIX_MONTHS", "LAST_TWELVE_MONTHS", "LAST_EIGHTEEN_MONTHS", "ALL_TIME"]), help=u"""The date range of the report""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") @@ -4052,9 +4550,7 @@ def list_listing_revision_packages(ctx, from_json, all_pages, page_size, listing cli_util.render_response(result, ctx) -@listing_revision_collection_group.command(name=cli_util.override('marketplace_publisher.list_listing_revisions.command_name', 'list-listing-revisions'), help=u"""Lists the list of listing revisions for a specific listing ID, compartment ID or listing revision status. - -You can specify your compartment's OCID as the value for the compartment ID. For information about OCIDs, see Resource Identifiers (Content/General/Concepts/identifiers.htm). \n[Command Reference](listListingRevisions)""") +@listing_revision_collection_group.command(name=cli_util.override('marketplace_publisher.list_listing_revisions.command_name', 'list-listing-revisions'), help=u"""Lists the list of listing revisions for a specific listing ID, compartment ID or listing revision status. You can specify your compartment's OCID as the value for the compartment ID. For information about OCIDs, see Resource Identifiers (Content/General/Concepts/identifiers.htm). \n[Command Reference](listListingRevisions)""") @cli_util.option('--listing-id', required=True, help=u"""listing OCID""") @cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only listing revisions their lifecycleState matches the given lifecycleState.""") @@ -5970,6 +6466,8 @@ def update_listing_revision_update_service_listing_revision_details(ctx, from_js @cli_util.option('--products', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Products subscribed by listing. This option is a JSON list with items of type ListingProduct. For documentation on ListingProduct please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/marketplacepublisher/20241201/datatypes/ListingProduct.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--partner-registration-url', help=u"""The url provided by partner for the registration of subscription.""") +@cli_util.option('--term-id', help=u"""The unique id of the term attached to the listing.""") @cli_util.option('--vanity-url', help=u"""Custom link to the listing""") @cli_util.option('--recommended-service-provider-listing-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""OCIDs of service listings attached to lead gen listing""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--availability-and-pricing-policy', help=u"""Listing availability and Pricing Policy statement.""") @@ -5977,6 +6475,8 @@ def update_listing_revision_update_service_listing_revision_details(ctx, from_js This option is a JSON list with items of type PricingPlan. For documentation on PricingPlan please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/marketplacepublisher/20241201/datatypes/PricingPlan.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--is-rover-exportable', type=click.BOOL, help=u"""Is this listing rover exportable""") +@cli_util.option('--demo-url', help=u"""Url to demo of the listing""") +@cli_util.option('--self-paced-training-url', help=u"""Url to training resources of the listing""") @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") @@ -5987,7 +6487,7 @@ def update_listing_revision_update_service_listing_revision_details(ctx, from_js @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'content-language': {'module': 'marketplace_publisher', 'class': 'LanguageItem'}, 'supportedlanguages': {'module': 'marketplace_publisher', 'class': 'list[LanguageItem]'}, 'support-contacts': {'module': 'marketplace_publisher', 'class': 'list[SupportContact]'}, 'support-links': {'module': 'marketplace_publisher', 'class': 'list[NamedLink]'}, 'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}, 'version-details': {'module': 'marketplace_publisher', 'class': 'VersionDetails'}, 'products': {'module': 'marketplace_publisher', 'class': 'list[ListingProduct]'}, 'recommended-service-provider-listing-ids': {'module': 'marketplace_publisher', 'class': 'list[string]'}, 'pricing-plans': {'module': 'marketplace_publisher', 'class': 'list[PricingPlan]'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevision'}) @cli_util.wrap_exceptions -def update_listing_revision_update_oci_listing_revision_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, display_name, headline, tagline, keywords, short_description, usage_information, long_description, content_language, supportedlanguages, support_contacts, support_links, freeform_tags, defined_tags, version_details, system_requirements, pricing_type, products, vanity_url, recommended_service_provider_listing_ids, availability_and_pricing_policy, pricing_plans, is_rover_exportable, if_match): +def update_listing_revision_update_oci_listing_revision_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, display_name, headline, tagline, keywords, short_description, usage_information, long_description, content_language, supportedlanguages, support_contacts, support_links, freeform_tags, defined_tags, version_details, system_requirements, pricing_type, products, partner_registration_url, term_id, vanity_url, recommended_service_provider_listing_ids, availability_and_pricing_policy, pricing_plans, is_rover_exportable, demo_url, self_paced_training_url, if_match): if isinstance(listing_revision_id, six.string_types) and len(listing_revision_id.strip()) == 0: raise click.UsageError('Parameter --listing-revision-id cannot be whitespace or empty string') @@ -6054,6 +6554,12 @@ def update_listing_revision_update_oci_listing_revision_details(ctx, from_json, if products is not None: _details['products'] = cli_util.parse_json_parameter("products", products) + if partner_registration_url is not None: + _details['partnerRegistrationUrl'] = partner_registration_url + + if term_id is not None: + _details['termId'] = term_id + if vanity_url is not None: _details['vanityUrl'] = vanity_url @@ -6069,6 +6575,12 @@ def update_listing_revision_update_oci_listing_revision_details(ctx, from_json, if is_rover_exportable is not None: _details['isRoverExportable'] = is_rover_exportable + if demo_url is not None: + _details['demoUrl'] = demo_url + + if self_paced_training_url is not None: + _details['selfPacedTrainingUrl'] = self_paced_training_url + _details['listingType'] = 'OCI_APPLICATION' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -6600,6 +7112,7 @@ def update_listing_revision_attachment_update_review_support_document_attachment @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--document-category', help=u"""The document category of the listing revision attachment.""") +@cli_util.option('--source-url', help=u"""The document URL of the listing revision attachment.""") @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED 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.""") @@ -6610,7 +7123,7 @@ def update_listing_revision_attachment_update_review_support_document_attachment @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevisionAttachment'}) @cli_util.wrap_exceptions -def update_listing_revision_attachment_update_related_document_attachment_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_attachment_id, display_name, description, freeform_tags, defined_tags, document_category, if_match): +def update_listing_revision_attachment_update_related_document_attachment_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_attachment_id, display_name, description, freeform_tags, defined_tags, document_category, source_url, if_match): if isinstance(listing_revision_attachment_id, six.string_types) and len(listing_revision_attachment_id.strip()) == 0: raise click.UsageError('Parameter --listing-revision-attachment-id cannot be whitespace or empty string') @@ -6641,6 +7154,9 @@ def update_listing_revision_attachment_update_related_document_attachment_detail if document_category is not None: _details['documentCategory'] = document_category + if source_url is not None: + _details['sourceUrl'] = source_url + _details['attachmentType'] = 'RELATED_DOCUMENT' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -6684,6 +7200,7 @@ def update_listing_revision_attachment_update_related_document_attachment_detail @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--url', help=u"""Optional url to service information""") +@cli_util.option('--source-type', help=u"""The specified attachment type is Internal or External.""") @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.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED 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.""") @@ -6694,7 +7211,7 @@ def update_listing_revision_attachment_update_related_document_attachment_detail @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'marketplace_publisher', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevisionAttachment'}) @cli_util.wrap_exceptions -def update_listing_revision_attachment_update_supported_service_attachment(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_attachment_id, service_name, type, display_name, description, freeform_tags, defined_tags, url, if_match): +def update_listing_revision_attachment_update_supported_service_attachment(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_attachment_id, service_name, type, display_name, description, freeform_tags, defined_tags, url, source_type, if_match): if isinstance(listing_revision_attachment_id, six.string_types) and len(listing_revision_attachment_id.strip()) == 0: raise click.UsageError('Parameter --listing-revision-attachment-id cannot be whitespace or empty string') @@ -6727,6 +7244,9 @@ def update_listing_revision_attachment_update_supported_service_attachment(ctx, if url is not None: _details['url'] = url + if source_type is not None: + _details['sourceType'] = source_type + _details['attachmentType'] = 'SUPPORTED_SERVICES' client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) @@ -6896,6 +7416,65 @@ def update_listing_revision_attachment_content(ctx, from_json, wait_for_state, m cli_util.render_response(result, ctx) +@listing_revision_group.command(name=cli_util.override('marketplace_publisher.update_listing_revision_banner_content.command_name', 'update-listing-revision-banner-content'), help=u"""Updates the Listing Revision \n[Command Reference](updateListingRevisionBannerContent)""") +@cli_util.option('--listing-revision-id', required=True, help=u"""listing revision""") +@cli_util.option('--banner-name', required=True, help=u"""banner name""") +@cli_util.option('--update-listing-revision-banner-content', required=True, help=u"""The listing revision icon to be updated.""") +@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.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --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.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'marketplace_publisher', 'class': 'ListingRevision'}) +@cli_util.wrap_exceptions +def update_listing_revision_banner_content(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, listing_revision_id, banner_name, update_listing_revision_banner_content, if_match): + + if isinstance(listing_revision_id, six.string_types) and len(listing_revision_id.strip()) == 0: + raise click.UsageError('Parameter --listing-revision-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + # do not automatically retry operations with binary inputs + kwargs['retry_strategy'] = oci.retry.NoneRetryStrategy() + + client = cli_util.build_client('marketplace_publisher', 'marketplace_publisher', ctx) + result = client.update_listing_revision_banner_content( + listing_revision_id=listing_revision_id, + banner_name=banner_name, + update_listing_revision_banner_content=update_listing_revision_banner_content, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_listing_revision') and callable(getattr(client, 'get_listing_revision')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_listing_revision(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + @listing_revision_group.command(name=cli_util.override('marketplace_publisher.update_listing_revision_icon_content.command_name', 'update-listing-revision-icon-content'), help=u"""Updates the Listing Revision \n[Command Reference](updateListingRevisionIconContent)""") @cli_util.option('--listing-revision-id', required=True, help=u"""listing revision""") @cli_util.option('--update-listing-revision-icon-content', required=True, help=u"""The listing revision icon to be updated.""") diff --git a/services/marketplace_publisher/tests/util/generated/command_to_api.py b/services/marketplace_publisher/tests/util/generated/command_to_api.py index cdc67c03b..2863fdf6f 100644 --- a/services/marketplace_publisher/tests/util/generated/command_to_api.py +++ b/services/marketplace_publisher/tests/util/generated/command_to_api.py @@ -17,9 +17,11 @@ "marketplace_publisher.create_listing_revision_attachment": "oci.marketplace_publisher.MarketplacePublisherClient.create_listing_revision_attachment", "marketplace_publisher.create_listing_revision_note": "oci.marketplace_publisher.MarketplacePublisherClient.create_listing_revision_note", "marketplace_publisher.create_listing_revision_package": "oci.marketplace_publisher.MarketplacePublisherClient.create_listing_revision_package", + "marketplace_publisher.create_publisher": "oci.marketplace_publisher.MarketplacePublisherClient.create_publisher", "marketplace_publisher.create_term": "oci.marketplace_publisher.MarketplacePublisherClient.create_term", "marketplace_publisher.create_term_version": "oci.marketplace_publisher.MarketplacePublisherClient.create_term_version", "marketplace_publisher.delete_artifact": "oci.marketplace_publisher.MarketplacePublisherClient.delete_artifact", + "marketplace_publisher.delete_customer_instance_report_export": "oci.marketplace_publisher.MarketplacePublisherClient.delete_customer_instance_report_export", "marketplace_publisher.delete_listing": "oci.marketplace_publisher.MarketplacePublisherClient.delete_listing", "marketplace_publisher.delete_listing_revision": "oci.marketplace_publisher.MarketplacePublisherClient.delete_listing_revision", "marketplace_publisher.delete_listing_revision_attachment": "oci.marketplace_publisher.MarketplacePublisherClient.delete_listing_revision_attachment", @@ -27,8 +29,11 @@ "marketplace_publisher.delete_listing_revision_package": "oci.marketplace_publisher.MarketplacePublisherClient.delete_listing_revision_package", "marketplace_publisher.delete_term": "oci.marketplace_publisher.MarketplacePublisherClient.delete_term", "marketplace_publisher.delete_term_version": "oci.marketplace_publisher.MarketplacePublisherClient.delete_term_version", + "marketplace_publisher.generate_customer_instance_report_export": "oci.marketplace_publisher.MarketplacePublisherClient.generate_customer_instance_report_export", "marketplace_publisher.get_artifact": "oci.marketplace_publisher.MarketplacePublisherClient.get_artifact", "marketplace_publisher.get_category": "oci.marketplace_publisher.MarketplacePublisherClient.get_category", + "marketplace_publisher.get_customer_instance_report_export": "oci.marketplace_publisher.MarketplacePublisherClient.get_customer_instance_report_export", + "marketplace_publisher.get_customer_instance_report_export_content": "oci.marketplace_publisher.MarketplacePublisherClient.get_customer_instance_report_export_content", "marketplace_publisher.get_lead": "oci.marketplace_publisher.MarketplacePublisherClient.get_lead", "marketplace_publisher.get_listing": "oci.marketplace_publisher.MarketplacePublisherClient.get_listing", "marketplace_publisher.get_listing_revision": "oci.marketplace_publisher.MarketplacePublisherClient.get_listing_revision", @@ -49,6 +54,7 @@ "marketplace_publisher.list_artifacts": "oci.marketplace_publisher.MarketplacePublisherClient.list_artifacts", "marketplace_publisher.list_available_services": "oci.marketplace_publisher.MarketplacePublisherClient.list_available_services", "marketplace_publisher.list_categories": "oci.marketplace_publisher.MarketplacePublisherClient.list_categories", + "marketplace_publisher.list_customer_instance_report_exports": "oci.marketplace_publisher.MarketplacePublisherClient.list_customer_instance_report_exports", "marketplace_publisher.list_customer_instance_report_records": "oci.marketplace_publisher.MarketplacePublisherClient.list_customer_instance_report_records", "marketplace_publisher.list_disbursement_report_records": "oci.marketplace_publisher.MarketplacePublisherClient.list_disbursement_report_records", "marketplace_publisher.list_leads": "oci.marketplace_publisher.MarketplacePublisherClient.list_leads", @@ -79,6 +85,7 @@ "marketplace_publisher.update_listing_revision": "oci.marketplace_publisher.MarketplacePublisherClient.update_listing_revision", "marketplace_publisher.update_listing_revision_attachment": "oci.marketplace_publisher.MarketplacePublisherClient.update_listing_revision_attachment", "marketplace_publisher.update_listing_revision_attachment_content": "oci.marketplace_publisher.MarketplacePublisherClient.update_listing_revision_attachment_content", + "marketplace_publisher.update_listing_revision_banner_content": "oci.marketplace_publisher.MarketplacePublisherClient.update_listing_revision_banner_content", "marketplace_publisher.update_listing_revision_icon_content": "oci.marketplace_publisher.MarketplacePublisherClient.update_listing_revision_icon_content", "marketplace_publisher.update_listing_revision_note": "oci.marketplace_publisher.MarketplacePublisherClient.update_listing_revision_note", "marketplace_publisher.update_listing_revision_package": "oci.marketplace_publisher.MarketplacePublisherClient.update_listing_revision_package", diff --git a/setup.py b/setup.py index b6c1e0e93..0847de720 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def open_relative(*path): readme = f.read() requires = [ - 'oci==2.186.0', + 'oci==2.187.0', 'arrow>=1.0.0,<2.0.0', 'certifi>=2025.1.31,<2026.0.0', 'click>=8.0.4,<=8.1.2; python_version < "3.11"', diff --git a/src/oci_cli/cli_util.py b/src/oci_cli/cli_util.py index e45294b23..458c0bf07 100644 --- a/src/oci_cli/cli_util.py +++ b/src/oci_cli/cli_util.py @@ -1188,6 +1188,9 @@ def make_dict_keys_camel_case(original_obj, parameter_name=None, complex_paramet list_type = None if complex_type_definition and complex_type_definition['class'].find('list[') == 0: list_type = {'module': complex_type_definition['module'], 'class': re.match(r'list\[(.*)\]', complex_type_definition['class']).group(1)} # noqa: W605 + elif complex_type_definition and complex_type_definition['class'] not in MODULE_TO_TYPE_MAPPINGS[complex_type_definition['module']]: + # Preserve arbitrary object semantics for arrays inside dict(str, object) values. + list_type = complex_type_definition for obj in original_obj: new_list.append(make_dict_keys_camel_case(obj, complex_parameter_type=list_type)) diff --git a/src/oci_cli/service_mapping.py b/src/oci_cli/service_mapping.py index 8f12a4b99..a4f5036cf 100644 --- a/src/oci_cli/service_mapping.py +++ b/src/oci_cli/service_mapping.py @@ -323,11 +323,6 @@ "Globally Distributed Database", "Others" ], - "distributed-database-v26": [ - "distributed_database_v26", - "Globally Distributed Database", - "Others" - ], "dns": [ "dns", "DNS", diff --git a/src/oci_cli/version.py b/src/oci_cli/version.py index 23c9c6bed..a85e05644 100644 --- a/src/oci_cli/version.py +++ b/src/oci_cli/version.py @@ -2,4 +2,4 @@ # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # 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. -__version__ = '3.93.0' +__version__ = '3.94.0' diff --git a/tests/resources/json_ignore_command_list.txt b/tests/resources/json_ignore_command_list.txt index 872111c8c..1b50adb4f 100644 --- a/tests/resources/json_ignore_command_list.txt +++ b/tests/resources/json_ignore_command_list.txt @@ -616,4 +616,7 @@ data-safe, private-endpoint, update db, database, create-from-database db, database, create-database-from-database iot, iot-flow-runtime, update-iot-flow-runtime-flows -iot, flow-runtime, update-flows \ No newline at end of file +iot, flow-runtime, update-flows +fn, function, create, archive-function, direct-archive, fn-update-runtime-config +fn, function, create, archive-function, direct-archive, manual-runtime-config +fn, function, update, archive-function \ No newline at end of file