diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0cc511255..e52eb6aed 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,101 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__. +3.91.0 - 2026-08-25 +------------------- +Added +~~~~~ +* Network Service + + * Support for Network Firewall as a source type for Virtual Test Access Points (VTAPs) + + * ``oci network vtap create --source-type NETWORK_FIREWALL`` + * ``oci network vtap update --source-type NETWORK_FIREWALL`` + +* Generative AI Data Service + + * Support for NL2SQL Model Selection, Annotation, Background mode and Delta Enrichment + + * ``oci generative-ai-data generate-sql generate-sql-from-nl-job generate-sql-from-nl`` + * ``oci generative-ai-data generate-sql generate-sql-from-nl-job get`` + +* Generative AI Service + + * Support for NL2SQL Model Selection, Annotation, Background mode and Delta Enrichment in semantic-store operations + + * ``oci generative-ai semantic-store create-semantic-store-custom-semantic-store-model-selection`` + * ``oci generative-ai semantic-store create-semantic-store-default-semantic-store-model-selection`` + * ``oci generative-ai semantic-store update-semantic-store-custom-semantic-store-model-selection`` + * ``oci generative-ai semantic-store update-semantic-store-default-semantic-store-model-selection`` + * ``oci generative-ai semantic-store create --is-user-defined-semantics-enabled --model-selection`` + * ``oci generative-ai semantic-store update --is-user-defined-semantics-enabled --model-selection`` + + * Support for additional B200, B300, L40S, and MI300X Dedicated AI Cluster unit shapes + + * ``oci generative-ai dedicated-ai-cluster create --unit-shape`` + +* MySQL Database Service + + * Support for blue/green deployments + + * ``oci mysql blue-green-deployment`` + +* Big Data Service + + * Support for BDS Capacity Reservations and BDS Capacity Reservation Configurations + + * ``oci bds bds-capacity-reservation`` + * ``oci bds bds-capacity-reservation-configuration`` + + * Support for associating a BDS Capacity Reservation when creating a BDS Instance + + * ``oci bds instance create --bds-capacity-reservation-configurations`` + +* Oracle Database Autonomous Recovery Service + + * Support for long-term backup lifecycle operations + + * ``oci recovery long-term-backup`` + * ``oci recovery long-term-backup-collection list-long-term-backups`` + + * Support for new optional parameter ``--security-attributes`` + + * ``oci recovery recovery-service-subnet create --security-attributes`` + * ``oci recovery recovery-service-subnet update --security-attributes`` + + * Support for new optional filters ``--backup-cloud-location`` and ``--must-enforce-cloud-locality`` + + * ``oci recovery protected-database-collection list-protected-databases --backup-cloud-location`` + * ``oci recovery protection-policy-collection list-protection-policies --must-enforce-cloud-locality`` + +Changed +~~~~~~~ +* Oracle Database Autonomous Recovery Service + + * ``--compartment-id`` is now an optional parameter + + * ``oci recovery protected-database-collection list-protected-databases --compartment-id`` + * ``oci recovery protection-policy-collection list-protection-policies --compartment-id`` + * ``oci recovery recovery-service-subnet-collection list-recovery-service-subnets --compartment-id`` + * ``oci recovery work-request-summary-collection list-work-requests --compartment-id`` + +* Generative AI Data Service + + * [BREAKING] Moved commands from ``oci generative-ai-data`` to ``oci generative-ai-data enrichment-job`` + + * ``oci generative-ai-data enrichment-job enrichment-job cancel`` + * ``oci generative-ai-data enrichment-job enrichment-job generate`` + * ``oci generative-ai-data enrichment-job enrichment-job generate-enrichment-job-delta-refresh-enrichment-job-configuration`` + * ``oci generative-ai-data enrichment-job enrichment-job generate-enrichment-job-full-build-enrichment-job-configuration`` + * ``oci generative-ai-data enrichment-job enrichment-job generate-enrichment-job-partial-build-enrichment-job-configuration`` + * ``oci generative-ai-data enrichment-job enrichment-job get`` + * ``oci generative-ai-data enrichment-job enrichment-job-collection list-enrichment-jobs`` + +Security +~~~~~~~~ +* The supported `pyOpenSSL` dependency range has changed to `>=17.5.0,<22.0.0` for Python 3.7 and earlier, and `>=26.2.0,<27.0.0` for Python 3.8 and later. Python 3.7 and earlier retain residual CVE-2026-27448 risk. +* The supported `cryptography` dependency range has changed to `>=3.2.1,<=37.0.2` for Python 3.7 and earlier. + 3.90.3 - 2026-08-18 ------------------- Added diff --git a/requirements.txt b/requirements.txt index ebaf19ebb..1c8f93acf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,8 @@ click>=8.0.4,<=8.1.2; python_version < '3.11' click>=8.3.3,<=8.4.2; python_version >= '3.11' coverage==6.2; python_version < '3.9' coverage==7.10.7; python_version >= '3.9' -cryptography>=3.2.1,<51.0.0 +cryptography>=3.2.1,<=37.0.2; python_version <= '3.7' +cryptography>=3.2.1,<51.0.0; python_version >= '3.8' httpsig-cffi==15.0.0 Jinja2<3.0.0; python_version == '3.6' Jinja2>=3.1.5,<4.0.0; python_version >= '3.7' @@ -18,7 +19,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.184.2 +oci==2.185.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' @@ -27,7 +28,8 @@ pluggy==1.6.0; python_version >= '3.9' py==1.11.0 pyasn1==0.5.0; python_version < '3.8' pyasn1==0.6.3; python_version >= '3.8' -pyOpenSSL>=17.5.0,<27.0.0 +pyOpenSSL>=17.5.0,<22.0.0; python_version <= '3.7' +pyOpenSSL>=26.2.0,<27.0.0; python_version >= '3.8' pycparser==2.20 pyparsing==2.2.0 pytest==7.0.1; python_version <= '3.10' diff --git a/services/bds/src/oci_cli_bds/generated/bds_cli.py b/services/bds/src/oci_cli_bds/generated/bds_cli.py index d4d5aa835..8b597f21b 100644 --- a/services/bds/src/oci_cli_bds/generated/bds_cli.py +++ b/services/bds/src/oci_cli_bds/generated/bds_cli.py @@ -58,6 +58,12 @@ def work_request_group(): pass +@click.command(cli_util.override('bds.bds_capacity_reservation_group.command_name', 'bds-capacity-reservation'), cls=CommandGroupWithAlias, help="""A reusable BDS capacity reservation resource.""") +@cli_util.help_option_group +def bds_capacity_reservation_group(): + pass + + @click.command(cli_util.override('bds.bds_metastore_configuration_group.command_name', 'bds-metastore-configuration'), cls=CommandGroupWithAlias, help="""The metastore configuration information.""") @cli_util.help_option_group def bds_metastore_configuration_group(): @@ -106,12 +112,19 @@ def node_backup_configuration_group(): pass +@click.command(cli_util.override('bds.bds_capacity_reservation_configuration_group.command_name', 'bds-capacity-reservation-configuration'), cls=CommandGroupWithAlias, help="""A configuration between a BDS cluster and a BDS capacity reservation.""") +@cli_util.help_option_group +def bds_capacity_reservation_configuration_group(): + pass + + bds_root_group.add_command(node_backup_group) bds_root_group.add_command(bds_capacity_report_group) bds_root_group.add_command(work_request_log_entry_group) bds_root_group.add_command(identity_configuration_group) bds_root_group.add_command(node_replace_configuration_group) bds_root_group.add_command(work_request_group) +bds_root_group.add_command(bds_capacity_reservation_group) bds_root_group.add_command(bds_metastore_configuration_group) bds_root_group.add_command(bds_instance_group) bds_root_group.add_command(bds_certificate_configuration_group) @@ -120,6 +133,63 @@ def node_backup_configuration_group(): bds_root_group.add_command(work_request_error_group) bds_root_group.add_command(bds_cluster_version_group) bds_root_group.add_command(node_backup_configuration_group) +bds_root_group.add_command(bds_capacity_reservation_configuration_group) + + +@bds_capacity_reservation_configuration_group.command(name=cli_util.override('bds.activate_bds_capacity_reservation_configuration.command_name', 'activate'), help=u"""Activates the BDS capacity reservation configuration identified by the given ID. \n[Command Reference](activateBdsCapacityReservationConfiguration)""") +@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--bds-capacity-reservation-configuration-id', required=True, help=u"""The OCID of the BDS capacity reservation configuration.""") +@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", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "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({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'bds', 'class': 'BdsCapacityReservationConfiguration'}) +@cli_util.wrap_exceptions +def activate_bds_capacity_reservation_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, bds_instance_id, bds_capacity_reservation_configuration_id, if_match): + + if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: + raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') + + if isinstance(bds_capacity_reservation_configuration_id, six.string_types) and len(bds_capacity_reservation_configuration_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-configuration-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('bds', 'bds', ctx) + result = client.activate_bds_capacity_reservation_configuration( + bds_instance_id=bds_instance_id, + bds_capacity_reservation_configuration_id=bds_capacity_reservation_configuration_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_bds_capacity_reservation_configuration') and callable(getattr(client, 'get_bds_capacity_reservation_configuration')): + 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_bds_capacity_reservation_configuration(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) @bds_metastore_configuration_group.command(name=cli_util.override('bds.activate_bds_metastore_configuration.command_name', 'activate'), help=u"""Activate specified metastore configuration. \n[Command Reference](activateBdsMetastoreConfiguration)""") @@ -1570,6 +1640,37 @@ def certificate_service_info(ctx, from_json, bds_instance_id, services, if_match cli_util.render_response(result, ctx) +@bds_capacity_reservation_group.command(name=cli_util.override('bds.change_bds_capacity_reservation_compartment.command_name', 'change-compartment'), help=u"""Moves a BDS capacity reservation into a different compartment. \n[Command Reference](changeBdsCapacityReservationCompartment)""") +@cli_util.option('--bds-capacity-reservation-id', required=True, help=u"""The OCID of the BDS capacity reservation.""") +@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment to move the BDS capacity reservation 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_bds_capacity_reservation_compartment(ctx, from_json, bds_capacity_reservation_id, compartment_id, if_match): + + if isinstance(bds_capacity_reservation_id, six.string_types) and len(bds_capacity_reservation_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-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('bds', 'bds', ctx) + result = client.change_bds_capacity_reservation_compartment( + bds_capacity_reservation_id=bds_capacity_reservation_id, + change_bds_capacity_reservation_compartment_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + @bds_instance_group.command(name=cli_util.override('bds.change_bds_instance_compartment.command_name', 'change-compartment'), help=u"""Moves a Big Data Service cluster into a different compartment. \n[Command Reference](changeBdsInstanceCompartment)""") @cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment.""") @@ -1795,6 +1896,131 @@ def create_bds_capacity_report(ctx, from_json, compartment_id, shape_availabilit cli_util.render_response(result, ctx) +@bds_capacity_reservation_group.command(name=cli_util.override('bds.create_bds_capacity_reservation.command_name', 'create'), help=u"""Creates a reusable BDS capacity reservation resource. \n[Command Reference](createBdsCapacityReservation)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name for the BDS capacity reservation.""") +@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment in which to create the BDS capacity reservation.""") +@cli_util.option('--compute-capacity-reservations', required=True, 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"""Simple key-value pair that is applied without any predefined name, type, or scope. Exists for cross-compatibility only. For 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. For 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", "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({'compute-capacity-reservations': {'module': 'bds', 'class': 'ComputeCapacityReservations'}, 'freeform-tags': {'module': 'bds', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'bds', '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={'compute-capacity-reservations': {'module': 'bds', 'class': 'ComputeCapacityReservations'}, 'freeform-tags': {'module': 'bds', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'bds', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'bds', 'class': 'BdsCapacityReservation'}) +@cli_util.wrap_exceptions +def create_bds_capacity_reservation(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, compute_capacity_reservations, 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 + _details['computeCapacityReservations'] = cli_util.parse_json_parameter("compute_capacity_reservations", compute_capacity_reservations) + + 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('bds', 'bds', ctx) + result = client.create_bds_capacity_reservation( + create_bds_capacity_reservation_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) + + +@bds_capacity_reservation_configuration_group.command(name=cli_util.override('bds.create_bds_capacity_reservation_configuration.command_name', 'create'), help=u"""Creates a configuration between the specified BDS cluster and a BDS capacity reservation. \n[Command Reference](createBdsCapacityReservationConfiguration)""") +@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name for the BDS capacity reservation configuration.""") +@cli_util.option('--bds-capacity-reservation-id', required=True, help=u"""The OCID of the BDS capacity reservation to associate with the BDS cluster.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state 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={}, output_type={'module': 'bds', 'class': 'BdsCapacityReservationConfiguration'}) +@cli_util.wrap_exceptions +def create_bds_capacity_reservation_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, bds_instance_id, display_name, bds_capacity_reservation_id): + + if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: + raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['displayName'] = display_name + _details['bdsCapacityReservationId'] = bds_capacity_reservation_id + + client = cli_util.build_client('bds', 'bds', ctx) + result = client.create_bds_capacity_reservation_configuration( + bds_instance_id=bds_instance_id, + create_bds_capacity_reservation_configuration_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) + + @bds_instance_group.command(name=cli_util.override('bds.create_bds_certificate_configuration.command_name', 'create-bds-certificate-configuration'), help=u"""Create a BDS certificate configuration for the cluster. \n[Command Reference](createBdsCertificateConfiguration)""") @cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") @cli_util.option('--display-name', required=True, help=u"""The display name of the BDS certificate configuration.""") @@ -1876,6 +2102,9 @@ def create_bds_certificate_configuration(ctx, from_json, wait_for_state, max_wai @cli_util.option('--is-secret-reused', type=click.BOOL, help=u"""Boolean flag specifying whether or not to persist the provided secret OCID and reuse it for future operations.""") @cli_util.option('--network-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--bootstrap-script-url', help=u"""Pre-authenticated URL of the script in Object Store that is downloaded and executed.""") +@cli_util.option('--bds-capacity-reservation-configurations', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Optional BDS capacity reservation configurations to associate with the cluster during creation. + +This option is a JSON list with items of type CreateBdsCapacityReservationConfigurationDetails. For documentation on CreateBdsCapacityReservationConfigurationDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/bds/20190531/datatypes/CreateBdsCapacityReservationConfigurationDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--kerberos-realm-name', help=u"""The user-defined kerberos realm name.""") @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. For 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. For example, `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -1885,12 +2114,12 @@ def create_bds_certificate_configuration(ctx, from_json, wait_for_state, max_wai @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state 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({'network-config': {'module': 'bds', 'class': 'NetworkConfig'}, 'nodes': {'module': 'bds', 'class': 'list[CreateNodeDetails]'}, 'freeform-tags': {'module': 'bds', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'bds', 'class': 'dict(str, dict(str, object))'}, 'bds-cluster-version-summary': {'module': 'bds', 'class': 'BdsClusterVersionSummary'}}) +@json_skeleton_utils.get_cli_json_input_option({'network-config': {'module': 'bds', 'class': 'NetworkConfig'}, 'nodes': {'module': 'bds', 'class': 'list[CreateNodeDetails]'}, 'bds-capacity-reservation-configurations': {'module': 'bds', 'class': 'list[CreateBdsCapacityReservationConfigurationDetails]'}, 'freeform-tags': {'module': 'bds', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'bds', 'class': 'dict(str, dict(str, object))'}, 'bds-cluster-version-summary': {'module': 'bds', 'class': 'BdsClusterVersionSummary'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'network-config': {'module': 'bds', 'class': 'NetworkConfig'}, 'nodes': {'module': 'bds', 'class': 'list[CreateNodeDetails]'}, 'freeform-tags': {'module': 'bds', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'bds', 'class': 'dict(str, dict(str, object))'}, 'bds-cluster-version-summary': {'module': 'bds', 'class': 'BdsClusterVersionSummary'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'network-config': {'module': 'bds', 'class': 'NetworkConfig'}, 'nodes': {'module': 'bds', 'class': 'list[CreateNodeDetails]'}, 'bds-capacity-reservation-configurations': {'module': 'bds', 'class': 'list[CreateBdsCapacityReservationConfigurationDetails]'}, 'freeform-tags': {'module': 'bds', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'bds', 'class': 'dict(str, dict(str, object))'}, 'bds-cluster-version-summary': {'module': 'bds', 'class': 'BdsClusterVersionSummary'}}) @cli_util.wrap_exceptions -def create_bds_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, cluster_version, cluster_public_key, is_high_availability, is_secure, nodes, cluster_admin_password, secret_id, is_secret_reused, network_config, bootstrap_script_url, kerberos_realm_name, freeform_tags, defined_tags, kms_key_id, cluster_profile, bds_cluster_version_summary): +def create_bds_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, cluster_version, cluster_public_key, is_high_availability, is_secure, nodes, cluster_admin_password, secret_id, is_secret_reused, network_config, bootstrap_script_url, bds_capacity_reservation_configurations, kerberos_realm_name, freeform_tags, defined_tags, kms_key_id, cluster_profile, bds_cluster_version_summary): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -1919,6 +2148,9 @@ def create_bds_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_i if bootstrap_script_url is not None: _details['bootstrapScriptUrl'] = bootstrap_script_url + if bds_capacity_reservation_configurations is not None: + _details['bdsCapacityReservationConfigurations'] = cli_util.parse_json_parameter("bds_capacity_reservation_configurations", bds_capacity_reservation_configurations) + if kerberos_realm_name is not None: _details['kerberosRealmName'] = kerberos_realm_name @@ -2656,6 +2888,62 @@ def create_resource_principal_configuration(ctx, from_json, wait_for_state, max_ cli_util.render_response(result, ctx) +@bds_capacity_reservation_configuration_group.command(name=cli_util.override('bds.deactivate_bds_capacity_reservation_configuration.command_name', 'deactivate'), help=u"""Deactivates the BDS capacity reservation configuration identified by the given ID. \n[Command Reference](deactivateBdsCapacityReservationConfiguration)""") +@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--bds-capacity-reservation-configuration-id', required=True, help=u"""The OCID of the BDS capacity reservation configuration.""") +@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", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "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({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'bds', 'class': 'BdsCapacityReservationConfiguration'}) +@cli_util.wrap_exceptions +def deactivate_bds_capacity_reservation_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, bds_instance_id, bds_capacity_reservation_configuration_id, if_match): + + if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: + raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') + + if isinstance(bds_capacity_reservation_configuration_id, six.string_types) and len(bds_capacity_reservation_configuration_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-configuration-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('bds', 'bds', ctx) + result = client.deactivate_bds_capacity_reservation_configuration( + bds_instance_id=bds_instance_id, + bds_capacity_reservation_configuration_id=bds_capacity_reservation_configuration_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_bds_capacity_reservation_configuration') and callable(getattr(client, 'get_bds_capacity_reservation_configuration')): + 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_bds_capacity_reservation_configuration(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) + + @identity_configuration_group.command(name=cli_util.override('bds.deactivate_iam_user_sync_configuration.command_name', 'deactivate-iam-user-sync-configuration'), help=u"""Deactivate the IAM user sync configuration. \n[Command Reference](deactivateIamUserSyncConfiguration)""") @cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") @cli_util.option('--identity-configuration-id', required=True, help=u"""The OCID of the identity configuration""") @@ -2861,6 +3149,101 @@ def delete_bds_api_key(ctx, from_json, wait_for_state, max_wait_seconds, wait_in cli_util.render_response(result, ctx) +@bds_capacity_reservation_group.command(name=cli_util.override('bds.delete_bds_capacity_reservation.command_name', 'delete'), help=u"""Deletes the BDS capacity reservation identified by the given ID. \n[Command Reference](deleteBdsCapacityReservation)""") +@cli_util.option('--bds-capacity-reservation-id', required=True, help=u"""The OCID of the BDS capacity reservation.""") +@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", "UPDATING", "DELETING", "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({}) +@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_bds_capacity_reservation(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, bds_capacity_reservation_id, if_match): + + if isinstance(bds_capacity_reservation_id, six.string_types) and len(bds_capacity_reservation_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-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('bds', 'bds', ctx) + result = client.delete_bds_capacity_reservation( + bds_capacity_reservation_id=bds_capacity_reservation_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_bds_capacity_reservation') and callable(getattr(client, 'get_bds_capacity_reservation')): + 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_bds_capacity_reservation(bds_capacity_reservation_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) + + +@bds_capacity_reservation_configuration_group.command(name=cli_util.override('bds.delete_bds_capacity_reservation_configuration.command_name', 'delete'), help=u"""Deletes the BDS capacity reservation configuration identified by the given ID. \n[Command Reference](deleteBdsCapacityReservationConfiguration)""") +@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--bds-capacity-reservation-configuration-id', required=True, help=u"""The OCID of the BDS capacity reservation configuration.""") +@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={}) +@cli_util.wrap_exceptions +def delete_bds_capacity_reservation_configuration(ctx, from_json, bds_instance_id, bds_capacity_reservation_configuration_id, if_match): + + if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: + raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') + + if isinstance(bds_capacity_reservation_configuration_id, six.string_types) and len(bds_capacity_reservation_configuration_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-configuration-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('bds', 'bds', ctx) + result = client.delete_bds_capacity_reservation_configuration( + bds_instance_id=bds_instance_id, + bds_capacity_reservation_configuration_id=bds_capacity_reservation_configuration_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @bds_certificate_configuration_group.command(name=cli_util.override('bds.delete_bds_certificate_configuration.command_name', 'delete'), help=u"""Delete the BDS certificate configuration for the given ID. \n[Command Reference](deleteBdsCertificateConfiguration)""") @cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") @cli_util.option('--bds-certificate-configuration-id', required=True, help=u"""Unique Oracle-assigned identifier of the BdsCertificateConfiguration.""") @@ -3788,6 +4171,55 @@ def get_bds_api_key(ctx, from_json, bds_instance_id, api_key_id): cli_util.render_response(result, ctx) +@bds_capacity_reservation_group.command(name=cli_util.override('bds.get_bds_capacity_reservation.command_name', 'get'), help=u"""Returns information about the BDS capacity reservation identified by the given ID. \n[Command Reference](getBdsCapacityReservation)""") +@cli_util.option('--bds-capacity-reservation-id', required=True, help=u"""The OCID of the BDS capacity reservation.""") +@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': 'bds', 'class': 'BdsCapacityReservation'}) +@cli_util.wrap_exceptions +def get_bds_capacity_reservation(ctx, from_json, bds_capacity_reservation_id): + + if isinstance(bds_capacity_reservation_id, six.string_types) and len(bds_capacity_reservation_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-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('bds', 'bds', ctx) + result = client.get_bds_capacity_reservation( + bds_capacity_reservation_id=bds_capacity_reservation_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@bds_capacity_reservation_configuration_group.command(name=cli_util.override('bds.get_bds_capacity_reservation_configuration.command_name', 'get'), help=u"""Returns information about the BDS capacity reservation configuration identified by the given ID. \n[Command Reference](getBdsCapacityReservationConfiguration)""") +@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--bds-capacity-reservation-configuration-id', required=True, help=u"""The OCID of the BDS capacity reservation configuration.""") +@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': 'bds', 'class': 'BdsCapacityReservationConfiguration'}) +@cli_util.wrap_exceptions +def get_bds_capacity_reservation_configuration(ctx, from_json, bds_instance_id, bds_capacity_reservation_configuration_id): + + if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: + raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') + + if isinstance(bds_capacity_reservation_configuration_id, six.string_types) and len(bds_capacity_reservation_configuration_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-configuration-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('bds', 'bds', ctx) + result = client.get_bds_capacity_reservation_configuration( + bds_instance_id=bds_instance_id, + bds_capacity_reservation_configuration_id=bds_capacity_reservation_configuration_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @bds_certificate_configuration_group.command(name=cli_util.override('bds.get_bds_certificate_configuration.command_name', 'get'), help=u"""Returns details of the BdsCertificateConfiguration identified by the given ID. \n[Command Reference](getBdsCertificateConfiguration)""") @cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") @cli_util.option('--bds-certificate-configuration-id', required=True, help=u"""Unique Oracle-assigned identifier of the BdsCertificateConfiguration.""") @@ -4718,82 +5150,217 @@ def install_patch_batching_based_odh_patching_config(ctx, from_json, wait_for_st @json_skeleton_utils.get_cli_json_input_option({'software-update-keys': {'module': 'bds', 'class': 'list[string]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'software-update-keys': {'module': 'bds', 'class': 'list[string]'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'software-update-keys': {'module': 'bds', 'class': 'list[string]'}}) +@cli_util.wrap_exceptions +def install_software_updates(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, bds_instance_id, software_update_keys, if_match): + + if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: + raise click.UsageError('Parameter --bds-instance-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['softwareUpdateKeys'] = cli_util.parse_json_parameter("software_update_keys", software_update_keys) + + client = cli_util.build_client('bds', 'bds', ctx) + result = client.install_software_updates( + bds_instance_id=bds_instance_id, + install_software_updates_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) + + +@bds_instance_group.command(name=cli_util.override('bds.list_auto_scaling_configurations.command_name', 'list-auto-scaling-configurations'), help=u"""Returns information about the autoscaling configurations for a cluster. \n[Command Reference](listAutoScalingConfigurations)""") +@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment.""") +@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") +@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(["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. If no value is specified timeCreated is default.""") +@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('--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", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), help=u"""The state of the autoscale configuration.""") +@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': 'bds', 'class': 'list[AutoScalingConfigurationSummary]'}) +@cli_util.wrap_exceptions +def list_auto_scaling_configurations(ctx, from_json, all_pages, page_size, compartment_id, bds_instance_id, page, limit, sort_by, sort_order, display_name, lifecycle_state): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: + raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') + + kwargs = {} + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + if display_name is not None: + kwargs['display_name'] = display_name + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('bds', 'bds', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_auto_scaling_configurations, + compartment_id=compartment_id, + bds_instance_id=bds_instance_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_auto_scaling_configurations, + limit, + page_size, + compartment_id=compartment_id, + bds_instance_id=bds_instance_id, + **kwargs + ) + else: + result = client.list_auto_scaling_configurations( + compartment_id=compartment_id, + bds_instance_id=bds_instance_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@bds_api_key_group.command(name=cli_util.override('bds.list_bds_api_keys.command_name', 'list'), help=u"""Returns a list of all API keys associated with this Big Data Service cluster. \n[Command Reference](listBdsApiKeys)""") +@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""The state of the API key.""") +@cli_util.option('--user-id', help=u"""The OCID of the user for whom the API key belongs.""") +@cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") +@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(["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. If no value is specified timeCreated is default.""") +@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('--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': 'bds', 'class': 'list[BdsApiKeySummary]'}) @cli_util.wrap_exceptions -def install_software_updates(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, bds_instance_id, software_update_keys, if_match): +def list_bds_api_keys(ctx, from_json, all_pages, page_size, bds_instance_id, lifecycle_state, user_id, page, limit, sort_by, sort_order, display_name): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if user_id is not None: + kwargs['user_id'] = user_id + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + 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']) - - _details = {} - _details['softwareUpdateKeys'] = cli_util.parse_json_parameter("software_update_keys", software_update_keys) - client = cli_util.build_client('bds', 'bds', ctx) - result = client.install_software_updates( - bds_instance_id=bds_instance_id, - install_software_updates_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 + if all_pages: + if page_size: + kwargs['limit'] = page_size - 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) + result = cli_util.list_call_get_all_results( + client.list_bds_api_keys, + bds_instance_id=bds_instance_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_bds_api_keys, + limit, + page_size, + bds_instance_id=bds_instance_id, + **kwargs + ) + else: + result = client.list_bds_api_keys( + bds_instance_id=bds_instance_id, + **kwargs + ) cli_util.render_response(result, ctx) -@bds_instance_group.command(name=cli_util.override('bds.list_auto_scaling_configurations.command_name', 'list-auto-scaling-configurations'), help=u"""Returns information about the autoscaling configurations for a cluster. \n[Command Reference](listAutoScalingConfigurations)""") +@bds_capacity_reservation_configuration_group.command(name=cli_util.override('bds.list_bds_capacity_reservation_associated_configurations.command_name', 'list-bds-capacity-reservation-associated-configurations'), help=u"""Returns a list of BDS capacity reservation configurations associated with the specified BDS capacity reservation. \n[Command Reference](listBdsCapacityReservationAssociatedConfigurations)""") +@cli_util.option('--bds-capacity-reservation-id', required=True, help=u"""The OCID of the BDS capacity reservation.""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment.""") -@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED"]), help=u"""The lifecycle state of the BDS capacity reservation configuration.""") @cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") @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(["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. If no value is specified timeCreated is default.""") @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('--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", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED", "FAILED"]), help=u"""The state of the autoscale configuration.""") @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': 'bds', 'class': 'list[AutoScalingConfigurationSummary]'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'bds', 'class': 'BdsCapacityReservationAssociatedConfigurationCollection'}) @cli_util.wrap_exceptions -def list_auto_scaling_configurations(ctx, from_json, all_pages, page_size, compartment_id, bds_instance_id, page, limit, sort_by, sort_order, display_name, lifecycle_state): +def list_bds_capacity_reservation_associated_configurations(ctx, from_json, all_pages, page_size, bds_capacity_reservation_id, compartment_id, lifecycle_state, page, limit, sort_by, sort_order, display_name): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') - if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: - raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') + if isinstance(bds_capacity_reservation_id, six.string_types) and len(bds_capacity_reservation_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-id cannot be whitespace or empty string') kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state if page is not None: kwargs['page'] = page if limit is not None: @@ -4804,8 +5371,6 @@ def list_auto_scaling_configurations(ctx, from_json, all_pages, page_size, compa kwargs['sort_order'] = sort_order if display_name is not None: kwargs['display_name'] = display_name - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('bds', 'bds', ctx) if all_pages: @@ -4813,33 +5378,32 @@ def list_auto_scaling_configurations(ctx, from_json, all_pages, page_size, compa kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( - client.list_auto_scaling_configurations, + client.list_bds_capacity_reservation_associated_configurations, + bds_capacity_reservation_id=bds_capacity_reservation_id, compartment_id=compartment_id, - bds_instance_id=bds_instance_id, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( - client.list_auto_scaling_configurations, + client.list_bds_capacity_reservation_associated_configurations, limit, page_size, + bds_capacity_reservation_id=bds_capacity_reservation_id, compartment_id=compartment_id, - bds_instance_id=bds_instance_id, **kwargs ) else: - result = client.list_auto_scaling_configurations( + result = client.list_bds_capacity_reservation_associated_configurations( + bds_capacity_reservation_id=bds_capacity_reservation_id, compartment_id=compartment_id, - bds_instance_id=bds_instance_id, **kwargs ) cli_util.render_response(result, ctx) -@bds_api_key_group.command(name=cli_util.override('bds.list_bds_api_keys.command_name', 'list'), help=u"""Returns a list of all API keys associated with this Big Data Service cluster. \n[Command Reference](listBdsApiKeys)""") +@bds_capacity_reservation_configuration_group.command(name=cli_util.override('bds.list_bds_capacity_reservation_configurations.command_name', 'list'), help=u"""Returns a list of BDS capacity reservation configurations for the specified BDS cluster. \n[Command Reference](listBdsCapacityReservationConfigurations)""") @cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""The state of the API key.""") -@cli_util.option('--user-id', help=u"""The OCID of the user for whom the API key belongs.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "DELETED"]), help=u"""The lifecycle state of the BDS capacity reservation configuration.""") @cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") @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(["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. If no value is specified timeCreated is default.""") @@ -4850,9 +5414,9 @@ def list_auto_scaling_configurations(ctx, from_json, all_pages, page_size, compa @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': 'bds', 'class': 'list[BdsApiKeySummary]'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'bds', 'class': 'BdsCapacityReservationConfigurationCollection'}) @cli_util.wrap_exceptions -def list_bds_api_keys(ctx, from_json, all_pages, page_size, bds_instance_id, lifecycle_state, user_id, page, limit, sort_by, sort_order, display_name): +def list_bds_capacity_reservation_configurations(ctx, from_json, all_pages, page_size, bds_instance_id, lifecycle_state, page, limit, sort_by, sort_order, display_name): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') @@ -4863,8 +5427,6 @@ def list_bds_api_keys(ctx, from_json, all_pages, page_size, bds_instance_id, lif kwargs = {} if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state - if user_id is not None: - kwargs['user_id'] = user_id if page is not None: kwargs['page'] = page if limit is not None: @@ -4882,26 +5444,86 @@ def list_bds_api_keys(ctx, from_json, all_pages, page_size, bds_instance_id, lif kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( - client.list_bds_api_keys, + client.list_bds_capacity_reservation_configurations, bds_instance_id=bds_instance_id, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( - client.list_bds_api_keys, + client.list_bds_capacity_reservation_configurations, limit, page_size, bds_instance_id=bds_instance_id, **kwargs ) else: - result = client.list_bds_api_keys( + result = client.list_bds_capacity_reservation_configurations( bds_instance_id=bds_instance_id, **kwargs ) cli_util.render_response(result, ctx) +@bds_capacity_reservation_group.command(name=cli_util.override('bds.list_bds_capacity_reservations.command_name', 'list'), help=u"""Returns a list of BDS capacity reservations in a compartment. \n[Command Reference](listBdsCapacityReservations)""") +@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "UPDATING", "DELETING", "DELETED"]), help=u"""The lifecycle state of the BDS capacity reservation.""") +@cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") +@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(["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. If no value is specified timeCreated is default.""") +@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('--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': 'bds', 'class': 'BdsCapacityReservationCollection'}) +@cli_util.wrap_exceptions +def list_bds_capacity_reservations(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, page, limit, sort_by, sort_order, display_name): + + 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 page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + 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('bds', 'bds', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_bds_capacity_reservations, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_bds_capacity_reservations, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_bds_capacity_reservations( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @bds_certificate_configuration_group.command(name=cli_util.override('bds.list_bds_certificate_configurations.command_name', 'list'), help=u"""Returns a list of BDS certificate configurations associated with this Big Data Service cluster. \n[Command Reference](listBdsCertificateConfigurations)""") @cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") @cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") @@ -7811,6 +8433,150 @@ def update_auto_scaling_configuration_update_schedule_based_vertical_scaling_pol cli_util.render_response(result, ctx) +@bds_capacity_reservation_group.command(name=cli_util.override('bds.update_bds_capacity_reservation.command_name', 'update'), help=u"""Updates the BDS capacity reservation identified by the given ID. \n[Command Reference](updateBdsCapacityReservation)""") +@cli_util.option('--bds-capacity-reservation-id', required=True, help=u"""The OCID of the BDS capacity reservation.""") +@cli_util.option('--display-name', help=u"""A user-friendly name for the BDS capacity reservation.""") +@cli_util.option('--compute-capacity-reservations', 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"""Simple key-value pair that is applied without any predefined name, type, or scope. Exists for cross-compatibility only. For 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. For 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(["CREATING", "ACTIVE", "UPDATING", "DELETING", "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({'compute-capacity-reservations': {'module': 'bds', 'class': 'ComputeCapacityReservations'}, 'freeform-tags': {'module': 'bds', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'bds', '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={'compute-capacity-reservations': {'module': 'bds', 'class': 'ComputeCapacityReservations'}, 'freeform-tags': {'module': 'bds', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'bds', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'bds', 'class': 'BdsCapacityReservation'}) +@cli_util.wrap_exceptions +def update_bds_capacity_reservation(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, bds_capacity_reservation_id, display_name, compute_capacity_reservations, freeform_tags, defined_tags, if_match): + + if isinstance(bds_capacity_reservation_id, six.string_types) and len(bds_capacity_reservation_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-id cannot be whitespace or empty string') + if not force: + if compute_capacity_reservations or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to compute-capacity-reservations 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 compute_capacity_reservations is not None: + _details['computeCapacityReservations'] = cli_util.parse_json_parameter("compute_capacity_reservations", compute_capacity_reservations) + + 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('bds', 'bds', ctx) + result = client.update_bds_capacity_reservation( + bds_capacity_reservation_id=bds_capacity_reservation_id, + update_bds_capacity_reservation_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_bds_capacity_reservation') and callable(getattr(client, 'get_bds_capacity_reservation')): + 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_bds_capacity_reservation(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) + + +@bds_capacity_reservation_configuration_group.command(name=cli_util.override('bds.update_bds_capacity_reservation_configuration.command_name', 'update'), help=u"""Updates the BDS capacity reservation configuration identified by the given ID. \n[Command Reference](updateBdsCapacityReservationConfiguration)""") +@cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") +@cli_util.option('--bds-capacity-reservation-configuration-id', required=True, help=u"""The OCID of the BDS capacity reservation configuration.""") +@cli_util.option('--bds-capacity-reservation-id', help=u"""The OCID of the BDS capacity reservation to associate with the BDS cluster.""") +@cli_util.option('--display-name', help=u"""A user-friendly name for the BDS capacity reservation configuration.""") +@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", "ACTIVE", "INACTIVE", "UPDATING", "DELETING", "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({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'bds', 'class': 'BdsCapacityReservationConfiguration'}) +@cli_util.wrap_exceptions +def update_bds_capacity_reservation_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, bds_instance_id, bds_capacity_reservation_configuration_id, bds_capacity_reservation_id, display_name, if_match): + + if isinstance(bds_instance_id, six.string_types) and len(bds_instance_id.strip()) == 0: + raise click.UsageError('Parameter --bds-instance-id cannot be whitespace or empty string') + + if isinstance(bds_capacity_reservation_configuration_id, six.string_types) and len(bds_capacity_reservation_configuration_id.strip()) == 0: + raise click.UsageError('Parameter --bds-capacity-reservation-configuration-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 bds_capacity_reservation_id is not None: + _details['bdsCapacityReservationId'] = bds_capacity_reservation_id + + if display_name is not None: + _details['displayName'] = display_name + + client = cli_util.build_client('bds', 'bds', ctx) + result = client.update_bds_capacity_reservation_configuration( + bds_instance_id=bds_instance_id, + bds_capacity_reservation_configuration_id=bds_capacity_reservation_configuration_id, + update_bds_capacity_reservation_configuration_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_bds_capacity_reservation_configuration') and callable(getattr(client, 'get_bds_capacity_reservation_configuration')): + 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_bds_capacity_reservation_configuration(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) + + @bds_instance_group.command(name=cli_util.override('bds.update_bds_instance.command_name', 'update'), help=u"""Updates the Big Data Service cluster identified by the given ID. \n[Command Reference](updateBdsInstance)""") @cli_util.option('--bds-instance-id', required=True, help=u"""The OCID of the cluster.""") @cli_util.option('--secret-id', help=u"""The secretId for the clusterAdminPassword.""") diff --git a/services/bds/tests/util/generated/command_to_api.py b/services/bds/tests/util/generated/command_to_api.py index 0094be267..c6a875642 100644 --- a/services/bds/tests/util/generated/command_to_api.py +++ b/services/bds/tests/util/generated/command_to_api.py @@ -2,6 +2,7 @@ # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. SDK_client_map = { + "bds.activate_bds_capacity_reservation_configuration": "oci.bds.BdsClient.activate_bds_capacity_reservation_configuration", "bds.activate_bds_metastore_configuration": "oci.bds.BdsClient.activate_bds_metastore_configuration", "bds.activate_iam_user_sync_configuration": "oci.bds.BdsClient.activate_iam_user_sync_configuration", "bds.activate_upst_configuration": "oci.bds.BdsClient.activate_upst_configuration", @@ -15,10 +16,13 @@ "bds.backup_node": "oci.bds.BdsClient.backup_node", "bds.bds_instance_reset_password": "oci.bds.BdsClient.bds_instance_reset_password", "bds.certificate_service_info": "oci.bds.BdsClient.certificate_service_info", + "bds.change_bds_capacity_reservation_compartment": "oci.bds.BdsClient.change_bds_capacity_reservation_compartment", "bds.change_bds_instance_compartment": "oci.bds.BdsClient.change_bds_instance_compartment", "bds.change_shape": "oci.bds.BdsClient.change_shape", "bds.create_bds_api_key": "oci.bds.BdsClient.create_bds_api_key", "bds.create_bds_capacity_report": "oci.bds.BdsClient.create_bds_capacity_report", + "bds.create_bds_capacity_reservation": "oci.bds.BdsClient.create_bds_capacity_reservation", + "bds.create_bds_capacity_reservation_configuration": "oci.bds.BdsClient.create_bds_capacity_reservation_configuration", "bds.create_bds_certificate_configuration": "oci.bds.BdsClient.create_bds_certificate_configuration", "bds.create_bds_instance": "oci.bds.BdsClient.create_bds_instance", "bds.create_bds_metastore_configuration": "oci.bds.BdsClient.create_bds_metastore_configuration", @@ -26,9 +30,12 @@ "bds.create_node_backup_configuration": "oci.bds.BdsClient.create_node_backup_configuration", "bds.create_node_replace_configuration": "oci.bds.BdsClient.create_node_replace_configuration", "bds.create_resource_principal_configuration": "oci.bds.BdsClient.create_resource_principal_configuration", + "bds.deactivate_bds_capacity_reservation_configuration": "oci.bds.BdsClient.deactivate_bds_capacity_reservation_configuration", "bds.deactivate_iam_user_sync_configuration": "oci.bds.BdsClient.deactivate_iam_user_sync_configuration", "bds.deactivate_upst_configuration": "oci.bds.BdsClient.deactivate_upst_configuration", "bds.delete_bds_api_key": "oci.bds.BdsClient.delete_bds_api_key", + "bds.delete_bds_capacity_reservation": "oci.bds.BdsClient.delete_bds_capacity_reservation", + "bds.delete_bds_capacity_reservation_configuration": "oci.bds.BdsClient.delete_bds_capacity_reservation_configuration", "bds.delete_bds_certificate_configuration": "oci.bds.BdsClient.delete_bds_certificate_configuration", "bds.delete_bds_instance": "oci.bds.BdsClient.delete_bds_instance", "bds.delete_bds_metastore_configuration": "oci.bds.BdsClient.delete_bds_metastore_configuration", @@ -42,6 +49,8 @@ "bds.generate_bds_certificate": "oci.bds.BdsClient.generate_bds_certificate", "bds.get_auto_scaling_configuration": "oci.bds.BdsClient.get_auto_scaling_configuration", "bds.get_bds_api_key": "oci.bds.BdsClient.get_bds_api_key", + "bds.get_bds_capacity_reservation": "oci.bds.BdsClient.get_bds_capacity_reservation", + "bds.get_bds_capacity_reservation_configuration": "oci.bds.BdsClient.get_bds_capacity_reservation_configuration", "bds.get_bds_certificate_configuration": "oci.bds.BdsClient.get_bds_certificate_configuration", "bds.get_bds_instance": "oci.bds.BdsClient.get_bds_instance", "bds.get_bds_metastore_configuration": "oci.bds.BdsClient.get_bds_metastore_configuration", @@ -58,6 +67,9 @@ "bds.install_software_updates": "oci.bds.BdsClient.install_software_updates", "bds.list_auto_scaling_configurations": "oci.bds.BdsClient.list_auto_scaling_configurations", "bds.list_bds_api_keys": "oci.bds.BdsClient.list_bds_api_keys", + "bds.list_bds_capacity_reservation_associated_configurations": "oci.bds.BdsClient.list_bds_capacity_reservation_associated_configurations", + "bds.list_bds_capacity_reservation_configurations": "oci.bds.BdsClient.list_bds_capacity_reservation_configurations", + "bds.list_bds_capacity_reservations": "oci.bds.BdsClient.list_bds_capacity_reservations", "bds.list_bds_certificate_configurations": "oci.bds.BdsClient.list_bds_certificate_configurations", "bds.list_bds_cluster_versions": "oci.bds.BdsClient.list_bds_cluster_versions", "bds.list_bds_instances": "oci.bds.BdsClient.list_bds_instances", @@ -93,6 +105,8 @@ "bds.test_bds_metastore_configuration": "oci.bds.BdsClient.test_bds_metastore_configuration", "bds.test_bds_object_storage_connection": "oci.bds.BdsClient.test_bds_object_storage_connection", "bds.update_auto_scaling_configuration": "oci.bds.BdsClient.update_auto_scaling_configuration", + "bds.update_bds_capacity_reservation": "oci.bds.BdsClient.update_bds_capacity_reservation", + "bds.update_bds_capacity_reservation_configuration": "oci.bds.BdsClient.update_bds_capacity_reservation_configuration", "bds.update_bds_instance": "oci.bds.BdsClient.update_bds_instance", "bds.update_bds_metastore_configuration": "oci.bds.BdsClient.update_bds_metastore_configuration", "bds.update_identity_configuration": "oci.bds.BdsClient.update_identity_configuration", diff --git a/services/core/src/oci_cli_virtual_network/generated/virtualnetwork_cli.py b/services/core/src/oci_cli_virtual_network/generated/virtualnetwork_cli.py index b48b534ae..b68801a8c 100644 --- a/services/core/src/oci_cli_virtual_network/generated/virtualnetwork_cli.py +++ b/services/core/src/oci_cli_virtual_network/generated/virtualnetwork_cli.py @@ -5319,7 +5319,7 @@ def create_vlan(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_ @cli_util.option('--is-vtap-enabled', type=click.BOOL, help=u"""Used to start or stop a `Vtap` resource. * `TRUE` directs the VTAP to start mirroring traffic. * `FALSE` (Default) directs the VTAP to stop mirroring traffic.""") -@cli_util.option('--source-type', type=custom_types.CliCaseInsensitiveChoice(["VNIC", "SUBNET", "LOAD_BALANCER", "DB_SYSTEM", "EXADATA_VM_CLUSTER", "AUTONOMOUS_DATA_WAREHOUSE"]), help=u"""The source type for the VTAP.""") +@cli_util.option('--source-type', type=custom_types.CliCaseInsensitiveChoice(["VNIC", "SUBNET", "LOAD_BALANCER", "DB_SYSTEM", "EXADATA_VM_CLUSTER", "AUTONOMOUS_DATA_WAREHOUSE", "NETWORK_FIREWALL"]), help=u"""The source type for the VTAP.""") @cli_util.option('--traffic-mode', type=custom_types.CliCaseInsensitiveChoice(["DEFAULT", "PRIORITY"]), help=u"""Used to control the priority of traffic. It is an optional field. If it not passed, the value is DEFAULT""") @cli_util.option('--max-packet-size', type=click.INT, help=u"""The maximum size of the packets to be included in the filter.""") @cli_util.option('--target-type', type=custom_types.CliCaseInsensitiveChoice(["VNIC", "NETWORK_LOAD_BALANCER", "IP_ADDRESS"]), help=u"""The target type for the VTAP.""") @@ -15652,7 +15652,7 @@ def update_vnic(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_in @cli_util.option('--source-private-endpoint-ip', help=u"""The IP Address of the source private endpoint.""") @cli_util.option('--source-private-endpoint-subnet-id', help=u"""The [OCID] of the subnet that source private endpoint belongs to.""") @cli_util.option('--target-type', type=custom_types.CliCaseInsensitiveChoice(["VNIC", "NETWORK_LOAD_BALANCER", "IP_ADDRESS"]), help=u"""The target type for the VTAP.""") -@cli_util.option('--source-type', type=custom_types.CliCaseInsensitiveChoice(["VNIC", "SUBNET", "LOAD_BALANCER", "DB_SYSTEM", "EXADATA_VM_CLUSTER", "AUTONOMOUS_DATA_WAREHOUSE"]), help=u"""The source type for the VTAP.""") +@cli_util.option('--source-type', type=custom_types.CliCaseInsensitiveChoice(["VNIC", "SUBNET", "LOAD_BALANCER", "DB_SYSTEM", "EXADATA_VM_CLUSTER", "AUTONOMOUS_DATA_WAREHOUSE", "NETWORK_FIREWALL"]), help=u"""The source type for the VTAP.""") @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(["PROVISIONING", "AVAILABLE", "UPDATING", "TERMINATING", "TERMINATED"]), 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 PROVISIONING --wait-for-state TERMINATED 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.""") 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 2b00339ac..7dc702d49 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 @@ -234,7 +234,7 @@ def dedicated_ai_cluster_group(): pass -@click.command(cli_util.override('generative_ai.hosted_application_storage_group.command_name', 'hosted-application-storage'), cls=CommandGroupWithAlias, help="""defines a physical storage (database or cache) managed by service. Each application can choose one or two storages for certain purpose such as agent memory. +@click.command(cli_util.override('generative_ai.hosted_application_storage_group.command_name', 'hosted-application-storage'), cls=CommandGroupWithAlias, help="""Represents managed storage for an application. An application can use at most one managed storage resource of each type. 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 @@ -974,11 +974,11 @@ def create_api_key(ctx, from_json, wait_for_state, max_wait_seconds, wait_interv Allowed values are: - HOSTING - FINE_TUNING""") @cli_util.option('--compartment-id', required=True, help=u"""The compartment OCID to create the dedicated AI cluster in.""") @cli_util.option('--unit-count', required=True, type=click.INT, help=u"""The number of dedicated units in this AI cluster.""") -@cli_util.option('--unit-shape', required=True, help=u"""The shape of dedicated unit in this AI cluster. The underlying hardware configuration is hidden from customers. +@cli_util.option('--unit-shape', required=True, help=u"""The shape of dedicated unit in this AI cluster. Allowed values are: - LARGE_COHERE - LARGE_COHERE_V2 - SMALL_COHERE - SMALL_COHERE_V2 - SMALL_COHERE_4 - EMBED_COHERE - LLAMA2_70 - LARGE_GENERIC - LARGE_COHERE_V2_2 - LARGE_GENERIC_4 - SMALL_GENERIC_V2 - LARGE_GENERIC_2 - LARGE_GENERIC_V3 - LARGE_COHERE_V3 - RERANK_COHERE - SMALL_GENERIC_V1 - MEDIUM_GENERIC_V1 - LARGE_GENERIC_V1 - A10_X1 - A10_X2 - A10_X4 - A100_40G_X1 - A100_40G_X2 - A100_40G_X4 - A100_40G_X8 - A100_80G_X1 - A100_80G_X2 - A100_80G_X4 - A100_80G_X8 - H100_X1 - H100_X2 - H100_X4 - H100_X8 - H100_X16 - H100_X32 - H200_X1 - H200_X2 - H200_X4 - H200_X8 -The following shapes can only be used to deploy imported models: - A10_X1, A10_X2, A10_X4 - A100_40G_X1, A100_40G_X2, A100_40G_X4, A100_40G_X8 - A100_80G_X1, A100_80G_X2, A100_80G_X4, A100_80G_X8 - H100_X1, H100_X2, H100_X4, H100_X8 - H100_X16, H100_X32 - H200_X1, H200_X2, H200_X4, H200_X8 - OAI_A10_X2 - OAI_H100_X1 - OAI_H100_X2 - OAI_H200_X1 - OAI_A100_80G_X1 - OAI_A100_80G_X2 - OAI_A100_40G_X1 - OAI_A100_40G_X4 - B200_X1 - B200_X2 - B200_X4 - B200_X8 - OAI_B200_X1 - OAI_B200_X2 - OAI_B200_X4 - OAI_B200_X8 - SB_B200_X1 - COHERE_B300_X1 - META_B300_X1 - OAI_B300_X1""") +The following shapes can only be used to deploy imported models: - A10_X1, A10_X2, A10_X4 - A100_40G_X1, A100_40G_X2, A100_40G_X4, A100_40G_X8 - A100_80G_X1, A100_80G_X2, A100_80G_X4, A100_80G_X8 - H100_X1, H100_X2, H100_X4, H100_X8 - H100_X16, H100_X32 - H200_X1, H200_X2, H200_X4, H200_X8 - B200_X16, B200_X32 - B300_X1, B300_X2, B300_X4, B300_X8, B300_X16, B300_X32 - L40S_X1, L40S_X2, L40S_X4, L40S_X8, L40S_X16, L40S_X32 - MI300X_X1, MI300X_X2, MI300X_X4, MI300X_X8, MI300X_X16, MI300X_X32 - OAI_A10_X2 - OAI_H100_X1 - OAI_H100_X2 - OAI_H200_X1 - OAI_A100_80G_X1 - OAI_A100_80G_X2 - OAI_A100_40G_X1 - OAI_A100_40G_X4 - B200_X1 - B200_X2 - B200_X4 - B200_X8 - OAI_B200_X1 - OAI_B200_X2 - OAI_B200_X4 - OAI_B200_X8 - SB_B200_X1 - B200_X16 - B200_X32 - B300_X1 - B300_X2 - B300_X4 - B300_X8 - B300_X16 - B300_X32 - L40S_X1 - L40S_X2 - L40S_X4 - L40S_X8 - L40S_X16 - L40S_X32 - MI300X_X1 - MI300X_X2 - MI300X_X4 - MI300X_X8 - MI300X_X16 - MI300X_X32 - COHERE_B300_X1 - META_B300_X1 - OAI_B300_X1""") @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 dedicated AI cluster.""") @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]. @@ -1333,7 +1333,7 @@ def create_generative_ai_project(ctx, from_json, wait_for_state, max_wait_second @cli_util.option('--description', help=u"""The description for the Hosted Application.""") @cli_util.option('--scaling-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--networking-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--storage-configs', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of storage configuration for the Hosted Application. Defines a list of service-managed storage back-ends. +@cli_util.option('--storage-configs', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of managed storage configurations for the application. This option is a JSON list with items of type StorageConfig. For documentation on StorageConfig please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/generativeai/20231130/datatypes/StorageConfig.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--environment-variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of environment variables for the Hosted Application. Defines a list of environment variables injected at runtime. @@ -1425,7 +1425,7 @@ def create_hosted_application(ctx, from_json, wait_for_state, max_wait_seconds, @cli_util.option('--description', help=u"""The description for the Hosted Application.""") @cli_util.option('--scaling-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--networking-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--storage-configs', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of storage configuration for the Hosted Application. Defines a list of service-managed storage back-ends. +@cli_util.option('--storage-configs', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of managed storage configurations for the application. This option is a JSON list with items of type StorageConfig. For documentation on StorageConfig please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/generativeai/20231130/datatypes/StorageConfig.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--environment-variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of environment variables for the Hosted Application. Defines a list of environment variables injected at runtime. @@ -1513,7 +1513,7 @@ def create_hosted_application_iam(ctx, from_json, wait_for_state, max_wait_secon @hosted_application_storage_group.command(name=cli_util.override('generative_ai.create_hosted_application_storage.command_name', 'create'), help=u"""Creates a hosted application storage. \n[Command Reference](createHostedApplicationStorage)""") @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 compartment OCID to create the hosted application in.""") -@cli_util.option('--storage-type', required=True, help=u"""type like Cache, Postgresql and ADB.""") +@cli_util.option('--storage-type', required=True, help=u"""The managed storage type for the application.""") @cli_util.option('--description', help=u"""An optional description of the hosted application.""") @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]. @@ -2152,6 +2152,8 @@ def create_model(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval @cli_util.option('--data-source', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--schemas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. When omitted, this value defaults to true.""") +@cli_util.option('--model-selection', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--refresh-schedule', 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]. @@ -2162,12 +2164,12 @@ def create_model(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "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({'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def create_semantic_store(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, description, refresh_schedule, freeform_tags, defined_tags): +def create_semantic_store(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, description, is_user_defined_semantics_enabled, model_selection, refresh_schedule, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2181,6 +2183,12 @@ def create_semantic_store(ctx, from_json, wait_for_state, max_wait_seconds, wait if description is not None: _details['description'] = description + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + if refresh_schedule is not None: _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) @@ -2232,6 +2240,8 @@ def create_semantic_store(ctx, from_json, wait_for_state, max_wait_seconds, wait @cli_util.option('--data-source-querying-connection-id', required=True, help=u"""The [OCID] of the OCI Database Tools Connection for querying.""") @cli_util.option('--data-source-enrichment-connection-id', required=True, help=u"""The [OCID] of the OCI Database Tools Connection for enrichment.""") @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. When omitted, this value defaults to true.""") +@cli_util.option('--model-selection', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--refresh-schedule', 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]. @@ -2242,12 +2252,12 @@ def create_semantic_store(ctx, from_json, wait_for_state, max_wait_seconds, wait @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "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({'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def create_semantic_store_create_data_source_database_tools_connection_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, schemas, data_source_querying_connection_id, data_source_enrichment_connection_id, description, refresh_schedule, freeform_tags, defined_tags): +def create_semantic_store_create_data_source_database_tools_connection_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, schemas, data_source_querying_connection_id, data_source_enrichment_connection_id, description, is_user_defined_semantics_enabled, model_selection, refresh_schedule, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2263,6 +2273,12 @@ def create_semantic_store_create_data_source_database_tools_connection_details(c if description is not None: _details['description'] = description + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + if refresh_schedule is not None: _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) @@ -2315,6 +2331,8 @@ def create_semantic_store_create_data_source_database_tools_connection_details(c @cli_util.option('--data-source', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--schemas-schemas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Array of database schemas to be included in the connection. Each schema must define a name. A simple schema definition includes only the name, for example: { \"schemas\": [ { \"name\": \"HR\" } ] } Only one schema name is allowed now. Additional configuration options may be supported in extended forms later.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. When omitted, this value defaults to true.""") +@cli_util.option('--model-selection', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--refresh-schedule', 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]. @@ -2325,12 +2343,12 @@ def create_semantic_store_create_data_source_database_tools_connection_details(c @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "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({'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}, 'schemas-schemas': {'module': 'generative_ai', 'class': 'list[SchemaItem]'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}, 'schemas-schemas': {'module': 'generative_ai', 'class': 'list[SchemaItem]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}, 'schemas-schemas': {'module': 'generative_ai', 'class': 'list[SchemaItem]'}}, output_type={'module': 'generative_ai', 'class': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}, 'schemas-schemas': {'module': 'generative_ai', 'class': 'list[SchemaItem]'}}, output_type={'module': 'generative_ai', 'class': 'SemanticStore'}) @cli_util.wrap_exceptions -def create_semantic_store_create_schemas_database_tools_connection_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas_schemas, description, refresh_schedule, freeform_tags, defined_tags): +def create_semantic_store_create_schemas_database_tools_connection_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas_schemas, description, is_user_defined_semantics_enabled, model_selection, refresh_schedule, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2345,6 +2363,12 @@ def create_semantic_store_create_schemas_database_tools_connection_details(ctx, if description is not None: _details['description'] = description + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + if refresh_schedule is not None: _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) @@ -2391,12 +2415,188 @@ def create_semantic_store_create_schemas_database_tools_connection_details(ctx, cli_util.render_response(result, ctx) +@semantic_store_group.command(name=cli_util.override('generative_ai.create_semantic_store_default_semantic_store_model_selection.command_name', 'create-semantic-store-default-semantic-store-model-selection'), 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.""") +@cli_util.option('--data-source', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--schemas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. When omitted, this value defaults to true.""") +@cli_util.option('--refresh-schedule', 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", "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({'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@cli_util.wrap_exceptions +def create_semantic_store_default_semantic_store_model_selection(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, description, is_user_defined_semantics_enabled, refresh_schedule, freeform_tags, defined_tags): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['modelSelection'] = {} + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['dataSource'] = cli_util.parse_json_parameter("data_source", data_source) + _details['schemas'] = cli_util.parse_json_parameter("schemas", schemas) + + if description is not None: + _details['description'] = description + + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if refresh_schedule is not None: + _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) + + 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['modelSelection']['modelSelectionType'] = 'DEFAULT' + + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + result = client.create_semantic_store( + create_semantic_store_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) + + +@semantic_store_group.command(name=cli_util.override('generative_ai.create_semantic_store_custom_semantic_store_model_selection.command_name', 'create-semantic-store-custom-semantic-store-model-selection'), 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.""") +@cli_util.option('--data-source', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--schemas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--model-selection-model-id', required=True, help=u"""The generative AI modelId to use for SemanticStore enrichment. You can use the ListModels API to list the available models. https://docs.oracle.com/en-us/iaas/api/#/en/generative-ai/20231130/ModelCollection/ListModels""") +@cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. When omitted, this value defaults to true.""") +@cli_util.option('--refresh-schedule', 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", "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({'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@cli_util.wrap_exceptions +def create_semantic_store_custom_semantic_store_model_selection(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, model_selection_model_id, description, is_user_defined_semantics_enabled, refresh_schedule, freeform_tags, defined_tags): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['modelSelection'] = {} + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['dataSource'] = cli_util.parse_json_parameter("data_source", data_source) + _details['schemas'] = cli_util.parse_json_parameter("schemas", schemas) + _details['modelSelection']['modelId'] = model_selection_model_id + + if description is not None: + _details['description'] = description + + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if refresh_schedule is not None: + _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) + + 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['modelSelection']['modelSelectionType'] = 'CUSTOM' + + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + result = client.create_semantic_store( + create_semantic_store_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) + + @semantic_store_group.command(name=cli_util.override('generative_ai.create_semantic_store_refresh_schedule_on_create_details.command_name', 'create-semantic-store-refresh-schedule-on-create-details'), 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.""") @cli_util.option('--data-source', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--schemas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. When omitted, this value defaults to true.""") +@cli_util.option('--model-selection', 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) @@ -2406,12 +2606,12 @@ def create_semantic_store_create_schemas_database_tools_connection_details(ctx, @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "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({'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def create_semantic_store_refresh_schedule_on_create_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, description, freeform_tags, defined_tags): +def create_semantic_store_refresh_schedule_on_create_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, description, is_user_defined_semantics_enabled, model_selection, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2426,6 +2626,12 @@ def create_semantic_store_refresh_schedule_on_create_details(ctx, from_json, wai if description is not None: _details['description'] = description + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -2475,6 +2681,8 @@ def create_semantic_store_refresh_schedule_on_create_details(ctx, from_json, wai @cli_util.option('--data-source', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--schemas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. When omitted, this value defaults to true.""") +@cli_util.option('--model-selection', 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) @@ -2484,12 +2692,12 @@ def create_semantic_store_refresh_schedule_on_create_details(ctx, from_json, wai @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "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({'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def create_semantic_store_refresh_schedule_none_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, description, freeform_tags, defined_tags): +def create_semantic_store_refresh_schedule_none_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, description, is_user_defined_semantics_enabled, model_selection, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2504,6 +2712,12 @@ def create_semantic_store_refresh_schedule_none_details(ctx, from_json, wait_for if description is not None: _details['description'] = description + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -2554,6 +2768,8 @@ def create_semantic_store_refresh_schedule_none_details(ctx, from_json, wait_for @cli_util.option('--schemas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--refresh-schedule-value', required=True, help=u"""Specifies the refresh interval value. The interval must be provided using the ISO 8601 extended format, either as PnW or PnYnMnDTnHnMnS, where 'P' is always required, 'T' precedes any time components less than one day, and each included component is properly suffixed. For example, \"P1DT6H\" represents a duration of 1 day and 6 hours.""") @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. When omitted, this value defaults to true.""") +@cli_util.option('--model-selection', 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) @@ -2563,12 +2779,12 @@ def create_semantic_store_refresh_schedule_none_details(ctx, from_json, wait_for @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "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({'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'data-source': {'module': 'generative_ai', 'class': 'CreateDataSourceDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def create_semantic_store_refresh_schedule_interval_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, refresh_schedule_value, description, freeform_tags, defined_tags): +def create_semantic_store_refresh_schedule_interval_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, data_source, schemas, refresh_schedule_value, description, is_user_defined_semantics_enabled, model_selection, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2584,6 +2800,12 @@ def create_semantic_store_refresh_schedule_interval_details(ctx, from_json, wait if description is not None: _details['description'] = description + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -6479,6 +6701,199 @@ def update_model(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_i @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.""") @cli_util.option('--display-name', help=u"""A user-friendly name.""") +@cli_util.option('--model-selection', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. If omitted, the existing setting is unchanged.""") +@cli_util.option('--refresh-schedule', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--schemas', 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({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@cli_util.wrap_exceptions +def update_semantic_store(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, description, display_name, model_selection, is_user_defined_semantics_enabled, refresh_schedule, schemas, freeform_tags, defined_tags, if_match): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') + if not force: + if model_selection or refresh_schedule or schemas or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to model-selection and refresh-schedule and schemas 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 description is not None: + _details['description'] = description + + if display_name is not None: + _details['displayName'] = display_name + + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if refresh_schedule is not None: + _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) + + if schemas is not None: + _details['schemas'] = cli_util.parse_json_parameter("schemas", schemas) + + 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_semantic_store( + semantic_store_id=semantic_store_id, + update_semantic_store_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_semantic_store') and callable(getattr(client, 'get_semantic_store')): + 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_semantic_store(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_default_semantic_store_model_selection.command_name', 'update-semantic-store-default-semantic-store-model-selection'), 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.""") +@cli_util.option('--display-name', help=u"""A user-friendly name.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. If omitted, the existing setting is unchanged.""") +@cli_util.option('--refresh-schedule', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--schemas', 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({'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@cli_util.wrap_exceptions +def update_semantic_store_default_semantic_store_model_selection(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, description, display_name, is_user_defined_semantics_enabled, refresh_schedule, schemas, freeform_tags, defined_tags, if_match): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') + if not force: + if refresh_schedule or schemas or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to refresh-schedule and schemas 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 = {} + _details['modelSelection'] = {} + + if description is not None: + _details['description'] = description + + if display_name is not None: + _details['displayName'] = display_name + + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + + if refresh_schedule is not None: + _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) + + if schemas is not None: + _details['schemas'] = cli_util.parse_json_parameter("schemas", schemas) + + 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['modelSelection']['modelSelectionType'] = 'DEFAULT' + + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) + result = client.update_semantic_store( + semantic_store_id=semantic_store_id, + update_semantic_store_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_semantic_store') and callable(getattr(client, 'get_semantic_store')): + 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_semantic_store(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_custom_semantic_store_model_selection.command_name', 'update-semantic-store-custom-semantic-store-model-selection'), 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('--model-selection-model-id', required=True, help=u"""The generative AI modelId to use for SemanticStore enrichment. You can use the ListModels API to list the available models. https://docs.oracle.com/en-us/iaas/api/#/en/generative-ai/20231130/ModelCollection/ListModels""") +@cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") +@cli_util.option('--display-name', help=u"""A user-friendly name.""") +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. If omitted, the existing setting is unchanged.""") @cli_util.option('--refresh-schedule', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--schemas', 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]. @@ -6497,7 +6912,7 @@ def update_model(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_i @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def update_semantic_store(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, description, display_name, refresh_schedule, schemas, freeform_tags, defined_tags, if_match): +def update_semantic_store_custom_semantic_store_model_selection(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, model_selection_model_id, description, display_name, is_user_defined_semantics_enabled, refresh_schedule, schemas, freeform_tags, defined_tags, if_match): if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') @@ -6512,6 +6927,8 @@ def update_semantic_store(ctx, from_json, force, wait_for_state, max_wait_second kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} + _details['modelSelection'] = {} + _details['modelSelection']['modelId'] = model_selection_model_id if description is not None: _details['description'] = description @@ -6519,6 +6936,9 @@ def update_semantic_store(ctx, from_json, force, wait_for_state, max_wait_second if display_name is not None: _details['displayName'] = display_name + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + if refresh_schedule is not None: _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) @@ -6531,6 +6951,8 @@ def update_semantic_store(ctx, from_json, force, wait_for_state, max_wait_second if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + _details['modelSelection']['modelSelectionType'] = 'CUSTOM' + client = cli_util.build_client('generative_ai', 'generative_ai', ctx) result = client.update_semantic_store( semantic_store_id=semantic_store_id, @@ -6567,6 +6989,8 @@ def update_semantic_store(ctx, from_json, force, wait_for_state, max_wait_second @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.""") @cli_util.option('--display-name', help=u"""A user-friendly name.""") +@cli_util.option('--model-selection', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. If omitted, the existing setting is unchanged.""") @cli_util.option('--schemas', 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]. @@ -6579,18 +7003,18 @@ def update_semantic_store(ctx, from_json, force, wait_for_state, max_wait_second @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({'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def update_semantic_store_refresh_schedule_on_create_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, description, display_name, schemas, freeform_tags, defined_tags, if_match): +def update_semantic_store_refresh_schedule_on_create_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, description, display_name, model_selection, is_user_defined_semantics_enabled, schemas, freeform_tags, defined_tags, if_match): if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') if not force: - if schemas or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to schemas and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if model_selection or schemas or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to model-selection and schemas and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -6607,6 +7031,12 @@ def update_semantic_store_refresh_schedule_on_create_details(ctx, from_json, for if display_name is not None: _details['displayName'] = display_name + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + if schemas is not None: _details['schemas'] = cli_util.parse_json_parameter("schemas", schemas) @@ -6654,6 +7084,8 @@ def update_semantic_store_refresh_schedule_on_create_details(ctx, from_json, for @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.""") @cli_util.option('--display-name', help=u"""A user-friendly name.""") +@cli_util.option('--model-selection', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. If omitted, the existing setting is unchanged.""") @cli_util.option('--schemas', 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]. @@ -6666,18 +7098,18 @@ def update_semantic_store_refresh_schedule_on_create_details(ctx, from_json, for @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({'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def update_semantic_store_refresh_schedule_none_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, description, display_name, schemas, freeform_tags, defined_tags, if_match): +def update_semantic_store_refresh_schedule_none_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, description, display_name, model_selection, is_user_defined_semantics_enabled, schemas, freeform_tags, defined_tags, if_match): if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') if not force: - if schemas or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to schemas and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if model_selection or schemas or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to model-selection and schemas and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -6694,6 +7126,12 @@ def update_semantic_store_refresh_schedule_none_details(ctx, from_json, force, w if display_name is not None: _details['displayName'] = display_name + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + if schemas is not None: _details['schemas'] = cli_util.parse_json_parameter("schemas", schemas) @@ -6742,6 +7180,8 @@ def update_semantic_store_refresh_schedule_none_details(ctx, from_json, force, w @cli_util.option('--refresh-schedule-value', required=True, help=u"""Specifies the refresh interval value. The interval must be provided using the ISO 8601 extended format, either as PnW or PnYnMnDTnHnMnS, where 'P' is always required, 'T' precedes any time components less than one day, and each included component is properly suffixed. For example, \"P1DT6H\" represents a duration of 1 day and 6 hours.""") @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") @cli_util.option('--display-name', help=u"""A user-friendly name.""") +@cli_util.option('--model-selection', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. If omitted, the existing setting is unchanged.""") @cli_util.option('--schemas', 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]. @@ -6754,18 +7194,18 @@ def update_semantic_store_refresh_schedule_none_details(ctx, from_json, force, w @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({'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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={'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'schemas': {'module': 'generative_ai', 'class': 'CreateSchemasDetails'}, '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': 'SemanticStore'}) @cli_util.wrap_exceptions -def update_semantic_store_refresh_schedule_interval_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, refresh_schedule_value, description, display_name, schemas, freeform_tags, defined_tags, if_match): +def update_semantic_store_refresh_schedule_interval_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, refresh_schedule_value, description, display_name, model_selection, is_user_defined_semantics_enabled, schemas, freeform_tags, defined_tags, if_match): if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') if not force: - if schemas or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to schemas and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if model_selection or schemas or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to model-selection and schemas and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -6783,6 +7223,12 @@ def update_semantic_store_refresh_schedule_interval_details(ctx, from_json, forc if display_name is not None: _details['displayName'] = display_name + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + if schemas is not None: _details['schemas'] = cli_util.parse_json_parameter("schemas", schemas) @@ -6831,6 +7277,8 @@ def update_semantic_store_refresh_schedule_interval_details(ctx, from_json, forc @cli_util.option('--schemas-schemas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Array of database schemas to be included in the connection. Each schema must define a name. A simple schema definition includes only the name, for example: { \"schemas\": [ { \"name\": \"HR\" } ] } Only one schema name is allowed now. Additional configuration options may be supported in extended forms later.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--description', help=u"""An optional description of the SemanticStore.""") @cli_util.option('--display-name', help=u"""A user-friendly name.""") +@cli_util.option('--model-selection', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-user-defined-semantics-enabled', type=click.BOOL, help=u"""Whether to include user-defined semantic inputs, such as annotations, comments, and synonyms, during semantic-store enrichment. When true, enrichment uses both metadata and user-defined semantics. When false, enrichment uses metadata only. If omitted, the existing setting is unchanged.""") @cli_util.option('--refresh-schedule', 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]. @@ -6843,18 +7291,18 @@ def update_semantic_store_refresh_schedule_interval_details(ctx, from_json, forc @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({'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}, 'schemas-schemas': {'module': 'generative_ai', 'class': 'list[SchemaItem]'}}) +@json_skeleton_utils.get_cli_json_input_option({'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}, 'schemas-schemas': {'module': 'generative_ai', 'class': 'list[SchemaItem]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}, 'schemas-schemas': {'module': 'generative_ai', 'class': 'list[SchemaItem]'}}, output_type={'module': 'generative_ai', 'class': 'SemanticStore'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'model-selection': {'module': 'generative_ai', 'class': 'SemanticStoreModelSelection'}, 'refresh-schedule': {'module': 'generative_ai', 'class': 'RefreshScheduleDetails'}, 'freeform-tags': {'module': 'generative_ai', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai', 'class': 'dict(str, dict(str, object))'}, 'schemas-schemas': {'module': 'generative_ai', 'class': 'list[SchemaItem]'}}, output_type={'module': 'generative_ai', 'class': 'SemanticStore'}) @cli_util.wrap_exceptions -def update_semantic_store_create_schemas_database_tools_connection_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, schemas_schemas, description, display_name, refresh_schedule, freeform_tags, defined_tags, if_match): +def update_semantic_store_create_schemas_database_tools_connection_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, schemas_schemas, description, display_name, model_selection, is_user_defined_semantics_enabled, refresh_schedule, freeform_tags, defined_tags, if_match): if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') if not force: - if refresh_schedule or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to refresh-schedule and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if model_selection or refresh_schedule or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to model-selection and refresh-schedule and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -6872,6 +7320,12 @@ def update_semantic_store_create_schemas_database_tools_connection_details(ctx, if display_name is not None: _details['displayName'] = display_name + if model_selection is not None: + _details['modelSelection'] = cli_util.parse_json_parameter("model_selection", model_selection) + + if is_user_defined_semantics_enabled is not None: + _details['isUserDefinedSemanticsEnabled'] = is_user_defined_semantics_enabled + if refresh_schedule is not None: _details['refreshSchedule'] = cli_util.parse_json_parameter("refresh_schedule", refresh_schedule) diff --git a/services/generative_ai_data/src/oci_cli_cancel_enrichment_job/generated/cancelenrichmentjob_cli.py b/services/generative_ai_data/src/oci_cli_cancel_enrichment_job/generated/cancelenrichmentjob_cli.py deleted file mode 100644 index f5aff6d19..000000000 --- a/services/generative_ai_data/src/oci_cli_cancel_enrichment_job/generated/cancelenrichmentjob_cli.py +++ /dev/null @@ -1,62 +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: 20260325 - -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.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli - - -@click.command(cli_util.override('cancel_enrichment_job.cancel_enrichment_job_root_group.command_name', 'cancel-enrichment-job'), cls=CommandGroupWithAlias, help=cli_util.override('cancel_enrichment_job.cancel_enrichment_job_root_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('cancel_enrichment_job.cancel_enrichment_job_root_group.short_help', """Generative AI Service NL2SQL API""")) -@cli_util.help_option_group -def cancel_enrichment_job_root_group(): - pass - - -@click.command(cli_util.override('cancel_enrichment_job.enrichment_job_group.command_name', 'enrichment-job'), cls=CommandGroupWithAlias, help="""Object representing to EnrichmentJob. ocidEntityType: generativeaiEnrichmentJob adLocality: regional""") -@cli_util.help_option_group -def enrichment_job_group(): - pass - - -generative_ai_data_service_cli.generative_ai_data_service_group.add_command(cancel_enrichment_job_root_group) -cancel_enrichment_job_root_group.add_command(enrichment_job_group) - - -@enrichment_job_group.command(name=cli_util.override('cancel_enrichment_job.cancel_enrichment_job.command_name', 'cancel'), help=u"""Cancels an EnrichmentJob resource by identifier. \n[Command Reference](cancelEnrichmentJob)""") -@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") -@cli_util.option('--enrichment-job-id', required=True, help=u"""The OCID of the enrichment job""") -@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 cancel_enrichment_job(ctx, from_json, semantic_store_id, enrichment_job_id, if_match): - - if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: - raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') - - if isinstance(enrichment_job_id, six.string_types) and len(enrichment_job_id.strip()) == 0: - raise click.UsageError('Parameter --enrichment-job-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_data', 'cancel_enrichment_job', ctx) - result = client.cancel_enrichment_job( - semantic_store_id=semantic_store_id, - enrichment_job_id=enrichment_job_id, - **kwargs - ) - cli_util.render_response(result, ctx) diff --git a/services/generative_ai_data/src/oci_cli_cancel_enrichment_job/__init__.py b/services/generative_ai_data/src/oci_cli_enrichment_job/__init__.py similarity index 100% rename from services/generative_ai_data/src/oci_cli_cancel_enrichment_job/__init__.py rename to services/generative_ai_data/src/oci_cli_enrichment_job/__init__.py diff --git a/services/generative_ai_data/src/oci_cli_enrichment_job/enrichmentjob_cli_extended.py b/services/generative_ai_data/src/oci_cli_enrichment_job/enrichmentjob_cli_extended.py new file mode 100644 index 000000000..4d598c110 --- /dev/null +++ b/services/generative_ai_data/src/oci_cli_enrichment_job/enrichmentjob_cli_extended.py @@ -0,0 +1,168 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. + +from __future__ import print_function +import click +import oci +import six +import sys +from oci_cli import cli_util +from oci_cli import custom_types +from oci_cli import json_skeleton_utils +from services.generative_ai_data.src.oci_cli_enrichment_job.generated import enrichmentjob_cli +from services.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli + + +cli_util.rename_command( + enrichmentjob_cli, + generative_ai_data_service_cli.generative_ai_data_service_group, + enrichmentjob_cli.enrichment_job_root_group, + "enrichment-jobs" +) + +enrichmentjob_cli.enrichment_job_root_group.commands.pop(enrichmentjob_cli.enrichment_job_group.name) +enrichmentjob_cli.enrichment_job_root_group.commands.pop(enrichmentjob_cli.enrichment_job_collection_group.name) + +enrichmentjob_cli.enrichment_job_root_group.add_command(enrichmentjob_cli.cancel_enrichment_job) +enrichmentjob_cli.enrichment_job_root_group.add_command(enrichmentjob_cli.generate_enrichment_job) +enrichmentjob_cli.enrichment_job_root_group.add_command(enrichmentjob_cli.generate_enrichment_job_delta_refresh_enrichment_job_configuration) +enrichmentjob_cli.enrichment_job_root_group.add_command(enrichmentjob_cli.generate_enrichment_job_full_build_enrichment_job_configuration) +enrichmentjob_cli.enrichment_job_root_group.add_command(enrichmentjob_cli.generate_enrichment_job_partial_build_enrichment_job_configuration) +enrichmentjob_cli.enrichment_job_root_group.add_command(enrichmentjob_cli.get_enrichment_job) +enrichmentjob_cli.enrichment_job_root_group.add_command(enrichmentjob_cli.list_enrichment_jobs) + +cli_util.rename_command(enrichmentjob_cli, enrichmentjob_cli.enrichment_job_root_group, enrichmentjob_cli.list_enrichment_jobs, "list") +cli_util.rename_command(enrichmentjob_cli, enrichmentjob_cli.enrichment_job_root_group, enrichmentjob_cli.generate_enrichment_job_full_build_enrichment_job_configuration, "generate-full-build") +cli_util.rename_command(enrichmentjob_cli, enrichmentjob_cli.enrichment_job_root_group, enrichmentjob_cli.generate_enrichment_job_partial_build_enrichment_job_configuration, "generate-partial-build") +cli_util.rename_command(enrichmentjob_cli, enrichmentjob_cli.enrichment_job_root_group, enrichmentjob_cli.generate_enrichment_job_delta_refresh_enrichment_job_configuration, "generate-delta-refresh") + + +@cli_util.copy_params_from_generated_command(enrichmentjob_cli.cancel_enrichment_job, params_to_exclude=['enrichment_job_id']) +@enrichmentjob_cli.enrichment_job_root_group.command(name=enrichmentjob_cli.cancel_enrichment_job.name, help=enrichmentjob_cli.cancel_enrichment_job.help) +@cli_util.option('--job-id', required=True, help=u"""The OCID of the enrichment job.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def cancel_enrichment_job_extended(ctx, **kwargs): + enrichment_job_id = kwargs.pop('job_id') + semantic_store_id = kwargs.pop('semantic_store_id') + if_match = kwargs.pop('if_match', None) + wait_for_state = kwargs.pop('wait_for_state', None) + max_wait_seconds = kwargs.pop('max_wait_seconds', None) + wait_interval_seconds = kwargs.pop('wait_interval_seconds', None) + kwargs.pop('from_json', None) + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') + + if isinstance(enrichment_job_id, six.string_types) and len(enrichment_job_id.strip()) == 0: + raise click.UsageError('Parameter --job-id cannot be whitespace or empty string') + + operation_kwargs = {} + if if_match is not None: + operation_kwargs['if_match'] = if_match + operation_kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + client = cli_util.build_client('generative_ai_data', 'enrichment_job', ctx) + result = client.cancel_enrichment_job( + semantic_store_id=semantic_store_id, + enrichment_job_id=enrichment_job_id, + **operation_kwargs + ) + + if wait_for_state: + 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_enrichment_job(semantic_store_id, enrichment_job_id), + 'lifecycle_state', + wait_for_state, + **wait_period_kwargs + ) + except oci.exceptions.MaximumWaitTimeExceeded: + 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 + + cli_util.render_response(result, ctx) + + +@cli_util.copy_params_from_generated_command(enrichmentjob_cli.generate_enrichment_job, params_to_exclude=['enrichment_job_configuration']) +@enrichmentjob_cli.enrichment_job_root_group.command(name=enrichmentjob_cli.generate_enrichment_job.name, help=enrichmentjob_cli.generate_enrichment_job.help) +@cli_util.option('--configuration', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'configuration': {'module': 'generative_ai_data', 'class': 'EnrichmentJobConfiguration'}, 'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def generate_enrichment_job_extended(ctx, **kwargs): + kwargs['enrichment_job_configuration'] = kwargs.pop('configuration') + ctx.invoke(enrichmentjob_cli.generate_enrichment_job, **kwargs) + + +@cli_util.copy_params_from_generated_command(enrichmentjob_cli.generate_enrichment_job_full_build_enrichment_job_configuration, params_to_exclude=['enrichment_job_configuration_schema_name', 'enrichment_job_type']) +@enrichmentjob_cli.enrichment_job_root_group.command(name=enrichmentjob_cli.generate_enrichment_job_full_build_enrichment_job_configuration.name, help=enrichmentjob_cli.generate_enrichment_job_full_build_enrichment_job_configuration.help) +@cli_util.option('--schema-name', required=True, help=u"""Name of the DB Schema to be enriched.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def generate_enrichment_job_full_build_extended(ctx, **kwargs): + kwargs['enrichment_job_configuration_schema_name'] = kwargs.pop('schema_name') + ctx.invoke(enrichmentjob_cli.generate_enrichment_job_full_build_enrichment_job_configuration, **kwargs) + + +@cli_util.copy_params_from_generated_command(enrichmentjob_cli.generate_enrichment_job_partial_build_enrichment_job_configuration, params_to_exclude=['enrichment_job_configuration_schema_name', 'enrichment_job_configuration_database_objects', 'enrichment_job_type']) +@enrichmentjob_cli.enrichment_job_root_group.command(name=enrichmentjob_cli.generate_enrichment_job_partial_build_enrichment_job_configuration.name, help=enrichmentjob_cli.generate_enrichment_job_partial_build_enrichment_job_configuration.help) +@cli_util.option('--database-objects', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of the DatabaseObjects to be enriched for the given schema.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--schema-name', required=True, help=u"""Name of the DB Schema to be enriched.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'database-objects': {'module': 'generative_ai_data', 'class': 'list[DatabaseObject]'}, 'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def generate_enrichment_job_partial_build_extended(ctx, **kwargs): + kwargs['enrichment_job_configuration_schema_name'] = kwargs.pop('schema_name') + kwargs['enrichment_job_configuration_database_objects'] = kwargs.pop('database_objects') + ctx.invoke(enrichmentjob_cli.generate_enrichment_job_partial_build_enrichment_job_configuration, **kwargs) + + +@cli_util.copy_params_from_generated_command(enrichmentjob_cli.generate_enrichment_job_delta_refresh_enrichment_job_configuration, params_to_exclude=['enrichment_job_configuration_schema_name', 'enrichment_job_configuration_delta_refresh_schedule', 'enrichment_job_type']) +@enrichmentjob_cli.enrichment_job_root_group.command(name=enrichmentjob_cli.generate_enrichment_job_delta_refresh_enrichment_job_configuration.name, help=enrichmentjob_cli.generate_enrichment_job_delta_refresh_enrichment_job_configuration.help) +@cli_util.option('--schema-name', required=True, help=u"""Name of the DB Schema to be enriched.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def generate_enrichment_job_delta_refresh_extended(ctx, **kwargs): + kwargs['enrichment_job_configuration_schema_name'] = kwargs.pop('schema_name') + ctx.invoke(enrichmentjob_cli.generate_enrichment_job_delta_refresh_enrichment_job_configuration, **kwargs) + + +@cli_util.copy_params_from_generated_command(enrichmentjob_cli.get_enrichment_job, params_to_exclude=['enrichment_job_id']) +@enrichmentjob_cli.enrichment_job_root_group.command(name=enrichmentjob_cli.get_enrichment_job.name, help=enrichmentjob_cli.get_enrichment_job.help) +@cli_util.option('--job-id', required=True, help=u"""The OCID of the enrichment job.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def get_enrichment_job_extended(ctx, **kwargs): + kwargs['enrichment_job_id'] = kwargs.pop('job_id') + ctx.invoke(enrichmentjob_cli.get_enrichment_job, **kwargs) + + +def _normalize_choice_params(command): + for param in getattr(command, 'params', []): + choices = getattr(getattr(param, 'type', None), 'choices', None) + if isinstance(choices, tuple): + param.type.choices = list(choices) + + for child in getattr(command, 'commands', {}).values(): + _normalize_choice_params(child) + + +_normalize_choice_params(enrichmentjob_cli.enrichment_job_root_group) diff --git a/services/generative_ai_data/src/oci_cli_cancel_enrichment_job/generated/__init__.py b/services/generative_ai_data/src/oci_cli_enrichment_job/generated/__init__.py similarity index 100% rename from services/generative_ai_data/src/oci_cli_cancel_enrichment_job/generated/__init__.py rename to services/generative_ai_data/src/oci_cli_enrichment_job/generated/__init__.py diff --git a/services/generative_ai_data/src/oci_cli_get_enrichment_job/generated/client_mappings.py b/services/generative_ai_data/src/oci_cli_enrichment_job/generated/client_mappings.py similarity index 84% rename from services/generative_ai_data/src/oci_cli_get_enrichment_job/generated/client_mappings.py rename to services/generative_ai_data/src/oci_cli_enrichment_job/generated/client_mappings.py index 2dd64731a..c0f930f4d 100644 --- a/services/generative_ai_data/src/oci_cli_get_enrichment_job/generated/client_mappings.py +++ b/services/generative_ai_data/src/oci_cli_enrichment_job/generated/client_mappings.py @@ -6,9 +6,9 @@ import oci from oci_cli.cli_clients import CLIENT_MAP from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.generative_ai_data import GetEnrichmentJobClient +from oci.generative_ai_data import EnrichmentJobClient MODULE_TO_TYPE_MAPPINGS["generative_ai_data"] = oci.generative_ai_data.models.generative_ai_data_type_mapping if CLIENT_MAP.get("generative_ai_data") is None: CLIENT_MAP["generative_ai_data"] = {} -CLIENT_MAP["generative_ai_data"]["get_enrichment_job"] = GetEnrichmentJobClient +CLIENT_MAP["generative_ai_data"]["enrichment_job"] = EnrichmentJobClient diff --git a/services/generative_ai_data/src/oci_cli_enrichment_job/generated/enrichmentjob_cli.py b/services/generative_ai_data/src/oci_cli_enrichment_job/generated/enrichmentjob_cli.py new file mode 100644 index 000000000..007702a3e --- /dev/null +++ b/services/generative_ai_data/src/oci_cli_enrichment_job/generated/enrichmentjob_cli.py @@ -0,0 +1,408 @@ +# 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: 20260325 + +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.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli + + +@click.command(cli_util.override('enrichment_job.enrichment_job_root_group.command_name', 'enrichment-job'), cls=CommandGroupWithAlias, help=cli_util.override('enrichment_job.enrichment_job_root_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('enrichment_job.enrichment_job_root_group.short_help', """Generative AI Service NL2SQL API""")) +@cli_util.help_option_group +def enrichment_job_root_group(): + pass + + +@click.command(cli_util.override('enrichment_job.enrichment_job_group.command_name', 'enrichment-job'), cls=CommandGroupWithAlias, help="""Object representing to EnrichmentJob. ocidEntityType: generativeaisemanticstorejob adLocality: regional""") +@cli_util.help_option_group +def enrichment_job_group(): + pass + + +@click.command(cli_util.override('enrichment_job.enrichment_job_collection_group.command_name', 'enrichment-job-collection'), cls=CommandGroupWithAlias, help="""Object representing list of EnrichmentJobSummaries.""") +@cli_util.help_option_group +def enrichment_job_collection_group(): + pass + + +generative_ai_data_service_cli.generative_ai_data_service_group.add_command(enrichment_job_root_group) +enrichment_job_root_group.add_command(enrichment_job_group) +enrichment_job_root_group.add_command(enrichment_job_collection_group) + + +@enrichment_job_group.command(name=cli_util.override('enrichment_job.cancel_enrichment_job.command_name', 'cancel'), help=u"""Cancels an EnrichmentJob resource by identifier. The returned job includes the modelId used for enrichment. \n[Command Reference](cancelEnrichmentJob)""") +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--enrichment-job-id', required=True, help=u"""The OCID of the enrichment job""") +@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"]), 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 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 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': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def cancel_enrichment_job(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, semantic_store_id, enrichment_job_id, if_match): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') + + if isinstance(enrichment_job_id, six.string_types) and len(enrichment_job_id.strip()) == 0: + raise click.UsageError('Parameter --enrichment-job-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_data', 'enrichment_job', ctx) + result = client.cancel_enrichment_job( + semantic_store_id=semantic_store_id, + enrichment_job_id=enrichment_job_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_enrichment_job') and callable(getattr(client, 'get_enrichment_job')): + 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_enrichment_job(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) + + +@enrichment_job_group.command(name=cli_util.override('enrichment_job.generate_enrichment_job.command_name', 'generate'), help=u"""Creates a new asynchronous EnrichmentJob. The returned job includes the modelId used for enrichment. \n[Command Reference](generateEnrichmentJob)""") +@cli_util.option('--enrichment-job-configuration', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--description', help=u"""An optional description of the EnrichmentJob.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") +@cli_util.option('--enrichment-job-type', type=custom_types.CliCaseInsensitiveChoice(["FULL_BUILD", "PARTIAL_BUILD", "DELTA_REFRESH"]), help=u"""Deprecated. Use EnrichmentJobConfiguration.enrichmentJobType instead.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'enrichment-job-configuration': {'module': 'generative_ai_data', 'class': 'EnrichmentJobConfiguration'}, 'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', '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={'enrichment-job-configuration': {'module': 'generative_ai_data', 'class': 'EnrichmentJobConfiguration'}, 'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def generate_enrichment_job(ctx, from_json, enrichment_job_configuration, semantic_store_id, description, display_name, enrichment_job_type, freeform_tags, defined_tags, if_match): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-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['enrichmentJobConfiguration'] = cli_util.parse_json_parameter("enrichment_job_configuration", enrichment_job_configuration) + + if description is not None: + _details['description'] = description + + if display_name is not None: + _details['displayName'] = display_name + + if enrichment_job_type is not None: + _details['enrichmentJobType'] = enrichment_job_type + + 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_data', 'enrichment_job', ctx) + result = client.generate_enrichment_job( + semantic_store_id=semantic_store_id, + generate_enrichment_job_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@enrichment_job_group.command(name=cli_util.override('enrichment_job.generate_enrichment_job_delta_refresh_enrichment_job_configuration.command_name', 'generate-enrichment-job-delta-refresh-enrichment-job-configuration'), help=u"""Creates a new asynchronous EnrichmentJob. The returned job includes the modelId used for enrichment. \n[Command Reference](generateEnrichmentJob)""") +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--enrichment-job-configuration-schema-name', required=True, help=u"""Name of the DB Schema to be enriched""") +@cli_util.option('--description', help=u"""An optional description of the EnrichmentJob.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") +@cli_util.option('--enrichment-job-type', type=custom_types.CliCaseInsensitiveChoice(["FULL_BUILD", "PARTIAL_BUILD", "DELTA_REFRESH"]), help=u"""Deprecated. Use EnrichmentJobConfiguration.enrichmentJobType instead.""") +@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('--enrichment-job-configuration-delta-refresh-schedule', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Deprecated schedule for occurrences of Delta Refresh jobs. This value is not used by the service.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}, 'enrichment-job-configuration-delta-refresh-schedule': {'module': 'generative_ai_data', 'class': 'object'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}, 'enrichment-job-configuration-delta-refresh-schedule': {'module': 'generative_ai_data', 'class': 'object'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def generate_enrichment_job_delta_refresh_enrichment_job_configuration(ctx, from_json, semantic_store_id, enrichment_job_configuration_schema_name, description, display_name, enrichment_job_type, freeform_tags, defined_tags, if_match, enrichment_job_configuration_delta_refresh_schedule): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-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['enrichmentJobConfiguration'] = {} + _details['enrichmentJobConfiguration']['schemaName'] = enrichment_job_configuration_schema_name + + if description is not None: + _details['description'] = description + + if display_name is not None: + _details['displayName'] = display_name + + if enrichment_job_type is not None: + _details['enrichmentJobType'] = enrichment_job_type + + 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 enrichment_job_configuration_delta_refresh_schedule is not None: + _details['enrichmentJobConfiguration']['deltaRefreshSchedule'] = cli_util.parse_json_parameter("enrichment_job_configuration_delta_refresh_schedule", enrichment_job_configuration_delta_refresh_schedule) + + _details['enrichmentJobConfiguration']['enrichmentJobType'] = 'DELTA_REFRESH' + + client = cli_util.build_client('generative_ai_data', 'enrichment_job', ctx) + result = client.generate_enrichment_job( + semantic_store_id=semantic_store_id, + generate_enrichment_job_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@enrichment_job_group.command(name=cli_util.override('enrichment_job.generate_enrichment_job_partial_build_enrichment_job_configuration.command_name', 'generate-enrichment-job-partial-build-enrichment-job-configuration'), help=u"""Creates a new asynchronous EnrichmentJob. The returned job includes the modelId used for enrichment. \n[Command Reference](generateEnrichmentJob)""") +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--enrichment-job-configuration-schema-name', required=True, help=u"""Name of the DB Schema to be enriched""") +@cli_util.option('--enrichment-job-configuration-database-objects', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of the DatabaseObjects to be enriched for the given schema.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--description', help=u"""An optional description of the EnrichmentJob.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") +@cli_util.option('--enrichment-job-type', type=custom_types.CliCaseInsensitiveChoice(["FULL_BUILD", "PARTIAL_BUILD", "DELTA_REFRESH"]), help=u"""Deprecated. Use EnrichmentJobConfiguration.enrichmentJobType instead.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}, 'enrichment-job-configuration-database-objects': {'module': 'generative_ai_data', 'class': 'list[DatabaseObject]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}, 'enrichment-job-configuration-database-objects': {'module': 'generative_ai_data', 'class': 'list[DatabaseObject]'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def generate_enrichment_job_partial_build_enrichment_job_configuration(ctx, from_json, semantic_store_id, enrichment_job_configuration_schema_name, enrichment_job_configuration_database_objects, description, display_name, enrichment_job_type, freeform_tags, defined_tags, if_match): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-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['enrichmentJobConfiguration'] = {} + _details['enrichmentJobConfiguration']['schemaName'] = enrichment_job_configuration_schema_name + _details['enrichmentJobConfiguration']['databaseObjects'] = cli_util.parse_json_parameter("enrichment_job_configuration_database_objects", enrichment_job_configuration_database_objects) + + if description is not None: + _details['description'] = description + + if display_name is not None: + _details['displayName'] = display_name + + if enrichment_job_type is not None: + _details['enrichmentJobType'] = enrichment_job_type + + 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['enrichmentJobConfiguration']['enrichmentJobType'] = 'PARTIAL_BUILD' + + client = cli_util.build_client('generative_ai_data', 'enrichment_job', ctx) + result = client.generate_enrichment_job( + semantic_store_id=semantic_store_id, + generate_enrichment_job_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@enrichment_job_group.command(name=cli_util.override('enrichment_job.generate_enrichment_job_full_build_enrichment_job_configuration.command_name', 'generate-enrichment-job-full-build-enrichment-job-configuration'), help=u"""Creates a new asynchronous EnrichmentJob. The returned job includes the modelId used for enrichment. \n[Command Reference](generateEnrichmentJob)""") +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--enrichment-job-configuration-schema-name', required=True, help=u"""Name of the DB Schema to be enriched""") +@cli_util.option('--description', help=u"""An optional description of the EnrichmentJob.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") +@cli_util.option('--enrichment-job-type', type=custom_types.CliCaseInsensitiveChoice(["FULL_BUILD", "PARTIAL_BUILD", "DELTA_REFRESH"]), help=u"""Deprecated. Use EnrichmentJobConfiguration.enrichmentJobType instead.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', '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': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def generate_enrichment_job_full_build_enrichment_job_configuration(ctx, from_json, semantic_store_id, enrichment_job_configuration_schema_name, description, display_name, enrichment_job_type, freeform_tags, defined_tags, if_match): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-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['enrichmentJobConfiguration'] = {} + _details['enrichmentJobConfiguration']['schemaName'] = enrichment_job_configuration_schema_name + + if description is not None: + _details['description'] = description + + if display_name is not None: + _details['displayName'] = display_name + + if enrichment_job_type is not None: + _details['enrichmentJobType'] = enrichment_job_type + + 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['enrichmentJobConfiguration']['enrichmentJobType'] = 'FULL_BUILD' + + client = cli_util.build_client('generative_ai_data', 'enrichment_job', ctx) + result = client.generate_enrichment_job( + semantic_store_id=semantic_store_id, + generate_enrichment_job_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@enrichment_job_group.command(name=cli_util.override('enrichment_job.get_enrichment_job.command_name', 'get'), help=u"""Gets an EnrichmentJob by identifier. The returned job includes the modelId used for enrichment. \n[Command Reference](getEnrichmentJob)""") +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--enrichment-job-id', required=True, help=u"""The OCID of the enrichment job""") +@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_data', 'class': 'EnrichmentJob'}) +@cli_util.wrap_exceptions +def get_enrichment_job(ctx, from_json, semantic_store_id, enrichment_job_id): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') + + if isinstance(enrichment_job_id, six.string_types) and len(enrichment_job_id.strip()) == 0: + raise click.UsageError('Parameter --enrichment-job-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_data', 'enrichment_job', ctx) + result = client.get_enrichment_job( + semantic_store_id=semantic_store_id, + enrichment_job_id=enrichment_job_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@enrichment_job_collection_group.command(name=cli_util.override('enrichment_job.list_enrichment_jobs.command_name', 'list-enrichment-jobs'), help=u"""Lists EnrichmentJobs in a semantic store. Each returned job summary includes the modelId used for enrichment. \n[Command Reference](listEnrichmentJobs)""") +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@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(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), 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-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-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.""") +@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_data', 'class': 'EnrichmentJobCollection'}) +@cli_util.wrap_exceptions +def list_enrichment_jobs(ctx, from_json, all_pages, page_size, semantic_store_id, compartment_id, display_name, lifecycle_state, limit, page, sort_by, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') + + kwargs = {} + 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_by is not None: + kwargs['sort_by'] = sort_by + 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('generative_ai_data', 'enrichment_job', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_enrichment_jobs, + semantic_store_id=semantic_store_id, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_enrichment_jobs, + limit, + page_size, + semantic_store_id=semantic_store_id, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_enrichment_jobs( + semantic_store_id=semantic_store_id, + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) diff --git a/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generated/client_mappings.py b/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generated/client_mappings.py deleted file mode 100644 index 66cf664d0..000000000 --- a/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generated/client_mappings.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: 20260325 - -import oci -from oci_cli.cli_clients import CLIENT_MAP -from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.generative_ai_data import GenerateEnrichmentJobClient - -MODULE_TO_TYPE_MAPPINGS["generative_ai_data"] = oci.generative_ai_data.models.generative_ai_data_type_mapping -if CLIENT_MAP.get("generative_ai_data") is None: - CLIENT_MAP["generative_ai_data"] = {} -CLIENT_MAP["generative_ai_data"]["generate_enrichment_job"] = GenerateEnrichmentJobClient diff --git a/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generated/generateenrichmentjob_cli.py b/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generated/generateenrichmentjob_cli.py deleted file mode 100644 index 87a316084..000000000 --- a/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generated/generateenrichmentjob_cli.py +++ /dev/null @@ -1,241 +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: 20260325 - -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.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli - - -@click.command(cli_util.override('generate_enrichment_job.generate_enrichment_job_root_group.command_name', 'generate-enrichment-job'), cls=CommandGroupWithAlias, help=cli_util.override('generate_enrichment_job.generate_enrichment_job_root_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('generate_enrichment_job.generate_enrichment_job_root_group.short_help', """Generative AI Service NL2SQL API""")) -@cli_util.help_option_group -def generate_enrichment_job_root_group(): - pass - - -@click.command(cli_util.override('generate_enrichment_job.enrichment_job_group.command_name', 'enrichment-job'), cls=CommandGroupWithAlias, help="""Object representing to EnrichmentJob. ocidEntityType: generativeaiEnrichmentJob adLocality: regional""") -@cli_util.help_option_group -def enrichment_job_group(): - pass - - -generative_ai_data_service_cli.generative_ai_data_service_group.add_command(generate_enrichment_job_root_group) -generate_enrichment_job_root_group.add_command(enrichment_job_group) - - -@enrichment_job_group.command(name=cli_util.override('generate_enrichment_job.generate_enrichment_job.command_name', 'generate'), help=u"""Creates a new asynchronous EnrichmentJob. \n[Command Reference](generateEnrichmentJob)""") -@cli_util.option('--enrichment-job-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL_BUILD", "PARTIAL_BUILD", "DELTA_REFRESH"]), help=u"""Enrichment job type. Currently supported Full Build (All supported objects in a given schema) and Partial Build (Selected tables and/or supported objects in a given schema).""") -@cli_util.option('--enrichment-job-configuration', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") -@cli_util.option('--description', help=u"""An optional description of the EnrichmentJob.""") -@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'enrichment-job-configuration': {'module': 'generative_ai_data', 'class': 'EnrichmentJobConfiguration'}, 'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', '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={'enrichment-job-configuration': {'module': 'generative_ai_data', 'class': 'EnrichmentJobConfiguration'}, 'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) -@cli_util.wrap_exceptions -def generate_enrichment_job(ctx, from_json, enrichment_job_type, enrichment_job_configuration, semantic_store_id, description, display_name, freeform_tags, defined_tags, if_match): - - if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: - raise click.UsageError('Parameter --semantic-store-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['enrichmentJobType'] = enrichment_job_type - _details['enrichmentJobConfiguration'] = cli_util.parse_json_parameter("enrichment_job_configuration", enrichment_job_configuration) - - if description is not None: - _details['description'] = description - - 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('generative_ai_data', 'generate_enrichment_job', ctx) - result = client.generate_enrichment_job( - semantic_store_id=semantic_store_id, - generate_enrichment_job_details=_details, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@enrichment_job_group.command(name=cli_util.override('generate_enrichment_job.generate_enrichment_job_delta_refresh_enrichment_job_configuration.command_name', 'generate-enrichment-job-delta-refresh-enrichment-job-configuration'), help=u"""Creates a new asynchronous EnrichmentJob. \n[Command Reference](generateEnrichmentJob)""") -@cli_util.option('--enrichment-job-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL_BUILD", "PARTIAL_BUILD", "DELTA_REFRESH"]), help=u"""Enrichment job type. Currently supported Full Build (All supported objects in a given schema) and Partial Build (Selected tables and/or supported objects in a given schema).""") -@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") -@cli_util.option('--enrichment-job-configuration-schema-name', required=True, help=u"""Name of the DB Schema to be enriched""") -@cli_util.option('--enrichment-job-configuration-delta-refresh-schedule', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Schedule for occurrences of Delta Refresh jobs""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--description', help=u"""An optional description of the EnrichmentJob.""") -@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}, 'enrichment-job-configuration-delta-refresh-schedule': {'module': 'generative_ai_data', 'class': 'object'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}, 'enrichment-job-configuration-delta-refresh-schedule': {'module': 'generative_ai_data', 'class': 'object'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) -@cli_util.wrap_exceptions -def generate_enrichment_job_delta_refresh_enrichment_job_configuration(ctx, from_json, enrichment_job_type, semantic_store_id, enrichment_job_configuration_schema_name, enrichment_job_configuration_delta_refresh_schedule, description, display_name, freeform_tags, defined_tags, if_match): - - if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: - raise click.UsageError('Parameter --semantic-store-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['enrichmentJobConfiguration'] = {} - _details['enrichmentJobType'] = enrichment_job_type - _details['enrichmentJobConfiguration']['schemaName'] = enrichment_job_configuration_schema_name - _details['enrichmentJobConfiguration']['deltaRefreshSchedule'] = cli_util.parse_json_parameter("enrichment_job_configuration_delta_refresh_schedule", enrichment_job_configuration_delta_refresh_schedule) - - if description is not None: - _details['description'] = description - - 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) - - _details['enrichmentJobConfiguration']['enrichmentJobType'] = 'DELTA_REFRESH' - - client = cli_util.build_client('generative_ai_data', 'generate_enrichment_job', ctx) - result = client.generate_enrichment_job( - semantic_store_id=semantic_store_id, - generate_enrichment_job_details=_details, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@enrichment_job_group.command(name=cli_util.override('generate_enrichment_job.generate_enrichment_job_partial_build_enrichment_job_configuration.command_name', 'generate-enrichment-job-partial-build-enrichment-job-configuration'), help=u"""Creates a new asynchronous EnrichmentJob. \n[Command Reference](generateEnrichmentJob)""") -@cli_util.option('--enrichment-job-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL_BUILD", "PARTIAL_BUILD", "DELTA_REFRESH"]), help=u"""Enrichment job type. Currently supported Full Build (All supported objects in a given schema) and Partial Build (Selected tables and/or supported objects in a given schema).""") -@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") -@cli_util.option('--enrichment-job-configuration-schema-name', required=True, help=u"""Name of the DB Schema to be enriched""") -@cli_util.option('--enrichment-job-configuration-database-objects', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Collection of the DatabaseObjects to be enriched for the given schema.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--description', help=u"""An optional description of the EnrichmentJob.""") -@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}, 'enrichment-job-configuration-database-objects': {'module': 'generative_ai_data', 'class': 'list[DatabaseObject]'}}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}, 'enrichment-job-configuration-database-objects': {'module': 'generative_ai_data', 'class': 'list[DatabaseObject]'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) -@cli_util.wrap_exceptions -def generate_enrichment_job_partial_build_enrichment_job_configuration(ctx, from_json, enrichment_job_type, semantic_store_id, enrichment_job_configuration_schema_name, enrichment_job_configuration_database_objects, description, display_name, freeform_tags, defined_tags, if_match): - - if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: - raise click.UsageError('Parameter --semantic-store-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['enrichmentJobConfiguration'] = {} - _details['enrichmentJobType'] = enrichment_job_type - _details['enrichmentJobConfiguration']['schemaName'] = enrichment_job_configuration_schema_name - _details['enrichmentJobConfiguration']['databaseObjects'] = cli_util.parse_json_parameter("enrichment_job_configuration_database_objects", enrichment_job_configuration_database_objects) - - if description is not None: - _details['description'] = description - - 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) - - _details['enrichmentJobConfiguration']['enrichmentJobType'] = 'PARTIAL_BUILD' - - client = cli_util.build_client('generative_ai_data', 'generate_enrichment_job', ctx) - result = client.generate_enrichment_job( - semantic_store_id=semantic_store_id, - generate_enrichment_job_details=_details, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@enrichment_job_group.command(name=cli_util.override('generate_enrichment_job.generate_enrichment_job_full_build_enrichment_job_configuration.command_name', 'generate-enrichment-job-full-build-enrichment-job-configuration'), help=u"""Creates a new asynchronous EnrichmentJob. \n[Command Reference](generateEnrichmentJob)""") -@cli_util.option('--enrichment-job-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL_BUILD", "PARTIAL_BUILD", "DELTA_REFRESH"]), help=u"""Enrichment job type. Currently supported Full Build (All supported objects in a given schema) and Partial Build (Selected tables and/or supported objects in a given schema).""") -@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") -@cli_util.option('--enrichment-job-configuration-schema-name', required=True, help=u"""Name of the DB Schema to be enriched""") -@cli_util.option('--description', help=u"""An optional description of the EnrichmentJob.""") -@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', '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': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'EnrichmentJob'}) -@cli_util.wrap_exceptions -def generate_enrichment_job_full_build_enrichment_job_configuration(ctx, from_json, enrichment_job_type, semantic_store_id, enrichment_job_configuration_schema_name, description, display_name, freeform_tags, defined_tags, if_match): - - if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: - raise click.UsageError('Parameter --semantic-store-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['enrichmentJobConfiguration'] = {} - _details['enrichmentJobType'] = enrichment_job_type - _details['enrichmentJobConfiguration']['schemaName'] = enrichment_job_configuration_schema_name - - if description is not None: - _details['description'] = description - - 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) - - _details['enrichmentJobConfiguration']['enrichmentJobType'] = 'FULL_BUILD' - - client = cli_util.build_client('generative_ai_data', 'generate_enrichment_job', ctx) - result = client.generate_enrichment_job( - semantic_store_id=semantic_store_id, - generate_enrichment_job_details=_details, - **kwargs - ) - cli_util.render_response(result, ctx) diff --git a/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generateenrichmentjob_cli_extended.py b/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generateenrichmentjob_cli_extended.py deleted file mode 100644 index 18fd80817..000000000 --- a/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generateenrichmentjob_cli_extended.py +++ /dev/null @@ -1,22 +0,0 @@ -# # coding: utf-8 -# # Copyright (c) 2016, 2020, 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 click # noqa: F401 -# import json # noqa: F401 -# from services.generative_ai_data.src.oci_cli_generate_enrichment_job.generated import generateenrichmentjob_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 generate-enrichment-job-delta-refresh-enrichment-job-configuration from oci generative-ai-data generate-enrichment-job enrichment-job -# generateenrichmentjob_cli.enrichment_job_group.commands.pop(generateenrichmentjob_cli.generate_enrichment_job_delta_refresh_enrichment_job_configuration.name) -# -# -# # Remove generate-enrichment-job-full-build-enrichment-job-configuration from oci generative-ai-data generate-enrichment-job enrichment-job -# generateenrichmentjob_cli.enrichment_job_group.commands.pop(generateenrichmentjob_cli.generate_enrichment_job_full_build_enrichment_job_configuration.name) -# -# -# # Remove generate-enrichment-job-partial-build-enrichment-job-configuration from oci generative-ai-data generate-enrichment-job enrichment-job -# generateenrichmentjob_cli.enrichment_job_group.commands.pop(generateenrichmentjob_cli.generate_enrichment_job_partial_build_enrichment_job_configuration.name) diff --git a/services/generative_ai_data/src/oci_cli_generate_enrichment_job/__init__.py b/services/generative_ai_data/src/oci_cli_generate_sql/__init__.py similarity index 100% rename from services/generative_ai_data/src/oci_cli_generate_enrichment_job/__init__.py rename to services/generative_ai_data/src/oci_cli_generate_sql/__init__.py diff --git a/services/generative_ai_data/src/oci_cli_generate_enrichment_job/generated/__init__.py b/services/generative_ai_data/src/oci_cli_generate_sql/generated/__init__.py similarity index 100% rename from services/generative_ai_data/src/oci_cli_generate_enrichment_job/generated/__init__.py rename to services/generative_ai_data/src/oci_cli_generate_sql/generated/__init__.py diff --git a/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/generated/client_mappings.py b/services/generative_ai_data/src/oci_cli_generate_sql/generated/client_mappings.py similarity index 83% rename from services/generative_ai_data/src/oci_cli_list_enrichment_jobs/generated/client_mappings.py rename to services/generative_ai_data/src/oci_cli_generate_sql/generated/client_mappings.py index cd7a615ba..2cfb37c15 100644 --- a/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/generated/client_mappings.py +++ b/services/generative_ai_data/src/oci_cli_generate_sql/generated/client_mappings.py @@ -6,9 +6,9 @@ import oci from oci_cli.cli_clients import CLIENT_MAP from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.generative_ai_data import ListEnrichmentJobsClient +from oci.generative_ai_data import GenerateSqlClient MODULE_TO_TYPE_MAPPINGS["generative_ai_data"] = oci.generative_ai_data.models.generative_ai_data_type_mapping if CLIENT_MAP.get("generative_ai_data") is None: CLIENT_MAP["generative_ai_data"] = {} -CLIENT_MAP["generative_ai_data"]["list_enrichment_jobs"] = ListEnrichmentJobsClient +CLIENT_MAP["generative_ai_data"]["generate_sql"] = GenerateSqlClient diff --git a/services/generative_ai_data/src/oci_cli_generate_sql/generated/generatesql_cli.py b/services/generative_ai_data/src/oci_cli_generate_sql/generated/generatesql_cli.py new file mode 100644 index 000000000..f68adf614 --- /dev/null +++ b/services/generative_ai_data/src/oci_cli_generate_sql/generated/generatesql_cli.py @@ -0,0 +1,122 @@ +# 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: 20260325 + +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.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli + + +@click.command(cli_util.override('generate_sql.generate_sql_root_group.command_name', 'generate-sql'), cls=CommandGroupWithAlias, help=cli_util.override('generate_sql.generate_sql_root_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('generate_sql.generate_sql_root_group.short_help', """Generative AI Service NL2SQL API""")) +@cli_util.help_option_group +def generate_sql_root_group(): + pass + + +@click.command(cli_util.override('generate_sql.generate_sql_from_nl_job_group.command_name', 'generate-sql-from-nl-job'), cls=CommandGroupWithAlias, help="""Object representing to GenerateSqlFromNlJob. ocidEntityType: generativeaisemanticstorejob adLocality: regional""") +@cli_util.help_option_group +def generate_sql_from_nl_job_group(): + pass + + +generative_ai_data_service_cli.generative_ai_data_service_group.add_command(generate_sql_root_group) +generate_sql_root_group.add_command(generate_sql_from_nl_job_group) + + +@generate_sql_from_nl_job_group.command(name=cli_util.override('generate_sql.generate_sql_from_nl.command_name', 'generate-sql-from-nl'), help=u"""Generates a SQL query from a natural language input for the specified SemanticStore. + +This operation creates a GenerateSqlFromNlJob. The request can either be processed as a background job or wait for completion, depending on completionMode. + +If modelId is provided, the service validates it and uses it for schema-linking in table selection, SQL generation, and SQL refinement. If modelId is omitted, the service default model is used. The response includes the modelId used for generation. + +Clients should inspect lifecycleState in the response: - If lifecycleState is SUCCEEDED, SQL generation is complete and the result is available in jobOutput. - If lifecycleState is ACCEPTED or IN_PROGRESS, poll GetGenerateSqlFromNlJob using the returned job id. - If lifecycleState is FAILED or CANCELED, SQL generation did not complete. See lifecycleDetails for more information. + +The GetGenerateSqlFromNlJob endpoint is the source of truth for final job state and result availability. \n[Command Reference](generateSqlFromNl)""") +@cli_util.option('--input-natural-language-query', required=True, help=u"""A user-provided query or instruction written in plain, conversational language. This input is intended to capture the user's intent, question, or command without requiring technical syntax or structured formatting. The query should clearly express what the user wants to know or accomplish, allowing the system to interpret and respond appropriately.""") +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--description', help=u"""An optional description of the GenerateSqlFromNlJob.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") +@cli_util.option('--model-id', help=u"""The generative AI modelId to use for Generate SQL. You can use the ListModels API to list the available models. https://docs.oracle.com/en-us/iaas/api/#/en/generative-ai/20231130/ModelCollection/ListModels""") +@cli_util.option('--completion-mode', type=custom_types.CliCaseInsensitiveChoice(["WAIT_FOR_COMPLETION", "BACKGROUND_JOB"]), help=u"""Controls whether GenerateSqlFromNl should be accepted as a background job or wait for completion. BACKGROUND_JOB accepts the request for background processing and returns a pollable job. WAIT_FOR_COMPLETION waits for completion within the service-defined timeout.""") +@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.""") +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', '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': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'GenerateSqlFromNlJob'}) +@cli_util.wrap_exceptions +def generate_sql_from_nl(ctx, from_json, input_natural_language_query, semantic_store_id, description, display_name, model_id, completion_mode, freeform_tags, defined_tags, if_match): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-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['inputNaturalLanguageQuery'] = input_natural_language_query + + if description is not None: + _details['description'] = description + + if display_name is not None: + _details['displayName'] = display_name + + if model_id is not None: + _details['modelId'] = model_id + + if completion_mode is not None: + _details['completionMode'] = completion_mode + + 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_data', 'generate_sql', ctx) + result = client.generate_sql_from_nl( + semantic_store_id=semantic_store_id, + generate_sql_from_nl_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@generate_sql_from_nl_job_group.command(name=cli_util.override('generate_sql.get_generate_sql_from_nl_job.command_name', 'get'), help=u"""Retrieves the current state of a GenerateSqlFromNlJob. Clients should poll this endpoint until lifecycleState is SUCCEEDED or FAILED. When lifecycleState is SUCCEEDED, the result is available in jobOutput. The returned job includes the modelId used for generation. \n[Command Reference](getGenerateSqlFromNlJob)""") +@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") +@cli_util.option('--generate-sql-from-nl-job-id', required=True, help=u"""The OCID of the Semantic Store job for a GenerateSqlFromNl job.""") +@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_data', 'class': 'GenerateSqlFromNlJob'}) +@cli_util.wrap_exceptions +def get_generate_sql_from_nl_job(ctx, from_json, semantic_store_id, generate_sql_from_nl_job_id): + + if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: + raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') + + if isinstance(generate_sql_from_nl_job_id, six.string_types) and len(generate_sql_from_nl_job_id.strip()) == 0: + raise click.UsageError('Parameter --generate-sql-from-nl-job-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_data', 'generate_sql', ctx) + result = client.get_generate_sql_from_nl_job( + semantic_store_id=semantic_store_id, + generate_sql_from_nl_job_id=generate_sql_from_nl_job_id, + **kwargs + ) + cli_util.render_response(result, ctx) diff --git a/services/generative_ai_data/src/oci_cli_generate_sql/generatesql_cli_extended.py b/services/generative_ai_data/src/oci_cli_generate_sql/generatesql_cli_extended.py new file mode 100644 index 000000000..f59337a36 --- /dev/null +++ b/services/generative_ai_data/src/oci_cli_generate_sql/generatesql_cli_extended.py @@ -0,0 +1,57 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. + +import click +from oci_cli import cli_util +from oci_cli import json_skeleton_utils +from services.generative_ai_data.src.oci_cli_generate_sql.generated import generatesql_cli +from services.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli + + +cli_util.rename_command( + generatesql_cli, + generative_ai_data_service_cli.generative_ai_data_service_group, + generatesql_cli.generate_sql_root_group, + "generate-sql-jobs" +) + +generatesql_cli.generate_sql_root_group.commands.pop(generatesql_cli.generate_sql_from_nl_job_group.name) +generatesql_cli.generate_sql_root_group.add_command(generatesql_cli.generate_sql_from_nl) +generatesql_cli.generate_sql_root_group.add_command(generatesql_cli.get_generate_sql_from_nl_job) + +cli_util.rename_command(generatesql_cli, generatesql_cli.generate_sql_root_group, generatesql_cli.generate_sql_from_nl, "generate") + + +@cli_util.copy_params_from_generated_command(generatesql_cli.generate_sql_from_nl, params_to_exclude=['input_natural_language_query']) +@generatesql_cli.generate_sql_root_group.command(name=generatesql_cli.generate_sql_from_nl.name, help=generatesql_cli.generate_sql_from_nl.help) +@cli_util.option('--nl-query', required=True, help=u"""A user-provided query or instruction written in plain, conversational language.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'GenerateSqlFromNlJob'}) +def generate_sql_from_nl_extended(ctx, **kwargs): + kwargs['input_natural_language_query'] = kwargs.pop('nl_query') + ctx.obj.pop('missing_required_parameters', None) + ctx.invoke(generatesql_cli.generate_sql_from_nl, **kwargs) + + +@cli_util.copy_params_from_generated_command(generatesql_cli.get_generate_sql_from_nl_job, params_to_exclude=['generate_sql_from_nl_job_id']) +@generatesql_cli.generate_sql_root_group.command(name=generatesql_cli.get_generate_sql_from_nl_job.name, help=generatesql_cli.get_generate_sql_from_nl_job.help) +@cli_util.option('--job-id', required=True, help=u"""The OCID of the GenerateSqlFromNl job.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'generative_ai_data', 'class': 'GenerateSqlFromNlJob'}) +def get_generate_sql_from_nl_job_extended(ctx, **kwargs): + kwargs['generate_sql_from_nl_job_id'] = kwargs.pop('job_id') + ctx.obj.pop('missing_required_parameters', None) + ctx.invoke(generatesql_cli.get_generate_sql_from_nl_job, **kwargs) + + +def _normalize_choice_params(command): + for param in getattr(command, 'params', []): + choices = getattr(getattr(param, 'type', None), 'choices', None) + if isinstance(choices, tuple): + param.type.choices = list(choices) + + for child in getattr(command, 'commands', {}).values(): + _normalize_choice_params(child) + + +_normalize_choice_params(generatesql_cli.generate_sql_root_group) diff --git a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/client_mappings.py b/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/client_mappings.py deleted file mode 100644 index b481152c4..000000000 --- a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/client_mappings.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: 20260325 - -import oci -from oci_cli.cli_clients import CLIENT_MAP -from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.generative_ai_data import GenerateSqlFromNlJobClient - -MODULE_TO_TYPE_MAPPINGS["generative_ai_data"] = oci.generative_ai_data.models.generative_ai_data_type_mapping -if CLIENT_MAP.get("generative_ai_data") is None: - CLIENT_MAP["generative_ai_data"] = {} -CLIENT_MAP["generative_ai_data"]["generate_sql_from_nl_job"] = GenerateSqlFromNlJobClient diff --git a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/generatesqlfromnljob_cli.py b/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/generatesqlfromnljob_cli.py deleted file mode 100644 index 04db93a69..000000000 --- a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/generatesqlfromnljob_cli.py +++ /dev/null @@ -1,79 +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: 20260325 - -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.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli - - -@click.command(cli_util.override('generate_sql_from_nl_job.generate_sql_from_nl_job_root_group.command_name', 'generate-sql-from-nl-job'), cls=CommandGroupWithAlias, help=cli_util.override('generate_sql_from_nl_job.generate_sql_from_nl_job_root_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('generate_sql_from_nl_job.generate_sql_from_nl_job_root_group.short_help', """Generative AI Service NL2SQL API""")) -@cli_util.help_option_group -def generate_sql_from_nl_job_root_group(): - pass - - -@click.command(cli_util.override('generate_sql_from_nl_job.generate_sql_from_nl_job_group.command_name', 'generate-sql-from-nl-job'), cls=CommandGroupWithAlias, help="""Object representing to GenerateSqlFromNlJob. ocidEntityType: generativeaiGenerateSqlFromNlJob adLocality: regional""") -@cli_util.help_option_group -def generate_sql_from_nl_job_group(): - pass - - -generative_ai_data_service_cli.generative_ai_data_service_group.add_command(generate_sql_from_nl_job_root_group) -generate_sql_from_nl_job_root_group.add_command(generate_sql_from_nl_job_group) - - -@generate_sql_from_nl_job_group.command(name=cli_util.override('generate_sql_from_nl_job.generate_sql_from_nl.command_name', 'generate-sql-from-nl'), help=u"""Generates a SQL query from a natural language input for the specified SemanticStore. \n[Command Reference](generateSqlFromNl)""") -@cli_util.option('--input-natural-language-query', required=True, help=u"""A user-provided query or instruction written in plain, conversational language. This input is intended to capture the user's intent, question, or command without requiring technical syntax or structured formatting. The query should clearly express what the user wants to know or accomplish, allowing the system to interpret and respond appropriately.""") -@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") -@cli_util.option('--description', help=u"""An optional description of the GenerateSqlFromNlJob.""") -@cli_util.option('--display-name', help=u"""A user-friendly display name. It does not have to be unique and can be modified. Avoid entering confidential information.""") -@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.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', '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': 'generative_ai_data', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'generative_ai_data', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'generative_ai_data', 'class': 'GenerateSqlFromNlJob'}) -@cli_util.wrap_exceptions -def generate_sql_from_nl(ctx, from_json, input_natural_language_query, semantic_store_id, description, display_name, freeform_tags, defined_tags, if_match): - - if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: - raise click.UsageError('Parameter --semantic-store-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['inputNaturalLanguageQuery'] = input_natural_language_query - - if description is not None: - _details['description'] = description - - 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('generative_ai_data', 'generate_sql_from_nl_job', ctx) - result = client.generate_sql_from_nl( - semantic_store_id=semantic_store_id, - generate_sql_from_nl_details=_details, - **kwargs - ) - cli_util.render_response(result, ctx) diff --git a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generatesqlfromnljob_cli_extended.py b/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generatesqlfromnljob_cli_extended.py deleted file mode 100644 index d0127bc35..000000000 --- a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generatesqlfromnljob_cli_extended.py +++ /dev/null @@ -1,13 +0,0 @@ -# # coding: utf-8 -# # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. -# -# import click # noqa: F401 -# import json # noqa: F401 -# from services.generative_ai_data.src.oci_cli_generate_sql_from_nl_job.generated import generatesqlfromnljob_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 redundant subcommand -# generatesqlfromnljob_cli.generate_sql_from_nl_job_group.commands.pop(generatesqlfromnljob_cli.generate_sql_from_nl.name) -# generatesqlfromnljob_cli.generate_sql_from_nl_job_root_group.add_command(generatesqlfromnljob_cli.generate_sql_from_nl) -# generatesqlfromnljob_cli.generate_sql_from_nl_job_root_group.commands.pop(generatesqlfromnljob_cli.generate_sql_from_nl_job_group.name) diff --git a/services/generative_ai_data/src/oci_cli_generative_ai_data/generated/generative_ai_data_service_cli.py b/services/generative_ai_data/src/oci_cli_generative_ai_data/generated/generative_ai_data_service_cli.py index c96a6a0c6..fde9fdfb0 100644 --- a/services/generative_ai_data/src/oci_cli_generative_ai_data/generated/generative_ai_data_service_cli.py +++ b/services/generative_ai_data/src/oci_cli_generative_ai_data/generated/generative_ai_data_service_cli.py @@ -8,7 +8,7 @@ from oci_cli.aliasing import CommandGroupWithAlias -@cli.command(cli_util.override('list_enrichment_jobs.generative_ai_data_service_group.command_name', 'generative-ai-data'), cls=CommandGroupWithAlias, help=cli_util.override('list_enrichment_jobs.generative_ai_data_service_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('list_enrichment_jobs.generative_ai_data_service_group.short_help', """Generative AI Service NL2SQL API""")) +@cli.command(cli_util.override('generate_sql.generative_ai_data_service_group.command_name', 'generative-ai-data'), cls=CommandGroupWithAlias, help=cli_util.override('generate_sql.generative_ai_data_service_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('generate_sql.generative_ai_data_service_group.short_help', """Generative AI Service NL2SQL API""")) @cli_util.help_option_group def generative_ai_data_service_group(): pass diff --git a/services/generative_ai_data/src/oci_cli_get_enrichment_job/__init__.py b/services/generative_ai_data/src/oci_cli_get_enrichment_job/__init__.py deleted file mode 100644 index 376112c90..000000000 --- a/services/generative_ai_data/src/oci_cli_get_enrichment_job/__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: 20260325 diff --git a/services/generative_ai_data/src/oci_cli_get_enrichment_job/generated/__init__.py b/services/generative_ai_data/src/oci_cli_get_enrichment_job/generated/__init__.py deleted file mode 100644 index 376112c90..000000000 --- a/services/generative_ai_data/src/oci_cli_get_enrichment_job/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: 20260325 diff --git a/services/generative_ai_data/src/oci_cli_get_enrichment_job/generated/getenrichmentjob_cli.py b/services/generative_ai_data/src/oci_cli_get_enrichment_job/generated/getenrichmentjob_cli.py deleted file mode 100644 index acd0c47ab..000000000 --- a/services/generative_ai_data/src/oci_cli_get_enrichment_job/generated/getenrichmentjob_cli.py +++ /dev/null @@ -1,59 +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: 20260325 - -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.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli - - -@click.command(cli_util.override('get_enrichment_job.get_enrichment_job_root_group.command_name', 'get-enrichment-job'), cls=CommandGroupWithAlias, help=cli_util.override('get_enrichment_job.get_enrichment_job_root_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('get_enrichment_job.get_enrichment_job_root_group.short_help', """Generative AI Service NL2SQL API""")) -@cli_util.help_option_group -def get_enrichment_job_root_group(): - pass - - -@click.command(cli_util.override('get_enrichment_job.enrichment_job_group.command_name', 'enrichment-job'), cls=CommandGroupWithAlias, help="""Object representing to EnrichmentJob. ocidEntityType: generativeaiEnrichmentJob adLocality: regional""") -@cli_util.help_option_group -def enrichment_job_group(): - pass - - -generative_ai_data_service_cli.generative_ai_data_service_group.add_command(get_enrichment_job_root_group) -get_enrichment_job_root_group.add_command(enrichment_job_group) - - -@enrichment_job_group.command(name=cli_util.override('get_enrichment_job.get_enrichment_job.command_name', 'get'), help=u"""Gets an EnrichmentJob by identifier. \n[Command Reference](getEnrichmentJob)""") -@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") -@cli_util.option('--enrichment-job-id', required=True, help=u"""The OCID of the enrichment job""") -@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_data', 'class': 'EnrichmentJob'}) -@cli_util.wrap_exceptions -def get_enrichment_job(ctx, from_json, semantic_store_id, enrichment_job_id): - - if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: - raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') - - if isinstance(enrichment_job_id, six.string_types) and len(enrichment_job_id.strip()) == 0: - raise click.UsageError('Parameter --enrichment-job-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_data', 'get_enrichment_job', ctx) - result = client.get_enrichment_job( - semantic_store_id=semantic_store_id, - enrichment_job_id=enrichment_job_id, - **kwargs - ) - cli_util.render_response(result, ctx) diff --git a/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/__init__.py b/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/__init__.py deleted file mode 100644 index 376112c90..000000000 --- a/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/__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: 20260325 diff --git a/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/generated/__init__.py b/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/generated/__init__.py deleted file mode 100644 index 376112c90..000000000 --- a/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/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: 20260325 diff --git a/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/generated/listenrichmentjobs_cli.py b/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/generated/listenrichmentjobs_cli.py deleted file mode 100644 index 47a69e216..000000000 --- a/services/generative_ai_data/src/oci_cli_list_enrichment_jobs/generated/listenrichmentjobs_cli.py +++ /dev/null @@ -1,99 +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: 20260325 - -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.generative_ai_data.src.oci_cli_generative_ai_data.generated import generative_ai_data_service_cli - - -@click.command(cli_util.override('list_enrichment_jobs.list_enrichment_jobs_root_group.command_name', 'list-enrichment-jobs'), cls=CommandGroupWithAlias, help=cli_util.override('list_enrichment_jobs.list_enrichment_jobs_root_group.help', """A description of the ReferenceService API. in progress"""), short_help=cli_util.override('list_enrichment_jobs.list_enrichment_jobs_root_group.short_help', """Generative AI Service NL2SQL API""")) -@cli_util.help_option_group -def list_enrichment_jobs_root_group(): - pass - - -@click.command(cli_util.override('list_enrichment_jobs.enrichment_job_collection_group.command_name', 'enrichment-job-collection'), cls=CommandGroupWithAlias, help="""Object representing list of EnrichmentJobSummaries.""") -@cli_util.help_option_group -def enrichment_job_collection_group(): - pass - - -generative_ai_data_service_cli.generative_ai_data_service_group.add_command(list_enrichment_jobs_root_group) -list_enrichment_jobs_root_group.add_command(enrichment_job_collection_group) - - -@enrichment_job_collection_group.command(name=cli_util.override('list_enrichment_jobs.list_enrichment_jobs.command_name', 'list-enrichment-jobs'), help=u"""Lists EnrichmentJobs in a semantic store. \n[Command Reference](listEnrichmentJobs)""") -@cli_util.option('--semantic-store-id', required=True, help=u"""The OCID of the semantic store""") -@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") -@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(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), 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-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-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.""") -@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_data', 'class': 'EnrichmentJobCollection'}) -@cli_util.wrap_exceptions -def list_enrichment_jobs(ctx, from_json, all_pages, page_size, semantic_store_id, compartment_id, display_name, lifecycle_state, limit, page, sort_by, sort_order): - - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') - - if isinstance(semantic_store_id, six.string_types) and len(semantic_store_id.strip()) == 0: - raise click.UsageError('Parameter --semantic-store-id cannot be whitespace or empty string') - - kwargs = {} - 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_by is not None: - kwargs['sort_by'] = sort_by - 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('generative_ai_data', 'list_enrichment_jobs', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size - - result = cli_util.list_call_get_all_results( - client.list_enrichment_jobs, - semantic_store_id=semantic_store_id, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_enrichment_jobs, - limit, - page_size, - semantic_store_id=semantic_store_id, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_enrichment_jobs( - semantic_store_id=semantic_store_id, - compartment_id=compartment_id, - **kwargs - ) - cli_util.render_response(result, ctx) diff --git a/services/generative_ai_data/tests/util/generated/command_to_api.py b/services/generative_ai_data/tests/util/generated/command_to_api.py index c73fcf1e5..167baf145 100644 --- a/services/generative_ai_data/tests/util/generated/command_to_api.py +++ b/services/generative_ai_data/tests/util/generated/command_to_api.py @@ -1,6 +1,27 @@ # coding: utf-8 -# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# 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. SDK_client_map = { - "list_enrichment_jobs.list_enrichment_jobs": "oci.generative_ai_data.ListEnrichmentJobsClient.list_enrichment_jobs", + "generate_sql.generate_sql_from_nl": "oci.generative_ai_data.GenerateSqlClient.generate_sql_from_nl", + "generate_sql.get_generate_sql_from_nl_job": "oci.generative_ai_data.GenerateSqlClient.get_generate_sql_from_nl_job", } diff --git a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/__init__.py b/services/mysql/src/oci_cli_blue_green_deployments/__init__.py similarity index 92% rename from services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/__init__.py rename to services/mysql/src/oci_cli_blue_green_deployments/__init__.py index 376112c90..291daf65e 100644 --- a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/__init__.py +++ b/services/mysql/src/oci_cli_blue_green_deployments/__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: 20260325 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20190415 diff --git a/services/mysql/src/oci_cli_blue_green_deployments/bluegreendeployments_cli_extended.py b/services/mysql/src/oci_cli_blue_green_deployments/bluegreendeployments_cli_extended.py new file mode 100644 index 000000000..3d3b4f3f0 --- /dev/null +++ b/services/mysql/src/oci_cli_blue_green_deployments/bluegreendeployments_cli_extended.py @@ -0,0 +1,37 @@ +# coding: utf-8 +# Copyright (c) 2016, 2020, 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 click # noqa: F401 +import json # noqa: F401 +from services.mysql.src.oci_cli_blue_green_deployments.generated import bluegreendeployments_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 + + +bluegreendeployments_cli.blue_green_deployments_root_group.help = bluegreendeployments_cli.blue_green_deployment_group.help +bluegreendeployments_cli.blue_green_deployments_root_group.short_help = "Manage blue/green deployments." + + +# oci mysql blue-green-deployments blue-green-deployment-collection list-blue-green-deployments -> oci mysql blue-green-deployments blue-green-deployment-collection list +cli_util.rename_command(bluegreendeployments_cli, bluegreendeployments_cli.blue_green_deployment_collection_group, bluegreendeployments_cli.list_blue_green_deployments, "list") + + +# Remove blue-green-deployment-collection from oci mysql blue-green-deployments +bluegreendeployments_cli.blue_green_deployments_root_group.commands.pop(bluegreendeployments_cli.blue_green_deployment_collection_group.name) + + +# oci mysql blue-green-deployments blue-green-deployment-collection list-blue-green-deployments -> oci mysql blue-green-deployments +bluegreendeployments_cli.blue_green_deployment_collection_group.commands.pop(bluegreendeployments_cli.list_blue_green_deployments.name) +bluegreendeployments_cli.blue_green_deployments_root_group.add_command(bluegreendeployments_cli.list_blue_green_deployments) + + +# Move commands under 'oci mysql blue-green-deployments blue-green-deployment' -> 'oci mysql blue-green-deployments' +bluegreendeployments_cli.blue_green_deployments_root_group.commands.pop(bluegreendeployments_cli.blue_green_deployment_group.name) +bluegreendeployments_cli.blue_green_deployments_root_group.add_command(bluegreendeployments_cli.change_blue_green_deployment_compartment) +bluegreendeployments_cli.blue_green_deployments_root_group.add_command(bluegreendeployments_cli.create_blue_green_deployment) +bluegreendeployments_cli.blue_green_deployments_root_group.add_command(bluegreendeployments_cli.delete_blue_green_deployment) +bluegreendeployments_cli.blue_green_deployments_root_group.add_command(bluegreendeployments_cli.get_blue_green_deployment) +bluegreendeployments_cli.blue_green_deployments_root_group.add_command(bluegreendeployments_cli.switchover_blue_green_deployment) +bluegreendeployments_cli.blue_green_deployments_root_group.add_command(bluegreendeployments_cli.update_blue_green_deployment) diff --git a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/__init__.py b/services/mysql/src/oci_cli_blue_green_deployments/generated/__init__.py similarity index 92% rename from services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/__init__.py rename to services/mysql/src/oci_cli_blue_green_deployments/generated/__init__.py index 376112c90..291daf65e 100644 --- a/services/generative_ai_data/src/oci_cli_generate_sql_from_nl_job/generated/__init__.py +++ b/services/mysql/src/oci_cli_blue_green_deployments/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: 20260325 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20190415 diff --git a/services/mysql/src/oci_cli_blue_green_deployments/generated/bluegreendeployments_cli.py b/services/mysql/src/oci_cli_blue_green_deployments/generated/bluegreendeployments_cli.py new file mode 100644 index 000000000..73c333408 --- /dev/null +++ b/services/mysql/src/oci_cli_blue_green_deployments/generated/bluegreendeployments_cli.py @@ -0,0 +1,473 @@ +# 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: 20190415 + +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.mysql.src.oci_cli_mysql.generated import mysql_service_cli + + +@click.command(cli_util.override('blue_green_deployments.blue_green_deployments_root_group.command_name', 'blue-green-deployments'), cls=CommandGroupWithAlias, help=cli_util.override('blue_green_deployments.blue_green_deployments_root_group.help', """The API for the MySQL Database Service"""), short_help=cli_util.override('blue_green_deployments.blue_green_deployments_root_group.short_help', """MySQL Database Service API""")) +@cli_util.help_option_group +def blue_green_deployments_root_group(): + pass + + +@click.command(cli_util.override('blue_green_deployments.blue_green_deployment_collection_group.command_name', 'blue-green-deployment-collection'), cls=CommandGroupWithAlias, help="""A list of blue/green deployments.""") +@cli_util.help_option_group +def blue_green_deployment_collection_group(): + pass + + +@click.command(cli_util.override('blue_green_deployments.blue_green_deployment_group.command_name', 'blue-green-deployment'), cls=CommandGroupWithAlias, help="""A blue/green deployment resource.""") +@cli_util.help_option_group +def blue_green_deployment_group(): + pass + + +mysql_service_cli.mysql_service_group.add_command(blue_green_deployments_root_group) +blue_green_deployments_root_group.add_command(blue_green_deployment_collection_group) +blue_green_deployments_root_group.add_command(blue_green_deployment_group) + + +@blue_green_deployment_group.command(name=cli_util.override('blue_green_deployments.change_blue_green_deployment_compartment.command_name', 'change-compartment'), help=u"""Moves only the blue/green deployment wrapper resource into a different compartment. This operation does not move the source DB system, target DB system, or replication channel referenced by the deployment. When provided, If-Match is checked against ETag values of the blue/green deployment. \n[Command Reference](changeBlueGreenDeploymentCompartment)""") +@cli_util.option('--blue-green-deployment-id', required=True, help=u"""The [OCID] of the blue/green deployment.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the target compartment.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `If-Match` header 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"]), 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_blue_green_deployment_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, blue_green_deployment_id, compartment_id, if_match): + + if isinstance(blue_green_deployment_id, six.string_types) and len(blue_green_deployment_id.strip()) == 0: + raise click.UsageError('Parameter --blue-green-deployment-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('mysql', 'blue_green_deployments', ctx) + result = client.change_blue_green_deployment_compartment( + blue_green_deployment_id=blue_green_deployment_id, + change_blue_green_deployment_compartment_details=_details, + **kwargs + ) + if wait_for_state: + + client = cli_util.build_client('mysql', 'work_requests', ctx) + + 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) + + +@blue_green_deployment_group.command(name=cli_util.override('blue_green_deployments.create_blue_green_deployment.command_name', 'create'), help=u"""Creates a blue/green deployment resource and its replication channel. \n[Command Reference](createBlueGreenDeployment)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment.""") +@cli_util.option('--display-name', required=True, help=u"""The display name of the blue/green deployment.""") +@cli_util.option('--source-db-system-id', required=True, help=u"""Source DB system [OCID].""") +@cli_util.option('--target-db-system-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--channel-details', required=True, 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"""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", "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({'target-db-system-details': {'module': 'mysql', 'class': 'CreateBlueGreenDeploymentTargetDbSystemDetails'}, 'channel-details': {'module': 'mysql', 'class': 'CreateBlueGreenDeploymentChannelDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', '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={'target-db-system-details': {'module': 'mysql', 'class': 'CreateBlueGreenDeploymentTargetDbSystemDetails'}, 'channel-details': {'module': 'mysql', 'class': 'CreateBlueGreenDeploymentChannelDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'mysql', 'class': 'BlueGreenDeployment'}) +@cli_util.wrap_exceptions +def create_blue_green_deployment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, source_db_system_id, target_db_system_details, channel_details, 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['sourceDbSystemId'] = source_db_system_id + _details['targetDbSystemDetails'] = cli_util.parse_json_parameter("target_db_system_details", target_db_system_details) + _details['channelDetails'] = cli_util.parse_json_parameter("channel_details", channel_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('mysql', 'blue_green_deployments', ctx) + result = client.create_blue_green_deployment( + create_blue_green_deployment_details=_details, + **kwargs + ) + if wait_for_state: + + client = cli_util.build_client('mysql', 'work_requests', ctx) + + 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) + + +@blue_green_deployment_group.command(name=cli_util.override('blue_green_deployments.delete_blue_green_deployment.command_name', 'delete'), help=u"""Deletes only the blue/green deployment wrapper resource. This operation does not delete the source DB system, target DB system, or replication channel associated with the deployment. \n[Command Reference](deleteBlueGreenDeployment)""") +@cli_util.option('--blue-green-deployment-id', required=True, help=u"""The [OCID] of the blue/green deployment.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `If-Match` header 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"]), 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_blue_green_deployment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, blue_green_deployment_id, if_match): + + if isinstance(blue_green_deployment_id, six.string_types) and len(blue_green_deployment_id.strip()) == 0: + raise click.UsageError('Parameter --blue-green-deployment-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('mysql', 'blue_green_deployments', ctx) + result = client.delete_blue_green_deployment( + blue_green_deployment_id=blue_green_deployment_id, + **kwargs + ) + if wait_for_state: + + client = cli_util.build_client('mysql', 'work_requests', ctx) + + 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) + + +@blue_green_deployment_group.command(name=cli_util.override('blue_green_deployments.get_blue_green_deployment.command_name', 'get'), help=u"""Gets a blue/green deployment by identifier. \n[Command Reference](getBlueGreenDeployment)""") +@cli_util.option('--blue-green-deployment-id', required=True, help=u"""The [OCID] of the blue/green deployment.""") +@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': 'mysql', 'class': 'BlueGreenDeployment'}) +@cli_util.wrap_exceptions +def get_blue_green_deployment(ctx, from_json, blue_green_deployment_id, if_none_match): + + if isinstance(blue_green_deployment_id, six.string_types) and len(blue_green_deployment_id.strip()) == 0: + raise click.UsageError('Parameter --blue-green-deployment-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('mysql', 'blue_green_deployments', ctx) + result = client.get_blue_green_deployment( + blue_green_deployment_id=blue_green_deployment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@blue_green_deployment_collection_group.command(name=cli_util.override('blue_green_deployments.list_blue_green_deployments.command_name', 'list-blue-green-deployments'), help=u"""Lists blue/green deployments in a compartment. \n[Command Reference](listBlueGreenDeployments)""") +@cli_util.option('--compartment-id', required=True, help=u"""The compartment [OCID].""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated list call. For information about pagination, see [List Pagination].""") +@cli_util.option('--page', help=u"""The value of the `opc-next-page` or `opc-prev-page` response header from the previous list call. For information about pagination, see [List Pagination].""") +@cli_util.option('--source-db-system-id', help=u"""Source DB system [OCID] filter.""") +@cli_util.option('--target-db-system-id', help=u"""Target DB system [OCID] filter.""") +@cli_util.option('--display-name', help=u"""Filters deployments by display name.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "UPDATING", "FAILED", "DELETING", "DELETED"]), help=u"""Filters deployments by lifecycle state.""") +@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. Time fields are default ordered as descending. Display name is default ordered as ascending.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use (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.""") +@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': 'mysql', 'class': 'BlueGreenDeploymentCollection'}) +@cli_util.wrap_exceptions +def list_blue_green_deployments(ctx, from_json, all_pages, page_size, compartment_id, limit, page, source_db_system_id, target_db_system_id, display_name, lifecycle_state, sort_by, sort_order): + + 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 source_db_system_id is not None: + kwargs['source_db_system_id'] = source_db_system_id + if target_db_system_id is not None: + kwargs['target_db_system_id'] = target_db_system_id + if display_name is not None: + kwargs['display_name'] = display_name + 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 + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('mysql', 'blue_green_deployments', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_blue_green_deployments, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_blue_green_deployments, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_blue_green_deployments( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@blue_green_deployment_group.command(name=cli_util.override('blue_green_deployments.switchover_blue_green_deployment.command_name', 'switchover'), help=u"""Initiates switchover for a blue/green deployment. + +This action is asynchronous and supports idempotent retry only when the same `opc-retry-token` is reused for an equivalent switchover request on the same blue/green deployment. Equivalent request identity includes materially equivalent request parameters after applying defaults and preconditions, including the effective `waitTimeInSeconds` from the request body and the same `If-Match` value when provided. An empty switchover details body and a body that explicitly passes the default `waitTimeInSeconds=300` are equivalent. + +Requests that change `If-Match` or other material preconditions are treated as new requests and follow normal conflict (`409`) or precondition (`412`) handling instead of ordinary retry reuse. + +Switchover outcome and partial/failure conditions are surfaced through `lifecycleState`, `lifecycleDetails`, `switchoverStatus`, and `activeDbSystemId` in the blue/green deployment resource. + +When `waitTimeInSeconds` is omitted from the request body, the default wait time applies. The effective wait time provides upper bound guidance for waiting while the target DB System applies remaining replication changes during switchover processing. \n[Command Reference](switchoverBlueGreenDeployment)""") +@cli_util.option('--blue-green-deployment-id', required=True, help=u"""The [OCID] of the blue/green deployment.""") +@cli_util.option('--wait-time-in-seconds', type=click.INT, help=u"""Upper bound guidance, in seconds, for waiting while the target DB System applies remaining replication changes during switchover processing.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `If-Match` header 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"]), 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={}, output_type={'module': 'mysql', 'class': 'BlueGreenDeployment'}) +@cli_util.wrap_exceptions +def switchover_blue_green_deployment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, blue_green_deployment_id, wait_time_in_seconds, if_match): + + if isinstance(blue_green_deployment_id, six.string_types) and len(blue_green_deployment_id.strip()) == 0: + raise click.UsageError('Parameter --blue-green-deployment-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 wait_time_in_seconds is not None: + _details['waitTimeInSeconds'] = wait_time_in_seconds + + client = cli_util.build_client('mysql', 'blue_green_deployments', ctx) + result = client.switchover_blue_green_deployment( + blue_green_deployment_id=blue_green_deployment_id, + switchover_blue_green_deployment_details=_details, + **kwargs + ) + if wait_for_state: + + client = cli_util.build_client('mysql', 'work_requests', ctx) + + 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) + + +@blue_green_deployment_group.command(name=cli_util.override('blue_green_deployments.update_blue_green_deployment.command_name', 'update'), help=u"""Updates mutable metadata for a blue/green deployment. Currently only `displayName`, `freeformTags`, and `definedTags` can be changed. \n[Command Reference](updateBlueGreenDeployment)""") +@cli_util.option('--blue-green-deployment-id', required=True, help=u"""The [OCID] of the blue/green deployment.""") +@cli_util.option('--display-name', help=u"""A user-supplied display name for the blue/green deployment.""") +@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` header 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"]), 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({'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', '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': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_blue_green_deployment(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, blue_green_deployment_id, display_name, freeform_tags, defined_tags, if_match): + + if isinstance(blue_green_deployment_id, six.string_types) and len(blue_green_deployment_id.strip()) == 0: + raise click.UsageError('Parameter --blue-green-deployment-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('mysql', 'blue_green_deployments', ctx) + result = client.update_blue_green_deployment( + blue_green_deployment_id=blue_green_deployment_id, + update_blue_green_deployment_details=_details, + **kwargs + ) + if wait_for_state: + + client = cli_util.build_client('mysql', 'work_requests', ctx) + + 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/generative_ai_data/src/oci_cli_cancel_enrichment_job/generated/client_mappings.py b/services/mysql/src/oci_cli_blue_green_deployments/generated/client_mappings.py similarity index 57% rename from services/generative_ai_data/src/oci_cli_cancel_enrichment_job/generated/client_mappings.py rename to services/mysql/src/oci_cli_blue_green_deployments/generated/client_mappings.py index 3f3890b64..546e107ec 100644 --- a/services/generative_ai_data/src/oci_cli_cancel_enrichment_job/generated/client_mappings.py +++ b/services/mysql/src/oci_cli_blue_green_deployments/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: 20260325 +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20190415 import oci from oci_cli.cli_clients import CLIENT_MAP from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS -from oci.generative_ai_data import CancelEnrichmentJobClient +from oci.mysql import BlueGreenDeploymentsClient -MODULE_TO_TYPE_MAPPINGS["generative_ai_data"] = oci.generative_ai_data.models.generative_ai_data_type_mapping -if CLIENT_MAP.get("generative_ai_data") is None: - CLIENT_MAP["generative_ai_data"] = {} -CLIENT_MAP["generative_ai_data"]["cancel_enrichment_job"] = CancelEnrichmentJobClient +MODULE_TO_TYPE_MAPPINGS["mysql"] = oci.mysql.models.mysql_type_mapping +if CLIENT_MAP.get("mysql") is None: + CLIENT_MAP["mysql"] = {} +CLIENT_MAP["mysql"]["blue_green_deployments"] = BlueGreenDeploymentsClient diff --git a/services/mysql/src/oci_cli_mysql/mysql_service_cli_extended.py b/services/mysql/src/oci_cli_mysql/mysql_service_cli_extended.py new file mode 100644 index 000000000..46144aa71 --- /dev/null +++ b/services/mysql/src/oci_cli_mysql/mysql_service_cli_extended.py @@ -0,0 +1,15 @@ +# coding: utf-8 +# Copyright (c) 2016, 2020, 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 click # noqa: F401 +import json # noqa: F401 +from services.mysql.src.oci_cli_mysql.generated import mysql_service_cli +from services.mysql.src.oci_cli_blue_green_deployments.generated import bluegreendeployments_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 + + +# oci mysql blue-green-deployments -> oci mysql blue-green-deployment +cli_util.rename_command(mysql_service_cli, mysql_service_cli.mysql_service_group, bluegreendeployments_cli.blue_green_deployments_root_group, "blue-green-deployment") diff --git a/services/mysql/tests/unit/test_blue_green_deployments_cli_extended.py b/services/mysql/tests/unit/test_blue_green_deployments_cli_extended.py new file mode 100644 index 000000000..9367e0798 --- /dev/null +++ b/services/mysql/tests/unit/test_blue_green_deployments_cli_extended.py @@ -0,0 +1,20 @@ +# 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. + +import unittest + +from services.mysql.src.oci_cli_blue_green_deployments import bluegreendeployments_cli_extended # noqa: F401 +from services.mysql.src.oci_cli_blue_green_deployments.generated import bluegreendeployments_cli + + +class TestBlueGreenDeploymentsCliExtended(unittest.TestCase): + def test_blue_green_deployment_help(self): + self.assertEqual( + 'A blue/green deployment resource.', + bluegreendeployments_cli.blue_green_deployments_root_group.help) + + def test_blue_green_deployment_short_help(self): + self.assertEqual( + 'Manage blue/green deployments.', + bluegreendeployments_cli.blue_green_deployments_root_group.short_help) diff --git a/services/object_storage/src/oci_cli_object_storage/objectstorage_cli_extended.py b/services/object_storage/src/oci_cli_object_storage/objectstorage_cli_extended.py index 93b54fd9f..de6c24268 100644 --- a/services/object_storage/src/oci_cli_object_storage/objectstorage_cli_extended.py +++ b/services/object_storage/src/oci_cli_object_storage/objectstorage_cli_extended.py @@ -11,6 +11,7 @@ import math import os import os.path +import re import shutil import stat import sys @@ -47,10 +48,41 @@ DeleteUploadTask, DeleteReplicationPolicyTask, DeletePreAuthenticatedRequestTask, DeleteObjectTask +NAMESPACE_HOST_LABEL_PATTERN = re.compile(r'\A[A-Za-z0-9_.-]+\Z') +NAMESPACE_VALIDATION_ERROR = 'must contain only letters, digits, underscores, hyphens, and periods' +WRAPPED_NAMESPACE_PARAM_IDS = set() + + def is_python2(): return sys.version_info[0] < 3 +def validate_namespace_name(value): + if value is None: + return value + + if isinstance(value, six.string_types): + if not value or value != value.strip() or not NAMESPACE_HOST_LABEL_PATTERN.match(value): + raise click.BadParameter(NAMESPACE_VALIDATION_ERROR) + + return value + + +def _wrap_namespace_param_callback(param): + if id(param) in WRAPPED_NAMESPACE_PARAM_IDS: + return + + existing_callback = param.callback + + def validate_object_storage_namespace(ctx, click_param, value): + if existing_callback: + value = existing_callback(ctx, click_param, value) + return validate_namespace_name(value) + + param.callback = validate_object_storage_namespace + WRAPPED_NAMESPACE_PARAM_IDS.add(id(param)) + + # For namespace parameter within object storage commands, if not explicitly provided we make a SDK API call to # get the parameter. This removes the requirement for the parameter to be a required parameter. # Is this an object storage command? Check if the first level command is 'os' [oci os] @@ -85,6 +117,7 @@ def remove_namespace_required_objectstorage(): for command in commands: for param in command.params: if param.name in ['namespace_name', 'namespace', 'ns']: + _wrap_namespace_param_callback(param) param.required = False if param.help.endswith(' [required]'): # Remove ' [required]' diff --git a/services/object_storage/tests/unit/test_objectstorage_namespace_validation.py b/services/object_storage/tests/unit/test_objectstorage_namespace_validation.py new file mode 100644 index 000000000..f2158944c --- /dev/null +++ b/services/object_storage/tests/unit/test_objectstorage_namespace_validation.py @@ -0,0 +1,69 @@ +# 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. + +import click +import pytest + +import oci_cli.final_command_processor as final_command_processor +from services.object_storage.src.oci_cli_object_storage.generated import objectstorage_cli +from services.object_storage.src.oci_cli_object_storage.objectstorage_cli_extended import ( + NAMESPACE_VALIDATION_ERROR, + validate_namespace_name +) + + +@pytest.mark.parametrize('namespace', [ + 'mynamespace', + 'dex-us-phx-cli-1', + 'my_namespace', + 'my.namespace' +]) +def test_validate_namespace_name_allows_host_safe_values(namespace): + assert validate_namespace_name(namespace) == namespace + + +@pytest.mark.parametrize('namespace', [ + 'bad/namespace', + 'bad@namespace', + 'bad?namespace', + 'bad#namespace', + 'bad:namespace', + 'bad namespace', + ' mynamespace', + 'mynamespace ', + '', + ' ' +]) +def test_validate_namespace_name_rejects_url_unsafe_values(namespace): + with pytest.raises(click.BadParameter) as exc: + validate_namespace_name(namespace) + + assert NAMESPACE_VALIDATION_ERROR in str(exc.value) + + +def test_object_storage_namespace_callback_rejects_url_unsafe_values(): + final_command_processor.process() + + list_command = objectstorage_cli.object_group.commands['list'] + namespace_param = next(param for param in list_command.params if param.name == 'namespace') + + with pytest.raises(click.BadParameter) as exc: + namespace_param.callback(None, namespace_param, 'bad/namespace') + + assert NAMESPACE_VALIDATION_ERROR in str(exc.value) + + +def test_object_storage_namespace_callback_wrapping_is_idempotent(): + final_command_processor.process() + + list_command = objectstorage_cli.object_group.commands['list'] + namespace_param = next(param for param in list_command.params if param.name == 'namespace') + callback = namespace_param.callback + + final_command_processor.process() + + assert namespace_param.callback is callback diff --git a/services/recovery/src/oci_cli_database_recovery/generated/databaserecovery_cli.py b/services/recovery/src/oci_cli_database_recovery/generated/databaserecovery_cli.py index 54cfceaf6..72ae63a69 100644 --- a/services/recovery/src/oci_cli_database_recovery/generated/databaserecovery_cli.py +++ b/services/recovery/src/oci_cli_database_recovery/generated/databaserecovery_cli.py @@ -28,6 +28,12 @@ def protection_policy_group(): pass +@click.command(cli_util.override('recovery.long_term_backup_group.command_name', 'long-term-backup'), cls=CommandGroupWithAlias, help="""The details of a Long Term Backup.""") +@cli_util.help_option_group +def long_term_backup_group(): + pass + + @click.command(cli_util.override('recovery.work_request_error_collection_group.command_name', 'work-request-error-collection'), cls=CommandGroupWithAlias, help="""Results of a workRequestError search. Contains both WorkRequestError items and other information, such as metadata.""") @cli_util.help_option_group def work_request_error_collection_group(): @@ -52,6 +58,12 @@ def protection_policy_collection_group(): pass +@click.command(cli_util.override('recovery.long_term_backup_collection_group.command_name', 'long-term-backup-collection'), cls=CommandGroupWithAlias, help="""Results of a long term backup search. Contains both long term backup Summary items and other information, such as metadata.""") +@cli_util.help_option_group +def long_term_backup_collection_group(): + pass + + @click.command(cli_util.override('recovery.protected_database_group.command_name', 'protected-database'), cls=CommandGroupWithAlias, help="""A protected database is an Oracle Cloud Database whose backups are managed by Oracle Database Autonomous Recovery Service. Each protected database requires a recovery service subnet and a protection policy to use Recovery Service as the backup destination for centralized backup and recovery""") @cli_util.help_option_group def protected_database_group(): @@ -83,10 +95,12 @@ def work_request_log_entry_collection_group(): recovery_root_group.add_command(protection_policy_group) +recovery_root_group.add_command(long_term_backup_group) recovery_root_group.add_command(work_request_error_collection_group) recovery_root_group.add_command(work_request_summary_collection_group) recovery_root_group.add_command(recovery_service_subnet_group) recovery_root_group.add_command(protection_policy_collection_group) +recovery_root_group.add_command(long_term_backup_collection_group) recovery_root_group.add_command(protected_database_group) recovery_root_group.add_command(work_request_group) recovery_root_group.add_command(protected_database_collection_group) @@ -94,6 +108,61 @@ def work_request_log_entry_collection_group(): recovery_root_group.add_command(work_request_log_entry_collection_group) +@long_term_backup_group.command(name=cli_util.override('recovery.cancel_long_term_backup.command_name', 'cancel'), help=u"""Cancels a long-term backup that is being created or scheduled to be created. You must specify the unique identifier or OCID of the long-term backup that you want to cancel. You can cancel a long-term backup only if the current state of the backup resource is WAITING_FOR_BACKUP_FROM_DB, or SCHEDULED_FOR_ARCHIVAL, or ARCHIVAL_IN_PROGRESS. \n[Command Reference](cancelLongTermBackup)""") +@cli_util.option('--long-term-backup-id', required=True, help=u"""The long term backup 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.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state 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 cancel_long_term_backup(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, long_term_backup_id, if_match): + + if isinstance(long_term_backup_id, six.string_types) and len(long_term_backup_id.strip()) == 0: + raise click.UsageError('Parameter --long-term-backup-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('recovery', 'database_recovery', ctx) + result = client.cancel_long_term_backup( + long_term_backup_id=long_term_backup_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) + + @protected_database_group.command(name=cli_util.override('recovery.cancel_protected_database_deletion.command_name', 'cancel-protected-database-deletion'), help=u"""Cancels the scheduled deletion of a protected database, and returns the protected database to an ACTIVE state. You can cancel the deletion only if the protected database is in the DELETE SCHEDULED state. \n[Command Reference](cancelProtectedDatabaseDeletion)""") @cli_util.option('--protected-database-id', required=True, help=u"""The protected database 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.""") @@ -369,6 +438,81 @@ def change_recovery_service_subnet_compartment(ctx, from_json, wait_for_state, m cli_util.render_response(result, ctx) +@long_term_backup_group.command(name=cli_util.override('recovery.create_long_term_backup.command_name', 'create'), help=u"""Creates a long-term backup of a specified protected database. \n[Command Reference](createLongTermBackup)""") +@cli_util.option('--protected-database-id', required=True, help=u"""The OCID of the protected database for which you want to create the long-term backup.""") +@cli_util.option('--retention-period', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""The maximum period to retain the long-term backup. Specify the retention period type and the duration for the long-term backup. If you have chosen the retention period type as 'DAYS', then specify a duration ranging from 90 days to 3650 days. If you have chosen the retention period type as 'YEARS', then specify a duration ranging from 1 year to 10 years.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--display-name', help=u"""A user provided name for the long term backup. The 'displayName' does not have to be unique, and it can be modified. Avoid entering confidential information.""") +@cli_util.option('--retention-scn', type=click.INT, help=u"""The desired target point (SCN) at which you want to create the long-term backup of the database.For example, specify the value as 1000 if you want to create the long-term backup until SCN 1000. If you want to specify the target point as a time expression instead of the SCN value, then use the longTermRetentionPointInTime parameter.""") +@cli_util.option('--retention-point-in-time', type=custom_types.CLI_DATETIME, help=u"""An RFC3339 formatted datetime string that indicates the desired target point in time in the database at which you want to create the long-term backup. For example, if you want the long-term backup to include all the changes until May 22 at 9:10 PM, then specify the value as, '2020-05-22T21:10:00.000Z'. If you want to specify the target point as an SCN value instead of the target time, then use the databaseSCN parameter.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@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\"}}`. For more information, see [Resource Tags]""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state 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({'retention-period': {'module': 'recovery', 'class': 'list[RetentionPeriodValue]'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', '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={'retention-period': {'module': 'recovery', 'class': 'list[RetentionPeriodValue]'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'recovery', 'class': 'LongTermBackup'}) +@cli_util.wrap_exceptions +def create_long_term_backup(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, protected_database_id, retention_period, display_name, retention_scn, retention_point_in_time, freeform_tags, defined_tags): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['protectedDatabaseId'] = protected_database_id + _details['retentionPeriod'] = cli_util.parse_json_parameter("retention_period", retention_period) + + if display_name is not None: + _details['displayName'] = display_name + + if retention_scn is not None: + _details['retentionScn'] = retention_scn + + if retention_point_in_time is not None: + _details['retentionPointInTime'] = retention_point_in_time + + 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('recovery', 'database_recovery', ctx) + result = client.create_long_term_backup( + create_long_term_backup_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) + + @protected_database_group.command(name=cli_util.override('recovery.create_protected_database.command_name', 'create'), help=u"""Creates a new Protected Database. \n[Command Reference](createProtectedDatabase)""") @cli_util.option('--display-name', required=True, help=u"""The protected database name. You can change the displayName. Avoid entering confidential information.""") @cli_util.option('--db-unique-name', required=True, help=u"""The dbUniqueName of the protected database in Recovery Service. You cannot change the unique name.""") @@ -563,17 +707,20 @@ def create_protection_policy(ctx, from_json, wait_for_state, max_wait_seconds, w @cli_util.option('--subnet-id', help=u"""Deprecated. One of the subnets associated with the Recovery Service subnet.""") @cli_util.option('--subnets', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of OCIDs of the subnets associated with the Recovery Service subnet.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of network security group (NSG) OCIDs that are associated with the Recovery Service subnet. You can specify a maximum of 5 unique OCIDs, which implies that you can associate a maximum of 5 NSGs to each Recovery Service subnet. Specify an empty array if you want to remove all the associated NSGs from a Recovery Service subnet. See [Network Security Groups] for more information.""" + 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('--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\"}}`. For more information, see [Resource Tags]""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state 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({'subnets': {'module': 'recovery', 'class': 'list[string]'}, 'nsg-ids': {'module': 'recovery', 'class': 'list[string]'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'subnets': {'module': 'recovery', 'class': 'list[string]'}, 'nsg-ids': {'module': 'recovery', 'class': 'list[string]'}, 'security-attributes': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', '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={'subnets': {'module': 'recovery', 'class': 'list[string]'}, 'nsg-ids': {'module': 'recovery', 'class': 'list[string]'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'recovery', 'class': 'RecoveryServiceSubnet'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'subnets': {'module': 'recovery', 'class': 'list[string]'}, 'nsg-ids': {'module': 'recovery', 'class': 'list[string]'}, 'security-attributes': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'recovery', 'class': 'RecoveryServiceSubnet'}) @cli_util.wrap_exceptions -def create_recovery_service_subnet(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, vcn_id, compartment_id, subnet_id, subnets, nsg_ids, freeform_tags, defined_tags): +def create_recovery_service_subnet(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, vcn_id, compartment_id, subnet_id, subnets, nsg_ids, security_attributes, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -592,6 +739,9 @@ def create_recovery_service_subnet(ctx, from_json, wait_for_state, max_wait_seco if nsg_ids is not None: _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -633,7 +783,63 @@ def create_recovery_service_subnet(ctx, from_json, wait_for_state, max_wait_seco cli_util.render_response(result, ctx) -@protected_database_group.command(name=cli_util.override('recovery.delete_protected_database.command_name', 'delete'), help=u"""Deletes a protected database based on the specified protected database ID. \n[Command Reference](deleteProtectedDatabase)""") +@long_term_backup_group.command(name=cli_util.override('recovery.delete_long_term_backup.command_name', 'delete'), help=u"""Deletes a long-term backup. You can delete a long-term backup only if the current state of the backup is ACTIVE, FAILED, or CANCELED. \n[Command Reference](deleteLongTermBackup)""") +@cli_util.option('--long-term-backup-id', required=True, help=u"""The long term backup 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.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state 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_long_term_backup(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, long_term_backup_id, if_match): + + if isinstance(long_term_backup_id, six.string_types) and len(long_term_backup_id.strip()) == 0: + raise click.UsageError('Parameter --long-term-backup-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('recovery', 'database_recovery', ctx) + result = client.delete_long_term_backup( + long_term_backup_id=long_term_backup_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) + + +@protected_database_group.command(name=cli_util.override('recovery.delete_protected_database.command_name', 'delete'), help=u"""Deletes a protected database based on the specified protected database ID. Only the user or the Oracle Database service that created the protected database is allowed to modify or delete it. \n[Command Reference](deleteProtectedDatabase)""") @cli_util.option('--protected-database-id', required=True, help=u"""The protected database OCID.""") @cli_util.option('--deletion-schedule', type=custom_types.CliCaseInsensitiveChoice(["DELETE_AFTER_RETENTION_PERIOD", "DELETE_AFTER_72_HOURS"]), help=u"""Defines a preferred schedule to delete a protected database after you terminate the source database. * The default schedule is DELETE_AFTER_72_HOURS, so that the delete operation can occur 72 hours (3 days) after the source database is terminated . * The alternate schedule is DELETE_AFTER_RETENTION_PERIOD. Specify this option if you want to delete a protected database only after the policy-defined backup retention period expires.""") @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.""") @@ -860,6 +1066,28 @@ def fetch_protected_database_configuration(ctx, from_json, file, protected_datab file.close() +@long_term_backup_group.command(name=cli_util.override('recovery.get_long_term_backup.command_name', 'get'), help=u"""Retrieves information regarding a long-term backup. \n[Command Reference](getLongTermBackup)""") +@cli_util.option('--long-term-backup-id', required=True, help=u"""The long term backup 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': 'recovery', 'class': 'LongTermBackup'}) +@cli_util.wrap_exceptions +def get_long_term_backup(ctx, from_json, long_term_backup_id): + + if isinstance(long_term_backup_id, six.string_types) and len(long_term_backup_id.strip()) == 0: + raise click.UsageError('Parameter --long-term-backup-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('recovery', 'database_recovery', ctx) + result = client.get_long_term_backup( + long_term_backup_id=long_term_backup_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @protected_database_group.command(name=cli_util.override('recovery.get_protected_database.command_name', 'get'), help=u"""Gets information about a specified protected database. \n[Command Reference](getProtectedDatabase)""") @cli_util.option('--protected-database-id', required=True, help=u"""The protected database OCID.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -948,13 +1176,79 @@ def get_work_request(ctx, from_json, work_request_id): cli_util.render_response(result, ctx) +@long_term_backup_collection_group.command(name=cli_util.override('recovery.list_long_term_backups.command_name', 'list-long-term-backups'), help=u"""Lists the long-term backups associated with a protected database. You can filter the results using the unique identifier (OCID) of a specific compartment, a protected database, or a long-term backup. \n[Command Reference](listLongTermBackups)""") +@cli_util.option('--compartment-id', help=u"""The compartment OCID.""") +@cli_util.option('--id', help=u"""The long-term backup OCID. Use longTermBackupId to filter a long-term backup based on its unique identifier.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire 'displayname' given.""") +@cli_util.option('--protected-database-id', help=u"""The protected database OCID. Use protectedDatabaseId to list the long-term backups of a specific protected database.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETE_SCHEDULED", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only the resources that match the specified lifecycle state.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return per page.""") +@cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC). Allowed values are: - ASC - DESC""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for DISPLAYNAME is ascending. If you do not specify a value, then TIMECREATED is used as the default sort order. Allowed values are: - TIMECREATED - DISPLAYNAME""") +@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': 'recovery', 'class': 'LongTermBackupCollection'}) +@cli_util.wrap_exceptions +def list_long_term_backups(ctx, from_json, all_pages, page_size, compartment_id, id, display_name, protected_database_id, 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 id is not None: + kwargs['id'] = id + if display_name is not None: + kwargs['display_name'] = display_name + if protected_database_id is not None: + kwargs['protected_database_id'] = protected_database_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 + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('recovery', 'database_recovery', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_long_term_backups, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_long_term_backups, + limit, + page_size, + **kwargs + ) + else: + result = client.list_long_term_backups( + **kwargs + ) + cli_util.render_response(result, ctx) + + @protected_database_collection_group.command(name=cli_util.override('recovery.list_protected_databases.command_name', 'list-protected-databases'), help=u"""Lists the protected databases based on the specified parameters. \n[Command Reference](listProtectedDatabases)""") -@cli_util.option('--compartment-id', required=True, help=u"""The compartment OCID.""") +@cli_util.option('--compartment-id', help=u"""The compartment OCID.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETE_SCHEDULED", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only the resources that match the specified lifecycle state.""") @cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire 'displayname' given.""") @cli_util.option('--id', help=u"""The protected database OCID.""") @cli_util.option('--protection-policy-id', help=u"""The protection policy OCID.""") @cli_util.option('--recovery-service-subnet-id', help=u"""The recovery service subnet OCID.""") +@cli_util.option('--backup-cloud-location', type=custom_types.CliCaseInsensitiveChoice(["AZURE", "OCI", "GCP", "AWS"]), help=u"""Filter for cloud location of protected database.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return per page.""") @cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC). Allowed values are: - ASC - DESC""") @@ -966,12 +1260,14 @@ def get_work_request(ctx, from_json, work_request_id): @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'recovery', 'class': 'ProtectedDatabaseCollection'}) @cli_util.wrap_exceptions -def list_protected_databases(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, protection_policy_id, recovery_service_subnet_id, limit, page, sort_order, sort_by): +def list_protected_databases(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, protection_policy_id, recovery_service_subnet_id, backup_cloud_location, 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 lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state if display_name is not None: @@ -982,6 +1278,8 @@ def list_protected_databases(ctx, from_json, all_pages, page_size, compartment_i kwargs['protection_policy_id'] = protection_policy_id if recovery_service_subnet_id is not None: kwargs['recovery_service_subnet_id'] = recovery_service_subnet_id + if backup_cloud_location is not None: + kwargs['backup_cloud_location'] = backup_cloud_location if limit is not None: kwargs['limit'] = limit if page is not None: @@ -998,7 +1296,6 @@ def list_protected_databases(ctx, from_json, all_pages, page_size, compartment_i result = cli_util.list_call_get_all_results( client.list_protected_databases, - compartment_id=compartment_id, **kwargs ) elif limit is not None: @@ -1006,23 +1303,22 @@ def list_protected_databases(ctx, from_json, all_pages, page_size, compartment_i client.list_protected_databases, limit, page_size, - compartment_id=compartment_id, **kwargs ) else: result = client.list_protected_databases( - compartment_id=compartment_id, **kwargs ) cli_util.render_response(result, ctx) @protection_policy_collection_group.command(name=cli_util.override('recovery.list_protection_policies.command_name', 'list-protection-policies'), help=u"""Gets a list of protection policies based on the specified parameters. \n[Command Reference](listProtectionPolicies)""") -@cli_util.option('--compartment-id', required=True, help=u"""The compartment OCID.""") +@cli_util.option('--compartment-id', help=u"""The compartment OCID.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETE_SCHEDULED", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") @cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire 'displayname' given.""") @cli_util.option('--protection-policy-id', help=u"""The protection policy OCID.""") @cli_util.option('--owner', type=custom_types.CliCaseInsensitiveChoice(["oracle", "customer"]), help=u"""A filter to return only the policies that match the owner as 'Customer' or 'Oracle'.""") +@cli_util.option('--must-enforce-cloud-locality', type=click.BOOL, help=u"""A filter to return only the protection policies that enforce backup colocation (mustEnforceCloudLocality is set to TRUE).""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return. Specify a value greater than 4.""") @cli_util.option('--page', help=u"""The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (ASC) or descending (DESC). Allowed values are: - ASC - DESC""") @@ -1034,12 +1330,14 @@ def list_protected_databases(ctx, from_json, all_pages, page_size, compartment_i @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'recovery', 'class': 'ProtectionPolicyCollection'}) @cli_util.wrap_exceptions -def list_protection_policies(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, protection_policy_id, owner, limit, page, sort_order, sort_by): +def list_protection_policies(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, protection_policy_id, owner, must_enforce_cloud_locality, 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 lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state if display_name is not None: @@ -1048,6 +1346,8 @@ def list_protection_policies(ctx, from_json, all_pages, page_size, compartment_i kwargs['protection_policy_id'] = protection_policy_id if owner is not None: kwargs['owner'] = owner + if must_enforce_cloud_locality is not None: + kwargs['must_enforce_cloud_locality'] = must_enforce_cloud_locality if limit is not None: kwargs['limit'] = limit if page is not None: @@ -1064,7 +1364,6 @@ def list_protection_policies(ctx, from_json, all_pages, page_size, compartment_i result = cli_util.list_call_get_all_results( client.list_protection_policies, - compartment_id=compartment_id, **kwargs ) elif limit is not None: @@ -1072,19 +1371,17 @@ def list_protection_policies(ctx, from_json, all_pages, page_size, compartment_i client.list_protection_policies, limit, page_size, - compartment_id=compartment_id, **kwargs ) else: result = client.list_protection_policies( - compartment_id=compartment_id, **kwargs ) cli_util.render_response(result, ctx) @recovery_service_subnet_collection_group.command(name=cli_util.override('recovery.list_recovery_service_subnets.command_name', 'list-recovery-service-subnets'), help=u"""Returns a list of Recovery Service Subnets. \n[Command Reference](listRecoveryServiceSubnets)""") -@cli_util.option('--compartment-id', required=True, help=u"""The compartment OCID.""") +@cli_util.option('--compartment-id', help=u"""The compartment OCID.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETE_SCHEDULED", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only the resources that match the specified lifecycle state.""") @cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire 'displayname' given.""") @cli_util.option('--id', help=u"""The recovery service subnet OCID.""") @@ -1106,6 +1403,8 @@ def list_recovery_service_subnets(ctx, from_json, all_pages, page_size, compartm 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 lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state if display_name is not None: @@ -1130,7 +1429,6 @@ def list_recovery_service_subnets(ctx, from_json, all_pages, page_size, compartm result = cli_util.list_call_get_all_results( client.list_recovery_service_subnets, - compartment_id=compartment_id, **kwargs ) elif limit is not None: @@ -1138,12 +1436,10 @@ def list_recovery_service_subnets(ctx, from_json, all_pages, page_size, compartm client.list_recovery_service_subnets, limit, page_size, - compartment_id=compartment_id, **kwargs ) else: result = client.list_recovery_service_subnets( - compartment_id=compartment_id, **kwargs ) cli_util.render_response(result, ctx) @@ -1264,7 +1560,7 @@ def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id @work_request_summary_collection_group.command(name=cli_util.override('recovery.list_work_requests.command_name', 'list-work-requests'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listWorkRequests)""") -@cli_util.option('--compartment-id', required=True, help=u"""The compartment OCID.""") +@cli_util.option('--compartment-id', help=u"""The compartment OCID.""") @cli_util.option('--work-request-id', help=u"""Unique Oracle-assigned identifier of the work request.""") @cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "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.""") @@ -1285,6 +1581,8 @@ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, wor 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 work_request_id is not None: kwargs['work_request_id'] = work_request_id if status is not None: @@ -1307,7 +1605,6 @@ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, wor result = cli_util.list_call_get_all_results( client.list_work_requests, - compartment_id=compartment_id, **kwargs ) elif limit is not None: @@ -1315,18 +1612,18 @@ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, wor client.list_work_requests, limit, page_size, - compartment_id=compartment_id, **kwargs ) else: result = client.list_work_requests( - compartment_id=compartment_id, **kwargs ) cli_util.render_response(result, ctx) -@protected_database_group.command(name=cli_util.override('recovery.schedule_protected_database_deletion.command_name', 'schedule-protected-database-deletion'), help=u"""Defines a preferred schedule to delete a protected database after you terminate the source database. The default schedule is DELETE_AFTER_72_HOURS, so that the delete operation can occur 72 hours (3 days) after the source database is terminated. The alternate schedule is DELETE_AFTER_RETENTION_PERIOD. Specify this option if you want to delete a protected database only after the policy-defined backup retention period expires. \n[Command Reference](scheduleProtectedDatabaseDeletion)""") +@protected_database_group.command(name=cli_util.override('recovery.schedule_protected_database_deletion.command_name', 'schedule-protected-database-deletion'), help=u"""Defines a preferred schedule to delete a protected database after you terminate the source database. Only the user or the Oracle Database service that created the protected database is allowed to modify or delete it. + +The default schedule is DELETE_AFTER_72_HOURS, so that the delete operation can occur 72 hours (3 days) after the source database is terminated. The alternate schedule is DELETE_AFTER_RETENTION_PERIOD. Specify this option if you want to delete a protected database only after the policy-defined backup retention period expires. \n[Command Reference](scheduleProtectedDatabaseDeletion)""") @cli_util.option('--protected-database-id', required=True, help=u"""The protected database OCID.""") @cli_util.option('--deletion-schedule', type=custom_types.CliCaseInsensitiveChoice(["DELETE_AFTER_RETENTION_PERIOD", "DELETE_AFTER_72_HOURS"]), help=u"""Defines a preferred schedule to delete a protected database after you terminate the source database. * The default schedule is DELETE_AFTER_72_HOURS, so that the delete operation can occur 72 hours (3 days) after the source database is terminated. * The alternate schedule is DELETE_AFTER_RETENTION_PERIOD. Specify this option if you want to delete a protected database only after the policy-defined backup retention period expires.""") @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.""") @@ -1389,6 +1686,88 @@ def schedule_protected_database_deletion(ctx, from_json, wait_for_state, max_wai cli_util.render_response(result, ctx) +@long_term_backup_group.command(name=cli_util.override('recovery.update_long_term_backup.command_name', 'update'), help=u"""Updates the specified long term backup. \n[Command Reference](updateLongTermBackup)""") +@cli_util.option('--long-term-backup-id', required=True, help=u"""The long term backup OCID.""") +@cli_util.option('--display-name', help=u"""A user provided name for the long term backup. The 'displayName' does not have to be unique, and it can be modified. Avoid entering confidential information.""") +@cli_util.option('--retention-period', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The maximum period to retain the long-term backup. Specify the retention period type and the duration for the long-term backup. If you have chosen the retention period type as 'DAYS', then specify a duration ranging from 90 days to 3650 days. If you have chosen the retention period type as 'YEARS', then specify a duration ranging from 1 year to 10 years. + +This option is a JSON list with items of type RetentionPeriodValue. For documentation on RetentionPeriodValue please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databaserecovery/20210216/datatypes/RetentionPeriodValue.""" + 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\"}}`. For more information, see [Resource Tags]""" + 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", "WAITING", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state 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({'retention-period': {'module': 'recovery', 'class': 'list[RetentionPeriodValue]'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', '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={'retention-period': {'module': 'recovery', 'class': 'list[RetentionPeriodValue]'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_long_term_backup(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, long_term_backup_id, display_name, retention_period, freeform_tags, defined_tags, if_match): + + if isinstance(long_term_backup_id, six.string_types) and len(long_term_backup_id.strip()) == 0: + raise click.UsageError('Parameter --long-term-backup-id cannot be whitespace or empty string') + if not force: + if retention_period or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to retention-period 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 retention_period is not None: + _details['retentionPeriod'] = cli_util.parse_json_parameter("retention_period", retention_period) + + 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('recovery', 'database_recovery', ctx) + result = client.update_long_term_backup( + long_term_backup_id=long_term_backup_id, + update_long_term_backup_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) + + @protected_database_group.command(name=cli_util.override('recovery.update_protected_database.command_name', 'update'), help=u"""Updates the Protected Database \n[Command Reference](updateProtectedDatabase)""") @cli_util.option('--protected-database-id', required=True, help=u"""The protected database OCID.""") @cli_util.option('--display-name', help=u"""The protected database name. You can change the displayName. Avoid entering confidential information.""") @@ -1582,6 +1961,9 @@ def update_protection_policy(ctx, from_json, force, wait_for_state, max_wait_sec @cli_util.option('--display-name', help=u"""A user-provided name for the recovery service subnet. The 'displayName' does not have to be unique, and it can be modified. Avoid entering confidential information.""") @cli_util.option('--subnets', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of OCIDs of the subnets associated with the recovery service subnet.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of network security group (NSG) OCIDs that are associated with the Recovery Service subnet. You can specify a maximum of 5 unique OCIDs, which implies that you can associate a maximum of 5 NSGs to each Recovery Service subnet. Specify an empty array if you want to remove all the associated NSGs from a Recovery Service subnet. See [Network Security Groups] for more information.""" + 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('--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\"}}`. For more information, see [Resource Tags]""" + 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.""") @@ -1589,18 +1971,18 @@ def update_protection_policy(ctx, from_json, force, wait_for_state, max_wait_sec @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "WAITING", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state 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({'subnets': {'module': 'recovery', 'class': 'list[string]'}, 'nsg-ids': {'module': 'recovery', 'class': 'list[string]'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'subnets': {'module': 'recovery', 'class': 'list[string]'}, 'nsg-ids': {'module': 'recovery', 'class': 'list[string]'}, 'security-attributes': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', '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={'subnets': {'module': 'recovery', 'class': 'list[string]'}, 'nsg-ids': {'module': 'recovery', 'class': 'list[string]'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'subnets': {'module': 'recovery', 'class': 'list[string]'}, 'nsg-ids': {'module': 'recovery', 'class': 'list[string]'}, 'security-attributes': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'recovery', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'recovery', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_recovery_service_subnet(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, recovery_service_subnet_id, display_name, subnets, nsg_ids, freeform_tags, defined_tags, if_match): +def update_recovery_service_subnet(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, recovery_service_subnet_id, display_name, subnets, nsg_ids, security_attributes, freeform_tags, defined_tags, if_match): if isinstance(recovery_service_subnet_id, six.string_types) and len(recovery_service_subnet_id.strip()) == 0: raise click.UsageError('Parameter --recovery-service-subnet-id cannot be whitespace or empty string') if not force: - if subnets or nsg_ids or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to subnets and nsg-ids and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if subnets or nsg_ids or security_attributes or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to subnets and nsg-ids and security-attributes and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -1619,6 +2001,9 @@ def update_recovery_service_subnet(ctx, from_json, force, wait_for_state, max_wa if nsg_ids is not None: _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) diff --git a/services/recovery/tests/util/generated/command_to_api.py b/services/recovery/tests/util/generated/command_to_api.py index 2749c539a..ca8be1931 100644 --- a/services/recovery/tests/util/generated/command_to_api.py +++ b/services/recovery/tests/util/generated/command_to_api.py @@ -2,22 +2,27 @@ # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. SDK_client_map = { + "recovery.cancel_long_term_backup": "oci.recovery.DatabaseRecoveryClient.cancel_long_term_backup", "recovery.cancel_protected_database_deletion": "oci.recovery.DatabaseRecoveryClient.cancel_protected_database_deletion", "recovery.change_protected_database_compartment": "oci.recovery.DatabaseRecoveryClient.change_protected_database_compartment", "recovery.change_protected_database_subscription": "oci.recovery.DatabaseRecoveryClient.change_protected_database_subscription", "recovery.change_protection_policy_compartment": "oci.recovery.DatabaseRecoveryClient.change_protection_policy_compartment", "recovery.change_recovery_service_subnet_compartment": "oci.recovery.DatabaseRecoveryClient.change_recovery_service_subnet_compartment", + "recovery.create_long_term_backup": "oci.recovery.DatabaseRecoveryClient.create_long_term_backup", "recovery.create_protected_database": "oci.recovery.DatabaseRecoveryClient.create_protected_database", "recovery.create_protection_policy": "oci.recovery.DatabaseRecoveryClient.create_protection_policy", "recovery.create_recovery_service_subnet": "oci.recovery.DatabaseRecoveryClient.create_recovery_service_subnet", + "recovery.delete_long_term_backup": "oci.recovery.DatabaseRecoveryClient.delete_long_term_backup", "recovery.delete_protected_database": "oci.recovery.DatabaseRecoveryClient.delete_protected_database", "recovery.delete_protection_policy": "oci.recovery.DatabaseRecoveryClient.delete_protection_policy", "recovery.delete_recovery_service_subnet": "oci.recovery.DatabaseRecoveryClient.delete_recovery_service_subnet", "recovery.fetch_protected_database_configuration": "oci.recovery.DatabaseRecoveryClient.fetch_protected_database_configuration", + "recovery.get_long_term_backup": "oci.recovery.DatabaseRecoveryClient.get_long_term_backup", "recovery.get_protected_database": "oci.recovery.DatabaseRecoveryClient.get_protected_database", "recovery.get_protection_policy": "oci.recovery.DatabaseRecoveryClient.get_protection_policy", "recovery.get_recovery_service_subnet": "oci.recovery.DatabaseRecoveryClient.get_recovery_service_subnet", "recovery.get_work_request": "oci.recovery.DatabaseRecoveryClient.get_work_request", + "recovery.list_long_term_backups": "oci.recovery.DatabaseRecoveryClient.list_long_term_backups", "recovery.list_protected_databases": "oci.recovery.DatabaseRecoveryClient.list_protected_databases", "recovery.list_protection_policies": "oci.recovery.DatabaseRecoveryClient.list_protection_policies", "recovery.list_recovery_service_subnets": "oci.recovery.DatabaseRecoveryClient.list_recovery_service_subnets", @@ -25,6 +30,7 @@ "recovery.list_work_request_logs": "oci.recovery.DatabaseRecoveryClient.list_work_request_logs", "recovery.list_work_requests": "oci.recovery.DatabaseRecoveryClient.list_work_requests", "recovery.schedule_protected_database_deletion": "oci.recovery.DatabaseRecoveryClient.schedule_protected_database_deletion", + "recovery.update_long_term_backup": "oci.recovery.DatabaseRecoveryClient.update_long_term_backup", "recovery.update_protected_database": "oci.recovery.DatabaseRecoveryClient.update_protected_database", "recovery.update_protection_policy": "oci.recovery.DatabaseRecoveryClient.update_protection_policy", "recovery.update_recovery_service_subnet": "oci.recovery.DatabaseRecoveryClient.update_recovery_service_subnet", diff --git a/setup.py b/setup.py index dc0fa9875..ca0060ecf 100644 --- a/setup.py +++ b/setup.py @@ -30,19 +30,21 @@ def open_relative(*path): readme = f.read() requires = [ - 'oci==2.184.2', + 'oci==2.185.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"', 'click>=8.3.3,<=8.4.2; python_version >= "3.11"', - 'cryptography>=3.2.1,<51.0.0', 'importlib-metadata; python_version < "3.8"', + 'cryptography>=3.2.1,<=37.0.2; python_version <= "3.7"', + 'cryptography>=3.2.1,<51.0.0; python_version >= "3.8"', 'jmespath>=0.10.0,<=1.0.1', 'python-dateutil>=2.5.3,<3.0.0', 'pytz>=2016.10,<=2026.2', 'six>=1.15.0,<2.0.0', 'terminaltables==3.1.10', - 'pyOpenSSL>=17.5.0,<27.0.0', + 'pyOpenSSL>=17.5.0,<22.0.0; python_version <= "3.7"', + 'pyOpenSSL>=26.2.0,<27.0.0; python_version >= "3.8"', 'PyYAML>=5.4,<=6.0.2', 'prompt-toolkit>=3.0.38,<=3.0.43; python_version > "3.6"', 'prompt-toolkit==3.0.29; python_version == "3.6"', diff --git a/src/oci_cli/version.py b/src/oci_cli/version.py index dfdd296b2..8f790a646 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.90.3' +__version__ = '3.91.0'