diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d21f7b091..448174ed9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,104 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__. +3.82.0 - 2026-05-12 +------------------- +Added +~~~~~ +* Database Tools Runtime service + + * ``oci dbtools-runtime`` + + * Support for executing SQL on connections + + * ``oci dbtools-runtime connection execute-sql async`` + * ``oci dbtools-runtime connection execute-sql sync`` + + * Support for Database API Gateway Configuration resources + + * ``oci dbtools-runtime database-api-gateway-config get content`` + * ``oci dbtools-runtime database-api-gateway-config-pool create default`` + * ``oci dbtools-runtime database-api-gateway-config-pool list`` + * ``oci dbtools-runtime database-api-gateway-config-pool-api-spec list`` + * ``oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec list`` + + * Support for Oracle Database External Authentication + + * ``oci dbtools-runtime connection validate oracle-database`` + * ``oci dbtools-runtime property-set update oracle-database-external-authentication-details`` + +* Database Tools service + + * Support for Model Context Protocol (MCP) Servers + * ``oci dbtools mcp-server create-mcp-server-default`` + * ``oci dbtools mcp-server get`` + * ``oci dbtools mcp-server list`` + * ``oci dbtools mcp-server update-mcp-server-default`` + * ``oci dbtools mcp-server delete`` + * ``oci dbtools mcp-server cascading-delete`` + * ``oci dbtools mcp-server change-compartment`` + * ``oci dbtools mcp-server add-lock`` + * ``oci dbtools mcp-server remove-lock`` + + * Support for MCP Toolsets for customizable reporting tools + + * ``oci dbtools mcp-toolset create-mcp-toolset-customizable-reporting-tools`` + * ``oci dbtools mcp-toolset get`` + * ``oci dbtools mcp-toolset list`` + * ``oci dbtools mcp-toolset update-mcp-toolset-customizable-reporting-tools`` + * ``oci dbtools mcp-toolset delete`` + * ``oci dbtools mcp-toolset change-compartment`` + * ``oci dbtools mcp-toolset add-lock`` + * ``oci dbtools mcp-toolset remove-lock`` + + * Support for SQL Reports + + * ``oci dbtools sql-report create-sql-report-oracle-database`` + * ``oci dbtools sql-report get`` + * ``oci dbtools sql-report list`` + * ``oci dbtools sql-report update-sql-report-oracle-database`` + * ``oci dbtools sql-report delete`` + * ``oci dbtools sql-report change-compartment`` + * ``oci dbtools sql-report add-lock`` + * ``oci dbtools sql-report remove-lock`` + + * Support for Database API Gateway Configurations + * ``oci dbtools database-api-gateway-config create-database-api-gateway-config-default`` + * ``oci dbtools database-api-gateway-config get`` + * ``oci dbtools database-api-gateway-config list`` + * ``oci dbtools database-api-gateway-config update-database-api-gateway-config-default`` + * ``oci dbtools database-api-gateway-config delete`` + * ``oci dbtools database-api-gateway-config change-compartment`` + * ``oci dbtools database-api-gateway-config add-lock`` + * ``oci dbtools database-api-gateway-config remove-lock`` + +* Support for PATCH APIs to add or delete multiple IPv6 prefixes in the Virtual Cloud Network service + + * ``oci network vcn patch`` + * ``oci network subnet patch`` + +* Support for new optional parameters ``--connectivity-type`` and ``--gateways`` in the IoT service Digital Twin Instance operations + + * ``oci iot digital-twin-instance create --connectivity-type --gateways`` + * ``oci iot digital-twin-instance list --connectivity-type`` + * ``oci iot digital-twin-instance update --gateways`` + +* Support for additional Generative AI model capability values by Generative AI service + + * ``oci generative-ai imported-model create-from-huggingface --capabilities`` + * ``oci generative-ai imported-model create-from-objectstorage --capabilities`` + * ``oci generative-ai imported-model update --capabilities`` + * ``oci generative-ai hosted-deployment-collection list-hosted-deployments --capability`` + * ``oci generative-ai imported-model-collection list-imported-models --capability`` + +Changed +~~~~~~~ + - [BREAKING] Added validation to restrict allowed profile name characters in OCI CLI session and config commands. + +Security +~~~~~~~~ +* Updated pytz dependency upper bound to `<=2026.2` for python version. + 3.81.1 - 2026-05-05 ------------------- Added diff --git a/requirements.txt b/requirements.txt index 6ebf3b347..cbcd6c7c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ appdirs==1.4.3 arrow>=1.0.0,<2.0.0 certifi>=2025.1.31,<2026.0.0 cffi>=1.9.1,<2.0.0 -click==8.0.4 +click<=8.1.2 coverage==4.5.2 cryptography>=3.2.1,<47.0.0 httpsig-cffi==15.0.0 @@ -15,7 +15,7 @@ Jinja2>=3.1.5,<4.0.0; python_version >= '3.7' jmespath>=0.10.0,<=1.0.1 ndg-httpsclient==0.4.2 mock==2.0.0 -oci==2.173.1 +oci==2.174.0 packaging>=22.0,<25.0; python_version > '3.8' packaging==20.2; python_version <= '3.8' pluggy==0.13.0 @@ -28,7 +28,7 @@ pytest==4.6.10; python_version <= '3.9' pytest==7.1.2; python_version >= '3.10' pytest-cov==2.5.1 python-dateutil>=2.5.3,<3.0.0 -pytz>=2016.10,<2025.0 +pytz>=2016.10,<=2026.2 requests==2.27.0; python_version == '3.6' requests==2.31.0; python_version == '3.7' requests>=2.32.4,<3.0.0; python_version > '3.7' @@ -55,4 +55,4 @@ setuptools==68.0.0; python_version == '3.7' setuptools==59.6.0; python_version == '3.6' # this is required because of python 3.6 requests dependency version bound urllib3==2.6.3; python_version >= '3.10' -urllib3==1.26.20; python_version < '3.10' \ No newline at end of file +urllib3==1.26.20; python_version < '3.10' diff --git a/services/core/src/oci_cli_compute/generated/compute_cli.py b/services/core/src/oci_cli_compute/generated/compute_cli.py index 91926b4d0..99431120a 100644 --- a/services/core/src/oci_cli_compute/generated/compute_cli.py +++ b/services/core/src/oci_cli_compute/generated/compute_cli.py @@ -236,13 +236,13 @@ def compute_capacity_topology_group(): pass -@click.command(cli_util.override('compute.compute_cluster_group.command_name', 'compute-cluster'), cls=CommandGroupWithAlias, help="""A remote direct memory access (RDMA) network group. +@click.command(cli_util.override('compute.compute_cluster_group.command_name', 'compute-cluster'), cls=CommandGroupWithAlias, help="""The data for creating a [compute cluster]. A compute cluster is an empty remote direct memory access (RDMA) network group -A cluster network on a [compute cluster] is a group of high performance computing (HPC), GPU, or optimized instances that are connected with an ultra low-latency network. +After the compute cluster is created, you can use the compute cluster's OCID with the [LaunchInstance] operation to create instances in the compute cluster. The instances must be created in the same compartment and availability domain as the cluster. Use compute clusters when you want to manage instances in the cluster individually in the RDMA network group. -For details about cluster networks that use instance pools to manage groups of identical instances, see [ClusterNetwork].""") +For details about creating a cluster network that uses instance pools to manage groups of identical instances, see [CreateClusterNetworkDetails].""") @cli_util.help_option_group def compute_cluster_group(): pass 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 bc9fc82b1..c2af5d5c5 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 @@ -11718,6 +11718,144 @@ def modify_vcn_cidr(ctx, from_json, wait_for_state, max_wait_seconds, wait_inter cli_util.render_response(result, ctx) +@subnet_group.command(name=cli_util.override('virtual_network.patch_subnet.command_name', 'patch'), help=u"""Updates a Subnet by evaluating a sequence of patch instructions (JSON List Patch). This operation is restricted to IPv6 CIDR-related fields only. Supported selections (exact match) are: - ipv6CidrBlock - ipv6CidrBlocks Only the REPLACE operation is supported. The request must include the If-Match header for optimistic concurrency control. This is an asynchronous operation. The subnet\u2019s lifecycleState is set to UPDATING while the patch work request is in progress, and changes back to AVAILABLE after the patch operation is complete. All patch instructions are applied atomically as a single operation; either all succeed or none are applied. \n[Command Reference](patchSubnet)""") +@cli_util.option('--subnet-id', required=True, help=u"""Specify the [OCID] of the subnet.""") +@cli_util.option('--patch-subnet-instructions', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of patch instructions for Subnet.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED"]), 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 SUCCEEDED 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({'patch-subnet-instructions': {'module': 'core', 'class': 'list[PatchSubnetInstruction]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'patch-subnet-instructions': {'module': 'core', 'class': 'list[PatchSubnetInstruction]'}}) +@cli_util.wrap_exceptions +def patch_subnet(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, subnet_id, patch_subnet_instructions, if_match): + + if isinstance(subnet_id, six.string_types) and len(subnet_id.strip()) == 0: + raise click.UsageError('Parameter --subnet-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['patchSubnetInstructions'] = cli_util.parse_json_parameter("patch_subnet_instructions", patch_subnet_instructions) + + client = cli_util.build_client('core', 'virtual_network', ctx) + result = client.patch_subnet( + subnet_id=subnet_id, + patch_subnet_details=_details, + **kwargs + ) + work_request_client = cli_util.build_client('work_requests', 'work_request', ctx) + if wait_for_state: + + if hasattr(work_request_client, 'get_work_request') and callable(getattr(work_request_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(work_request_client, work_request_client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + if hasattr(result, "data") and hasattr(result.data, "resources") and len(result.data.resources) == 1: + entity_type = result.data.resources[0].entity_type + identifier = result.data.resources[0].identifier + get_operation = 'get_' + entity_type + if hasattr(client, get_operation) and callable(getattr(client, get_operation)): + result = getattr(client, get_operation)(identifier) + + 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) + + +@vcn_group.command(name=cli_util.override('virtual_network.patch_vcn.command_name', 'patch'), help=u"""Updates a VCN by evaluating a sequence of patch instructions (JSON List Patch). This operation is restricted to IPv6 CIDR-related fields only. Supported selections (exact match) are: - ipv6CidrBlock - ipv6PublicCidrBlock - ipv6PrivateCidrBlocks - byoipv6CidrDetails Only the REPLACE operation is supported. The request must include the If-Match header for optimistic concurrency control. This is an asynchronous operation. The VCN\u2019s lifecycleState is set to UPDATING while the patch work request is in progress, and changes back to AVAILABLE after the patch operation is complete. All patch instructions are applied atomically as a single operation; either all succeed or none are applied. NOTE: `ipv6PublicCidrBlock` represents Oracle provided GUA on VCN. With PATCH API, customer can only remove it if present. Since this is Oracle provided CIDR, there is no concept of replacing with customer provided CIDR. \n[Command Reference](patchVcn)""") +@cli_util.option('--vcn-id', required=True, help=u"""Specify the [OCID] of the VCN.""") +@cli_util.option('--patch-vcn-instructions', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of patch instructions for VCN.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED"]), 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 SUCCEEDED 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({'patch-vcn-instructions': {'module': 'core', 'class': 'list[PatchVcnInstruction]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'patch-vcn-instructions': {'module': 'core', 'class': 'list[PatchVcnInstruction]'}}) +@cli_util.wrap_exceptions +def patch_vcn(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, vcn_id, patch_vcn_instructions, if_match): + + if isinstance(vcn_id, six.string_types) and len(vcn_id.strip()) == 0: + raise click.UsageError('Parameter --vcn-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['patchVcnInstructions'] = cli_util.parse_json_parameter("patch_vcn_instructions", patch_vcn_instructions) + + client = cli_util.build_client('core', 'virtual_network', ctx) + result = client.patch_vcn( + vcn_id=vcn_id, + patch_vcn_details=_details, + **kwargs + ) + work_request_client = cli_util.build_client('work_requests', 'work_request', ctx) + if wait_for_state: + + if hasattr(work_request_client, 'get_work_request') and callable(getattr(work_request_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(work_request_client, work_request_client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + if hasattr(result, "data") and hasattr(result.data, "resources") and len(result.data.resources) == 1: + entity_type = result.data.resources[0].entity_type + identifier = result.data.resources[0].identifier + get_operation = 'get_' + entity_type + if hasattr(client, get_operation) and callable(getattr(client, get_operation)): + result = getattr(client, get_operation)(identifier) + + 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) + + @private_ip_group.command(name=cli_util.override('virtual_network.private_ip_vnic_detach.command_name', 'private-ip-vnic-detach'), help=u"""Unassign the specified PrivateIP address from Virtual Network Interface Card (VNIC). You must specify the PrivateIP [OCID]. \n[Command Reference](privateIpVnicDetach)""") @cli_util.option('--private-ip-id', required=True, help=u"""The [OCID] of the private IP or IPv6.""") @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.""") diff --git a/services/core/tests/util/generated/command_to_api.py b/services/core/tests/util/generated/command_to_api.py index f96a8e5e8..866fda1bd 100644 --- a/services/core/tests/util/generated/command_to_api.py +++ b/services/core/tests/util/generated/command_to_api.py @@ -218,6 +218,8 @@ "virtual_network.list_vtaps": "oci.core.VirtualNetworkClient.list_vtaps", "virtual_network.modify_ipv4_subnet_cidr": "oci.core.VirtualNetworkClient.modify_ipv4_subnet_cidr", "virtual_network.modify_vcn_cidr": "oci.core.VirtualNetworkClient.modify_vcn_cidr", + "virtual_network.patch_subnet": "oci.core.VirtualNetworkClient.patch_subnet", + "virtual_network.patch_vcn": "oci.core.VirtualNetworkClient.patch_vcn", "virtual_network.private_ip_vnic_detach": "oci.core.VirtualNetworkClient.private_ip_vnic_detach", "virtual_network.remove_drg_route_distribution_statements": "oci.core.VirtualNetworkClient.remove_drg_route_distribution_statements", "virtual_network.remove_drg_route_rules": "oci.core.VirtualNetworkClient.remove_drg_route_rules", diff --git a/services/database_tools/src/oci_cli_database_tools/databasetools_cli_extended.py b/services/database_tools/src/oci_cli_database_tools/databasetools_cli_extended.py index bf09701c5..09410b3e2 100644 --- a/services/database_tools/src/oci_cli_database_tools/databasetools_cli_extended.py +++ b/services/database_tools/src/oci_cli_database_tools/databasetools_cli_extended.py @@ -118,9 +118,27 @@ def update_database_tools_connection_update_database_tools_connection_oracle_dat ctx.invoke(databasetools_cli.update_database_tools_connection_update_database_tools_connection_oracle_database_details, **kwargs) +databasetools_cli.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_built_in_sql_tools_details.help = """Creates a new Database Tools MCP Toolset for built-in SQL tools. \n[Command Reference](createDatabaseToolsMcpToolset)""" +databasetools_cli.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_custom_sql_tool_details.help = """Creates a new Database Tools MCP Toolset for a custom SQL tool. \n[Command Reference](createDatabaseToolsMcpToolset)""" +databasetools_cli.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_customizable_reporting_tools_details.help = """Creates a new Database Tools MCP Toolset for customizable reporting tools. \n[Command Reference](createDatabaseToolsMcpToolset)""" +databasetools_cli.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_gen_ai_sql_assistant_details.help = """Creates a new Database Tools MCP Toolset for a GenAI SQL assistant. \n[Command Reference](createDatabaseToolsMcpToolset)""" +databasetools_cli.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_built_in_sql_tools_details.help = """Updates the specified Database Tools MCP Toolset for built-in SQL tools. \n[Command Reference](updateDatabaseToolsMcpToolset)""" +databasetools_cli.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_custom_sql_tool_details.help = """Updates the specified Database Tools MCP Toolset for a custom SQL tool. \n[Command Reference](updateDatabaseToolsMcpToolset)""" +databasetools_cli.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_customizable_reporting_tools_details.help = """Updates the specified Database Tools MCP Toolset for customizable reporting tools. \n[Command Reference](updateDatabaseToolsMcpToolset)""" +databasetools_cli.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_gen_ai_sql_assistant_details.help = """Updates the specified Database Tools MCP Toolset for a GenAI SQL assistant. \n[Command Reference](updateDatabaseToolsMcpToolset)""" +databasetools_cli.database_tools_endpoint_service_group.help = """Provides information about Database Tools endpoint services.""" +databasetools_cli.cascading_delete_database_tools_mcp_server.help = """Deletes the Database Tools MCP server resource and its associated assets. \n[Command Reference](cascadingDeleteDatabaseToolsMcpServer)""" +databasetools_cli.change_database_tools_mcp_server_compartment.help = """Moves the specified Database Tools MCP server to a different compartment in the same tenancy. \n[Command Reference](changeDatabaseToolsMcpServerCompartment)""" +databasetools_cli.get_database_tools_mcp_server.help = """Gets details of the specified Database Tools MCP server. \n[Command Reference](getDatabaseToolsMcpServer)""" +databasetools_cli.create_database_tools_database_api_gateway_config.help = """Creates a new Database Tools database API gateway config. \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfig)""" +databasetools_cli.create_database_tools_database_api_gateway_config_create_database_tools_database_api_gateway_config_default_details.help = """Creates a new default Database Tools database API gateway config. \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfig)""" +databasetools_cli.create_database_tools_sql_report.help = """Creates a new Database Tools SQL report. \n[Command Reference](createDatabaseToolsSqlReport)""" +databasetools_cli.create_database_tools_sql_report_create_database_tools_sql_report_oracle_database_details.help = """Creates a new Database Tools SQL report for Oracle Database. \n[Command Reference](createDatabaseToolsSqlReport)""" + + @cli_util.copy_params_from_generated_command(databasetools_cli.create_database_tools_connection_create_database_tools_connection_oracle_database_details, params_to_exclude=['user_password']) @databasetools_cli.database_tools_connection_group.command(name=databasetools_cli.create_database_tools_connection_create_database_tools_connection_oracle_database_details.name, help=databasetools_cli.create_database_tools_connection_create_database_tools_connection_oracle_database_details.help) -@cli_util.option('--user-password-secret-id', required=True, help="""The [OCID] of the secret containing the user password.""") +@cli_util.option('--user-password-secret-id', help="""The [OCID] of the secret containing the user password. Required when ``--authentication-type`` is ``PASSWORD``. Not required when ``--authentication-type`` is ``TOKEN``.""") @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClient'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) @cli_util.wrap_exceptions @@ -693,3 +711,147 @@ def validate_database_tools_identity_credential_validate_database_tools_identity kwargs.pop('identity_id') ctx.invoke(databasetools_cli.validate_database_tools_identity_credential_validate_database_tools_identity_credential_oracle_database_resource_principal_details, **kwargs) + + +# oci dbtools database-tools-database-api-gateway-config -> oci dbtools database-api-gateway-config +cli_util.rename_command(databasetools_cli, databasetools_cli.dbtools_root_group, databasetools_cli.database_tools_database_api_gateway_config_group, "database-api-gateway-config") + + +# oci dbtools database-tools-mcp-server -> oci dbtools mcp-server +cli_util.rename_command(databasetools_cli, databasetools_cli.dbtools_root_group, databasetools_cli.database_tools_mcp_server_group, "mcp-server") + + +# oci dbtools database-tools-mcp-toolset -> oci dbtools mcp-toolset +cli_util.rename_command(databasetools_cli, databasetools_cli.dbtools_root_group, databasetools_cli.database_tools_mcp_toolset_group, "mcp-toolset") + + +# oci dbtools database-tools-sql-report -> oci dbtools sql-report +cli_util.rename_command(databasetools_cli, databasetools_cli.dbtools_root_group, databasetools_cli.database_tools_sql_report_group, "sql-report") + + +# oci dbtools database-tools-mcp-toolset-version-collection -> oci dbtools mcp-toolset-version-collection +cli_util.rename_command(databasetools_cli, databasetools_cli.dbtools_root_group, databasetools_cli.database_tools_mcp_toolset_version_collection_group, "mcp-toolset-version-collection") + + +# oci dbtools mcp-toolset-version-collection list-database-tools-mcp-toolset-versions -> oci dbtools mcp-toolset-version-collection list-mcp-toolset-version +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_version_collection_group, databasetools_cli.list_database_tools_mcp_toolset_versions, "list-mcp-toolset-version") + + +# oci dbtools database-tools-database-api-gateway-config create-database-tools-database-api-gateway-config-create-database-tools-database-api-gateway-config-default-details -> oci dbtools database-tools-database-api-gateway-config create-database-api-gateway-config-default +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_database_api_gateway_config_group, databasetools_cli.create_database_tools_database_api_gateway_config_create_database_tools_database_api_gateway_config_default_details, "create-database-api-gateway-config-default") + + +# oci dbtools database-tools-database-api-gateway-config update-database-tools-database-api-gateway-config-update-database-tools-database-api-gateway-config-default-details -> oci dbtools database-tools-database-api-gateway-config update-database-api-gateway-config-default +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_database_api_gateway_config_group, databasetools_cli.update_database_tools_database_api_gateway_config_update_database_tools_database_api_gateway_config_default_details, "update-database-api-gateway-config-default") + + +# oci dbtools database-tools-database-api-gateway-config add -> oci dbtools database-tools-database-api-gateway-config add-lock +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_database_api_gateway_config_group, databasetools_cli.add_database_tools_database_api_gateway_config_lock, "add-lock") + + +# oci dbtools database-tools-database-api-gateway-config remove -> oci dbtools database-tools-database-api-gateway-config remove-lock +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_database_api_gateway_config_group, databasetools_cli.remove_database_tools_database_api_gateway_config_lock, "remove-lock") + + +# oci dbtools database-tools-mcp-server create-database-tools-mcp-server-create-database-tools-mcp-server-default-details -> oci dbtools database-tools-mcp-server create-mcp-server-default +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_server_group, databasetools_cli.create_database_tools_mcp_server_create_database_tools_mcp_server_default_details, "create-mcp-server-default") + + +# oci dbtools database-tools-mcp-server update-database-tools-mcp-server-update-database-tools-mcp-server-details-default -> oci dbtools database-tools-mcp-server update-mcp-server-default +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_server_group, databasetools_cli.update_database_tools_mcp_server_update_database_tools_mcp_server_details_default, "update-mcp-server-default") + + +# oci dbtools database-tools-mcp-server add -> oci dbtools database-tools-mcp-server add-lock +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_server_group, databasetools_cli.add_database_tools_mcp_server_lock, "add-lock") + + +# oci dbtools database-tools-mcp-server remove -> oci dbtools database-tools-mcp-server remove-lock +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_server_group, databasetools_cli.remove_database_tools_mcp_server_lock, "remove-lock") + + +# oci dbtools database-tools-mcp-toolset create-database-tools-mcp-toolset-create-database-tools-mcp-toolset-built-in-sql-tools-details -> oci dbtools database-tools-mcp-toolset create-mcp-toolset-built-in-sql-tools +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_built_in_sql_tools_details, "create-mcp-toolset-built-in-sql-tools") + + +# oci dbtools database-tools-mcp-toolset create-database-tools-mcp-toolset-create-database-tools-mcp-toolset-custom-sql-tool-details -> oci dbtools database-tools-mcp-toolset create-mcp-toolset-custom-sql-tool +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_custom_sql_tool_details, "create-mcp-toolset-custom-sql-tool") + + +# oci dbtools database-tools-mcp-toolset create-database-tools-mcp-toolset-create-database-tools-mcp-toolset-customizable-reporting-tools-details -> oci dbtools database-tools-mcp-toolset create-mcp-toolset-customizable-reporting-tools +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_customizable_reporting_tools_details, "create-mcp-toolset-customizable-reporting-tools") + + +# oci dbtools database-tools-mcp-toolset create-database-tools-mcp-toolset-create-database-tools-mcp-toolset-gen-ai-sql-assistant-details -> oci dbtools database-tools-mcp-toolset create-mcp-toolset-gen-ai-sql-assistant +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_gen_ai_sql_assistant_details, "create-mcp-toolset-gen-ai-sql-assistant") + + +# oci dbtools database-tools-mcp-toolset update-database-tools-mcp-toolset-update-database-tools-mcp-toolset-built-in-sql-tools-details -> oci dbtools database-tools-mcp-toolset update-mcp-toolset-built-in-sql-tools +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_built_in_sql_tools_details, "update-mcp-toolset-built-in-sql-tools") + + +# oci dbtools database-tools-mcp-toolset update-database-tools-mcp-toolset-update-database-tools-mcp-toolset-custom-sql-tool-details -> oci dbtools database-tools-mcp-toolset update-mcp-toolset-custom-sql-tool +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_custom_sql_tool_details, "update-mcp-toolset-custom-sql-tool") + + +# oci dbtools database-tools-mcp-toolset update-database-tools-mcp-toolset-update-database-tools-mcp-toolset-customizable-reporting-tools-details -> oci dbtools database-tools-mcp-toolset update-mcp-toolset-customizable-reporting-tools +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_customizable_reporting_tools_details, "update-mcp-toolset-customizable-reporting-tools") + + +# oci dbtools database-tools-mcp-toolset update-database-tools-mcp-toolset-update-database-tools-mcp-toolset-gen-ai-sql-assistant-details -> oci dbtools database-tools-mcp-toolset update-mcp-toolset-gen-ai-sql-assistant +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_gen_ai_sql_assistant_details, "update-mcp-toolset-gen-ai-sql-assistant") + + +# oci dbtools database-tools-mcp-toolset add -> oci dbtools database-tools-mcp-toolset add-lock +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.add_database_tools_mcp_toolset_lock, "add-lock") + + +# oci dbtools database-tools-mcp-toolset remove -> oci dbtools database-tools-mcp-toolset remove-lock +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_mcp_toolset_group, databasetools_cli.remove_database_tools_mcp_toolset_lock, "remove-lock") + + +# oci dbtools database-tools-sql-report create-database-tools-sql-report-create-database-tools-sql-report-oracle-database-details -> oci dbtools database-tools-sql-report create-sql-report-oracle-database +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_sql_report_group, databasetools_cli.create_database_tools_sql_report_create_database_tools_sql_report_oracle_database_details, "create-sql-report-oracle-database") + + +# oci dbtools database-tools-sql-report update-database-tools-sql-report-update-database-tools-sql-report-details-oracle-database -> oci dbtools database-tools-sql-report update-sql-report-oracle-database +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_sql_report_group, databasetools_cli.update_database_tools_sql_report_update_database_tools_sql_report_details_oracle_database, "update-sql-report-oracle-database") + + +# oci dbtools database-tools-sql-report add -> oci dbtools database-tools-sql-report add-lock +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_sql_report_group, databasetools_cli.add_database_tools_sql_report_lock, "add-lock") + + +# oci dbtools database-tools-sql-report remove -> oci dbtools database-tools-sql-report remove-lock +cli_util.rename_command(databasetools_cli, databasetools_cli.database_tools_sql_report_group, databasetools_cli.remove_database_tools_sql_report_lock, "remove-lock") + + +# Remove create from oci dbtools database-tools-database-api-gateway-config +databasetools_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetools_cli.create_database_tools_database_api_gateway_config.name) + + +# Remove update from oci dbtools database-tools-database-api-gateway-config +databasetools_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetools_cli.update_database_tools_database_api_gateway_config.name) + + +# Remove create from oci dbtools database-tools-mcp-server +databasetools_cli.database_tools_mcp_server_group.commands.pop(databasetools_cli.create_database_tools_mcp_server.name) + + +# Remove update from oci dbtools database-tools-mcp-server +databasetools_cli.database_tools_mcp_server_group.commands.pop(databasetools_cli.update_database_tools_mcp_server.name) + + +# Remove create from oci dbtools database-tools-mcp-toolset +databasetools_cli.database_tools_mcp_toolset_group.commands.pop(databasetools_cli.create_database_tools_mcp_toolset.name) + + +# Remove update from oci dbtools database-tools-mcp-toolset +databasetools_cli.database_tools_mcp_toolset_group.commands.pop(databasetools_cli.update_database_tools_mcp_toolset.name) + + +# Remove create from oci dbtools database-tools-sql-report +databasetools_cli.database_tools_sql_report_group.commands.pop(databasetools_cli.create_database_tools_sql_report.name) + + +# Remove update from oci dbtools database-tools-sql-report +databasetools_cli.database_tools_sql_report_group.commands.pop(databasetools_cli.update_database_tools_sql_report.name) diff --git a/services/database_tools/src/oci_cli_database_tools/generated/databasetools_cli.py b/services/database_tools/src/oci_cli_database_tools/generated/databasetools_cli.py index 627110938..6bee79cf7 100644 --- a/services/database_tools/src/oci_cli_database_tools/generated/databasetools_cli.py +++ b/services/database_tools/src/oci_cli_database_tools/generated/databasetools_cli.py @@ -16,18 +16,36 @@ from oci_cli.aliasing import CommandGroupWithAlias -@cli.command(cli_util.override('dbtools.dbtools_root_group.command_name', 'dbtools'), cls=CommandGroupWithAlias, help=cli_util.override('dbtools.dbtools_root_group.help', """Use the Database Tools API to manage connections, private endpoints, and work requests in the Database Tools service."""), short_help=cli_util.override('dbtools.dbtools_root_group.short_help', """Database Tools""")) +@cli.command(cli_util.override('dbtools.dbtools_root_group.command_name', 'dbtools'), cls=CommandGroupWithAlias, help=cli_util.override('dbtools.dbtools_root_group.help', """Use the Database Tools API to manage connections, private endpoints, and work requests in the Database Tools service."""), short_help=cli_util.override('dbtools.dbtools_root_group.short_help', """Database Tools API""")) @cli_util.help_option_group def dbtools_root_group(): pass +@click.command(cli_util.override('dbtools.database_tools_database_api_gateway_config_group.command_name', 'database-tools-database-api-gateway-config'), cls=CommandGroupWithAlias, help="""Manage configuration related to database API gateway config resources.""") +@cli_util.help_option_group +def database_tools_database_api_gateway_config_group(): + pass + + +@click.command(cli_util.override('dbtools.database_tools_mcp_toolset_group.command_name', 'database-tools-mcp-toolset'), cls=CommandGroupWithAlias, help="""Allows the creation, configuration and management of an MCP Toolset.""") +@cli_util.help_option_group +def database_tools_mcp_toolset_group(): + pass + + @click.command(cli_util.override('dbtools.database_tools_endpoint_service_group.command_name', 'database-tools-endpoint-service'), cls=CommandGroupWithAlias, help="""Description of Database Tools Endpoint Service.""") @cli_util.help_option_group def database_tools_endpoint_service_group(): pass +@click.command(cli_util.override('dbtools.database_tools_mcp_server_group.command_name', 'database-tools-mcp-server'), cls=CommandGroupWithAlias, help="""Allows the creation, configuration and management of an MCP server.""") +@cli_util.help_option_group +def database_tools_mcp_server_group(): + pass + + @click.command(cli_util.override('dbtools.database_tools_private_endpoint_group.command_name', 'database-tools-private-endpoint'), cls=CommandGroupWithAlias, help="""Allows the Database Tools service to connect to databases in a customer's virtual cloud network (VCN).""") @cli_util.help_option_group def database_tools_private_endpoint_group(): @@ -58,19 +76,36 @@ def work_request_group(): pass +@click.command(cli_util.override('dbtools.database_tools_mcp_toolset_version_collection_group.command_name', 'database-tools-mcp-toolset-version-collection'), cls=CommandGroupWithAlias, help="""List of MCP toolset type version summary items.""") +@cli_util.help_option_group +def database_tools_mcp_toolset_version_collection_group(): + pass + + @click.command(cli_util.override('dbtools.database_tools_connection_group.command_name', 'database-tools-connection'), cls=CommandGroupWithAlias, help="""Provides connectivity details required to establish a connection to a database.""") @cli_util.help_option_group def database_tools_connection_group(): pass +@click.command(cli_util.override('dbtools.database_tools_sql_report_group.command_name', 'database-tools-sql-report'), cls=CommandGroupWithAlias, help="""Allows generating a summary of SQL query execution details for database operations.""") +@cli_util.help_option_group +def database_tools_sql_report_group(): + pass + + +dbtools_root_group.add_command(database_tools_database_api_gateway_config_group) +dbtools_root_group.add_command(database_tools_mcp_toolset_group) dbtools_root_group.add_command(database_tools_endpoint_service_group) +dbtools_root_group.add_command(database_tools_mcp_server_group) dbtools_root_group.add_command(database_tools_private_endpoint_group) dbtools_root_group.add_command(database_tools_identity_group) dbtools_root_group.add_command(work_request_error_group) dbtools_root_group.add_command(work_request_log_entry_group) dbtools_root_group.add_command(work_request_group) +dbtools_root_group.add_command(database_tools_mcp_toolset_version_collection_group) dbtools_root_group.add_command(database_tools_connection_group) +dbtools_root_group.add_command(database_tools_sql_report_group) @database_tools_connection_group.command(name=cli_util.override('dbtools.add_database_tools_connection_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsConnection resource. \n[Command Reference](addDatabaseToolsConnectionLock)""") @@ -142,25 +177,25 @@ def add_database_tools_connection_lock(ctx, from_json, wait_for_state, max_wait_ cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.add_database_tools_identity_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsIdentity resource. \n[Command Reference](addDatabaseToolsIdentityLock)""") -@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.add_database_tools_database_api_gateway_config_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsDatabaseApiGatewayConfig resource. \n[Command Reference](addDatabaseToolsDatabaseApiGatewayConfigLock)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") @cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") @cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") @cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") @cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @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': 'database_tools', 'class': 'DatabaseToolsIdentity'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsDatabaseApiGatewayConfig'}) @cli_util.wrap_exceptions -def add_database_tools_identity_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, type, related_resource_id, message, time_created, if_match): +def add_database_tools_database_api_gateway_config_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_api_gateway_config_id, type, related_resource_id, message, time_created, if_match): - if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: @@ -180,14 +215,14 @@ def add_database_tools_identity_lock(ctx, from_json, wait_for_state, max_wait_se _details['timeCreated'] = time_created client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.add_database_tools_identity_lock( - database_tools_identity_id=database_tools_identity_id, + result = client.add_database_tools_database_api_gateway_config_lock( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, add_resource_lock_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_database_tools_identity') and callable(getattr(client, 'get_database_tools_identity')): + if hasattr(client, 'get_database_tools_database_api_gateway_config') and callable(getattr(client, 'get_database_tools_database_api_gateway_config')): try: wait_period_kwargs = {} if max_wait_seconds is not None: @@ -196,7 +231,7 @@ def add_database_tools_identity_lock(ctx, from_json, wait_for_state, max_wait_se 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_database_tools_identity(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + result = oci.wait_until(client, client.get_database_tools_database_api_gateway_config(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) @@ -211,25 +246,25 @@ def add_database_tools_identity_lock(ctx, from_json, wait_for_state, max_wait_se cli_util.render_response(result, ctx) -@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.add_database_tools_private_endpoint_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsPrivateEndpoint resource. \n[Command Reference](addDatabaseToolsPrivateEndpointLock)""") -@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") +@database_tools_identity_group.command(name=cli_util.override('dbtools.add_database_tools_identity_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsIdentity resource. \n[Command Reference](addDatabaseToolsIdentityLock)""") +@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") @cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") @cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") @cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") @cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), 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 INACTIVE 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('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsPrivateEndpoint'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentity'}) @cli_util.wrap_exceptions -def add_database_tools_private_endpoint_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, type, related_resource_id, message, time_created, if_match): +def add_database_tools_identity_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, type, related_resource_id, message, time_created, if_match): - if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') + if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: @@ -249,14 +284,14 @@ def add_database_tools_private_endpoint_lock(ctx, from_json, wait_for_state, max _details['timeCreated'] = time_created client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.add_database_tools_private_endpoint_lock( - database_tools_private_endpoint_id=database_tools_private_endpoint_id, + result = client.add_database_tools_identity_lock( + database_tools_identity_id=database_tools_identity_id, add_resource_lock_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_database_tools_private_endpoint') and callable(getattr(client, 'get_database_tools_private_endpoint')): + if hasattr(client, 'get_database_tools_identity') and callable(getattr(client, 'get_database_tools_identity')): try: wait_period_kwargs = {} if max_wait_seconds is not None: @@ -265,7 +300,7 @@ def add_database_tools_private_endpoint_lock(ctx, from_json, wait_for_state, max 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_database_tools_private_endpoint(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + result = oci.wait_until(client, client.get_database_tools_identity(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) @@ -280,148 +315,160 @@ def add_database_tools_private_endpoint_lock(ctx, from_json, wait_for_state, max cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.change_database_tools_connection_compartment.command_name', 'change-compartment'), help=u"""Moves the specified Database Tools connection to a different compartment in the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeDatabaseToolsConnectionCompartment)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the Database Tools connection to.""") +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.add_database_tools_mcp_server_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsMcpServer resource. \n[Command Reference](addDatabaseToolsMcpServerLock)""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The [OCID] of a Database Tools MCP server.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpServer'}) @cli_util.wrap_exceptions -def change_database_tools_connection_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, compartment_id, if_match, is_lock_override): +def add_database_tools_mcp_server_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_server_id, type, related_resource_id, message, time_created, if_match): - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if isinstance(mcp_server_id, six.string_types) and len(mcp_server_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-server-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: kwargs['if_match'] = if_match - if is_lock_override is not None: - kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['compartmentId'] = compartment_id + _details['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.change_database_tools_connection_compartment( - database_tools_connection_id=database_tools_connection_id, - change_database_tools_connection_compartment_details=_details, + result = client.add_database_tools_mcp_server_lock( + database_tools_mcp_server_id=mcp_server_id, + add_resource_lock_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_database_tools_mcp_server') and callable(getattr(client, 'get_database_tools_mcp_server')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_database_tools_mcp_server(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.change_database_tools_identity_compartment.command_name', 'change-compartment'), help=u"""Moves the specified Database Tools identity to a different compartment in the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeDatabaseToolsIdentityCompartment)""") -@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the Database Tools identity to.""") +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.add_database_tools_mcp_toolset_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsMcpToolset resource. \n[Command Reference](addDatabaseToolsMcpToolsetLock)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpToolset'}) @cli_util.wrap_exceptions -def change_database_tools_identity_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, compartment_id, if_match, is_lock_override): +def add_database_tools_mcp_toolset_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_toolset_id, type, related_resource_id, message, time_created, if_match): - if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: kwargs['if_match'] = if_match - if is_lock_override is not None: - kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['compartmentId'] = compartment_id + _details['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.change_database_tools_identity_compartment( - database_tools_identity_id=database_tools_identity_id, - change_database_tools_identity_compartment_details=_details, + result = client.add_database_tools_mcp_toolset_lock( + database_tools_mcp_toolset_id=mcp_toolset_id, + add_resource_lock_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_database_tools_mcp_toolset') and callable(getattr(client, 'get_database_tools_mcp_toolset')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_database_tools_mcp_toolset(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.change_database_tools_private_endpoint_compartment.command_name', 'change-compartment'), help=u"""Moves a Database Tools private endpoint into a different compartment in the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeDatabaseToolsPrivateEndpointCompartment)""") +@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.add_database_tools_private_endpoint_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsPrivateEndpoint resource. \n[Command Reference](addDatabaseToolsPrivateEndpointLock)""") @cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the `DatabaseConnectionProfile` to.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), 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 INACTIVE 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={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsPrivateEndpoint'}) @cli_util.wrap_exceptions -def change_database_tools_private_endpoint_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, compartment_id, if_match, is_lock_override): +def add_database_tools_private_endpoint_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, type, related_resource_id, message, time_created, if_match): if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') @@ -429,191 +476,144 @@ def change_database_tools_private_endpoint_compartment(ctx, from_json, wait_for_ kwargs = {} if if_match is not None: kwargs['if_match'] = if_match - if is_lock_override is not None: - kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['compartmentId'] = compartment_id + _details['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.change_database_tools_private_endpoint_compartment( + result = client.add_database_tools_private_endpoint_lock( database_tools_private_endpoint_id=database_tools_private_endpoint_id, - change_database_tools_private_endpoint_compartment_details=_details, + add_resource_lock_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_database_tools_private_endpoint') and callable(getattr(client, 'get_database_tools_private_endpoint')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_database_tools_private_endpoint(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection.command_name', 'create'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") -@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") -@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE", "MYSQL", "POSTGRESQL", "GENERIC_JDBC"]), help=u"""The Database Tools connection type.""") -@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. - -This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") -@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used by the Database Tools service to issue requests to other OCI services (e.g., Secrets in Vault).""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.add_database_tools_sql_report_lock.command_name', 'add'), help=u"""Adds a lock to a DatabaseToolsSqlReport resource. \n[Command Reference](addDatabaseToolsSqlReportLock)""") +@cli_util.option('--sql-report-id', required=True, help=u"""The [OCID] of a Database Tools SQL Report.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@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(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@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={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsSqlReport'}) @cli_util.wrap_exceptions -def create_database_tools_connection(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, type, defined_tags, freeform_tags, locks, runtime_support, runtime_identity): +def add_database_tools_sql_report_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, sql_report_id, type, related_resource_id, message, time_created, if_match): + + if isinstance(sql_report_id, six.string_types) and len(sql_report_id.strip()) == 0: + raise click.UsageError('Parameter --sql-report-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['displayName'] = display_name - _details['compartmentId'] = compartment_id _details['type'] = type - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if locks is not None: - _details['locks'] = cli_util.parse_json_parameter("locks", locks) + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id - if runtime_support is not None: - _details['runtimeSupport'] = runtime_support + if message is not None: + _details['message'] = message - if runtime_identity is not None: - _details['runtimeIdentity'] = runtime_identity + if time_created is not None: + _details['timeCreated'] = time_created client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.create_database_tools_connection( - create_database_tools_connection_details=_details, + result = client.add_database_tools_sql_report_lock( + database_tools_sql_report_id=sql_report_id, + add_resource_lock_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_database_tools_sql_report') and callable(getattr(client, 'get_database_tools_sql_report')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_database_tools_sql_report(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection_create_database_tools_connection_generic_jdbc_details.command_name', 'create-database-tools-connection-create-database-tools-connection-generic-jdbc-details'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") -@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") -@cli_util.option('--url', required=True, help=u"""The JDBC URL used to connect to the Generic JDBC database system.""") -@cli_util.option('--user-name', required=True, help=u"""The database user name.""") -@cli_util.option('--user-password', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. - -This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") -@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used by the Database Tools service to issue requests to other OCI services (e.g., Secrets in Vault).""") -@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. - -This option is a JSON list with items of type DatabaseToolsKeyStoreGenericJdbcDetails. For documentation on DatabaseToolsKeyStoreGenericJdbcDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreGenericJdbcDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.cascading_delete_database_tools_mcp_server.command_name', 'cascading-delete'), help=u"""Deletes Database Tools McpServer resource. \n[Command Reference](cascadingDeleteDatabaseToolsMcpServer)""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The [OCID] of a Database Tools MCP server.""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreGenericJdbcDetails]'}}) +@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={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreGenericJdbcDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def create_database_tools_connection_create_database_tools_connection_generic_jdbc_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, url, user_name, user_password, defined_tags, freeform_tags, locks, runtime_support, runtime_identity, advanced_properties, key_stores): +def cascading_delete_database_tools_mcp_server(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_server_id, if_match): + + if isinstance(mcp_server_id, six.string_types) and len(mcp_server_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-server-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['displayName'] = display_name - _details['compartmentId'] = compartment_id - _details['url'] = url - _details['userName'] = user_name - _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if locks is not None: - _details['locks'] = cli_util.parse_json_parameter("locks", locks) - - if runtime_support is not None: - _details['runtimeSupport'] = runtime_support - - if runtime_identity is not None: - _details['runtimeIdentity'] = runtime_identity - - if advanced_properties is not None: - _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) - - if key_stores is not None: - _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) - - _details['type'] = 'GENERIC_JDBC' - client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.create_database_tools_connection( - create_database_tools_connection_details=_details, + result = client.cascading_delete_database_tools_mcp_server( + database_tools_mcp_server_id=mcp_server_id, **kwargs ) if wait_for_state: @@ -646,77 +646,38 @@ def create_database_tools_connection_create_database_tools_connection_generic_jd cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection_create_database_tools_connection_postgresql_details.command_name', 'create-database-tools-connection-create-database-tools-connection-postgresql-details'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") -@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") -@cli_util.option('--connection-string', required=True, help=u"""The connection string used to connect to the PostgreSQL Server.""") -@cli_util.option('--user-name', required=True, help=u"""The database user name.""") -@cli_util.option('--user-password', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. - -This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") -@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used by the Database Tools service to issue requests to other OCI services (e.g., Secrets in Vault).""") -@cli_util.option('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `sslMode`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. - -This option is a JSON list with items of type DatabaseToolsKeyStorePostgresqlDetails. For documentation on DatabaseToolsKeyStorePostgresqlDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStorePostgresqlDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the customer VCN.""") +@database_tools_connection_group.command(name=cli_util.override('dbtools.change_database_tools_connection_compartment.command_name', 'change-compartment'), help=u"""Moves the specified Database Tools connection to a different compartment in the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeDatabaseToolsConnectionCompartment)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the Database Tools connection 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.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourcePostgresqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStorePostgresqlDetails]'}}) +@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={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourcePostgresqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStorePostgresqlDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def create_database_tools_connection_create_database_tools_connection_postgresql_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, connection_string, user_name, user_password, defined_tags, freeform_tags, locks, runtime_support, runtime_identity, related_resource, advanced_properties, key_stores, private_endpoint_id): +def change_database_tools_connection_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, compartment_id, if_match, is_lock_override): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override 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['connectionString'] = connection_string - _details['userName'] = user_name - _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if locks is not None: - _details['locks'] = cli_util.parse_json_parameter("locks", locks) - - if runtime_support is not None: - _details['runtimeSupport'] = runtime_support - - if runtime_identity is not None: - _details['runtimeIdentity'] = runtime_identity - - if related_resource is not None: - _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) - - if advanced_properties is not None: - _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) - - if key_stores is not None: - _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) - - if private_endpoint_id is not None: - _details['privateEndpointId'] = private_endpoint_id - - _details['type'] = 'POSTGRESQL' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.create_database_tools_connection( - create_database_tools_connection_details=_details, + result = client.change_database_tools_connection_compartment( + database_tools_connection_id=database_tools_connection_id, + change_database_tools_connection_compartment_details=_details, **kwargs ) if wait_for_state: @@ -749,77 +710,72 @@ def create_database_tools_connection_create_database_tools_connection_postgresql cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection_create_database_tools_connection_my_sql_details.command_name', 'create-database-tools-connection-create-database-tools-connection-my-sql-details'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") -@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") -@cli_util.option('--connection-string', required=True, help=u"""The connection string used to connect to the MySQL Server.""") -@cli_util.option('--user-name', required=True, help=u"""The database user name.""") -@cli_util.option('--user-password', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. - -This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") -@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used by the Database Tools service to issue requests to other OCI services (e.g., Secrets in Vault).""") -@cli_util.option('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `sslMode`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. - -This option is a JSON list with items of type DatabaseToolsKeyStoreMySqlDetails. For documentation on DatabaseToolsKeyStoreMySqlDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreMySqlDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the customer VCN.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceMySqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreMySqlDetails]'}}) +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.change_database_tools_database_api_gateway_config_compartment.command_name', 'change-compartment'), help=u"""Moves the specified Database Tools database API gateway config to a different compartment in the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeDatabaseToolsDatabaseApiGatewayConfigCompartment)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the Database Tools database API gateway config 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.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceMySqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreMySqlDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def create_database_tools_connection_create_database_tools_connection_my_sql_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, connection_string, user_name, user_password, defined_tags, freeform_tags, locks, runtime_support, runtime_identity, related_resource, advanced_properties, key_stores, private_endpoint_id): +def change_database_tools_database_api_gateway_config_compartment(ctx, from_json, database_api_gateway_config_id, compartment_id, if_match, is_lock_override): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override 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['connectionString'] = connection_string - _details['userName'] = user_name - _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - if locks is not None: - _details['locks'] = cli_util.parse_json_parameter("locks", locks) - - if runtime_support is not None: - _details['runtimeSupport'] = runtime_support - - if runtime_identity is not None: - _details['runtimeIdentity'] = runtime_identity + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.change_database_tools_database_api_gateway_config_compartment( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + change_database_tools_database_api_gateway_config_compartment_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) - if related_resource is not None: - _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) - if advanced_properties is not None: - _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) +@database_tools_identity_group.command(name=cli_util.override('dbtools.change_database_tools_identity_compartment.command_name', 'change-compartment'), help=u"""Moves the specified Database Tools identity to a different compartment in the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeDatabaseToolsIdentityCompartment)""") +@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the Database Tools identity 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.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def change_database_tools_identity_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, compartment_id, if_match, is_lock_override): - if key_stores is not None: - _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') - if private_endpoint_id is not None: - _details['privateEndpointId'] = private_endpoint_id + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - _details['type'] = 'MYSQL' + _details = {} + _details['compartmentId'] = compartment_id client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.create_database_tools_connection( - create_database_tools_connection_details=_details, + result = client.change_database_tools_identity_compartment( + database_tools_identity_id=database_tools_identity_id, + change_database_tools_identity_compartment_details=_details, **kwargs ) if wait_for_state: @@ -852,81 +808,38 @@ def create_database_tools_connection_create_database_tools_connection_my_sql_det cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection_create_database_tools_connection_oracle_database_details.command_name', 'create-database-tools-connection-create-database-tools-connection-oracle-database-details'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") -@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") -@cli_util.option('--connection-string', required=True, help=u"""The connect descriptor or Easy Connect Naming method use to connect to the database.""") -@cli_util.option('--user-name', required=True, help=u"""The database user name.""") -@cli_util.option('--user-password', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. - -This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") -@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used by the Database Tools service to issue requests to other OCI services (e.g., Secrets in Vault).""") -@cli_util.option('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `oracle.net.ssl_server_dn_match`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Oracle wallet or Java Keystores containing trusted certificates for authenticating the server's public certificate and the client private key and associated certificates required for client authentication. - -This option is a JSON list with items of type DatabaseToolsKeyStoreDetails. For documentation on DatabaseToolsKeyStoreDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the customer VCN.""") -@cli_util.option('--proxy-client', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.change_database_tools_mcp_server_compartment.command_name', 'change-compartment'), help=u"""Moves the specified Database Tools mcpserver to a different compartment in the same tenancy. \n[Command Reference](changeDatabaseToolsMcpServerCompartment)""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The [OCID] of a Database Tools MCP server.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the Database Tools MCP server 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.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClientDetails'}}) +@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={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClientDetails'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def create_database_tools_connection_create_database_tools_connection_oracle_database_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, connection_string, user_name, user_password, defined_tags, freeform_tags, locks, runtime_support, runtime_identity, related_resource, advanced_properties, key_stores, private_endpoint_id, proxy_client): +def change_database_tools_mcp_server_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_server_id, compartment_id, if_match, is_lock_override): + + if isinstance(mcp_server_id, six.string_types) and len(mcp_server_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-server-id cannot be whitespace or empty string') kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override 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['connectionString'] = connection_string - _details['userName'] = user_name - _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if locks is not None: - _details['locks'] = cli_util.parse_json_parameter("locks", locks) - - if runtime_support is not None: - _details['runtimeSupport'] = runtime_support - - if runtime_identity is not None: - _details['runtimeIdentity'] = runtime_identity - - if related_resource is not None: - _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) - - if advanced_properties is not None: - _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) - - if key_stores is not None: - _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) - - if private_endpoint_id is not None: - _details['privateEndpointId'] = private_endpoint_id - - if proxy_client is not None: - _details['proxyClient'] = cli_util.parse_json_parameter("proxy_client", proxy_client) - - _details['type'] = 'ORACLE_DATABASE' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.create_database_tools_connection( - create_database_tools_connection_details=_details, + result = client.change_database_tools_mcp_server_compartment( + database_tools_mcp_server_id=mcp_server_id, + change_database_tools_mcp_server_compartment_details=_details, **kwargs ) if wait_for_state: @@ -959,47 +872,72 @@ def create_database_tools_connection_create_database_tools_connection_oracle_dat cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.create_database_tools_identity.command_name', 'create'), help=u"""Creates a new Database Tools identity. \n[Command Reference](createDatabaseToolsIdentity)""") -@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE_RESOURCE_PRINCIPAL"]), help=u"""The Database Tools identity type.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools identity.""") -@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of the related Database Tools connection.""") -@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.change_database_tools_mcp_toolset_compartment.command_name', 'change-compartment'), help=u"""Moves the specified Database Tools MCP Toolset to a different compartment in the same tenancy. \n[Command Reference](changeDatabaseToolsMcpToolsetCompartment)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the Database Tools MCP Toolset 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.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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_database_tools_mcp_toolset_compartment(ctx, from_json, mcp_toolset_id, compartment_id, if_match, is_lock_override): -This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + 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('database_tools', 'database_tools', ctx) + result = client.change_database_tools_mcp_toolset_compartment( + database_tools_mcp_toolset_id=mcp_toolset_id, + change_database_tools_mcp_toolset_compartment_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.change_database_tools_private_endpoint_compartment.command_name', 'change-compartment'), help=u"""Moves a Database Tools private endpoint into a different compartment in the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment]. \n[Command Reference](changeDatabaseToolsPrivateEndpointCompartment)""") +@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the `DatabaseConnectionProfile` 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.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) +@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={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentity'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def create_database_tools_identity(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, type, compartment_id, display_name, database_tools_connection_id, defined_tags, freeform_tags, locks): +def change_database_tools_private_endpoint_compartment(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, compartment_id, if_match, is_lock_override): + + if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['type'] = type _details['compartmentId'] = compartment_id - _details['displayName'] = display_name - _details['databaseToolsConnectionId'] = database_tools_connection_id - - if defined_tags is not None: - _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - - if freeform_tags is not None: - _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - - if locks is not None: - _details['locks'] = cli_util.parse_json_parameter("locks", locks) client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.create_database_tools_identity( - create_database_tools_identity_details=_details, + result = client.change_database_tools_private_endpoint_compartment( + database_tools_private_endpoint_id=database_tools_private_endpoint_id, + change_database_tools_private_endpoint_compartment_details=_details, **kwargs ) if wait_for_state: @@ -1032,34 +970,68 @@ def create_database_tools_identity(ctx, from_json, wait_for_state, max_wait_seco cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.create_database_tools_identity_create_database_tools_identity_oracle_database_resource_principal_details.command_name', 'create-database-tools-identity-create-database-tools-identity-oracle-database-resource-principal-details'), help=u"""Creates a new Database Tools identity. \n[Command Reference](createDatabaseToolsIdentity)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools identity.""") +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.change_database_tools_sql_report_compartment.command_name', 'change-compartment'), help=u"""Moves the specified Database Tools SQL Report to a different compartment in the same tenancy. \n[Command Reference](changeDatabaseToolsSqlReportCompartment)""") +@cli_util.option('--sql-report-id', required=True, help=u"""The [OCID] of a Database Tools SQL Report.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment to move the Database Tools SQL Report 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.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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_database_tools_sql_report_compartment(ctx, from_json, sql_report_id, compartment_id, if_match, is_lock_override): + + if isinstance(sql_report_id, six.string_types) and len(sql_report_id.strip()) == 0: + raise click.UsageError('Parameter --sql-report-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + 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('database_tools', 'database_tools', ctx) + result = client.change_database_tools_sql_report_compartment( + database_tools_sql_report_id=sql_report_id, + change_database_tools_sql_report_compartment_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection.command_name', 'create'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") @cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of the related Database Tools connection.""") -@cli_util.option('--credential-key', required=True, help=u"""The name of the credential object created in the Oracle Database.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE", "MYSQL", "POSTGRESQL", "GENERIC_JDBC"]), help=u"""The Database Tools connection type.""") @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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") +@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used when accessing OCI resources at runtime. AUTHENTICATED_PRINCIPAL to use the caller\u2019s identity (On-Behalf-Of token), or RESOURCE_PRINCIPAL to use the connection\u2019s resource principal (RPST).""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentity'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) @cli_util.wrap_exceptions -def create_database_tools_identity_create_database_tools_identity_oracle_database_resource_principal_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, database_tools_connection_id, credential_key, defined_tags, freeform_tags, locks): +def create_database_tools_connection(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, type, defined_tags, freeform_tags, locks, runtime_support, runtime_identity): 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['databaseToolsConnectionId'] = database_tools_connection_id - _details['credentialKey'] = credential_key + _details['compartmentId'] = compartment_id + _details['type'] = type if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) @@ -1070,11 +1042,15 @@ def create_database_tools_identity_create_database_tools_identity_oracle_databas if locks is not None: _details['locks'] = cli_util.parse_json_parameter("locks", locks) - _details['type'] = 'ORACLE_DATABASE_RESOURCE_PRINCIPAL' + if runtime_support is not None: + _details['runtimeSupport'] = runtime_support + + if runtime_identity is not None: + _details['runtimeIdentity'] = runtime_identity client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.create_database_tools_identity( - create_database_tools_identity_details=_details, + result = client.create_database_tools_connection( + create_database_tools_connection_details=_details, **kwargs ) if wait_for_state: @@ -1107,37 +1083,42 @@ def create_database_tools_identity_create_database_tools_identity_oracle_databas cli_util.render_response(result, ctx) -@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.create_database_tools_private_endpoint.command_name', 'create'), help=u"""Creates a new Database Tools private endpoint. \n[Command Reference](createDatabaseToolsPrivateEndpoint)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools private endpoint.""") +@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection_create_database_tools_connection_generic_jdbc_details.command_name', 'create-database-tools-connection-create-database-tools-connection-generic-jdbc-details'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") @cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--endpoint-service-id', required=True, help=u"""The [OCID] of the `DatabaseToolsEndpointService`.""") -@cli_util.option('--subnet-id', required=True, help=u"""The [OCID] of the subnet that the private endpoint belongs to.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") +@cli_util.option('--url', required=True, help=u"""The JDBC URL used to connect to the Generic JDBC database system.""") +@cli_util.option('--user-name', required=True, help=u"""The database user name.""") +@cli_util.option('--user-password', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--description', help=u"""A description of the Database Tools private endpoint.""") -@cli_util.option('--private-endpoint-ip', help=u"""The private IP address that represents the access point for the associated endpoint service.""") -@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The [OCID] of the network security groups that the private endpoint's VNIC belongs to. For more information about NSGs, see [NetworkSecurityGroup].""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") +@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used when accessing OCI resources at runtime. AUTHENTICATED_PRINCIPAL to use the caller\u2019s identity (On-Behalf-Of token), or RESOURCE_PRINCIPAL to use the connection\u2019s resource principal (RPST).""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. + +This option is a JSON list with items of type DatabaseToolsKeyStoreGenericJdbcDetails. For documentation on DatabaseToolsKeyStoreGenericJdbcDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreGenericJdbcDetails.""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'nsg-ids': {'module': 'database_tools', 'class': 'list[string]'}}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreGenericJdbcDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'nsg-ids': {'module': 'database_tools', 'class': 'list[string]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsPrivateEndpoint'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreGenericJdbcDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) @cli_util.wrap_exceptions -def create_database_tools_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, endpoint_service_id, subnet_id, defined_tags, freeform_tags, locks, description, private_endpoint_ip, nsg_ids): +def create_database_tools_connection_create_database_tools_connection_generic_jdbc_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, url, user_name, user_password, defined_tags, freeform_tags, locks, runtime_support, runtime_identity, advanced_properties, key_stores): 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['endpointServiceId'] = endpoint_service_id - _details['subnetId'] = subnet_id + _details['compartmentId'] = compartment_id + _details['url'] = url + _details['userName'] = user_name + _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) @@ -1148,18 +1129,23 @@ def create_database_tools_private_endpoint(ctx, from_json, wait_for_state, max_w if locks is not None: _details['locks'] = cli_util.parse_json_parameter("locks", locks) - if description is not None: - _details['description'] = description + if runtime_support is not None: + _details['runtimeSupport'] = runtime_support - if private_endpoint_ip is not None: - _details['privateEndpointIp'] = private_endpoint_ip + if runtime_identity is not None: + _details['runtimeIdentity'] = runtime_identity - if nsg_ids is not None: - _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if key_stores is not None: + _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + + _details['type'] = 'GENERIC_JDBC' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.create_database_tools_private_endpoint( - create_database_tools_private_endpoint_details=_details, + result = client.create_database_tools_connection( + create_database_tools_connection_details=_details, **kwargs ) if wait_for_state: @@ -1192,33 +1178,77 @@ def create_database_tools_private_endpoint(ctx, from_json, wait_for_state, max_w cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.delete_database_tools_connection.command_name', 'delete'), help=u"""Deletes the specified Database Tools connection resource. \n[Command Reference](deleteDatabaseToolsConnection)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") -@cli_util.confirm_delete_option +@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection_create_database_tools_connection_postgresql_details.command_name', 'create-database-tools-connection-create-database-tools-connection-postgresql-details'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") +@cli_util.option('--connection-string', required=True, help=u"""The connection string used to connect to the PostgreSQL Server.""") +@cli_util.option('--user-name', required=True, help=u"""The database user name.""") +@cli_util.option('--user-password', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") +@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used when accessing OCI resources at runtime. AUTHENTICATED_PRINCIPAL to use the caller\u2019s identity (On-Behalf-Of token), or RESOURCE_PRINCIPAL to use the connection\u2019s resource principal (RPST).""") +@cli_util.option('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `sslMode`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. + +This option is a JSON list with items of type DatabaseToolsKeyStorePostgresqlDetails. For documentation on DatabaseToolsKeyStorePostgresqlDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStorePostgresqlDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the customer VCN.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourcePostgresqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStorePostgresqlDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourcePostgresqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStorePostgresqlDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) @cli_util.wrap_exceptions -def delete_database_tools_connection(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, if_match, is_lock_override): - - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') +def create_database_tools_connection_create_database_tools_connection_postgresql_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, connection_string, user_name, user_password, defined_tags, freeform_tags, locks, runtime_support, runtime_identity, related_resource, advanced_properties, key_stores, private_endpoint_id): kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - if is_lock_override is not None: - kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.delete_database_tools_connection( - database_tools_connection_id=database_tools_connection_id, + + _details = {} + _details['displayName'] = display_name + _details['compartmentId'] = compartment_id + _details['connectionString'] = connection_string + _details['userName'] = user_name + _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + if runtime_support is not None: + _details['runtimeSupport'] = runtime_support + + if runtime_identity is not None: + _details['runtimeIdentity'] = runtime_identity + + if related_resource is not None: + _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if key_stores is not None: + _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + + if private_endpoint_id is not None: + _details['privateEndpointId'] = private_endpoint_id + + _details['type'] = 'POSTGRESQL' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.create_database_tools_connection( + create_database_tools_connection_details=_details, **kwargs ) if wait_for_state: @@ -1239,7 +1269,7 @@ def delete_database_tools_connection(ctx, from_json, wait_for_state, max_wait_se 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) + 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: @@ -1251,33 +1281,77 @@ def delete_database_tools_connection(ctx, from_json, wait_for_state, max_wait_se cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.delete_database_tools_identity.command_name', 'delete'), help=u"""Deletes the specified Database Tools identity resource. \n[Command Reference](deleteDatabaseToolsIdentity)""") -@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") -@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") -@cli_util.confirm_delete_option +@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection_create_database_tools_connection_my_sql_details.command_name', 'create-database-tools-connection-create-database-tools-connection-my-sql-details'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") +@cli_util.option('--connection-string', required=True, help=u"""The connection string used to connect to the MySQL Server.""") +@cli_util.option('--user-name', required=True, help=u"""The database user name.""") +@cli_util.option('--user-password', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") +@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used when accessing OCI resources at runtime. AUTHENTICATED_PRINCIPAL to use the caller\u2019s identity (On-Behalf-Of token), or RESOURCE_PRINCIPAL to use the connection\u2019s resource principal (RPST).""") +@cli_util.option('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `sslMode`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. + +This option is a JSON list with items of type DatabaseToolsKeyStoreMySqlDetails. For documentation on DatabaseToolsKeyStoreMySqlDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreMySqlDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the customer VCN.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceMySqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreMySqlDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceMySqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreMySqlDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) @cli_util.wrap_exceptions -def delete_database_tools_identity(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, if_match, is_lock_override): - - if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') +def create_database_tools_connection_create_database_tools_connection_my_sql_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, connection_string, user_name, user_password, defined_tags, freeform_tags, locks, runtime_support, runtime_identity, related_resource, advanced_properties, key_stores, private_endpoint_id): kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - if is_lock_override is not None: - kwargs['is_lock_override'] = is_lock_override 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['connectionString'] = connection_string + _details['userName'] = user_name + _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + if runtime_support is not None: + _details['runtimeSupport'] = runtime_support + + if runtime_identity is not None: + _details['runtimeIdentity'] = runtime_identity + + if related_resource is not None: + _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if key_stores is not None: + _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + + if private_endpoint_id is not None: + _details['privateEndpointId'] = private_endpoint_id + + _details['type'] = 'MYSQL' + client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.delete_database_tools_identity( - database_tools_identity_id=database_tools_identity_id, + result = client.create_database_tools_connection( + create_database_tools_connection_details=_details, **kwargs ) if wait_for_state: @@ -1298,7 +1372,7 @@ def delete_database_tools_identity(ctx, from_json, wait_for_state, max_wait_seco 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) + 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: @@ -1310,33 +1384,89 @@ def delete_database_tools_identity(ctx, from_json, wait_for_state, max_wait_seco cli_util.render_response(result, ctx) -@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.delete_database_tools_private_endpoint.command_name', 'delete'), help=u"""Deletes the specified Database Tools private endpoint. \n[Command Reference](deleteDatabaseToolsPrivateEndpoint)""") -@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") -@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") -@cli_util.confirm_delete_option +@database_tools_connection_group.command(name=cli_util.override('dbtools.create_database_tools_connection_create_database_tools_connection_oracle_database_details.command_name', 'create-database-tools-connection-create-database-tools-connection-oracle-database-details'), help=u"""Creates a new Database Tools connection. \n[Command Reference](createDatabaseToolsConnection)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools connection.""") +@cli_util.option('--connection-string', required=True, help=u"""The connect descriptor or Easy Connect Naming method use to connect to the database.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), help=u"""Specifies whether this connection is supported by the Database Tools Runtime.""") +@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used when accessing OCI resources at runtime. AUTHENTICATED_PRINCIPAL to use the caller\u2019s identity (On-Behalf-Of token), or RESOURCE_PRINCIPAL to use the connection\u2019s resource principal (RPST).""") +@cli_util.option('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--user-name', help=u"""The database user name.""") +@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `oracle.net.ssl_server_dn_match`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Oracle wallet or Java Keystores containing trusted certificates for authenticating the server's public certificate and the client private key and associated certificates required for client authentication. + +This option is a JSON list with items of type DatabaseToolsKeyStoreDetails. For documentation on DatabaseToolsKeyStoreDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the customer VCN.""") +@cli_util.option('--proxy-client', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--authentication-type', type=custom_types.CliCaseInsensitiveChoice(["TOKEN", "PASSWORD"]), help=u"""Specifies the authentication type used by the Database Tools service to authenticate with the database.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClientDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'related-resource': {'module': 'database_tools', 'class': 'CreateDatabaseToolsRelatedResourceDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClientDetails'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) @cli_util.wrap_exceptions -def delete_database_tools_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, if_match, is_lock_override): - - if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') +def create_database_tools_connection_create_database_tools_connection_oracle_database_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, connection_string, defined_tags, freeform_tags, locks, runtime_support, runtime_identity, related_resource, user_name, user_password, advanced_properties, key_stores, private_endpoint_id, proxy_client, authentication_type): kwargs = {} - if if_match is not None: - kwargs['if_match'] = if_match - if is_lock_override is not None: - kwargs['is_lock_override'] = is_lock_override 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['connectionString'] = connection_string + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + if runtime_support is not None: + _details['runtimeSupport'] = runtime_support + + if runtime_identity is not None: + _details['runtimeIdentity'] = runtime_identity + + if related_resource is not None: + _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) + + if user_name is not None: + _details['userName'] = user_name + + if user_password is not None: + _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if key_stores is not None: + _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + + if private_endpoint_id is not None: + _details['privateEndpointId'] = private_endpoint_id + + if proxy_client is not None: + _details['proxyClient'] = cli_util.parse_json_parameter("proxy_client", proxy_client) + + if authentication_type is not None: + _details['authenticationType'] = authentication_type + + _details['type'] = 'ORACLE_DATABASE' + client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.delete_database_tools_private_endpoint( - database_tools_private_endpoint_id=database_tools_private_endpoint_id, + result = client.create_database_tools_connection( + create_database_tools_connection_details=_details, **kwargs ) if wait_for_state: @@ -1357,7 +1487,7 @@ def delete_database_tools_private_endpoint(ctx, from_json, wait_for_state, max_w 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) + 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: @@ -1369,583 +1499,3905 @@ def delete_database_tools_private_endpoint(ctx, from_json, wait_for_state, max_w cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.get_database_tools_connection.command_name', 'get'), help=u"""Gets details of the specified Database Tools connection. \n[Command Reference](getDatabaseToolsConnection)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.create_database_tools_database_api_gateway_config.command_name', 'create'), help=u"""Creates a new Database Tools database API gateway config. \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfig)""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The Database Tools DP API gateway config type.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools database API gateway config.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@cli_util.option('--metadata-source', required=True, type=custom_types.CliCaseInsensitiveChoice(["DATABASE", "CLOUD"]), help=u"""The RESTful service definition location.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsDatabaseApiGatewayConfig'}) @cli_util.wrap_exceptions -def get_database_tools_connection(ctx, from_json, database_tools_connection_id): - - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') +def create_database_tools_database_api_gateway_config(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, type, compartment_id, display_name, metadata_source, defined_tags, freeform_tags, locks): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.get_database_tools_connection( - database_tools_connection_id=database_tools_connection_id, - **kwargs - ) - cli_util.render_response(result, ctx) + _details = {} + _details['type'] = type + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['metadataSource'] = metadata_source -@database_tools_endpoint_service_group.command(name=cli_util.override('dbtools.get_database_tools_endpoint_service.command_name', 'get'), help=u"""Gets details for the specified Database Tools endpoint service. \n[Command Reference](getDatabaseToolsEndpointService)""") -@cli_util.option('--database-tools-endpoint-service-id', required=True, help=u"""The [OCID] of a Database Tools Endpoint Service.""") -@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': 'database_tools', 'class': 'DatabaseToolsEndpointService'}) -@cli_util.wrap_exceptions -def get_database_tools_endpoint_service(ctx, from_json, database_tools_endpoint_service_id): + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - if isinstance(database_tools_endpoint_service_id, six.string_types) and len(database_tools_endpoint_service_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-endpoint-service-id cannot be whitespace or empty string') + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) - kwargs = {} - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.get_database_tools_endpoint_service( - database_tools_endpoint_service_id=database_tools_endpoint_service_id, + result = client.create_database_tools_database_api_gateway_config( + create_database_tools_database_api_gateway_config_details=_details, **kwargs ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_database_api_gateway_config') and callable(getattr(client, 'get_database_tools_database_api_gateway_config')): + 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_database_tools_database_api_gateway_config(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) -@database_tools_identity_group.command(name=cli_util.override('dbtools.get_database_tools_identity.command_name', 'get'), help=u"""Gets details of the specified Database Tools identity. \n[Command Reference](getDatabaseToolsIdentity)""") -@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.create_database_tools_database_api_gateway_config_create_database_tools_database_api_gateway_config_default_details.command_name', 'create-database-tools-database-api-gateway-config-create-database-tools-database-api-gateway-config-default-details'), help=u"""Creates a new Database Tools database API gateway config. \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfig)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools database API gateway config.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@cli_util.option('--metadata-source', required=True, type=custom_types.CliCaseInsensitiveChoice(["DATABASE", "CLOUD"]), help=u"""The RESTful service definition location.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentity'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsDatabaseApiGatewayConfig'}) @cli_util.wrap_exceptions -def get_database_tools_identity(ctx, from_json, database_tools_identity_id): - - if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') +def create_database_tools_database_api_gateway_config_create_database_tools_database_api_gateway_config_default_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, metadata_source, defined_tags, freeform_tags, locks): 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['metadataSource'] = metadata_source + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + _details['type'] = 'DEFAULT' + client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.get_database_tools_identity( - database_tools_identity_id=database_tools_identity_id, + result = client.create_database_tools_database_api_gateway_config( + create_database_tools_database_api_gateway_config_details=_details, **kwargs ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_database_api_gateway_config') and callable(getattr(client, 'get_database_tools_database_api_gateway_config')): + 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_database_tools_database_api_gateway_config(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) -@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.get_database_tools_private_endpoint.command_name', 'get'), help=u"""Gets details of a specified Database Tools private endpoint. \n[Command Reference](getDatabaseToolsPrivateEndpoint)""") -@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@database_tools_identity_group.command(name=cli_util.override('dbtools.create_database_tools_identity.command_name', 'create'), help=u"""Creates a new Database Tools identity. \n[Command Reference](createDatabaseToolsIdentity)""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE_RESOURCE_PRINCIPAL"]), help=u"""The Database Tools identity type.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools identity.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of the related Database Tools connection.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsPrivateEndpoint'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentity'}) @cli_util.wrap_exceptions -def get_database_tools_private_endpoint(ctx, from_json, database_tools_private_endpoint_id): - - if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') +def create_database_tools_identity(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, type, compartment_id, display_name, database_tools_connection_id, defined_tags, freeform_tags, locks): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['type'] = type + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['databaseToolsConnectionId'] = database_tools_connection_id + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.get_database_tools_private_endpoint( - database_tools_private_endpoint_id=database_tools_private_endpoint_id, + result = client.create_database_tools_identity( + create_database_tools_identity_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) -@work_request_group.command(name=cli_util.override('dbtools.get_work_request.command_name', 'get'), help=u"""Gets the status of the specified work request. \n[Command Reference](getWorkRequest)""") -@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous request.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@database_tools_identity_group.command(name=cli_util.override('dbtools.create_database_tools_identity_create_database_tools_identity_oracle_database_resource_principal_details.command_name', 'create-database-tools-identity-create-database-tools-identity-oracle-database-resource-principal-details'), help=u"""Creates a new Database Tools identity. \n[Command Reference](createDatabaseToolsIdentity)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools identity.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of the related Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential object created in the Oracle Database.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'WorkRequest'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentity'}) @cli_util.wrap_exceptions -def get_work_request(ctx, from_json, work_request_id): - - if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: - raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') +def create_database_tools_identity_create_database_tools_identity_oracle_database_resource_principal_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, database_tools_connection_id, credential_key, defined_tags, freeform_tags, locks): 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['databaseToolsConnectionId'] = database_tools_connection_id + _details['credentialKey'] = credential_key + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + _details['type'] = 'ORACLE_DATABASE_RESOURCE_PRINCIPAL' + client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.get_work_request( - work_request_id=work_request_id, + result = client.create_database_tools_identity( + create_database_tools_identity_details=_details, **kwargs ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.list_database_tools_connections.command_name', 'list'), help=u"""Returns a list of Database Tools connections. \n[Command Reference](listDatabaseToolsConnections)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), help=u"""A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.""") -@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") -@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE", "MYSQL", "POSTGRESQL", "GENERIC_JDBC"]), multiple=True, help=u"""A filter to return only resources their type matches the specified type.""") -@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), multiple=True, help=u"""A filter to return only resources with one of the specified type values.""") -@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), multiple=True, help=u"""A filter to return only resources with one of the specified runtimeIdentity values.""") -@cli_util.option('--related-resource-identifier', help=u"""The [OCID] of the related resource.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@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 'asc' or 'desc'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") -@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({}) +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.create_database_tools_mcp_server.command_name', 'create'), help=u"""Creates a new Database Tools MCP server. \n[Command Reference](createDatabaseToolsMcpServer)""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The Database Tools MCP server type.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools MCP server.""") +@cli_util.option('--display-name', required=True, help=u"""A meaningful, human-readable label displayed to end users. Not required to be unique and can be changed after creation. Do not include confidential information.""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of the related Database Tools connection.""") +@cli_util.option('--custom-roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Custom Roles associated with the MCP Server. + +This option is a JSON list with items of type DatabaseToolsMcpServerCustomRole. For documentation on DatabaseToolsMcpServerCustomRole please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsMcpServerCustomRole.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--description', help=u"""A human-readable description of the Database Tools MCP server.""") +@cli_util.option('--access-token-expiry-in-seconds', type=click.INT, help=u"""Access token expiry in seconds""") +@cli_util.option('--refresh-token-expiry-in-seconds', type=click.INT, help=u"""Refresh token expiry in seconds""") +@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('--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('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used when accessing OCI resources at runtime. AUTHENTICATED_PRINCIPAL to use the caller\u2019s identity (On-Behalf-Of token), or RESOURCE_PRINCIPAL to use the MCP Server\u2019s resource principal (RPST).""") +@cli_util.option('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'custom-roles': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpServerCustomRole]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnectionCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'custom-roles': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpServerCustomRole]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpServer'}) @cli_util.wrap_exceptions -def list_database_tools_connections(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, type, runtime_support, runtime_identity, related_resource_identifier, 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') +def create_database_tools_mcp_server(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, type, compartment_id, display_name, connection_id, custom_roles, description, access_token_expiry_in_seconds, refresh_token_expiry_in_seconds, defined_tags, freeform_tags, runtime_identity, locks): kwargs = {} - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state - if display_name is not None: - kwargs['display_name'] = display_name - if type is not None and len(type) > 0: - kwargs['type'] = type - if runtime_support is not None and len(runtime_support) > 0: - kwargs['runtime_support'] = runtime_support - if runtime_identity is not None and len(runtime_identity) > 0: - kwargs['runtime_identity'] = runtime_identity - if related_resource_identifier is not None: - kwargs['related_resource_identifier'] = related_resource_identifier - 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']) + + _details = {} + _details['type'] = type + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['databaseToolsConnectionId'] = connection_id + + if custom_roles is not None: + _details['customRoles'] = cli_util.parse_json_parameter("custom_roles", custom_roles) + + if description is not None: + _details['description'] = description + + if access_token_expiry_in_seconds is not None: + _details['accessTokenExpiryInSeconds'] = access_token_expiry_in_seconds + + if refresh_token_expiry_in_seconds is not None: + _details['refreshTokenExpiryInSeconds'] = refresh_token_expiry_in_seconds + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if runtime_identity is not None: + _details['runtimeIdentity'] = runtime_identity + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + client = cli_util.build_client('database_tools', 'database_tools', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size + result = client.create_database_tools_mcp_server( + create_database_tools_mcp_server_details=_details, + **kwargs + ) + if wait_for_state: - result = cli_util.list_call_get_all_results( - client.list_database_tools_connections, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_database_tools_connections, - limit, - page_size, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_database_tools_connections( - compartment_id=compartment_id, - **kwargs - ) + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_endpoint_service_group.command(name=cli_util.override('dbtools.list_database_tools_endpoint_services.command_name', 'list'), help=u"""Returns a list of Database Tools endpoint services. \n[Command Reference](listDatabaseToolsEndpointServices)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@cli_util.option('--page', help=u"""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 'asc' or 'desc'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), help=u"""A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.""") -@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") -@cli_util.option('--name', help=u"""A filter to return only resources that match the entire specified name.""") -@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({}) +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.create_database_tools_mcp_server_create_database_tools_mcp_server_default_details.command_name', 'create-database-tools-mcp-server-create-database-tools-mcp-server-default-details'), help=u"""Creates a new Database Tools MCP server. \n[Command Reference](createDatabaseToolsMcpServer)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools MCP server.""") +@cli_util.option('--display-name', required=True, help=u"""A meaningful, human-readable label displayed to end users. Not required to be unique and can be changed after creation. Do not include confidential information.""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of the related Database Tools connection.""") +@cli_util.option('--domain-id', required=True, help=u"""The [OCID] of the associated identity domain.""") +@cli_util.option('--storage', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--custom-roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Custom Roles associated with the MCP Server. + +This option is a JSON list with items of type DatabaseToolsMcpServerCustomRole. For documentation on DatabaseToolsMcpServerCustomRole please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsMcpServerCustomRole.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--description', help=u"""A human-readable description of the Database Tools MCP server.""") +@cli_util.option('--access-token-expiry-in-seconds', type=click.INT, help=u"""Access token expiry in seconds""") +@cli_util.option('--refresh-token-expiry-in-seconds', type=click.INT, help=u"""Refresh token expiry in seconds""") +@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('--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('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), help=u"""Specifies the identity used when accessing OCI resources at runtime. AUTHENTICATED_PRINCIPAL to use the caller\u2019s identity (On-Behalf-Of token), or RESOURCE_PRINCIPAL to use the MCP Server\u2019s resource principal (RPST).""") +@cli_util.option('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'custom-roles': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpServerCustomRole]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'storage': {'module': 'database_tools', 'class': 'DatabaseToolsMcpServerStorage'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsEndpointServiceCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'custom-roles': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpServerCustomRole]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'storage': {'module': 'database_tools', 'class': 'DatabaseToolsMcpServerStorage'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpServer'}) @cli_util.wrap_exceptions -def list_database_tools_endpoint_services(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_order, sort_by, lifecycle_state, display_name, name): - - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') +def create_database_tools_mcp_server_create_database_tools_mcp_server_default_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, connection_id, domain_id, storage, custom_roles, description, access_token_expiry_in_seconds, refresh_token_expiry_in_seconds, defined_tags, freeform_tags, runtime_identity, locks): kwargs = {} - if limit is not None: - kwargs['limit'] = limit - if page is not None: - kwargs['page'] = page - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state - if display_name is not None: - kwargs['display_name'] = display_name - if name is not None: - kwargs['name'] = name 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['databaseToolsConnectionId'] = connection_id + _details['domainId'] = domain_id + _details['storage'] = cli_util.parse_json_parameter("storage", storage) + + if custom_roles is not None: + _details['customRoles'] = cli_util.parse_json_parameter("custom_roles", custom_roles) + + if description is not None: + _details['description'] = description + + if access_token_expiry_in_seconds is not None: + _details['accessTokenExpiryInSeconds'] = access_token_expiry_in_seconds + + if refresh_token_expiry_in_seconds is not None: + _details['refreshTokenExpiryInSeconds'] = refresh_token_expiry_in_seconds + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if runtime_identity is not None: + _details['runtimeIdentity'] = runtime_identity + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + _details['type'] = 'DEFAULT' + client = cli_util.build_client('database_tools', 'database_tools', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size + result = client.create_database_tools_mcp_server( + create_database_tools_mcp_server_details=_details, + **kwargs + ) + if wait_for_state: - result = cli_util.list_call_get_all_results( - client.list_database_tools_endpoint_services, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_database_tools_endpoint_services, - limit, - page_size, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_database_tools_endpoint_services( - compartment_id=compartment_id, - **kwargs - ) + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.list_database_tools_identities.command_name', 'list'), help=u"""Returns a list of Database Tools identities. \n[Command Reference](listDatabaseToolsIdentities)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), help=u"""A filter to return resources only when their `databaseToolsIdentityLifecycleState` matches the specified `databaseToolsIdentityLifecycleState`.""") -@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") -@cli_util.option('--database-tools-connection-id', help=u"""A filter to return only resources when their `databaseToolsConnectionId` matches the specified `databaseToolsConnectionId`.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@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 'asc' or 'desc'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") -@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE_RESOURCE_PRINCIPAL"]), multiple=True, help=u"""A filter to return only resources with one of the specified type values.""") -@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({}) +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.create_database_tools_mcp_toolset.command_name', 'create'), help=u"""Creates a new Database Tools MCP Toolset. \n[Command Reference](createDatabaseToolsMcpToolset)""") +@cli_util.option('--toolset-version', required=True, type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools MCP server.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The OCID of the Database Tools MCP Server""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["CUSTOM_SQL_TOOL", "BUILT_IN_SQL_TOOLS", "CUSTOMIZABLE_REPORTING_TOOLS", "GENAI_SQL_ASSISTANT"]), help=u"""The Database Tools MCP Toolset type.""") +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentityCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpToolset'}) @cli_util.wrap_exceptions -def list_database_tools_identities(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, database_tools_connection_id, limit, page, sort_order, sort_by, type): - - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') +def create_database_tools_mcp_toolset(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, toolset_version, compartment_id, display_name, mcp_server_id, type, description, defined_tags, freeform_tags, locks): kwargs = {} - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state - if display_name is not None: - kwargs['display_name'] = display_name - if database_tools_connection_id is not None: - kwargs['database_tools_connection_id'] = database_tools_connection_id - if limit is not None: - kwargs['limit'] = limit - if page is not None: - kwargs['page'] = page - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if type is not None and len(type) > 0: - kwargs['type'] = type kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('database_tools', 'database_tools', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size - result = cli_util.list_call_get_all_results( - client.list_database_tools_identities, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_database_tools_identities, - limit, - page_size, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_database_tools_identities( - compartment_id=compartment_id, - **kwargs - ) + _details = {} + _details['version'] = toolset_version + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['databaseToolsMcpServerId'] = mcp_server_id + _details['type'] = type + + if description is not None: + _details['description'] = description + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.create_database_tools_mcp_toolset( + create_database_tools_mcp_toolset_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.list_database_tools_private_endpoints.command_name', 'list'), help=u"""Returns a list of Database Tools private endpoints. \n[Command Reference](listDatabaseToolsPrivateEndpoints)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") -@cli_util.option('--subnet-id', help=u"""A filter to return only resources their `subnetId` matches the specified `subnetId`.""") -@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") -@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 'asc' or 'desc'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") -@cli_util.option('--endpoint-service-id', help=u"""A filter to return only resources their `endpointServiceId` matches the specified `endpointServiceId`.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), help=u"""A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.""") -@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") -@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({}) +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_built_in_sql_tools_details.command_name', 'create-database-tools-mcp-toolset-create-database-tools-mcp-toolset-built-in-sql-tools-details'), help=u"""Creates a new Database Tools MCP Toolset. \n[Command Reference](createDatabaseToolsMcpToolset)""") +@cli_util.option('--toolset-version', required=True, type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools MCP server.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The OCID of the Database Tools MCP Server""") +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--tools', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Database Tools BUILT_IN_SQL_TOOLS toolset tool configurations + +This option is a JSON list with items of type CreateDatabaseToolsMcpToolsetToolDetails. For documentation on CreateDatabaseToolsMcpToolsetToolDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/CreateDatabaseToolsMcpToolsetToolDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--default-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The default execution type for the toolset. The default value is SYNCHRONOUS. + +To use ASYNCHRONOUS execution, the MCP Server must have the storage property configured.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'tools': {'module': 'database_tools', 'class': 'list[CreateDatabaseToolsMcpToolsetToolDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsPrivateEndpointCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'tools': {'module': 'database_tools', 'class': 'list[CreateDatabaseToolsMcpToolsetToolDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpToolset'}) @cli_util.wrap_exceptions -def list_database_tools_private_endpoints(ctx, from_json, all_pages, page_size, compartment_id, subnet_id, limit, page, sort_order, sort_by, endpoint_service_id, lifecycle_state, display_name): - - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') +def create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_built_in_sql_tools_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, toolset_version, compartment_id, display_name, mcp_server_id, description, defined_tags, freeform_tags, locks, tools, default_execution_type): kwargs = {} - if subnet_id is not None: - kwargs['subnet_id'] = subnet_id - if limit is not None: - kwargs['limit'] = limit - if page is not None: - kwargs['page'] = page - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if endpoint_service_id is not None: - kwargs['endpoint_service_id'] = endpoint_service_id - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state - 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['version'] = toolset_version + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['databaseToolsMcpServerId'] = mcp_server_id + + if description is not None: + _details['description'] = description + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + if tools is not None: + _details['tools'] = cli_util.parse_json_parameter("tools", tools) + + if default_execution_type is not None: + _details['defaultExecutionType'] = default_execution_type + + _details['type'] = 'BUILT_IN_SQL_TOOLS' + client = cli_util.build_client('database_tools', 'database_tools', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size + result = client.create_database_tools_mcp_toolset( + create_database_tools_mcp_toolset_details=_details, + **kwargs + ) + if wait_for_state: - result = cli_util.list_call_get_all_results( - client.list_database_tools_private_endpoints, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_database_tools_private_endpoints, - limit, - page_size, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_database_tools_private_endpoints( - compartment_id=compartment_id, - **kwargs - ) + 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) -@work_request_error_group.command(name=cli_util.override('dbtools.list_work_request_errors.command_name', 'list'), help=u"""Returns a paginated list of errors for the specified work request. \n[Command Reference](listWorkRequestErrors)""") -@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous request.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") -@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('--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({}) +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_custom_sql_tool_details.command_name', 'create-database-tools-mcp-toolset-create-database-tools-mcp-toolset-custom-sql-tool-details'), help=u"""Creates a new Database Tools MCP Toolset. \n[Command Reference](createDatabaseToolsMcpToolset)""") +@cli_util.option('--toolset-version', required=True, type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools MCP server.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The OCID of the Database Tools MCP Server""") +@cli_util.option('--tool-name', required=True, help=u"""Name of the tool returned by the MCP Server""") +@cli_util.option('--source', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--tool-description', help=u"""Instructions describing how to use the MCP toolset and its features. This can be used to improve the LLM's understanding of the tool.""") +@cli_util.option('--variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The variables to use with the query + +This option is a JSON list with items of type DatabaseToolsMcpToolsetCustomSqlToolVariable. For documentation on DatabaseToolsMcpToolsetCustomSqlToolVariable please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsMcpToolsetCustomSqlToolVariable.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--allowed-roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The roles granted access to the MCP tool generated by this toolset""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--default-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The default execution type for the toolset. The default value is SYNCHRONOUS. + +To use ASYNCHRONOUS execution, the MCP Server must have the storage property configured.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'source': {'module': 'database_tools', 'class': 'DatabaseToolsCustomSqlToolToolsetSource'}, 'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpToolsetCustomSqlToolVariable]'}, 'allowed-roles': {'module': 'database_tools', 'class': 'list[string]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'WorkRequestErrorCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'source': {'module': 'database_tools', 'class': 'DatabaseToolsCustomSqlToolToolsetSource'}, 'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpToolsetCustomSqlToolVariable]'}, 'allowed-roles': {'module': 'database_tools', 'class': 'list[string]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpToolset'}) @cli_util.wrap_exceptions -def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_id, sort_order, sort_by, page, limit): - - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') - - if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: - raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') +def create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_custom_sql_tool_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, toolset_version, compartment_id, display_name, mcp_server_id, tool_name, source, description, defined_tags, freeform_tags, locks, tool_description, variables, allowed_roles, default_execution_type): kwargs = {} - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if page is not None: - kwargs['page'] = page - if limit is not None: - kwargs['limit'] = limit kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['version'] = toolset_version + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['databaseToolsMcpServerId'] = mcp_server_id + _details['toolName'] = tool_name + _details['source'] = cli_util.parse_json_parameter("source", source) + + if description is not None: + _details['description'] = description + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + if tool_description is not None: + _details['toolDescription'] = tool_description + + if variables is not None: + _details['variables'] = cli_util.parse_json_parameter("variables", variables) + + if allowed_roles is not None: + _details['allowedRoles'] = cli_util.parse_json_parameter("allowed_roles", allowed_roles) + + if default_execution_type is not None: + _details['defaultExecutionType'] = default_execution_type + + _details['type'] = 'CUSTOM_SQL_TOOL' + client = cli_util.build_client('database_tools', 'database_tools', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size + result = client.create_database_tools_mcp_toolset( + create_database_tools_mcp_toolset_details=_details, + **kwargs + ) + if wait_for_state: - result = cli_util.list_call_get_all_results( - client.list_work_request_errors, - work_request_id=work_request_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_work_request_errors, - limit, - page_size, - work_request_id=work_request_id, - **kwargs - ) - else: - result = client.list_work_request_errors( - work_request_id=work_request_id, - **kwargs - ) + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_gen_ai_sql_assistant_details.command_name', 'create-database-tools-mcp-toolset-create-database-tools-mcp-toolset-gen-ai-sql-assistant-details'), help=u"""Creates a new Database Tools MCP Toolset. \n[Command Reference](createDatabaseToolsMcpToolset)""") +@cli_util.option('--toolset-version', required=True, type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools MCP server.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The OCID of the Database Tools MCP Server""") +@cli_util.option('--generative-ai-semantic-store-id', required=True, help=u"""The [OCID] of the related Generative AI Semantic Store.""") +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--tools', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Database Tools GENAI_SQL_ASSISTANT toolset tool configurations + +This option is a JSON list with items of type CreateDatabaseToolsMcpToolsetToolDetails. For documentation on CreateDatabaseToolsMcpToolsetToolDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/CreateDatabaseToolsMcpToolsetToolDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--default-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The default execution type for the toolset. The default value is SYNCHRONOUS. + +To use ASYNCHRONOUS execution, the MCP Server must have the storage property configured.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'tools': {'module': 'database_tools', 'class': 'list[CreateDatabaseToolsMcpToolsetToolDetails]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'tools': {'module': 'database_tools', 'class': 'list[CreateDatabaseToolsMcpToolsetToolDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpToolset'}) +@cli_util.wrap_exceptions +def create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_gen_ai_sql_assistant_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, toolset_version, compartment_id, display_name, mcp_server_id, generative_ai_semantic_store_id, description, defined_tags, freeform_tags, locks, tools, default_execution_type): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['version'] = toolset_version + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['databaseToolsMcpServerId'] = mcp_server_id + _details['generativeAiSemanticStoreId'] = generative_ai_semantic_store_id + + if description is not None: + _details['description'] = description + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + if tools is not None: + _details['tools'] = cli_util.parse_json_parameter("tools", tools) + + if default_execution_type is not None: + _details['defaultExecutionType'] = default_execution_type + + _details['type'] = 'GENAI_SQL_ASSISTANT' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.create_database_tools_mcp_toolset( + create_database_tools_mcp_toolset_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_customizable_reporting_tools_details.command_name', 'create-database-tools-mcp-toolset-create-database-tools-mcp-toolset-customizable-reporting-tools-details'), help=u"""Creates a new Database Tools MCP Toolset. \n[Command Reference](createDatabaseToolsMcpToolset)""") +@cli_util.option('--toolset-version', required=True, type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools MCP server.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The OCID of the Database Tools MCP Server""") +@cli_util.option('--reports', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Database Tools SQL Reports""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--tools', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Database Tools CUSTOMIZABLE_REPORTING_TOOLS toolset tool configurations + +This option is a JSON list with items of type CreateDatabaseToolsMcpToolsetToolDetails. For documentation on CreateDatabaseToolsMcpToolsetToolDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/CreateDatabaseToolsMcpToolsetToolDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--default-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The default execution type for the toolset. The default value is SYNCHRONOUS. + +To use ASYNCHRONOUS execution, the MCP Server must have the storage property configured.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'reports': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpToolsetCustomizableReportingToolsReport]'}, 'tools': {'module': 'database_tools', 'class': 'list[CreateDatabaseToolsMcpToolsetToolDetails]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'reports': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpToolsetCustomizableReportingToolsReport]'}, 'tools': {'module': 'database_tools', 'class': 'list[CreateDatabaseToolsMcpToolsetToolDetails]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpToolset'}) +@cli_util.wrap_exceptions +def create_database_tools_mcp_toolset_create_database_tools_mcp_toolset_customizable_reporting_tools_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, toolset_version, compartment_id, display_name, mcp_server_id, reports, description, defined_tags, freeform_tags, locks, tools, default_execution_type): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['version'] = toolset_version + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['databaseToolsMcpServerId'] = mcp_server_id + _details['reports'] = cli_util.parse_json_parameter("reports", reports) + + if description is not None: + _details['description'] = description + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + if tools is not None: + _details['tools'] = cli_util.parse_json_parameter("tools", tools) + + if default_execution_type is not None: + _details['defaultExecutionType'] = default_execution_type + + _details['type'] = 'CUSTOMIZABLE_REPORTING_TOOLS' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.create_database_tools_mcp_toolset( + create_database_tools_mcp_toolset_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.create_database_tools_private_endpoint.command_name', 'create'), help=u"""Creates a new Database Tools private endpoint. \n[Command Reference](createDatabaseToolsPrivateEndpoint)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools private endpoint.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@cli_util.option('--endpoint-service-id', required=True, help=u"""The [OCID] of the `DatabaseToolsEndpointService`.""") +@cli_util.option('--subnet-id', required=True, help=u"""The [OCID] of the subnet that the private endpoint belongs to.""") +@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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--description', help=u"""A description of the Database Tools private endpoint.""") +@cli_util.option('--private-endpoint-ip', help=u"""The private IP address that represents the access point for the associated endpoint service.""") +@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The [OCID] of the network security groups that the private endpoint's VNIC belongs to. For more information about NSGs, see [NetworkSecurityGroup].""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'nsg-ids': {'module': 'database_tools', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}, 'nsg-ids': {'module': 'database_tools', 'class': 'list[string]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsPrivateEndpoint'}) +@cli_util.wrap_exceptions +def create_database_tools_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, endpoint_service_id, subnet_id, defined_tags, freeform_tags, locks, description, private_endpoint_ip, nsg_ids): + + 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['endpointServiceId'] = endpoint_service_id + _details['subnetId'] = subnet_id + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + if description is not None: + _details['description'] = description + + if private_endpoint_ip is not None: + _details['privateEndpointIp'] = private_endpoint_ip + + if nsg_ids is not None: + _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.create_database_tools_private_endpoint( + create_database_tools_private_endpoint_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.create_database_tools_sql_report.command_name', 'create'), help=u"""Creates a new Database Tools Sql Report. \n[Command Reference](createDatabaseToolsSqlReport)""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE"]), help=u"""The Database Tools SQL report type.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools SQL report.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--source', required=True, help=u"""SQL query executed to generate the report.""") +@cli_util.option('--description', help=u"""A description of the SQL report.""") +@cli_util.option('--purpose', help=u"""Purpose of the Database Tools SQL report. Scenario or conditions describing when or why this report should be used. Provides selection criteria to AI agents to improve report selection accuracy.""") +@cli_util.option('--instructions', help=u"""Instructions on how to use the SQL report. Step-by-step guidance for an AI agent on how to execute or fill in parameters for the report.""") +@cli_util.option('--variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Variables referenced in the Database Tools SQL Report source. + +This option is a JSON list with items of type DatabaseToolsSqlReportVariable. For documentation on DatabaseToolsSqlReportVariable please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsSqlReportVariable.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--columns', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Descriptive information on columns referenced in the Database Tools SQL Report source. + +This option is a JSON list with items of type DatabaseToolsSqlReportColumn. For documentation on DatabaseToolsSqlReportColumn please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsSqlReportColumn.""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportVariable]'}, 'columns': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportColumn]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportVariable]'}, 'columns': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportColumn]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsSqlReport'}) +@cli_util.wrap_exceptions +def create_database_tools_sql_report(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, type, compartment_id, display_name, source, description, purpose, instructions, variables, columns, defined_tags, freeform_tags, locks): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['type'] = type + _details['compartmentId'] = compartment_id + _details['displayName'] = display_name + _details['source'] = source + + if description is not None: + _details['description'] = description + + if purpose is not None: + _details['purpose'] = purpose + + if instructions is not None: + _details['instructions'] = instructions + + if variables is not None: + _details['variables'] = cli_util.parse_json_parameter("variables", variables) + + if columns is not None: + _details['columns'] = cli_util.parse_json_parameter("columns", columns) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.create_database_tools_sql_report( + create_database_tools_sql_report_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.create_database_tools_sql_report_create_database_tools_sql_report_oracle_database_details.command_name', 'create-database-tools-sql-report-create-database-tools-sql-report-oracle-database-details'), help=u"""Creates a new Database Tools Sql Report. \n[Command Reference](createDatabaseToolsSqlReport)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment containing the Database Tools SQL report.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--source', required=True, help=u"""SQL query executed to generate the report.""") +@cli_util.option('--description', help=u"""A description of the SQL report.""") +@cli_util.option('--purpose', help=u"""Purpose of the Database Tools SQL report. Scenario or conditions describing when or why this report should be used. Provides selection criteria to AI agents to improve report selection accuracy.""") +@cli_util.option('--instructions', help=u"""Instructions on how to use the SQL report. Step-by-step guidance for an AI agent on how to execute or fill in parameters for the report.""") +@cli_util.option('--variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Variables referenced in the Database Tools SQL Report source. + +This option is a JSON list with items of type DatabaseToolsSqlReportVariable. For documentation on DatabaseToolsSqlReportVariable please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsSqlReportVariable.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--columns', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Descriptive information on columns referenced in the Database Tools SQL Report source. + +This option is a JSON list with items of type DatabaseToolsSqlReportColumn. For documentation on DatabaseToolsSqlReportColumn please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsSqlReportColumn.""" + 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('--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('--locks', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Locks associated with this resource. + +This option is a JSON list with items of type ResourceLock. For documentation on ResourceLock please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/ResourceLock.""" + 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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportVariable]'}, 'columns': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportColumn]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportVariable]'}, 'columns': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportColumn]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'locks': {'module': 'database_tools', 'class': 'list[ResourceLock]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsSqlReport'}) +@cli_util.wrap_exceptions +def create_database_tools_sql_report_create_database_tools_sql_report_oracle_database_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, source, description, purpose, instructions, variables, columns, defined_tags, freeform_tags, locks): + + 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['source'] = source + + if description is not None: + _details['description'] = description + + if purpose is not None: + _details['purpose'] = purpose + + if instructions is not None: + _details['instructions'] = instructions + + if variables is not None: + _details['variables'] = cli_util.parse_json_parameter("variables", variables) + + if columns is not None: + _details['columns'] = cli_util.parse_json_parameter("columns", columns) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if locks is not None: + _details['locks'] = cli_util.parse_json_parameter("locks", locks) + + _details['type'] = 'ORACLE_DATABASE' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.create_database_tools_sql_report( + create_database_tools_sql_report_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.delete_database_tools_connection.command_name', 'delete'), help=u"""Deletes the specified Database Tools connection resource. \n[Command Reference](deleteDatabaseToolsConnection)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_database_tools_connection(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, if_match, is_lock_override): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.delete_database_tools_connection( + database_tools_connection_id=database_tools_connection_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) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.delete_database_tools_database_api_gateway_config.command_name', 'delete'), help=u"""Deletes the specified Database Tools database API gateway config resource. \n[Command Reference](deleteDatabaseToolsDatabaseApiGatewayConfig)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@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_database_tools_database_api_gateway_config(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_api_gateway_config_id, if_match, is_lock_override): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.delete_database_tools_database_api_gateway_config( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_database_api_gateway_config') and callable(getattr(client, 'get_database_tools_database_api_gateway_config')): + 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_database_tools_database_api_gateway_config(database_api_gateway_config_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) + + +@database_tools_identity_group.command(name=cli_util.override('dbtools.delete_database_tools_identity.command_name', 'delete'), help=u"""Deletes the specified Database Tools identity resource. \n[Command Reference](deleteDatabaseToolsIdentity)""") +@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_database_tools_identity(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, if_match, is_lock_override): + + if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.delete_database_tools_identity( + database_tools_identity_id=database_tools_identity_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) + + +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.delete_database_tools_mcp_server.command_name', 'delete'), help=u"""Deletes the specified Database Tools MCP server resource. \n[Command Reference](deleteDatabaseToolsMcpServer)""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The [OCID] of a Database Tools MCP server.""") +@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_database_tools_mcp_server(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_server_id, if_match, is_lock_override): + + if isinstance(mcp_server_id, six.string_types) and len(mcp_server_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-server-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.delete_database_tools_mcp_server( + database_tools_mcp_server_id=mcp_server_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) + + +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.delete_database_tools_mcp_toolset.command_name', 'delete'), help=u"""Deletes the specified Database Tools MCP Toolset resource. \n[Command Reference](deleteDatabaseToolsMcpToolset)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_database_tools_mcp_toolset(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_toolset_id, if_match, is_lock_override): + + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.delete_database_tools_mcp_toolset( + database_tools_mcp_toolset_id=mcp_toolset_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) + + +@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.delete_database_tools_private_endpoint.command_name', 'delete'), help=u"""Deletes the specified Database Tools private endpoint. \n[Command Reference](deleteDatabaseToolsPrivateEndpoint)""") +@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_database_tools_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, if_match, is_lock_override): + + if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.delete_database_tools_private_endpoint( + database_tools_private_endpoint_id=database_tools_private_endpoint_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Please retrieve the work request to find its current state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.delete_database_tools_sql_report.command_name', 'delete'), help=u"""Deletes the specified Database Tools SQL Report resource. \n[Command Reference](deleteDatabaseToolsSqlReport)""") +@cli_util.option('--sql-report-id', required=True, help=u"""The [OCID] of a Database Tools SQL Report.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@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_database_tools_sql_report(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, sql_report_id, if_match, is_lock_override): + + if isinstance(sql_report_id, six.string_types) and len(sql_report_id.strip()) == 0: + raise click.UsageError('Parameter --sql-report-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.delete_database_tools_sql_report( + database_tools_sql_report_id=sql_report_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_sql_report') and callable(getattr(client, 'get_database_tools_sql_report')): + 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_database_tools_sql_report(sql_report_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) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.get_database_tools_connection.command_name', 'get'), help=u"""Gets details of the specified Database Tools connection. \n[Command Reference](getDatabaseToolsConnection)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@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': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@cli_util.wrap_exceptions +def get_database_tools_connection(ctx, from_json, database_tools_connection_id): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-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('database_tools', 'database_tools', ctx) + result = client.get_database_tools_connection( + database_tools_connection_id=database_tools_connection_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.get_database_tools_database_api_gateway_config.command_name', 'get'), help=u"""Gets details of the specified Database Tools database API gateway config. \n[Command Reference](getDatabaseToolsDatabaseApiGatewayConfig)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@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': 'database_tools', 'class': 'DatabaseToolsDatabaseApiGatewayConfig'}) +@cli_util.wrap_exceptions +def get_database_tools_database_api_gateway_config(ctx, from_json, database_api_gateway_config_id): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-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('database_tools', 'database_tools', ctx) + result = client.get_database_tools_database_api_gateway_config( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_endpoint_service_group.command(name=cli_util.override('dbtools.get_database_tools_endpoint_service.command_name', 'get'), help=u"""Gets details for the specified Database Tools endpoint service. \n[Command Reference](getDatabaseToolsEndpointService)""") +@cli_util.option('--database-tools-endpoint-service-id', required=True, help=u"""The [OCID] of a Database Tools Endpoint Service.""") +@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': 'database_tools', 'class': 'DatabaseToolsEndpointService'}) +@cli_util.wrap_exceptions +def get_database_tools_endpoint_service(ctx, from_json, database_tools_endpoint_service_id): + + if isinstance(database_tools_endpoint_service_id, six.string_types) and len(database_tools_endpoint_service_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-endpoint-service-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('database_tools', 'database_tools', ctx) + result = client.get_database_tools_endpoint_service( + database_tools_endpoint_service_id=database_tools_endpoint_service_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_identity_group.command(name=cli_util.override('dbtools.get_database_tools_identity.command_name', 'get'), help=u"""Gets details of the specified Database Tools identity. \n[Command Reference](getDatabaseToolsIdentity)""") +@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@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': 'database_tools', 'class': 'DatabaseToolsIdentity'}) +@cli_util.wrap_exceptions +def get_database_tools_identity(ctx, from_json, database_tools_identity_id): + + if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-identity-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('database_tools', 'database_tools', ctx) + result = client.get_database_tools_identity( + database_tools_identity_id=database_tools_identity_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.get_database_tools_mcp_server.command_name', 'get'), help=u"""Gets details of the specified Database Tools MCP server. \n[Command Reference](getDatabaseToolsMcpServer)""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The [OCID] of a Database Tools MCP server.""") +@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': 'database_tools', 'class': 'DatabaseToolsMcpServer'}) +@cli_util.wrap_exceptions +def get_database_tools_mcp_server(ctx, from_json, mcp_server_id): + + if isinstance(mcp_server_id, six.string_types) and len(mcp_server_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-server-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('database_tools', 'database_tools', ctx) + result = client.get_database_tools_mcp_server( + database_tools_mcp_server_id=mcp_server_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.get_database_tools_mcp_toolset.command_name', 'get'), help=u"""Gets details of the specified Database Tools MCP Toolset. \n[Command Reference](getDatabaseToolsMcpToolset)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@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': 'database_tools', 'class': 'DatabaseToolsMcpToolset'}) +@cli_util.wrap_exceptions +def get_database_tools_mcp_toolset(ctx, from_json, mcp_toolset_id): + + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-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('database_tools', 'database_tools', ctx) + result = client.get_database_tools_mcp_toolset( + database_tools_mcp_toolset_id=mcp_toolset_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.get_database_tools_private_endpoint.command_name', 'get'), help=u"""Gets details of a specified Database Tools private endpoint. \n[Command Reference](getDatabaseToolsPrivateEndpoint)""") +@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") +@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': 'database_tools', 'class': 'DatabaseToolsPrivateEndpoint'}) +@cli_util.wrap_exceptions +def get_database_tools_private_endpoint(ctx, from_json, database_tools_private_endpoint_id): + + if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-private-endpoint-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('database_tools', 'database_tools', ctx) + result = client.get_database_tools_private_endpoint( + database_tools_private_endpoint_id=database_tools_private_endpoint_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.get_database_tools_sql_report.command_name', 'get'), help=u"""Gets details of the specified Database Tools SQL report. \n[Command Reference](getDatabaseToolsSqlReport)""") +@cli_util.option('--sql-report-id', required=True, help=u"""The [OCID] of a Database Tools SQL Report.""") +@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': 'database_tools', 'class': 'DatabaseToolsSqlReport'}) +@cli_util.wrap_exceptions +def get_database_tools_sql_report(ctx, from_json, sql_report_id): + + if isinstance(sql_report_id, six.string_types) and len(sql_report_id.strip()) == 0: + raise click.UsageError('Parameter --sql-report-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('database_tools', 'database_tools', ctx) + result = client.get_database_tools_sql_report( + database_tools_sql_report_id=sql_report_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_group.command(name=cli_util.override('dbtools.get_work_request.command_name', 'get'), help=u"""Gets the status of the specified work request. \n[Command Reference](getWorkRequest)""") +@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous request.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'WorkRequest'}) +@cli_util.wrap_exceptions +def get_work_request(ctx, from_json, work_request_id): + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.get_work_request( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.list_database_tools_connections.command_name', 'list'), help=u"""Returns a list of Database Tools connections. \n[Command Reference](listDatabaseToolsConnections)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), help=u"""A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE", "MYSQL", "POSTGRESQL", "GENERIC_JDBC"]), multiple=True, help=u"""A filter to return only resources their type matches the specified type.""") +@cli_util.option('--runtime-support', type=custom_types.CliCaseInsensitiveChoice(["SUPPORTED", "UNSUPPORTED"]), multiple=True, help=u"""A filter to return only resources with one of the specified type values.""") +@cli_util.option('--runtime-identity', type=custom_types.CliCaseInsensitiveChoice(["AUTHENTICATED_PRINCIPAL", "RESOURCE_PRINCIPAL"]), multiple=True, help=u"""A filter to return only resources with one of the specified runtimeIdentity values.""") +@cli_util.option('--related-resource-identifier', help=u"""The [OCID] of the related resource.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@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': 'database_tools', 'class': 'DatabaseToolsConnectionCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_connections(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, type, runtime_support, runtime_identity, related_resource_identifier, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if type is not None and len(type) > 0: + kwargs['type'] = type + if runtime_support is not None and len(runtime_support) > 0: + kwargs['runtime_support'] = runtime_support + if runtime_identity is not None and len(runtime_identity) > 0: + kwargs['runtime_identity'] = runtime_identity + if related_resource_identifier is not None: + kwargs['related_resource_identifier'] = related_resource_identifier + 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('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_connections, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_connections, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_database_tools_connections( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.list_database_tools_database_api_gateway_configs.command_name', 'list'), help=u"""Returns a list of Database Tools database API gateway configs. \n[Command Reference](listDatabaseToolsDatabaseApiGatewayConfigs)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), help=u"""A filter to return resources only when their `lifecycleState` matches the specified `lifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), multiple=True, help=u"""A filter to return only resources with one of the specified type values.""") +@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': 'database_tools', 'class': 'DatabaseToolsDatabaseApiGatewayConfigCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_database_api_gateway_configs(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, limit, page, sort_order, sort_by, type): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if type is not None and len(type) > 0: + kwargs['type'] = type + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_database_api_gateway_configs, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_database_api_gateway_configs, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_database_tools_database_api_gateway_configs( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_endpoint_service_group.command(name=cli_util.override('dbtools.list_database_tools_endpoint_services.command_name', 'list'), help=u"""Returns a list of Database Tools endpoint services. \n[Command Reference](listDatabaseToolsEndpointServices)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), help=u"""A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--name', help=u"""A filter to return only resources that match the entire specified name.""") +@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': 'database_tools', 'class': 'DatabaseToolsEndpointServiceCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_endpoint_services(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_order, sort_by, lifecycle_state, display_name, name): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if name is not None: + kwargs['name'] = name + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_endpoint_services, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_endpoint_services, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_database_tools_endpoint_services( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_identity_group.command(name=cli_util.override('dbtools.list_database_tools_identities.command_name', 'list'), help=u"""Returns a list of Database Tools identities. \n[Command Reference](listDatabaseToolsIdentities)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), help=u"""A filter to return resources only when their `databaseToolsIdentityLifecycleState` matches the specified `databaseToolsIdentityLifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--database-tools-connection-id', help=u"""A filter to return only resources when their `databaseToolsConnectionId` matches the specified `databaseToolsConnectionId`.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE_RESOURCE_PRINCIPAL"]), multiple=True, help=u"""A filter to return only resources with one of the specified type values.""") +@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': 'database_tools', 'class': 'DatabaseToolsIdentityCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_identities(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, database_tools_connection_id, limit, page, sort_order, sort_by, type): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if database_tools_connection_id is not None: + kwargs['database_tools_connection_id'] = database_tools_connection_id + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if type is not None and len(type) > 0: + kwargs['type'] = type + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_identities, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_identities, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_database_tools_identities( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.list_database_tools_mcp_servers.command_name', 'list'), help=u"""Returns a list of Database Tools MCP servers. \n[Command Reference](listDatabaseToolsMcpServers)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), help=u"""A filter to return resources only when their `databaseToolsMcpServerLifecycleState` matches the specified `databaseToolsMcpServerLifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--database-tools-connection-id', help=u"""A filter to return only resources when their `databaseToolsConnectionId` matches the specified `databaseToolsConnectionId`.""") +@cli_util.option('--related-resource-identifier', help=u"""The [OCID] of the related resource.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), multiple=True, help=u"""A filter to return only resources with one of the specified type values.""") +@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': 'database_tools', 'class': 'DatabaseToolsMcpServerCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_mcp_servers(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, database_tools_connection_id, related_resource_identifier, limit, page, sort_order, sort_by, type): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if database_tools_connection_id is not None: + kwargs['database_tools_connection_id'] = database_tools_connection_id + if related_resource_identifier is not None: + kwargs['related_resource_identifier'] = related_resource_identifier + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if type is not None and len(type) > 0: + kwargs['type'] = type + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_mcp_servers, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_mcp_servers, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_database_tools_mcp_servers( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_mcp_toolset_version_collection_group.command(name=cli_util.override('dbtools.list_database_tools_mcp_toolset_versions.command_name', 'list-database-tools-mcp-toolset-versions'), help=u"""Returns a list of Database Tools Toolset versions \n[Command Reference](listDatabaseToolsMcpToolsetVersions)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--mcp-server-id', help=u"""A filter to return only resources matching the specified `databaseToolsMcpServerId`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpToolsetVersionCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_mcp_toolset_versions(ctx, from_json, all_pages, compartment_id, mcp_server_id, display_name): + + kwargs = {} + if mcp_server_id is not None: + kwargs['database_tools_mcp_server_id'] = mcp_server_id + 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('database_tools', 'database_tools', ctx) + result = client.list_database_tools_mcp_toolset_versions( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.list_database_tools_mcp_toolsets.command_name', 'list'), help=u"""Returns a list of Database Tools Toolsets. \n[Command Reference](listDatabaseToolsMcpToolsets)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return resources only when their `databaseToolsMcpToolsetLifecycleState` matches the specified `databaseToolsMcpToolsetLifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["CUSTOM_SQL_TOOL", "BUILT_IN_SQL_TOOLS", "CUSTOMIZABLE_REPORTING_TOOLS", "GENAI_SQL_ASSISTANT"]), multiple=True, help=u"""A filter to return only resources with one of the specified type values.""") +@cli_util.option('--mcp-server-id', help=u"""A filter to return only resources matching the specified `databaseToolsMcpServerId`.""") +@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': 'database_tools', 'class': 'DatabaseToolsMcpToolsetCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_mcp_toolsets(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, limit, page, sort_order, sort_by, type, mcp_server_id): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if type is not None and len(type) > 0: + kwargs['type'] = type + if mcp_server_id is not None: + kwargs['database_tools_mcp_server_id'] = mcp_server_id + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_mcp_toolsets, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_mcp_toolsets, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_database_tools_mcp_toolsets( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.list_database_tools_private_endpoints.command_name', 'list'), help=u"""Returns a list of Database Tools private endpoints. \n[Command Reference](listDatabaseToolsPrivateEndpoints)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--subnet-id', help=u"""A filter to return only resources their `subnetId` matches the specified `subnetId`.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@cli_util.option('--endpoint-service-id', help=u"""A filter to return only resources their `endpointServiceId` matches the specified `endpointServiceId`.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), help=u"""A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@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': 'database_tools', 'class': 'DatabaseToolsPrivateEndpointCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_private_endpoints(ctx, from_json, all_pages, page_size, compartment_id, subnet_id, limit, page, sort_order, sort_by, endpoint_service_id, lifecycle_state, display_name): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if subnet_id is not None: + kwargs['subnet_id'] = subnet_id + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if endpoint_service_id is not None: + kwargs['endpoint_service_id'] = endpoint_service_id + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + 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('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_private_endpoints, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_private_endpoints, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_database_tools_private_endpoints( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.list_database_tools_sql_reports.command_name', 'list'), help=u"""Returns a list of Database Tools SQL reports. \n[Command Reference](listDatabaseToolsSqlReports)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), help=u"""A filter to return resources only when their `databaseToolsSqlReportLifecycleState` matches the specified `databaseToolsSqlReportLifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE"]), multiple=True, help=u"""A filter to return only resources with one of the specified type values.""") +@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': 'database_tools', 'class': 'DatabaseToolsSqlReportCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_sql_reports(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, limit, page, sort_order, sort_by, type): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if type is not None and len(type) > 0: + kwargs['type'] = type + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_sql_reports, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_sql_reports, + limit, + page_size, + compartment_id=compartment_id, + **kwargs + ) + else: + result = client.list_database_tools_sql_reports( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_error_group.command(name=cli_util.override('dbtools.list_work_request_errors.command_name', 'list'), help=u"""Returns a paginated list of errors for the specified work request. \n[Command Reference](listWorkRequestErrors)""") +@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous request.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@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('--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': 'database_tools', 'class': 'WorkRequestErrorCollection'}) +@cli_util.wrap_exceptions +def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_id, sort_order, sort_by, page, limit): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_request_errors, + work_request_id=work_request_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_work_request_errors, + limit, + page_size, + work_request_id=work_request_id, + **kwargs + ) + else: + result = client.list_work_request_errors( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_log_entry_group.command(name=cli_util.override('dbtools.list_work_request_logs.command_name', 'list-work-request-logs'), help=u"""Returns a paginated list of logs for the specified work request. \n[Command Reference](listWorkRequestLogs)""") +@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous request.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@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('--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': 'database_tools', 'class': 'WorkRequestLogEntryCollection'}) +@cli_util.wrap_exceptions +def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id, sort_order, sort_by, page, limit): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_request_logs, + work_request_id=work_request_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_work_request_logs, + limit, + page_size, + work_request_id=work_request_id, + **kwargs + ) + else: + result = client.list_work_request_logs( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_group.command(name=cli_util.override('dbtools.list_work_requests.command_name', 'list'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listWorkRequests)""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") +@cli_util.option('--resource-identifier', help=u"""The [OCID] of the resource.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted", "timeUpdated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeAccepted is descending. If no value is specified timeAccepted is default.""") +@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('--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': 'database_tools', 'class': 'WorkRequestCollection'}) +@cli_util.wrap_exceptions +def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, resource_identifier, sort_order, sort_by, page, limit): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if resource_identifier is not None: + kwargs['resource_identifier'] = resource_identifier + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools', 'database_tools', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_requests, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + 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) + + +@database_tools_identity_group.command(name=cli_util.override('dbtools.refresh_database_tools_identity_credential.command_name', 'refresh-database-tools-identity-credential'), help=u"""Refresh Database Tools identity credential. \n[Command Reference](refreshDatabaseToolsIdentityCredential)""") +@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE_RESOURCE_PRINCIPAL"]), help=u"""The Database Tools identity type.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def refresh_database_tools_identity_credential(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, type, if_match): + + if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-identity-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['type'] = type + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.refresh_database_tools_identity_credential( + database_tools_identity_id=database_tools_identity_id, + refresh_database_tools_identity_credential_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_identity_group.command(name=cli_util.override('dbtools.refresh_database_tools_identity_credential_refresh_database_tools_identity_oracle_database_resource_principal_credential_details.command_name', 'refresh-database-tools-identity-credential-refresh-database-tools-identity-oracle-database-resource-principal-credential-details'), help=u"""Refresh Database Tools identity credential. \n[Command Reference](refreshDatabaseToolsIdentityCredential)""") +@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def refresh_database_tools_identity_credential_refresh_database_tools_identity_oracle_database_resource_principal_credential_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, if_match): + + if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-identity-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['type'] = 'ORACLE_DATABASE_RESOURCE_PRINCIPAL' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.refresh_database_tools_identity_credential( + database_tools_identity_id=database_tools_identity_id, + refresh_database_tools_identity_credential_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.remove_database_tools_connection_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsConnection resource. \n[Command Reference](removeDatabaseToolsConnectionLock)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), 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 INACTIVE 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': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@cli_util.wrap_exceptions +def remove_database_tools_connection_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, type, related_resource_id, message, time_created, if_match): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-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['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.remove_database_tools_connection_lock( + database_tools_connection_id=database_tools_connection_id, + remove_resource_lock_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_connection') and callable(getattr(client, 'get_database_tools_connection')): + 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_database_tools_connection(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) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.remove_database_tools_database_api_gateway_config_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsDatabaseApiGatewayConfig resource. \n[Command Reference](removeDatabaseToolsDatabaseApiGatewayConfigLock)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@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(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@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': 'database_tools', 'class': 'DatabaseToolsDatabaseApiGatewayConfig'}) +@cli_util.wrap_exceptions +def remove_database_tools_database_api_gateway_config_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_api_gateway_config_id, type, related_resource_id, message, time_created, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-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['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.remove_database_tools_database_api_gateway_config_lock( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + remove_resource_lock_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_database_api_gateway_config') and callable(getattr(client, 'get_database_tools_database_api_gateway_config')): + 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_database_tools_database_api_gateway_config(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) + + +@database_tools_identity_group.command(name=cli_util.override('dbtools.remove_database_tools_identity_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsIdentity resource. \n[Command Reference](removeDatabaseToolsIdentityLock)""") +@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentity'}) +@cli_util.wrap_exceptions +def remove_database_tools_identity_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, type, related_resource_id, message, time_created, if_match): + + if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-identity-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['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.remove_database_tools_identity_lock( + database_tools_identity_id=database_tools_identity_id, + remove_resource_lock_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_identity') and callable(getattr(client, 'get_database_tools_identity')): + 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_database_tools_identity(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) + + +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.remove_database_tools_mcp_server_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsMcpServer resource. \n[Command Reference](removeDatabaseToolsMcpServerLock)""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The [OCID] of a Database Tools MCP server.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpServer'}) +@cli_util.wrap_exceptions +def remove_database_tools_mcp_server_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_server_id, type, related_resource_id, message, time_created, if_match): + + if isinstance(mcp_server_id, six.string_types) and len(mcp_server_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-server-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['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.remove_database_tools_mcp_server_lock( + database_tools_mcp_server_id=mcp_server_id, + remove_resource_lock_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_mcp_server') and callable(getattr(client, 'get_database_tools_mcp_server')): + 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_database_tools_mcp_server(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) + + +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.remove_database_tools_mcp_toolset_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsMcpToolset resource. \n[Command Reference](removeDatabaseToolsMcpToolsetLock)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsMcpToolset'}) +@cli_util.wrap_exceptions +def remove_database_tools_mcp_toolset_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_toolset_id, type, related_resource_id, message, time_created, if_match): + + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-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['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.remove_database_tools_mcp_toolset_lock( + database_tools_mcp_toolset_id=mcp_toolset_id, + remove_resource_lock_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_mcp_toolset') and callable(getattr(client, 'get_database_tools_mcp_toolset')): + 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_database_tools_mcp_toolset(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) + + +@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.remove_database_tools_private_endpoint_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsPrivateEndpoint resource. \n[Command Reference](removeDatabaseToolsPrivateEndpointLock)""") +@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), 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 INACTIVE 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': 'database_tools', 'class': 'DatabaseToolsPrivateEndpoint'}) +@cli_util.wrap_exceptions +def remove_database_tools_private_endpoint_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, type, related_resource_id, message, time_created, if_match): + + if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.remove_database_tools_private_endpoint_lock( + database_tools_private_endpoint_id=database_tools_private_endpoint_id, + remove_resource_lock_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_private_endpoint') and callable(getattr(client, 'get_database_tools_private_endpoint')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_database_tools_private_endpoint(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.remove_database_tools_sql_report_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsSqlReport resource. \n[Command Reference](removeDatabaseToolsSqlReportLock)""") +@cli_util.option('--sql-report-id', required=True, help=u"""The [OCID] of a Database Tools SQL Report.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") +@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") +@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") +@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@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(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@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': 'database_tools', 'class': 'DatabaseToolsSqlReport'}) +@cli_util.wrap_exceptions +def remove_database_tools_sql_report_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, sql_report_id, type, related_resource_id, message, time_created, if_match): + + if isinstance(sql_report_id, six.string_types) and len(sql_report_id.strip()) == 0: + raise click.UsageError('Parameter --sql-report-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['type'] = type + + if related_resource_id is not None: + _details['relatedResourceId'] = related_resource_id + + if message is not None: + _details['message'] = message + + if time_created is not None: + _details['timeCreated'] = time_created + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.remove_database_tools_sql_report_lock( + database_tools_sql_report_id=sql_report_id, + remove_resource_lock_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_database_tools_sql_report') and callable(getattr(client, 'get_database_tools_sql_report')): + 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_database_tools_sql_report(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) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection.command_name', 'update'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE", "MYSQL", "POSTGRESQL", "GENERIC_JDBC"]), help=u"""The Database Tools connection type.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@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('--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('--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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) +@cli_util.wrap_exceptions +def update_database_tools_connection(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, type, display_name, defined_tags, freeform_tags, if_match, is_lock_override): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags: + if not click.confirm("WARNING: Updates to defined-tags and freeform-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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['type'] = type + + if display_name is not None: + _details['displayName'] = display_name + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.update_database_tools_connection( + database_tools_connection_id=database_tools_connection_id, + update_database_tools_connection_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection_update_database_tools_connection_generic_jdbc_details.command_name', 'update-database-tools-connection-update-database-tools-connection-generic-jdbc-details'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@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('--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('--url', help=u"""The JDBC URL used to connect to the Generic JDBC database system.""") +@cli_util.option('--user-name', help=u"""The database user name.""") +@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. + +This option is a JSON list with items of type DatabaseToolsKeyStoreGenericJdbcDetails. For documentation on DatabaseToolsKeyStoreGenericJdbcDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreGenericJdbcDetails.""" + 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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreGenericJdbcDetails]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreGenericJdbcDetails]'}}) +@cli_util.wrap_exceptions +def update_database_tools_connection_update_database_tools_connection_generic_jdbc_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, display_name, defined_tags, freeform_tags, url, user_name, user_password, advanced_properties, key_stores, if_match, is_lock_override): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags or user_password or advanced_properties or key_stores: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and user-password and advanced-properties and key-stores 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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + 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 defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if url is not None: + _details['url'] = url + + if user_name is not None: + _details['userName'] = user_name + + if user_password is not None: + _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if key_stores is not None: + _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + + _details['type'] = 'GENERIC_JDBC' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.update_database_tools_connection( + database_tools_connection_id=database_tools_connection_id, + update_database_tools_connection_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection_update_database_tools_connection_postgresql_details.command_name', 'update-database-tools-connection-update-database-tools-connection-postgresql-details'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@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('--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('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--connection-string', help=u"""The connection string used to connect to the PostgreSQL Server.""") +@cli_util.option('--user-name', help=u"""The database user name.""") +@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `sslMode`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. + +This option is a JSON list with items of type DatabaseToolsKeyStorePostgresqlDetails. For documentation on DatabaseToolsKeyStorePostgresqlDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStorePostgresqlDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the Customer VCN.""") +@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourcePostgresqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStorePostgresqlDetails]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourcePostgresqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStorePostgresqlDetails]'}}) +@cli_util.wrap_exceptions +def update_database_tools_connection_update_database_tools_connection_postgresql_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, display_name, defined_tags, freeform_tags, related_resource, connection_string, user_name, user_password, advanced_properties, key_stores, private_endpoint_id, if_match, is_lock_override): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags or related_resource or user_password or advanced_properties or key_stores: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and related-resource and user-password and advanced-properties and key-stores 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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + 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 defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if related_resource is not None: + _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) + + if connection_string is not None: + _details['connectionString'] = connection_string + + if user_name is not None: + _details['userName'] = user_name + + if user_password is not None: + _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if key_stores is not None: + _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + + if private_endpoint_id is not None: + _details['privateEndpointId'] = private_endpoint_id + + _details['type'] = 'POSTGRESQL' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.update_database_tools_connection( + database_tools_connection_id=database_tools_connection_id, + update_database_tools_connection_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection_update_database_tools_connection_my_sql_details.command_name', 'update-database-tools-connection-update-database-tools-connection-my-sql-details'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@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('--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('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--connection-string', help=u"""The connection string used to connect to the MySQL Server.""") +@cli_util.option('--user-name', help=u"""The database user name.""") +@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `sslMode`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. + +This option is a JSON list with items of type DatabaseToolsKeyStoreMySqlDetails. For documentation on DatabaseToolsKeyStoreMySqlDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreMySqlDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the Customer VCN.""") +@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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourceMySqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreMySqlDetails]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourceMySqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreMySqlDetails]'}}) +@cli_util.wrap_exceptions +def update_database_tools_connection_update_database_tools_connection_my_sql_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, display_name, defined_tags, freeform_tags, related_resource, connection_string, user_name, user_password, advanced_properties, key_stores, private_endpoint_id, if_match, is_lock_override): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags or related_resource or user_password or advanced_properties or key_stores: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and related-resource and user-password and advanced-properties and key-stores 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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + 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 defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if related_resource is not None: + _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) + + if connection_string is not None: + _details['connectionString'] = connection_string + + if user_name is not None: + _details['userName'] = user_name + + if user_password is not None: + _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if key_stores is not None: + _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + + if private_endpoint_id is not None: + _details['privateEndpointId'] = private_endpoint_id + + _details['type'] = 'MYSQL' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.update_database_tools_connection( + database_tools_connection_id=database_tools_connection_id, + update_database_tools_connection_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection_update_database_tools_connection_oracle_database_details.command_name', 'update-database-tools-connection-update-database-tools-connection-oracle-database-details'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@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('--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('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--connection-string', help=u"""The connect descriptor or Easy Connect Naming method used to connect to the database.""") +@cli_util.option('--user-name', help=u"""The database user name.""") +@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `oracle.net.ssl_server_dn_match`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Oracle wallet or Java Keystores containing trusted certificates for authenticating the server's public certificate and the client private key and associated certificates required for client authentication. + +This option is a JSON list with items of type DatabaseToolsKeyStoreDetails. For documentation on DatabaseToolsKeyStoreDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the Customer VCN.""") +@cli_util.option('--proxy-client', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourceDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClientDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourceDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClientDetails'}}) +@cli_util.wrap_exceptions +def update_database_tools_connection_update_database_tools_connection_oracle_database_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, display_name, defined_tags, freeform_tags, related_resource, connection_string, user_name, user_password, advanced_properties, key_stores, private_endpoint_id, proxy_client, if_match, is_lock_override): + + if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags or related_resource or user_password or advanced_properties or key_stores or proxy_client: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and related-resource and user-password and advanced-properties and key-stores and proxy-client 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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override + 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 defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if related_resource is not None: + _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) + + if connection_string is not None: + _details['connectionString'] = connection_string + + if user_name is not None: + _details['userName'] = user_name + + if user_password is not None: + _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if key_stores is not None: + _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + + if private_endpoint_id is not None: + _details['privateEndpointId'] = private_endpoint_id + + if proxy_client is not None: + _details['proxyClient'] = cli_util.parse_json_parameter("proxy_client", proxy_client) + + _details['type'] = 'ORACLE_DATABASE' + + client = cli_util.build_client('database_tools', 'database_tools', ctx) + result = client.update_database_tools_connection( + database_tools_connection_id=database_tools_connection_id, + update_database_tools_connection_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) -@work_request_log_entry_group.command(name=cli_util.override('dbtools.list_work_request_logs.command_name', 'list-work-request-logs'), help=u"""Returns a paginated list of logs for the specified work request. \n[Command Reference](listWorkRequestLogs)""") -@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the asynchronous request.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") -@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('--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({}) +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.update_database_tools_database_api_gateway_config.command_name', 'update'), help=u"""Updates the specified Database Tools database API gateway config. \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfig)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The Database Tools database API gateway config type.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@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('--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('--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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'WorkRequestLogEntryCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsDatabaseApiGatewayConfig'}) @cli_util.wrap_exceptions -def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id, sort_order, sort_by, page, limit): +def update_database_tools_database_api_gateway_config(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_api_gateway_config_id, type, display_name, defined_tags, freeform_tags, if_match, is_lock_override): - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') - - if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: - raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() kwargs = {} - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if page is not None: - kwargs['page'] = page - if limit is not None: - kwargs['limit'] = limit + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['type'] = type + + if display_name is not None: + _details['displayName'] = display_name + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + client = cli_util.build_client('database_tools', 'database_tools', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size + result = client.update_database_tools_database_api_gateway_config( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + update_database_tools_database_api_gateway_config_details=_details, + **kwargs + ) + if wait_for_state: - result = cli_util.list_call_get_all_results( - client.list_work_request_logs, - work_request_id=work_request_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_work_request_logs, - limit, - page_size, - work_request_id=work_request_id, - **kwargs - ) - else: - result = client.list_work_request_logs( - work_request_id=work_request_id, - **kwargs - ) + if hasattr(client, 'get_database_tools_database_api_gateway_config') and callable(getattr(client, 'get_database_tools_database_api_gateway_config')): + 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_database_tools_database_api_gateway_config(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) -@work_request_group.command(name=cli_util.override('dbtools.list_work_requests.command_name', 'list'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listWorkRequests)""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") -@cli_util.option('--resource-identifier', help=u"""The [OCID] of the resource.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted", "timeUpdated"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeAccepted is descending. If no value is specified timeAccepted is default.""") -@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('--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({}) +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools.update_database_tools_database_api_gateway_config_update_database_tools_database_api_gateway_config_default_details.command_name', 'update-database-tools-database-api-gateway-config-update-database-tools-database-api-gateway-config-default-details'), help=u"""Updates the specified Database Tools database API gateway config. \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfig)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@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('--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('--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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'WorkRequestCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsDatabaseApiGatewayConfig'}) @cli_util.wrap_exceptions -def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, resource_identifier, sort_order, sort_by, page, limit): +def update_database_tools_database_api_gateway_config_update_database_tools_database_api_gateway_config_default_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_api_gateway_config_id, display_name, defined_tags, freeform_tags, if_match, is_lock_override): - if all_pages and limit: - raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() kwargs = {} - if resource_identifier is not None: - kwargs['resource_identifier'] = resource_identifier - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by - if page is not None: - kwargs['page'] = page - if limit is not None: - kwargs['limit'] = limit + if if_match is not None: + kwargs['if_match'] = if_match + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override 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 defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + _details['type'] = 'DEFAULT' + client = cli_util.build_client('database_tools', 'database_tools', ctx) - if all_pages: - if page_size: - kwargs['limit'] = page_size + result = client.update_database_tools_database_api_gateway_config( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + update_database_tools_database_api_gateway_config_details=_details, + **kwargs + ) + if wait_for_state: - result = cli_util.list_call_get_all_results( - client.list_work_requests, - compartment_id=compartment_id, - **kwargs - ) - elif limit is not None: - result = cli_util.list_call_get_up_to_limit( - client.list_work_requests, - limit, - page_size, - compartment_id=compartment_id, - **kwargs - ) - else: - result = client.list_work_requests( - compartment_id=compartment_id, - **kwargs - ) + if hasattr(client, 'get_database_tools_database_api_gateway_config') and callable(getattr(client, 'get_database_tools_database_api_gateway_config')): + 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_database_tools_database_api_gateway_config(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) -@database_tools_identity_group.command(name=cli_util.override('dbtools.refresh_database_tools_identity_credential.command_name', 'refresh-database-tools-identity-credential'), help=u"""Refresh Database Tools identity credential. \n[Command Reference](refreshDatabaseToolsIdentityCredential)""") +@database_tools_identity_group.command(name=cli_util.override('dbtools.update_database_tools_identity.command_name', 'update'), help=u"""Updates the specified Database Tools identity. \n[Command Reference](updateDatabaseToolsIdentity)""") @cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") @cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE_RESOURCE_PRINCIPAL"]), help=u"""The Database Tools identity type.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@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('--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('--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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.wrap_exceptions -def refresh_database_tools_identity_credential(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, type, if_match): +def update_database_tools_identity(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, type, display_name, defined_tags, freeform_tags, if_match, is_lock_override): if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags: + if not click.confirm("WARNING: Updates to defined-tags and freeform-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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} _details['type'] = type + if display_name is not None: + _details['displayName'] = display_name + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.refresh_database_tools_identity_credential( + result = client.update_database_tools_identity( database_tools_identity_id=database_tools_identity_id, - refresh_database_tools_identity_credential_details=_details, + update_database_tools_identity_details=_details, **kwargs ) if wait_for_state: @@ -1978,35 +5430,55 @@ def refresh_database_tools_identity_credential(ctx, from_json, wait_for_state, m cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.refresh_database_tools_identity_credential_refresh_database_tools_identity_oracle_database_resource_principal_credential_details.command_name', 'refresh-database-tools-identity-credential-refresh-database-tools-identity-oracle-database-resource-principal-credential-details'), help=u"""Refresh Database Tools identity credential. \n[Command Reference](refreshDatabaseToolsIdentityCredential)""") +@database_tools_identity_group.command(name=cli_util.override('dbtools.update_database_tools_identity_update_database_tools_identity_oracle_database_resource_principal_details.command_name', 'update-database-tools-identity-update-database-tools-identity-oracle-database-resource-principal-details'), help=u"""Updates the specified Database Tools identity. \n[Command Reference](updateDatabaseToolsIdentity)""") @cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@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('--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('--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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.wrap_exceptions -def refresh_database_tools_identity_credential_refresh_database_tools_identity_oracle_database_resource_principal_credential_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, if_match): +def update_database_tools_identity_update_database_tools_identity_oracle_database_resource_principal_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, display_name, defined_tags, freeform_tags, if_match, is_lock_override): if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') + if not force: + if defined_tags or freeform_tags: + if not click.confirm("WARNING: Updates to defined-tags and freeform-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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override 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 defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + _details['type'] = 'ORACLE_DATABASE_RESOURCE_PRINCIPAL' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.refresh_database_tools_identity_credential( + result = client.update_database_tools_identity( database_tools_identity_id=database_tools_identity_id, - refresh_database_tools_identity_credential_details=_details, + update_database_tools_identity_details=_details, **kwargs ) if wait_for_state: @@ -2039,217 +5511,214 @@ def refresh_database_tools_identity_credential_refresh_database_tools_identity_o cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.remove_database_tools_connection_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsConnection resource. \n[Command Reference](removeDatabaseToolsConnectionLock)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") -@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") -@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") -@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.update_database_tools_mcp_server.command_name', 'update'), help=u"""Updates the specified Database Tools MCP server. \n[Command Reference](updateDatabaseToolsMcpServer)""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The [OCID] of a Database Tools MCP server.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The Database Tools MCP server type.""") +@cli_util.option('--display-name', help=u"""A meaningful, human-readable label displayed to end users. Not required to be unique and can be changed after creation. Do not include confidential information.""") +@cli_util.option('--description', help=u"""A human-readable description of the Database Tools MCP server.""") +@cli_util.option('--custom-roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Custom roles associated with the MCP Server. + +This option is a JSON list with items of type DatabaseToolsMcpServerCustomRole. For documentation on DatabaseToolsMcpServerCustomRole please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsMcpServerCustomRole.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--access-token-expiry-in-seconds', type=click.INT, help=u"""Access token expiry in seconds""") +@cli_util.option('--refresh-token-expiry-in-seconds', type=click.INT, help=u"""Refresh token expiry in seconds""") +@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('--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('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), 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 INACTIVE 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.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'custom-roles': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpServerCustomRole]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsConnection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'custom-roles': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpServerCustomRole]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.wrap_exceptions -def remove_database_tools_connection_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, type, related_resource_id, message, time_created, if_match): +def update_database_tools_mcp_server(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_server_id, type, display_name, description, custom_roles, access_token_expiry_in_seconds, refresh_token_expiry_in_seconds, defined_tags, freeform_tags, if_match, is_lock_override): - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if isinstance(mcp_server_id, six.string_types) and len(mcp_server_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-server-id cannot be whitespace or empty string') + if not force: + if custom_roles or defined_tags or freeform_tags: + if not click.confirm("WARNING: Updates to custom-roles and defined-tags and freeform-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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} _details['type'] = type - if related_resource_id is not None: - _details['relatedResourceId'] = related_resource_id + if display_name is not None: + _details['displayName'] = display_name - if message is not None: - _details['message'] = message + if description is not None: + _details['description'] = description - if time_created is not None: - _details['timeCreated'] = time_created + if custom_roles is not None: + _details['customRoles'] = cli_util.parse_json_parameter("custom_roles", custom_roles) + + if access_token_expiry_in_seconds is not None: + _details['accessTokenExpiryInSeconds'] = access_token_expiry_in_seconds + + if refresh_token_expiry_in_seconds is not None: + _details['refreshTokenExpiryInSeconds'] = refresh_token_expiry_in_seconds + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.remove_database_tools_connection_lock( - database_tools_connection_id=database_tools_connection_id, - remove_resource_lock_details=_details, + result = client.update_database_tools_mcp_server( + database_tools_mcp_server_id=mcp_server_id, + update_database_tools_mcp_server_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_database_tools_connection') and callable(getattr(client, 'get_database_tools_connection')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_database_tools_connection(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.remove_database_tools_identity_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsIdentity resource. \n[Command Reference](removeDatabaseToolsIdentityLock)""") -@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") -@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") -@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") -@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") -@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@database_tools_mcp_server_group.command(name=cli_util.override('dbtools.update_database_tools_mcp_server_update_database_tools_mcp_server_details_default.command_name', 'update-database-tools-mcp-server-update-database-tools-mcp-server-details-default'), help=u"""Updates the specified Database Tools MCP server. \n[Command Reference](updateDatabaseToolsMcpServer)""") +@cli_util.option('--mcp-server-id', required=True, help=u"""The [OCID] of a Database Tools MCP server.""") +@cli_util.option('--display-name', help=u"""A meaningful, human-readable label displayed to end users. Not required to be unique and can be changed after creation. Do not include confidential information.""") +@cli_util.option('--description', help=u"""A human-readable description of the Database Tools MCP server.""") +@cli_util.option('--custom-roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Custom roles associated with the MCP Server. + +This option is a JSON list with items of type DatabaseToolsMcpServerCustomRole. For documentation on DatabaseToolsMcpServerCustomRole please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsMcpServerCustomRole.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--access-token-expiry-in-seconds', type=click.INT, help=u"""Access token expiry in seconds""") +@cli_util.option('--refresh-token-expiry-in-seconds', type=click.INT, help=u"""Refresh token expiry in seconds""") +@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('--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('--storage', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state CREATING --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.option('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") +@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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'custom-roles': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpServerCustomRole]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'storage': {'module': 'database_tools', 'class': 'DatabaseToolsMcpServerStorage'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsIdentity'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'custom-roles': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpServerCustomRole]'}, 'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'storage': {'module': 'database_tools', 'class': 'DatabaseToolsMcpServerStorage'}}) @cli_util.wrap_exceptions -def remove_database_tools_identity_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, type, related_resource_id, message, time_created, if_match): +def update_database_tools_mcp_server_update_database_tools_mcp_server_details_default(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_server_id, display_name, description, custom_roles, access_token_expiry_in_seconds, refresh_token_expiry_in_seconds, defined_tags, freeform_tags, storage, if_match, is_lock_override): - if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') + if isinstance(mcp_server_id, six.string_types) and len(mcp_server_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-server-id cannot be whitespace or empty string') + if not force: + if custom_roles or defined_tags or freeform_tags or storage: + if not click.confirm("WARNING: Updates to custom-roles and defined-tags and freeform-tags and storage 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 + if is_lock_override is not None: + kwargs['is_lock_override'] = is_lock_override kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['type'] = type - - if related_resource_id is not None: - _details['relatedResourceId'] = related_resource_id - - if message is not None: - _details['message'] = message - - if time_created is not None: - _details['timeCreated'] = time_created - - client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.remove_database_tools_identity_lock( - database_tools_identity_id=database_tools_identity_id, - remove_resource_lock_details=_details, - **kwargs - ) - if wait_for_state: - - if hasattr(client, 'get_database_tools_identity') and callable(getattr(client, 'get_database_tools_identity')): - 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_database_tools_identity(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) + if display_name is not None: + _details['displayName'] = display_name + if description is not None: + _details['description'] = description -@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.remove_database_tools_private_endpoint_lock.command_name', 'remove'), help=u"""Removes a lock from a DatabaseToolsPrivateEndpoint resource. \n[Command Reference](removeDatabaseToolsPrivateEndpointLock)""") -@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") -@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FULL", "DELETE"]), help=u"""Type of the lock.""") -@cli_util.option('--related-resource-id', help=u"""The id of the resource that is locking this resource. Indicates that deleting this resource will remove the lock.""") -@cli_util.option('--message', help=u"""A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.""") -@cli_util.option('--time-created', type=custom_types.CLI_DATETIME, help=u"""When the lock was created.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) -@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), 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 INACTIVE 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': 'database_tools', 'class': 'DatabaseToolsPrivateEndpoint'}) -@cli_util.wrap_exceptions -def remove_database_tools_private_endpoint_lock(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, type, related_resource_id, message, time_created, if_match): + if custom_roles is not None: + _details['customRoles'] = cli_util.parse_json_parameter("custom_roles", custom_roles) - if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') + if access_token_expiry_in_seconds is not None: + _details['accessTokenExpiryInSeconds'] = access_token_expiry_in_seconds - 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']) + if refresh_token_expiry_in_seconds is not None: + _details['refreshTokenExpiryInSeconds'] = refresh_token_expiry_in_seconds - _details = {} - _details['type'] = type + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - if related_resource_id is not None: - _details['relatedResourceId'] = related_resource_id + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - if message is not None: - _details['message'] = message + if storage is not None: + _details['storage'] = cli_util.parse_json_parameter("storage", storage) - if time_created is not None: - _details['timeCreated'] = time_created + _details['type'] = 'DEFAULT' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.remove_database_tools_private_endpoint_lock( - database_tools_private_endpoint_id=database_tools_private_endpoint_id, - remove_resource_lock_details=_details, + result = client.update_database_tools_mcp_server( + database_tools_mcp_server_id=mcp_server_id, + update_database_tools_mcp_server_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_database_tools_private_endpoint') and callable(getattr(client, 'get_database_tools_private_endpoint')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_database_tools_private_endpoint(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection.command_name', 'update'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE", "MYSQL", "POSTGRESQL", "GENERIC_JDBC"]), help=u"""The Database Tools connection type.""") -@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.update_database_tools_mcp_toolset.command_name', 'update'), help=u"""Updates the specified Database Tools MCP Toolset. \n[Command Reference](updateDatabaseToolsMcpToolset)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["CUSTOM_SQL_TOOL", "BUILT_IN_SQL_TOOLS", "CUSTOMIZABLE_REPORTING_TOOLS", "GENAI_SQL_ASSISTANT"]), help=u"""The Database Tools MCP Toolset type.""") +@cli_util.option('--toolset-version', type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") @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('--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('--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.""") @@ -2263,10 +5732,10 @@ def remove_database_tools_private_endpoint_lock(ctx, from_json, wait_for_state, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) @cli_util.wrap_exceptions -def update_database_tools_connection(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, type, display_name, defined_tags, freeform_tags, if_match, is_lock_override): +def update_database_tools_mcp_toolset(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_toolset_id, type, toolset_version, display_name, description, defined_tags, freeform_tags, if_match, is_lock_override): - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-id cannot be whitespace or empty string') if not force: if defined_tags or freeform_tags: if not click.confirm("WARNING: Updates to defined-tags and freeform-tags will replace any existing values. Are you sure you want to continue?"): @@ -2282,9 +5751,15 @@ def update_database_tools_connection(ctx, from_json, force, wait_for_state, max_ _details = {} _details['type'] = type + if toolset_version is not None: + _details['version'] = toolset_version + if display_name is not None: _details['displayName'] = display_name + if description is not None: + _details['description'] = description + if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) @@ -2292,9 +5767,9 @@ def update_database_tools_connection(ctx, from_json, force, wait_for_state, max_ _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.update_database_tools_connection( - database_tools_connection_id=database_tools_connection_id, - update_database_tools_connection_details=_details, + result = client.update_database_tools_mcp_toolset( + database_tools_mcp_toolset_id=mcp_toolset_id, + update_database_tools_mcp_toolset_details=_details, **kwargs ) if wait_for_state: @@ -2327,36 +5802,40 @@ def update_database_tools_connection(ctx, from_json, force, wait_for_state, max_ cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection_update_database_tools_connection_generic_jdbc_details.command_name', 'update-database-tools-connection-update-database-tools-connection-generic-jdbc-details'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_customizable_reporting_tools_details.command_name', 'update-database-tools-mcp-toolset-update-database-tools-mcp-toolset-customizable-reporting-tools-details'), help=u"""Updates the specified Database Tools MCP Toolset. \n[Command Reference](updateDatabaseToolsMcpToolset)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@cli_util.option('--toolset-version', type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") @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('--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('--url', help=u"""The JDBC URL used to connect to the Generic JDBC database system.""") -@cli_util.option('--user-name', help=u"""The database user name.""") -@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. +@cli_util.option('--reports', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Database Tools SQL Reports -This option is a JSON list with items of type DatabaseToolsKeyStoreGenericJdbcDetails. For documentation on DatabaseToolsKeyStoreGenericJdbcDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreGenericJdbcDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +This option is a JSON list with items of type DatabaseToolsMcpToolsetCustomizableReportingToolsReport. For documentation on DatabaseToolsMcpToolsetCustomizableReportingToolsReport please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsMcpToolsetCustomizableReportingToolsReport.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--tools', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Database Tools CUSTOMIZABLE_REPORTING_TOOLS toolset tool configurations + +This option is a JSON list with items of type UpdateDatabaseToolsMcpToolsetToolDetails. For documentation on UpdateDatabaseToolsMcpToolsetToolDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/UpdateDatabaseToolsMcpToolsetToolDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--default-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The default execution type for the toolset. The default value is SYNCHRONOUS. + +To use ASYNCHRONOUS execution, the MCP Server must have the storage property configured.""") @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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreGenericJdbcDetails]'}}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'reports': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpToolsetCustomizableReportingToolsReport]'}, 'tools': {'module': 'database_tools', 'class': 'list[UpdateDatabaseToolsMcpToolsetToolDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreGenericJdbcDetails]'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'reports': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpToolsetCustomizableReportingToolsReport]'}, 'tools': {'module': 'database_tools', 'class': 'list[UpdateDatabaseToolsMcpToolsetToolDetails]'}}) @cli_util.wrap_exceptions -def update_database_tools_connection_update_database_tools_connection_generic_jdbc_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, display_name, defined_tags, freeform_tags, url, user_name, user_password, advanced_properties, key_stores, if_match, is_lock_override): +def update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_customizable_reporting_tools_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_toolset_id, toolset_version, display_name, description, defined_tags, freeform_tags, reports, tools, default_execution_type, if_match, is_lock_override): - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-id cannot be whitespace or empty string') if not force: - if defined_tags or freeform_tags or user_password or advanced_properties or key_stores: - if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and user-password and advanced-properties and key-stores will replace any existing values. Are you sure you want to continue?"): + if defined_tags or freeform_tags or reports or tools: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and reports and tools will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2368,36 +5847,36 @@ def update_database_tools_connection_update_database_tools_connection_generic_jd _details = {} + if toolset_version is not None: + _details['version'] = toolset_version + if display_name is not None: _details['displayName'] = display_name + if description is not None: + _details['description'] = description + if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - if url is not None: - _details['url'] = url - - if user_name is not None: - _details['userName'] = user_name - - if user_password is not None: - _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + if reports is not None: + _details['reports'] = cli_util.parse_json_parameter("reports", reports) - if advanced_properties is not None: - _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + if tools is not None: + _details['tools'] = cli_util.parse_json_parameter("tools", tools) - if key_stores is not None: - _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + if default_execution_type is not None: + _details['defaultExecutionType'] = default_execution_type - _details['type'] = 'GENERIC_JDBC' + _details['type'] = 'CUSTOMIZABLE_REPORTING_TOOLS' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.update_database_tools_connection( - database_tools_connection_id=database_tools_connection_id, - update_database_tools_connection_details=_details, + result = client.update_database_tools_mcp_toolset( + database_tools_mcp_toolset_id=mcp_toolset_id, + update_database_tools_mcp_toolset_details=_details, **kwargs ) if wait_for_state: @@ -2430,38 +5909,37 @@ def update_database_tools_connection_update_database_tools_connection_generic_jd cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection_update_database_tools_connection_postgresql_details.command_name', 'update-database-tools-connection-update-database-tools-connection-postgresql-details'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_built_in_sql_tools_details.command_name', 'update-database-tools-mcp-toolset-update-database-tools-mcp-toolset-built-in-sql-tools-details'), help=u"""Updates the specified Database Tools MCP Toolset. \n[Command Reference](updateDatabaseToolsMcpToolset)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@cli_util.option('--toolset-version', type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") @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('--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('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--connection-string', help=u"""The connection string used to connect to the PostgreSQL Server.""") -@cli_util.option('--user-name', help=u"""The database user name.""") -@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `sslMode`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. +@cli_util.option('--tools', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Database Tools BUILT_IN_SQL_TOOLS toolset tool configurations -This option is a JSON list with items of type DatabaseToolsKeyStorePostgresqlDetails. For documentation on DatabaseToolsKeyStorePostgresqlDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStorePostgresqlDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the Customer VCN.""") +This option is a JSON list with items of type UpdateDatabaseToolsMcpToolsetToolDetails. For documentation on UpdateDatabaseToolsMcpToolsetToolDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/UpdateDatabaseToolsMcpToolsetToolDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--default-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The default execution type for the toolset. The default value is SYNCHRONOUS. + +To use ASYNCHRONOUS execution, the MCP Server must have the storage property configured.""") @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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourcePostgresqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStorePostgresqlDetails]'}}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'tools': {'module': 'database_tools', 'class': 'list[UpdateDatabaseToolsMcpToolsetToolDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourcePostgresqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStorePostgresqlDetails]'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'tools': {'module': 'database_tools', 'class': 'list[UpdateDatabaseToolsMcpToolsetToolDetails]'}}) @cli_util.wrap_exceptions -def update_database_tools_connection_update_database_tools_connection_postgresql_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, display_name, defined_tags, freeform_tags, related_resource, connection_string, user_name, user_password, advanced_properties, key_stores, private_endpoint_id, if_match, is_lock_override): +def update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_built_in_sql_tools_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_toolset_id, toolset_version, display_name, description, defined_tags, freeform_tags, tools, default_execution_type, if_match, is_lock_override): - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-id cannot be whitespace or empty string') if not force: - if defined_tags or freeform_tags or related_resource or user_password or advanced_properties or key_stores: - if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and related-resource and user-password and advanced-properties and key-stores will replace any existing values. Are you sure you want to continue?"): + if defined_tags or freeform_tags or tools: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and tools will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2473,42 +5951,33 @@ def update_database_tools_connection_update_database_tools_connection_postgresql _details = {} + if toolset_version is not None: + _details['version'] = toolset_version + if display_name is not None: _details['displayName'] = display_name + if description is not None: + _details['description'] = description + if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - if related_resource is not None: - _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) - - if connection_string is not None: - _details['connectionString'] = connection_string - - if user_name is not None: - _details['userName'] = user_name - - if user_password is not None: - _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) - - if advanced_properties is not None: - _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) - - if key_stores is not None: - _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + if tools is not None: + _details['tools'] = cli_util.parse_json_parameter("tools", tools) - if private_endpoint_id is not None: - _details['privateEndpointId'] = private_endpoint_id + if default_execution_type is not None: + _details['defaultExecutionType'] = default_execution_type - _details['type'] = 'POSTGRESQL' + _details['type'] = 'BUILT_IN_SQL_TOOLS' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.update_database_tools_connection( - database_tools_connection_id=database_tools_connection_id, - update_database_tools_connection_details=_details, + result = client.update_database_tools_mcp_toolset( + database_tools_mcp_toolset_id=mcp_toolset_id, + update_database_tools_mcp_toolset_details=_details, **kwargs ) if wait_for_state: @@ -2541,38 +6010,41 @@ def update_database_tools_connection_update_database_tools_connection_postgresql cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection_update_database_tools_connection_my_sql_details.command_name', 'update-database-tools-connection-update-database-tools-connection-my-sql-details'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_custom_sql_tool_details.command_name', 'update-database-tools-mcp-toolset-update-database-tools-mcp-toolset-custom-sql-tool-details'), help=u"""Updates the specified Database Tools MCP Toolset. \n[Command Reference](updateDatabaseToolsMcpToolset)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@cli_util.option('--toolset-version', type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") @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('--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('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--connection-string', help=u"""The connection string used to connect to the MySQL Server.""") -@cli_util.option('--user-name', help=u"""The database user name.""") -@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `sslMode`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The CA certificate to verify the server's certificate and the client private key and associated certificate required for client authentication. +@cli_util.option('--tool-description', help=u"""Instructions describing how to use the MCP toolset and its features. This can be used to improve the LLM's understanding of the tool.""") +@cli_util.option('--tool-name', help=u"""Name of the tool returned by the MCP Server""") +@cli_util.option('--source', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The variables to use with the query -This option is a JSON list with items of type DatabaseToolsKeyStoreMySqlDetails. For documentation on DatabaseToolsKeyStoreMySqlDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreMySqlDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the Customer VCN.""") +This option is a JSON list with items of type DatabaseToolsMcpToolsetCustomSqlToolVariable. For documentation on DatabaseToolsMcpToolsetCustomSqlToolVariable please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsMcpToolsetCustomSqlToolVariable.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--allowed-roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The roles granted access to the MCP tool generated by this toolset""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--default-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The default execution type for the toolset. The default value is SYNCHRONOUS. + +To use ASYNCHRONOUS execution, the MCP Server must have the storage property configured.""") @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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourceMySqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreMySqlDetails]'}}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'source': {'module': 'database_tools', 'class': 'DatabaseToolsCustomSqlToolToolsetSource'}, 'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpToolsetCustomSqlToolVariable]'}, 'allowed-roles': {'module': 'database_tools', 'class': 'list[string]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourceMySqlDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreMySqlDetails]'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'source': {'module': 'database_tools', 'class': 'DatabaseToolsCustomSqlToolToolsetSource'}, 'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsMcpToolsetCustomSqlToolVariable]'}, 'allowed-roles': {'module': 'database_tools', 'class': 'list[string]'}}) @cli_util.wrap_exceptions -def update_database_tools_connection_update_database_tools_connection_my_sql_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, display_name, defined_tags, freeform_tags, related_resource, connection_string, user_name, user_password, advanced_properties, key_stores, private_endpoint_id, if_match, is_lock_override): +def update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_custom_sql_tool_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_toolset_id, toolset_version, display_name, description, defined_tags, freeform_tags, tool_description, tool_name, source, variables, allowed_roles, default_execution_type, if_match, is_lock_override): - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-id cannot be whitespace or empty string') if not force: - if defined_tags or freeform_tags or related_resource or user_password or advanced_properties or key_stores: - if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and related-resource and user-password and advanced-properties and key-stores will replace any existing values. Are you sure you want to continue?"): + if defined_tags or freeform_tags or source or variables or allowed_roles: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and source and variables and allowed-roles will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2584,42 +6056,45 @@ def update_database_tools_connection_update_database_tools_connection_my_sql_det _details = {} + if toolset_version is not None: + _details['version'] = toolset_version + if display_name is not None: _details['displayName'] = display_name + if description is not None: + _details['description'] = description + if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - if related_resource is not None: - _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) - - if connection_string is not None: - _details['connectionString'] = connection_string + if tool_description is not None: + _details['toolDescription'] = tool_description - if user_name is not None: - _details['userName'] = user_name + if tool_name is not None: + _details['toolName'] = tool_name - if user_password is not None: - _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) + if source is not None: + _details['source'] = cli_util.parse_json_parameter("source", source) - if advanced_properties is not None: - _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + if variables is not None: + _details['variables'] = cli_util.parse_json_parameter("variables", variables) - if key_stores is not None: - _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + if allowed_roles is not None: + _details['allowedRoles'] = cli_util.parse_json_parameter("allowed_roles", allowed_roles) - if private_endpoint_id is not None: - _details['privateEndpointId'] = private_endpoint_id + if default_execution_type is not None: + _details['defaultExecutionType'] = default_execution_type - _details['type'] = 'MYSQL' + _details['type'] = 'CUSTOM_SQL_TOOL' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.update_database_tools_connection( - database_tools_connection_id=database_tools_connection_id, - update_database_tools_connection_details=_details, + result = client.update_database_tools_mcp_toolset( + database_tools_mcp_toolset_id=mcp_toolset_id, + update_database_tools_mcp_toolset_details=_details, **kwargs ) if wait_for_state: @@ -2652,39 +6127,38 @@ def update_database_tools_connection_update_database_tools_connection_my_sql_det cli_util.render_response(result, ctx) -@database_tools_connection_group.command(name=cli_util.override('dbtools.update_database_tools_connection_update_database_tools_connection_oracle_database_details.command_name', 'update-database-tools-connection-update-database-tools-connection-oracle-database-details'), help=u"""Updates the specified Database Tools connection. \n[Command Reference](updateDatabaseToolsConnection)""") -@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") -@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@database_tools_mcp_toolset_group.command(name=cli_util.override('dbtools.update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_gen_ai_sql_assistant_details.command_name', 'update-database-tools-mcp-toolset-update-database-tools-mcp-toolset-gen-ai-sql-assistant-details'), help=u"""Updates the specified Database Tools MCP Toolset. \n[Command Reference](updateDatabaseToolsMcpToolset)""") +@cli_util.option('--mcp-toolset-id', required=True, help=u"""The [OCID] of a Database Tools MCP Toolset.""") +@cli_util.option('--toolset-version', type=click.INT, help=u"""The MCP toolset version""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A human readable description of the Database Tools MCP toolset.""") @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('--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('--related-resource', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--connection-string', help=u"""The connect descriptor or Easy Connect Naming method used to connect to the database.""") -@cli_util.option('--user-name', help=u"""The database user name.""") -@cli_util.option('--user-password', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The advanced connection properties key-value pair (e.g., `oracle.net.ssl_server_dn_match`).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--key-stores', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Oracle wallet or Java Keystores containing trusted certificates for authenticating the server's public certificate and the client private key and associated certificates required for client authentication. +@cli_util.option('--generative-ai-semantic-store-id', help=u"""The [OCID] of the related Generative AI Semantic Store.""") +@cli_util.option('--tools', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Database Tools GENAI_SQL_ASSISTANT toolset tool configurations -This option is a JSON list with items of type DatabaseToolsKeyStoreDetails. For documentation on DatabaseToolsKeyStoreDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsKeyStoreDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-endpoint-id', help=u"""The [OCID] of the Database Tools private endpoint used to access the database in the Customer VCN.""") -@cli_util.option('--proxy-client', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +This option is a JSON list with items of type UpdateDatabaseToolsMcpToolsetToolDetails. For documentation on UpdateDatabaseToolsMcpToolsetToolDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/UpdateDatabaseToolsMcpToolsetToolDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--default-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The default execution type for the toolset. The default value is SYNCHRONOUS. + +To use ASYNCHRONOUS execution, the MCP Server must have the storage property configured.""") @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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourceDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClientDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'tools': {'module': 'database_tools', 'class': 'list[UpdateDatabaseToolsMcpToolsetToolDetails]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'related-resource': {'module': 'database_tools', 'class': 'UpdateDatabaseToolsRelatedResourceDetails'}, 'user-password': {'module': 'database_tools', 'class': 'DatabaseToolsUserPasswordDetails'}, 'advanced-properties': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'key-stores': {'module': 'database_tools', 'class': 'list[DatabaseToolsKeyStoreDetails]'}, 'proxy-client': {'module': 'database_tools', 'class': 'DatabaseToolsConnectionOracleDatabaseProxyClientDetails'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'tools': {'module': 'database_tools', 'class': 'list[UpdateDatabaseToolsMcpToolsetToolDetails]'}}) @cli_util.wrap_exceptions -def update_database_tools_connection_update_database_tools_connection_oracle_database_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_connection_id, display_name, defined_tags, freeform_tags, related_resource, connection_string, user_name, user_password, advanced_properties, key_stores, private_endpoint_id, proxy_client, if_match, is_lock_override): +def update_database_tools_mcp_toolset_update_database_tools_mcp_toolset_gen_ai_sql_assistant_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, mcp_toolset_id, toolset_version, display_name, description, defined_tags, freeform_tags, generative_ai_semantic_store_id, tools, default_execution_type, if_match, is_lock_override): - if isinstance(database_tools_connection_id, six.string_types) and len(database_tools_connection_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-connection-id cannot be whitespace or empty string') + if isinstance(mcp_toolset_id, six.string_types) and len(mcp_toolset_id.strip()) == 0: + raise click.UsageError('Parameter --mcp-toolset-id cannot be whitespace or empty string') if not force: - if defined_tags or freeform_tags or related_resource or user_password or advanced_properties or key_stores or proxy_client: - if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and related-resource and user-password and advanced-properties and key-stores and proxy-client will replace any existing values. Are you sure you want to continue?"): + if defined_tags or freeform_tags or tools: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and tools will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2696,45 +6170,36 @@ def update_database_tools_connection_update_database_tools_connection_oracle_dat _details = {} + if toolset_version is not None: + _details['version'] = toolset_version + if display_name is not None: _details['displayName'] = display_name + if description is not None: + _details['description'] = description + if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - if related_resource is not None: - _details['relatedResource'] = cli_util.parse_json_parameter("related_resource", related_resource) - - if connection_string is not None: - _details['connectionString'] = connection_string - - if user_name is not None: - _details['userName'] = user_name - - if user_password is not None: - _details['userPassword'] = cli_util.parse_json_parameter("user_password", user_password) - - if advanced_properties is not None: - _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) - - if key_stores is not None: - _details['keyStores'] = cli_util.parse_json_parameter("key_stores", key_stores) + if generative_ai_semantic_store_id is not None: + _details['generativeAiSemanticStoreId'] = generative_ai_semantic_store_id - if private_endpoint_id is not None: - _details['privateEndpointId'] = private_endpoint_id + if tools is not None: + _details['tools'] = cli_util.parse_json_parameter("tools", tools) - if proxy_client is not None: - _details['proxyClient'] = cli_util.parse_json_parameter("proxy_client", proxy_client) + if default_execution_type is not None: + _details['defaultExecutionType'] = default_execution_type - _details['type'] = 'ORACLE_DATABASE' + _details['type'] = 'GENAI_SQL_ASSISTANT' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.update_database_tools_connection( - database_tools_connection_id=database_tools_connection_id, - update_database_tools_connection_details=_details, + result = client.update_database_tools_mcp_toolset( + database_tools_mcp_toolset_id=mcp_toolset_id, + update_database_tools_mcp_toolset_details=_details, **kwargs ) if wait_for_state: @@ -2767,30 +6232,31 @@ def update_database_tools_connection_update_database_tools_connection_oracle_dat cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.update_database_tools_identity.command_name', 'update'), help=u"""Updates the specified Database Tools identity. \n[Command Reference](updateDatabaseToolsIdentity)""") -@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") -@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE_RESOURCE_PRINCIPAL"]), help=u"""The Database Tools identity type.""") -@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.update_database_tools_private_endpoint.command_name', 'update'), help=u"""Updates the specified Database Tools private endpoint. \n[Command Reference](updateDatabaseToolsPrivateEndpoint)""") +@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") @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('--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('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A description of the Database Tools private endpoint.""") +@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The [OCID] of the network security groups that the private endpoint's VNIC belongs to. For more information about NSGs, see [NetworkSecurityGroup].""" + 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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'nsg-ids': {'module': 'database_tools', 'class': 'list[string]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'nsg-ids': {'module': 'database_tools', 'class': 'list[string]'}}) @cli_util.wrap_exceptions -def update_database_tools_identity(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, type, display_name, defined_tags, freeform_tags, if_match, is_lock_override): +def update_database_tools_private_endpoint(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, defined_tags, freeform_tags, display_name, description, nsg_ids, if_match, is_lock_override): - if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') + if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: + raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') if not force: - if defined_tags or freeform_tags: - if not click.confirm("WARNING: Updates to defined-tags and freeform-tags will replace any existing values. Are you sure you want to continue?"): + if defined_tags or freeform_tags or nsg_ids: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and nsg-ids will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2801,10 +6267,6 @@ def update_database_tools_identity(ctx, from_json, force, wait_for_state, max_wa kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['type'] = type - - if display_name is not None: - _details['displayName'] = display_name if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) @@ -2812,10 +6274,19 @@ def update_database_tools_identity(ctx, from_json, force, wait_for_state, max_wa if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if nsg_ids is not None: + _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) + client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.update_database_tools_identity( - database_tools_identity_id=database_tools_identity_id, - update_database_tools_identity_details=_details, + result = client.update_database_tools_private_endpoint( + database_tools_private_endpoint_id=database_tools_private_endpoint_id, + update_database_tools_private_endpoint_details=_details, **kwargs ) if wait_for_state: @@ -2848,29 +6319,40 @@ def update_database_tools_identity(ctx, from_json, force, wait_for_state, max_wa cli_util.render_response(result, ctx) -@database_tools_identity_group.command(name=cli_util.override('dbtools.update_database_tools_identity_update_database_tools_identity_oracle_database_resource_principal_details.command_name', 'update-database-tools-identity-update-database-tools-identity-oracle-database-resource-principal-details'), help=u"""Updates the specified Database Tools identity. \n[Command Reference](updateDatabaseToolsIdentity)""") -@cli_util.option('--database-tools-identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") -@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.update_database_tools_sql_report.command_name', 'update'), help=u"""Updates the specified Database Tools SQL Report. \n[Command Reference](updateDatabaseToolsSqlReport)""") +@cli_util.option('--sql-report-id', required=True, help=u"""The [OCID] of a Database Tools SQL Report.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE"]), help=u"""The Database Tools SQL report type.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") @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('--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('--source', help=u"""SQL query executed to generate the report.""") +@cli_util.option('--description', help=u"""A description of the SQL report.""") +@cli_util.option('--purpose', help=u"""Purpose of the Database Tools SQL report. Scenario or conditions describing when or why this report should be used. Provides selection criteria to AI agents to improve report selection accuracy.""") +@cli_util.option('--instructions', help=u"""Instructions on how to use the SQL report. Step-by-step guidance for an AI agent on how to execute or fill in parameters for the report.""") +@cli_util.option('--variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Variables referenced in the Database Tools SQL Report source. + +This option is a JSON list with items of type DatabaseToolsSqlReportVariable. For documentation on DatabaseToolsSqlReportVariable please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsSqlReportVariable.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--columns', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Descriptive information on columns referenced in the Database Tools SQL Report source. + +This option is a JSON list with items of type DatabaseToolsSqlReportColumn. For documentation on DatabaseToolsSqlReportColumn please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsSqlReportColumn.""" + 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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportVariable]'}, 'columns': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportColumn]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportVariable]'}, 'columns': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportColumn]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsSqlReport'}) @cli_util.wrap_exceptions -def update_database_tools_identity_update_database_tools_identity_oracle_database_resource_principal_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_identity_id, display_name, defined_tags, freeform_tags, if_match, is_lock_override): +def update_database_tools_sql_report(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, sql_report_id, type, display_name, defined_tags, freeform_tags, source, description, purpose, instructions, variables, columns, if_match, is_lock_override): - if isinstance(database_tools_identity_id, six.string_types) and len(database_tools_identity_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-identity-id cannot be whitespace or empty string') + if isinstance(sql_report_id, six.string_types) and len(sql_report_id.strip()) == 0: + raise click.UsageError('Parameter --sql-report-id cannot be whitespace or empty string') if not force: - if defined_tags or freeform_tags: - if not click.confirm("WARNING: Updates to defined-tags and freeform-tags will replace any existing values. Are you sure you want to continue?"): + if defined_tags or freeform_tags or variables or columns: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and variables and columns will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2881,6 +6363,7 @@ def update_database_tools_identity_update_database_tools_identity_oracle_databas kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} + _details['type'] = type if display_name is not None: _details['displayName'] = display_name @@ -2891,69 +6374,89 @@ def update_database_tools_identity_update_database_tools_identity_oracle_databas if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - _details['type'] = 'ORACLE_DATABASE_RESOURCE_PRINCIPAL' + if source is not None: + _details['source'] = source + + if description is not None: + _details['description'] = description + + if purpose is not None: + _details['purpose'] = purpose + + if instructions is not None: + _details['instructions'] = instructions + + if variables is not None: + _details['variables'] = cli_util.parse_json_parameter("variables", variables) + + if columns is not None: + _details['columns'] = cli_util.parse_json_parameter("columns", columns) client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.update_database_tools_identity( - database_tools_identity_id=database_tools_identity_id, - update_database_tools_identity_details=_details, + result = client.update_database_tools_sql_report( + database_tools_sql_report_id=sql_report_id, + update_database_tools_sql_report_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_database_tools_sql_report') and callable(getattr(client, 'get_database_tools_sql_report')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_database_tools_sql_report(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@database_tools_private_endpoint_group.command(name=cli_util.override('dbtools.update_database_tools_private_endpoint.command_name', 'update'), help=u"""Updates the specified Database Tools private endpoint. \n[Command Reference](updateDatabaseToolsPrivateEndpoint)""") -@cli_util.option('--database-tools-private-endpoint-id', required=True, help=u"""The [OCID] of a Database Tools private endpoint.""") +@database_tools_sql_report_group.command(name=cli_util.override('dbtools.update_database_tools_sql_report_update_database_tools_sql_report_details_oracle_database.command_name', 'update-database-tools-sql-report-update-database-tools-sql-report-details-oracle-database'), help=u"""Updates the specified Database Tools SQL Report. \n[Command Reference](updateDatabaseToolsSqlReport)""") +@cli_util.option('--sql-report-id', required=True, help=u"""The [OCID] of a Database Tools SQL Report.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique and can be updated. Avoid entering confidential information.""") @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('--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('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--description', help=u"""A description of the Database Tools private endpoint.""") -@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The [OCID] of the network security groups that the private endpoint's VNIC belongs to. For more information about NSGs, see [NetworkSecurityGroup].""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source', help=u"""SQL query executed to generate the report.""") +@cli_util.option('--description', help=u"""A description of the SQL report.""") +@cli_util.option('--purpose', help=u"""Purpose of the Database Tools SQL report. Scenario or conditions describing when or why this report should be used. Provides selection criteria to AI agents to improve report selection accuracy.""") +@cli_util.option('--instructions', help=u"""Instructions on how to use the SQL report. Step-by-step guidance for an AI agent on how to execute or fill in parameters for the report.""") +@cli_util.option('--variables', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Variables referenced in the Database Tools SQL Report source. + +This option is a JSON list with items of type DatabaseToolsSqlReportVariable. For documentation on DatabaseToolsSqlReportVariable please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsSqlReportVariable.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--columns', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Descriptive information on columns referenced in the Database Tools SQL Report source. + +This option is a JSON list with items of type DatabaseToolsSqlReportColumn. For documentation on DatabaseToolsSqlReportColumn please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetools/20201005/datatypes/DatabaseToolsSqlReportColumn.""" + 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('--is-lock-override', type=click.BOOL, help=u"""Whether to override locks (if any exist).""") @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", "WAITING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state NEEDS_ATTENTION would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'nsg-ids': {'module': 'database_tools', 'class': 'list[string]'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportVariable]'}, 'columns': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportColumn]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'nsg-ids': {'module': 'database_tools', 'class': 'list[string]'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'database_tools', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'database_tools', 'class': 'dict(str, string)'}, 'variables': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportVariable]'}, 'columns': {'module': 'database_tools', 'class': 'list[DatabaseToolsSqlReportColumn]'}}, output_type={'module': 'database_tools', 'class': 'DatabaseToolsSqlReport'}) @cli_util.wrap_exceptions -def update_database_tools_private_endpoint(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, database_tools_private_endpoint_id, defined_tags, freeform_tags, display_name, description, nsg_ids, if_match, is_lock_override): +def update_database_tools_sql_report_update_database_tools_sql_report_details_oracle_database(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, sql_report_id, display_name, defined_tags, freeform_tags, source, description, purpose, instructions, variables, columns, if_match, is_lock_override): - if isinstance(database_tools_private_endpoint_id, six.string_types) and len(database_tools_private_endpoint_id.strip()) == 0: - raise click.UsageError('Parameter --database-tools-private-endpoint-id cannot be whitespace or empty string') + if isinstance(sql_report_id, six.string_types) and len(sql_report_id.strip()) == 0: + raise click.UsageError('Parameter --sql-report-id cannot be whitespace or empty string') if not force: - if defined_tags or freeform_tags or nsg_ids: - if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and nsg-ids will replace any existing values. Are you sure you want to continue?"): + if defined_tags or freeform_tags or variables or columns: + if not click.confirm("WARNING: Updates to defined-tags and freeform-tags and variables and columns will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2965,54 +6468,64 @@ def update_database_tools_private_endpoint(ctx, from_json, force, wait_for_state _details = {} + if display_name is not None: + _details['displayName'] = display_name + if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) - if display_name is not None: - _details['displayName'] = display_name + if source is not None: + _details['source'] = source if description is not None: _details['description'] = description - if nsg_ids is not None: - _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) + if purpose is not None: + _details['purpose'] = purpose + + if instructions is not None: + _details['instructions'] = instructions + + if variables is not None: + _details['variables'] = cli_util.parse_json_parameter("variables", variables) + + if columns is not None: + _details['columns'] = cli_util.parse_json_parameter("columns", columns) + + _details['type'] = 'ORACLE_DATABASE' client = cli_util.build_client('database_tools', 'database_tools', ctx) - result = client.update_database_tools_private_endpoint( - database_tools_private_endpoint_id=database_tools_private_endpoint_id, - update_database_tools_private_endpoint_details=_details, + result = client.update_database_tools_sql_report( + database_tools_sql_report_id=sql_report_id, + update_database_tools_sql_report_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_database_tools_sql_report') and callable(getattr(client, 'get_database_tools_sql_report')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds - if 'opc-work-request-id' not in result.headers: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') - cli_util.render_response(result, ctx) - return - click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) - result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_database_tools_sql_report(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) diff --git a/services/database_tools/tests/util/generated/command_to_api.py b/services/database_tools/tests/util/generated/command_to_api.py index 667997b4b..30baed0f3 100644 --- a/services/database_tools/tests/util/generated/command_to_api.py +++ b/services/database_tools/tests/util/generated/command_to_api.py @@ -3,36 +3,70 @@ SDK_client_map = { "dbtools.add_database_tools_connection_lock": "oci.database_tools.DatabaseToolsClient.add_database_tools_connection_lock", + "dbtools.add_database_tools_database_api_gateway_config_lock": "oci.database_tools.DatabaseToolsClient.add_database_tools_database_api_gateway_config_lock", "dbtools.add_database_tools_identity_lock": "oci.database_tools.DatabaseToolsClient.add_database_tools_identity_lock", + "dbtools.add_database_tools_mcp_server_lock": "oci.database_tools.DatabaseToolsClient.add_database_tools_mcp_server_lock", + "dbtools.add_database_tools_mcp_toolset_lock": "oci.database_tools.DatabaseToolsClient.add_database_tools_mcp_toolset_lock", "dbtools.add_database_tools_private_endpoint_lock": "oci.database_tools.DatabaseToolsClient.add_database_tools_private_endpoint_lock", + "dbtools.add_database_tools_sql_report_lock": "oci.database_tools.DatabaseToolsClient.add_database_tools_sql_report_lock", + "dbtools.cascading_delete_database_tools_mcp_server": "oci.database_tools.DatabaseToolsClient.cascading_delete_database_tools_mcp_server", "dbtools.change_database_tools_connection_compartment": "oci.database_tools.DatabaseToolsClient.change_database_tools_connection_compartment", + "dbtools.change_database_tools_database_api_gateway_config_compartment": "oci.database_tools.DatabaseToolsClient.change_database_tools_database_api_gateway_config_compartment", "dbtools.change_database_tools_identity_compartment": "oci.database_tools.DatabaseToolsClient.change_database_tools_identity_compartment", + "dbtools.change_database_tools_mcp_server_compartment": "oci.database_tools.DatabaseToolsClient.change_database_tools_mcp_server_compartment", + "dbtools.change_database_tools_mcp_toolset_compartment": "oci.database_tools.DatabaseToolsClient.change_database_tools_mcp_toolset_compartment", "dbtools.change_database_tools_private_endpoint_compartment": "oci.database_tools.DatabaseToolsClient.change_database_tools_private_endpoint_compartment", + "dbtools.change_database_tools_sql_report_compartment": "oci.database_tools.DatabaseToolsClient.change_database_tools_sql_report_compartment", "dbtools.create_database_tools_connection": "oci.database_tools.DatabaseToolsClient.create_database_tools_connection", + "dbtools.create_database_tools_database_api_gateway_config": "oci.database_tools.DatabaseToolsClient.create_database_tools_database_api_gateway_config", "dbtools.create_database_tools_identity": "oci.database_tools.DatabaseToolsClient.create_database_tools_identity", + "dbtools.create_database_tools_mcp_server": "oci.database_tools.DatabaseToolsClient.create_database_tools_mcp_server", + "dbtools.create_database_tools_mcp_toolset": "oci.database_tools.DatabaseToolsClient.create_database_tools_mcp_toolset", "dbtools.create_database_tools_private_endpoint": "oci.database_tools.DatabaseToolsClient.create_database_tools_private_endpoint", + "dbtools.create_database_tools_sql_report": "oci.database_tools.DatabaseToolsClient.create_database_tools_sql_report", "dbtools.delete_database_tools_connection": "oci.database_tools.DatabaseToolsClient.delete_database_tools_connection", + "dbtools.delete_database_tools_database_api_gateway_config": "oci.database_tools.DatabaseToolsClient.delete_database_tools_database_api_gateway_config", "dbtools.delete_database_tools_identity": "oci.database_tools.DatabaseToolsClient.delete_database_tools_identity", + "dbtools.delete_database_tools_mcp_server": "oci.database_tools.DatabaseToolsClient.delete_database_tools_mcp_server", + "dbtools.delete_database_tools_mcp_toolset": "oci.database_tools.DatabaseToolsClient.delete_database_tools_mcp_toolset", "dbtools.delete_database_tools_private_endpoint": "oci.database_tools.DatabaseToolsClient.delete_database_tools_private_endpoint", + "dbtools.delete_database_tools_sql_report": "oci.database_tools.DatabaseToolsClient.delete_database_tools_sql_report", "dbtools.get_database_tools_connection": "oci.database_tools.DatabaseToolsClient.get_database_tools_connection", + "dbtools.get_database_tools_database_api_gateway_config": "oci.database_tools.DatabaseToolsClient.get_database_tools_database_api_gateway_config", "dbtools.get_database_tools_endpoint_service": "oci.database_tools.DatabaseToolsClient.get_database_tools_endpoint_service", "dbtools.get_database_tools_identity": "oci.database_tools.DatabaseToolsClient.get_database_tools_identity", + "dbtools.get_database_tools_mcp_server": "oci.database_tools.DatabaseToolsClient.get_database_tools_mcp_server", + "dbtools.get_database_tools_mcp_toolset": "oci.database_tools.DatabaseToolsClient.get_database_tools_mcp_toolset", "dbtools.get_database_tools_private_endpoint": "oci.database_tools.DatabaseToolsClient.get_database_tools_private_endpoint", + "dbtools.get_database_tools_sql_report": "oci.database_tools.DatabaseToolsClient.get_database_tools_sql_report", "dbtools.get_work_request": "oci.database_tools.DatabaseToolsClient.get_work_request", "dbtools.list_database_tools_connections": "oci.database_tools.DatabaseToolsClient.list_database_tools_connections", + "dbtools.list_database_tools_database_api_gateway_configs": "oci.database_tools.DatabaseToolsClient.list_database_tools_database_api_gateway_configs", "dbtools.list_database_tools_endpoint_services": "oci.database_tools.DatabaseToolsClient.list_database_tools_endpoint_services", "dbtools.list_database_tools_identities": "oci.database_tools.DatabaseToolsClient.list_database_tools_identities", + "dbtools.list_database_tools_mcp_servers": "oci.database_tools.DatabaseToolsClient.list_database_tools_mcp_servers", + "dbtools.list_database_tools_mcp_toolset_versions": "oci.database_tools.DatabaseToolsClient.list_database_tools_mcp_toolset_versions", + "dbtools.list_database_tools_mcp_toolsets": "oci.database_tools.DatabaseToolsClient.list_database_tools_mcp_toolsets", "dbtools.list_database_tools_private_endpoints": "oci.database_tools.DatabaseToolsClient.list_database_tools_private_endpoints", + "dbtools.list_database_tools_sql_reports": "oci.database_tools.DatabaseToolsClient.list_database_tools_sql_reports", "dbtools.list_work_request_errors": "oci.database_tools.DatabaseToolsClient.list_work_request_errors", "dbtools.list_work_request_logs": "oci.database_tools.DatabaseToolsClient.list_work_request_logs", "dbtools.list_work_requests": "oci.database_tools.DatabaseToolsClient.list_work_requests", "dbtools.refresh_database_tools_identity_credential": "oci.database_tools.DatabaseToolsClient.refresh_database_tools_identity_credential", "dbtools.remove_database_tools_connection_lock": "oci.database_tools.DatabaseToolsClient.remove_database_tools_connection_lock", + "dbtools.remove_database_tools_database_api_gateway_config_lock": "oci.database_tools.DatabaseToolsClient.remove_database_tools_database_api_gateway_config_lock", "dbtools.remove_database_tools_identity_lock": "oci.database_tools.DatabaseToolsClient.remove_database_tools_identity_lock", + "dbtools.remove_database_tools_mcp_server_lock": "oci.database_tools.DatabaseToolsClient.remove_database_tools_mcp_server_lock", + "dbtools.remove_database_tools_mcp_toolset_lock": "oci.database_tools.DatabaseToolsClient.remove_database_tools_mcp_toolset_lock", "dbtools.remove_database_tools_private_endpoint_lock": "oci.database_tools.DatabaseToolsClient.remove_database_tools_private_endpoint_lock", + "dbtools.remove_database_tools_sql_report_lock": "oci.database_tools.DatabaseToolsClient.remove_database_tools_sql_report_lock", "dbtools.update_database_tools_connection": "oci.database_tools.DatabaseToolsClient.update_database_tools_connection", + "dbtools.update_database_tools_database_api_gateway_config": "oci.database_tools.DatabaseToolsClient.update_database_tools_database_api_gateway_config", "dbtools.update_database_tools_identity": "oci.database_tools.DatabaseToolsClient.update_database_tools_identity", + "dbtools.update_database_tools_mcp_server": "oci.database_tools.DatabaseToolsClient.update_database_tools_mcp_server", + "dbtools.update_database_tools_mcp_toolset": "oci.database_tools.DatabaseToolsClient.update_database_tools_mcp_toolset", "dbtools.update_database_tools_private_endpoint": "oci.database_tools.DatabaseToolsClient.update_database_tools_private_endpoint", + "dbtools.update_database_tools_sql_report": "oci.database_tools.DatabaseToolsClient.update_database_tools_sql_report", "dbtools.validate_database_tools_connection": "oci.database_tools.DatabaseToolsClient.validate_database_tools_connection", "dbtools.validate_database_tools_identity_credential": "oci.database_tools.DatabaseToolsClient.validate_database_tools_identity_credential", } diff --git a/services/database_tools_runtime/__init__.py b/services/database_tools_runtime/__init__.py new file mode 100644 index 000000000..5c3d90774 --- /dev/null +++ b/services/database_tools_runtime/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20230222 diff --git a/services/database_tools_runtime/src/__init__.py b/services/database_tools_runtime/src/__init__.py new file mode 100644 index 000000000..5c3d90774 --- /dev/null +++ b/services/database_tools_runtime/src/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20230222 diff --git a/services/database_tools_runtime/src/oci_cli_database_tools_runtime/__init__.py b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/__init__.py new file mode 100644 index 000000000..5c3d90774 --- /dev/null +++ b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20230222 diff --git a/services/database_tools_runtime/src/oci_cli_database_tools_runtime/databasetoolsruntime_cli_extended.py b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/databasetoolsruntime_cli_extended.py new file mode 100644 index 000000000..34a44a173 --- /dev/null +++ b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/databasetoolsruntime_cli_extended.py @@ -0,0 +1,687 @@ +# 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 +import oci +import sys +from services.database_tools_runtime.src.oci_cli_database_tools_runtime.generated import databasetoolsruntime_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 + + +def _wait_on_work_request_if_needed(ctx, client, result, wait_for_state, max_wait_seconds, wait_interval_seconds): + if not wait_for_state: + return result + + 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 result + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + return 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: + 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) + return result + + +def _render_async_execute_sql_response(ctx, client, result, wait_for_state, max_wait_seconds, wait_interval_seconds): + result = _wait_on_work_request_if_needed(ctx, client, result, wait_for_state, max_wait_seconds, wait_interval_seconds) + cli_util.render_response(result, ctx) + + +def _execute_sql_database_tools_connection_without_response_model(ctx, client, connection_id, details, kwargs_for_call): + operation_name = 'execute_sql_database_tools_connection' + path = '/databaseToolsConnections/{databaseToolsConnectionId}/actions/executeSql'.format(databaseToolsConnectionId=connection_id) + + return client.base_client.call_api( + resource_path=path, + method='POST', + header_params={ + 'accept': 'application/json', + 'content-type': 'application/json', + 'opc-request-id': kwargs_for_call.get('opc_request_id'), + 'if-match': kwargs_for_call.get('if_match') + }, + body=details, + response_type='object', + allow_control_chars=False, + operation_name=operation_name, + required_arguments=['databaseToolsConnectionId'], + enforce_content_headers=True + ) + +# oci dbtools-runtime user credential + + +@click.command('user', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='User resources.') +@cli_util.help_option_group +def user_group(): + pass + + +@click.command('credential', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='User credential resources.') +@cli_util.help_option_group +def user_credential_nested_group(): + pass + + +user_group.add_command(user_credential_nested_group) +databasetoolsruntime_cli.dbtools_runtime_root_group.add_command(user_group) + + +# oci dbtools-runtime connection execute-sql +@click.command('execute-sql', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Execute SQL using a connection.') +@cli_util.help_option_group +def connection_execute_sql_group(): + pass + + +# oci dbtools-runtime connection validate + +# oci database-tools-runtime user-credential-collection list-user-credentials -> oci database-tools-runtime user-credential-collection list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.user_credential_collection_group, databasetoolsruntime_cli.list_user_credentials, "list") + + +# oci database-tools-runtime credential-collection list-credentials -> oci database-tools-runtime credential-collection list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.credential_collection_group, databasetoolsruntime_cli.list_credentials, "list") + + +# oci database-tools-runtime credential-execute-grantee-collection list-credential-execute-grantees -> oci database-tools-runtime credential-execute-grantee-collection list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.credential_execute_grantee_collection_group, databasetoolsruntime_cli.list_credential_execute_grantees, "list") + + +# oci database-tools-runtime credential-public-synonym-collection list-credential-public-synonyms -> oci database-tools-runtime credential-public-synonym-collection list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.credential_public_synonym_collection_group, databasetoolsruntime_cli.list_credential_public_synonyms, "list") + + +# oci dbtools-runtime work-request-log-entry list-work-request-logs -> oci dbtools-runtime work-request-log-entry list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.work_request_log_entry_group, databasetoolsruntime_cli.list_work_request_logs, "list") + + +# oci dbtools-runtime credential-execute-grantee -> oci dbtools-runtime execute-grantee +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.credential_execute_grantee_group, "execute-grantee") + +# Add execute-grantee list under oci dbtools-runtime execute-grantee +databasetoolsruntime_cli.credential_execute_grantee_group.add_command(databasetoolsruntime_cli.list_credential_execute_grantees) + +# oci dbtools-runtime execute-grantee list-credential-execute-grantees -> oci dbtools-runtime execute-grantee list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.credential_execute_grantee_group, databasetoolsruntime_cli.list_credential_execute_grantees, "list") + + +# oci dbtools-runtime credential-public-synonym -> oci dbtools-runtime public-synonym +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.credential_public_synonym_group, "public-synonym") + +# Add public-synonym list under oci dbtools-runtime public-synonym +databasetoolsruntime_cli.credential_public_synonym_group.add_command(databasetoolsruntime_cli.list_credential_public_synonyms) + +# oci dbtools-runtime public-synonym list-credential-public-synonyms -> oci dbtools-runtime public-synonym list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.credential_public_synonym_group, databasetoolsruntime_cli.list_credential_public_synonyms, "list") + + +# oci dbtools-runtime database-tools-connection -> oci dbtools-runtime connection +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.database_tools_connection_group, "connection") +databasetoolsruntime_cli.database_tools_connection_group.help = 'Database Tools connection resources.' + + +# oci dbtools-runtime database-tools-database-api-gateway-config -> oci dbtools-runtime database-api-gateway-config +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.database_tools_database_api_gateway_config_group, "database-api-gateway-config") +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.help = 'Database API Gateway configuration resources.' + +# Remove pool list/delete commands from oci dbtools-runtime database-api-gateway-config root; they are exposed via dedicated groups +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetoolsruntime_cli.list_database_tools_database_api_gateway_config_pools.name, None) +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetoolsruntime_cli.list_database_tools_database_api_gateway_config_pool_api_specs.name, None) +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetoolsruntime_cli.list_database_tools_database_api_gateway_config_pool_auto_api_specs.name, None) +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetoolsruntime_cli.delete_database_tools_database_api_gateway_config_pool.name, None) +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetoolsruntime_cli.delete_database_tools_database_api_gateway_config_pool_api_spec.name, None) +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetoolsruntime_cli.delete_database_tools_database_api_gateway_config_pool_auto_api_spec.name, None) + + +# oci dbtools-runtime database-tools-database-api-gateway-config-global -> oci dbtools-runtime database-api-gateway-config-global +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.database_tools_database_api_gateway_config_global_group, "database-api-gateway-config-global") + + +# oci dbtools-runtime database-tools-database-api-gateway-config-pool -> oci dbtools-runtime database-api-gateway-config-pool +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group, "database-api-gateway-config-pool") + + +# oci dbtools-runtime database-tools-database-api-gateway-config-pool-api-spec -> oci dbtools-runtime database-api-gateway-config-pool-api-spec +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group, "database-api-gateway-config-pool-api-spec") + + +# oci dbtools-runtime database-tools-database-api-gateway-config-pool-auto-api-spec -> oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group, "database-api-gateway-config-pool-auto-api-spec") + + +# oci dbtools-runtime database-tools-database-api-gateway-config-advanced-property-summary -> oci dbtools-runtime database-api-gateway-config-advanced-properties +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.database_tools_database_api_gateway_config_advanced_property_summary_group, "database-api-gateway-config-advanced-properties") + + +# oci dbtools-runtime database-tools-identity -> oci dbtools-runtime identity +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.database_tools_identity_group, "identity") + + +# oci dbtools-runtime user-credential-collection -> oci dbtools-runtime user-credential +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.dbtools_runtime_root_group, databasetoolsruntime_cli.user_credential_collection_group, "user-credential") + + +# Remove credential-collection from oci dbtools-runtime +databasetoolsruntime_cli.dbtools_runtime_root_group.commands.pop(databasetoolsruntime_cli.credential_collection_group.name, None) + + +# Remove list-credentials from oci dbtools-runtime credential before re-adding it as list +databasetoolsruntime_cli.credential_group.commands.pop(databasetoolsruntime_cli.list_credentials.name, None) +databasetoolsruntime_cli.credential_group.commands.pop('list', None) + + +# Move user credential commands under oci dbtools-runtime user credential +databasetoolsruntime_cli.dbtools_runtime_root_group.commands.pop(databasetoolsruntime_cli.user_credential_group.name, None) +databasetoolsruntime_cli.dbtools_runtime_root_group.commands.pop("user-credential", None) + +user_credential_nested_group.add_command(databasetoolsruntime_cli.get_user_credential) +user_credential_nested_group.add_command(databasetoolsruntime_cli.list_user_credentials) + +# oci dbtools-runtime user credential get -> oci dbtools-runtime user credential get +cli_util.rename_command(databasetoolsruntime_cli, user_credential_nested_group, databasetoolsruntime_cli.get_user_credential, "get") + +# oci dbtools-runtime user credential list-user-credentials -> oci dbtools-runtime user credential list +cli_util.rename_command(databasetoolsruntime_cli, user_credential_nested_group, databasetoolsruntime_cli.list_user_credentials, "list") + + +# Add credential list under oci dbtools-runtime credential +databasetoolsruntime_cli.credential_group.add_command(databasetoolsruntime_cli.list_credential_execute_grantees) +databasetoolsruntime_cli.credential_group.add_command(databasetoolsruntime_cli.list_credential_public_synonyms) + + +# oci dbtools-runtime credential list +@click.command('list', help=databasetoolsruntime_cli.list_credentials.help) +@cli_util.option('--connection-id', required=True, help='''The [OCID] of a Database Tools connection.''') +@cli_util.option('--if-match', help='''For optimistic concurrency control.''') +@cli_util.option('--limit', type=click.INT, help='''The maximum number of items to return.''') +@cli_util.option('--page', help='''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='''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': 'database_tools_runtime', 'class': 'CredentialCollection'}) +@cli_util.wrap_exceptions +def credential_list_extended(ctx, from_json, all_pages, page_size, connection_id, if_match, limit, page, sort_order): + ctx.invoke( + databasetoolsruntime_cli.list_credentials, + from_json=from_json, + all_pages=all_pages, + page_size=page_size, + connection_id=connection_id, + if_match=if_match, + limit=limit, + page=page, + sort_order=sort_order + ) + + +databasetoolsruntime_cli.credential_group.commands.pop('list', None) +databasetoolsruntime_cli.credential_group.add_command(credential_list_extended) + +# oci dbtools-runtime credential list-credential-execute-grantees -> oci dbtools-runtime credential list-execute-grantees +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.credential_group, databasetoolsruntime_cli.list_credential_execute_grantees, "list-execute-grantees") + +# oci dbtools-runtime credential list-credential-public-synonyms -> oci dbtools-runtime credential list-public-synonyms +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.credential_group, databasetoolsruntime_cli.list_credential_public_synonyms, "list-public-synonyms") + + +# Add connection list-credentials under oci dbtools-runtime connection +databasetoolsruntime_cli.database_tools_connection_group.add_command(databasetoolsruntime_cli.list_credentials) + +# oci dbtools-runtime connection list-credentials -> oci dbtools-runtime connection list-credentials +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.database_tools_connection_group, databasetoolsruntime_cli.list_credentials, "list-credentials") + + +# Move credential create basic-details command under oci dbtools-runtime credential create +databasetoolsruntime_cli.credential_group.commands.pop(databasetoolsruntime_cli.create_credential_create_credential_basic_details.name, None) + + +# oci dbtools-runtime credential create +@click.command('create', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Create a database credential.') +@cli_util.help_option_group +def credential_create_group(): + pass + + +databasetoolsruntime_cli.credential_group.add_command(credential_create_group) +credential_create_group.add_command(databasetoolsruntime_cli.create_credential_create_credential_basic_details) + +# oci dbtools-runtime credential create create-credential-create-credential-basic-details -> oci dbtools-runtime credential create basic +cli_util.rename_command(databasetoolsruntime_cli, credential_create_group, databasetoolsruntime_cli.create_credential_create_credential_basic_details, "basic") + + +# Remove create-credential from oci database-tools-runtime database-tools-connection +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.create_credential.name) + + +# Remove update from oci database-tools-runtime credential +databasetoolsruntime_cli.credential_group.commands.pop(databasetoolsruntime_cli.update_credential.name) + + +# Move credential update basic-details command under oci dbtools-runtime credential update +databasetoolsruntime_cli.credential_group.commands.pop(databasetoolsruntime_cli.update_credential_update_credential_basic_details.name, None) + + +# oci dbtools-runtime credential update +@click.command('update', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Update a database credential.') +@cli_util.help_option_group +def credential_update_group(): + pass + + +databasetoolsruntime_cli.credential_group.add_command(credential_update_group) +credential_update_group.add_command(databasetoolsruntime_cli.update_credential_update_credential_basic_details) + +# oci dbtools-runtime credential update update-credential-update-credential-basic-details -> oci dbtools-runtime credential update basic +cli_util.rename_command(databasetoolsruntime_cli, credential_update_group, databasetoolsruntime_cli.update_credential_update_credential_basic_details, "basic") + + +# Remove execute-sql from oci database-tools-runtime database-tools-connection +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.execute_sql_database_tools_connection.name) +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.execute_sql_database_tools_connection_execute_sql_database_tools_connection_asynchronous_details.name) +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.execute_sql_database_tools_connection_execute_sql_database_tools_connection_synchronous_details.name) +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.execute_sql_database_tools_connection_execute_sql_output_object_storage_details.name) + +databasetoolsruntime_cli.database_tools_connection_group.add_command(connection_execute_sql_group) + + +@connection_execute_sql_group.command('async', help=databasetoolsruntime_cli.execute_sql_database_tools_connection_execute_sql_database_tools_connection_asynchronous_details.help) +@cli_util.option('--connection-id', required=True, help='''The [OCID] of a Database Tools connection.''') +@cli_util.option('--request-input', required=True, type=custom_types.CLI_COMPLEX_TYPE, help='''Request input payload.''' + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--request-output', type=custom_types.CLI_COMPLEX_TYPE, help='''Request output payload.''' + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--output-time-of-deletion', type=custom_types.CLI_DATETIME, help='''The time when the object becomes eligible for deletion, expressed as an RFC 3339 date-time string.''' + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--timeout-in-seconds', type=click.INT, help='''The timeout in seconds.''') +@cli_util.option('--if-match', help='''For optimistic concurrency control.''') +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING"]), multiple=True, help='''Wait for a given work request state.''') +@cli_util.option('--max-wait-seconds', type=click.INT, help='''Maximum wait time in seconds.''') +@cli_util.option('--wait-interval-seconds', type=click.INT, help='''Check interval while waiting.''') +@json_skeleton_utils.get_cli_json_input_option({'request-input': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlAsynchronousInputDetails'}, 'request-output': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlOutputDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'request-input': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlAsynchronousInputDetails'}, 'request-output': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlOutputDetails'}}) +@cli_util.wrap_exceptions +def execute_sql_async_extended(ctx, **kwargs): + cli_util.load_context_obj_values_from_defaults(ctx) + if ctx.obj.get('generate_param_json_input') or ctx.obj.get('generate_full_command_json_input'): + return + connection_id = kwargs['connection_id'] + wait_for_state = kwargs.get('wait_for_state') + max_wait_seconds = kwargs.get('max_wait_seconds') + wait_interval_seconds = kwargs.get('wait_interval_seconds') + request_output = kwargs.pop('request_output', None) + output_time_of_deletion = kwargs.pop('output_time_of_deletion', None) + if request_output is not None: + kwargs['output_parameterconflict'] = cli_util.parse_json_parameter('request_output', request_output) + if request_output is not None and output_time_of_deletion is not None: + kwargs['output_parameterconflict']['timeOfDeletion'] = output_time_of_deletion + parsed_input = cli_util.parse_json_parameter('request_input', kwargs['request_input']) + kwargs_for_call = {} + if kwargs.get('if_match') is not None: + kwargs_for_call['if_match'] = kwargs.get('if_match') + kwargs_for_call['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + details = { + 'type': 'ASYNCHRONOUS', + 'input': parsed_input + } + if kwargs.get('timeout_in_seconds') is not None: + details['timeoutInSeconds'] = kwargs.get('timeout_in_seconds') + if kwargs.get('output_parameterconflict') is not None: + details['output'] = kwargs.get('output_parameterconflict') + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = _execute_sql_database_tools_connection_without_response_model(ctx, client, connection_id, details, kwargs_for_call) + _render_async_execute_sql_response(ctx, client, result, wait_for_state, max_wait_seconds, wait_interval_seconds) + + +execute_sql_async_extended.help = 'Execute SQL asynchronously using a connection.' + + +@connection_execute_sql_group.command('sync', help=databasetoolsruntime_cli.execute_sql_database_tools_connection_execute_sql_database_tools_connection_synchronous_details.help) +@cli_util.option('--connection-id', required=True, help='''The [OCID] of a Database Tools connection.''') +@cli_util.option('--request-input', required=True, type=custom_types.CLI_COMPLEX_TYPE, help='''Request input payload.''' + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help='''For optimistic concurrency control.''') +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING"]), multiple=True, help='''Wait for a given work request state.''') +@cli_util.option('--max-wait-seconds', type=click.INT, help='''Maximum wait time in seconds.''') +@cli_util.option('--wait-interval-seconds', type=click.INT, help='''Check interval while waiting.''') +@json_skeleton_utils.get_cli_json_input_option({'request-input': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlInputDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'request-input': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlInputDetails'}}) +@cli_util.wrap_exceptions +def execute_sql_sync_extended(ctx, **kwargs): + cli_util.load_context_obj_values_from_defaults(ctx) + if ctx.obj.get('generate_param_json_input') or ctx.obj.get('generate_full_command_json_input'): + return + kwargs['input'] = kwargs.pop('request_input') + ctx.invoke(databasetoolsruntime_cli.execute_sql_database_tools_connection_execute_sql_database_tools_connection_synchronous_details, **kwargs) + + +execute_sql_sync_extended.help = 'Execute SQL synchronously using a connection.' + + +# Remove validate from oci database-tools-runtime database-tools-connection +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.validate_database_tools_connection.name) + + +# Move validate detail commands under oci dbtools-runtime connection validate +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_my_sql_details.name) +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_oracle_database_details.name) +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_postgresql_details.name) + + +# Remove obsolete collection groups from oci dbtools-runtime root +databasetoolsruntime_cli.dbtools_runtime_root_group.commands.pop(databasetoolsruntime_cli.credential_execute_grantee_collection_group.name, None) +databasetoolsruntime_cli.dbtools_runtime_root_group.commands.pop(databasetoolsruntime_cli.credential_public_synonym_collection_group.name, None) + + +# oci dbtools-runtime connection validate +@click.command('validate', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help=databasetoolsruntime_cli.validate_database_tools_connection.help) +@cli_util.help_option_group +def database_tools_connection_validate_group(): + pass + + +databasetoolsruntime_cli.database_tools_connection_group.add_command(database_tools_connection_validate_group) + +database_tools_connection_validate_group.add_command(databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_my_sql_details) +database_tools_connection_validate_group.add_command(databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_oracle_database_details) +database_tools_connection_validate_group.add_command(databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_postgresql_details) + +# oci dbtools-runtime connection validate validate-database-tools-connection-validate-database-tools-connection-my-sql-details -> oci dbtools-runtime connection validate mysql +cli_util.rename_command(databasetoolsruntime_cli, database_tools_connection_validate_group, databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_my_sql_details, "mysql") + +# oci dbtools-runtime connection validate validate-database-tools-connection-validate-database-tools-connection-oracle-database-details -> oci dbtools-runtime connection validate oracle-database +cli_util.rename_command(databasetoolsruntime_cli, database_tools_connection_validate_group, databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_oracle_database_details, "oracle-database") + +# oci dbtools-runtime connection validate validate-database-tools-connection-validate-database-tools-connection-postgresql-details -> oci dbtools-runtime connection validate postgresql +cli_util.rename_command(databasetoolsruntime_cli, database_tools_connection_validate_group, databasetoolsruntime_cli.validate_database_tools_connection_validate_database_tools_connection_postgresql_details, "postgresql") + + +# Move get content command under oci dbtools-runtime database-api-gateway-config get +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.commands.pop(databasetoolsruntime_cli.get_database_tools_database_api_gateway_config_content.name) + + +# oci dbtools-runtime database-api-gateway-config get +@click.command('get', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Get database API gateway config resources.') +@cli_util.help_option_group +def database_api_gateway_config_get_group(): + pass + + +databasetoolsruntime_cli.database_tools_database_api_gateway_config_group.add_command(database_api_gateway_config_get_group) +database_api_gateway_config_get_group.add_command(databasetoolsruntime_cli.get_database_tools_database_api_gateway_config_content) + +# oci dbtools-runtime database-api-gateway-config get get-database-tools-database-api-gateway-config-content -> oci dbtools-runtime database-api-gateway-config get content +cli_util.rename_command(databasetoolsruntime_cli, database_api_gateway_config_get_group, databasetoolsruntime_cli.get_database_tools_database_api_gateway_config_content, "content") + + +# oci dbtools-runtime database-api-gateway-config-advanced-properties list-database-tools-database-api-gateway-config-advanced-properties -> oci dbtools-runtime database-api-gateway-config-advanced-properties list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.database_tools_database_api_gateway_config_advanced_property_summary_group, databasetoolsruntime_cli.list_database_tools_database_api_gateway_config_advanced_properties, "list") + + +# Remove update from oci database-tools-runtime database-tools-database-api-gateway-config-global +databasetoolsruntime_cli.database_tools_database_api_gateway_config_global_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_global.name) + + +# Move database-api-gateway-config-global update detail commands under oci dbtools-runtime database-api-gateway-config-global update +databasetoolsruntime_cli.database_tools_database_api_gateway_config_global_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_global_update_database_tools_database_api_gateway_config_global_default_details.name, None) +databasetoolsruntime_cli.database_tools_database_api_gateway_config_global_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_global_database_api_gateway_config_certificate_bundle_file_name.name, None) +databasetoolsruntime_cli.database_tools_database_api_gateway_config_global_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_global_database_api_gateway_config_certificate_bundle_self_signed.name, None) + + +# oci dbtools-runtime database-api-gateway-config-global update +@click.command('update', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Update database API gateway config global settings.') +@cli_util.help_option_group +def database_api_gateway_config_global_update_group(): + pass + + +databasetoolsruntime_cli.database_tools_database_api_gateway_config_global_group.add_command(database_api_gateway_config_global_update_group) +database_api_gateway_config_global_update_group.add_command(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_global_update_database_tools_database_api_gateway_config_global_default_details) + +# oci dbtools-runtime database-api-gateway-config-global update update-database-tools-database-api-gateway-config-global-update-database-tools-database-api-gateway-config-global-default-details -> oci dbtools-runtime database-api-gateway-config-global update default +cli_util.rename_command(databasetoolsruntime_cli, database_api_gateway_config_global_update_group, databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_global_update_database_tools_database_api_gateway_config_global_default_details, "default") + + +# Remove create from oci database-tools-runtime database-tools-database-api-gateway-config-pool +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group.commands.pop(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool.name) + + +# Move create default-details command under oci dbtools-runtime database-api-gateway-config-pool create +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group.commands.pop(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_create_database_tools_database_api_gateway_config_pool_default_details.name) + + +# oci dbtools-runtime database-api-gateway-config-pool create +@click.command('create', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Create database API gateway config pool resources.') +@cli_util.help_option_group +def database_api_gateway_config_pool_create_group(): + pass + + +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group.add_command(database_api_gateway_config_pool_create_group) +database_api_gateway_config_pool_create_group.add_command(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_create_database_tools_database_api_gateway_config_pool_default_details) + +# oci dbtools-runtime database-api-gateway-config-pool create create-database-tools-database-api-gateway-config-pool-create-database-tools-database-api-gateway-config-pool-default-details -> oci dbtools-runtime database-api-gateway-config-pool create default +cli_util.rename_command(databasetoolsruntime_cli, database_api_gateway_config_pool_create_group, databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_create_database_tools_database_api_gateway_config_pool_default_details, "default") + +# oci dbtools-runtime database-api-gateway-config-pool list-database-tools-database-api-gateway-config-pools -> oci dbtools-runtime database-api-gateway-config-pool list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group, databasetoolsruntime_cli.list_database_tools_database_api_gateway_config_pools, "list") + +# oci dbtools-runtime database-api-gateway-config-pool delete-database-tools-database-api-gateway-config-pool -> oci dbtools-runtime database-api-gateway-config-pool delete +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group, databasetoolsruntime_cli.delete_database_tools_database_api_gateway_config_pool, "delete") + + +# Remove update from oci database-tools-runtime database-tools-database-api-gateway-config-pool +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool.name) + + +# Move update default-details command under oci dbtools-runtime database-api-gateway-config-pool update +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_update_database_tools_database_api_gateway_config_pool_default_details.name) + + +# oci dbtools-runtime database-api-gateway-config-pool update +@click.command('update', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Update database API gateway config pool resources.') +@cli_util.help_option_group +def database_api_gateway_config_pool_update_group(): + pass + + +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_group.add_command(database_api_gateway_config_pool_update_group) +database_api_gateway_config_pool_update_group.add_command(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_update_database_tools_database_api_gateway_config_pool_default_details) + +# oci dbtools-runtime database-api-gateway-config-pool update update-database-tools-database-api-gateway-config-pool-update-database-tools-database-api-gateway-config-pool-default-details -> oci dbtools-runtime database-api-gateway-config-pool update default +cli_util.rename_command(databasetoolsruntime_cli, database_api_gateway_config_pool_update_group, databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_update_database_tools_database_api_gateway_config_pool_default_details, "default") + + +# Remove create from oci database-tools-runtime database-tools-database-api-gateway-config-pool-api-spec +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group.commands.pop(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_api_spec.name) + + +# Move create default-details command under oci dbtools-runtime database-api-gateway-config-pool-api-spec create +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group.commands.pop(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_api_spec_create_database_tools_database_api_gateway_config_pool_api_spec_default_details.name) + + +# oci dbtools-runtime database-api-gateway-config-pool-api-spec create +@click.command('create', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Create database API gateway config pool API spec resources.') +@cli_util.help_option_group +def database_api_gateway_config_pool_api_spec_create_group(): + pass + + +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group.add_command(database_api_gateway_config_pool_api_spec_create_group) +database_api_gateway_config_pool_api_spec_create_group.add_command(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_api_spec_create_database_tools_database_api_gateway_config_pool_api_spec_default_details) + +# oci dbtools-runtime database-api-gateway-config-pool-api-spec create create-database-tools-database-api-gateway-config-pool-api-spec-create-database-tools-database-api-gateway-config-pool-api-spec-default-details -> oci dbtools-runtime database-api-gateway-config-pool-api-spec create default +cli_util.rename_command(databasetoolsruntime_cli, database_api_gateway_config_pool_api_spec_create_group, databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_api_spec_create_database_tools_database_api_gateway_config_pool_api_spec_default_details, "default") + +# oci dbtools-runtime database-api-gateway-config-pool-api-spec list-database-tools-database-api-gateway-config-pool-api-specs -> oci dbtools-runtime database-api-gateway-config-pool-api-spec list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group, databasetoolsruntime_cli.list_database_tools_database_api_gateway_config_pool_api_specs, "list") + +# oci dbtools-runtime database-api-gateway-config-pool-api-spec delete-database-tools-database-api-gateway-config-pool-api-spec -> oci dbtools-runtime database-api-gateway-config-pool-api-spec delete +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group, databasetoolsruntime_cli.delete_database_tools_database_api_gateway_config_pool_api_spec, "delete") + + +# Remove update from oci database-tools-runtime database-tools-database-api-gateway-config-pool-api-spec +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_api_spec.name) + + +# Move update default-details command under oci dbtools-runtime database-api-gateway-config-pool-api-spec update +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_api_spec_update_database_tools_database_api_gateway_config_pool_api_spec_default_details.name) + + +# oci dbtools-runtime database-api-gateway-config-pool-api-spec update +@click.command('update', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Update database API gateway config pool API spec resources.') +@cli_util.help_option_group +def database_api_gateway_config_pool_api_spec_update_group(): + pass + + +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_api_spec_group.add_command(database_api_gateway_config_pool_api_spec_update_group) +database_api_gateway_config_pool_api_spec_update_group.add_command(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_api_spec_update_database_tools_database_api_gateway_config_pool_api_spec_default_details) + +# oci dbtools-runtime database-api-gateway-config-pool-api-spec update update-database-tools-database-api-gateway-config-pool-api-spec-update-database-tools-database-api-gateway-config-pool-api-spec-default-details -> oci dbtools-runtime database-api-gateway-config-pool-api-spec update default +cli_util.rename_command(databasetoolsruntime_cli, database_api_gateway_config_pool_api_spec_update_group, databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_api_spec_update_database_tools_database_api_gateway_config_pool_api_spec_default_details, "default") + + +# Remove create from oci database-tools-runtime database-tools-database-api-gateway-config-pool-auto-api-spec +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group.commands.pop(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_auto_api_spec.name) + + +# Move create default-details command under oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec create +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group.commands.pop(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_auto_api_spec_create_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details.name) + + +# oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec create +@click.command('create', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Create database API gateway config pool auto API spec resources.') +@cli_util.help_option_group +def database_api_gateway_config_pool_auto_api_spec_create_group(): + pass + + +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group.add_command(database_api_gateway_config_pool_auto_api_spec_create_group) +database_api_gateway_config_pool_auto_api_spec_create_group.add_command(databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_auto_api_spec_create_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details) + +# oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec create create-database-tools-database-api-gateway-config-pool-auto-api-spec-create-database-tools-database-api-gateway-config-pool-auto-api-spec-default-details -> oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec create default +cli_util.rename_command(databasetoolsruntime_cli, database_api_gateway_config_pool_auto_api_spec_create_group, databasetoolsruntime_cli.create_database_tools_database_api_gateway_config_pool_auto_api_spec_create_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details, "default") + +# oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec list-database-tools-database-api-gateway-config-pool-auto-api-specs -> oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec list +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group, databasetoolsruntime_cli.list_database_tools_database_api_gateway_config_pool_auto_api_specs, "list") + +# oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec delete-database-tools-database-api-gateway-config-pool-auto-api-spec -> oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec delete +cli_util.rename_command(databasetoolsruntime_cli, databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group, databasetoolsruntime_cli.delete_database_tools_database_api_gateway_config_pool_auto_api_spec, "delete") + + +# Remove update from oci database-tools-runtime database-tools-database-api-gateway-config-pool-auto-api-spec +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_auto_api_spec.name) + + +# Move update default-details command under oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec update +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group.commands.pop(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_auto_api_spec_update_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details.name) + + +# oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec update +@click.command('update', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Update database API gateway config pool auto API spec resources.') +@cli_util.help_option_group +def database_api_gateway_config_pool_auto_api_spec_update_group(): + pass + + +databasetoolsruntime_cli.database_tools_database_api_gateway_config_pool_auto_api_spec_group.add_command(database_api_gateway_config_pool_auto_api_spec_update_group) +database_api_gateway_config_pool_auto_api_spec_update_group.add_command(databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_auto_api_spec_update_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details) + +# oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec update update-database-tools-database-api-gateway-config-pool-auto-api-spec-update-database-tools-database-api-gateway-config-pool-auto-api-spec-default-details -> oci dbtools-runtime database-api-gateway-config-pool-auto-api-spec update default +cli_util.rename_command(databasetoolsruntime_cli, database_api_gateway_config_pool_auto_api_spec_update_group, databasetoolsruntime_cli.update_database_tools_database_api_gateway_config_pool_auto_api_spec_update_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details, "default") + + +# Remove validate-database-tools-identity-credential from oci database-tools-runtime database-tools-identity +databasetoolsruntime_cli.database_tools_identity_group.commands.pop(databasetoolsruntime_cli.validate_database_tools_identity_credential.name) + + +# Move validate detail command under oci dbtools-runtime identity validate +databasetoolsruntime_cli.database_tools_identity_group.commands.pop(databasetoolsruntime_cli.validate_database_tools_identity_credential_validate_database_tools_identity_credential_oracle_database_resource_principal_details.name) + + +# oci dbtools-runtime identity validate +@click.command('validate', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help=databasetoolsruntime_cli.validate_database_tools_identity_credential.help) +@cli_util.help_option_group +def database_tools_identity_validate_group(): + pass + + +databasetoolsruntime_cli.database_tools_identity_group.add_command(database_tools_identity_validate_group) +database_tools_identity_validate_group.add_command(databasetoolsruntime_cli.validate_database_tools_identity_credential_validate_database_tools_identity_credential_oracle_database_resource_principal_details) + +# oci dbtools-runtime identity validate validate-database-tools-identity-credential-validate-database-tools-identity-credential-oracle-database-resource-principal-details -> oci dbtools-runtime identity validate oracle-database-resource-principal +cli_util.rename_command(databasetoolsruntime_cli, database_tools_identity_validate_group, databasetoolsruntime_cli.validate_database_tools_identity_credential_validate_database_tools_identity_credential_oracle_database_resource_principal_details, "oracle-database-resource-principal") + + +# Remove update from oci database-tools-runtime property-set +databasetoolsruntime_cli.property_set_group.commands.pop(databasetoolsruntime_cli.update_property_set.name) + + +# Move property-set update detail commands under oci dbtools-runtime property-set update +databasetoolsruntime_cli.property_set_group.commands.pop(databasetoolsruntime_cli.update_property_set_update_property_set_apex_document_generator_details.name) +databasetoolsruntime_cli.property_set_group.commands.pop(databasetoolsruntime_cli.update_property_set_update_property_set_apex_fa_integration_details.name) +databasetoolsruntime_cli.property_set_group.commands.pop(databasetoolsruntime_cli.update_property_set_update_property_set_oracle_database_external_authentication_details.name) + + +# oci dbtools-runtime property-set update +@click.command('update', cls=databasetoolsruntime_cli.CommandGroupWithAlias, help='Update property set resources.') +@cli_util.help_option_group +def property_set_update_group(): + pass + + +databasetoolsruntime_cli.property_set_group.add_command(property_set_update_group) +property_set_update_group.add_command(databasetoolsruntime_cli.update_property_set_update_property_set_apex_document_generator_details) +property_set_update_group.add_command(databasetoolsruntime_cli.update_property_set_update_property_set_apex_fa_integration_details) +property_set_update_group.add_command(databasetoolsruntime_cli.update_property_set_update_property_set_oracle_database_external_authentication_details) + +# oci dbtools-runtime property-set update update-property-set-update-property-set-apex-document-generator-details -> oci dbtools-runtime property-set update apex-document-generator-details +cli_util.rename_command(databasetoolsruntime_cli, property_set_update_group, databasetoolsruntime_cli.update_property_set_update_property_set_apex_document_generator_details, "apex-document-generator-details") +databasetoolsruntime_cli.update_property_set_update_property_set_apex_document_generator_details.help = 'Update the APEX Document Generator property set.' + +# oci dbtools-runtime property-set update update-property-set-update-property-set-apex-fa-integration-details -> oci dbtools-runtime property-set update apex-fa-integration-details +cli_util.rename_command(databasetoolsruntime_cli, property_set_update_group, databasetoolsruntime_cli.update_property_set_update_property_set_apex_fa_integration_details, "apex-fa-integration-details") +databasetoolsruntime_cli.update_property_set_update_property_set_apex_fa_integration_details.help = 'Update the APEX FA Integration property set.' + +# oci dbtools-runtime property-set update update-property-set-update-property-set-oracle-database-external-authentication-details -> oci dbtools-runtime property-set update oracle-database-external-authentication-details +cli_util.rename_command(databasetoolsruntime_cli, property_set_update_group, databasetoolsruntime_cli.update_property_set_update_property_set_oracle_database_external_authentication_details, "oracle-database-external-authentication-details") +databasetoolsruntime_cli.update_property_set_update_property_set_oracle_database_external_authentication_details.help = 'Update the Oracle Database External Authentication property set.' + + +# oci database-tools-runtime database-tools-connection create-credential-create-credential-basic-details -> oci database-tools-runtime credential +databasetoolsruntime_cli.database_tools_connection_group.commands.pop(databasetoolsruntime_cli.create_credential_create_credential_basic_details.name, None) + +# Ensure create-credential-create-credential-basic-details is removed from oci dbtools-runtime connection +databasetoolsruntime_cli.database_tools_connection_group.commands.pop("create-credential-create-credential-basic-details", None) + + +# Final credential list registration: add it at the very end so no later mutation can overwrite/remove it. +databasetoolsruntime_cli.credential_group.commands.pop('list', None) +databasetoolsruntime_cli.credential_group.add_command(credential_list_extended) diff --git a/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/__init__.py b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/__init__.py new file mode 100644 index 000000000..5c3d90774 --- /dev/null +++ b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20230222 diff --git a/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/client_mappings.py b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/client_mappings.py new file mode 100644 index 000000000..69443b698 --- /dev/null +++ b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/client_mappings.py @@ -0,0 +1,14 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20230222 + +import oci +from oci_cli.cli_clients import CLIENT_MAP +from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS +from oci.database_tools_runtime import DatabaseToolsRuntimeClient + +MODULE_TO_TYPE_MAPPINGS["database_tools_runtime"] = oci.database_tools_runtime.models.database_tools_runtime_type_mapping +if CLIENT_MAP.get("database_tools_runtime") is None: + CLIENT_MAP["database_tools_runtime"] = {} +CLIENT_MAP["database_tools_runtime"]["database_tools_runtime"] = DatabaseToolsRuntimeClient diff --git a/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/databasetoolsruntime_cli.py b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/databasetoolsruntime_cli.py new file mode 100644 index 000000000..e771c9f55 --- /dev/null +++ b/services/database_tools_runtime/src/oci_cli_database_tools_runtime/generated/databasetoolsruntime_cli.py @@ -0,0 +1,3376 @@ +# 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: 20230222 + +from __future__ import print_function +import click +import oci # noqa: F401 +import six # noqa: F401 +import sys # noqa: F401 +from oci_cli.cli_root import cli +from oci_cli import cli_constants # noqa: F401 +from oci_cli import cli_util +from oci_cli import json_skeleton_utils +from oci_cli import custom_types # noqa: F401 +from oci_cli.aliasing import CommandGroupWithAlias + + +@cli.command(cli_util.override('dbtools_runtime.dbtools_runtime_root_group.command_name', 'dbtools-runtime'), cls=CommandGroupWithAlias, help=cli_util.override('dbtools_runtime.dbtools_runtime_root_group.help', """Use the Database Tools Runtime API to connect to databases through Database Tools Connections."""), short_help=cli_util.override('dbtools_runtime.dbtools_runtime_root_group.short_help', """Database Tools Service Runtime""")) +@cli_util.help_option_group +def dbtools_runtime_root_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.credential_execute_grantee_collection_group.command_name', 'credential-execute-grantee-collection'), cls=CommandGroupWithAlias, help="""List of `CredentialExecuteGranteeSummary` items.""") +@cli_util.help_option_group +def credential_execute_grantee_collection_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.property_set_group.command_name', 'property-set'), cls=CommandGroupWithAlias, help="""The base definition for a property set""") +@cli_util.help_option_group +def property_set_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.credential_execute_grantee_group.command_name', 'credential-execute-grantee'), cls=CommandGroupWithAlias, help="""Specifies the database user, the grantee, who is granted the execute privilege on the credential.""") +@cli_util.help_option_group +def credential_execute_grantee_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.database_tools_database_api_gateway_config_pool_auto_api_spec_group.command_name', 'database-tools-database-api-gateway-config-pool-auto-api-spec'), cls=CommandGroupWithAlias, help="""The content of a Database Tools database API gateway config auto API spec sub resource defined within a pool.""") +@cli_util.help_option_group +def database_tools_database_api_gateway_config_pool_auto_api_spec_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.credential_collection_group.command_name', 'credential-collection'), cls=CommandGroupWithAlias, help="""List of `CredentialSummary` items.""") +@cli_util.help_option_group +def credential_collection_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.credential_public_synonym_group.command_name', 'credential-public-synonym'), cls=CommandGroupWithAlias, help="""The public synonym information""") +@cli_util.help_option_group +def credential_public_synonym_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.database_tools_database_api_gateway_config_global_group.command_name', 'database-tools-database-api-gateway-config-global'), cls=CommandGroupWithAlias, help="""The content of a Database Tools database API gateway config global resource.""") +@cli_util.help_option_group +def database_tools_database_api_gateway_config_global_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.work_request_log_entry_group.command_name', 'work-request-log-entry'), cls=CommandGroupWithAlias, help="""A log message from the execution of a work request.""") +@cli_util.help_option_group +def work_request_log_entry_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.work_request_group.command_name', 'work-request'), cls=CommandGroupWithAlias, help="""An asynchronous work request.""") +@cli_util.help_option_group +def work_request_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.database_tools_database_api_gateway_config_pool_api_spec_group.command_name', 'database-tools-database-api-gateway-config-pool-api-spec'), cls=CommandGroupWithAlias, help="""The content of a Database Tools database API gateway config API spec sub resource defined within a pool.""") +@cli_util.help_option_group +def database_tools_database_api_gateway_config_pool_api_spec_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.database_tools_database_api_gateway_config_group.command_name', 'database-tools-database-api-gateway-config'), cls=CommandGroupWithAlias, help="""Simplified DatabaseToolsDatabaseApiGatewayConfig representation for splat usage only.""") +@cli_util.help_option_group +def database_tools_database_api_gateway_config_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.user_credential_group.command_name', 'user-credential'), cls=CommandGroupWithAlias, help="""Credential information""") +@cli_util.help_option_group +def user_credential_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.credential_group.command_name', 'credential'), cls=CommandGroupWithAlias, help="""Credential information""") +@cli_util.help_option_group +def credential_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.credential_public_synonym_collection_group.command_name', 'credential-public-synonym-collection'), cls=CommandGroupWithAlias, help="""List of `CredentialPublicSynonymSummary` items.""") +@cli_util.help_option_group +def credential_public_synonym_collection_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.user_credential_collection_group.command_name', 'user-credential-collection'), cls=CommandGroupWithAlias, help="""List of `UserCredentialSummary` items.""") +@cli_util.help_option_group +def user_credential_collection_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.database_tools_identity_group.command_name', 'database-tools-identity'), cls=CommandGroupWithAlias, help="""Manages credentials in a database to access service resources.""") +@cli_util.help_option_group +def database_tools_identity_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.work_request_error_group.command_name', 'work-request-error'), cls=CommandGroupWithAlias, help="""An error encountered while executing a work request.""") +@cli_util.help_option_group +def work_request_error_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.database_tools_database_api_gateway_config_advanced_property_summary_group.command_name', 'database-tools-database-api-gateway-config-advanced-property-summary'), cls=CommandGroupWithAlias, help="""Description of a database API gateway config setting to be provided as an advanced property.""") +@cli_util.help_option_group +def database_tools_database_api_gateway_config_advanced_property_summary_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.database_tools_connection_group.command_name', 'database-tools-connection'), cls=CommandGroupWithAlias, help="""Simplified DatabaseToolsConnection representation for splat usage only""") +@cli_util.help_option_group +def database_tools_connection_group(): + pass + + +@click.command(cli_util.override('dbtools_runtime.database_tools_database_api_gateway_config_pool_group.command_name', 'database-tools-database-api-gateway-config-pool'), cls=CommandGroupWithAlias, help="""The content of a Database Tools database API gateway config pool sub resource.""") +@cli_util.help_option_group +def database_tools_database_api_gateway_config_pool_group(): + pass + + +dbtools_runtime_root_group.add_command(credential_execute_grantee_collection_group) +dbtools_runtime_root_group.add_command(property_set_group) +dbtools_runtime_root_group.add_command(credential_execute_grantee_group) +dbtools_runtime_root_group.add_command(database_tools_database_api_gateway_config_pool_auto_api_spec_group) +dbtools_runtime_root_group.add_command(credential_collection_group) +dbtools_runtime_root_group.add_command(credential_public_synonym_group) +dbtools_runtime_root_group.add_command(database_tools_database_api_gateway_config_global_group) +dbtools_runtime_root_group.add_command(work_request_log_entry_group) +dbtools_runtime_root_group.add_command(work_request_group) +dbtools_runtime_root_group.add_command(database_tools_database_api_gateway_config_pool_api_spec_group) +dbtools_runtime_root_group.add_command(database_tools_database_api_gateway_config_group) +dbtools_runtime_root_group.add_command(user_credential_group) +dbtools_runtime_root_group.add_command(credential_group) +dbtools_runtime_root_group.add_command(credential_public_synonym_collection_group) +dbtools_runtime_root_group.add_command(user_credential_collection_group) +dbtools_runtime_root_group.add_command(database_tools_identity_group) +dbtools_runtime_root_group.add_command(work_request_error_group) +dbtools_runtime_root_group.add_command(database_tools_database_api_gateway_config_advanced_property_summary_group) +dbtools_runtime_root_group.add_command(database_tools_connection_group) +dbtools_runtime_root_group.add_command(database_tools_database_api_gateway_config_pool_group) + + +@work_request_group.command(name=cli_util.override('dbtools_runtime.cancel_work_request.command_name', 'cancel'), help=u"""Attempts to cancel the specified work request. \n[Command Reference](cancelWorkRequest)""") +@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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 cancel_work_request(ctx, from_json, work_request_id, if_match): + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.cancel_work_request( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.create_credential.command_name', 'create-credential'), help=u"""Creates a credential for the user specified by the key. \n[Command Reference](createCredential)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["BASIC"]), help=u"""The type of credential.""") +@cli_util.option('--credential-key', required=True, help=u"""The credential_name to be created""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'Credential'}) +@cli_util.wrap_exceptions +def create_credential(ctx, from_json, connection_id, type, credential_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['type'] = type + _details['key'] = credential_key + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_credential( + database_tools_connection_id=connection_id, + create_credential_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.create_credential_create_credential_basic_details.command_name', 'create-credential-create-credential-basic-details'), help=u"""Creates a credential for the user specified by the key. \n[Command Reference](createCredential)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The credential_name to be created""") +@cli_util.option('--user-name', required=True, help=u"""The username for the new credential.""") +@cli_util.option('--password', required=True, help=u"""The password for the new credential.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'Credential'}) +@cli_util.wrap_exceptions +def create_credential_create_credential_basic_details(ctx, from_json, connection_id, credential_key, user_name, password, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['key'] = credential_key + _details['userName'] = user_name + _details['password'] = password + + _details['type'] = 'BASIC' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_credential( + database_tools_connection_id=connection_id, + create_credential_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_execute_grantee_group.command(name=cli_util.override('dbtools_runtime.create_credential_execute_grantee.command_name', 'create'), help=u"""Grants the EXECUTE privilege on the credential to the user specified by the key. \n[Command Reference](createCredentialExecuteGrantee)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--execute-grantee-key', required=True, help=u"""The name of the user to grant the EXECUTE privilege on the credential.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'CredentialExecuteGrantee'}) +@cli_util.wrap_exceptions +def create_credential_execute_grantee(ctx, from_json, connection_id, credential_key, execute_grantee_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key 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['key'] = execute_grantee_key + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_credential_execute_grantee( + database_tools_connection_id=connection_id, + credential_key=credential_key, + create_credential_execute_grantee_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_public_synonym_group.command(name=cli_util.override('dbtools_runtime.create_credential_public_synonym.command_name', 'create'), help=u"""Creates a public synonym for the given credentials \n[Command Reference](createCredentialPublicSynonym)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--public-synonym-key', required=True, help=u"""The name of the public synonym for the credential""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'CredentialPublicSynonym'}) +@cli_util.wrap_exceptions +def create_credential_public_synonym(ctx, from_json, connection_id, credential_key, public_synonym_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key 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['key'] = public_synonym_key + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_credential_public_synonym( + database_tools_connection_id=connection_id, + credential_key=credential_key, + create_credential_public_synonym_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_group.command(name=cli_util.override('dbtools_runtime.create_database_tools_database_api_gateway_config_pool.command_name', 'create'), help=u"""Create a Database Tools database API gateway config pool resource \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfigPool)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The type of the Database Tools database API gateway config pool sub resource.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--pool-route-value', required=True, help=u"""The pool route value provided in requests to target this pool.""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of the related Database Tools connection. Specifies the OCI database tools connection ocid to build the connection pool from.""") +@cli_util.option('--max-pool-size', type=click.INT, help=u"""Specifies the maximum number of database connections allowed for the pool.""") +@cli_util.option('--min-pool-size', type=click.INT, help=u"""Specifies the minimum number of database connections allowed for the pool.""") +@cli_util.option('--initial-pool-size', type=click.INT, help=u"""Specifies the initial size for the number of database connections that will be created for the pool.""") +@cli_util.option('--jwt-profile-jwk-url', help=u"""Specifies the URL of the JSON Web Key (JWK) that is used to verify the signature of the JWT token.""") +@cli_util.option('--jwt-profile-issuer', help=u"""Specifies the issuer of the JWT token. This value is used to validate the iss claim in the JWT token.""") +@cli_util.option('--jwt-profile-audience', help=u"""Specifies the expected audience for the JWT token. This value is used to validate the aud claim in the JWT token.""") +@cli_util.option('--jwt-profile-role-claim-name', help=u"""Specifies the JSON pointer to the claim in the JWT token that contains the roles of the users.""") +@cli_util.option('--database-actions-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""Specifies to enable the Database Actions feature.""") +@cli_util.option('--rest-enabled-sql-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""Specifies whether the REST-Enabled SQL service is active.""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Advanced pool properties.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@json_skeleton_utils.get_cli_json_input_option({'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPool'}) +@cli_util.wrap_exceptions +def create_database_tools_database_api_gateway_config_pool(ctx, from_json, database_api_gateway_config_id, type, display_name, pool_route_value, database_tools_connection_id, max_pool_size, min_pool_size, initial_pool_size, jwt_profile_jwk_url, jwt_profile_issuer, jwt_profile_audience, jwt_profile_role_claim_name, database_actions_status, rest_enabled_sql_status, advanced_properties): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-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['type'] = type + _details['displayName'] = display_name + _details['poolRouteValue'] = pool_route_value + _details['databaseToolsConnectionId'] = database_tools_connection_id + + if max_pool_size is not None: + _details['maxPoolSize'] = max_pool_size + + if min_pool_size is not None: + _details['minPoolSize'] = min_pool_size + + if initial_pool_size is not None: + _details['initialPoolSize'] = initial_pool_size + + if jwt_profile_jwk_url is not None: + _details['jwtProfileJwkUrl'] = jwt_profile_jwk_url + + if jwt_profile_issuer is not None: + _details['jwtProfileIssuer'] = jwt_profile_issuer + + if jwt_profile_audience is not None: + _details['jwtProfileAudience'] = jwt_profile_audience + + if jwt_profile_role_claim_name is not None: + _details['jwtProfileRoleClaimName'] = jwt_profile_role_claim_name + + if database_actions_status is not None: + _details['databaseActionsStatus'] = database_actions_status + + if rest_enabled_sql_status is not None: + _details['restEnabledSqlStatus'] = rest_enabled_sql_status + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_database_tools_database_api_gateway_config_pool( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + create_database_tools_database_api_gateway_config_pool_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_group.command(name=cli_util.override('dbtools_runtime.create_database_tools_database_api_gateway_config_pool_create_database_tools_database_api_gateway_config_pool_default_details.command_name', 'create-database-tools-database-api-gateway-config-pool-create-database-tools-database-api-gateway-config-pool-default-details'), help=u"""Create a Database Tools database API gateway config pool resource \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfigPool)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--pool-route-value', required=True, help=u"""The pool route value provided in requests to target this pool.""") +@cli_util.option('--database-tools-connection-id', required=True, help=u"""The [OCID] of the related Database Tools connection. Specifies the OCI database tools connection ocid to build the connection pool from.""") +@cli_util.option('--max-pool-size', type=click.INT, help=u"""Specifies the maximum number of database connections allowed for the pool.""") +@cli_util.option('--min-pool-size', type=click.INT, help=u"""Specifies the minimum number of database connections allowed for the pool.""") +@cli_util.option('--initial-pool-size', type=click.INT, help=u"""Specifies the initial size for the number of database connections that will be created for the pool.""") +@cli_util.option('--jwt-profile-jwk-url', help=u"""Specifies the URL of the JSON Web Key (JWK) that is used to verify the signature of the JWT token.""") +@cli_util.option('--jwt-profile-issuer', help=u"""Specifies the issuer of the JWT token. This value is used to validate the iss claim in the JWT token.""") +@cli_util.option('--jwt-profile-audience', help=u"""Specifies the expected audience for the JWT token. This value is used to validate the aud claim in the JWT token.""") +@cli_util.option('--jwt-profile-role-claim-name', help=u"""Specifies the JSON pointer to the claim in the JWT token that contains the roles of the users.""") +@cli_util.option('--database-actions-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""Specifies to enable the Database Actions feature.""") +@cli_util.option('--rest-enabled-sql-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""Specifies whether the REST-Enabled SQL service is active.""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Advanced pool properties.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@json_skeleton_utils.get_cli_json_input_option({'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPool'}) +@cli_util.wrap_exceptions +def create_database_tools_database_api_gateway_config_pool_create_database_tools_database_api_gateway_config_pool_default_details(ctx, from_json, database_api_gateway_config_id, display_name, pool_route_value, database_tools_connection_id, max_pool_size, min_pool_size, initial_pool_size, jwt_profile_jwk_url, jwt_profile_issuer, jwt_profile_audience, jwt_profile_role_claim_name, database_actions_status, rest_enabled_sql_status, advanced_properties): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-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['poolRouteValue'] = pool_route_value + _details['databaseToolsConnectionId'] = database_tools_connection_id + + if max_pool_size is not None: + _details['maxPoolSize'] = max_pool_size + + if min_pool_size is not None: + _details['minPoolSize'] = min_pool_size + + if initial_pool_size is not None: + _details['initialPoolSize'] = initial_pool_size + + if jwt_profile_jwk_url is not None: + _details['jwtProfileJwkUrl'] = jwt_profile_jwk_url + + if jwt_profile_issuer is not None: + _details['jwtProfileIssuer'] = jwt_profile_issuer + + if jwt_profile_audience is not None: + _details['jwtProfileAudience'] = jwt_profile_audience + + if jwt_profile_role_claim_name is not None: + _details['jwtProfileRoleClaimName'] = jwt_profile_role_claim_name + + if database_actions_status is not None: + _details['databaseActionsStatus'] = database_actions_status + + if rest_enabled_sql_status is not None: + _details['restEnabledSqlStatus'] = rest_enabled_sql_status + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + _details['type'] = 'DEFAULT' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_database_tools_database_api_gateway_config_pool( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + create_database_tools_database_api_gateway_config_pool_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_api_spec_group.command(name=cli_util.override('dbtools_runtime.create_database_tools_database_api_gateway_config_pool_api_spec.command_name', 'create'), help=u"""Create a Database Tools database API gateway config API spec resource \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfigPoolApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The type of the Database Tools database API gateway config API spec sub resource.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--content', required=True, help=u"""The content of a string-escaped Open API spec in JSON format.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolApiSpec'}) +@cli_util.wrap_exceptions +def create_database_tools_database_api_gateway_config_pool_api_spec(ctx, from_json, database_api_gateway_config_id, pool_key, type, display_name, content): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['type'] = type + _details['displayName'] = display_name + _details['content'] = content + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_database_tools_database_api_gateway_config_pool_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + create_database_tools_database_api_gateway_config_pool_api_spec_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_api_spec_group.command(name=cli_util.override('dbtools_runtime.create_database_tools_database_api_gateway_config_pool_api_spec_create_database_tools_database_api_gateway_config_pool_api_spec_default_details.command_name', 'create-database-tools-database-api-gateway-config-pool-api-spec-create-database-tools-database-api-gateway-config-pool-api-spec-default-details'), help=u"""Create a Database Tools database API gateway config API spec resource \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfigPoolApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--content', required=True, help=u"""The content of a string-escaped Open API spec in JSON format.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolApiSpec'}) +@cli_util.wrap_exceptions +def create_database_tools_database_api_gateway_config_pool_api_spec_create_database_tools_database_api_gateway_config_pool_api_spec_default_details(ctx, from_json, database_api_gateway_config_id, pool_key, display_name, content): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key 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['content'] = content + + _details['type'] = 'DEFAULT' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_database_tools_database_api_gateway_config_pool_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + create_database_tools_database_api_gateway_config_pool_api_spec_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_auto_api_spec_group.command(name=cli_util.override('dbtools_runtime.create_database_tools_database_api_gateway_config_pool_auto_api_spec.command_name', 'create'), help=u"""Create a Database Tools database API gateway config auto API spec resource \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The type of the Database Tools database API gateway config auto API spec sub resource.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--database-object-name', required=True, help=u"""The name of the database object.""") +@cli_util.option('--database-object-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FUNCTION", "MVIEW", "PACKAGE", "PROCEDURE", "TABLE", "VIEW", "DUALITYVIEW"]), help=u"""The type of the database object.""") +@cli_util.option('--description', help=u"""Description of the autoApiSpec.""") +@cli_util.option('--alias', help=u"""Used as the URI path element for this object. When not specified the objectName lowercase is the default value.""") +@cli_util.option('--operations', type=custom_types.CliCaseInsensitiveChoice(["READ", "WRITE"]), help=u"""The operations to limit access to this resource. If not specified then the default is [\"READ\",\"WRITE\"].""") +@cli_util.option('--security-schemes', type=custom_types.CliCaseInsensitiveChoice(["BASIC", "BEARER"]), help=u"""The security schemes that can access this resource. If not specified then the resource is public.""") +@cli_util.option('--scope', help=u"""The name of the database API gateway config privilege protecting the resource. Only valid for SCOPE JWT Profile pools and BEARER securitySchemes.""") +@cli_util.option('--roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The name of the database API gateway config roles protecting the resource. Only valid for RBAC JWT Profile pools and BEARER securitySchemes.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@json_skeleton_utils.get_cli_json_input_option({'roles': {'module': 'database_tools_runtime', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'roles': {'module': 'database_tools_runtime', 'class': 'list[string]'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec'}) +@cli_util.wrap_exceptions +def create_database_tools_database_api_gateway_config_pool_auto_api_spec(ctx, from_json, database_api_gateway_config_id, pool_key, type, display_name, database_object_name, database_object_type, description, alias, operations, security_schemes, scope, roles): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['type'] = type + _details['displayName'] = display_name + _details['databaseObjectName'] = database_object_name + _details['databaseObjectType'] = database_object_type + + if description is not None: + _details['description'] = description + + if alias is not None: + _details['alias'] = alias + + if operations is not None: + _details['operations'] = cli_util.parse_json_parameter("operations", operations) + + if security_schemes is not None: + _details['securitySchemes'] = cli_util.parse_json_parameter("security_schemes", security_schemes) + + if scope is not None: + _details['scope'] = scope + + if roles is not None: + _details['roles'] = cli_util.parse_json_parameter("roles", roles) + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_database_tools_database_api_gateway_config_pool_auto_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + create_database_tools_database_api_gateway_config_pool_auto_api_spec_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_auto_api_spec_group.command(name=cli_util.override('dbtools_runtime.create_database_tools_database_api_gateway_config_pool_auto_api_spec_create_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details.command_name', 'create-database-tools-database-api-gateway-config-pool-auto-api-spec-create-database-tools-database-api-gateway-config-pool-auto-api-spec-default-details'), help=u"""Create a Database Tools database API gateway config auto API spec resource \n[Command Reference](createDatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--database-object-name', required=True, help=u"""The name of the database object.""") +@cli_util.option('--database-object-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["FUNCTION", "MVIEW", "PACKAGE", "PROCEDURE", "TABLE", "VIEW", "DUALITYVIEW"]), help=u"""The type of the database object.""") +@cli_util.option('--description', help=u"""Description of the autoApiSpec.""") +@cli_util.option('--alias', help=u"""Used as the URI path element for this object. When not specified the objectName lowercase is the default value.""") +@cli_util.option('--operations', type=custom_types.CliCaseInsensitiveChoice(["READ", "WRITE"]), help=u"""The operations to limit access to this resource. If not specified then the default is [\"READ\",\"WRITE\"].""") +@cli_util.option('--security-schemes', type=custom_types.CliCaseInsensitiveChoice(["BASIC", "BEARER"]), help=u"""The security schemes that can access this resource. If not specified then the resource is public.""") +@cli_util.option('--scope', help=u"""The name of the database API gateway config privilege protecting the resource. Only valid for SCOPE JWT Profile pools and BEARER securitySchemes.""") +@cli_util.option('--roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The name of the database API gateway config roles protecting the resource. Only valid for RBAC JWT Profile pools and BEARER securitySchemes.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@json_skeleton_utils.get_cli_json_input_option({'roles': {'module': 'database_tools_runtime', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'roles': {'module': 'database_tools_runtime', 'class': 'list[string]'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec'}) +@cli_util.wrap_exceptions +def create_database_tools_database_api_gateway_config_pool_auto_api_spec_create_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details(ctx, from_json, database_api_gateway_config_id, pool_key, display_name, database_object_name, database_object_type, description, alias, operations, security_schemes, scope, roles): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key 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['databaseObjectName'] = database_object_name + _details['databaseObjectType'] = database_object_type + + if description is not None: + _details['description'] = description + + if alias is not None: + _details['alias'] = alias + + if operations is not None: + _details['operations'] = cli_util.parse_json_parameter("operations", operations) + + if security_schemes is not None: + _details['securitySchemes'] = cli_util.parse_json_parameter("security_schemes", security_schemes) + + if scope is not None: + _details['scope'] = scope + + if roles is not None: + _details['roles'] = cli_util.parse_json_parameter("roles", roles) + + _details['type'] = 'DEFAULT' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.create_database_tools_database_api_gateway_config_pool_auto_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + create_database_tools_database_api_gateway_config_pool_auto_api_spec_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_group.command(name=cli_util.override('dbtools_runtime.delete_credential.command_name', 'delete'), help=u"""Delete credential \n[Command Reference](deleteCredential)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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_credential(ctx, from_json, connection_id, credential_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.delete_credential( + database_tools_connection_id=connection_id, + credential_key=credential_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_execute_grantee_group.command(name=cli_util.override('dbtools_runtime.delete_credential_execute_grantee.command_name', 'delete'), help=u"""Delete execute grantee \n[Command Reference](deleteCredentialExecuteGrantee)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--execute-grantee-key', required=True, help=u"""The name of the user granted the EXECUTE privilege on the credential.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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_credential_execute_grantee(ctx, from_json, connection_id, credential_key, execute_grantee_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key cannot be whitespace or empty string') + + if isinstance(execute_grantee_key, six.string_types) and len(execute_grantee_key.strip()) == 0: + raise click.UsageError('Parameter --execute-grantee-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.delete_credential_execute_grantee( + database_tools_connection_id=connection_id, + credential_key=credential_key, + execute_grantee_key=execute_grantee_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_public_synonym_group.command(name=cli_util.override('dbtools_runtime.delete_credential_public_synonym.command_name', 'delete'), help=u"""Deletes the public synonym \n[Command Reference](deleteCredentialPublicSynonym)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--public-synonym-key', required=True, help=u"""The name of the public synonym for the credential""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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_credential_public_synonym(ctx, from_json, connection_id, credential_key, public_synonym_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key cannot be whitespace or empty string') + + if isinstance(public_synonym_key, six.string_types) and len(public_synonym_key.strip()) == 0: + raise click.UsageError('Parameter --public-synonym-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.delete_credential_public_synonym( + database_tools_connection_id=connection_id, + credential_key=credential_key, + public_synonym_key=public_synonym_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools_runtime.delete_database_tools_database_api_gateway_config_pool.command_name', 'delete-database-tools-database-api-gateway-config-pool'), help=u"""Deletes the specified Database Tools database API gateway config pool resource. \n[Command Reference](deleteDatabaseToolsDatabaseApiGatewayConfigPool)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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_database_tools_database_api_gateway_config_pool(ctx, from_json, database_api_gateway_config_id, pool_key, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.delete_database_tools_database_api_gateway_config_pool( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools_runtime.delete_database_tools_database_api_gateway_config_pool_api_spec.command_name', 'delete-database-tools-database-api-gateway-config-pool-api-spec'), help=u"""Deletes the specified Database Tools database API gateway config API spec resource. \n[Command Reference](deleteDatabaseToolsDatabaseApiGatewayConfigPoolApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--api-spec-key', required=True, help=u"""The key of the API spec config.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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_database_tools_database_api_gateway_config_pool_api_spec(ctx, from_json, database_api_gateway_config_id, pool_key, api_spec_key, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + if isinstance(api_spec_key, six.string_types) and len(api_spec_key.strip()) == 0: + raise click.UsageError('Parameter --api-spec-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.delete_database_tools_database_api_gateway_config_pool_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + api_spec_key=api_spec_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools_runtime.delete_database_tools_database_api_gateway_config_pool_auto_api_spec.command_name', 'delete-database-tools-database-api-gateway-config-pool-auto-api-spec'), help=u"""Deletes the specified Database Tools database API gateway config auto API spec resource. \n[Command Reference](deleteDatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--auto-api-spec-key', required=True, help=u"""The key of the auto API spec config.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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_database_tools_database_api_gateway_config_pool_auto_api_spec(ctx, from_json, database_api_gateway_config_id, pool_key, auto_api_spec_key, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + if isinstance(auto_api_spec_key, six.string_types) and len(auto_api_spec_key.strip()) == 0: + raise click.UsageError('Parameter --auto-api-spec-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.delete_database_tools_database_api_gateway_config_pool_auto_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + auto_api_spec_key=auto_api_spec_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.execute_sql_database_tools_connection.command_name', 'execute-sql'), help=u"""Execute statements on a database tools connection. \n[Command Reference](executeSqlDatabaseToolsConnection)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["SYNCHRONOUS", "ASYNCHRONOUS"]), help=u"""The request execution type.""") +@cli_util.option('--output-parameterconflict', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING"]), 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 WAITING 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({'output-parameterconflict': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlOutputDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'output-parameterconflict': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlOutputDetails'}}, output_type={'module': 'database_tools_runtime', 'class': 'ExecuteSqlResponse'}) +@cli_util.wrap_exceptions +def execute_sql_database_tools_connection(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, connection_id, type, output_parameterconflict, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['type'] = type + + if output_parameterconflict is not None: + _details['output'] = cli_util.parse_json_parameter("output_parameterconflict", output_parameterconflict) + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.execute_sql_database_tools_connection( + database_tools_connection_id=connection_id, + execute_sql_database_tools_connection_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.execute_sql_database_tools_connection_execute_sql_database_tools_connection_asynchronous_details.command_name', 'execute-sql-database-tools-connection-execute-sql-database-tools-connection-asynchronous-details'), help=u"""Execute statements on a database tools connection. \n[Command Reference](executeSqlDatabaseToolsConnection)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--input', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--output-parameterconflict', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--timeout-in-seconds', type=click.INT, help=u"""Maximum time in seconds allowed for the request to complete, measured from submission.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING"]), 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 WAITING 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({'output-parameterconflict': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlOutputDetails'}, 'input': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlAsynchronousInputDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'output-parameterconflict': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlOutputDetails'}, 'input': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlAsynchronousInputDetails'}}, output_type={'module': 'database_tools_runtime', 'class': 'ExecuteSqlResponse'}) +@cli_util.wrap_exceptions +def execute_sql_database_tools_connection_execute_sql_database_tools_connection_asynchronous_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, connection_id, input, output_parameterconflict, timeout_in_seconds, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['input'] = cli_util.parse_json_parameter("input", input) + + if output_parameterconflict is not None: + _details['output'] = cli_util.parse_json_parameter("output_parameterconflict", output_parameterconflict) + + if timeout_in_seconds is not None: + _details['timeoutInSeconds'] = timeout_in_seconds + + _details['type'] = 'ASYNCHRONOUS' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.execute_sql_database_tools_connection( + database_tools_connection_id=connection_id, + execute_sql_database_tools_connection_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.execute_sql_database_tools_connection_execute_sql_database_tools_connection_synchronous_details.command_name', 'execute-sql-database-tools-connection-execute-sql-database-tools-connection-synchronous-details'), help=u"""Execute statements on a database tools connection. \n[Command Reference](executeSqlDatabaseToolsConnection)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--input', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--output-parameterconflict', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING"]), 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 WAITING 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({'output-parameterconflict': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlOutputDetails'}, 'input': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlInputDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'output-parameterconflict': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlOutputDetails'}, 'input': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlInputDetails'}}, output_type={'module': 'database_tools_runtime', 'class': 'ExecuteSqlResponse'}) +@cli_util.wrap_exceptions +def execute_sql_database_tools_connection_execute_sql_database_tools_connection_synchronous_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, connection_id, input, output_parameterconflict, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['input'] = cli_util.parse_json_parameter("input", input) + + if output_parameterconflict is not None: + _details['output'] = cli_util.parse_json_parameter("output_parameterconflict", output_parameterconflict) + + _details['type'] = 'SYNCHRONOUS' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.execute_sql_database_tools_connection( + database_tools_connection_id=connection_id, + execute_sql_database_tools_connection_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.execute_sql_database_tools_connection_execute_sql_output_object_storage_details.command_name', 'execute-sql-database-tools-connection-execute-sql-output-object-storage-details'), help=u"""Execute statements on a database tools connection. \n[Command Reference](executeSqlDatabaseToolsConnection)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--output-object', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--output-result-disposition-templates', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defines how the result of commands in a script should be stored. If the command does not match any template filter, the result will be inline. + +This option is a JSON list with items of type ExecuteSqlOutputResultDispositionTemplate. For documentation on ExecuteSqlOutputResultDispositionTemplate please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/databasetoolsruntime/20230222/datatypes/ExecuteSqlOutputResultDispositionTemplate.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--output-time-of-deletion', type=custom_types.CLI_DATETIME, help=u"""The time when the object becomes eligible for deletion, expressed as an RFC 3339 date-time string.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING"]), 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 WAITING 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({'output-parameterconflict-result-disposition-templates': {'module': 'database_tools_runtime', 'class': 'list[ExecuteSqlOutputResultDispositionTemplate]'}, 'output-parameterconflict-object': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlObjectStorageLocation'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'output-parameterconflict-result-disposition-templates': {'module': 'database_tools_runtime', 'class': 'list[ExecuteSqlOutputResultDispositionTemplate]'}, 'output-parameterconflict-object': {'module': 'database_tools_runtime', 'class': 'ExecuteSqlObjectStorageLocation'}}, output_type={'module': 'database_tools_runtime', 'class': 'ExecuteSqlResponse'}) +@cli_util.wrap_exceptions +def execute_sql_database_tools_connection_execute_sql_output_object_storage_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, connection_id, output_object, if_match, output_result_disposition_templates, output_time_of_deletion): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['output'] = {} + _details['output']['object'] = cli_util.parse_json_parameter("output_object", output_object) + + if output_result_disposition_templates is not None: + _details['output']['resultDispositionTemplates'] = cli_util.parse_json_parameter("output_result_disposition_templates", output_result_disposition_templates) + + if output_time_of_deletion is not None: + _details['output']['timeOfDeletion'] = output_time_of_deletion + + _details['output']['type'] = 'OBJECT_STORAGE' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.execute_sql_database_tools_connection( + database_tools_connection_id=connection_id, + execute_sql_database_tools_connection_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) + + +@credential_group.command(name=cli_util.override('dbtools_runtime.get_credential.command_name', 'get'), help=u"""Get a credential \n[Command Reference](getCredential)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'Credential'}) +@cli_util.wrap_exceptions +def get_credential(ctx, from_json, connection_id, credential_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_credential( + database_tools_connection_id=connection_id, + credential_key=credential_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_execute_grantee_group.command(name=cli_util.override('dbtools_runtime.get_credential_execute_grantee.command_name', 'get'), help=u"""Get a credential execute grantee \n[Command Reference](getCredentialExecuteGrantee)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--execute-grantee-key', required=True, help=u"""The name of the user granted the EXECUTE privilege on the credential.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'CredentialExecuteGrantee'}) +@cli_util.wrap_exceptions +def get_credential_execute_grantee(ctx, from_json, connection_id, credential_key, execute_grantee_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key cannot be whitespace or empty string') + + if isinstance(execute_grantee_key, six.string_types) and len(execute_grantee_key.strip()) == 0: + raise click.UsageError('Parameter --execute-grantee-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_credential_execute_grantee( + database_tools_connection_id=connection_id, + credential_key=credential_key, + execute_grantee_key=execute_grantee_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_public_synonym_group.command(name=cli_util.override('dbtools_runtime.get_credential_public_synonym.command_name', 'get'), help=u"""Get a public synonym \n[Command Reference](getCredentialPublicSynonym)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--public-synonym-key', required=True, help=u"""The name of the public synonym for the credential""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'CredentialPublicSynonym'}) +@cli_util.wrap_exceptions +def get_credential_public_synonym(ctx, from_json, connection_id, credential_key, public_synonym_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key cannot be whitespace or empty string') + + if isinstance(public_synonym_key, six.string_types) and len(public_synonym_key.strip()) == 0: + raise click.UsageError('Parameter --public-synonym-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_credential_public_synonym( + database_tools_connection_id=connection_id, + credential_key=credential_key, + public_synonym_key=public_synonym_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools_runtime.get_database_tools_database_api_gateway_config_content.command_name', 'get-database-tools-database-api-gateway-config-content'), help=u"""Get the content of a Database Tools database API gateway config \n[Command Reference](getDatabaseToolsDatabaseApiGatewayConfigContent)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--file', type=click.File(mode='wb'), required=True, help="The name of the file that will receive the response data, or '-' to write to STDOUT.") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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={}) +@cli_util.wrap_exceptions +def get_database_tools_database_api_gateway_config_content(ctx, from_json, file, database_api_gateway_config_id, if_match, if_none_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_database_tools_database_api_gateway_config_content( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + **kwargs + ) + + # If outputting to stdout we don't want to print a progress bar because it will get mixed up with the output + # Also we need a non-zero Content-Length in order to display a meaningful progress bar + bar = None + if hasattr(file, 'name') and file.name != '' and 'Content-Length' in result.headers: + content_length = int(result.headers['Content-Length']) + if content_length > 0: + bar = click.progressbar(length=content_length, label='Downloading file') + + try: + if bar: + bar.__enter__() + + # TODO: Make the download size a configurable option + # use decode_content=True to automatically unzip service responses (this should be overridden for object storage) + for chunk in result.data.raw.stream(cli_constants.MEBIBYTE, decode_content=True): + if bar: + bar.update(len(chunk)) + file.write(chunk) + finally: + if bar: + bar.render_finish() + file.close() + + +@database_tools_database_api_gateway_config_global_group.command(name=cli_util.override('dbtools_runtime.get_database_tools_database_api_gateway_config_global.command_name', 'get'), help=u"""Get a Database Tools database API gateway config global resource \n[Command Reference](getDatabaseToolsDatabaseApiGatewayConfigGlobal)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--global-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["SETTINGS"]), help=u"""The key of the global config.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigGlobal'}) +@cli_util.wrap_exceptions +def get_database_tools_database_api_gateway_config_global(ctx, from_json, database_api_gateway_config_id, global_key, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(global_key, six.string_types) and len(global_key.strip()) == 0: + raise click.UsageError('Parameter --global-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_database_tools_database_api_gateway_config_global( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + global_key=global_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_group.command(name=cli_util.override('dbtools_runtime.get_database_tools_database_api_gateway_config_pool.command_name', 'get'), help=u"""Get a Database Tools database API gateway config pool resource \n[Command Reference](getDatabaseToolsDatabaseApiGatewayConfigPool)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPool'}) +@cli_util.wrap_exceptions +def get_database_tools_database_api_gateway_config_pool(ctx, from_json, database_api_gateway_config_id, pool_key, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_database_tools_database_api_gateway_config_pool( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_api_spec_group.command(name=cli_util.override('dbtools_runtime.get_database_tools_database_api_gateway_config_pool_api_spec.command_name', 'get'), help=u"""Get a Database Tools database API gateway config API spec resource \n[Command Reference](getDatabaseToolsDatabaseApiGatewayConfigPoolApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--api-spec-key', required=True, help=u"""The key of the API spec config.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolApiSpec'}) +@cli_util.wrap_exceptions +def get_database_tools_database_api_gateway_config_pool_api_spec(ctx, from_json, database_api_gateway_config_id, pool_key, api_spec_key, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + if isinstance(api_spec_key, six.string_types) and len(api_spec_key.strip()) == 0: + raise click.UsageError('Parameter --api-spec-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_database_tools_database_api_gateway_config_pool_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + api_spec_key=api_spec_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_auto_api_spec_group.command(name=cli_util.override('dbtools_runtime.get_database_tools_database_api_gateway_config_pool_auto_api_spec.command_name', 'get'), help=u"""Get a Database Tools database API gateway config auto API spec resource \n[Command Reference](getDatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--auto-api-spec-key', required=True, help=u"""The key of the auto API spec config.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec'}) +@cli_util.wrap_exceptions +def get_database_tools_database_api_gateway_config_pool_auto_api_spec(ctx, from_json, database_api_gateway_config_id, pool_key, auto_api_spec_key, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + if isinstance(auto_api_spec_key, six.string_types) and len(auto_api_spec_key.strip()) == 0: + raise click.UsageError('Parameter --auto-api-spec-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_database_tools_database_api_gateway_config_pool_auto_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + auto_api_spec_key=auto_api_spec_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@property_set_group.command(name=cli_util.override('dbtools_runtime.get_property_set.command_name', 'get'), help=u"""Get a property set \n[Command Reference](getPropertySet)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--property-set-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["APEX_DOCUMENT_GENERATOR", "APEX", "APEX_FA_INTEGRATION", "ORACLE_DATABASE_EXTERNAL_AUTHENTICATION"]), help=u"""The name of the property set""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'PropertySet'}) +@cli_util.wrap_exceptions +def get_property_set(ctx, from_json, connection_id, property_set_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(property_set_key, six.string_types) and len(property_set_key.strip()) == 0: + raise click.UsageError('Parameter --property-set-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_property_set( + database_tools_connection_id=connection_id, + property_set_key=property_set_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@user_credential_group.command(name=cli_util.override('dbtools_runtime.get_user_credential.command_name', 'get'), help=u"""Get a user credential \n[Command Reference](getUserCredential)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--user-key', required=True, help=u"""The name of the database user.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'UserCredential'}) +@cli_util.wrap_exceptions +def get_user_credential(ctx, from_json, connection_id, user_key, credential_key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(user_key, six.string_types) and len(user_key.strip()) == 0: + raise click.UsageError('Parameter --user-key cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key 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('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_user_credential( + database_tools_connection_id=connection_id, + user_key=user_key, + credential_key=credential_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_group.command(name=cli_util.override('dbtools_runtime.get_work_request.command_name', 'get'), help=u"""Gets the status of the specified work request. \n[Command Reference](getWorkRequest)""") +@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools_runtime', 'class': 'WorkRequest'}) +@cli_util.wrap_exceptions +def get_work_request(ctx, from_json, work_request_id): + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.get_work_request( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_execute_grantee_collection_group.command(name=cli_util.override('dbtools_runtime.list_credential_execute_grantees.command_name', 'list-credential-execute-grantees'), help=u"""Get a list of all execute grantees \n[Command Reference](listCredentialExecuteGrantees)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 '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': 'database_tools_runtime', 'class': 'CredentialExecuteGranteeCollection'}) +@cli_util.wrap_exceptions +def list_credential_execute_grantees(ctx, from_json, all_pages, page_size, connection_id, credential_key, if_match, limit, page, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_credential_execute_grantees, + database_tools_connection_id=connection_id, + credential_key=credential_key, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_credential_execute_grantees, + limit, + page_size, + database_tools_connection_id=connection_id, + credential_key=credential_key, + **kwargs + ) + else: + result = client.list_credential_execute_grantees( + database_tools_connection_id=connection_id, + credential_key=credential_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_public_synonym_collection_group.command(name=cli_util.override('dbtools_runtime.list_credential_public_synonyms.command_name', 'list-credential-public-synonyms'), help=u"""Get a list of all public synonyms for the given credential \n[Command Reference](listCredentialPublicSynonyms)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 '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': 'database_tools_runtime', 'class': 'CredentialPublicSynonymCollection'}) +@cli_util.wrap_exceptions +def list_credential_public_synonyms(ctx, from_json, all_pages, page_size, connection_id, credential_key, if_match, limit, page, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_credential_public_synonyms, + database_tools_connection_id=connection_id, + credential_key=credential_key, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_credential_public_synonyms, + limit, + page_size, + database_tools_connection_id=connection_id, + credential_key=credential_key, + **kwargs + ) + else: + result = client.list_credential_public_synonyms( + database_tools_connection_id=connection_id, + credential_key=credential_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_collection_group.command(name=cli_util.override('dbtools_runtime.list_credentials.command_name', 'list-credentials'), help=u"""Returns a paginated list of `CredentialSummary` for the specified request. \n[Command Reference](listCredentials)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 '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': 'database_tools_runtime', 'class': 'CredentialCollection'}) +@cli_util.wrap_exceptions +def list_credentials(ctx, from_json, all_pages, page_size, connection_id, if_match, limit, page, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_credentials, + database_tools_connection_id=connection_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_credentials, + limit, + page_size, + database_tools_connection_id=connection_id, + **kwargs + ) + else: + result = client.list_credentials( + database_tools_connection_id=connection_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_advanced_property_summary_group.command(name=cli_util.override('dbtools_runtime.list_database_tools_database_api_gateway_config_advanced_properties.command_name', 'list-database-tools-database-api-gateway-config-advanced-properties'), help=u"""Returns list of database API gateway config setting descriptions to be provided as advanced properties. \n[Command Reference](listDatabaseToolsDatabaseApiGatewayConfigAdvancedProperties)""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigAdvancedPropertySummaryCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_database_api_gateway_config_advanced_properties(ctx, from_json, all_pages, ): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.list_database_tools_database_api_gateway_config_advanced_properties( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools_runtime.list_database_tools_database_api_gateway_config_pool_api_specs.command_name', 'list-database-tools-database-api-gateway-config-pool-api-specs'), help=u"""Returns a list of Database Tools database API gateway config API spec resources \n[Command Reference](listDatabaseToolsDatabaseApiGatewayConfigPoolApiSpecs)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolApiSpecCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_database_api_gateway_config_pool_api_specs(ctx, from_json, all_pages, page_size, database_api_gateway_config_id, pool_key, display_name, 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') + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + kwargs = {} + if display_name is not None: + kwargs['display_name'] = display_name + 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('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_database_api_gateway_config_pool_api_specs, + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_database_api_gateway_config_pool_api_specs, + limit, + page_size, + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + **kwargs + ) + else: + result = client.list_database_tools_database_api_gateway_config_pool_api_specs( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools_runtime.list_database_tools_database_api_gateway_config_pool_auto_api_specs.command_name', 'list-database-tools-database-api-gateway-config-pool-auto-api-specs'), help=u"""Returns a list of Database Tools database API gateway config auto API spec resources \n[Command Reference](listDatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpecs)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpecCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_database_api_gateway_config_pool_auto_api_specs(ctx, from_json, all_pages, page_size, database_api_gateway_config_id, pool_key, display_name, 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') + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + kwargs = {} + if display_name is not None: + kwargs['display_name'] = display_name + 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('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_database_api_gateway_config_pool_auto_api_specs, + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_database_api_gateway_config_pool_auto_api_specs, + limit, + page_size, + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + **kwargs + ) + else: + result = client.list_database_tools_database_api_gateway_config_pool_auto_api_specs( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_group.command(name=cli_util.override('dbtools_runtime.list_database_tools_database_api_gateway_config_pools.command_name', 'list-database-tools-database-api-gateway-config-pools'), help=u"""Returns a list of Database Tools database API gateway config pool resources \n[Command Reference](listDatabaseToolsDatabaseApiGatewayConfigPools)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire specified display name.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolCollection'}) +@cli_util.wrap_exceptions +def list_database_tools_database_api_gateway_config_pools(ctx, from_json, all_pages, page_size, database_api_gateway_config_id, display_name, 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') + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + kwargs = {} + if display_name is not None: + kwargs['display_name'] = display_name + 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('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_database_tools_database_api_gateway_config_pools, + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_database_tools_database_api_gateway_config_pools, + limit, + page_size, + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + **kwargs + ) + else: + result = client.list_database_tools_database_api_gateway_config_pools( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@user_credential_collection_group.command(name=cli_util.override('dbtools_runtime.list_user_credentials.command_name', 'list-user-credentials'), help=u"""Returns a paginated list of user `UserCredentialSummary` for the specified request. \n[Command Reference](listUserCredentials)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--user-key', required=True, help=u"""The name of the database user.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@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 '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': 'database_tools_runtime', 'class': 'UserCredentialCollection'}) +@cli_util.wrap_exceptions +def list_user_credentials(ctx, from_json, all_pages, page_size, connection_id, user_key, if_match, limit, page, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(user_key, six.string_types) and len(user_key.strip()) == 0: + raise click.UsageError('Parameter --user-key cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_user_credentials, + database_tools_connection_id=connection_id, + user_key=user_key, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_user_credentials, + limit, + page_size, + database_tools_connection_id=connection_id, + user_key=user_key, + **kwargs + ) + else: + result = client.list_user_credentials( + database_tools_connection_id=connection_id, + user_key=user_key, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_error_group.command(name=cli_util.override('dbtools_runtime.list_work_request_errors.command_name', 'list'), help=u"""Returns a paginated list of errors for the specified work request. \n[Command Reference](listWorkRequestErrors)""") +@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@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('--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': 'database_tools_runtime', 'class': 'WorkRequestErrorCollection'}) +@cli_util.wrap_exceptions +def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_id, sort_order, sort_by, page, limit): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_request_errors, + work_request_id=work_request_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_work_request_errors, + limit, + page_size, + work_request_id=work_request_id, + **kwargs + ) + else: + result = client.list_work_request_errors( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_log_entry_group.command(name=cli_util.override('dbtools_runtime.list_work_request_logs.command_name', 'list-work-request-logs'), help=u"""Returns a paginated list of logs for the specified work request. \n[Command Reference](listWorkRequestLogs)""") +@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending. If no value is specified timeCreated is default.""") +@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('--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': 'database_tools_runtime', 'class': 'WorkRequestLogEntryCollection'}) +@cli_util.wrap_exceptions +def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id, sort_order, sort_by, page, limit): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_request_logs, + work_request_id=work_request_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_work_request_logs, + limit, + page_size, + work_request_id=work_request_id, + **kwargs + ) + else: + result = client.list_work_request_logs( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_group.command(name=cli_util.override('dbtools_runtime.list_work_requests.command_name', 'list'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listWorkRequests)""") +@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--resource-identifier', help=u"""The [OCID] of the resource.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'asc' or 'desc'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted", "timeUpdated", "timeFinished"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeAccepted is descending. If no value is specified timeAccepted is default.""") +@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('--operation-type', type=custom_types.CliCaseInsensitiveChoice(["EXECUTE_SQL"]), multiple=True, help=u"""The work request operation type.""") +@cli_util.option('--created-by-principal-id', help=u"""A filter to return only work requests initiated by the specified principal OCID.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED", "WAITING"]), multiple=True, help=u"""A filter to return only work requests with one of the specified status values.""") +@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': 'database_tools_runtime', 'class': 'WorkRequestCollection'}) +@cli_util.wrap_exceptions +def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, resource_identifier, sort_order, sort_by, page, limit, operation_type, created_by_principal_id, status): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if resource_identifier is not None: + kwargs['resource_identifier'] = resource_identifier + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + if operation_type is not None and len(operation_type) > 0: + kwargs['operation_type'] = operation_type + if created_by_principal_id is not None: + kwargs['created_by_principal_id'] = created_by_principal_id + if status is not None and len(status) > 0: + kwargs['status'] = status + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_requests, + compartment_id=compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + 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) + + +@credential_group.command(name=cli_util.override('dbtools_runtime.update_credential.command_name', 'update'), help=u"""Update a credential \n[Command Reference](updateCredential)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["BASIC"]), help=u"""The type of credential.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'Credential'}) +@cli_util.wrap_exceptions +def update_credential(ctx, from_json, connection_id, credential_key, type, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key 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['type'] = type + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_credential( + database_tools_connection_id=connection_id, + credential_key=credential_key, + update_credential_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@credential_group.command(name=cli_util.override('dbtools_runtime.update_credential_update_credential_basic_details.command_name', 'update-credential-update-credential-basic-details'), help=u"""Update a credential \n[Command Reference](updateCredential)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--credential-key', required=True, help=u"""The name of the credential""") +@cli_util.option('--user-name', help=u"""The username for the new credential.""") +@cli_util.option('--password', help=u"""The password for the new credential.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'Credential'}) +@cli_util.wrap_exceptions +def update_credential_update_credential_basic_details(ctx, from_json, connection_id, credential_key, user_name, password, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(credential_key, six.string_types) and len(credential_key.strip()) == 0: + raise click.UsageError('Parameter --credential-key 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 user_name is not None: + _details['userName'] = user_name + + if password is not None: + _details['password'] = password + + _details['type'] = 'BASIC' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_credential( + database_tools_connection_id=connection_id, + credential_key=credential_key, + update_credential_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_global_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_global.command_name', 'update'), help=u"""Update a Database Tools database API gateway config global resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigGlobal)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--global-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["SETTINGS"]), help=u"""The key of the global config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The type of the Database Tools database API gateway config global settings resource.""") +@cli_util.option('--pool-route', type=custom_types.CliCaseInsensitiveChoice(["PATH", "HEADER"]), help=u"""How the target pool route value is determined for a HTTP request.""") +@cli_util.option('--pool-routing-header', help=u"""The request header name providing the pool route value.""") +@cli_util.option('--database-api-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""ORDS database API is a database management and monitoring REST API. Database Actions requires this feature.""") +@cli_util.option('--http-port', type=click.INT, help=u"""Specifies the HTTP listen port. 0 disables HTTP. Use of ports below 1024 requires elevated (root) privileges and is generally discouraged; deployment on non-privileged ports (1024\u201365535) is recommended.""") +@cli_util.option('--https-port', type=click.INT, help=u"""Specifies the HTTPS listen port. 0 disables HTTPS. Use of ports below 1024 requires elevated (root) privileges and is generally discouraged; deployment on non-privileged ports (1024\u201365535) is recommended. ORDS will use a self-signed certificate if a certificate bundle is not provided.""") +@cli_util.option('--certificate-bundle', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--document-root', help=u"""The location of the static resources to be served under the / root server path.""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Advanced global properties.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'certificate-bundle': {'module': 'database_tools_runtime', 'class': 'DatabaseApiGatewayConfigCertificateBundle'}, 'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'certificate-bundle': {'module': 'database_tools_runtime', 'class': 'DatabaseApiGatewayConfigCertificateBundle'}, 'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigGlobal'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_global(ctx, from_json, force, database_api_gateway_config_id, global_key, type, pool_route, pool_routing_header, database_api_status, http_port, https_port, certificate_bundle, document_root, advanced_properties, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(global_key, six.string_types) and len(global_key.strip()) == 0: + raise click.UsageError('Parameter --global-key cannot be whitespace or empty string') + if not force: + if certificate_bundle or advanced_properties: + if not click.confirm("WARNING: Updates to certificate-bundle and advanced-properties 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['type'] = type + + if pool_route is not None: + _details['poolRoute'] = pool_route + + if pool_routing_header is not None: + _details['poolRoutingHeader'] = pool_routing_header + + if database_api_status is not None: + _details['databaseApiStatus'] = database_api_status + + if http_port is not None: + _details['httpPort'] = http_port + + if https_port is not None: + _details['httpsPort'] = https_port + + if certificate_bundle is not None: + _details['certificateBundle'] = cli_util.parse_json_parameter("certificate_bundle", certificate_bundle) + + if document_root is not None: + _details['documentRoot'] = document_root + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_global( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + global_key=global_key, + update_database_tools_database_api_gateway_config_global_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_global_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_global_update_database_tools_database_api_gateway_config_global_default_details.command_name', 'update-database-tools-database-api-gateway-config-global-update-database-tools-database-api-gateway-config-global-default-details'), help=u"""Update a Database Tools database API gateway config global resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigGlobal)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--global-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["SETTINGS"]), help=u"""The key of the global config.""") +@cli_util.option('--pool-route', type=custom_types.CliCaseInsensitiveChoice(["PATH", "HEADER"]), help=u"""How the target pool route value is determined for a HTTP request.""") +@cli_util.option('--pool-routing-header', help=u"""The request header name providing the pool route value.""") +@cli_util.option('--database-api-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""ORDS database API is a database management and monitoring REST API. Database Actions requires this feature.""") +@cli_util.option('--http-port', type=click.INT, help=u"""Specifies the HTTP listen port. 0 disables HTTP. Use of ports below 1024 requires elevated (root) privileges and is generally discouraged; deployment on non-privileged ports (1024\u201365535) is recommended.""") +@cli_util.option('--https-port', type=click.INT, help=u"""Specifies the HTTPS listen port. 0 disables HTTPS. Use of ports below 1024 requires elevated (root) privileges and is generally discouraged; deployment on non-privileged ports (1024\u201365535) is recommended. ORDS will use a self-signed certificate if a certificate bundle is not provided.""") +@cli_util.option('--certificate-bundle', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--document-root', help=u"""The location of the static resources to be served under the / root server path.""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Advanced global properties.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'certificate-bundle': {'module': 'database_tools_runtime', 'class': 'DatabaseApiGatewayConfigCertificateBundle'}, 'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'certificate-bundle': {'module': 'database_tools_runtime', 'class': 'DatabaseApiGatewayConfigCertificateBundle'}, 'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigGlobal'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_global_update_database_tools_database_api_gateway_config_global_default_details(ctx, from_json, force, database_api_gateway_config_id, global_key, pool_route, pool_routing_header, database_api_status, http_port, https_port, certificate_bundle, document_root, advanced_properties, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(global_key, six.string_types) and len(global_key.strip()) == 0: + raise click.UsageError('Parameter --global-key cannot be whitespace or empty string') + if not force: + if certificate_bundle or advanced_properties: + if not click.confirm("WARNING: Updates to certificate-bundle and advanced-properties 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 pool_route is not None: + _details['poolRoute'] = pool_route + + if pool_routing_header is not None: + _details['poolRoutingHeader'] = pool_routing_header + + if database_api_status is not None: + _details['databaseApiStatus'] = database_api_status + + if http_port is not None: + _details['httpPort'] = http_port + + if https_port is not None: + _details['httpsPort'] = https_port + + if certificate_bundle is not None: + _details['certificateBundle'] = cli_util.parse_json_parameter("certificate_bundle", certificate_bundle) + + if document_root is not None: + _details['documentRoot'] = document_root + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + _details['type'] = 'DEFAULT' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_global( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + global_key=global_key, + update_database_tools_database_api_gateway_config_global_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_global_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_global_database_api_gateway_config_certificate_bundle_file_name.command_name', 'update-database-tools-database-api-gateway-config-global-database-api-gateway-config-certificate-bundle-file-name'), help=u"""Update a Database Tools database API gateway config global resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigGlobal)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--global-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["SETTINGS"]), help=u"""The key of the global config.""") +@cli_util.option('--pool-route', type=custom_types.CliCaseInsensitiveChoice(["PATH", "HEADER"]), help=u"""How the target pool route value is determined for a HTTP request.""") +@cli_util.option('--pool-routing-header', help=u"""The request header name providing the pool route value.""") +@cli_util.option('--database-api-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""ORDS database API is a database management and monitoring REST API. Database Actions requires this feature.""") +@cli_util.option('--http-port', type=click.INT, help=u"""Specifies the HTTP listen port. 0 disables HTTP. Use of ports below 1024 requires elevated (root) privileges and is generally discouraged; deployment on non-privileged ports (1024\u201365535) is recommended.""") +@cli_util.option('--https-port', type=click.INT, help=u"""Specifies the HTTPS listen port. 0 disables HTTPS. Use of ports below 1024 requires elevated (root) privileges and is generally discouraged; deployment on non-privileged ports (1024\u201365535) is recommended. ORDS will use a self-signed certificate if a certificate bundle is not provided.""") +@cli_util.option('--document-root', help=u"""The location of the static resources to be served under the / root server path.""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Advanced global properties.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--certificate-bundle-certificate-public', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--certificate-bundle-certificate-private-key', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}, 'certificate-bundle-certificate-public': {'module': 'database_tools_runtime', 'class': 'DatabaseApiGatewayConfigCertificatePublicFileName'}, 'certificate-bundle-certificate-private-key': {'module': 'database_tools_runtime', 'class': 'DatabaseApiGatewayConfigCertificatePrivateKeyFileName'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}, 'certificate-bundle-certificate-public': {'module': 'database_tools_runtime', 'class': 'DatabaseApiGatewayConfigCertificatePublicFileName'}, 'certificate-bundle-certificate-private-key': {'module': 'database_tools_runtime', 'class': 'DatabaseApiGatewayConfigCertificatePrivateKeyFileName'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigGlobal'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_global_database_api_gateway_config_certificate_bundle_file_name(ctx, from_json, force, database_api_gateway_config_id, global_key, pool_route, pool_routing_header, database_api_status, http_port, https_port, document_root, advanced_properties, if_match, certificate_bundle_certificate_public, certificate_bundle_certificate_private_key): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(global_key, six.string_types) and len(global_key.strip()) == 0: + raise click.UsageError('Parameter --global-key cannot be whitespace or empty string') + if not force: + if advanced_properties: + if not click.confirm("WARNING: Updates to advanced-properties 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['certificateBundle'] = {} + + if pool_route is not None: + _details['poolRoute'] = pool_route + + if pool_routing_header is not None: + _details['poolRoutingHeader'] = pool_routing_header + + if database_api_status is not None: + _details['databaseApiStatus'] = database_api_status + + if http_port is not None: + _details['httpPort'] = http_port + + if https_port is not None: + _details['httpsPort'] = https_port + + if document_root is not None: + _details['documentRoot'] = document_root + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + if certificate_bundle_certificate_public is not None: + _details['certificateBundle']['certificatePublic'] = cli_util.parse_json_parameter("certificate_bundle_certificate_public", certificate_bundle_certificate_public) + + if certificate_bundle_certificate_private_key is not None: + _details['certificateBundle']['certificatePrivateKey'] = cli_util.parse_json_parameter("certificate_bundle_certificate_private_key", certificate_bundle_certificate_private_key) + + _details['certificateBundle']['type'] = 'FILENAME' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_global( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + global_key=global_key, + update_database_tools_database_api_gateway_config_global_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_global_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_global_database_api_gateway_config_certificate_bundle_self_signed.command_name', 'update-database-tools-database-api-gateway-config-global-database-api-gateway-config-certificate-bundle-self-signed'), help=u"""Update a Database Tools database API gateway config global resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigGlobal)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--global-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["SETTINGS"]), help=u"""The key of the global config.""") +@cli_util.option('--pool-route', type=custom_types.CliCaseInsensitiveChoice(["PATH", "HEADER"]), help=u"""How the target pool route value is determined for a HTTP request.""") +@cli_util.option('--pool-routing-header', help=u"""The request header name providing the pool route value.""") +@cli_util.option('--database-api-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""ORDS database API is a database management and monitoring REST API. Database Actions requires this feature.""") +@cli_util.option('--http-port', type=click.INT, help=u"""Specifies the HTTP listen port. 0 disables HTTP. Use of ports below 1024 requires elevated (root) privileges and is generally discouraged; deployment on non-privileged ports (1024\u201365535) is recommended.""") +@cli_util.option('--https-port', type=click.INT, help=u"""Specifies the HTTPS listen port. 0 disables HTTPS. Use of ports below 1024 requires elevated (root) privileges and is generally discouraged; deployment on non-privileged ports (1024\u201365535) is recommended. ORDS will use a self-signed certificate if a certificate bundle is not provided.""") +@cli_util.option('--document-root', help=u"""The location of the static resources to be served under the / root server path.""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Advanced global properties.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigGlobal'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_global_database_api_gateway_config_certificate_bundle_self_signed(ctx, from_json, force, database_api_gateway_config_id, global_key, pool_route, pool_routing_header, database_api_status, http_port, https_port, document_root, advanced_properties, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(global_key, six.string_types) and len(global_key.strip()) == 0: + raise click.UsageError('Parameter --global-key cannot be whitespace or empty string') + if not force: + if advanced_properties: + if not click.confirm("WARNING: Updates to advanced-properties 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['certificateBundle'] = {} + + if pool_route is not None: + _details['poolRoute'] = pool_route + + if pool_routing_header is not None: + _details['poolRoutingHeader'] = pool_routing_header + + if database_api_status is not None: + _details['databaseApiStatus'] = database_api_status + + if http_port is not None: + _details['httpPort'] = http_port + + if https_port is not None: + _details['httpsPort'] = https_port + + if document_root is not None: + _details['documentRoot'] = document_root + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + _details['certificateBundle']['type'] = 'SELF_SIGNED' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_global( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + global_key=global_key, + update_database_tools_database_api_gateway_config_global_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_pool.command_name', 'update'), help=u"""Update a Database Tools database API gateway config pool resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigPool)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The type of the Database Tools database API gateway config pool sub resource.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--pool-route-value', help=u"""The pool route value provided in requests to target this pool.""") +@cli_util.option('--database-tools-connection-id', help=u"""The [OCID] of the related Database Tools connection. Specifies the OCI database tools connection ocid to build the connection pool from.""") +@cli_util.option('--max-pool-size', type=click.INT, help=u"""Specifies the maximum number of database connections allowed for the pool.""") +@cli_util.option('--min-pool-size', type=click.INT, help=u"""Specifies the minimum number of database connections allowed for the pool.""") +@cli_util.option('--initial-pool-size', type=click.INT, help=u"""Specifies the initial size for the number of database connections that will be created for the pool.""") +@cli_util.option('--jwt-profile-jwk-url', help=u"""Specifies the URL of the JSON Web Key (JWK) that is used to verify the signature of the JWT token.""") +@cli_util.option('--jwt-profile-issuer', help=u"""Specifies the issuer of the JWT token. This value is used to validate the iss claim in the JWT token.""") +@cli_util.option('--jwt-profile-audience', help=u"""Specifies the expected audience for the JWT token. This value is used to validate the aud claim in the JWT token.""") +@cli_util.option('--jwt-profile-role-claim-name', help=u"""Specifies the JSON pointer to the claim in the JWT token that contains the roles of the users.""") +@cli_util.option('--database-actions-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""Specifies to enable the Database Actions feature.""") +@cli_util.option('--rest-enabled-sql-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""Specifies whether the REST-Enabled SQL service is active.""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Advanced pool properties.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPool'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_pool(ctx, from_json, force, database_api_gateway_config_id, pool_key, type, display_name, pool_route_value, database_tools_connection_id, max_pool_size, min_pool_size, initial_pool_size, jwt_profile_jwk_url, jwt_profile_issuer, jwt_profile_audience, jwt_profile_role_claim_name, database_actions_status, rest_enabled_sql_status, advanced_properties, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + if not force: + if advanced_properties: + if not click.confirm("WARNING: Updates to advanced-properties 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['type'] = type + + if display_name is not None: + _details['displayName'] = display_name + + if pool_route_value is not None: + _details['poolRouteValue'] = pool_route_value + + if database_tools_connection_id is not None: + _details['databaseToolsConnectionId'] = database_tools_connection_id + + if max_pool_size is not None: + _details['maxPoolSize'] = max_pool_size + + if min_pool_size is not None: + _details['minPoolSize'] = min_pool_size + + if initial_pool_size is not None: + _details['initialPoolSize'] = initial_pool_size + + if jwt_profile_jwk_url is not None: + _details['jwtProfileJwkUrl'] = jwt_profile_jwk_url + + if jwt_profile_issuer is not None: + _details['jwtProfileIssuer'] = jwt_profile_issuer + + if jwt_profile_audience is not None: + _details['jwtProfileAudience'] = jwt_profile_audience + + if jwt_profile_role_claim_name is not None: + _details['jwtProfileRoleClaimName'] = jwt_profile_role_claim_name + + if database_actions_status is not None: + _details['databaseActionsStatus'] = database_actions_status + + if rest_enabled_sql_status is not None: + _details['restEnabledSqlStatus'] = rest_enabled_sql_status + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_pool( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + update_database_tools_database_api_gateway_config_pool_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_pool_update_database_tools_database_api_gateway_config_pool_default_details.command_name', 'update-database-tools-database-api-gateway-config-pool-update-database-tools-database-api-gateway-config-pool-default-details'), help=u"""Update a Database Tools database API gateway config pool resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigPool)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--pool-route-value', help=u"""The pool route value provided in requests to target this pool.""") +@cli_util.option('--database-tools-connection-id', help=u"""The [OCID] of the related Database Tools connection. Specifies the OCI database tools connection ocid to build the connection pool from.""") +@cli_util.option('--max-pool-size', type=click.INT, help=u"""Specifies the maximum number of database connections allowed for the pool.""") +@cli_util.option('--min-pool-size', type=click.INT, help=u"""Specifies the minimum number of database connections allowed for the pool.""") +@cli_util.option('--initial-pool-size', type=click.INT, help=u"""Specifies the initial size for the number of database connections that will be created for the pool.""") +@cli_util.option('--jwt-profile-jwk-url', help=u"""Specifies the URL of the JSON Web Key (JWK) that is used to verify the signature of the JWT token.""") +@cli_util.option('--jwt-profile-issuer', help=u"""Specifies the issuer of the JWT token. This value is used to validate the iss claim in the JWT token.""") +@cli_util.option('--jwt-profile-audience', help=u"""Specifies the expected audience for the JWT token. This value is used to validate the aud claim in the JWT token.""") +@cli_util.option('--jwt-profile-role-claim-name', help=u"""Specifies the JSON pointer to the claim in the JWT token that contains the roles of the users.""") +@cli_util.option('--database-actions-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""Specifies to enable the Database Actions feature.""") +@cli_util.option('--rest-enabled-sql-status', type=custom_types.CliCaseInsensitiveChoice(["ENABLED", "DISABLED"]), help=u"""Specifies whether the REST-Enabled SQL service is active.""") +@cli_util.option('--advanced-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Advanced pool properties.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'advanced-properties': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPool'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_pool_update_database_tools_database_api_gateway_config_pool_default_details(ctx, from_json, force, database_api_gateway_config_id, pool_key, display_name, pool_route_value, database_tools_connection_id, max_pool_size, min_pool_size, initial_pool_size, jwt_profile_jwk_url, jwt_profile_issuer, jwt_profile_audience, jwt_profile_role_claim_name, database_actions_status, rest_enabled_sql_status, advanced_properties, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + if not force: + if advanced_properties: + if not click.confirm("WARNING: Updates to advanced-properties 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 pool_route_value is not None: + _details['poolRouteValue'] = pool_route_value + + if database_tools_connection_id is not None: + _details['databaseToolsConnectionId'] = database_tools_connection_id + + if max_pool_size is not None: + _details['maxPoolSize'] = max_pool_size + + if min_pool_size is not None: + _details['minPoolSize'] = min_pool_size + + if initial_pool_size is not None: + _details['initialPoolSize'] = initial_pool_size + + if jwt_profile_jwk_url is not None: + _details['jwtProfileJwkUrl'] = jwt_profile_jwk_url + + if jwt_profile_issuer is not None: + _details['jwtProfileIssuer'] = jwt_profile_issuer + + if jwt_profile_audience is not None: + _details['jwtProfileAudience'] = jwt_profile_audience + + if jwt_profile_role_claim_name is not None: + _details['jwtProfileRoleClaimName'] = jwt_profile_role_claim_name + + if database_actions_status is not None: + _details['databaseActionsStatus'] = database_actions_status + + if rest_enabled_sql_status is not None: + _details['restEnabledSqlStatus'] = rest_enabled_sql_status + + if advanced_properties is not None: + _details['advancedProperties'] = cli_util.parse_json_parameter("advanced_properties", advanced_properties) + + _details['type'] = 'DEFAULT' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_pool( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + update_database_tools_database_api_gateway_config_pool_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_api_spec_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_pool_api_spec.command_name', 'update'), help=u"""Update a Database Tools database API gateway config API spec resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigPoolApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--api-spec-key', required=True, help=u"""The key of the API spec config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The type of the Database Tools database API gateway config API spec sub resource.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--content', help=u"""The content of a string-escaped Open API spec in JSON format.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolApiSpec'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_pool_api_spec(ctx, from_json, database_api_gateway_config_id, pool_key, api_spec_key, type, display_name, content, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + if isinstance(api_spec_key, six.string_types) and len(api_spec_key.strip()) == 0: + raise click.UsageError('Parameter --api-spec-key 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['type'] = type + + if display_name is not None: + _details['displayName'] = display_name + + if content is not None: + _details['content'] = content + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_pool_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + api_spec_key=api_spec_key, + update_database_tools_database_api_gateway_config_pool_api_spec_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_api_spec_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_pool_api_spec_update_database_tools_database_api_gateway_config_pool_api_spec_default_details.command_name', 'update-database-tools-database-api-gateway-config-pool-api-spec-update-database-tools-database-api-gateway-config-pool-api-spec-default-details'), help=u"""Update a Database Tools database API gateway config API spec resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigPoolApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--api-spec-key', required=True, help=u"""The key of the API spec config.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--content', help=u"""The content of a string-escaped Open API spec in JSON format.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolApiSpec'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_pool_api_spec_update_database_tools_database_api_gateway_config_pool_api_spec_default_details(ctx, from_json, database_api_gateway_config_id, pool_key, api_spec_key, display_name, content, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + if isinstance(api_spec_key, six.string_types) and len(api_spec_key.strip()) == 0: + raise click.UsageError('Parameter --api-spec-key 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 display_name is not None: + _details['displayName'] = display_name + + if content is not None: + _details['content'] = content + + _details['type'] = 'DEFAULT' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_pool_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + api_spec_key=api_spec_key, + update_database_tools_database_api_gateway_config_pool_api_spec_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_auto_api_spec_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_pool_auto_api_spec.command_name', 'update'), help=u"""Update a Database Tools database API gateway config auto API spec resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--auto-api-spec-key', required=True, help=u"""The key of the auto API spec config.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The type of the Database Tools database API gateway config auto API spec sub resource.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--database-object-name', help=u"""The name of the database object.""") +@cli_util.option('--database-object-type', type=custom_types.CliCaseInsensitiveChoice(["FUNCTION", "MVIEW", "PACKAGE", "PROCEDURE", "TABLE", "VIEW", "DUALITYVIEW"]), help=u"""The type of the database object.""") +@cli_util.option('--description', help=u"""Description of the autoApiSpec.""") +@cli_util.option('--alias', help=u"""Used as the URI path element for this object. When not specified the objectName lowercase is the default value.""") +@cli_util.option('--operations', type=custom_types.CliCaseInsensitiveChoice(["READ", "WRITE"]), help=u"""The operations to limit access to this resource. If not specified then the default is [\"READ\",\"WRITE\"].""") +@cli_util.option('--security-schemes', type=custom_types.CliCaseInsensitiveChoice(["BASIC", "BEARER"]), help=u"""The security schemes that can access this resource. If not specified then the resource is public.""") +@cli_util.option('--scope', help=u"""The name of the database API gateway config privilege protecting the resource. Only valid for SCOPE JWT Profile pools and BEARER securitySchemes.""") +@cli_util.option('--roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The name of the database API gateway config roles protecting the resource. Only valid for RBAC JWT Profile pools and BEARER securitySchemes.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'roles': {'module': 'database_tools_runtime', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'roles': {'module': 'database_tools_runtime', 'class': 'list[string]'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_pool_auto_api_spec(ctx, from_json, force, database_api_gateway_config_id, pool_key, auto_api_spec_key, type, display_name, database_object_name, database_object_type, description, alias, operations, security_schemes, scope, roles, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + if isinstance(auto_api_spec_key, six.string_types) and len(auto_api_spec_key.strip()) == 0: + raise click.UsageError('Parameter --auto-api-spec-key cannot be whitespace or empty string') + if not force: + if operations or security_schemes or roles: + if not click.confirm("WARNING: Updates to operations and security-schemes and roles 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['type'] = type + + if display_name is not None: + _details['displayName'] = display_name + + if database_object_name is not None: + _details['databaseObjectName'] = database_object_name + + if database_object_type is not None: + _details['databaseObjectType'] = database_object_type + + if description is not None: + _details['description'] = description + + if alias is not None: + _details['alias'] = alias + + if operations is not None: + _details['operations'] = cli_util.parse_json_parameter("operations", operations) + + if security_schemes is not None: + _details['securitySchemes'] = cli_util.parse_json_parameter("security_schemes", security_schemes) + + if scope is not None: + _details['scope'] = scope + + if roles is not None: + _details['roles'] = cli_util.parse_json_parameter("roles", roles) + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_pool_auto_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + auto_api_spec_key=auto_api_spec_key, + update_database_tools_database_api_gateway_config_pool_auto_api_spec_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_database_api_gateway_config_pool_auto_api_spec_group.command(name=cli_util.override('dbtools_runtime.update_database_tools_database_api_gateway_config_pool_auto_api_spec_update_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details.command_name', 'update-database-tools-database-api-gateway-config-pool-auto-api-spec-update-database-tools-database-api-gateway-config-pool-auto-api-spec-default-details'), help=u"""Update a Database Tools database API gateway config auto API spec resource \n[Command Reference](updateDatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec)""") +@cli_util.option('--database-api-gateway-config-id', required=True, help=u"""The [OCID] of a Database Tools database API gateway config.""") +@cli_util.option('--pool-key', required=True, help=u"""The key of the pool config.""") +@cli_util.option('--auto-api-spec-key', required=True, help=u"""The key of the auto API spec config.""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it\u2019s changeable. Avoid entering confidential information.""") +@cli_util.option('--database-object-name', help=u"""The name of the database object.""") +@cli_util.option('--database-object-type', type=custom_types.CliCaseInsensitiveChoice(["FUNCTION", "MVIEW", "PACKAGE", "PROCEDURE", "TABLE", "VIEW", "DUALITYVIEW"]), help=u"""The type of the database object.""") +@cli_util.option('--description', help=u"""Description of the autoApiSpec.""") +@cli_util.option('--alias', help=u"""Used as the URI path element for this object. When not specified the objectName lowercase is the default value.""") +@cli_util.option('--operations', type=custom_types.CliCaseInsensitiveChoice(["READ", "WRITE"]), help=u"""The operations to limit access to this resource. If not specified then the default is [\"READ\",\"WRITE\"].""") +@cli_util.option('--security-schemes', type=custom_types.CliCaseInsensitiveChoice(["BASIC", "BEARER"]), help=u"""The security schemes that can access this resource. If not specified then the resource is public.""") +@cli_util.option('--scope', help=u"""The name of the database API gateway config privilege protecting the resource. Only valid for SCOPE JWT Profile pools and BEARER securitySchemes.""") +@cli_util.option('--roles', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The name of the database API gateway config roles protecting the resource. Only valid for RBAC JWT Profile pools and BEARER securitySchemes.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'roles': {'module': 'database_tools_runtime', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'roles': {'module': 'database_tools_runtime', 'class': 'list[string]'}}, output_type={'module': 'database_tools_runtime', 'class': 'DatabaseToolsDatabaseApiGatewayConfigPoolAutoApiSpec'}) +@cli_util.wrap_exceptions +def update_database_tools_database_api_gateway_config_pool_auto_api_spec_update_database_tools_database_api_gateway_config_pool_auto_api_spec_default_details(ctx, from_json, force, database_api_gateway_config_id, pool_key, auto_api_spec_key, display_name, database_object_name, database_object_type, description, alias, operations, security_schemes, scope, roles, if_match): + + if isinstance(database_api_gateway_config_id, six.string_types) and len(database_api_gateway_config_id.strip()) == 0: + raise click.UsageError('Parameter --database-api-gateway-config-id cannot be whitespace or empty string') + + if isinstance(pool_key, six.string_types) and len(pool_key.strip()) == 0: + raise click.UsageError('Parameter --pool-key cannot be whitespace or empty string') + + if isinstance(auto_api_spec_key, six.string_types) and len(auto_api_spec_key.strip()) == 0: + raise click.UsageError('Parameter --auto-api-spec-key cannot be whitespace or empty string') + if not force: + if operations or security_schemes or roles: + if not click.confirm("WARNING: Updates to operations and security-schemes and roles 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 database_object_name is not None: + _details['databaseObjectName'] = database_object_name + + if database_object_type is not None: + _details['databaseObjectType'] = database_object_type + + if description is not None: + _details['description'] = description + + if alias is not None: + _details['alias'] = alias + + if operations is not None: + _details['operations'] = cli_util.parse_json_parameter("operations", operations) + + if security_schemes is not None: + _details['securitySchemes'] = cli_util.parse_json_parameter("security_schemes", security_schemes) + + if scope is not None: + _details['scope'] = scope + + if roles is not None: + _details['roles'] = cli_util.parse_json_parameter("roles", roles) + + _details['type'] = 'DEFAULT' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_database_tools_database_api_gateway_config_pool_auto_api_spec( + database_tools_database_api_gateway_config_id=database_api_gateway_config_id, + pool_key=pool_key, + auto_api_spec_key=auto_api_spec_key, + update_database_tools_database_api_gateway_config_pool_auto_api_spec_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@property_set_group.command(name=cli_util.override('dbtools_runtime.update_property_set.command_name', 'update'), help=u"""Update a property set \n[Command Reference](updatePropertySet)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--property-set-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["APEX_DOCUMENT_GENERATOR", "APEX", "APEX_FA_INTEGRATION", "ORACLE_DATABASE_EXTERNAL_AUTHENTICATION"]), help=u"""The name of the property set""") +@cli_util.option('--key', required=True, type=custom_types.CliCaseInsensitiveChoice(["APEX_DOCUMENT_GENERATOR", "APEX", "APEX_FA_INTEGRATION", "ORACLE_DATABASE_EXTERNAL_AUTHENTICATION"]), help=u"""The name of the property set""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'PropertySet'}) +@cli_util.wrap_exceptions +def update_property_set(ctx, from_json, connection_id, property_set_key, key, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(property_set_key, six.string_types) and len(property_set_key.strip()) == 0: + raise click.UsageError('Parameter --property-set-key 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['key'] = key + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_property_set( + database_tools_connection_id=connection_id, + property_set_key=property_set_key, + update_property_set_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@property_set_group.command(name=cli_util.override('dbtools_runtime.update_property_set_update_property_set_apex_document_generator_details.command_name', 'update-property-set-update-property-set-apex-document-generator-details'), help=u"""Update a property set \n[Command Reference](updatePropertySet)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--property-set-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["APEX_DOCUMENT_GENERATOR", "APEX", "APEX_FA_INTEGRATION", "ORACLE_DATABASE_EXTERNAL_AUTHENTICATION"]), help=u"""The name of the property set""") +@cli_util.option('--print-server-type', help=u"""The print server type""") +@cli_util.option('--credential-key', help=u"""The name of the credential used by APEX to manage Object Storage Buckets and Objects as well as invoke the Document Generator function.""") +@cli_util.option('--autonomous-database-resource-principal-status', help=u"""The status of the Autonomous Database Serverless Resource Principal (OCI$RESOURCE_PRINCIPAL)""") +@cli_util.option('--object-storage-namespace', help=u"""The Object Storage Namespace containing the Object Storage Buckets managed by APEX""") +@cli_util.option('--object-storage-bucket-compartment-id', help=u"""The [OCID] of the compartment containing the Object Storage Buckets managed by APEX""") +@cli_util.option('--object-storage-endpoint', help=u"""Object Storage Endpoint""") +@cli_util.option('--function-id', help=u"""The [OCID] of the Document Generator function""") +@cli_util.option('--invoke-endpoint', help=u"""The base endpoint URL to use to invoke the Document Generator function""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'PropertySet'}) +@cli_util.wrap_exceptions +def update_property_set_update_property_set_apex_document_generator_details(ctx, from_json, connection_id, property_set_key, print_server_type, credential_key, autonomous_database_resource_principal_status, object_storage_namespace, object_storage_bucket_compartment_id, object_storage_endpoint, function_id, invoke_endpoint, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(property_set_key, six.string_types) and len(property_set_key.strip()) == 0: + raise click.UsageError('Parameter --property-set-key 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 print_server_type is not None: + _details['printServerType'] = print_server_type + + if credential_key is not None: + _details['credentialKey'] = credential_key + + if autonomous_database_resource_principal_status is not None: + _details['autonomousDatabaseResourcePrincipalStatus'] = autonomous_database_resource_principal_status + + if object_storage_namespace is not None: + _details['objectStorageNamespace'] = object_storage_namespace + + if object_storage_bucket_compartment_id is not None: + _details['objectStorageBucketCompartmentId'] = object_storage_bucket_compartment_id + + if object_storage_endpoint is not None: + _details['objectStorageEndpoint'] = object_storage_endpoint + + if function_id is not None: + _details['functionId'] = function_id + + if invoke_endpoint is not None: + _details['invokeEndpoint'] = invoke_endpoint + + _details['key'] = 'APEX_DOCUMENT_GENERATOR' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_property_set( + database_tools_connection_id=connection_id, + property_set_key=property_set_key, + update_property_set_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@property_set_group.command(name=cli_util.override('dbtools_runtime.update_property_set_update_property_set_oracle_database_external_authentication_details.command_name', 'update-property-set-update-property-set-oracle-database-external-authentication-details'), help=u"""Update a property set \n[Command Reference](updatePropertySet)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--property-set-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["APEX_DOCUMENT_GENERATOR", "APEX", "APEX_FA_INTEGRATION", "ORACLE_DATABASE_EXTERNAL_AUTHENTICATION"]), help=u"""The name of the property set""") +@cli_util.option('--identity-provider', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'identity-provider': {'module': 'database_tools_runtime', 'class': 'PropertySetOracleDatabaseExternalAuthenticationIdentityProvider'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'identity-provider': {'module': 'database_tools_runtime', 'class': 'PropertySetOracleDatabaseExternalAuthenticationIdentityProvider'}}, output_type={'module': 'database_tools_runtime', 'class': 'PropertySet'}) +@cli_util.wrap_exceptions +def update_property_set_update_property_set_oracle_database_external_authentication_details(ctx, from_json, force, connection_id, property_set_key, identity_provider, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(property_set_key, six.string_types) and len(property_set_key.strip()) == 0: + raise click.UsageError('Parameter --property-set-key cannot be whitespace or empty string') + if not force: + if identity_provider: + if not click.confirm("WARNING: Updates to identity-provider 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['identityProvider'] = cli_util.parse_json_parameter("identity_provider", identity_provider) + + _details['key'] = 'ORACLE_DATABASE_EXTERNAL_AUTHENTICATION' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_property_set( + database_tools_connection_id=connection_id, + property_set_key=property_set_key, + update_property_set_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@property_set_group.command(name=cli_util.override('dbtools_runtime.update_property_set_update_property_set_apex_fa_integration_details.command_name', 'update-property-set-update-property-set-apex-fa-integration-details'), help=u"""Update a property set \n[Command Reference](updatePropertySet)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--property-set-key', required=True, type=custom_types.CliCaseInsensitiveChoice(["APEX_DOCUMENT_GENERATOR", "APEX", "APEX_FA_INTEGRATION", "ORACLE_DATABASE_EXTERNAL_AUTHENTICATION"]), help=u"""The name of the property set""") +@cli_util.option('--authentication-substitutions', type=custom_types.CLI_COMPLEX_TYPE, help=u"""APEX FA Integration key-value pairs.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--instance-dbms-credential-enabled', help=u"""Specifies whether database credentials can be used in all workspaces on the APEX instance. Supported values include: \"Y\", \"N\" and empty string.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@json_skeleton_utils.get_cli_json_input_option({'authentication-substitutions': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'authentication-substitutions': {'module': 'database_tools_runtime', 'class': 'dict(str, string)'}}, output_type={'module': 'database_tools_runtime', 'class': 'PropertySet'}) +@cli_util.wrap_exceptions +def update_property_set_update_property_set_apex_fa_integration_details(ctx, from_json, force, connection_id, property_set_key, authentication_substitutions, instance_dbms_credential_enabled, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-id cannot be whitespace or empty string') + + if isinstance(property_set_key, six.string_types) and len(property_set_key.strip()) == 0: + raise click.UsageError('Parameter --property-set-key cannot be whitespace or empty string') + if not force: + if authentication_substitutions: + if not click.confirm("WARNING: Updates to authentication-substitutions 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 authentication_substitutions is not None: + _details['authenticationSubstitutions'] = cli_util.parse_json_parameter("authentication_substitutions", authentication_substitutions) + + if instance_dbms_credential_enabled is not None: + _details['instanceDbmsCredentialEnabled'] = instance_dbms_credential_enabled + + _details['key'] = 'APEX_FA_INTEGRATION' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.update_property_set( + database_tools_connection_id=connection_id, + property_set_key=property_set_key, + update_property_set_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.validate_database_tools_connection.command_name', 'validate'), help=u"""Validates the specified Database Tools connection. \n[Command Reference](validateDatabaseToolsConnection)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE", "MYSQL", "POSTGRESQL"]), help=u"""The `DatabaseToolsConnection` type.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'ValidateDatabaseToolsConnectionResult'}) +@cli_util.wrap_exceptions +def validate_database_tools_connection(ctx, from_json, connection_id, type, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['type'] = type + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.validate_database_tools_connection( + database_tools_connection_id=connection_id, + validate_database_tools_connection_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.validate_database_tools_connection_validate_database_tools_connection_postgresql_details.command_name', 'validate-database-tools-connection-validate-database-tools-connection-postgresql-details'), help=u"""Validates the specified Database Tools connection. \n[Command Reference](validateDatabaseToolsConnection)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'ValidateDatabaseToolsConnectionResult'}) +@cli_util.wrap_exceptions +def validate_database_tools_connection_validate_database_tools_connection_postgresql_details(ctx, from_json, connection_id, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['type'] = 'POSTGRESQL' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.validate_database_tools_connection( + database_tools_connection_id=connection_id, + validate_database_tools_connection_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.validate_database_tools_connection_validate_database_tools_connection_my_sql_details.command_name', 'validate-database-tools-connection-validate-database-tools-connection-my-sql-details'), help=u"""Validates the specified Database Tools connection. \n[Command Reference](validateDatabaseToolsConnection)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'ValidateDatabaseToolsConnectionResult'}) +@cli_util.wrap_exceptions +def validate_database_tools_connection_validate_database_tools_connection_my_sql_details(ctx, from_json, connection_id, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['type'] = 'MYSQL' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.validate_database_tools_connection( + database_tools_connection_id=connection_id, + validate_database_tools_connection_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_connection_group.command(name=cli_util.override('dbtools_runtime.validate_database_tools_connection_validate_database_tools_connection_oracle_database_details.command_name', 'validate-database-tools-connection-validate-database-tools-connection-oracle-database-details'), help=u"""Validates the specified Database Tools connection. \n[Command Reference](validateDatabaseToolsConnection)""") +@cli_util.option('--connection-id', required=True, help=u"""The [OCID] of a Database Tools connection.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'ValidateDatabaseToolsConnectionResult'}) +@cli_util.wrap_exceptions +def validate_database_tools_connection_validate_database_tools_connection_oracle_database_details(ctx, from_json, connection_id, if_match): + + if isinstance(connection_id, six.string_types) and len(connection_id.strip()) == 0: + raise click.UsageError('Parameter --connection-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['type'] = 'ORACLE_DATABASE' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.validate_database_tools_connection( + database_tools_connection_id=connection_id, + validate_database_tools_connection_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_identity_group.command(name=cli_util.override('dbtools_runtime.validate_database_tools_identity_credential.command_name', 'validate-database-tools-identity-credential'), help=u"""Validates the Database Tools identity credentials by establishing a connection to the customer database and executing the dbms_cloud.send_request to validate the credential. \n[Command Reference](validateDatabaseToolsIdentityCredential)""") +@cli_util.option('--identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@cli_util.option('--type', required=True, type=custom_types.CliCaseInsensitiveChoice(["ORACLE_DATABASE_RESOURCE_PRINCIPAL"]), help=u"""The Database Tools identity type.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'ValidateDatabaseToolsIdentityCredentialResult'}) +@cli_util.wrap_exceptions +def validate_database_tools_identity_credential(ctx, from_json, identity_id, type, if_match): + + if isinstance(identity_id, six.string_types) and len(identity_id.strip()) == 0: + raise click.UsageError('Parameter --identity-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['type'] = type + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.validate_database_tools_identity_credential( + database_tools_identity_id=identity_id, + validate_database_tools_identity_credential_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@database_tools_identity_group.command(name=cli_util.override('dbtools_runtime.validate_database_tools_identity_credential_validate_database_tools_identity_credential_oracle_database_resource_principal_details.command_name', 'validate-database-tools-identity-credential-validate-database-tools-identity-credential-oracle-database-resource-principal-details'), help=u"""Validates the Database Tools identity credentials by establishing a connection to the customer database and executing the dbms_cloud.send_request to validate the credential. \n[Command Reference](validateDatabaseToolsIdentityCredential)""") +@cli_util.option('--identity-id', required=True, help=u"""The [OCID] of a Database Tools identity.""") +@cli_util.option('--if-match', help=u"""If-Match is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agentss might be acting in parallel on the same resource (i.e., to prevent the \"lost update\" problem). In general, it can be used with any method that involves the selection or modification of a representation to abort the request if the selected representation's current entity tag is not a member within the If-Match field value. When specified on an action-specific subresource, the ETag value of the resource on which the action is requested should be provided.""") +@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': 'database_tools_runtime', 'class': 'ValidateDatabaseToolsIdentityCredentialResult'}) +@cli_util.wrap_exceptions +def validate_database_tools_identity_credential_validate_database_tools_identity_credential_oracle_database_resource_principal_details(ctx, from_json, identity_id, if_match): + + if isinstance(identity_id, six.string_types) and len(identity_id.strip()) == 0: + raise click.UsageError('Parameter --identity-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['type'] = 'ORACLE_DATABASE_RESOURCE_PRINCIPAL' + + client = cli_util.build_client('database_tools_runtime', 'database_tools_runtime', ctx) + result = client.validate_database_tools_identity_credential( + database_tools_identity_id=identity_id, + validate_database_tools_identity_credential_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) diff --git a/services/database_tools_runtime/tests/__init__.py b/services/database_tools_runtime/tests/__init__.py new file mode 100644 index 000000000..5c3d90774 --- /dev/null +++ b/services/database_tools_runtime/tests/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. +# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20230222 diff --git a/services/database_tools_runtime/tests/util/generated/command_to_api.py b/services/database_tools_runtime/tests/util/generated/command_to_api.py new file mode 100644 index 000000000..5d3f2a548 --- /dev/null +++ b/services/database_tools_runtime/tests/util/generated/command_to_api.py @@ -0,0 +1,49 @@ +# coding: utf-8 +# Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. + +SDK_client_map = { + "dbtools_runtime.cancel_work_request": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.cancel_work_request", + "dbtools_runtime.create_credential": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.create_credential", + "dbtools_runtime.create_credential_execute_grantee": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.create_credential_execute_grantee", + "dbtools_runtime.create_credential_public_synonym": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.create_credential_public_synonym", + "dbtools_runtime.create_database_tools_database_api_gateway_config_pool": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.create_database_tools_database_api_gateway_config_pool", + "dbtools_runtime.create_database_tools_database_api_gateway_config_pool_api_spec": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.create_database_tools_database_api_gateway_config_pool_api_spec", + "dbtools_runtime.create_database_tools_database_api_gateway_config_pool_auto_api_spec": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.create_database_tools_database_api_gateway_config_pool_auto_api_spec", + "dbtools_runtime.delete_credential": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.delete_credential", + "dbtools_runtime.delete_credential_execute_grantee": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.delete_credential_execute_grantee", + "dbtools_runtime.delete_credential_public_synonym": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.delete_credential_public_synonym", + "dbtools_runtime.delete_database_tools_database_api_gateway_config_pool": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.delete_database_tools_database_api_gateway_config_pool", + "dbtools_runtime.delete_database_tools_database_api_gateway_config_pool_api_spec": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.delete_database_tools_database_api_gateway_config_pool_api_spec", + "dbtools_runtime.delete_database_tools_database_api_gateway_config_pool_auto_api_spec": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.delete_database_tools_database_api_gateway_config_pool_auto_api_spec", + "dbtools_runtime.execute_sql_database_tools_connection": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.execute_sql_database_tools_connection", + "dbtools_runtime.get_credential": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_credential", + "dbtools_runtime.get_credential_execute_grantee": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_credential_execute_grantee", + "dbtools_runtime.get_credential_public_synonym": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_credential_public_synonym", + "dbtools_runtime.get_database_tools_database_api_gateway_config_content": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_database_tools_database_api_gateway_config_content", + "dbtools_runtime.get_database_tools_database_api_gateway_config_global": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_database_tools_database_api_gateway_config_global", + "dbtools_runtime.get_database_tools_database_api_gateway_config_pool": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_database_tools_database_api_gateway_config_pool", + "dbtools_runtime.get_database_tools_database_api_gateway_config_pool_api_spec": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_database_tools_database_api_gateway_config_pool_api_spec", + "dbtools_runtime.get_database_tools_database_api_gateway_config_pool_auto_api_spec": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_database_tools_database_api_gateway_config_pool_auto_api_spec", + "dbtools_runtime.get_property_set": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_property_set", + "dbtools_runtime.get_user_credential": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_user_credential", + "dbtools_runtime.get_work_request": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.get_work_request", + "dbtools_runtime.list_credential_execute_grantees": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_credential_execute_grantees", + "dbtools_runtime.list_credential_public_synonyms": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_credential_public_synonyms", + "dbtools_runtime.list_credentials": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_credentials", + "dbtools_runtime.list_database_tools_database_api_gateway_config_advanced_properties": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_database_tools_database_api_gateway_config_advanced_properties", + "dbtools_runtime.list_database_tools_database_api_gateway_config_pool_api_specs": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_database_tools_database_api_gateway_config_pool_api_specs", + "dbtools_runtime.list_database_tools_database_api_gateway_config_pool_auto_api_specs": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_database_tools_database_api_gateway_config_pool_auto_api_specs", + "dbtools_runtime.list_database_tools_database_api_gateway_config_pools": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_database_tools_database_api_gateway_config_pools", + "dbtools_runtime.list_user_credentials": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_user_credentials", + "dbtools_runtime.list_work_request_errors": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_work_request_errors", + "dbtools_runtime.list_work_request_logs": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_work_request_logs", + "dbtools_runtime.list_work_requests": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.list_work_requests", + "dbtools_runtime.update_credential": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.update_credential", + "dbtools_runtime.update_database_tools_database_api_gateway_config_global": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.update_database_tools_database_api_gateway_config_global", + "dbtools_runtime.update_database_tools_database_api_gateway_config_pool": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.update_database_tools_database_api_gateway_config_pool", + "dbtools_runtime.update_database_tools_database_api_gateway_config_pool_api_spec": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.update_database_tools_database_api_gateway_config_pool_api_spec", + "dbtools_runtime.update_database_tools_database_api_gateway_config_pool_auto_api_spec": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.update_database_tools_database_api_gateway_config_pool_auto_api_spec", + "dbtools_runtime.update_property_set": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.update_property_set", + "dbtools_runtime.validate_database_tools_connection": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.validate_database_tools_connection", + "dbtools_runtime.validate_database_tools_identity_credential": "oci.database_tools_runtime.DatabaseToolsRuntimeClient.validate_database_tools_identity_credential", +} 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 7c306919b..33908a8e1 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 @@ -1634,7 +1634,7 @@ def create_hosted_deployment_single_docker_artifact(ctx, from_json, wait_for_sta @cli_util.option('--description', help=u"""An optional description of the imported model.""") @cli_util.option('--vendor', help=u"""The provider of the imported model.""") @cli_util.option('--version-parameterconflict', help=u"""The version of the imported model.""") -@cli_util.option('--capabilities', type=custom_types.CliCaseInsensitiveChoice(["TEXT_TO_TEXT", "IMAGE_TEXT_TO_TEXT", "EMBEDDING", "RERANK", "TEXT_TO_IMAGE"]), help=u"""Specifies the intended use or supported capabilities of the imported model.""") +@cli_util.option('--capabilities', type=custom_types.CliCaseInsensitiveChoice(["TEXT_TO_TEXT", "IMAGE_TEXT_TO_TEXT", "EMBEDDING", "RERANK", "TEXT_TO_IMAGE", "IMAGE_TEXT_TO_IMAGE", "IMAGE_TEXT_TO_VIDEO", "IMAGE_TO_IMAGE", "REALTIME", "AUDIO_TO_AUDIO", "AUDIO_TO_TEXT", "TEXT_TO_AUDIO", "TEXT_TO_VIDEO"]), help=u"""Specifies the intended use or supported capabilities of the imported model.""") @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) @@ -1725,7 +1725,7 @@ def create_imported_model(ctx, from_json, wait_for_state, max_wait_seconds, wait @cli_util.option('--description', help=u"""An optional description of the imported model.""") @cli_util.option('--vendor', help=u"""The provider of the imported model.""") @cli_util.option('--version-parameterconflict', help=u"""The version of the imported model.""") -@cli_util.option('--capabilities', type=custom_types.CliCaseInsensitiveChoice(["TEXT_TO_TEXT", "IMAGE_TEXT_TO_TEXT", "EMBEDDING", "RERANK", "TEXT_TO_IMAGE"]), help=u"""Specifies the intended use or supported capabilities of the imported model.""") +@cli_util.option('--capabilities', type=custom_types.CliCaseInsensitiveChoice(["TEXT_TO_TEXT", "IMAGE_TEXT_TO_TEXT", "EMBEDDING", "RERANK", "TEXT_TO_IMAGE", "IMAGE_TEXT_TO_IMAGE", "IMAGE_TEXT_TO_VIDEO", "IMAGE_TO_IMAGE", "REALTIME", "AUDIO_TO_AUDIO", "AUDIO_TO_TEXT", "TEXT_TO_AUDIO", "TEXT_TO_VIDEO"]), help=u"""Specifies the intended use or supported capabilities of the imported model.""") @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) @@ -1823,7 +1823,7 @@ def create_imported_model_object_storage_object(ctx, from_json, wait_for_state, @cli_util.option('--description', help=u"""An optional description of the imported model.""") @cli_util.option('--vendor', help=u"""The provider of the imported model.""") @cli_util.option('--version-parameterconflict', help=u"""The version of the imported model.""") -@cli_util.option('--capabilities', type=custom_types.CliCaseInsensitiveChoice(["TEXT_TO_TEXT", "IMAGE_TEXT_TO_TEXT", "EMBEDDING", "RERANK", "TEXT_TO_IMAGE"]), help=u"""Specifies the intended use or supported capabilities of the imported model.""") +@cli_util.option('--capabilities', type=custom_types.CliCaseInsensitiveChoice(["TEXT_TO_TEXT", "IMAGE_TEXT_TO_TEXT", "EMBEDDING", "RERANK", "TEXT_TO_IMAGE", "IMAGE_TEXT_TO_IMAGE", "IMAGE_TEXT_TO_VIDEO", "IMAGE_TO_IMAGE", "REALTIME", "AUDIO_TO_AUDIO", "AUDIO_TO_TEXT", "TEXT_TO_AUDIO", "TEXT_TO_VIDEO"]), help=u"""Specifies the intended use or supported capabilities of the imported model.""") @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) @@ -4510,7 +4510,7 @@ def list_hosted_deployments(ctx, from_json, all_pages, page_size, compartment_id @imported_model_collection_group.command(name=cli_util.override('generative_ai.list_imported_models.command_name', 'list-imported-models'), help=u"""Lists imported models in a specific compartment. \n[Command Reference](listImportedModels)""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") @cli_util.option('--vendor', help=u"""A filter to return only resources that match the entire vendor given.""") -@cli_util.option('--capability', type=custom_types.CliCaseInsensitiveChoice(["TEXT_TO_TEXT", "IMAGE_TEXT_TO_TEXT", "EMBEDDING", "RERANK", "TEXT_TO_IMAGE"]), multiple=True, help=u"""A filter to return only resources their capability matches the given capability.""") +@cli_util.option('--capability', type=custom_types.CliCaseInsensitiveChoice(["TEXT_TO_TEXT", "IMAGE_TEXT_TO_TEXT", "EMBEDDING", "RERANK", "TEXT_TO_IMAGE", "IMAGE_TEXT_TO_IMAGE", "IMAGE_TEXT_TO_VIDEO", "IMAGE_TO_IMAGE", "REALTIME", "AUDIO_TO_AUDIO", "AUDIO_TO_TEXT", "TEXT_TO_AUDIO", "TEXT_TO_VIDEO"]), multiple=True, help=u"""A filter to return only resources their capability matches the given capability.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CREATING", "UPDATING", "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 given display name exactly.""") @cli_util.option('--id', help=u"""The ID of the importedModel.""") @@ -4579,7 +4579,7 @@ def list_imported_models(ctx, from_json, all_pages, page_size, compartment_id, v @model_collection_group.command(name=cli_util.override('generative_ai.list_models.command_name', 'list-models'), help=u"""Lists the models in a specific compartment. Includes pretrained base models and fine-tuned custom models. \n[Command Reference](listModels)""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to list resources.""") @cli_util.option('--vendor', help=u"""A filter to return only resources that match the entire vendor given.""") -@cli_util.option('--capability', type=custom_types.CliCaseInsensitiveChoice(["TEXT_GENERATION", "TEXT_SUMMARIZATION", "TEXT_EMBEDDINGS", "FINE_TUNE", "CHAT", "TEXT_RERANK", "TEXT_TO_IMAGE"]), multiple=True, help=u"""A filter to return only resources their capability matches the given capability.""") +@cli_util.option('--capability', type=custom_types.CliCaseInsensitiveChoice(["TEXT_GENERATION", "TEXT_SUMMARIZATION", "TEXT_EMBEDDINGS", "FINE_TUNE", "CHAT", "TEXT_RERANK", "TEXT_TO_IMAGE", "IMAGE_TEXT_TO_IMAGE", "IMAGE_TEXT_TO_TEXT", "IMAGE_TEXT_TO_VIDEO", "IMAGE_TO_IMAGE", "REALTIME", "AUDIO_TO_AUDIO", "AUDIO_TO_TEXT", "TEXT_TO_AUDIO", "TEXT_TO_VIDEO"]), multiple=True, help=u"""A filter to return only resources their capability matches the given capability.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CREATING", "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 given display name exactly.""") @cli_util.option('--id', help=u"""The ID of the model.""") diff --git a/services/iot/src/oci_cli_iot/generated/iot_cli.py b/services/iot/src/oci_cli_iot/generated/iot_cli.py index 742f68d75..d8ce0e982 100644 --- a/services/iot/src/oci_cli_iot/generated/iot_cli.py +++ b/services/iot/src/oci_cli_iot/generated/iot_cli.py @@ -671,6 +671,7 @@ def create_digital_twin_adapter(ctx, from_json, wait_for_state, max_wait_seconds @digital_twin_instance_group.command(name=cli_util.override('iot.create_digital_twin_instance.command_name', 'create'), help=u"""Creates a new digital twin instance. \n[Command Reference](createDigitalTwinInstance)""") @cli_util.option('--iot-domain-id', required=True, help=u"""The [OCID] of the IoT domain.""") +@cli_util.option('--connectivity-type', type=custom_types.CliCaseInsensitiveChoice(["DIRECT", "INDIRECT", "GATEWAY", "NONE"]), help=u"""Connectivity type of the digital twin instance""") @cli_util.option('--auth-id', help=u"""The [OCID] of the resource (like VaultSecret, ClientCertificate etc.,) used to authenticate the digital twin instance.""") @cli_util.option('--external-key', help=u"""A unique identifier for the physical entity (typically an IoT device) represented by the digital twin instance. This could be a Bluetooth address, Ethernet MAC address, or serial number, depending on the use case. If not provided, the system will automatically generate one.""") @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") @@ -678,6 +679,7 @@ def create_digital_twin_adapter(ctx, from_json, wait_for_state, max_wait_seconds @cli_util.option('--digital-twin-adapter-id', help=u"""The [OCID] of the digital twin adapter.""") @cli_util.option('--digital-twin-model-id', help=u"""The [OCID] of the digital twin model.""") @cli_util.option('--digital-twin-model-spec-uri', help=u"""The URI of the digital twin model specification.""") +@cli_util.option('--gateways', type=custom_types.CLI_COMPLEX_TYPE, help=u"""An array of unique ids ([OCIDs]) of the IoT digital twin instances with connectivityType equals to GATEWAY.""" + 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) @@ -687,12 +689,12 @@ def create_digital_twin_adapter(ctx, from_json, wait_for_state, max_wait_seconds @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'iot', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'iot', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'gateways': {'module': 'iot', 'class': 'list[string]'}, 'freeform-tags': {'module': 'iot', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'iot', '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': 'iot', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'iot', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'iot', 'class': 'DigitalTwinInstance'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'gateways': {'module': 'iot', 'class': 'list[string]'}, 'freeform-tags': {'module': 'iot', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'iot', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'iot', 'class': 'DigitalTwinInstance'}) @cli_util.wrap_exceptions -def create_digital_twin_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, iot_domain_id, auth_id, external_key, display_name, description, digital_twin_adapter_id, digital_twin_model_id, digital_twin_model_spec_uri, freeform_tags, defined_tags): +def create_digital_twin_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, iot_domain_id, connectivity_type, auth_id, external_key, display_name, description, digital_twin_adapter_id, digital_twin_model_id, digital_twin_model_spec_uri, gateways, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -700,6 +702,9 @@ def create_digital_twin_instance(ctx, from_json, wait_for_state, max_wait_second _details = {} _details['iotDomainId'] = iot_domain_id + if connectivity_type is not None: + _details['connectivityType'] = connectivity_type + if auth_id is not None: _details['authId'] = auth_id @@ -721,6 +726,9 @@ def create_digital_twin_instance(ctx, from_json, wait_for_state, max_wait_second if digital_twin_model_spec_uri is not None: _details['digitalTwinModelSpecUri'] = digital_twin_model_spec_uri + if gateways is not None: + _details['gateways'] = cli_util.parse_json_parameter("gateways", gateways) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -1900,6 +1908,7 @@ def list_digital_twin_adapters(ctx, from_json, all_pages, page_size, iot_domain_ @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('--digital-twin-model-id', help=u"""Filter resources that match the specified [OCID] of the digital twin model.""") @cli_util.option('--digital-twin-model-spec-uri', help=u"""Filter resources that match the specified URI (DTMI) of the digital twin model.""") +@cli_util.option('--connectivity-type', type=custom_types.CliCaseInsensitiveChoice(["DIRECT", "INDIRECT", "GATEWAY", "NONE"]), help=u"""Filter resources whose connectivityType matches the specified value.""") @cli_util.option('--id', help=u"""Filter resources by [OCID]. Must be a valid OCID of the resource type.""") @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.""") @@ -1908,7 +1917,7 @@ def list_digital_twin_adapters(ctx, from_json, all_pages, page_size, iot_domain_ @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'iot', 'class': 'DigitalTwinInstanceCollection'}) @cli_util.wrap_exceptions -def list_digital_twin_instances(ctx, from_json, all_pages, page_size, iot_domain_id, display_name, limit, page, lifecycle_state, sort_order, sort_by, digital_twin_model_id, digital_twin_model_spec_uri, id): +def list_digital_twin_instances(ctx, from_json, all_pages, page_size, iot_domain_id, display_name, limit, page, lifecycle_state, sort_order, sort_by, digital_twin_model_id, digital_twin_model_spec_uri, connectivity_type, id): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') @@ -1930,6 +1939,8 @@ def list_digital_twin_instances(ctx, from_json, all_pages, page_size, iot_domain kwargs['digital_twin_model_id'] = digital_twin_model_id if digital_twin_model_spec_uri is not None: kwargs['digital_twin_model_spec_uri'] = digital_twin_model_spec_uri + if connectivity_type is not None: + kwargs['connectivity_type'] = connectivity_type if id is not None: kwargs['id'] = id kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -2505,6 +2516,7 @@ def update_digital_twin_adapter(ctx, from_json, force, wait_for_state, max_wait_ @cli_util.option('--digital-twin-adapter-id', help=u"""The [OCID] of the digital twin adapter.""") @cli_util.option('--digital-twin-model-id', help=u"""The [OCID] of the digital twin model.""") @cli_util.option('--digital-twin-model-spec-uri', help=u"""The URI of the digital twin model specification.""") +@cli_util.option('--gateways', type=custom_types.CLI_COMPLEX_TYPE, help=u"""An array of unique ids ([OCIDs]) of the IoT digital twin instances with connectivityType equals to GATEWAY.""" + 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) @@ -2516,18 +2528,18 @@ def update_digital_twin_adapter(ctx, from_json, force, wait_for_state, max_wait_ @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state DELETED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'iot', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'iot', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'gateways': {'module': 'iot', 'class': 'list[string]'}, 'freeform-tags': {'module': 'iot', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'iot', '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': 'iot', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'iot', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'iot', 'class': 'DigitalTwinInstance'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'gateways': {'module': 'iot', 'class': 'list[string]'}, 'freeform-tags': {'module': 'iot', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'iot', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'iot', 'class': 'DigitalTwinInstance'}) @cli_util.wrap_exceptions -def update_digital_twin_instance(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, digital_twin_instance_id, auth_id, external_key, display_name, description, digital_twin_adapter_id, digital_twin_model_id, digital_twin_model_spec_uri, freeform_tags, defined_tags, if_match): +def update_digital_twin_instance(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, digital_twin_instance_id, auth_id, external_key, display_name, description, digital_twin_adapter_id, digital_twin_model_id, digital_twin_model_spec_uri, gateways, freeform_tags, defined_tags, if_match): if isinstance(digital_twin_instance_id, six.string_types) and len(digital_twin_instance_id.strip()) == 0: raise click.UsageError('Parameter --digital-twin-instance-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?"): + if gateways or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to gateways and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2558,6 +2570,9 @@ def update_digital_twin_instance(ctx, from_json, force, wait_for_state, max_wait if digital_twin_model_spec_uri is not None: _details['digitalTwinModelSpecUri'] = digital_twin_model_spec_uri + if gateways is not None: + _details['gateways'] = cli_util.parse_json_parameter("gateways", gateways) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) diff --git a/services/object_storage/tests/unit/test_objectstorage_extended.py b/services/object_storage/tests/unit/test_objectstorage_extended.py index 7fb1a9703..21b522c4e 100644 --- a/services/object_storage/tests/unit/test_objectstorage_extended.py +++ b/services/object_storage/tests/unit/test_objectstorage_extended.py @@ -30,7 +30,7 @@ def test_time_delta(self): assert time_delta(1, 0) == '1 day 0 hours 0 mins' assert time_delta(2, 12840) == '2 days 3 hours 34 mins' - @mock.patch('click.termui.get_terminal_size') + @mock.patch('shutil.get_terminal_size') def test_get_progress_bar_label(self, mock_click): mock_click.return_value = (40, 80) str_long_slash = '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0' \ diff --git a/setup.py b/setup.py index 37a2ec995..ceca9804e 100644 --- a/setup.py +++ b/setup.py @@ -30,14 +30,14 @@ def open_relative(*path): readme = f.read() requires = [ - 'oci==2.173.1', + 'oci==2.174.0', 'arrow>=1.0.0,<2.0.0', 'certifi>=2025.1.31,<2026.0.0', - 'click==8.0.4', + 'click<=8.1.2', 'cryptography>=3.2.1,<47.0.0', 'jmespath>=0.10.0,<=1.0.1', 'python-dateutil>=2.5.3,<3.0.0', - 'pytz>=2016.10,<2025.0', + 'pytz>=2016.10,<=2026.2', 'six>=1.15.0,<2.0.0', 'terminaltables==3.1.10', 'pyOpenSSL>=17.5.0,<27.0.0', diff --git a/src/oci_cli/cli_session.py b/src/oci_cli/cli_session.py index 02d5b68b9..d380aee4e 100644 --- a/src/oci_cli/cli_session.py +++ b/src/oci_cli/cli_session.py @@ -66,7 +66,13 @@ def session_group(): @click.option('--no-browser', is_flag=True, help="""Triggers user authentication without requiring interactive browser login""") @cli_util.option('--public-key-file-path', type=click.Path(), help="""Full path of the public key PEM file that corresponds to the RSA key pair used for signing requests""") @click.option('--session-expiration-in-minutes', default=cli_constants.OCI_CLI_UPST_TOKEN_MAX_TTL, help="""User session expiration in minutes to which the requested user principal session token (UPST) is bounded. Valid values are from 5 to 60 for all realms. If not provided, a default value of 60 minutes if set.""") -@cli_util.option('--token-location', default=cli_setup.DEFAULT_TOKEN_DIRECTORY, help=u"""Provide the directory where you would like to store token and private/public key. Default is ~/.oci/sessions""") +# If we set a Click default for --token-location (e.g. default=cli_setup.DEFAULT_TOKEN_DIRECTORY), +# that value is evaluated once at import/decorator time. At that point, it is typically ~/.oci/sessions. +# Several unit tests modify cli_setup.DEFAULT_TOKEN_DIRECTORY at runtime, but those changes are not +# reflected in Click's already-evaluated default. +# To ensure tests can override the default directory, we omit the Click default and instead assign +# the default inside the function body when token_location is None. +@cli_util.option('--token-location', help=u"""Provide the directory where you would like to store token and private/public key. Default is ~/.oci/sessions""") @click.option('--profile-name', help='Name of the profile you are creating') @click.option('--config-location', help='Path to the config for the new session') @click.option('--use-passphrase', is_flag=True, help='Provide a passphrase to be used to encrypt the private key from the generated key pair') @@ -83,6 +89,10 @@ def authenticate(ctx, region, tenancy_name, profile_name, config_location, use_p validate_profile_name(profile_name) persist_only_public_key = False + + if token_location is None: + token_location = cli_setup.DEFAULT_TOKEN_DIRECTORY + if no_browser: if int(session_expiration_in_minutes) > int(cli_constants.OCI_CLI_UPST_TOKEN_MAX_TTL): click.echo("""Session expiration cannot be longer than 60 minutes""") @@ -137,7 +147,7 @@ def authenticate(ctx, region, tenancy_name, profile_name, config_location, use_p user_session = cli_setup_bootstrap.create_user_session(region, tenancy_name, identity_provider_name) # persist the session to a config (including the token value) - profile, config = cli_setup_bootstrap.persist_user_session(user_session, profile_name=profile_name, config=config_location, use_passphrase=use_passphrase, persist_token=True, session_auth=True, persist_only_public_key=persist_only_public_key) + profile, config = cli_setup_bootstrap.persist_user_session(user_session, profile_name=profile_name, config=config_location, token_location=token_location, use_passphrase=use_passphrase, persist_token=True, session_auth=True, persist_only_public_key=persist_only_public_key) click.echo('Config written to: {}'.format(config)) diff --git a/src/oci_cli/cli_setup_bootstrap.py b/src/oci_cli/cli_setup_bootstrap.py index ccb9fea6a..cba8ac5b1 100644 --- a/src/oci_cli/cli_setup_bootstrap.py +++ b/src/oci_cli/cli_setup_bootstrap.py @@ -201,7 +201,7 @@ def create_user_session(region='', tenancy_name=None, identity_provider_name=Non return UserSession(user_ocid, tenancy_ocid, region, token, public_key, private_key, fingerprint) -def persist_user_session(user_session, profile_name=None, config=None, use_passphrase=False, persist_token=False, bootstrap=False, session_auth=False, persist_only_public_key=False): +def persist_user_session(user_session, profile_name=None, config=None, token_location=None, use_passphrase=False, persist_token=False, bootstrap=False, session_auth=False, persist_only_public_key=False): if not profile_name: # prompt for location of user config config_location, profile_name = cli_setup.prompt_session_for_profile() @@ -209,13 +209,14 @@ def persist_user_session(user_session, profile_name=None, config=None, use_passp config_location = config else: config_location = cli_setup.DEFAULT_CONFIG_LOCATION - + if token_location is None: + token_location = cli_setup.DEFAULT_TOKEN_DIRECTORY if not config_location: click.echo(BOOTSTRAP_PROCESS_CANCELED_MESSAGE) sys.exit(0) # prompt for directory to place keys - session_auth_location = os.path.abspath(os.path.join(cli_setup.DEFAULT_TOKEN_DIRECTORY, profile_name)) + session_auth_location = os.path.abspath(os.path.join(token_location, profile_name)) if not os.path.exists(session_auth_location): cli_util.create_directory(session_auth_location) diff --git a/src/oci_cli/service_mapping.py b/src/oci_cli/service_mapping.py index b9cff88d3..b4f8d9baa 100644 --- a/src/oci_cli/service_mapping.py +++ b/src/oci_cli/service_mapping.py @@ -263,6 +263,11 @@ "Database Tools", "Developer Services" ], + "dbtools-runtime": [ + "database_tools_runtime", + "Database Tools Service Runtime", + "Others" + ], "delegate-access-control": [ "delegate_access_control", "Oracle Delegate Access Control", diff --git a/src/oci_cli/version.py b/src/oci_cli/version.py index b046058a8..99cf30a63 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.81.1' +__version__ = '3.82.0' diff --git a/tests/resources/json_ignore_command_list.txt b/tests/resources/json_ignore_command_list.txt index ceff26041..0ad49c651 100644 --- a/tests/resources/json_ignore_command_list.txt +++ b/tests/resources/json_ignore_command_list.txt @@ -600,3 +600,11 @@ cloud-bridge, inventory, asset, update os-management-hub, managed-instance-group, list-managed-instances fusion-apps, fusion-environment, create fusion-apps, fusion-environment, update +database-tools-runtime, database-tools-connection, execute-sql-database-tools-connection-execute-sql-output-object-storage-details +database-tools-runtime, database-tools-database-api-gateway-config-pool-auto-api-spec, create +database-tools-runtime, database-tools-database-api-gateway-config-pool-auto-api-spec, create-database-tools-database-api-gateway-config-pool-auto-api-spec-create-database-tools-database-api-gateway-config-pool-auto-api-spec-default-details +database-tools-runtime, database-tools-database-api-gateway-config-pool-auto-api-spec, update +database-tools-runtime, database-tools-database-api-gateway-config-pool-auto-api-spec, update-database-tools-database-api-gateway-config-pool-auto-api-spec-update-database-tools-database-api-gateway-config-pool-auto-api-spec-default-details +dbtools-runtime, connection, execute-sql, async +dbtools-runtime, database-api-gateway-config-pool-auto-api-spec, create, default +dbtools-runtime, database-api-gateway-config-pool-auto-api-spec, update, default