diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 20a56ac95..a8813745b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,187 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__. +3.87.0 - 2026-06-16 +------------------- +Added +~~~~~ +* Kubernetes Engine service + + * Support for new optional `hostGroupId` field in placement configurations + + * ``oci ce node-pool create`` + * ``oci ce node-pool update`` + +* Database service + + * Support for restarting Oracle REST Data Services (ORDS) on Autonomous Exadata VM Clusters + + * ``oci db autonomous-vm-cluster restart-autonomous-vm-cluster-ords`` + * ``oci db cloud-autonomous-vm-cluster restart-cloud-autonomous-vm-cluster-ords`` + + * Support for new optional parameters ``--is-force-restart`` and ``--is-force-stop`` + + * ``oci db autonomous-container-database restart --is-force-restart`` + * ``oci db autonomous-database restart --is-force-restart`` + * ``oci db autonomous-database stop --is-force-stop`` + + * Support for triggering forced reboot and stop of DB nodes + + * ``oci db node force-reset`` + * ``oci db node force-stop`` + +* OpenSearch Service + + * Support for coordinator nodes + + * ``oci opensearch cluster create --coordinator-node-count --coordinator-node-host-memory-gb --coordinator-node-host-ocpu-count --coordinator-node-host-shape --coordinator-node-host-type`` + * ``oci opensearch cluster resizehorizontal --coordinator-node-count`` + * ``oci opensearch cluster resizevertical --coordinator-node-host-memory-gb --coordinator-node-host-ocpu-count --coordinator-node-host-shape`` + +* Organizations service + + * Support for new optional parameter ``--features`` + + * ``oci organizations child-tenancy create --features`` + * ``oci organizations sender-invitation create --features`` + + * Support for new optional parameter ``--feature`` + + * ``oci organizations link list --feature`` + + * Support for additional ``status`` value ``NOT_APPLICABLE`` + + * ``oci organizations sender-invitation list --status NOT_APPLICABLE`` + + * Support for the following new commands + + * ``oci organizations link link-with-tenancy-names get`` + * ``oci organizations link-features link-features-collection list-link-features`` + +* Oracle Cloud Migrations service + + * Support for new optional parameter ``--security-attributes`` + + * ``oci cloud-migrations migration create --security-attributes`` + * ``oci cloud-migrations migration update --security-attributes`` + +* Object Storage service + + * Support for new optional parameter ``--security-attributes`` + + * ``oci os private-endpoint create --security-attributes`` + * ``oci os private-endpoint update --security-attributes`` + +* PSQL service + + * Support for ODSP Insights configuration in Database System operations + + * ``oci psql db-system create --odsp-insight-details`` + * ``oci psql db-system update --odsp-insight-details`` + * ``oci psql db-system create-db-system-backup-source-details --odsp-insight-details`` + * ``oci psql db-system create-db-system-none-source-details --odsp-insight-details`` + * ``oci psql db-system create-db-system-oci-optimized-storage-details --odsp-insight-details`` + * ``oci psql db-system create-db-system-disabled-insight-details`` + * ``oci psql db-system create-db-system-enabled-insight-details`` + * ``oci psql db-system update-db-system-disabled-insight-details`` + * ``oci psql db-system update-db-system-enabled-insight-details` + * ``oci psql insight-capability-summary list-insight-capabilities`` + + * Support for replica configuration in Database System operations + + * ``oci psql db-system create --replication-config`` + * ``oci psql db-system update --replication-config`` + * ``oci psql db-system create-db-system-backup-source-details --replication-config`` + * ``oci psql db-system create-db-system-none-source-details --replication-config`` + * ``oci psql db-system create-db-system-oci-optimized-storage-details --replication-config`` + + * Support for replica database systems + + * ``oci psql db-system change-role-to-replica --db-system-id --primary-db-system-id`` + * ``oci psql db-system change-role-to-standalone --db-system-id --change-mode`` + * ``oci psql db-system-replica-collection list-db-system-replicas --db-system-id`` + * ``oci psql db-system create-db-system-primary-db-system-source-details --source-primary-db-system-id`` + + * Support for starting, stopping and switching DB Systems + + * ``oci psql db-system start`` + * ``oci psql db-system stop`` + * ``oci psql db-system switch-over`` + + * Support for Kerberos authentication details in DB system update operations + + * ``oci psql db-system update --kerberos-auth-details`` + * ``oci psql db-system update-db-system-disabled-kerberos-auth-details`` + * ``oci psql db-system update-db-system-enabled-kerberos-auth-details`` + + * Support for new system-role enum values on list db-systems + + * ``oci psql db-system-collection list-db-systems --system-role`` + +* Operator Access Control service + + * Support for new optional parameter `--num-days` + + * ``oci opctl access-request list --num-days`` + + * Support for OCI Notification topic integration + + * ``oci opctl operator-control create --notification-topic-id`` + * ``oci opctl operator-control update --notification-topic-id`` + + * Support for Cloud Exadata Infrastructure (`CLOUDEXADATAINFRASTRUCTURE`) resource type + + * ``oci opctl operator-control create --resource-type CLOUDEXADATAINFRASTRUCTURE`` + * ``oci opctl operator-control update --resource-type CLOUDEXADATAINFRASTRUCTURE`` + * ``oci opctl operator-control-assignment create --resource-type CLOUDEXADATAINFRASTRUCTURE`` + + * Support for new lifecycle state and waiter state `CUSTOMERASSIGNED` + + * ``oci opctl operator-control-assignment list --lifecycle-state CUSTOMERASSIGNED`` + * ``oci opctl operator-control-assignment create --wait-for-state CUSTOMERASSIGNED`` + * ``oci opctl operator-control-assignment delete --wait-for-state CUSTOMERASSIGNED`` + * ``oci opctl operator-control-assignment update --wait-for-state CUSTOMERASSIGNED`` + +* Secure Desktops service + + * Support for new optional parameter ``--security-attributes`` + + * ``oci desktops desktop-pool create --security-attributes`` + * ``oci desktops desktop-pool update --security-attributes`` + + * Support for new optional parameters ``--network-configuration`` and ``--private-access-details`` + + * ``oci desktops desktop-pool update --network-configuration --private-access-details`` + +* Application Performance Monitoring Control Plane service + + * Support for new optional parameter ``--log-group-id`` + + * ``oci apm-control-plane apm-domain create --log-group-id`` + * ``oci apm-control-plane apm-domain update --log-group-id`` + +* Application Performance Monitoring Configuration service + + * Support for Data File operations + + * ``oci apm-config data-file delete`` + * ``oci apm-config data-file get`` + * ``oci apm-config data-file head`` + * ``oci apm-config data-file put`` + * ``oci apm-config data-file-summary-collection list-data-files`` + +Changed +~~~~~~~ + +* Organizations Service + + * [BREAKING] Renamed the oci organizations work-request-error list command + + * ``oci organizations work-request-error list-errors`` + + * [BREAKING] Renamed the oci organizations work-request-log-entry list command + + * ``oci organizations work-request-log list`` 3.86.0 - 2026-06-09 ------------------- @@ -458,7 +639,6 @@ Added * Support for large generic v4 and v5 unit shapes in the Generative AI service in Python SDK - 3.81.0 - 2026-04-28 ------------------- Added @@ -561,7 +741,6 @@ Changed * ``oci batch batch-task-profile create --min-memory-in-gbs --min-ocpus`` - 3.80.0 - 2026-04-21 ------------------- Added @@ -2587,7 +2766,6 @@ Modified * ``oci opensearch cluster shapes-details list`` - 3.67.0 - 2025-09-30 -------------------- Added @@ -10291,7 +10469,6 @@ Added * ``oci resource-manager stack code`` - * Support for new optional parameters for Devops Deployments in Devops service * ``oci devops deployment create-pipeline-deployment --stage-override-arguments`` @@ -15571,8 +15748,6 @@ Changed * ``lifecycle_state, wait-for-state, job_type, harvest_status, workflow_status, schedule_type`` - - 2.11.1 - 2020-06-16 ------------------- Added @@ -16541,7 +16716,6 @@ Added * ``oci resource-manager stack get-stack-tf-state --file, --stack-id`` - 2.6.10 - 2019-10-29 ------------------- Added diff --git a/requirements.txt b/requirements.txt index c61543951..7bdef29f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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.178.0 +oci==2.179.0 packaging>=22.0,<25.0; python_version > '3.8' packaging==20.2; python_version <= '3.8' pluggy==0.13.0 diff --git a/services/apm_config/src/oci_cli_config/config_cli_extended.py b/services/apm_config/src/oci_cli_config/config_cli_extended.py index f1be36ccf..9ce9e93cd 100644 --- a/services/apm_config/src/oci_cli_config/config_cli_extended.py +++ b/services/apm_config/src/oci_cli_config/config_cli_extended.py @@ -112,3 +112,26 @@ # oci apm-config config update-config-update-macs-apm-extension-details -> oci apm-config config update-macs-extension cli_util.rename_command(config_cli, config_cli.config_group, config_cli.update_config_update_macs_apm_extension_details, "update-macs-extension") + + +# oci apm-config data-file-summary-collection list-data-files -> oci apm-config data-file-summary-collection list +cli_util.rename_command(config_cli, config_cli.data_file_summary_collection_group, config_cli.list_data_files, "list") + + +# oci apm-config data-file-summary-collection -> oci apm-config data-file-collection +cli_util.rename_command(config_cli, config_cli.apm_config_root_group, config_cli.data_file_summary_collection_group, "data-file-collection") + + +@cli_util.copy_params_from_generated_command(config_cli.put_data_file, params_to_exclude=['put_data_file_body']) +@config_cli.data_file_group.command(name=config_cli.put_data_file.name, help=config_cli.put_data_file.help) +@cli_util.option('--data-file-body', required=True, help=u"""The data file to be uploaded. [required]""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def put_data_file_extended(ctx, **kwargs): + + if 'data_file_body' in kwargs: + kwargs['put_data_file_body'] = kwargs['data_file_body'] + kwargs.pop('data_file_body') + + ctx.invoke(config_cli.put_data_file, **kwargs) diff --git a/services/apm_config/src/oci_cli_config/generated/config_cli.py b/services/apm_config/src/oci_cli_config/generated/config_cli.py index 0a32c3ec1..8adb59ff9 100644 --- a/services/apm_config/src/oci_cli_config/generated/config_cli.py +++ b/services/apm_config/src/oci_cli_config/generated/config_cli.py @@ -29,12 +29,24 @@ def metric_group_group(): pass +@click.command(cli_util.override('apm_config.data_file_group.command_name', 'data-file'), cls=CommandGroupWithAlias, help="""The data file to be uploaded.""") +@cli_util.help_option_group +def data_file_group(): + pass + + @click.command(cli_util.override('apm_config.import_configuration_details_group.command_name', 'import-configuration-details'), cls=CommandGroupWithAlias, help="""Array of configuration items with dependencies to import.""") @cli_util.help_option_group def import_configuration_details_group(): pass +@click.command(cli_util.override('apm_config.data_file_summary_collection_group.command_name', 'data-file-summary-collection'), cls=CommandGroupWithAlias, help="""A collection of Data File summaries.""") +@cli_util.help_option_group +def data_file_summary_collection_group(): + pass + + @click.command(cli_util.override('apm_config.span_filter_group.command_name', 'span-filter'), cls=CommandGroupWithAlias, help="""A named setting that specifies the filter criteria to match a subset of the spans.""") @cli_util.help_option_group def span_filter_group(): @@ -72,7 +84,9 @@ def test_output_group(): apm_config_root_group.add_command(metric_group_group) +apm_config_root_group.add_command(data_file_group) apm_config_root_group.add_command(import_configuration_details_group) +apm_config_root_group.add_command(data_file_summary_collection_group) apm_config_root_group.add_command(span_filter_group) apm_config_root_group.add_command(config_collection_group) apm_config_root_group.add_command(export_configuration_details_group) @@ -458,6 +472,36 @@ def delete_config(ctx, from_json, apm_domain_id, config_id, if_match): cli_util.render_response(result, ctx) +@data_file_group.command(name=cli_util.override('apm_config.delete_data_file.command_name', 'delete'), help=u"""Removes the data file. \n[Command Reference](deleteDataFile)""") +@cli_util.option('--data-file-name', required=True, help=u"""The name of the data file.""") +@cli_util.option('--apm-domain-id', required=True, help=u"""The APM Domain ID the request is intended for.""") +@cli_util.option('--apm-type', required=True, help=u"""The type of the data file.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_data_file(ctx, from_json, data_file_name, apm_domain_id, apm_type, if_match): + + if isinstance(data_file_name, six.string_types) and len(data_file_name.strip()) == 0: + raise click.UsageError('Parameter --data-file-name cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_client_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('apm_config', 'config', ctx) + result = client.delete_data_file( + data_file_name=data_file_name, + apm_domain_id=apm_domain_id, + apm_type=apm_type, + **kwargs + ) + cli_util.render_response(result, ctx) + + @export_configuration_details_group.command(name=cli_util.override('apm_config.export_configuration.command_name', 'export-configuration'), help=u"""Exports configurations for the whole domain by domainId. \n[Command Reference](exportConfiguration)""") @cli_util.option('--configuration-map', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that has parameters related to the export process (ConfigurationId, Skip, \u2026) and more. Example: `{\"parameter-key\": \"parameter-value\"}` Supported parameters: \u2014 List of the Configuration Type or Groups to Export to a destination domain.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--apm-domain-id', required=True, help=u"""The APM Domain ID the request is intended for.""") @@ -507,6 +551,55 @@ def get_config(ctx, from_json, apm_domain_id, config_id): cli_util.render_response(result, ctx) +@data_file_group.command(name=cli_util.override('apm_config.get_data_file.command_name', 'get'), help=u"""Retrieves the Data file with the specified name and type. \n[Command Reference](getDataFile)""") +@cli_util.option('--data-file-name', required=True, help=u"""The name of the data file.""") +@cli_util.option('--apm-domain-id', required=True, help=u"""The APM Domain ID the request is intended for.""") +@cli_util.option('--apm-type', required=True, help=u"""The type of the data file.""") +@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.") +@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_data_file(ctx, from_json, file, data_file_name, apm_domain_id, apm_type): + + if isinstance(data_file_name, six.string_types) and len(data_file_name.strip()) == 0: + raise click.UsageError('Parameter --data-file-name cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_client_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('apm_config', 'config', ctx) + result = client.get_data_file( + data_file_name=data_file_name, + apm_domain_id=apm_domain_id, + apm_type=apm_type, + **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() + + @match_agents_with_attribute_key_group.command(name=cli_util.override('apm_config.get_match_agents_with_attribute_key.command_name', 'get'), help=u"""The domain-wide agents matching attribute key. \n[Command Reference](getMatchAgentsWithAttributeKey)""") @cli_util.option('--apm-domain-id', required=True, help=u"""The APM Domain ID the request is intended for.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -526,6 +619,32 @@ def get_match_agents_with_attribute_key(ctx, from_json, apm_domain_id): cli_util.render_response(result, ctx) +@data_file_group.command(name=cli_util.override('apm_config.head_data_file.command_name', 'head'), help=u"""Returns metadata about the datafile. \n[Command Reference](headDataFile)""") +@cli_util.option('--data-file-name', required=True, help=u"""The name of the data file.""") +@cli_util.option('--apm-domain-id', required=True, help=u"""The APM Domain ID the request is intended for.""") +@cli_util.option('--apm-type', required=True, help=u"""The type of the data file.""") +@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 head_data_file(ctx, from_json, data_file_name, apm_domain_id, apm_type): + + if isinstance(data_file_name, six.string_types) and len(data_file_name.strip()) == 0: + raise click.UsageError('Parameter --data-file-name cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_client_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('apm_config', 'config', ctx) + result = client.head_data_file( + data_file_name=data_file_name, + apm_domain_id=apm_domain_id, + apm_type=apm_type, + **kwargs + ) + cli_util.render_response(result, ctx) + + @import_configuration_details_group.command(name=cli_util.override('apm_config.import_configuration.command_name', 'import-configuration'), help=u"""Import configurations Item(s) with its dependencies into a destination domain. \n[Command Reference](importConfiguration)""") @cli_util.option('--configuration-items', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of Configurations Details .""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--configuration-map', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that has parameters related to the import process (EnableOcidSubstitution, Skip, \u2026) and more. Example: `{\"parameter-key\": \"parameter-value\"}` Supported parameters: \u2014 Enable the OCIDs in instructions to be replaced, if set to \"true\" The Config Service replace any OCIDs it finds in the instructions, if set to true the Config Service will replace. \u2014 Compartment Id we want to import the configuration Items, if the compartment Id is not provided it will be the default destination domain compartmentId.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -628,6 +747,133 @@ def list_configs(ctx, from_json, all_pages, page_size, apm_domain_id, config_typ cli_util.render_response(result, ctx) +@data_file_summary_collection_group.command(name=cli_util.override('apm_config.list_data_files.command_name', 'list-data-files'), help=u"""Fetches a list of Data files using some parameters. \n[Command Reference](listDataFiles)""") +@cli_util.option('--apm-domain-id', required=True, help=u"""The APM Domain ID the request is intended for.""") +@cli_util.option('--apm-type', help=u"""The type of the data file.""") +@cli_util.option('--name', help=u"""A filter to return resources that match the specified name. Supports regular expressions to filter data files.""") +@cli_util.option('--time-last-modified-before', type=custom_types.CLI_DATETIME, help=u"""Return data files with time 'timeLastModified' before the specified time, expressed in [RFC 3339] timestamp format. Example: `2020-02-19T22:47:12.613Z`""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-last-modified-after', type=custom_types.CLI_DATETIME, help=u"""Return data files with the 'timeLastModified' after the specified time, expressed in [RFC 3339] timestamp format. Example: `2020-02-19T22:47:12.613Z`""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""The maximum number of results per page, or items to return in a paginated \"List\" call. For information on how pagination works, see [List Pagination]. Example: `50`""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`). The displayName sort order is case-sensitive.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["displayName", "timeCreated", "timeUpdated"]), help=u"""The field to sort by. You can provide one \"sortBy\" value. The default order for displayName, timeCreated and timeUpdated is ascending. The displayName sort by is case-sensitive.""") +@cli_util.option('--metadata', help=u"""A string containing a JSON-encoded object with metadata related to the uploaded file or resource. Example: {\"fileName\":\"report.pdf\",\"uploader\":\"jane.doe\",\"category\":\"financial\"}""") +@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': 'apm_config', 'class': 'DataFileSummaryCollection'}) +@cli_util.wrap_exceptions +def list_data_files(ctx, from_json, all_pages, page_size, apm_domain_id, apm_type, name, time_last_modified_before, time_last_modified_after, limit, page, sort_order, sort_by, metadata): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if apm_type is not None: + kwargs['apm_type'] = apm_type + if name is not None: + kwargs['name'] = name + if time_last_modified_before is not None: + kwargs['time_last_modified_before'] = time_last_modified_before + if time_last_modified_after is not None: + kwargs['time_last_modified_after'] = time_last_modified_after + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if metadata is not None: + kwargs['metadata'] = metadata + kwargs['opc_client_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('apm_config', 'config', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_data_files, + apm_domain_id=apm_domain_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_data_files, + limit, + page_size, + apm_domain_id=apm_domain_id, + **kwargs + ) + else: + result = client.list_data_files( + apm_domain_id=apm_domain_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@data_file_group.command(name=cli_util.override('apm_config.put_data_file.command_name', 'put'), help=u"""Creates a new data file or replaces an existing one with the same name and type. \n[Command Reference](putDataFile)""") +@cli_util.option('--put-data-file-body', required=True, help=u"""The data file to be uploaded.""") +@cli_util.option('--data-file-name', required=True, help=u"""The name of the data file.""") +@cli_util.option('--apm-domain-id', required=True, help=u"""The APM Domain ID the request is intended for.""") +@cli_util.option('--apm-type', required=True, help=u"""The type of the data file.""") +@cli_util.option('--content-md5', help=u"""Optional base64-encoded MD5 hash of the request body. If provided, the server will perform a data integrity check by computing the MD5 of the received content and comparing it to the supplied value. + +If the values do not match, the request will be rejected with an HTTP 400 error and a message such as: + +\"The computed MD5 of the request body (ACTUAL_MD5) does not match the Content-MD5 header (HEADER_MD5)\"""") +@cli_util.option('--content-type', help=u"""Optional parameter specifying the media type (MIME type) of the request or response body. If not specified, the default is `application/octet-stream`. + +This value can be used by recipients to determine how to interpret or render the content.""") +@cli_util.option('--content-language', help=u"""Optional parameter that indicates the natural language of the content. This value can be used by clients or intermediaries to select or display content based on language preferences.""") +@cli_util.option('--content-encoding', help=u"""Optional parameter indicating the content encodings applied to the request body (e.g., gzip, deflate). This value can be used by recipients to determine how to decode the content.""") +@cli_util.option('--content-disposition', help=u"""Optional parameter that provides presentation information for how the content should be displayed or handled by the recipient. + +For example, to prompt a file download with a custom filename: `attachment; filename=\"example.txt\"`""") +@cli_util.option('--metadata', help=u"""A string containing a JSON-encoded object with metadata related to the uploaded file or resource. Example: {\"fileName\":\"report.pdf\",\"uploader\":\"jane.doe\",\"category\":\"financial\"}""") +@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 put_data_file(ctx, from_json, put_data_file_body, data_file_name, apm_domain_id, apm_type, content_md5, content_type, content_language, content_encoding, content_disposition, metadata): + + if isinstance(data_file_name, six.string_types) and len(data_file_name.strip()) == 0: + raise click.UsageError('Parameter --data-file-name cannot be whitespace or empty string') + + kwargs = {} + if content_md5 is not None: + kwargs['content_md5'] = content_md5 + if content_type is not None: + kwargs['content_type'] = content_type + if content_language is not None: + kwargs['content_language'] = content_language + if content_encoding is not None: + kwargs['content_encoding'] = content_encoding + if content_disposition is not None: + kwargs['content_disposition'] = content_disposition + if metadata is not None: + kwargs['metadata'] = metadata + kwargs['opc_client_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + # do not automatically retry operations with binary inputs + kwargs['retry_strategy'] = oci.retry.NoneRetryStrategy() + + client = cli_util.build_client('apm_config', 'config', ctx) + result = client.put_data_file( + put_data_file_body=put_data_file_body, + data_file_name=data_file_name, + apm_domain_id=apm_domain_id, + apm_type=apm_type, + **kwargs + ) + cli_util.render_response(result, ctx) + + @metric_group_group.command(name=cli_util.override('apm_config.retrieve_namespace_metrics.command_name', 'retrieve-namespace-metrics'), help=u"""Returns all metrics associated with the specified namespace. \n[Command Reference](retrieveNamespaceMetrics)""") @cli_util.option('--apm-domain-id', required=True, help=u"""The APM Domain ID the request is intended for.""") @cli_util.option('--name', required=True, help=u"""Name of the namespace.""") diff --git a/services/apm_config/tests/util/generated/command_to_api.py b/services/apm_config/tests/util/generated/command_to_api.py index c4b5cee08..10f3fc28b 100644 --- a/services/apm_config/tests/util/generated/command_to_api.py +++ b/services/apm_config/tests/util/generated/command_to_api.py @@ -5,11 +5,16 @@ "apm_config.copy_configuration": "oci.apm_config.ConfigClient.copy_configuration", "apm_config.create_config": "oci.apm_config.ConfigClient.create_config", "apm_config.delete_config": "oci.apm_config.ConfigClient.delete_config", + "apm_config.delete_data_file": "oci.apm_config.ConfigClient.delete_data_file", "apm_config.export_configuration": "oci.apm_config.ConfigClient.export_configuration", "apm_config.get_config": "oci.apm_config.ConfigClient.get_config", + "apm_config.get_data_file": "oci.apm_config.ConfigClient.get_data_file", "apm_config.get_match_agents_with_attribute_key": "oci.apm_config.ConfigClient.get_match_agents_with_attribute_key", + "apm_config.head_data_file": "oci.apm_config.ConfigClient.head_data_file", "apm_config.import_configuration": "oci.apm_config.ConfigClient.import_configuration", "apm_config.list_configs": "oci.apm_config.ConfigClient.list_configs", + "apm_config.list_data_files": "oci.apm_config.ConfigClient.list_data_files", + "apm_config.put_data_file": "oci.apm_config.ConfigClient.put_data_file", "apm_config.retrieve_namespace_metrics": "oci.apm_config.ConfigClient.retrieve_namespace_metrics", "apm_config.retrieve_namespaces": "oci.apm_config.ConfigClient.retrieve_namespaces", "apm_config.test": "oci.apm_config.ConfigClient.test", diff --git a/services/apm_control_plane/src/oci_cli_apm_domain/generated/apmdomain_cli.py b/services/apm_control_plane/src/oci_cli_apm_domain/generated/apmdomain_cli.py index 508b9e124..7219a6389 100644 --- a/services/apm_control_plane/src/oci_cli_apm_domain/generated/apmdomain_cli.py +++ b/services/apm_control_plane/src/oci_cli_apm_domain/generated/apmdomain_cli.py @@ -125,6 +125,7 @@ def change_apm_domain_compartment(ctx, from_json, wait_for_state, max_wait_secon @cli_util.option('--display-name', required=True, help=u"""Display name of the APM domain.""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment corresponding to the APM domain.""") @cli_util.option('--description', help=u"""Description of the APM domain.""") +@cli_util.option('--log-group-id', help=u"""The OCID of the Log Analytics log group to which the data uploaded to this APM domain will be mapped to.""") @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--is-free-tier', type=click.BOOL, help=u"""Indicates whether this is an \"Always Free\" resource. The default value is false.""") @@ -136,7 +137,7 @@ def change_apm_domain_compartment(ctx, from_json, wait_for_state, max_wait_secon @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'apm_control_plane', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'apm_control_plane', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def create_apm_domain(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, description, freeform_tags, defined_tags, is_free_tier): +def create_apm_domain(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, description, log_group_id, freeform_tags, defined_tags, is_free_tier): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -148,6 +149,9 @@ def create_apm_domain(ctx, from_json, wait_for_state, max_wait_seconds, wait_int if description is not None: _details['description'] = description + if log_group_id is not None: + _details['logGroupId'] = log_group_id + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -697,6 +701,7 @@ def remove_data_keys(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte @cli_util.option('--apm-domain-id', required=True, help=u"""The OCID of the APM domain.""") @cli_util.option('--display-name', help=u"""Display name of the APM domain.""") @cli_util.option('--description', help=u"""Description of the APM domain.""") +@cli_util.option('--log-group-id', help=u"""The OCID of the Log Analytics log group to which the data uploaded to this APM domain will be mapped to.""") @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. 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.""") @@ -709,7 +714,7 @@ def remove_data_keys(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'apm_control_plane', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'apm_control_plane', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_apm_domain(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, apm_domain_id, display_name, description, freeform_tags, defined_tags, if_match): +def update_apm_domain(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, apm_domain_id, display_name, description, log_group_id, freeform_tags, defined_tags, if_match): if isinstance(apm_domain_id, six.string_types) and len(apm_domain_id.strip()) == 0: raise click.UsageError('Parameter --apm-domain-id cannot be whitespace or empty string') @@ -731,6 +736,9 @@ def update_apm_domain(ctx, from_json, force, wait_for_state, max_wait_seconds, w if description is not None: _details['description'] = description + if log_group_id is not None: + _details['logGroupId'] = log_group_id + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) diff --git a/services/cloud_migrations/src/oci_cli_migration/generated/migration_cli.py b/services/cloud_migrations/src/oci_cli_migration/generated/migration_cli.py index b9831612f..a16203d0d 100644 --- a/services/cloud_migrations/src/oci_cli_migration/generated/migration_cli.py +++ b/services/cloud_migrations/src/oci_cli_migration/generated/migration_cli.py @@ -340,15 +340,18 @@ def change_replication_schedule_compartment(ctx, from_json, wait_for_state, max_ @cli_util.option('--migration-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. It exists only for cross-compatibility. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Security attributes for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. + +Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"enforce\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "NEEDS_ATTENTION", "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({'migration-config': {'module': 'cloud_migrations', 'class': 'MigrationConfig'}, 'freeform-tags': {'module': 'cloud_migrations', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'migration-config': {'module': 'cloud_migrations', 'class': 'MigrationConfig'}, 'freeform-tags': {'module': 'cloud_migrations', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'cloud_migrations', '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={'migration-config': {'module': 'cloud_migrations', 'class': 'MigrationConfig'}, 'freeform-tags': {'module': 'cloud_migrations', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'cloud_migrations', 'class': 'Migration'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'migration-config': {'module': 'cloud_migrations', 'class': 'MigrationConfig'}, 'freeform-tags': {'module': 'cloud_migrations', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'cloud_migrations', 'class': 'Migration'}) @cli_util.wrap_exceptions -def create_migration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, migration_type, replication_schedule_id, is_completed, migration_config, freeform_tags, defined_tags): +def create_migration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, migration_type, replication_schedule_id, is_completed, migration_config, freeform_tags, defined_tags, security_attributes): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -375,6 +378,9 @@ def create_migration(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + client = cli_util.build_client('cloud_migrations', 'migration', ctx) result = client.create_migration( create_migration_details=_details, @@ -2258,23 +2264,26 @@ def start_migration_replication(ctx, from_json, wait_for_state, max_wait_seconds @cli_util.option('--migration-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. It exists only for cross-compatibility. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Security attributes for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. + +Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"enforce\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "NEEDS_ATTENTION", "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({'migration-config': {'module': 'cloud_migrations', 'class': 'MigrationConfig'}, 'freeform-tags': {'module': 'cloud_migrations', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'migration-config': {'module': 'cloud_migrations', 'class': 'MigrationConfig'}, 'freeform-tags': {'module': 'cloud_migrations', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'cloud_migrations', '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={'migration-config': {'module': 'cloud_migrations', 'class': 'MigrationConfig'}, 'freeform-tags': {'module': 'cloud_migrations', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'cloud_migrations', 'class': 'Migration'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'migration-config': {'module': 'cloud_migrations', 'class': 'MigrationConfig'}, 'freeform-tags': {'module': 'cloud_migrations', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'cloud_migrations', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'cloud_migrations', 'class': 'Migration'}) @cli_util.wrap_exceptions -def update_migration(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, migration_id, display_name, replication_schedule_id, is_completed, migration_type, migration_config, freeform_tags, defined_tags, if_match): +def update_migration(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, migration_id, display_name, replication_schedule_id, is_completed, migration_type, migration_config, freeform_tags, defined_tags, security_attributes, if_match): if isinstance(migration_id, six.string_types) and len(migration_id.strip()) == 0: raise click.UsageError('Parameter --migration-id cannot be whitespace or empty string') if not force: - if migration_config or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to migration-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if migration_config or freeform_tags or defined_tags or security_attributes: + if not click.confirm("WARNING: Updates to migration-config and freeform-tags and defined-tags and security-attributes will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2305,6 +2314,9 @@ def update_migration(ctx, from_json, force, wait_for_state, max_wait_seconds, wa if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + client = cli_util.build_client('cloud_migrations', 'migration', ctx) result = client.update_migration( migration_id=migration_id, 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 9834cf4d5..fd7b84642 100644 --- a/services/core/src/oci_cli_compute/generated/compute_cli.py +++ b/services/core/src/oci_cli_compute/generated/compute_cli.py @@ -11377,39 +11377,31 @@ def terminate_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_in work_request_client = cli_util.build_client('work_requests', 'work_request', ctx) if wait_for_state: - if hasattr(client, 'get_instance') and callable(getattr(client, 'get_instance')): + 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 resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - oci.wait_until(client, client.get_instance(instance_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs) - except oci.exceptions.ServiceError as e: - # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the - # outcome of a delete operation it is possible that the resource is already gone and so the initial service call - # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising - # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument - # succeed_on_not_found=True to the waiter). - # - # Any non-404 should still result in the exception being thrown. - if e.status == 404: - pass - else: - raise + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(work_request_client, work_request_client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. Please retrieve the work request to find its current state', file=sys.stderr) cli_util.render_response(result, ctx) sys.exit(2) except Exception: - click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) cli_util.render_response(result, ctx) raise else: - click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) diff --git a/services/database/src/oci_cli_database/database_cli_extended.py b/services/database/src/oci_cli_database/database_cli_extended.py index 6366623b5..027447749 100644 --- a/services/database/src/oci_cli_database/database_cli_extended.py +++ b/services/database/src/oci_cli_database/database_cli_extended.py @@ -1332,6 +1332,16 @@ def db_node_stop(ctx, **kwargs): ctx.invoke(database_cli.db_node_action, **kwargs) +@cli_util.copy_params_from_generated_command(database_cli.db_node_action, params_to_exclude=['action']) +@database_cli.db_node_group.command(name='force-stop', help="""Powers off the specified DB node forcefully.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database', 'class': 'DbNode'}) +@cli_util.wrap_exceptions +def db_node_forcestop(ctx, **kwargs): + kwargs['action'] = 'forcestop' + ctx.invoke(database_cli.db_node_action, **kwargs) + + @cli_util.copy_params_from_generated_command(database_cli.db_node_action, params_to_exclude=['action']) @database_cli.db_node_group.command(name='soft-reset', help="""Performs an ACPI shutdown and powers on the specified DB node.""") @click.pass_context @@ -1352,6 +1362,16 @@ def db_node_reset(ctx, **kwargs): ctx.invoke(database_cli.db_node_action, **kwargs) +@cli_util.copy_params_from_generated_command(database_cli.db_node_action, params_to_exclude=['action']) +@database_cli.db_node_group.command(name='force-reset', help="""Powers off and powers on the specified DB node forcefully.""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database', 'class': 'DbNode'}) +@cli_util.wrap_exceptions +def db_node_forcereset(ctx, **kwargs): + kwargs['action'] = 'forcereset' + ctx.invoke(database_cli.db_node_action, **kwargs) + + @cli_util.copy_params_from_generated_command(database_cli.update_db_system, params_to_exclude=['ssh_public_keys', 'version_parameterconflict', 'data_collection_options']) @database_cli.db_system_group.command(name='update', help=database_cli.update_db_system.help) @cli_util.option('--patch-action', help="""The action to perform on the patch.""") diff --git a/services/database/src/oci_cli_database/generated/database_cli.py b/services/database/src/oci_cli_database/generated/database_cli.py index bbd46a280..a811bb23e 100644 --- a/services/database/src/oci_cli_database/generated/database_cli.py +++ b/services/database/src/oci_cli_database/generated/database_cli.py @@ -17157,11 +17157,11 @@ def create_vm_cluster_network(ctx, from_json, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) -@db_node_group.command(name=cli_util.override('db.db_node_action.command_name', 'db-node-action'), help=u"""Performs one of the following power actions on the specified DB node: - start - power on - stop - power off gracefully - softreset - ACPI shutdown and power on - reset - power off and power on +@db_node_group.command(name=cli_util.override('db.db_node_action.command_name', 'db-node-action'), help=u"""Performs one of the following power actions on the specified DB node: - start - power on - stop - power off gracefully - forcestop - power off forcefully - forcereset - ACPI shutdown and power on forcefully - softreset - ACPI shutdown and power on - reset - power off and power on **Note:** Stopping a node affects billing differently, depending on the type of DB system: *Bare metal and Exadata systems* - The _stop_ state has no effect on the resources you consume. Billing continues for DB nodes that you stop, and related resources continue to apply against any relevant quotas. You must terminate the DB system ([TerminateDbSystem]) to remove its resources from billing and quotas. *Virtual machine DB systems* - Stopping a node stops billing for all OCPUs associated with that node, and billing resumes when you restart the node. \n[Command Reference](dbNodeAction)""") @cli_util.option('--db-node-id', required=True, help=u"""The database node [OCID].""") -@cli_util.option('--action', required=True, help=u"""The action to perform on the DB Node. Allowed values are: STOP, START, SOFTRESET, RESET""") +@cli_util.option('--action', required=True, help=u"""The action to perform on the DB Node. Allowed values are: STOP, FORCESTOP, FORCERESET, START, SOFTRESET, RESET""") @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(["PROVISIONING", "AVAILABLE", "UPDATING", "STOPPING", "STOPPED", "STARTING", "TERMINATING", "TERMINATED", "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 PROVISIONING --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.""") @@ -32121,6 +32121,7 @@ def resource_pool_shapes(ctx, from_json, if_match, limit, page): @autonomous_container_database_group.command(name=cli_util.override('db.restart_autonomous_container_database.command_name', 'restart'), help=u"""Rolling restarts the specified Autonomous Container Database. \n[Command Reference](restartAutonomousContainerDatabase)""") @cli_util.option('--autonomous-container-database-id', required=True, help=u"""The Autonomous Container Database [OCID].""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--is-force-restart', type=click.BOOL, help=u"""If set to `true`, restarts the Autonomous Container Database with force option.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["PROVISIONING", "AVAILABLE", "UPDATING", "TERMINATING", "TERMINATED", "FAILED", "BACKUP_IN_PROGRESS", "RESTORING", "RESTORE_FAILED", "RESTARTING", "MAINTENANCE_IN_PROGRESS", "ROLE_CHANGE_IN_PROGRESS", "ENABLING_AUTONOMOUS_DATA_GUARD", "UNAVAILABLE"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state PROVISIONING --wait-for-state UNAVAILABLE would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, 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.""") @@ -32129,7 +32130,7 @@ def resource_pool_shapes(ctx, from_json, if_match, limit, page): @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database', 'class': 'AutonomousContainerDatabase'}) @cli_util.wrap_exceptions -def restart_autonomous_container_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, autonomous_container_database_id, if_match): +def restart_autonomous_container_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, autonomous_container_database_id, if_match, is_force_restart): if isinstance(autonomous_container_database_id, six.string_types) and len(autonomous_container_database_id.strip()) == 0: raise click.UsageError('Parameter --autonomous-container-database-id cannot be whitespace or empty string') @@ -32138,9 +32139,16 @@ def restart_autonomous_container_database(ctx, from_json, wait_for_state, max_wa if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if is_force_restart is not None: + _details['isForceRestart'] = is_force_restart + client = cli_util.build_client('database', 'database', ctx) result = client.restart_autonomous_container_database( autonomous_container_database_id=autonomous_container_database_id, + restart_autonomous_container_database_details=_details, **kwargs ) if wait_for_state: @@ -32173,6 +32181,7 @@ def restart_autonomous_container_database(ctx, from_json, wait_for_state, max_wa @cli_util.option('--autonomous-database-id', required=True, help=u"""The database [OCID].""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--is-online-restart', type=click.BOOL, help=u"""If provided, an online restart will be triggered.""") +@cli_util.option('--is-force-restart', type=click.BOOL, help=u"""If set to `true`, restarts the Autonomous Database with force option.""") @cli_util.option('--opc-dry-run', type=click.BOOL, help=u"""Indicates that the request is a dry run, if set to \"true\". A dry run request does not actually creating or updating a resource and is used only to perform validation on the submitted data.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["PROVISIONING", "AVAILABLE", "STOPPING", "STOPPED", "STARTING", "TERMINATING", "TERMINATED", "UNAVAILABLE", "RESTORE_IN_PROGRESS", "RESTORE_FAILED", "BACKUP_IN_PROGRESS", "SCALE_IN_PROGRESS", "AVAILABLE_NEEDS_ATTENTION", "UPDATING", "MAINTENANCE_IN_PROGRESS", "RESTARTING", "RECREATING", "ROLE_CHANGE_IN_PROGRESS", "UPGRADING", "INACCESSIBLE", "STANDBY", "TRANSPORTING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state PROVISIONING --wait-for-state TRANSPORTING would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, 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.""") @@ -32182,7 +32191,7 @@ def restart_autonomous_container_database(ctx, from_json, wait_for_state, max_wa @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database', 'class': 'AutonomousDatabase'}) @cli_util.wrap_exceptions -def restart_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, autonomous_database_id, if_match, is_online_restart, opc_dry_run): +def restart_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, autonomous_database_id, if_match, is_online_restart, is_force_restart, opc_dry_run): if isinstance(autonomous_database_id, six.string_types) and len(autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --autonomous-database-id cannot be whitespace or empty string') @@ -32194,9 +32203,16 @@ def restart_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds kwargs['is_online_restart'] = is_online_restart if opc_dry_run is not None: kwargs['opc_dry_run'] = opc_dry_run + + _details = {} + + if is_force_restart is not None: + _details['isForceRestart'] = is_force_restart + client = cli_util.build_client('database', 'database', ctx) result = client.restart_autonomous_database( autonomous_database_id=autonomous_database_id, + restart_autonomous_database_details=_details, **kwargs ) if wait_for_state: @@ -32225,6 +32241,132 @@ def restart_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds cli_util.render_response(result, ctx) +@autonomous_vm_cluster_group.command(name=cli_util.override('db.restart_autonomous_vm_cluster_ords.command_name', 'restart-autonomous-vm-cluster-ords'), help=u"""Restarts Oracle REST Data Services (ORDS) for Autonomous Exadata VM cluster. \n[Command Reference](restartAutonomousVmClusterOrds)""") +@cli_util.option('--autonomous-vm-cluster-id', required=True, help=u"""The autonomous VM cluster [OCID].""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "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({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def restart_autonomous_vm_cluster_ords(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, autonomous_vm_cluster_id, if_match): + + if isinstance(autonomous_vm_cluster_id, six.string_types) and len(autonomous_vm_cluster_id.strip()) == 0: + raise click.UsageError('Parameter --autonomous-vm-cluster-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', 'database', ctx) + result = client.restart_autonomous_vm_cluster_ords( + autonomous_vm_cluster_id=autonomous_vm_cluster_id, + **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) + + +@cloud_autonomous_vm_cluster_group.command(name=cli_util.override('db.restart_cloud_autonomous_vm_cluster_ords.command_name', 'restart-cloud-autonomous-vm-cluster-ords'), help=u"""Restarts Oracle REST Data Services (ORDS) for a cloud Autonomous Exadata VM cluster. \n[Command Reference](restartCloudAutonomousVmClusterOrds)""") +@cli_util.option('--cloud-autonomous-vm-cluster-id', required=True, help=u"""The Cloud VM cluster [OCID].""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "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({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def restart_cloud_autonomous_vm_cluster_ords(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, cloud_autonomous_vm_cluster_id, if_match): + + if isinstance(cloud_autonomous_vm_cluster_id, six.string_types) and len(cloud_autonomous_vm_cluster_id.strip()) == 0: + raise click.UsageError('Parameter --cloud-autonomous-vm-cluster-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', 'database', ctx) + result = client.restart_cloud_autonomous_vm_cluster_ords( + cloud_autonomous_vm_cluster_id=cloud_autonomous_vm_cluster_id, + **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) + + @autonomous_database_group.command(name=cli_util.override('db.restore_autonomous_database.command_name', 'restore'), help=u"""Restores an Autonomous AI Database based on the provided request parameters. \n[Command Reference](restoreAutonomousDatabase)""") @cli_util.option('--autonomous-database-id', required=True, help=u"""The database [OCID].""") @cli_util.option('--timestamp', type=custom_types.CLI_DATETIME, help=u"""The time to restore the database to.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @@ -33589,6 +33731,7 @@ def start_pluggable_database(ctx, from_json, wait_for_state, max_wait_seconds, w @autonomous_database_group.command(name=cli_util.override('db.stop_autonomous_database.command_name', 'stop'), help=u"""Stops the specified Autonomous AI Database. \n[Command Reference](stopAutonomousDatabase)""") @cli_util.option('--autonomous-database-id', required=True, help=u"""The database [OCID].""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--is-force-stop', type=click.BOOL, help=u"""If set to `true`, stops the Autonomous Database with force option.""") @cli_util.option('--opc-dry-run', type=click.BOOL, help=u"""Indicates that the request is a dry run, if set to \"true\". A dry run request does not actually creating or updating a resource and is used only to perform validation on the submitted data.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["PROVISIONING", "AVAILABLE", "STOPPING", "STOPPED", "STARTING", "TERMINATING", "TERMINATED", "UNAVAILABLE", "RESTORE_IN_PROGRESS", "RESTORE_FAILED", "BACKUP_IN_PROGRESS", "SCALE_IN_PROGRESS", "AVAILABLE_NEEDS_ATTENTION", "UPDATING", "MAINTENANCE_IN_PROGRESS", "RESTARTING", "RECREATING", "ROLE_CHANGE_IN_PROGRESS", "UPGRADING", "INACCESSIBLE", "STANDBY", "TRANSPORTING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state PROVISIONING --wait-for-state TRANSPORTING would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, 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.""") @@ -33598,7 +33741,7 @@ def start_pluggable_database(ctx, from_json, wait_for_state, max_wait_seconds, w @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database', 'class': 'AutonomousDatabase'}) @cli_util.wrap_exceptions -def stop_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, autonomous_database_id, if_match, opc_dry_run): +def stop_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, autonomous_database_id, if_match, is_force_stop, opc_dry_run): if isinstance(autonomous_database_id, six.string_types) and len(autonomous_database_id.strip()) == 0: raise click.UsageError('Parameter --autonomous-database-id cannot be whitespace or empty string') @@ -33609,9 +33752,16 @@ def stop_autonomous_database(ctx, from_json, wait_for_state, max_wait_seconds, w if opc_dry_run is not None: kwargs['opc_dry_run'] = opc_dry_run kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if is_force_stop is not None: + _details['isForceStop'] = is_force_stop + client = cli_util.build_client('database', 'database', ctx) result = client.stop_autonomous_database( autonomous_database_id=autonomous_database_id, + stop_autonomous_database_details=_details, **kwargs ) if wait_for_state: diff --git a/services/database/tests/util/generated/command_to_api.py b/services/database/tests/util/generated/command_to_api.py index feabcf24b..cd7c2a2cd 100644 --- a/services/database/tests/util/generated/command_to_api.py +++ b/services/database/tests/util/generated/command_to_api.py @@ -375,6 +375,8 @@ "db.resource_pool_shapes": "oci.database.DatabaseClient.resource_pool_shapes", "db.restart_autonomous_container_database": "oci.database.DatabaseClient.restart_autonomous_container_database", "db.restart_autonomous_database": "oci.database.DatabaseClient.restart_autonomous_database", + "db.restart_autonomous_vm_cluster_ords": "oci.database.DatabaseClient.restart_autonomous_vm_cluster_ords", + "db.restart_cloud_autonomous_vm_cluster_ords": "oci.database.DatabaseClient.restart_cloud_autonomous_vm_cluster_ords", "db.restore_autonomous_database": "oci.database.DatabaseClient.restore_autonomous_database", "db.restore_database": "oci.database.DatabaseClient.restore_database", "db.rotate_autonomous_container_database_encryption_key": "oci.database.DatabaseClient.rotate_autonomous_container_database_encryption_key", diff --git a/services/desktops/src/oci_cli_desktop_service/generated/desktopservice_cli.py b/services/desktops/src/oci_cli_desktop_service/generated/desktopservice_cli.py index 5b6dbb0d3..87b520070 100644 --- a/services/desktops/src/oci_cli_desktop_service/generated/desktopservice_cli.py +++ b/services/desktops/src/oci_cli_desktop_service/generated/desktopservice_cli.py @@ -172,16 +172,19 @@ def change_desktop_pool_compartment(ctx, from_json, wait_for_state, max_wait_sec @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of network security groups for the private access.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--private-access-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""[Security attributes] for this resource. Each attribute can be referenced in a [Zero Trust Packet Routing] (ZPR) policy to control access to ZPR-supported resources. + +Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"audit\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--boot-volume-size-in-gbs', type=click.INT, help=u"""The size in GBs of the boot volume for the desktop pool.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'shape-config': {'module': 'desktops', 'class': 'CreateDesktopPoolShapeConfigDetails'}, 'device-policy': {'module': 'desktops', 'class': 'DesktopDevicePolicy'}, 'availability-policy': {'module': 'desktops', 'class': 'DesktopAvailabilityPolicy'}, 'image': {'module': 'desktops', 'class': 'DesktopImage'}, 'network-configuration': {'module': 'desktops', 'class': 'DesktopNetworkConfiguration'}, 'session-lifecycle-actions': {'module': 'desktops', 'class': 'CreateDesktopPoolDesktopSessionLifecycleActions'}, 'freeform-tags': {'module': 'desktops', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'desktops', 'class': 'list[string]'}, 'private-access-details': {'module': 'desktops', 'class': 'CreateDesktopPoolPrivateAccessDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'shape-config': {'module': 'desktops', 'class': 'CreateDesktopPoolShapeConfigDetails'}, 'device-policy': {'module': 'desktops', 'class': 'DesktopDevicePolicy'}, 'availability-policy': {'module': 'desktops', 'class': 'DesktopAvailabilityPolicy'}, 'image': {'module': 'desktops', 'class': 'DesktopImage'}, 'network-configuration': {'module': 'desktops', 'class': 'DesktopNetworkConfiguration'}, 'session-lifecycle-actions': {'module': 'desktops', 'class': 'CreateDesktopPoolDesktopSessionLifecycleActions'}, 'freeform-tags': {'module': 'desktops', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'desktops', 'class': 'list[string]'}, 'private-access-details': {'module': 'desktops', 'class': 'CreateDesktopPoolPrivateAccessDetails'}, 'security-attributes': {'module': 'desktops', '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={'shape-config': {'module': 'desktops', 'class': 'CreateDesktopPoolShapeConfigDetails'}, 'device-policy': {'module': 'desktops', 'class': 'DesktopDevicePolicy'}, 'availability-policy': {'module': 'desktops', 'class': 'DesktopAvailabilityPolicy'}, 'image': {'module': 'desktops', 'class': 'DesktopImage'}, 'network-configuration': {'module': 'desktops', 'class': 'DesktopNetworkConfiguration'}, 'session-lifecycle-actions': {'module': 'desktops', 'class': 'CreateDesktopPoolDesktopSessionLifecycleActions'}, 'freeform-tags': {'module': 'desktops', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'desktops', 'class': 'list[string]'}, 'private-access-details': {'module': 'desktops', 'class': 'CreateDesktopPoolPrivateAccessDetails'}}, output_type={'module': 'desktops', 'class': 'DesktopPool'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'shape-config': {'module': 'desktops', 'class': 'CreateDesktopPoolShapeConfigDetails'}, 'device-policy': {'module': 'desktops', 'class': 'DesktopDevicePolicy'}, 'availability-policy': {'module': 'desktops', 'class': 'DesktopAvailabilityPolicy'}, 'image': {'module': 'desktops', 'class': 'DesktopImage'}, 'network-configuration': {'module': 'desktops', 'class': 'DesktopNetworkConfiguration'}, 'session-lifecycle-actions': {'module': 'desktops', 'class': 'CreateDesktopPoolDesktopSessionLifecycleActions'}, 'freeform-tags': {'module': 'desktops', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'desktops', 'class': 'list[string]'}, 'private-access-details': {'module': 'desktops', 'class': 'CreateDesktopPoolPrivateAccessDetails'}, 'security-attributes': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'desktops', 'class': 'DesktopPool'}) @cli_util.wrap_exceptions -def create_desktop_pool(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, maximum_size, standby_size, shape_name, is_storage_enabled, storage_size_in_gbs, storage_backup_policy_id, device_policy, availability_policy, image, network_configuration, contact_details, are_privileged_users, availability_domain, description, shape_config, use_dedicated_vm_host, session_lifecycle_actions, time_start_scheduled, time_stop_scheduled, freeform_tags, defined_tags, nsg_ids, private_access_details, boot_volume_size_in_gbs): +def create_desktop_pool(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, maximum_size, standby_size, shape_name, is_storage_enabled, storage_size_in_gbs, storage_backup_policy_id, device_policy, availability_policy, image, network_configuration, contact_details, are_privileged_users, availability_domain, description, shape_config, use_dedicated_vm_host, session_lifecycle_actions, time_start_scheduled, time_stop_scheduled, freeform_tags, defined_tags, nsg_ids, private_access_details, security_attributes, boot_volume_size_in_gbs): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -233,6 +236,9 @@ def create_desktop_pool(ctx, from_json, wait_for_state, max_wait_seconds, wait_i if private_access_details is not None: _details['privateAccessDetails'] = cli_util.parse_json_parameter("private_access_details", private_access_details) + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + if boot_volume_size_in_gbs is not None: _details['bootVolumeSizeInGBs'] = boot_volume_size_in_gbs @@ -1232,24 +1238,29 @@ def update_desktop(ctx, from_json, force, wait_for_state, max_wait_seconds, wait @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--session-lifecycle-actions', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--image', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--network-configuration', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-access-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""[Security attributes] for this resource. Each attribute can be referenced in a [Zero Trust Packet Routing] (ZPR) policy to control access to ZPR-supported resources. + +Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"audit\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--boot-volume-size-in-gbs', type=click.INT, help=u"""The size in GBs of the boot volume for the desktop pool.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'device-policy': {'module': 'desktops', 'class': 'DesktopDevicePolicy'}, 'availability-policy': {'module': 'desktops', 'class': 'DesktopAvailabilityPolicy'}, 'freeform-tags': {'module': 'desktops', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}, 'session-lifecycle-actions': {'module': 'desktops', 'class': 'UpdateDesktopPoolDesktopSessionLifecycleActions'}, 'image': {'module': 'desktops', 'class': 'UpdateDesktopImage'}}) +@json_skeleton_utils.get_cli_json_input_option({'device-policy': {'module': 'desktops', 'class': 'DesktopDevicePolicy'}, 'availability-policy': {'module': 'desktops', 'class': 'DesktopAvailabilityPolicy'}, 'freeform-tags': {'module': 'desktops', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}, 'session-lifecycle-actions': {'module': 'desktops', 'class': 'UpdateDesktopPoolDesktopSessionLifecycleActions'}, 'image': {'module': 'desktops', 'class': 'UpdateDesktopImage'}, 'network-configuration': {'module': 'desktops', 'class': 'UpdateDesktopNetworkConfiguration'}, 'private-access-details': {'module': 'desktops', 'class': 'UpdateDesktopPoolPrivateAccessDetails'}, 'security-attributes': {'module': 'desktops', '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={'device-policy': {'module': 'desktops', 'class': 'DesktopDevicePolicy'}, 'availability-policy': {'module': 'desktops', 'class': 'DesktopAvailabilityPolicy'}, 'freeform-tags': {'module': 'desktops', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}, 'session-lifecycle-actions': {'module': 'desktops', 'class': 'UpdateDesktopPoolDesktopSessionLifecycleActions'}, 'image': {'module': 'desktops', 'class': 'UpdateDesktopImage'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'device-policy': {'module': 'desktops', 'class': 'DesktopDevicePolicy'}, 'availability-policy': {'module': 'desktops', 'class': 'DesktopAvailabilityPolicy'}, 'freeform-tags': {'module': 'desktops', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}, 'session-lifecycle-actions': {'module': 'desktops', 'class': 'UpdateDesktopPoolDesktopSessionLifecycleActions'}, 'image': {'module': 'desktops', 'class': 'UpdateDesktopImage'}, 'network-configuration': {'module': 'desktops', 'class': 'UpdateDesktopNetworkConfiguration'}, 'private-access-details': {'module': 'desktops', 'class': 'UpdateDesktopPoolPrivateAccessDetails'}, 'security-attributes': {'module': 'desktops', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_desktop_pool(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, desktop_pool_id, display_name, description, maximum_size, standby_size, device_policy, availability_policy, contact_details, time_start_scheduled, time_stop_scheduled, freeform_tags, defined_tags, session_lifecycle_actions, image, boot_volume_size_in_gbs, if_match): +def update_desktop_pool(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, desktop_pool_id, display_name, description, maximum_size, standby_size, device_policy, availability_policy, contact_details, time_start_scheduled, time_stop_scheduled, freeform_tags, defined_tags, session_lifecycle_actions, image, network_configuration, private_access_details, security_attributes, boot_volume_size_in_gbs, if_match): if isinstance(desktop_pool_id, six.string_types) and len(desktop_pool_id.strip()) == 0: raise click.UsageError('Parameter --desktop-pool-id cannot be whitespace or empty string') if not force: - if device_policy or availability_policy or freeform_tags or defined_tags or session_lifecycle_actions or image: - if not click.confirm("WARNING: Updates to device-policy and availability-policy and freeform-tags and defined-tags and session-lifecycle-actions and image will replace any existing values. Are you sure you want to continue?"): + if device_policy or availability_policy or freeform_tags or defined_tags or session_lifecycle_actions or image or network_configuration or private_access_details or security_attributes: + if not click.confirm("WARNING: Updates to device-policy and availability-policy and freeform-tags and defined-tags and session-lifecycle-actions and image and network-configuration and private-access-details and security-attributes will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -1298,6 +1309,15 @@ def update_desktop_pool(ctx, from_json, force, wait_for_state, max_wait_seconds, if image is not None: _details['image'] = cli_util.parse_json_parameter("image", image) + if network_configuration is not None: + _details['networkConfiguration'] = cli_util.parse_json_parameter("network_configuration", network_configuration) + + if private_access_details is not None: + _details['privateAccessDetails'] = cli_util.parse_json_parameter("private_access_details", private_access_details) + + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + if boot_volume_size_in_gbs is not None: _details['bootVolumeSizeInGBs'] = boot_volume_size_in_gbs diff --git a/services/golden_gate/src/oci_cli_golden_gate/golden_gate_cli_extended.py b/services/golden_gate/src/oci_cli_golden_gate/golden_gate_cli_extended.py index e43ebb2ee..49b1ced7f 100644 --- a/services/golden_gate/src/oci_cli_golden_gate/golden_gate_cli_extended.py +++ b/services/golden_gate/src/oci_cli_golden_gate/golden_gate_cli_extended.py @@ -93,7 +93,7 @@ @cli_util.option('--maintenance-window-start-hour', help="""Start hour for maintenance period. Hour is in UTC.""") @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}}) @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'maintenance-window': {'module': 'golden_gate', 'class': 'CreateMaintenanceWindowDetails'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Deployment'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'ogg-data': {'module': 'golden_gate', 'class': 'CreateOggDeploymentDetails'}, 'placements': {'module': 'golden_gate', 'class': 'list[DeploymentPlacementDetails]'}, 'maintenance-window': {'module': 'golden_gate', 'class': 'CreateMaintenanceWindowDetails'}, 'maintenance-configuration': {'module': 'golden_gate', 'class': 'CreateMaintenanceConfigurationDetails'}, 'backup-schedule': {'module': 'golden_gate', 'class': 'CreateBackupScheduleDetails'}}, output_type={'module': 'golden_gate', 'class': 'Deployment'}) @cli_util.wrap_exceptions def create_deployment_extended(ctx, **kwargs): if kwargs.get('ogg_data') is None: @@ -189,7 +189,7 @@ def create_deployment_extended(ctx, **kwargs): @cli_util.option('--maintenance-window-start-hour', help="""Start hour for maintenance period. Hour is in UTC.""") @json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}}) @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'maintenance-window': {'module': 'golden_gate', 'class': 'UpdateMaintenanceWindowDetails'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'ogg-data': {'module': 'golden_gate', 'class': 'UpdateOggDeploymentDetails'}, 'placements': {'module': 'golden_gate', 'class': 'list[DeploymentPlacementDetails]'}, 'maintenance-window': {'module': 'golden_gate', 'class': 'UpdateMaintenanceWindowDetails'}, 'maintenance-configuration': {'module': 'golden_gate', 'class': 'UpdateMaintenanceConfigurationDetails'}, 'backup-schedule': {'module': 'golden_gate', 'class': 'UpdateBackupScheduleDetails'}}) @cli_util.wrap_exceptions def update_deployment_extended(ctx, **kwargs): if kwargs.get('ogg_data') is None: @@ -316,9 +316,9 @@ def update_deployment_extended(ctx, **kwargs): @cli_util.copy_params_from_generated_command(goldengate_cli.create_connection_create_oci_object_storage_connection_details, params_to_exclude=['region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.create_connection_create_oci_object_storage_connection_details.name, help=goldengate_cli.create_connection_create_oci_object_storage_connection_details.help) -@cli_util.option('--os-region', help=u"""The name of the region. e.g.: us-ashburn-1""") +@cli_util.option('--os-region', help=u"""The name of the region. e.g.: us-ashburn-1 If the region is not provided, backend will default to the default region.""") @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) @cli_util.wrap_exceptions def create_connection_create_oci_object_storage_connection_details_extended(ctx, **kwargs): @@ -331,7 +331,7 @@ def create_connection_create_oci_object_storage_connection_details_extended(ctx, @cli_util.copy_params_from_generated_command(goldengate_cli.update_connection_update_oci_object_storage_connection_details, params_to_exclude=['region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.update_connection_update_oci_object_storage_connection_details.name, help=goldengate_cli.update_connection_update_oci_object_storage_connection_details.help) -@cli_util.option('--os-region', help=u"""The name of the region. e.g.: us-ashburn-1""") +@cli_util.option('--os-region', help=u"""The name of the region. e.g.: us-ashburn-1 If the region is not provided, backend will default to the default region.""") @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions @@ -475,7 +475,7 @@ def update_connection_update_oci_object_storage_connection_details_extended(ctx, @goldengate_cli.connection_group.command(name=goldengate_cli.create_connection_create_azure_data_lake_storage_connection_details.name, help=goldengate_cli.create_connection_create_azure_data_lake_storage_connection_details.help) @cli_util.option('--connection-endpoint', help=u"""Azure Storage service endpoint. e.g: https://test.blob.core.windows.net""") @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) @cli_util.wrap_exceptions def create_connection_create_azure_data_lake_storage_connection_details_extended(ctx, **kwargs): @@ -503,9 +503,9 @@ def update_connection_update_azure_data_lake_storage_connection_details_extended @cli_util.copy_params_from_generated_command(goldengate_cli.create_connection_create_oracle_nosql_connection_details, params_to_exclude=['region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.create_connection_create_oracle_nosql_connection_details.name, help=goldengate_cli.create_connection_create_oracle_nosql_connection_details.help) -@cli_util.option('--connection-region', help=u"""The name of the region. e.g.: us-ashburn-1""") +@cli_util.option('--connection-region', help=u"""The name of the region. e.g.: us-ashburn-1 If the region is not provided, backend will default to the default region.""") @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) @cli_util.wrap_exceptions def create_connection_create_oracle_nosql_connection_details_extended(ctx, **kwargs): @@ -518,7 +518,7 @@ def create_connection_create_oracle_nosql_connection_details_extended(ctx, **kwa @cli_util.copy_params_from_generated_command(goldengate_cli.update_connection_update_oracle_nosql_connection_details, params_to_exclude=['region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.update_connection_update_oracle_nosql_connection_details.name, help=goldengate_cli.update_connection_update_oracle_nosql_connection_details.help) -@cli_util.option('--connection-region', help=u"""The name of the region. e.g.: us-ashburn-1""") +@cli_util.option('--connection-region', help=u"""The name of the region. e.g.: us-ashburn-1 If the region is not provided, backend will default to the default region.""") @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions @@ -533,9 +533,9 @@ def update_connection_update_oracle_nosql_connection_details_extended(ctx, **kwa @cli_util.copy_params_from_generated_command(goldengate_cli.create_connection_create_oracle_ai_data_platform_connection_details, params_to_exclude=['region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.create_connection_create_oracle_ai_data_platform_connection_details.name, help=goldengate_cli.create_connection_create_oracle_ai_data_platform_connection_details.help) -@cli_util.option('--connection-region', help=u"""The name of the region. e.g.: us-ashburn-1""") +@cli_util.option('--connection-region', help=u"""The name of the region. e.g.: us-ashburn-1 If the region is not provided, backend will default to the default region.""") @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) @cli_util.wrap_exceptions def create_connection_create_oracle_ai_data_platform_connection_details_extended(ctx, **kwargs): @@ -548,7 +548,7 @@ def create_connection_create_oracle_ai_data_platform_connection_details_extended @cli_util.copy_params_from_generated_command(goldengate_cli.update_connection_update_oracle_ai_data_platform_connection_details, params_to_exclude=['region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.update_connection_update_oracle_ai_data_platform_connection_details.name, help=goldengate_cli.update_connection_update_oracle_ai_data_platform_connection_details.help) -@cli_util.option('--connection-region', help=u"""The name of the region. e.g.: us-ashburn-1""") +@cli_util.option('--connection-region', help=u"""The name of the region. e.g.: us-ashburn-1 If the region is not provided, backend will default to the default region.""") @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions @@ -870,8 +870,8 @@ def update_connection_update_microsoft_fabric_connection_details_extended(ctx, * @cli_util.copy_params_from_generated_command(goldengate_cli.create_connection_create_amazon_s3_connection_details, params_to_exclude=['endpoint_parameterconflict', 'region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.create_connection_create_amazon_s3_connection_details.name, help=goldengate_cli.create_connection_create_amazon_s3_connection_details.help) -@cli_util.option('--connection-endpoint', help=u"""Optional Amazon S3 service endpoint. Default value: https://my-bucket.s3..amazonaws.com""") -@cli_util.option('--connection-region', help=u"""The name of the region where the bucket is created. Default value: us-west-2""") +@cli_util.option('--connection-endpoint', help=u"""The Amazon Endpoint for S3. e.g.: https://my-bucket.s3.us-east-1.amazonaws.com If not provided, GoldenGate will default to https://s3..amazonaws.com""") +@cli_util.option('--connection-region', help=u"""The name of the AWS region where the bucket is created. If not provided, GoldenGate will default to 'us-west-2'. Note: this property will become mandatory after May 20, 2026.""") @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) @cli_util.wrap_exceptions @@ -889,8 +889,8 @@ def create_connection_create_amazon_s3_connection_details_extended(ctx, **kwargs @cli_util.copy_params_from_generated_command(goldengate_cli.update_connection_update_amazon_s3_connection_details, params_to_exclude=['endpoint_parameterconflict', 'region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.update_connection_update_amazon_s3_connection_details.name, help=goldengate_cli.update_connection_update_amazon_s3_connection_details.help) -@cli_util.option('--connection-endpoint', help=u"""Optional Amazon S3 service endpoint. Default value: https://my-bucket.s3..amazonaws.com""") -@cli_util.option('--connection-region', help=u"""The name of the region where the bucket is created. Default value: us-west-2""") +@cli_util.option('--connection-endpoint', help=u"""The Amazon Endpoint for S3. e.g.: https://my-bucket.s3.us-east-1.amazonaws.com If not provided, GoldenGate will default to https://s3..amazonaws.com""") +@cli_util.option('--connection-region', help=u"""The name of the AWS region where the bucket is created. If not provided, GoldenGate will default to 'us-west-2'. Note: this property will become mandatory after May 20, 2026.""") @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions @@ -908,8 +908,8 @@ def update_connection_update_amazon_s3_connection_details_extended(ctx, **kwargs @cli_util.copy_params_from_generated_command(goldengate_cli.create_connection_create_amazon_kinesis_connection_details, params_to_exclude=['endpoint_parameterconflict', 'region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.create_connection_create_amazon_kinesis_connection_details.name, help=goldengate_cli.create_connection_create_amazon_kinesis_connection_details.help) -@cli_util.option('--connection-endpoint', help=u"""Optional Amazon Kinesis service endpoint. Default value: https://kinesis..amazonaws.com""") -@cli_util.option('--connection-region', help=u"""The name of the AWS region. Default value: us-west-1""") +@cli_util.option('--connection-endpoint', help=u"""The endpoint URL of the Amazon Kinesis service. e.g.: https://kinesis.us-east-1.amazonaws.com If not provided, GoldenGate will default to https://kinesis..amazonaws.com""") +@cli_util.option('--connection-region', help=u"""The name of the AWS region. If not provided, GoldenGate will default to 'us-west-1'. Note: this property will become mandatory after July 30, 2026.""") @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) @cli_util.wrap_exceptions @@ -925,8 +925,8 @@ def create_connection_create_amazon_kinesis_connection_details_extended(ctx, **k @cli_util.copy_params_from_generated_command(goldengate_cli.update_connection_update_amazon_kinesis_connection_details, params_to_exclude=['endpoint_parameterconflict', 'region_parameterconflict']) @goldengate_cli.connection_group.command(name=goldengate_cli.update_connection_update_amazon_kinesis_connection_details.name, help=goldengate_cli.update_connection_update_amazon_kinesis_connection_details.help) -@cli_util.option('--connection-endpoint', help=u"""Optional Amazon Kinesis service endpoint. Default value: https://kinesis..amazonaws.com""") -@cli_util.option('--connection-region', help=u"""The name of the AWS region. Default value: us-west-1""") +@cli_util.option('--connection-endpoint', help=u"""The endpoint URL of the Amazon Kinesis service. e.g.: https://kinesis.us-east-1.amazonaws.com If not provided, GoldenGate will default to https://kinesis..amazonaws.com""") +@cli_util.option('--connection-region', help=u"""The name of the AWS region. If not provided, GoldenGate will default to 'us-west-1'. Note: this property will become mandatory after July 30, 2026.""") @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions @@ -938,3 +938,59 @@ def update_connection_update_amazon_kinesis_connection_details_extended(ctx, **k kwargs['region_parameterconflict'] = kwargs['connection_region'] kwargs.pop('connection_region') ctx.invoke(goldengate_cli.update_connection_update_amazon_kinesis_connection_details, **kwargs) + + +@cli_util.copy_params_from_generated_command(goldengate_cli.create_connection_create_google_big_query_connection_details, params_to_exclude=['endpoint_parameterconflict']) +@goldengate_cli.connection_group.command(name=goldengate_cli.create_connection_create_google_big_query_connection_details.name, help=goldengate_cli.create_connection_create_google_big_query_connection_details.help) +@cli_util.option('--connection-endpoint', help=u"""A legal URL to connect to BigQuery including scheme, server name and port (if not the default port). Default: https://bigquery.googleapis.com""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) +@cli_util.wrap_exceptions +def create_connection_create_google_big_query_connection_details_extended(ctx, **kwargs): + if 'connection_endpoint' in kwargs: + kwargs['endpoint_parameterconflict'] = kwargs['connection_endpoint'] + kwargs.pop('connection_endpoint') + ctx.invoke(goldengate_cli.create_connection_create_google_big_query_connection_details, **kwargs) + + +@cli_util.copy_params_from_generated_command(goldengate_cli.update_connection_update_google_big_query_connection_details, params_to_exclude=['endpoint_parameterconflict']) +@goldengate_cli.connection_group.command(name=goldengate_cli.update_connection_update_google_big_query_connection_details.name, help=goldengate_cli.update_connection_update_google_big_query_connection_details.help) +@cli_util.option('--connection-endpoint', help=u"""A legal URL to connect to BigQuery including scheme, server name and port (if not the default port). Default: https://bigquery.googleapis.com""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_connection_update_google_big_query_connection_details_extended(ctx, **kwargs): + if 'connection_endpoint' in kwargs: + kwargs['endpoint_parameterconflict'] = kwargs['connection_endpoint'] + kwargs.pop('connection_endpoint') + ctx.invoke(goldengate_cli.update_connection_update_google_big_query_connection_details, **kwargs) + + +@cli_util.copy_params_from_generated_command(goldengate_cli.create_connection_create_google_cloud_storage_connection_details, params_to_exclude=['endpoint_parameterconflict']) +@goldengate_cli.connection_group.command(name=goldengate_cli.create_connection_create_google_cloud_storage_connection_details.name, help=goldengate_cli.create_connection_create_google_cloud_storage_connection_details.help) +@cli_util.option('--connection-endpoint', help=u"""A legal URL to connect to Google Cloud Storage including scheme, server name and port (if not the default port). Default: https://storage.googleapis.com""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'locks': {'module': 'golden_gate', 'class': 'list[AddResourceLockDetails]'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'golden_gate', 'class': 'Connection'}) +@cli_util.wrap_exceptions +def create_connection_create_google_cloud_storage_connection_details_extended(ctx, **kwargs): + if 'connection_endpoint' in kwargs: + kwargs['endpoint_parameterconflict'] = kwargs['connection_endpoint'] + kwargs.pop('connection_endpoint') + ctx.invoke(goldengate_cli.create_connection_create_google_cloud_storage_connection_details, **kwargs) + + +@cli_util.copy_params_from_generated_command(goldengate_cli.update_connection_update_google_cloud_storage_connection_details, params_to_exclude=['endpoint_parameterconflict']) +@goldengate_cli.connection_group.command(name=goldengate_cli.update_connection_update_google_cloud_storage_connection_details.name, help=goldengate_cli.update_connection_update_google_cloud_storage_connection_details.help) +@cli_util.option('--connection-endpoint', help=u"""A legal URL to connect to Google Cloud Storage including scheme, server name and port (if not the default port). Default: https://storage.googleapis.com""") +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'golden_gate', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}, 'nsg-ids': {'module': 'golden_gate', 'class': 'list[string]'}, 'security-attributes': {'module': 'golden_gate', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_connection_update_google_cloud_storage_connection_details_extended(ctx, **kwargs): + if 'connection_endpoint' in kwargs: + kwargs['endpoint_parameterconflict'] = kwargs['connection_endpoint'] + kwargs.pop('connection_endpoint') + ctx.invoke(goldengate_cli.update_connection_update_google_cloud_storage_connection_details, **kwargs) + + +# oci goldengate connection migrate-connection-secret-migrate-connection-details -> oci goldengate connection migrate-secret +cli_util.rename_command(goldengate_cli, goldengate_cli.connection_group, goldengate_cli.migrate_connection_secret_migrate_connection_details, "migrate-secret") diff --git a/services/object_storage/src/oci_cli_object_storage/generated/objectstorage_cli.py b/services/object_storage/src/oci_cli_object_storage/generated/objectstorage_cli.py index 59471fd90..93de5500c 100644 --- a/services/object_storage/src/oci_cli_object_storage/generated/objectstorage_cli.py +++ b/services/object_storage/src/oci_cli_object_storage/generated/objectstorage_cli.py @@ -592,15 +592,18 @@ def create_preauthenticated_request(ctx, from_json, namespace_name, bucket_name, @cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of the OCIDs of the network security groups (NSGs) to add the private endpoint's VNIC to. For more information about NSGs, see [NetworkSecurityGroup].""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Security attributes for Private Endpoint resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. + +Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"enforce\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "COMPLETED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'additional-prefixes': {'module': 'object_storage', 'class': 'list[string]'}, 'nsg-ids': {'module': 'object_storage', 'class': 'list[string]'}, 'access-targets': {'module': 'object_storage', 'class': 'list[AccessTargetDetails]'}, 'freeform-tags': {'module': 'object_storage', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'additional-prefixes': {'module': 'object_storage', 'class': 'list[string]'}, 'nsg-ids': {'module': 'object_storage', 'class': 'list[string]'}, 'access-targets': {'module': 'object_storage', 'class': 'list[AccessTargetDetails]'}, 'freeform-tags': {'module': 'object_storage', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'object_storage', '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={'additional-prefixes': {'module': 'object_storage', 'class': 'list[string]'}, 'nsg-ids': {'module': 'object_storage', 'class': 'list[string]'}, 'access-targets': {'module': 'object_storage', 'class': 'list[AccessTargetDetails]'}, 'freeform-tags': {'module': 'object_storage', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'additional-prefixes': {'module': 'object_storage', 'class': 'list[string]'}, 'nsg-ids': {'module': 'object_storage', 'class': 'list[string]'}, 'access-targets': {'module': 'object_storage', 'class': 'list[AccessTargetDetails]'}, 'freeform-tags': {'module': 'object_storage', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def create_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, namespace_name, name, compartment_id, subnet_id, prefix, access_targets, additional_prefixes, private_endpoint_ip, nsg_ids, freeform_tags, defined_tags): +def create_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, namespace_name, name, compartment_id, subnet_id, prefix, access_targets, additional_prefixes, private_endpoint_ip, nsg_ids, freeform_tags, defined_tags, security_attributes): if isinstance(namespace_name, six.string_types) and len(namespace_name.strip()) == 0: raise click.UsageError('Parameter --namespace-name cannot be whitespace or empty string') @@ -630,6 +633,9 @@ def create_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wa if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + client = cli_util.build_client('object_storage', 'object_storage', ctx) result = client.create_private_endpoint( namespace_name=namespace_name, @@ -2763,16 +2769,19 @@ def update_object_storage_tier(ctx, from_json, namespace_name, bucket_name, obje This option is a JSON list with items of type AccessTargetDetails. For documentation on AccessTargetDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/objectstorage/20160918/datatypes/AccessTargetDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--security-attributes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Security attributes for Private Endpoint resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags]. + +Example: `{\"Oracle-ZPR\": {\"MaxEgressCount\": {\"value\": \"42\", \"mode\": \"enforce\"}}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""The entity tag (ETag) to match with the ETag of an existing resource. If the specified ETag matches the ETag of the existing resource, GET and HEAD requests will return the resource and PUT and POST requests will upload the resource.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "COMPLETED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'access-targets': {'module': 'object_storage', 'class': 'list[AccessTargetDetails]'}, 'freeform-tags': {'module': 'object_storage', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'access-targets': {'module': 'object_storage', 'class': 'list[AccessTargetDetails]'}, 'freeform-tags': {'module': 'object_storage', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'object_storage', '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={'access-targets': {'module': 'object_storage', 'class': 'list[AccessTargetDetails]'}, 'freeform-tags': {'module': 'object_storage', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'access-targets': {'module': 'object_storage', 'class': 'list[AccessTargetDetails]'}, 'freeform-tags': {'module': 'object_storage', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'object_storage', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, namespace_name, pe_name, name, namespace, access_targets, freeform_tags, defined_tags, if_match): +def update_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, namespace_name, pe_name, name, namespace, access_targets, freeform_tags, defined_tags, security_attributes, if_match): if isinstance(namespace_name, six.string_types) and len(namespace_name.strip()) == 0: raise click.UsageError('Parameter --namespace-name cannot be whitespace or empty string') @@ -2802,6 +2811,9 @@ def update_private_endpoint(ctx, from_json, wait_for_state, max_wait_seconds, wa if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if security_attributes is not None: + _details['securityAttributes'] = cli_util.parse_json_parameter("security_attributes", security_attributes) + client = cli_util.build_client('object_storage', 'object_storage', ctx) result = client.update_private_endpoint( namespace_name=namespace_name, diff --git a/services/opensearch/src/oci_cli_opensearch_cluster/generated/opensearchcluster_cli.py b/services/opensearch/src/oci_cli_opensearch_cluster/generated/opensearchcluster_cli.py index 19fe2ce34..c705ae573 100644 --- a/services/opensearch/src/oci_cli_opensearch_cluster/generated/opensearchcluster_cli.py +++ b/services/opensearch/src/oci_cli_opensearch_cluster/generated/opensearchcluster_cli.py @@ -236,6 +236,11 @@ def configure_outbound_cluster(ctx, from_json, wait_for_state, max_wait_seconds, @cli_util.option('--search-node-host-ocpu-count', type=click.INT, help=u"""The number of OCPUs configured for the cluster's search nodes.""") @cli_util.option('--search-node-host-memory-gb', type=click.INT, help=u"""The amount of memory in GB, for the cluster's search nodes.""") @cli_util.option('--search-node-storage-gb', type=click.INT, help=u"""The amount of storage in GB, to configure per node for the cluster's search nodes.""") +@cli_util.option('--coordinator-node-count', type=click.INT, help=u"""The number of coordinator nodes configured for the cluster.""") +@cli_util.option('--coordinator-node-host-type', type=custom_types.CliCaseInsensitiveChoice(["FLEX"]), help=u"""The instance type for the cluster's coordinator nodes.""") +@cli_util.option('--coordinator-node-host-shape', help=u"""The node shape for the cluster's coordinator nodes.""") +@cli_util.option('--coordinator-node-host-ocpu-count', type=click.INT, help=u"""The number of OCPUs configured for the cluster's coordinator nodes.""") +@cli_util.option('--coordinator-node-host-memory-gb', type=click.INT, help=u"""The amount of memory in GB, for the cluster's coordinator nodes.""") @cli_util.option('--ml-node-count', type=click.INT, help=u"""The number of ML nodes configured for the cluster.""") @cli_util.option('--ml-node-host-type', type=custom_types.CliCaseInsensitiveChoice(["FLEX"]), help=u"""The instance type for the cluster's ML nodes.""") @cli_util.option('--ml-node-host-shape', help=u"""The node shape for the cluster's ML nodes.""") @@ -268,7 +273,7 @@ def configure_outbound_cluster(ctx, from_json, wait_for_state, max_wait_seconds, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'security-saml-config': {'module': 'opensearch', 'class': 'SecuritySamlConfig'}, 'backup-policy': {'module': 'opensearch', 'class': 'BackupPolicy'}, 'reverse-connection-endpoint-customer-ips': {'module': 'opensearch', 'class': 'list[string]'}, 'inbound-cluster-ids': {'module': 'opensearch', 'class': 'list[string]'}, 'outbound-cluster-config': {'module': 'opensearch', 'class': 'OutboundClusterConfig'}, 'maintenance-details': {'module': 'opensearch', 'class': 'CreateMaintenanceDetails'}, 'load-balancer-config': {'module': 'opensearch', 'class': 'LoadBalancerConfig'}, 'certificate-config': {'module': 'opensearch', 'class': 'CertificateConfig'}, 'freeform-tags': {'module': 'opensearch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'opensearch', 'class': 'dict(str, dict(str, object))'}, 'system-tags': {'module': 'opensearch', 'class': 'dict(str, dict(str, object))'}, 'security-attributes': {'module': 'opensearch', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def create_opensearch_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, software_version, master_node_count, master_node_host_type, master_node_host_ocpu_count, master_node_host_memory_gb, data_node_count, data_node_host_type, data_node_host_ocpu_count, data_node_host_memory_gb, data_node_storage_gb, opendashboard_node_count, opendashboard_node_host_ocpu_count, opendashboard_node_host_memory_gb, vcn_id, subnet_id, vcn_compartment_id, subnet_compartment_id, master_node_host_bare_metal_shape, master_node_host_shape, data_node_host_bare_metal_shape, data_node_host_shape, opendashboard_node_host_shape, search_node_count, search_node_host_type, search_node_host_shape, search_node_host_ocpu_count, search_node_host_memory_gb, search_node_storage_gb, ml_node_count, ml_node_host_type, ml_node_host_shape, ml_node_host_ocpu_count, ml_node_host_memory_gb, ml_node_storage_gb, security_mode, security_master_user_name, security_master_user_password_hash, security_saml_config, backup_policy, nsg_id, reverse_connection_endpoint_customer_ips, inbound_cluster_ids, outbound_cluster_config, maintenance_details, load_balancer_config, certificate_config, freeform_tags, defined_tags, system_tags, security_attributes): +def create_opensearch_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, software_version, master_node_count, master_node_host_type, master_node_host_ocpu_count, master_node_host_memory_gb, data_node_count, data_node_host_type, data_node_host_ocpu_count, data_node_host_memory_gb, data_node_storage_gb, opendashboard_node_count, opendashboard_node_host_ocpu_count, opendashboard_node_host_memory_gb, vcn_id, subnet_id, vcn_compartment_id, subnet_compartment_id, master_node_host_bare_metal_shape, master_node_host_shape, data_node_host_bare_metal_shape, data_node_host_shape, opendashboard_node_host_shape, search_node_count, search_node_host_type, search_node_host_shape, search_node_host_ocpu_count, search_node_host_memory_gb, search_node_storage_gb, coordinator_node_count, coordinator_node_host_type, coordinator_node_host_shape, coordinator_node_host_ocpu_count, coordinator_node_host_memory_gb, ml_node_count, ml_node_host_type, ml_node_host_shape, ml_node_host_ocpu_count, ml_node_host_memory_gb, ml_node_storage_gb, security_mode, security_master_user_name, security_master_user_password_hash, security_saml_config, backup_policy, nsg_id, reverse_connection_endpoint_customer_ips, inbound_cluster_ids, outbound_cluster_config, maintenance_details, load_balancer_config, certificate_config, freeform_tags, defined_tags, system_tags, security_attributes): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -327,6 +332,21 @@ def create_opensearch_cluster(ctx, from_json, wait_for_state, max_wait_seconds, if search_node_storage_gb is not None: _details['searchNodeStorageGB'] = search_node_storage_gb + if coordinator_node_count is not None: + _details['coordinatorNodeCount'] = coordinator_node_count + + if coordinator_node_host_type is not None: + _details['coordinatorNodeHostType'] = coordinator_node_host_type + + if coordinator_node_host_shape is not None: + _details['coordinatorNodeHostShape'] = coordinator_node_host_shape + + if coordinator_node_host_ocpu_count is not None: + _details['coordinatorNodeHostOcpuCount'] = coordinator_node_host_ocpu_count + + if coordinator_node_host_memory_gb is not None: + _details['coordinatorNodeHostMemoryGB'] = coordinator_node_host_memory_gb + if ml_node_count is not None: _details['mlNodeCount'] = ml_node_count @@ -886,6 +906,7 @@ def opensearch_cluster_restore(ctx, from_json, wait_for_state, max_wait_seconds, @cli_util.option('--data-node-count', type=click.INT, help=u"""The number of data nodes to configure for the cluster.""") @cli_util.option('--opendashboard-node-count', type=click.INT, help=u"""The number of OpenSearch Dashboard nodes to configure for the cluster.""") @cli_util.option('--search-node-count', type=click.INT, help=u"""The number of search nodes configured for the cluster.""") +@cli_util.option('--coordinator-node-count', type=click.INT, help=u"""The number of coordinator nodes configured for the cluster.""") @cli_util.option('--ml-node-count', type=click.INT, help=u"""The number of ML nodes configured for the cluster.""") @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -898,7 +919,7 @@ def opensearch_cluster_restore(ctx, from_json, wait_for_state, max_wait_seconds, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'opensearch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'opensearch', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def resize_opensearch_cluster_horizontal(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, opensearch_cluster_id, master_node_count, data_node_count, opendashboard_node_count, search_node_count, ml_node_count, freeform_tags, defined_tags, if_match): +def resize_opensearch_cluster_horizontal(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, opensearch_cluster_id, master_node_count, data_node_count, opendashboard_node_count, search_node_count, coordinator_node_count, ml_node_count, freeform_tags, defined_tags, if_match): if isinstance(opensearch_cluster_id, six.string_types) and len(opensearch_cluster_id.strip()) == 0: raise click.UsageError('Parameter --opensearch-cluster-id cannot be whitespace or empty string') @@ -922,6 +943,9 @@ def resize_opensearch_cluster_horizontal(ctx, from_json, wait_for_state, max_wai if search_node_count is not None: _details['searchNodeCount'] = search_node_count + if coordinator_node_count is not None: + _details['coordinatorNodeCount'] = coordinator_node_count + if ml_node_count is not None: _details['mlNodeCount'] = ml_node_count @@ -983,6 +1007,9 @@ def resize_opensearch_cluster_horizontal(ctx, from_json, wait_for_state, max_wai @cli_util.option('--search-node-host-ocpu-count', type=click.INT, help=u"""The number of OCPUs configured for the cluster's search nodes.""") @cli_util.option('--search-node-host-memory-gb', type=click.INT, help=u"""The amount of memory in GB, for the cluster's search nodes.""") @cli_util.option('--search-node-storage-gb', type=click.INT, help=u"""The amount of storage in GB, to configure per node for the cluster's search nodes.""") +@cli_util.option('--coordinator-node-host-shape', help=u"""The node shape for the cluster's coordinator nodes.""") +@cli_util.option('--coordinator-node-host-ocpu-count', type=click.INT, help=u"""The number of OCPUs configured for the cluster's coordinator nodes.""") +@cli_util.option('--coordinator-node-host-memory-gb', type=click.INT, help=u"""The amount of memory in GB, for the cluster's coordinator nodes.""") @cli_util.option('--ml-node-host-shape', help=u"""The node shape for the cluster's ML nodes.""") @cli_util.option('--ml-node-host-ocpu-count', type=click.INT, help=u"""The number of OCPUs configured for the cluster's ML nodes.""") @cli_util.option('--ml-node-host-memory-gb', type=click.INT, help=u"""The amount of memory in GB, for the cluster's ML nodes.""") @@ -998,7 +1025,7 @@ def resize_opensearch_cluster_horizontal(ctx, from_json, wait_for_state, max_wai @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'opensearch', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'opensearch', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def resize_opensearch_cluster_vertical(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, opensearch_cluster_id, master_node_host_ocpu_count, master_node_host_memory_gb, master_node_host_shape, data_node_host_ocpu_count, data_node_host_memory_gb, data_node_storage_gb, data_node_host_shape, opendashboard_node_host_ocpu_count, opendashboard_node_host_memory_gb, opendashboard_node_host_shape, search_node_host_shape, search_node_host_ocpu_count, search_node_host_memory_gb, search_node_storage_gb, ml_node_host_shape, ml_node_host_ocpu_count, ml_node_host_memory_gb, ml_node_storage_gb, freeform_tags, defined_tags, if_match): +def resize_opensearch_cluster_vertical(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, opensearch_cluster_id, master_node_host_ocpu_count, master_node_host_memory_gb, master_node_host_shape, data_node_host_ocpu_count, data_node_host_memory_gb, data_node_storage_gb, data_node_host_shape, opendashboard_node_host_ocpu_count, opendashboard_node_host_memory_gb, opendashboard_node_host_shape, search_node_host_shape, search_node_host_ocpu_count, search_node_host_memory_gb, search_node_storage_gb, coordinator_node_host_shape, coordinator_node_host_ocpu_count, coordinator_node_host_memory_gb, ml_node_host_shape, ml_node_host_ocpu_count, ml_node_host_memory_gb, ml_node_storage_gb, freeform_tags, defined_tags, if_match): if isinstance(opensearch_cluster_id, six.string_types) and len(opensearch_cluster_id.strip()) == 0: raise click.UsageError('Parameter --opensearch-cluster-id cannot be whitespace or empty string') @@ -1052,6 +1079,15 @@ def resize_opensearch_cluster_vertical(ctx, from_json, wait_for_state, max_wait_ if search_node_storage_gb is not None: _details['searchNodeStorageGB'] = search_node_storage_gb + if coordinator_node_host_shape is not None: + _details['coordinatorNodeHostShape'] = coordinator_node_host_shape + + if coordinator_node_host_ocpu_count is not None: + _details['coordinatorNodeHostOcpuCount'] = coordinator_node_host_ocpu_count + + if coordinator_node_host_memory_gb is not None: + _details['coordinatorNodeHostMemoryGB'] = coordinator_node_host_memory_gb + if ml_node_host_shape is not None: _details['mlNodeHostShape'] = ml_node_host_shape diff --git a/services/operator_access_control/src/oci_cli_access_requests/generated/accessrequests_cli.py b/services/operator_access_control/src/oci_cli_access_requests/generated/accessrequests_cli.py index 2fb054a58..e9d51fb91 100644 --- a/services/operator_access_control/src/oci_cli_access_requests/generated/accessrequests_cli.py +++ b/services/operator_access_control/src/oci_cli_access_requests/generated/accessrequests_cli.py @@ -17,9 +17,7 @@ @click.command(cli_util.override('access_requests.access_requests_root_group.command_name', 'access-requests'), cls=CommandGroupWithAlias, help=cli_util.override('access_requests.access_requests_root_group.help', """Operator Access Control enables you to control the time duration and the actions an Oracle operator can perform on your Exadata Cloud@Customer infrastructure. -Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator. - -Use the table of contents and search tool to explore the OperatorAccessControl API."""), short_help=cli_util.override('access_requests.access_requests_root_group.short_help', """OperatorAccessControl API""")) +Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator."""), short_help=cli_util.override('access_requests.access_requests_root_group.short_help', """Operator Access Control API""")) @cli_util.help_option_group def access_requests_root_group(): pass @@ -251,6 +249,7 @@ def list_access_request_histories(ctx, from_json, all_pages, page_size, access_r @cli_util.option('--resource-name', help=u"""A filter to return only resources that match the given ResourceName.""") @cli_util.option('--resource-type', help=u"""A filter to return only lists of resources that match the entire given service type.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATED", "APPROVALWAITING", "PREAPPROVED", "APPROVED", "MOREINFO", "REJECTED", "DEPLOYED", "DEPLOYFAILED", "UNDEPLOYED", "UNDEPLOYFAILED", "CLOSEFAILED", "REVOKEFAILED", "EXPIRYFAILED", "REVOKING", "REVOKED", "EXTENDING", "EXTENDED", "EXTENSIONREJECTED", "COMPLETING", "COMPLETED", "EXPIRED", "APPROVEDFORFUTURE", "INREVIEW"]), help=u"""A filter to return only resources whose lifecycleState matches the given AccessRequest lifecycleState.""") +@cli_util.option('--num-days', type=click.INT, help=u"""The number of days since when the user wants to search .""") @cli_util.option('--time-start', type=custom_types.CLI_DATETIME, help=u"""Query start time in UTC in ISO 8601 format(inclusive). Example 2019-10-30T00:00:00Z (yyyy-MM-ddThh:mm:ssZ). timeIntervalStart and timeIntervalEnd parameters are used together.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @cli_util.option('--time-end', type=custom_types.CLI_DATETIME, help=u"""Query start time in UTC in ISO 8601 format(inclusive). Example 2019-10-30T00:00:00Z (yyyy-MM-ddThh:mm:ssZ). timeIntervalStart and timeIntervalEnd parameters are used together.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") @@ -264,7 +263,7 @@ def list_access_request_histories(ctx, from_json, all_pages, page_size, access_r @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'operator_access_control', 'class': 'AccessRequestCollection'}) @cli_util.wrap_exceptions -def list_access_requests(ctx, from_json, all_pages, page_size, compartment_id, resource_name, resource_type, lifecycle_state, time_start, time_end, limit, page, sort_order, sort_by): +def list_access_requests(ctx, from_json, all_pages, page_size, compartment_id, resource_name, resource_type, lifecycle_state, num_days, time_start, time_end, 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') @@ -276,6 +275,8 @@ def list_access_requests(ctx, from_json, all_pages, page_size, compartment_id, r kwargs['resource_type'] = resource_type if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state + if num_days is not None: + kwargs['num_days'] = num_days if time_start is not None: kwargs['time_start'] = time_start if time_end is not None: diff --git a/services/operator_access_control/src/oci_cli_operator_access_control/generated/opctl_service_cli.py b/services/operator_access_control/src/oci_cli_operator_access_control/generated/opctl_service_cli.py index 616500d7f..855affa7e 100644 --- a/services/operator_access_control/src/oci_cli_operator_access_control/generated/opctl_service_cli.py +++ b/services/operator_access_control/src/oci_cli_operator_access_control/generated/opctl_service_cli.py @@ -9,9 +9,7 @@ @cli.command(cli_util.override('operator_control_assignment.opctl_service_group.command_name', 'opctl'), cls=CommandGroupWithAlias, help=cli_util.override('operator_control_assignment.opctl_service_group.help', """Operator Access Control enables you to control the time duration and the actions an Oracle operator can perform on your Exadata Cloud@Customer infrastructure. -Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator. - -Use the table of contents and search tool to explore the OperatorAccessControl API."""), short_help=cli_util.override('operator_control_assignment.opctl_service_group.short_help', """OperatorAccessControl API""")) +Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator."""), short_help=cli_util.override('operator_control_assignment.opctl_service_group.short_help', """Operator Access Control API""")) @cli_util.help_option_group def opctl_service_group(): pass diff --git a/services/operator_access_control/src/oci_cli_operator_actions/generated/operatoractions_cli.py b/services/operator_access_control/src/oci_cli_operator_actions/generated/operatoractions_cli.py index 2334cd4d1..9e0d40e27 100644 --- a/services/operator_access_control/src/oci_cli_operator_actions/generated/operatoractions_cli.py +++ b/services/operator_access_control/src/oci_cli_operator_actions/generated/operatoractions_cli.py @@ -17,9 +17,7 @@ @click.command(cli_util.override('operator_actions.operator_actions_root_group.command_name', 'operator-actions'), cls=CommandGroupWithAlias, help=cli_util.override('operator_actions.operator_actions_root_group.help', """Operator Access Control enables you to control the time duration and the actions an Oracle operator can perform on your Exadata Cloud@Customer infrastructure. -Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator. - -Use the table of contents and search tool to explore the OperatorAccessControl API."""), short_help=cli_util.override('operator_actions.operator_actions_root_group.short_help', """OperatorAccessControl API""")) +Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator."""), short_help=cli_util.override('operator_actions.operator_actions_root_group.short_help', """Operator Access Control API""")) @cli_util.help_option_group def operator_actions_root_group(): pass diff --git a/services/operator_access_control/src/oci_cli_operator_control/generated/operatorcontrol_cli.py b/services/operator_access_control/src/oci_cli_operator_control/generated/operatorcontrol_cli.py index 81b8e2456..ae43ce72b 100644 --- a/services/operator_access_control/src/oci_cli_operator_control/generated/operatorcontrol_cli.py +++ b/services/operator_access_control/src/oci_cli_operator_control/generated/operatorcontrol_cli.py @@ -17,9 +17,7 @@ @click.command(cli_util.override('operator_control.operator_control_root_group.command_name', 'operator-control'), cls=CommandGroupWithAlias, help=cli_util.override('operator_control.operator_control_root_group.help', """Operator Access Control enables you to control the time duration and the actions an Oracle operator can perform on your Exadata Cloud@Customer infrastructure. -Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator. - -Use the table of contents and search tool to explore the OperatorAccessControl API."""), short_help=cli_util.override('operator_control.operator_control_root_group.short_help', """OperatorAccessControl API""")) +Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator."""), short_help=cli_util.override('operator_control.operator_control_root_group.short_help', """Operator Access Control API""")) @cli_util.help_option_group def operator_control_root_group(): pass @@ -72,12 +70,13 @@ def change_operator_control_compartment(ctx, from_json, operator_control_id, com @cli_util.option('--operator-control-name', required=True, help=u"""Name of the operator control.""") @cli_util.option('--approver-groups-list', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of user groups who can approve an access request associated with a resource governed by this operator control.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--is-fully-pre-approved', required=True, type=click.BOOL, help=u"""Whether all the operator actions have been pre-approved. If yes, all access requests associated with a resource governed by this operator control will be auto-approved.""") -@cli_util.option('--resource-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["EXACC", "EXADATAINFRASTRUCTURE", "AUTONOMOUSVMCLUSTER", "CLOUDAUTONOMOUSVMCLUSTER", "CCCINFRASTRUCTURE"]), help=u"""resourceType for which the OperatorControl is applicable""") +@cli_util.option('--resource-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["EXACC", "EXADATAINFRASTRUCTURE", "AUTONOMOUSVMCLUSTER", "CLOUDAUTONOMOUSVMCLUSTER", "CCCINFRASTRUCTURE", "CLOUDEXADATAINFRASTRUCTURE"]), help=u"""resourceType for which the OperatorControl is applicable""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment that contains this operator control.""") @cli_util.option('--description', help=u"""Description of the operator control.""") @cli_util.option('--approvers-list', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of users who can approve an access request associated with a resource governed by this operator control.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--pre-approved-op-action-list', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of pre-approved operator actions. Access requests associated with a resource governed by this operator control will be auto-approved if the access request only contain operator actions in the pre-approved list.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--number-of-approvers', type=click.INT, help=u"""Number of approvers required to approve an access request.""") +@cli_util.option('--notification-topic-id', help=u"""The OCID of the OCI Notification topic to publish messages related to this operator control.""") @cli_util.option('--email-id-list', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of emailId.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--system-message', help=u"""This is the message that will be displayed to the operator users while accessing the system.""") @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.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -90,7 +89,7 @@ def change_operator_control_compartment(ctx, from_json, operator_control_id, com @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'approvers-list': {'module': 'operator_access_control', 'class': 'list[string]'}, 'approver-groups-list': {'module': 'operator_access_control', 'class': 'list[string]'}, 'pre-approved-op-action-list': {'module': 'operator_access_control', 'class': 'list[string]'}, 'email-id-list': {'module': 'operator_access_control', 'class': 'list[string]'}, 'freeform-tags': {'module': 'operator_access_control', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'operator_access_control', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'operator_access_control', 'class': 'OperatorControl'}) @cli_util.wrap_exceptions -def create_operator_control(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, operator_control_name, approver_groups_list, is_fully_pre_approved, resource_type, compartment_id, description, approvers_list, pre_approved_op_action_list, number_of_approvers, email_id_list, system_message, freeform_tags, defined_tags): +def create_operator_control(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, operator_control_name, approver_groups_list, is_fully_pre_approved, resource_type, compartment_id, description, approvers_list, pre_approved_op_action_list, number_of_approvers, notification_topic_id, email_id_list, system_message, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -114,6 +113,9 @@ def create_operator_control(ctx, from_json, wait_for_state, max_wait_seconds, wa if number_of_approvers is not None: _details['numberOfApprovers'] = number_of_approvers + if notification_topic_id is not None: + _details['notificationTopicId'] = notification_topic_id + if email_id_list is not None: _details['emailIdList'] = cli_util.parse_json_parameter("email_id_list", email_id_list) @@ -317,6 +319,7 @@ def list_operator_controls(ctx, from_json, all_pages, page_size, compartment_id, @cli_util.option('--description', help=u"""Description of the operator control.""") @cli_util.option('--approvers-list', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of users who can approve an access request associated with a target resource under the governance of this operator control.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--pre-approved-op-action-list', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of pre-approved operator actions. Access requests associated with a resource governed by this operator control will be automatically approved if the access request only contain operator actions in the pre-approved list.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--notification-topic-id', help=u"""The OCID of the OCI Notification topic to publish messages related to this operator control.""") @cli_util.option('--email-id-list', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of emailId.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--number-of-approvers', type=click.INT, help=u"""Number of approvers required to approve an access request.""") @cli_util.option('--system-message', help=u"""System message that would be displayed to the operator users on accessing the target resource under the governance of this operator control.""") @@ -332,7 +335,7 @@ def list_operator_controls(ctx, from_json, all_pages, page_size, compartment_id, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'approvers-list': {'module': 'operator_access_control', 'class': 'list[string]'}, 'approver-groups-list': {'module': 'operator_access_control', 'class': 'list[string]'}, 'pre-approved-op-action-list': {'module': 'operator_access_control', 'class': 'list[string]'}, 'email-id-list': {'module': 'operator_access_control', 'class': 'list[string]'}, 'freeform-tags': {'module': 'operator_access_control', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'operator_access_control', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'operator_access_control', 'class': 'OperatorControl'}) @cli_util.wrap_exceptions -def update_operator_control(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, operator_control_id, operator_control_name, approver_groups_list, is_fully_pre_approved, description, approvers_list, pre_approved_op_action_list, email_id_list, number_of_approvers, system_message, freeform_tags, defined_tags, if_match): +def update_operator_control(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, operator_control_id, operator_control_name, approver_groups_list, is_fully_pre_approved, description, approvers_list, pre_approved_op_action_list, notification_topic_id, email_id_list, number_of_approvers, system_message, freeform_tags, defined_tags, if_match): if isinstance(operator_control_id, six.string_types) and len(operator_control_id.strip()) == 0: raise click.UsageError('Parameter --operator-control-id cannot be whitespace or empty string') @@ -360,6 +363,9 @@ def update_operator_control(ctx, from_json, force, wait_for_state, max_wait_seco if pre_approved_op_action_list is not None: _details['preApprovedOpActionList'] = cli_util.parse_json_parameter("pre_approved_op_action_list", pre_approved_op_action_list) + if notification_topic_id is not None: + _details['notificationTopicId'] = notification_topic_id + if email_id_list is not None: _details['emailIdList'] = cli_util.parse_json_parameter("email_id_list", email_id_list) diff --git a/services/operator_access_control/src/oci_cli_operator_control_assignment/generated/operatorcontrolassignment_cli.py b/services/operator_access_control/src/oci_cli_operator_control_assignment/generated/operatorcontrolassignment_cli.py index f071cef2a..53a54a2d3 100644 --- a/services/operator_access_control/src/oci_cli_operator_control_assignment/generated/operatorcontrolassignment_cli.py +++ b/services/operator_access_control/src/oci_cli_operator_control_assignment/generated/operatorcontrolassignment_cli.py @@ -17,9 +17,7 @@ @click.command(cli_util.override('operator_control_assignment.operator_control_assignment_root_group.command_name', 'operator-control-assignment'), cls=CommandGroupWithAlias, help=cli_util.override('operator_control_assignment.operator_control_assignment_root_group.help', """Operator Access Control enables you to control the time duration and the actions an Oracle operator can perform on your Exadata Cloud@Customer infrastructure. -Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator. - -Use the table of contents and search tool to explore the OperatorAccessControl API."""), short_help=cli_util.override('operator_control_assignment.operator_control_assignment_root_group.short_help', """OperatorAccessControl API""")) +Using logging service, you can view a near real-time audit report of all actions performed by an Oracle operator."""), short_help=cli_util.override('operator_control_assignment.operator_control_assignment_root_group.short_help', """Operator Access Control API""")) @cli_util.help_option_group def operator_control_assignment_root_group(): pass @@ -72,7 +70,7 @@ def change_operator_control_assignment_compartment(ctx, from_json, operator_cont @cli_util.option('--operator-control-id', required=True, help=u"""The OCID of the operator control that is being assigned to a target resource.""") @cli_util.option('--resource-id', required=True, help=u"""The OCID of the target resource being brought under the governance of the operator control.""") @cli_util.option('--resource-name', required=True, help=u"""Name of the target resource.""") -@cli_util.option('--resource-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["EXACC", "EXADATAINFRASTRUCTURE", "AUTONOMOUSVMCLUSTER", "CLOUDAUTONOMOUSVMCLUSTER", "CCCINFRASTRUCTURE"]), help=u"""Type of the target resource.""") +@cli_util.option('--resource-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["EXACC", "EXADATAINFRASTRUCTURE", "AUTONOMOUSVMCLUSTER", "CLOUDAUTONOMOUSVMCLUSTER", "CCCINFRASTRUCTURE", "CLOUDEXADATAINFRASTRUCTURE"]), help=u"""Type of the target resource.""") @cli_util.option('--resource-compartment-id', required=True, help=u"""The OCID of the compartment that contains the target resource.""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment that contains the operator control assignment.""") @cli_util.option('--is-enforced-always', required=True, type=click.BOOL, help=u"""If set, then the target resource is always governed by the operator control.""") @@ -87,7 +85,7 @@ def change_operator_control_assignment_compartment(ctx, from_json, operator_cont @cli_util.option('--is-auto-approve-during-maintenance', type=click.BOOL, help=u"""The boolean if true would autoApprove during maintenance.""") @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.""" + 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.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATED", "APPLIED", "APPLYFAILED", "UPDATING", "UPDATEFAILED", "DELETING", "DELETED", "DELETIONFAILED"]), 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 CREATED --wait-for-state DELETIONFAILED would return on whichever lifecycle state is reached first. If 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(["CREATED", "APPLIED", "APPLYFAILED", "UPDATING", "UPDATEFAILED", "DELETING", "DELETED", "DELETIONFAILED", "CUSTOMERASSIGNED"]), 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 CREATED --wait-for-state CUSTOMERASSIGNED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, 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': 'operator_access_control', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'operator_access_control', 'class': 'dict(str, dict(str, object))'}}) @@ -178,7 +176,7 @@ def create_operator_control_assignment(ctx, from_json, wait_for_state, max_wait_ @cli_util.option('--description', help=u"""reason for detachment of OperatorAssignment.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.confirm_delete_option -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATED", "APPLIED", "APPLYFAILED", "UPDATING", "UPDATEFAILED", "DELETING", "DELETED", "DELETIONFAILED"]), 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 CREATED --wait-for-state DELETIONFAILED would return on whichever lifecycle state is reached first. If 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(["CREATED", "APPLIED", "APPLYFAILED", "UPDATING", "UPDATEFAILED", "DELETING", "DELETED", "DELETIONFAILED", "CUSTOMERASSIGNED"]), 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 CREATED --wait-for-state CUSTOMERASSIGNED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, 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({}) @@ -289,7 +287,7 @@ def get_operator_control_assignment(ctx, from_json, operator_control_assignment_ @cli_util.option('--operator-control-name', help=u"""A filter to return OperatorControl that match the given operatorControlName.""") @cli_util.option('--resource-name', help=u"""A filter to return only resources that match the given ResourceName.""") @cli_util.option('--resource-type', help=u"""A filter to return only lists of resources that match the entire given service type.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATED", "APPLIED", "APPLYFAILED", "UPDATING", "UPDATEFAILED", "DELETING", "DELETED", "DELETIONFAILED"]), help=u"""A filter to return only resources whose lifecycleState matches the given OperatorControlAssignment lifecycleState.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATED", "APPLIED", "APPLYFAILED", "UPDATING", "UPDATEFAILED", "DELETING", "DELETED", "DELETIONFAILED", "CUSTOMERASSIGNED"]), help=u"""A filter to return only resources whose lifecycleState matches the given OperatorControlAssignment lifecycleState.""") @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'.""") @@ -366,7 +364,7 @@ def list_operator_control_assignments(ctx, from_json, all_pages, page_size, comp @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.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATED", "APPLIED", "APPLYFAILED", "UPDATING", "UPDATEFAILED", "DELETING", "DELETED", "DELETIONFAILED"]), 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 CREATED --wait-for-state DELETIONFAILED would return on whichever lifecycle state is reached first. If 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(["CREATED", "APPLIED", "APPLYFAILED", "UPDATING", "UPDATEFAILED", "DELETING", "DELETED", "DELETIONFAILED", "CUSTOMERASSIGNED"]), 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 CREATED --wait-for-state CUSTOMERASSIGNED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, 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': 'operator_access_control', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'operator_access_control', 'class': 'dict(str, dict(str, object))'}}) diff --git a/services/psql/src/oci_cli_postgresql/generated/postgresql_cli.py b/services/psql/src/oci_cli_postgresql/generated/postgresql_cli.py index ad0905fec..af43777a6 100644 --- a/services/psql/src/oci_cli_postgresql/generated/postgresql_cli.py +++ b/services/psql/src/oci_cli_postgresql/generated/postgresql_cli.py @@ -29,6 +29,12 @@ def db_system_collection_group(): pass +@click.command(cli_util.override('psql.insight_capability_summary_group.command_name', 'insight-capability-summary'), cls=CommandGroupWithAlias, help="""Describes supported insight types and their capabilities.""") +@cli_util.help_option_group +def insight_capability_summary_group(): + pass + + @click.command(cli_util.override('psql.backup_group.command_name', 'backup'), cls=CommandGroupWithAlias, help="""Database system backup information.""") @cli_util.help_option_group def backup_group(): @@ -89,6 +95,12 @@ def shape_summary_group(): pass +@click.command(cli_util.override('psql.db_system_replica_collection_group.command_name', 'db-system-replica-collection'), cls=CommandGroupWithAlias, help="""Results of replica database system search.""") +@cli_util.help_option_group +def db_system_replica_collection_group(): + pass + + @click.command(cli_util.override('psql.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(): @@ -102,6 +114,7 @@ def backup_collection_group(): psql_root_group.add_command(db_system_collection_group) +psql_root_group.add_command(insight_capability_summary_group) psql_root_group.add_command(backup_group) psql_root_group.add_command(configuration_collection_group) psql_root_group.add_command(default_configuration_group) @@ -112,6 +125,7 @@ def backup_collection_group(): psql_root_group.add_command(work_request_group) psql_root_group.add_command(default_configuration_collection_group) psql_root_group.add_command(shape_summary_group) +psql_root_group.add_command(db_system_replica_collection_group) psql_root_group.add_command(work_request_error_group) psql_root_group.add_command(backup_collection_group) @@ -119,7 +133,7 @@ def backup_collection_group(): @backup_group.command(name=cli_util.override('psql.backup_copy.command_name', 'backup-copy'), help=u"""Backup Copy Request to copy back up in remote region. When provided, If-Match is checked against ETag values of the resource. \n[Command Reference](backupCopy)""") @cli_util.option('--backup-id', required=True, help=u"""A unique identifier for the backup.""") @cli_util.option('--compartment-id', required=True, help=u"""target compartment to place a new backup""") -@cli_util.option('--regions', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of region names of the remote region""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--regions', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of region names of the remote regions""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--retention-period', type=click.INT, help=u"""Retention period in days of the backup copy.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -336,6 +350,128 @@ def change_db_system_compartment(ctx, from_json, wait_for_state, max_wait_second cli_util.render_response(result, ctx) +@db_system_group.command(name=cli_util.override('psql.change_role_to_replica.command_name', 'change-role-to-replica'), help=u"""Changes a standalone database system's role to warm-standby replica, converting it into a replica database system that replicates data from the specified primary database system. \n[Command Reference](changeRoleToReplica)""") +@cli_util.option('--primary-db-system-id', required=True, help=u"""The [OCID] of the primary database system.""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def change_role_to_replica(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, primary_db_system_id, db_system_id, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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['primaryDbSystemId'] = primary_db_system_id + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.change_role_to_replica( + db_system_id=db_system_id, + change_role_to_replica_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) + + +@db_system_group.command(name=cli_util.override('psql.change_role_to_standalone.command_name', 'change-role-to-standalone'), help=u"""Convert a replica database system into a standalone database system. \n[Command Reference](changeRoleToStandalone)""") +@cli_util.option('--change-mode', required=True, type=custom_types.CliCaseInsensitiveChoice(["REPLAY_PENDING_UPDATES", "IMMEDIATELY"]), help=u"""Type of the mode choose during change role operation. REPLAY_PENDING_UPDATES (Default value): In this mode, the role change is delayed until replica database system has processed all Write-Ahead log (WAL) records that were archived before this API call is made. IMMEDIATELY: In this mode, the role change is applied right away, without waiting for any pending WAL records to be processed. This allows for an immediate transition.""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def change_role_to_standalone(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, change_mode, db_system_id, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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['changeMode'] = change_mode + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.change_role_to_standalone( + db_system_id=db_system_id, + change_role_to_standalone_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) + + @backup_group.command(name=cli_util.override('psql.create_backup.command_name', 'create'), help=u"""Creates a new backup. \n[Command Reference](createBackup)""") @cli_util.option('--display-name', required=True, help=u"""A user-friendly display name for the backup. Avoid entering confidential information.""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment that contains the backup.""") @@ -512,7 +648,6 @@ def create_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_ @cli_util.option('--db-version', required=True, help=u"""Version of database system software.""") @cli_util.option('--storage-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--shape', required=True, help=u"""The name of the shape for the database instance node. Use the /shapes API for accepted shapes. Example: `VM.Standard.E4.Flex`""") -@cli_util.option('--credentials', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--network-details', 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 user-provided description of a database system.""") @cli_util.option('--system-type', help=u"""Type of the database system.""") @@ -523,19 +658,22 @@ def create_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_ @cli_util.option('--instances-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Details of database instances nodes to be created. This parameter is optional. If specified, its size must match `instanceCount`. This option is a JSON list with items of type CreateDbInstanceDetails. For documentation on CreateDbInstanceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/postgresql/20220915/datatypes/CreateDbInstanceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--source', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', '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={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, credentials, network_details, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, management_policy, source, freeform_tags, defined_tags): +def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, network_details, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, credentials, management_policy, source, replication_config, odsp_insight_details, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -546,7 +684,6 @@ def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte _details['dbVersion'] = db_version _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) _details['shape'] = shape - _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) if description is not None: @@ -570,12 +707,21 @@ def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte if instances_details is not None: _details['instancesDetails'] = cli_util.parse_json_parameter("instances_details", instances_details) + if credentials is not None: + _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) + if management_policy is not None: _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) if source is not None: _details['source'] = cli_util.parse_json_parameter("source", source) + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if odsp_insight_details is not None: + _details['odspInsightDetails'] = cli_util.parse_json_parameter("odsp_insight_details", odsp_insight_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -622,7 +768,6 @@ def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment that contains the database system.""") @cli_util.option('--db-version', required=True, help=u"""Version of database system software.""") @cli_util.option('--shape', required=True, help=u"""The name of the shape for the database instance node. Use the /shapes API for accepted shapes. Example: `VM.Standard.E4.Flex`""") -@cli_util.option('--credentials', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--network-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--storage-details-is-regionally-durable', required=True, type=click.BOOL, help=u"""Specifies if the block volume used for the database system is regional or AD-local. If not specified, it will be set to false. If `isRegionallyDurable` is set to true, `availabilityDomain` should not be specified. If `isRegionallyDurable` is set to false, `availabilityDomain` must be specified.""") @cli_util.option('--description', help=u"""A user-provided description of a database system.""") @@ -634,8 +779,11 @@ def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte @cli_util.option('--instances-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Details of database instances nodes to be created. This parameter is optional. If specified, its size must match `instanceCount`. This option is a JSON list with items of type CreateDbInstanceDetails. For documentation on CreateDbInstanceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/postgresql/20220915/datatypes/CreateDbInstanceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--source', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--storage-details-availability-domain', help=u"""Specifies the availability domain of AD-local storage. If `isRegionallyDurable` is set to true, `availabilityDomain` should not be specified. If `isRegionallyDurable` is set to false, `availabilityDomain` must be specified.""") @@ -643,12 +791,12 @@ def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', '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={'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system_oci_optimized_storage_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, shape, credentials, network_details, storage_details_is_regionally_durable, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, management_policy, source, freeform_tags, defined_tags, storage_details_availability_domain, storage_details_iops): +def create_db_system_oci_optimized_storage_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, shape, network_details, storage_details_is_regionally_durable, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, credentials, management_policy, source, replication_config, odsp_insight_details, freeform_tags, defined_tags, storage_details_availability_domain, storage_details_iops): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -659,7 +807,6 @@ def create_db_system_oci_optimized_storage_details(ctx, from_json, wait_for_stat _details['compartmentId'] = compartment_id _details['dbVersion'] = db_version _details['shape'] = shape - _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) _details['storageDetails']['isRegionallyDurable'] = storage_details_is_regionally_durable @@ -684,12 +831,21 @@ def create_db_system_oci_optimized_storage_details(ctx, from_json, wait_for_stat if instances_details is not None: _details['instancesDetails'] = cli_util.parse_json_parameter("instances_details", instances_details) + if credentials is not None: + _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) + if management_policy is not None: _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) if source is not None: _details['source'] = cli_util.parse_json_parameter("source", source) + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if odsp_insight_details is not None: + _details['odspInsightDetails'] = cli_util.parse_json_parameter("odsp_insight_details", odsp_insight_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -745,7 +901,6 @@ def create_db_system_oci_optimized_storage_details(ctx, from_json, wait_for_stat @cli_util.option('--db-version', required=True, help=u"""Version of database system software.""") @cli_util.option('--storage-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--shape', required=True, help=u"""The name of the shape for the database instance node. Use the /shapes API for accepted shapes. Example: `VM.Standard.E4.Flex`""") -@cli_util.option('--credentials', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--network-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--source-backup-id', required=True, help=u"""The [OCID] of the database system backup.""") @cli_util.option('--description', help=u"""A user-provided description of a database system.""") @@ -757,19 +912,22 @@ def create_db_system_oci_optimized_storage_details(ctx, from_json, wait_for_stat @cli_util.option('--instances-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Details of database instances nodes to be created. This parameter is optional. If specified, its size must match `instanceCount`. This option is a JSON list with items of type CreateDbInstanceDetails. For documentation on CreateDbInstanceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/postgresql/20220915/datatypes/CreateDbInstanceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--source-is-having-restore-config-overrides', type=click.BOOL, help=u"""Deprecated. Don't use.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', '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={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system_backup_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, credentials, network_details, source_backup_id, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, management_policy, freeform_tags, defined_tags, source_is_having_restore_config_overrides): +def create_db_system_backup_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, network_details, source_backup_id, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, credentials, management_policy, replication_config, odsp_insight_details, freeform_tags, defined_tags, source_is_having_restore_config_overrides): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -781,7 +939,6 @@ def create_db_system_backup_source_details(ctx, from_json, wait_for_state, max_w _details['dbVersion'] = db_version _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) _details['shape'] = shape - _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) _details['source']['backupId'] = source_backup_id @@ -806,9 +963,18 @@ def create_db_system_backup_source_details(ctx, from_json, wait_for_state, max_w if instances_details is not None: _details['instancesDetails'] = cli_util.parse_json_parameter("instances_details", instances_details) + if credentials is not None: + _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) + if management_policy is not None: _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if odsp_insight_details is not None: + _details['odspInsightDetails'] = cli_util.parse_json_parameter("odsp_insight_details", odsp_insight_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -855,14 +1021,14 @@ def create_db_system_backup_source_details(ctx, from_json, wait_for_state, max_w cli_util.render_response(result, ctx) -@db_system_group.command(name=cli_util.override('psql.create_db_system_none_source_details.command_name', 'create-db-system-none-source-details'), help=u"""Creates a new database system. \n[Command Reference](createDbSystem)""") +@db_system_group.command(name=cli_util.override('psql.create_db_system_primary_db_system_source_details.command_name', 'create-db-system-primary-db-system-source-details'), help=u"""Creates a new database system. \n[Command Reference](createDbSystem)""") @cli_util.option('--display-name', required=True, help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") @cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment that contains the database system.""") @cli_util.option('--db-version', required=True, help=u"""Version of database system software.""") @cli_util.option('--storage-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--shape', required=True, help=u"""The name of the shape for the database instance node. Use the /shapes API for accepted shapes. Example: `VM.Standard.E4.Flex`""") -@cli_util.option('--credentials', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--network-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source-primary-db-system-id', required=True, help=u"""The [OCID] of the primary database system.""") @cli_util.option('--description', help=u"""A user-provided description of a database system.""") @cli_util.option('--system-type', help=u"""Type of the database system.""") @cli_util.option('--config-id', help=u"""The [OCID] of the configuration associated with the database system.""") @@ -872,18 +1038,21 @@ def create_db_system_backup_source_details(ctx, from_json, wait_for_state, max_w @cli_util.option('--instances-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Details of database instances nodes to be created. This parameter is optional. If specified, its size must match `instanceCount`. This option is a JSON list with items of type CreateDbInstanceDetails. For documentation on CreateDbInstanceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/postgresql/20220915/datatypes/CreateDbInstanceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', '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={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system_none_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, credentials, network_details, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, management_policy, freeform_tags, defined_tags): +def create_db_system_primary_db_system_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, network_details, source_primary_db_system_id, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, credentials, management_policy, replication_config, odsp_insight_details, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -895,8 +1064,8 @@ def create_db_system_none_source_details(ctx, from_json, wait_for_state, max_wai _details['dbVersion'] = db_version _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) _details['shape'] = shape - _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) + _details['source']['primaryDbSystemId'] = source_primary_db_system_id if description is not None: _details['description'] = description @@ -919,16 +1088,25 @@ def create_db_system_none_source_details(ctx, from_json, wait_for_state, max_wai if instances_details is not None: _details['instancesDetails'] = cli_util.parse_json_parameter("instances_details", instances_details) + if credentials is not None: + _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) + if management_policy is not None: _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if odsp_insight_details is not None: + _details['odspInsightDetails'] = cli_util.parse_json_parameter("odsp_insight_details", odsp_insight_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - _details['source']['sourceType'] = 'NONE' + _details['source']['sourceType'] = 'DB_SYSTEM' client = cli_util.build_client('psql', 'postgresql', ctx) result = client.create_db_system( @@ -965,30 +1143,94 @@ def create_db_system_none_source_details(ctx, from_json, wait_for_state, max_wai cli_util.render_response(result, ctx) -@backup_group.command(name=cli_util.override('psql.delete_backup.command_name', 'delete'), help=u"""Deletes a backup by identifier. \n[Command Reference](deleteBackup)""") -@cli_util.option('--backup-id', required=True, help=u"""A unique identifier for the backup.""") -@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.confirm_delete_option +@db_system_group.command(name=cli_util.override('psql.create_db_system_none_source_details.command_name', 'create-db-system-none-source-details'), help=u"""Creates a new database system. \n[Command Reference](createDbSystem)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment that contains the database system.""") +@cli_util.option('--db-version', required=True, help=u"""Version of database system software.""") +@cli_util.option('--storage-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--shape', required=True, help=u"""The name of the shape for the database instance node. Use the /shapes API for accepted shapes. Example: `VM.Standard.E4.Flex`""") +@cli_util.option('--network-details', 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 user-provided description of a database system.""") +@cli_util.option('--system-type', help=u"""Type of the database system.""") +@cli_util.option('--config-id', help=u"""The [OCID] of the configuration associated with the database system.""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The total number of OCPUs available to each database instance node.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The total amount of memory available to each database instance node, in gigabytes.""") +@cli_util.option('--instance-count', type=click.INT, help=u"""Count of database instances nodes to be created in the database system.""") +@cli_util.option('--instances-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Details of database instances nodes to be created. This parameter is optional. If specified, its size must match `instanceCount`. + +This option is a JSON list with items of type CreateDbInstanceDetails. For documentation on CreateDbInstanceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/postgresql/20220915/datatypes/CreateDbInstanceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def delete_backup(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, backup_id, if_match): - - if isinstance(backup_id, six.string_types) and len(backup_id.strip()) == 0: - raise click.UsageError('Parameter --backup-id cannot be whitespace or empty string') +def create_db_system_none_source_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, network_details, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, credentials, management_policy, replication_config, odsp_insight_details, freeform_tags, defined_tags): 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['source'] = {} + _details['displayName'] = display_name + _details['compartmentId'] = compartment_id + _details['dbVersion'] = db_version + _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) + _details['shape'] = shape + _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) + + if description is not None: + _details['description'] = description + + if system_type is not None: + _details['systemType'] = system_type + + if config_id is not None: + _details['configId'] = config_id + + if instance_ocpu_count is not None: + _details['instanceOcpuCount'] = instance_ocpu_count + + if instance_memory_size_in_gbs is not None: + _details['instanceMemorySizeInGBs'] = instance_memory_size_in_gbs + + if instance_count is not None: + _details['instanceCount'] = instance_count + + if instances_details is not None: + _details['instancesDetails'] = cli_util.parse_json_parameter("instances_details", instances_details) + + if credentials is not None: + _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) + + if management_policy is not None: + _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if odsp_insight_details is not None: + _details['odspInsightDetails'] = cli_util.parse_json_parameter("odsp_insight_details", odsp_insight_details) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + _details['source']['sourceType'] = 'NONE' + client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.delete_backup( - backup_id=backup_id, + result = client.create_db_system( + create_db_system_details=_details, **kwargs ) if wait_for_state: @@ -1009,7 +1251,7 @@ def delete_backup(ctx, from_json, wait_for_state, max_wait_seconds, wait_interva 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: @@ -1021,94 +1263,216 @@ def delete_backup(ctx, from_json, wait_for_state, max_wait_seconds, wait_interva cli_util.render_response(result, ctx) -@configuration_group.command(name=cli_util.override('psql.delete_configuration.command_name', 'delete'), help=u"""Deletes a configuration by identifier. \n[Command Reference](deleteConfiguration)""") -@cli_util.option('--configuration-id', required=True, help=u"""A unique identifier for the configuration.""") -@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.confirm_delete_option -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["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 ACTIVE --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@db_system_group.command(name=cli_util.override('psql.create_db_system_disabled_insight_details.command_name', 'create-db-system-disabled-insight-details'), help=u"""Creates a new database system. \n[Command Reference](createDbSystem)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment that contains the database system.""") +@cli_util.option('--db-version', required=True, help=u"""Version of database system software.""") +@cli_util.option('--storage-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--shape', required=True, help=u"""The name of the shape for the database instance node. Use the /shapes API for accepted shapes. Example: `VM.Standard.E4.Flex`""") +@cli_util.option('--network-details', 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 user-provided description of a database system.""") +@cli_util.option('--system-type', help=u"""Type of the database system.""") +@cli_util.option('--config-id', help=u"""The [OCID] of the configuration associated with the database system.""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The total number of OCPUs available to each database instance node.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The total amount of memory available to each database instance node, in gigabytes.""") +@cli_util.option('--instance-count', type=click.INT, help=u"""Count of database instances nodes to be created in the database system.""") +@cli_util.option('--instances-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Details of database instances nodes to be created. This parameter is optional. If specified, its size must match `instanceCount`. + +This option is a JSON list with items of type CreateDbInstanceDetails. For documentation on CreateDbInstanceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/postgresql/20220915/datatypes/CreateDbInstanceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def delete_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, configuration_id, if_match): - - if isinstance(configuration_id, six.string_types) and len(configuration_id.strip()) == 0: - raise click.UsageError('Parameter --configuration-id cannot be whitespace or empty string') +def create_db_system_disabled_insight_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, network_details, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, credentials, management_policy, source, replication_config, freeform_tags, defined_tags): 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('psql', 'postgresql', ctx) - result = client.delete_configuration( - configuration_id=configuration_id, - **kwargs - ) + + _details = {} + _details['odspInsightDetails'] = {} + _details['displayName'] = display_name + _details['compartmentId'] = compartment_id + _details['dbVersion'] = db_version + _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) + _details['shape'] = shape + _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) + + if description is not None: + _details['description'] = description + + if system_type is not None: + _details['systemType'] = system_type + + if config_id is not None: + _details['configId'] = config_id + + if instance_ocpu_count is not None: + _details['instanceOcpuCount'] = instance_ocpu_count + + if instance_memory_size_in_gbs is not None: + _details['instanceMemorySizeInGBs'] = instance_memory_size_in_gbs + + if instance_count is not None: + _details['instanceCount'] = instance_count + + if instances_details is not None: + _details['instancesDetails'] = cli_util.parse_json_parameter("instances_details", instances_details) + + if credentials is not None: + _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) + + if management_policy is not None: + _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + + if source is not None: + _details['source'] = cli_util.parse_json_parameter("source", source) + + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + _details['odspInsightDetails']['kind'] = 'DISABLED' + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.create_db_system( + create_db_system_details=_details, + **kwargs + ) if wait_for_state: - if hasattr(client, 'get_configuration') and callable(getattr(client, 'get_configuration')): + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): try: wait_period_kwargs = {} if max_wait_seconds is not None: wait_period_kwargs['max_wait_seconds'] = max_wait_seconds if wait_interval_seconds is not None: wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return - click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) - oci.wait_until(client, client.get_configuration(configuration_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs) - except oci.exceptions.ServiceError as e: - # We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the - # outcome of a delete operation it is possible that the resource is already gone and so the initial service call - # will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising - # the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument - # succeed_on_not_found=True to the waiter). - # - # Any non-404 should still result in the exception being thrown. - if e.status == 404: - pass - else: - raise + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) except oci.exceptions.MaximumWaitTimeExceeded as e: # If we fail, we should show an error, but we should still provide the information to the customer - click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr) + click.echo('Failed to wait until the work request entered the specified state. 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) -@db_system_group.command(name=cli_util.override('psql.delete_db_system.command_name', 'delete'), help=u"""Deletes a database system by identifier. \n[Command Reference](deleteDbSystem)""") -@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") -@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.confirm_delete_option +@db_system_group.command(name=cli_util.override('psql.create_db_system_enabled_insight_details.command_name', 'create-db-system-enabled-insight-details'), help=u"""Creates a new database system. \n[Command Reference](createDbSystem)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment that contains the database system.""") +@cli_util.option('--db-version', required=True, help=u"""Version of database system software.""") +@cli_util.option('--storage-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--shape', required=True, help=u"""The name of the shape for the database instance node. Use the /shapes API for accepted shapes. Example: `VM.Standard.E4.Flex`""") +@cli_util.option('--network-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details-odsp-insight-list', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of ODSP Insight and their configurations.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--description', help=u"""A user-provided description of a database system.""") +@cli_util.option('--system-type', help=u"""Type of the database system.""") +@cli_util.option('--config-id', help=u"""The [OCID] of the configuration associated with the database system.""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The total number of OCPUs available to each database instance node.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The total amount of memory available to each database instance node, in gigabytes.""") +@cli_util.option('--instance-count', type=click.INT, help=u"""Count of database instances nodes to be created in the database system.""") +@cli_util.option('--instances-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Details of database instances nodes to be created. This parameter is optional. If specified, its size must match `instanceCount`. + +This option is a JSON list with items of type CreateDbInstanceDetails. For documentation on CreateDbInstanceDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/postgresql/20220915/datatypes/CreateDbInstanceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--source', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'odsp-insight-details-odsp-insight-list': {'module': 'psql', 'class': 'list[OdspInsight]'}}) @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={'storage-details': {'module': 'psql', 'class': 'StorageDetails'}, 'instances-details': {'module': 'psql', 'class': 'list[CreateDbInstanceDetails]'}, 'credentials': {'module': 'psql', 'class': 'Credentials'}, 'network-details': {'module': 'psql', 'class': 'NetworkDetails'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'source': {'module': 'psql', 'class': 'SourceDetails'}, 'replication-config': {'module': 'psql', 'class': 'CreateReplicationConfigDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'odsp-insight-details-odsp-insight-list': {'module': 'psql', 'class': 'list[OdspInsight]'}}, output_type={'module': 'psql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def delete_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, if_match): - - if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: - raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') +def create_db_system_enabled_insight_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, db_version, storage_details, shape, network_details, odsp_insight_details_odsp_insight_list, description, system_type, config_id, instance_ocpu_count, instance_memory_size_in_gbs, instance_count, instances_details, credentials, management_policy, source, replication_config, freeform_tags, defined_tags): 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['odspInsightDetails'] = {} + _details['displayName'] = display_name + _details['compartmentId'] = compartment_id + _details['dbVersion'] = db_version + _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) + _details['shape'] = shape + _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) + _details['odspInsightDetails']['odspInsightList'] = cli_util.parse_json_parameter("odsp_insight_details_odsp_insight_list", odsp_insight_details_odsp_insight_list) + + if description is not None: + _details['description'] = description + + if system_type is not None: + _details['systemType'] = system_type + + if config_id is not None: + _details['configId'] = config_id + + if instance_ocpu_count is not None: + _details['instanceOcpuCount'] = instance_ocpu_count + + if instance_memory_size_in_gbs is not None: + _details['instanceMemorySizeInGBs'] = instance_memory_size_in_gbs + + if instance_count is not None: + _details['instanceCount'] = instance_count + + if instances_details is not None: + _details['instancesDetails'] = cli_util.parse_json_parameter("instances_details", instances_details) + + if credentials is not None: + _details['credentials'] = cli_util.parse_json_parameter("credentials", credentials) + + if management_policy is not None: + _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + + if source is not None: + _details['source'] = cli_util.parse_json_parameter("source", source) + + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + _details['odspInsightDetails']['kind'] = 'ENABLED' + client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.delete_db_system( - db_system_id=db_system_id, + result = client.create_db_system( + create_db_system_details=_details, **kwargs ) if wait_for_state: @@ -1129,7 +1493,7 @@ def delete_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte 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: @@ -1141,11 +1505,10 @@ def delete_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte cli_util.render_response(result, ctx) -@db_system_group.command(name=cli_util.override('psql.failover_db_system.command_name', 'failover'), help=u"""Runs a failover operation. Optionally, specify the desired AD for regions with three ADs. \n[Command Reference](failoverDbSystem)""") -@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") -@cli_util.option('--ad', help=u"""The preferred AD for regions with three availability domains. This parameter is optional. If not set, the AD will be chosen based on availability.""") -@cli_util.option('--db-instance-id', help=u"""The [OCID] of the database instance node. This parameter is optional. If not set, an existing database instance node will be chosen based on availability.""") +@backup_group.command(name=cli_util.override('psql.delete_backup.command_name', 'delete'), help=u"""Deletes a backup by identifier. \n[Command Reference](deleteBackup)""") +@cli_util.option('--backup-id', required=True, help=u"""A unique identifier for the backup.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -1154,28 +1517,18 @@ def delete_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def failover_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, ad, db_instance_id, if_match): +def delete_backup(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, backup_id, if_match): - if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: - raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + if isinstance(backup_id, six.string_types) and len(backup_id.strip()) == 0: + raise click.UsageError('Parameter --backup-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - - if ad is not None: - _details['ad'] = ad - - if db_instance_id is not None: - _details['dbInstanceId'] = db_instance_id - client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.failover_db_system( - db_system_id=db_system_id, - failover_db_system_details=_details, + result = client.delete_backup( + backup_id=backup_id, **kwargs ) if wait_for_state: @@ -1196,7 +1549,7 @@ def failover_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_in 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) + 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: @@ -1208,70 +1561,257 @@ def failover_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_in cli_util.render_response(result, ctx) -@backup_group.command(name=cli_util.override('psql.get_backup.command_name', 'get'), help=u"""Gets a backup by identifier. \n[Command Reference](getBackup)""") -@cli_util.option('--backup-id', required=True, help=u"""A unique identifier for the backup.""") -@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': 'psql', 'class': 'Backup'}) -@cli_util.wrap_exceptions -def get_backup(ctx, from_json, backup_id): - - if isinstance(backup_id, six.string_types) and len(backup_id.strip()) == 0: - raise click.UsageError('Parameter --backup-id cannot be whitespace or empty string') - - kwargs = {} - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.get_backup( - backup_id=backup_id, - **kwargs - ) - cli_util.render_response(result, ctx) - - -@configuration_group.command(name=cli_util.override('psql.get_configuration.command_name', 'get'), help=u"""Gets a configuration by identifier. \n[Command Reference](getConfiguration)""") +@configuration_group.command(name=cli_util.override('psql.delete_configuration.command_name', 'delete'), help=u"""Deletes a configuration by identifier. \n[Command Reference](deleteConfiguration)""") @cli_util.option('--configuration-id', required=True, help=u"""A unique identifier for the configuration.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["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 ACTIVE --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'psql', 'class': 'Configuration'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def get_configuration(ctx, from_json, configuration_id): +def delete_configuration(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, configuration_id, if_match): if isinstance(configuration_id, six.string_types) and len(configuration_id.strip()) == 0: raise click.UsageError('Parameter --configuration-id cannot be whitespace or empty string') kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.get_configuration( + result = client.delete_configuration( configuration_id=configuration_id, **kwargs ) - cli_util.render_response(result, ctx) - - -@connection_details_group.command(name=cli_util.override('psql.get_connection_details.command_name', 'get'), help=u"""Gets the database system connection details. \n[Command Reference](getConnectionDetails)""") -@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") -@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': 'psql', 'class': 'ConnectionDetails'}) -@cli_util.wrap_exceptions -def get_connection_details(ctx, from_json, db_system_id): - - if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: - raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + if wait_for_state: - kwargs = {} - kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.get_connection_details( - db_system_id=db_system_id, - **kwargs - ) - cli_util.render_response(result, ctx) + if hasattr(client, 'get_configuration') and callable(getattr(client, 'get_configuration')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + oci.wait_until(client, client.get_configuration(configuration_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) + + +@db_system_group.command(name=cli_util.override('psql.delete_db_system.command_name', 'delete'), help=u"""Deletes a database system by identifier. \n[Command Reference](deleteDbSystem)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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('psql', 'postgresql', ctx) + result = client.delete_db_system( + db_system_id=db_system_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) + + +@db_system_group.command(name=cli_util.override('psql.failover_db_system.command_name', 'failover'), help=u"""Runs a failover operation. Optionally, specify the desired AD for regions with three ADs. \n[Command Reference](failoverDbSystem)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--ad', help=u"""The preferred AD for regions with three availability domains. This parameter is optional. If not set, the AD will be chosen based on availability.""") +@cli_util.option('--db-instance-id', help=u"""The [OCID] of the database instance node. This parameter is optional. If not set, an existing database instance node will be chosen based on availability.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def failover_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, ad, db_instance_id, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if ad is not None: + _details['ad'] = ad + + if db_instance_id is not None: + _details['dbInstanceId'] = db_instance_id + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.failover_db_system( + db_system_id=db_system_id, + failover_db_system_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) + + +@backup_group.command(name=cli_util.override('psql.get_backup.command_name', 'get'), help=u"""Gets a backup by identifier. \n[Command Reference](getBackup)""") +@cli_util.option('--backup-id', required=True, help=u"""A unique identifier for the backup.""") +@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': 'psql', 'class': 'Backup'}) +@cli_util.wrap_exceptions +def get_backup(ctx, from_json, backup_id): + + if isinstance(backup_id, six.string_types) and len(backup_id.strip()) == 0: + raise click.UsageError('Parameter --backup-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.get_backup( + backup_id=backup_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@configuration_group.command(name=cli_util.override('psql.get_configuration.command_name', 'get'), help=u"""Gets a configuration by identifier. \n[Command Reference](getConfiguration)""") +@cli_util.option('--configuration-id', required=True, help=u"""A unique identifier for the configuration.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'psql', 'class': 'Configuration'}) +@cli_util.wrap_exceptions +def get_configuration(ctx, from_json, configuration_id): + + if isinstance(configuration_id, six.string_types) and len(configuration_id.strip()) == 0: + raise click.UsageError('Parameter --configuration-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.get_configuration( + configuration_id=configuration_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@connection_details_group.command(name=cli_util.override('psql.get_connection_details.command_name', 'get'), help=u"""Gets the database system connection details. \n[Command Reference](getConnectionDetails)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@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': 'psql', 'class': 'ConnectionDetails'}) +@cli_util.wrap_exceptions +def get_connection_details(ctx, from_json, db_system_id): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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('psql', 'postgresql', ctx) + result = client.get_connection_details( + db_system_id=db_system_id, + **kwargs + ) + cli_util.render_response(result, ctx) @db_system_group.command(name=cli_util.override('psql.get_db_system.command_name', 'get'), help=u"""Gets a database system by identifier. \n[Command Reference](getDbSystem)""") @@ -1513,44 +2053,30 @@ def list_configurations(ctx, from_json, all_pages, page_size, compartment_id, li cli_util.render_response(result, ctx) -@db_system_collection_group.command(name=cli_util.override('psql.list_db_systems.command_name', 'list-db-systems'), help=u"""Returns a list of database systems. \n[Command Reference](listDbSystems)""") -@cli_util.option('--compartment-id', help=u"""The ID of the compartment in which to list resources.""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), help=u"""A filter to return only resources if their `lifecycleState` matches the given `lifecycleState`.""") -@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") -@cli_util.option('--id', help=u"""A unique identifier for the database system.""") +@db_system_replica_collection_group.command(name=cli_util.override('psql.list_db_system_replicas.command_name', 'list-db-system-replicas'), help=u"""Returns a list of replica database systems. \n[Command Reference](listDbSystemReplicas)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") -@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") -@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") @cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") @cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'psql', 'class': 'DbSystemCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'psql', 'class': 'DbSystemReplicaCollection'}) @cli_util.wrap_exceptions -def list_db_systems(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, limit, page, sort_order, sort_by): +def list_db_system_replicas(ctx, from_json, all_pages, page_size, db_system_id, limit, page): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + kwargs = {} - if compartment_id is not None: - kwargs['compartment_id'] = compartment_id - if lifecycle_state is not None: - kwargs['lifecycle_state'] = lifecycle_state - if display_name is not None: - kwargs['display_name'] = display_name - if id is not None: - kwargs['id'] = id if limit is not None: kwargs['limit'] = limit if page is not None: kwargs['page'] = page - if sort_order is not None: - kwargs['sort_order'] = sort_order - if sort_by is not None: - kwargs['sort_by'] = sort_by kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) client = cli_util.build_client('psql', 'postgresql', ctx) if all_pages: @@ -1558,41 +2084,109 @@ def list_db_systems(ctx, from_json, all_pages, page_size, compartment_id, lifecy kwargs['limit'] = page_size result = cli_util.list_call_get_all_results( - client.list_db_systems, + client.list_db_system_replicas, + db_system_id=db_system_id, **kwargs ) elif limit is not None: result = cli_util.list_call_get_up_to_limit( - client.list_db_systems, + client.list_db_system_replicas, limit, page_size, + db_system_id=db_system_id, **kwargs ) else: - result = client.list_db_systems( + result = client.list_db_system_replicas( + db_system_id=db_system_id, **kwargs ) cli_util.render_response(result, ctx) -@default_configuration_collection_group.command(name=cli_util.override('psql.list_default_configurations.command_name', 'list-default-configurations'), help=u"""Returns a list of default configurations. \n[Command Reference](listDefaultConfigurations)""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only resources if their `lifecycleState` matches the given `lifecycleState`.""") +@db_system_collection_group.command(name=cli_util.override('psql.list_db_systems.command_name', 'list-db-systems'), help=u"""Returns a list of database systems. \n[Command Reference](listDbSystems)""") +@cli_util.option('--compartment-id', help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED", "FAILED", "NEEDS_ATTENTION"]), help=u"""A filter to return only resources if their `lifecycleState` matches the given `lifecycleState`.""") @cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") -@cli_util.option('--db-version', help=u"""Version of the PostgreSQL database, such as 14.9.""") -@cli_util.option('--shape', help=u"""The compute name of the shape for the configuration.""") -@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The instance ocpu count for the configuration.""") -@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The instance memory size in GBs for the configuration.""") -@cli_util.option('--configuration-id', help=u"""A unique identifier for the configuration.""") +@cli_util.option('--id', help=u"""A unique identifier for the database system.""") @cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") @cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") @cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--system-role', type=custom_types.CliCaseInsensitiveChoice(["STANDALONE_DB_SYSTEM", "PRIMARY_DB_SYSTEM", "WARM_STANDBY_DB_SYSTEM", "PILOT_LIGHT_DB_SYSTEM"]), help=u"""A filter to return only DbSystem resources if their `systemRole` matches the given value.""") @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': 'psql', 'class': 'DefaultConfigurationCollection'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'psql', 'class': 'DbSystemCollection'}) +@cli_util.wrap_exceptions +def list_db_systems(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, limit, page, sort_order, sort_by, system_role): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if id is not None: + kwargs['id'] = id + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + if system_role is not None: + kwargs['system_role'] = system_role + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('psql', 'postgresql', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_db_systems, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_db_systems, + limit, + page_size, + **kwargs + ) + else: + result = client.list_db_systems( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@default_configuration_collection_group.command(name=cli_util.override('psql.list_default_configurations.command_name', 'list-default-configurations'), help=u"""Returns a list of default configurations. \n[Command Reference](listDefaultConfigurations)""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only resources if their `lifecycleState` matches the given `lifecycleState`.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--db-version', help=u"""Version of the PostgreSQL database, such as 14.9.""") +@cli_util.option('--shape', help=u"""The compute name of the shape for the configuration.""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The instance ocpu count for the configuration.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The instance memory size in GBs for the configuration.""") +@cli_util.option('--configuration-id', help=u"""A unique identifier for the configuration.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'psql', 'class': 'DefaultConfigurationCollection'}) @cli_util.wrap_exceptions def list_default_configurations(ctx, from_json, all_pages, page_size, lifecycle_state, display_name, db_version, shape, instance_ocpu_count, instance_memory_size_in_gbs, configuration_id, limit, page, sort_order, sort_by): @@ -1646,6 +2240,50 @@ def list_default_configurations(ctx, from_json, all_pages, page_size, lifecycle_ cli_util.render_response(result, ctx) +@insight_capability_summary_group.command(name=cli_util.override('psql.list_insight_capabilities.command_name', 'list-insight-capabilities'), help=u"""Returns the supported insight types and their capabilities. This API allows clients to discover: - Supported insight types - Supported insight data types for each insight type - Filters, sorting, pagination, limits, and data contracts required to use the unified insights API. \n[Command Reference](listInsightCapabilities)""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'psql', 'class': 'InsightCapabilityCollection'}) +@cli_util.wrap_exceptions +def list_insight_capabilities(ctx, from_json, all_pages, page_size, limit, page): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('psql', 'postgresql', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_insight_capabilities, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_insight_capabilities, + limit, + page_size, + **kwargs + ) + else: + result = client.list_insight_capabilities( + **kwargs + ) + cli_util.render_response(result, ctx) + + @shape_summary_group.command(name=cli_util.override('psql.list_shapes.command_name', 'list-shapes'), help=u"""Returns the list of shapes allowed in the region. \n[Command Reference](listShapes)""") @cli_util.option('--compartment-id', help=u"""The ID of the compartment in which to list resources.""") @cli_util.option('--id', help=u"""A filter to return the feature by the shape name.""") @@ -1887,12 +2525,397 @@ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, wor @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'items': {'module': 'psql', 'class': 'list[PatchInstruction]'}}) +@json_skeleton_utils.get_cli_json_input_option({'items': {'module': 'psql', 'class': 'list[PatchInstruction]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'items': {'module': 'psql', 'class': 'list[PatchInstruction]'}}) +@cli_util.wrap_exceptions +def patch_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, items, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if items is not None: + _details['items'] = cli_util.parse_json_parameter("items", items) + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.patch_db_system( + db_system_id=db_system_id, + patch_db_system_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) + + +@db_system_group.command(name=cli_util.override('psql.reset_master_user_password.command_name', 'reset-master-user-password'), help=u"""Resets the database system's master password. \n[Command Reference](resetMasterUserPassword)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--password-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'password-details': {'module': 'psql', 'class': 'PasswordDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'password-details': {'module': 'psql', 'class': 'PasswordDetails'}}) +@cli_util.wrap_exceptions +def reset_master_user_password(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, password_details, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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['passwordDetails'] = cli_util.parse_json_parameter("password_details", password_details) + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.reset_master_user_password( + db_system_id=db_system_id, + reset_master_user_password_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) + + +@db_system_group.command(name=cli_util.override('psql.reset_master_user_password_plain_text_password_details.command_name', 'reset-master-user-password-plain-text-password-details'), help=u"""Resets the database system's master password. \n[Command Reference](resetMasterUserPassword)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--password-details-password', required=True, help=u"""The database system password.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def reset_master_user_password_plain_text_password_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, password_details_password, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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['passwordDetails'] = {} + _details['passwordDetails']['password'] = password_details_password + + _details['passwordDetails']['passwordType'] = 'PLAIN_TEXT' + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.reset_master_user_password( + db_system_id=db_system_id, + reset_master_user_password_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) + + +@db_system_group.command(name=cli_util.override('psql.reset_master_user_password_vault_secret_password_details.command_name', 'reset-master-user-password-vault-secret-password-details'), help=u"""Resets the database system's master password. \n[Command Reference](resetMasterUserPassword)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--password-details-secret-id', required=True, help=u"""The [OCID] of the secret where the password is stored.""") +@cli_util.option('--password-details-secret-version', required=True, help=u"""The secret version of the stored password.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def reset_master_user_password_vault_secret_password_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, password_details_secret_id, password_details_secret_version, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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['passwordDetails'] = {} + _details['passwordDetails']['secretId'] = password_details_secret_id + _details['passwordDetails']['secretVersion'] = password_details_secret_version + + _details['passwordDetails']['passwordType'] = 'VAULT_SECRET' + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.reset_master_user_password( + db_system_id=db_system_id, + reset_master_user_password_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) + + +@db_system_group.command(name=cli_util.override('psql.restart_db_instance_in_db_system.command_name', 'restart-db-instance-in'), help=u"""Restarts the running database instance node. \n[Command Reference](restartDbInstanceInDbSystem)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--db-instance-id', required=True, help=u"""A unique identifier for the database instance, or node.""") +@cli_util.option('--restart-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["NORMAL", "NODE_REBOOT"]), help=u"""The restart type for the database instance.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def restart_db_instance_in_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, db_instance_id, restart_type, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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['dbInstanceId'] = db_instance_id + _details['restartType'] = restart_type + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.restart_db_instance_in_db_system( + db_system_id=db_system_id, + restart_db_instance_in_db_system_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) + + +@db_system_group.command(name=cli_util.override('psql.restore_db_system.command_name', 'restore'), help=u"""Restore the database system. \n[Command Reference](restoreDbSystem)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--backup-id', required=True, help=u"""The [OCID] of the database system backup.""") +@cli_util.option('--ad', help=u"""The desired AD for regions with three ADs. This parameter is optional. If not set, the AD is chosen based on the database system's current AD.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def restore_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, backup_id, ad, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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['backupId'] = backup_id + + if ad is not None: + _details['ad'] = ad + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.restore_db_system( + db_system_id=db_system_id, + restore_db_system_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) + + +@db_system_group.command(name=cli_util.override('psql.start_db_system.command_name', 'start'), help=u"""Start the DB System. \n[Command Reference](startDbSystem)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The total number of OCPUs available to each database system node.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The total amount of memory available to each database system node, in gigabytes.""") +@cli_util.option('--shape', help=u"""The name of the shape for the database system nodes. Example: `VM.Standard.E4.Flex`""") +@cli_util.option('--config-id', help=u"""The updated configId for the database system.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'items': {'module': 'psql', 'class': 'list[PatchInstruction]'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def patch_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, items, if_match): +def start_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, instance_ocpu_count, instance_memory_size_in_gbs, shape, config_id, if_match): if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') @@ -1904,13 +2927,22 @@ def patch_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inter _details = {} - if items is not None: - _details['items'] = cli_util.parse_json_parameter("items", items) + if instance_ocpu_count is not None: + _details['instanceOcpuCount'] = instance_ocpu_count + + if instance_memory_size_in_gbs is not None: + _details['instanceMemorySizeInGBs'] = instance_memory_size_in_gbs + + if shape is not None: + _details['shape'] = shape + + if config_id is not None: + _details['configId'] = config_id client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.patch_db_system( + result = client.start_db_system( db_system_id=db_system_id, - patch_db_system_details=_details, + start_db_system_details=_details, **kwargs ) if wait_for_state: @@ -1943,19 +2975,18 @@ def patch_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inter cli_util.render_response(result, ctx) -@db_system_group.command(name=cli_util.override('psql.reset_master_user_password.command_name', 'reset-master-user-password'), help=u"""Resets the database system's master password. \n[Command Reference](resetMasterUserPassword)""") +@db_system_group.command(name=cli_util.override('psql.stop_db_system.command_name', 'stop'), help=u"""Stop the DB System. \n[Command Reference](stopDbSystem)""") @cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") -@cli_util.option('--password-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'password-details': {'module': 'psql', 'class': 'PasswordDetails'}}) +@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={'password-details': {'module': 'psql', 'class': 'PasswordDetails'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def reset_master_user_password(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, password_details, if_match): +def stop_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, if_match): if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') @@ -1964,14 +2995,9 @@ def reset_master_user_password(ctx, from_json, wait_for_state, max_wait_seconds, if if_match is not None: kwargs['if_match'] = if_match kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) - - _details = {} - _details['passwordDetails'] = cli_util.parse_json_parameter("password_details", password_details) - client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.reset_master_user_password( + result = client.stop_db_system( db_system_id=db_system_id, - reset_master_user_password_details=_details, **kwargs ) if wait_for_state: @@ -2004,9 +3030,9 @@ def reset_master_user_password(ctx, from_json, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) -@db_system_group.command(name=cli_util.override('psql.reset_master_user_password_plain_text_password_details.command_name', 'reset-master-user-password-plain-text-password-details'), help=u"""Resets the database system's master password. \n[Command Reference](resetMasterUserPassword)""") +@db_system_group.command(name=cli_util.override('psql.switch_over.command_name', 'switch-over'), help=u"""Switchover the roles between a primary database system and its replica, making the replica the new primary and the original primary become its replica. \n[Command Reference](switchOver)""") +@cli_util.option('--replica-db-system-id', required=True, help=u"""The OCID of the replica database system that will get the primary role after switchover.""") @cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") -@cli_util.option('--password-details-password', required=True, help=u"""The database system password.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -2016,7 +3042,7 @@ def reset_master_user_password(ctx, from_json, wait_for_state, max_wait_seconds, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) @cli_util.wrap_exceptions -def reset_master_user_password_plain_text_password_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, password_details_password, if_match): +def switch_over(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, replica_db_system_id, db_system_id, if_match): if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') @@ -2027,15 +3053,12 @@ def reset_master_user_password_plain_text_password_details(ctx, from_json, wait_ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['passwordDetails'] = {} - _details['passwordDetails']['password'] = password_details_password - - _details['passwordDetails']['passwordType'] = 'PLAIN_TEXT' + _details['replicaDbSystemId'] = replica_db_system_id client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.reset_master_user_password( + result = client.switch_over( db_system_id=db_system_id, - reset_master_user_password_details=_details, + switch_over_details=_details, **kwargs ) if wait_for_state: @@ -2068,23 +3091,31 @@ def reset_master_user_password_plain_text_password_details(ctx, from_json, wait_ cli_util.render_response(result, ctx) -@db_system_group.command(name=cli_util.override('psql.reset_master_user_password_vault_secret_password_details.command_name', 'reset-master-user-password-vault-secret-password-details'), help=u"""Resets the database system's master password. \n[Command Reference](resetMasterUserPassword)""") -@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") -@cli_util.option('--password-details-secret-id', required=True, help=u"""The [OCID] of the secret where the password is stored.""") -@cli_util.option('--password-details-secret-version', required=True, help=u"""The secret version of the stored password.""") +@backup_group.command(name=cli_util.override('psql.update_backup.command_name', 'update'), help=u"""Updates the backup. \n[Command Reference](updateBackup)""") +@cli_util.option('--backup-id', required=True, help=u"""A unique identifier for the backup.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name for the backup. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A description for the backup.""") +@cli_util.option('--retention-period', type=click.INT, help=u"""Backup retention period in days.""") +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "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({'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'Backup'}) @cli_util.wrap_exceptions -def reset_master_user_password_vault_secret_password_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, password_details_secret_id, password_details_secret_version, if_match): +def update_backup(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, backup_id, display_name, description, retention_period, freeform_tags, defined_tags, if_match): - if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: - raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + if isinstance(backup_id, six.string_types) and len(backup_id.strip()) == 0: + raise click.UsageError('Parameter --backup-id cannot be whitespace or empty string') + if not force: + if freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() kwargs = {} if if_match is not None: @@ -2092,79 +3123,222 @@ def reset_master_user_password_vault_secret_password_details(ctx, from_json, wai kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['passwordDetails'] = {} - _details['passwordDetails']['secretId'] = password_details_secret_id - _details['passwordDetails']['secretVersion'] = password_details_secret_version - _details['passwordDetails']['passwordType'] = 'VAULT_SECRET' + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if retention_period is not None: + _details['retentionPeriod'] = retention_period + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.reset_master_user_password( - db_system_id=db_system_id, - reset_master_user_password_details=_details, + result = client.update_backup( + backup_id=backup_id, + update_backup_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + if hasattr(client, 'get_backup') and callable(getattr(client, 'get_backup')): 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_backup(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) + + +@configuration_group.command(name=cli_util.override('psql.update_configuration.command_name', 'update'), help=u"""Updates a display name or description of the configuration. \n[Command Reference](updateConfiguration)""") +@cli_util.option('--configuration-id', required=True, help=u"""A unique identifier for the configuration.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name for the configuration. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""Details about the configuration set.""") +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--compatible-shapes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Indicates the collection of compatible shapes for this configuration.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'compatible-shapes': {'module': 'psql', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'compatible-shapes': {'module': 'psql', 'class': 'list[string]'}}, output_type={'module': 'psql', 'class': 'Configuration'}) +@cli_util.wrap_exceptions +def update_configuration(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, configuration_id, display_name, description, freeform_tags, defined_tags, compatible_shapes, if_match): + + if isinstance(configuration_id, six.string_types) and len(configuration_id.strip()) == 0: + raise click.UsageError('Parameter --configuration-id cannot be whitespace or empty string') + if not force: + if freeform_tags or defined_tags or compatible_shapes: + if not click.confirm("WARNING: Updates to freeform-tags and defined-tags and compatible-shapes will replace any existing values. Are you sure you want to continue?"): + ctx.abort() + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + if compatible_shapes is not None: + _details['compatibleShapes'] = cli_util.parse_json_parameter("compatible_shapes", compatible_shapes) + + client = cli_util.build_client('psql', 'postgresql', ctx) + result = client.update_configuration( + configuration_id=configuration_id, + update_configuration_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_configuration') and callable(getattr(client, 'get_configuration')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_configuration(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) cli_util.render_response(result, ctx) -@db_system_group.command(name=cli_util.override('psql.restart_db_instance_in_db_system.command_name', 'restart-db-instance-in'), help=u"""Restarts the running database instance node. \n[Command Reference](restartDbInstanceInDbSystem)""") -@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") -@cli_util.option('--db-instance-id', required=True, help=u"""A unique identifier for the database instance, or node.""") -@cli_util.option('--restart-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["NORMAL", "NODE_REBOOT"]), help=u"""The restart type for the database instance.""") -@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) -@cli_util.help_option -@click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) -@cli_util.wrap_exceptions -def restart_db_instance_in_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, db_instance_id, restart_type, if_match): +@db_system_group.command(name=cli_util.override('psql.update_db_system.command_name', 'update'), help=u"""Updates the database system. \n[Command Reference](updateDbSystem)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A user-provided description of the database system.""") +@cli_util.option('--shape', help=u"""The name of the shape for the database system nodes. Example: `VM.Standard.E4.Flex`""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The total number of OCPUs available to each database system node.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The total amount of memory available to each database system node, in gigabytes.""") +@cli_util.option('--db-configuration-params', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--storage-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--network-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--kerberos-auth-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'kerberos-auth-details': {'module': 'psql', 'class': 'KerberosAuthDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', '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={'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'kerberos-auth-details': {'module': 'psql', 'class': 'KerberosAuthDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_db_system(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, display_name, description, shape, instance_ocpu_count, instance_memory_size_in_gbs, db_configuration_params, management_policy, storage_details, replication_config, network_details, kerberos_auth_details, odsp_insight_details, freeform_tags, defined_tags, if_match): + + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + if not force: + if db_configuration_params or management_policy or storage_details or replication_config or network_details or kerberos_auth_details or odsp_insight_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to db-configuration-params and management-policy and storage-details and replication-config and network-details and kerberos-auth-details and odsp-insight-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if shape is not None: + _details['shape'] = shape + + if instance_ocpu_count is not None: + _details['instanceOcpuCount'] = instance_ocpu_count + + if instance_memory_size_in_gbs is not None: + _details['instanceMemorySizeInGBs'] = instance_memory_size_in_gbs + + if db_configuration_params is not None: + _details['dbConfigurationParams'] = cli_util.parse_json_parameter("db_configuration_params", db_configuration_params) + + if management_policy is not None: + _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + + if storage_details is not None: + _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) + + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if network_details is not None: + _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) - if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: - raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + if kerberos_auth_details is not None: + _details['kerberosAuthDetails'] = cli_util.parse_json_parameter("kerberos_auth_details", kerberos_auth_details) - 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 odsp_insight_details is not None: + _details['odspInsightDetails'] = cli_util.parse_json_parameter("odsp_insight_details", odsp_insight_details) - _details = {} - _details['dbInstanceId'] = db_instance_id - _details['restartType'] = restart_type + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.restart_db_instance_in_db_system( + result = client.update_db_system( db_system_id=db_system_id, - restart_db_instance_in_db_system_details=_details, + update_db_system_details=_details, **kwargs ) if wait_for_state: @@ -2197,23 +3371,39 @@ def restart_db_instance_in_db_system(ctx, from_json, wait_for_state, max_wait_se cli_util.render_response(result, ctx) -@db_system_group.command(name=cli_util.override('psql.restore_db_system.command_name', 'restore'), help=u"""Restore the database system. \n[Command Reference](restoreDbSystem)""") +@db_system_group.command(name=cli_util.override('psql.update_db_system_disabled_kerberos_auth_details.command_name', 'update-db-system-disabled-kerberos-auth-details'), help=u"""Updates the database system. \n[Command Reference](updateDbSystem)""") @cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") -@cli_util.option('--backup-id', required=True, help=u"""The [OCID] of the database system backup.""") -@cli_util.option('--ad', help=u"""The desired AD for regions with three ADs. This parameter is optional. If not set, the AD is chosen based on the database system's current AD.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A user-provided description of the database system.""") +@cli_util.option('--shape', help=u"""The name of the shape for the database system nodes. Example: `VM.Standard.E4.Flex`""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The total number of OCPUs available to each database system node.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The total amount of memory available to each database system node, in gigabytes.""") +@cli_util.option('--db-configuration-params', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--storage-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--network-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def restore_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, backup_id, ad, if_match): +def update_db_system_disabled_kerberos_auth_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, display_name, description, shape, instance_ocpu_count, instance_memory_size_in_gbs, db_configuration_params, management_policy, storage_details, replication_config, network_details, odsp_insight_details, freeform_tags, defined_tags, if_match): if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') + if not force: + if db_configuration_params or management_policy or storage_details or replication_config or network_details or odsp_insight_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to db-configuration-params and management-policy and storage-details and replication-config and network-details and odsp-insight-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() kwargs = {} if if_match is not None: @@ -2221,15 +3411,53 @@ def restore_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_int kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['backupId'] = backup_id + _details['kerberosAuthDetails'] = {} - if ad is not None: - _details['ad'] = ad + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if shape is not None: + _details['shape'] = shape + + if instance_ocpu_count is not None: + _details['instanceOcpuCount'] = instance_ocpu_count + + if instance_memory_size_in_gbs is not None: + _details['instanceMemorySizeInGBs'] = instance_memory_size_in_gbs + + if db_configuration_params is not None: + _details['dbConfigurationParams'] = cli_util.parse_json_parameter("db_configuration_params", db_configuration_params) + + if management_policy is not None: + _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + + if storage_details is not None: + _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) + + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if network_details is not None: + _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) + + if odsp_insight_details is not None: + _details['odspInsightDetails'] = cli_util.parse_json_parameter("odsp_insight_details", odsp_insight_details) + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + _details['kerberosAuthDetails']['kind'] = 'DISABLED' client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.restore_db_system( + result = client.update_db_system( db_system_id=db_system_id, - restore_db_system_details=_details, + update_db_system_details=_details, **kwargs ) if wait_for_state: @@ -2262,30 +3490,42 @@ def restore_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_int cli_util.render_response(result, ctx) -@backup_group.command(name=cli_util.override('psql.update_backup.command_name', 'update'), help=u"""Updates the backup. \n[Command Reference](updateBackup)""") -@cli_util.option('--backup-id', required=True, help=u"""A unique identifier for the backup.""") -@cli_util.option('--display-name', help=u"""A user-friendly display name for the backup. Avoid entering confidential information.""") -@cli_util.option('--description', help=u"""A description for the backup.""") -@cli_util.option('--retention-period', type=click.INT, help=u"""Backup retention period in days.""") +@db_system_group.command(name=cli_util.override('psql.update_db_system_enabled_kerberos_auth_details.command_name', 'update-db-system-enabled-kerberos-auth-details'), help=u"""Updates the database system. \n[Command Reference](updateDbSystem)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--kerberos-auth-details-credentials', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Kerberos Credentials to be configured for the dbsystem. Currently supports only one entry.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--display-name', help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A user-provided description of the database system.""") +@cli_util.option('--shape', help=u"""The name of the shape for the database system nodes. Example: `VM.Standard.E4.Flex`""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The total number of OCPUs available to each database system node.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The total amount of memory available to each database system node, in gigabytes.""") +@cli_util.option('--db-configuration-params', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--storage-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--network-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--odsp-insight-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--kerberos-auth-details-backup-credentials', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Optional. List of Kerberos Credentials previously configured for the dbsystem. Currently supports only one entry. + +This option is a JSON list with items of type KerberosCredential. For documentation on KerberosCredential please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/postgresql/20220915/datatypes/KerberosCredential.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "DELETING", "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({'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'kerberos-auth-details-credentials': {'module': 'psql', 'class': 'list[KerberosCredential]'}, 'kerberos-auth-details-backup-credentials': {'module': 'psql', 'class': 'list[KerberosCredential]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'psql', 'class': 'Backup'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'odsp-insight-details': {'module': 'psql', 'class': 'OdspInsightDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'kerberos-auth-details-credentials': {'module': 'psql', 'class': 'list[KerberosCredential]'}, 'kerberos-auth-details-backup-credentials': {'module': 'psql', 'class': 'list[KerberosCredential]'}}) @cli_util.wrap_exceptions -def update_backup(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, backup_id, display_name, description, retention_period, freeform_tags, defined_tags, if_match): +def update_db_system_enabled_kerberos_auth_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, kerberos_auth_details_credentials, display_name, description, shape, instance_ocpu_count, instance_memory_size_in_gbs, db_configuration_params, management_policy, storage_details, replication_config, network_details, odsp_insight_details, freeform_tags, defined_tags, if_match, kerberos_auth_details_backup_credentials): - if isinstance(backup_id, six.string_types) and len(backup_id.strip()) == 0: - raise click.UsageError('Parameter --backup-id cannot be whitespace or empty string') + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-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 db_configuration_params or management_policy or storage_details or replication_config or network_details or odsp_insight_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to db-configuration-params and management-policy and storage-details and replication-config and network-details and odsp-insight-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2294,6 +3534,8 @@ def update_backup(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_ kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} + _details['kerberosAuthDetails'] = {} + _details['kerberosAuthDetails']['credentials'] = cli_util.parse_json_parameter("kerberos_auth_details_credentials", kerberos_auth_details_credentials) if display_name is not None: _details['displayName'] = display_name @@ -2301,8 +3543,32 @@ def update_backup(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_ if description is not None: _details['description'] = description - if retention_period is not None: - _details['retentionPeriod'] = retention_period + if shape is not None: + _details['shape'] = shape + + if instance_ocpu_count is not None: + _details['instanceOcpuCount'] = instance_ocpu_count + + if instance_memory_size_in_gbs is not None: + _details['instanceMemorySizeInGBs'] = instance_memory_size_in_gbs + + if db_configuration_params is not None: + _details['dbConfigurationParams'] = cli_util.parse_json_parameter("db_configuration_params", db_configuration_params) + + if management_policy is not None: + _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + + if storage_details is not None: + _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) + + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if network_details is not None: + _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) + + if odsp_insight_details is not None: + _details['odspInsightDetails'] = cli_util.parse_json_parameter("odsp_insight_details", odsp_insight_details) if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -2310,62 +3576,79 @@ def update_backup(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_ if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + if kerberos_auth_details_backup_credentials is not None: + _details['kerberosAuthDetails']['backupCredentials'] = cli_util.parse_json_parameter("kerberos_auth_details_backup_credentials", kerberos_auth_details_backup_credentials) + + _details['kerberosAuthDetails']['kind'] = 'ENABLED' + client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.update_backup( - backup_id=backup_id, - update_backup_details=_details, + result = client.update_db_system( + db_system_id=db_system_id, + update_db_system_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_backup') and callable(getattr(client, 'get_backup')): + 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_backup(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) -@configuration_group.command(name=cli_util.override('psql.update_configuration.command_name', 'update'), help=u"""Updates a display name or description of the configuration. \n[Command Reference](updateConfiguration)""") -@cli_util.option('--configuration-id', required=True, help=u"""A unique identifier for the configuration.""") -@cli_util.option('--display-name', help=u"""A user-friendly display name for the configuration. Avoid entering confidential information.""") -@cli_util.option('--description', help=u"""Details about the configuration set.""") +@db_system_group.command(name=cli_util.override('psql.update_db_system_disabled_insight_details.command_name', 'update-db-system-disabled-insight-details'), help=u"""Updates the database system. \n[Command Reference](updateDbSystem)""") +@cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--display-name', help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") +@cli_util.option('--description', help=u"""A user-provided description of the database system.""") +@cli_util.option('--shape', help=u"""The name of the shape for the database system nodes. Example: `VM.Standard.E4.Flex`""") +@cli_util.option('--instance-ocpu-count', type=click.INT, help=u"""The total number of OCPUs available to each database system node.""") +@cli_util.option('--instance-memory-size-in-gbs', type=click.INT, help=u"""The total amount of memory available to each database system node, in gigabytes.""") +@cli_util.option('--db-configuration-params', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--storage-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--network-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--kerberos-auth-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--compatible-shapes', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Indicates the collection of compatible shapes for this configuration.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) -@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETING", "DELETED", "FAILED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") -@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") -@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'compatible-shapes': {'module': 'psql', 'class': 'list[string]'}}) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'kerberos-auth-details': {'module': 'psql', 'class': 'KerberosAuthDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', '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': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'compatible-shapes': {'module': 'psql', 'class': 'list[string]'}}, output_type={'module': 'psql', 'class': 'Configuration'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'kerberos-auth-details': {'module': 'psql', 'class': 'KerberosAuthDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_configuration(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, configuration_id, display_name, description, freeform_tags, defined_tags, compatible_shapes, if_match): +def update_db_system_disabled_insight_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, display_name, description, shape, instance_ocpu_count, instance_memory_size_in_gbs, db_configuration_params, management_policy, storage_details, replication_config, network_details, kerberos_auth_details, freeform_tags, defined_tags, if_match): - if isinstance(configuration_id, six.string_types) and len(configuration_id.strip()) == 0: - raise click.UsageError('Parameter --configuration-id cannot be whitespace or empty string') + if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: + raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') if not force: - if freeform_tags or defined_tags or compatible_shapes: - if not click.confirm("WARNING: Updates to freeform-tags and defined-tags and compatible-shapes will replace any existing values. Are you sure you want to continue?"): + if db_configuration_params or management_policy or storage_details or replication_config or network_details or kerberos_auth_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to db-configuration-params and management-policy and storage-details and replication-config and network-details and kerberos-auth-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2374,6 +3657,7 @@ def update_configuration(ctx, from_json, force, wait_for_state, max_wait_seconds kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} + _details['odspInsightDetails'] = {} if display_name is not None: _details['displayName'] = display_name @@ -2381,49 +3665,80 @@ def update_configuration(ctx, from_json, force, wait_for_state, max_wait_seconds if description is not None: _details['description'] = description + if shape is not None: + _details['shape'] = shape + + if instance_ocpu_count is not None: + _details['instanceOcpuCount'] = instance_ocpu_count + + if instance_memory_size_in_gbs is not None: + _details['instanceMemorySizeInGBs'] = instance_memory_size_in_gbs + + if db_configuration_params is not None: + _details['dbConfigurationParams'] = cli_util.parse_json_parameter("db_configuration_params", db_configuration_params) + + if management_policy is not None: + _details['managementPolicy'] = cli_util.parse_json_parameter("management_policy", management_policy) + + if storage_details is not None: + _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) + + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + + if network_details is not None: + _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) + + if kerberos_auth_details is not None: + _details['kerberosAuthDetails'] = cli_util.parse_json_parameter("kerberos_auth_details", kerberos_auth_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) - if compatible_shapes is not None: - _details['compatibleShapes'] = cli_util.parse_json_parameter("compatible_shapes", compatible_shapes) + _details['odspInsightDetails']['kind'] = 'DISABLED' client = cli_util.build_client('psql', 'postgresql', ctx) - result = client.update_configuration( - configuration_id=configuration_id, - update_configuration_details=_details, + result = client.update_db_system( + db_system_id=db_system_id, + update_db_system_details=_details, **kwargs ) if wait_for_state: - if hasattr(client, 'get_configuration') and callable(getattr(client, 'get_configuration')): + 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_configuration(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) -@db_system_group.command(name=cli_util.override('psql.update_db_system.command_name', 'update'), help=u"""Updates the database system. \n[Command Reference](updateDbSystem)""") +@db_system_group.command(name=cli_util.override('psql.update_db_system_enabled_insight_details.command_name', 'update-db-system-enabled-insight-details'), help=u"""Updates the database system. \n[Command Reference](updateDbSystem)""") @cli_util.option('--db-system-id', required=True, help=u"""A unique identifier for the database system.""") +@cli_util.option('--odsp-insight-details-odsp-insight-list', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of ODSP Insight and their configurations.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--display-name', help=u"""A user-friendly display name for the database system. Avoid entering confidential information.""") @cli_util.option('--description', help=u"""A user-provided description of the database system.""") @cli_util.option('--shape', help=u"""The name of the shape for the database system nodes. Example: `VM.Standard.E4.Flex`""") @@ -2432,7 +3747,9 @@ def update_configuration(ctx, from_json, force, wait_for_state, max_wait_seconds @cli_util.option('--db-configuration-params', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--management-policy', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--storage-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--replication-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--network-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--kerberos-auth-details', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @@ -2440,18 +3757,18 @@ def update_configuration(ctx, from_json, force, wait_for_state, max_wait_seconds @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'kerberos-auth-details': {'module': 'psql', 'class': 'KerberosAuthDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'odsp-insight-details-odsp-insight-list': {'module': 'psql', 'class': 'list[OdspInsight]'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'db-configuration-params': {'module': 'psql', 'class': 'UpdateDbConfigParams'}, 'management-policy': {'module': 'psql', 'class': 'ManagementPolicyDetails'}, 'storage-details': {'module': 'psql', 'class': 'UpdateStorageDetailsParams'}, 'replication-config': {'module': 'psql', 'class': 'UpdateReplicationConfigDetails'}, 'network-details': {'module': 'psql', 'class': 'UpdateNetworkDetails'}, 'kerberos-auth-details': {'module': 'psql', 'class': 'KerberosAuthDetails'}, 'freeform-tags': {'module': 'psql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'psql', 'class': 'dict(str, dict(str, object))'}, 'odsp-insight-details-odsp-insight-list': {'module': 'psql', 'class': 'list[OdspInsight]'}}) @cli_util.wrap_exceptions -def update_db_system(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, display_name, description, shape, instance_ocpu_count, instance_memory_size_in_gbs, db_configuration_params, management_policy, storage_details, network_details, freeform_tags, defined_tags, if_match): +def update_db_system_enabled_insight_details(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, odsp_insight_details_odsp_insight_list, display_name, description, shape, instance_ocpu_count, instance_memory_size_in_gbs, db_configuration_params, management_policy, storage_details, replication_config, network_details, kerberos_auth_details, freeform_tags, defined_tags, if_match): if isinstance(db_system_id, six.string_types) and len(db_system_id.strip()) == 0: raise click.UsageError('Parameter --db-system-id cannot be whitespace or empty string') if not force: - if db_configuration_params or management_policy or storage_details or network_details or freeform_tags or defined_tags: - if not click.confirm("WARNING: Updates to db-configuration-params and management-policy and storage-details and network-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + if db_configuration_params or management_policy or storage_details or replication_config or network_details or kerberos_auth_details or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to db-configuration-params and management-policy and storage-details and replication-config and network-details and kerberos-auth-details and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -2460,6 +3777,8 @@ def update_db_system(ctx, from_json, force, wait_for_state, max_wait_seconds, wa kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} + _details['odspInsightDetails'] = {} + _details['odspInsightDetails']['odspInsightList'] = cli_util.parse_json_parameter("odsp_insight_details_odsp_insight_list", odsp_insight_details_odsp_insight_list) if display_name is not None: _details['displayName'] = display_name @@ -2485,15 +3804,23 @@ def update_db_system(ctx, from_json, force, wait_for_state, max_wait_seconds, wa if storage_details is not None: _details['storageDetails'] = cli_util.parse_json_parameter("storage_details", storage_details) + if replication_config is not None: + _details['replicationConfig'] = cli_util.parse_json_parameter("replication_config", replication_config) + if network_details is not None: _details['networkDetails'] = cli_util.parse_json_parameter("network_details", network_details) + if kerberos_auth_details is not None: + _details['kerberosAuthDetails'] = cli_util.parse_json_parameter("kerberos_auth_details", kerberos_auth_details) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) if defined_tags is not None: _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + _details['odspInsightDetails']['kind'] = 'ENABLED' + client = cli_util.build_client('psql', 'postgresql', ctx) result = client.update_db_system( db_system_id=db_system_id, diff --git a/services/psql/tests/util/generated/command_to_api.py b/services/psql/tests/util/generated/command_to_api.py index 14e38a424..35aa71fd1 100644 --- a/services/psql/tests/util/generated/command_to_api.py +++ b/services/psql/tests/util/generated/command_to_api.py @@ -6,6 +6,8 @@ "psql.change_backup_compartment": "oci.psql.PostgresqlClient.change_backup_compartment", "psql.change_configuration_compartment": "oci.psql.PostgresqlClient.change_configuration_compartment", "psql.change_db_system_compartment": "oci.psql.PostgresqlClient.change_db_system_compartment", + "psql.change_role_to_replica": "oci.psql.PostgresqlClient.change_role_to_replica", + "psql.change_role_to_standalone": "oci.psql.PostgresqlClient.change_role_to_standalone", "psql.create_backup": "oci.psql.PostgresqlClient.create_backup", "psql.create_configuration": "oci.psql.PostgresqlClient.create_configuration", "psql.create_db_system": "oci.psql.PostgresqlClient.create_db_system", @@ -22,8 +24,10 @@ "psql.get_work_request": "oci.psql.PostgresqlClient.get_work_request", "psql.list_backups": "oci.psql.PostgresqlClient.list_backups", "psql.list_configurations": "oci.psql.PostgresqlClient.list_configurations", + "psql.list_db_system_replicas": "oci.psql.PostgresqlClient.list_db_system_replicas", "psql.list_db_systems": "oci.psql.PostgresqlClient.list_db_systems", "psql.list_default_configurations": "oci.psql.PostgresqlClient.list_default_configurations", + "psql.list_insight_capabilities": "oci.psql.PostgresqlClient.list_insight_capabilities", "psql.list_shapes": "oci.psql.PostgresqlClient.list_shapes", "psql.list_work_request_errors": "oci.psql.PostgresqlClient.list_work_request_errors", "psql.list_work_request_logs": "oci.psql.PostgresqlClient.list_work_request_logs", @@ -32,6 +36,9 @@ "psql.reset_master_user_password": "oci.psql.PostgresqlClient.reset_master_user_password", "psql.restart_db_instance_in_db_system": "oci.psql.PostgresqlClient.restart_db_instance_in_db_system", "psql.restore_db_system": "oci.psql.PostgresqlClient.restore_db_system", + "psql.start_db_system": "oci.psql.PostgresqlClient.start_db_system", + "psql.stop_db_system": "oci.psql.PostgresqlClient.stop_db_system", + "psql.switch_over": "oci.psql.PostgresqlClient.switch_over", "psql.update_backup": "oci.psql.PostgresqlClient.update_backup", "psql.update_configuration": "oci.psql.PostgresqlClient.update_configuration", "psql.update_db_system": "oci.psql.PostgresqlClient.update_db_system", diff --git a/services/tenant_manager_control_plane/src/oci_cli_link/generated/link_cli.py b/services/tenant_manager_control_plane/src/oci_cli_link/generated/link_cli.py index a4bf6dfcd..804fb3d9a 100644 --- a/services/tenant_manager_control_plane/src/oci_cli_link/generated/link_cli.py +++ b/services/tenant_manager_control_plane/src/oci_cli_link/generated/link_cli.py @@ -28,8 +28,15 @@ def link_group(): pass +@click.command(cli_util.override('link.link_with_tenancy_names_group.command_name', 'link-with-tenancy-names'), cls=CommandGroupWithAlias, help="""A link between a parent tenancy and a child tenancy, including the parent and child tenancy names.""") +@cli_util.help_option_group +def link_with_tenancy_names_group(): + pass + + organizations_service_cli.organizations_service_group.add_command(link_root_group) link_root_group.add_command(link_group) +link_root_group.add_command(link_with_tenancy_names_group) @link_group.command(name=cli_util.override('link.delete_link.command_name', 'delete'), help=u"""Starts the link termination workflow. \n[Command Reference](deleteLink)""") @@ -110,9 +117,32 @@ def get_link(ctx, from_json, link_id): cli_util.render_response(result, ctx) +@link_with_tenancy_names_group.command(name=cli_util.override('link.get_link_with_tenancy_names.command_name', 'get'), help=u"""Gets information about the link along with the parent and child tenancy names. \n[Command Reference](getLinkWithTenancyNames)""") +@cli_util.option('--link-id', required=True, help=u"""OCID of the link to retrieve.""") +@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': 'tenant_manager_control_plane', 'class': 'LinkWithTenancyNames'}) +@cli_util.wrap_exceptions +def get_link_with_tenancy_names(ctx, from_json, link_id): + + if isinstance(link_id, six.string_types) and len(link_id.strip()) == 0: + raise click.UsageError('Parameter --link-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('tenant_manager_control_plane', 'link', ctx) + result = client.get_link_with_tenancy_names( + link_id=link_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @link_group.command(name=cli_util.override('link.list_links.command_name', 'list'), help=u"""Return a (paginated) list of links. \n[Command Reference](listLinks)""") @cli_util.option('--parent-tenancy-id', help=u"""The ID of the parent tenancy this link is associated with.""") @cli_util.option('--child-tenancy-id', help=u"""The ID of the child tenancy this link is associated with.""") +@cli_util.option('--feature', help=u"""The feature associated with this link.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "FAILED", "TERMINATED"]), help=u"""The lifecycle state of the resource.""") @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.""") @@ -124,7 +154,7 @@ def get_link(ctx, from_json, link_id): @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'tenant_manager_control_plane', 'class': 'LinkCollection'}) @cli_util.wrap_exceptions -def list_links(ctx, from_json, all_pages, page_size, parent_tenancy_id, child_tenancy_id, lifecycle_state, page, limit, sort_order): +def list_links(ctx, from_json, all_pages, page_size, parent_tenancy_id, child_tenancy_id, feature, lifecycle_state, page, limit, sort_order): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') @@ -134,6 +164,8 @@ def list_links(ctx, from_json, all_pages, page_size, parent_tenancy_id, child_te kwargs['parent_tenancy_id'] = parent_tenancy_id if child_tenancy_id is not None: kwargs['child_tenancy_id'] = child_tenancy_id + if feature is not None: + kwargs['feature'] = feature if lifecycle_state is not None: kwargs['lifecycle_state'] = lifecycle_state if page is not None: diff --git a/services/tenant_manager_control_plane/src/oci_cli_link_features/__init__.py b/services/tenant_manager_control_plane/src/oci_cli_link_features/__init__.py new file mode 100644 index 000000000..dd9420bc5 --- /dev/null +++ b/services/tenant_manager_control_plane/src/oci_cli_link_features/__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: 20230401 diff --git a/services/tenant_manager_control_plane/src/oci_cli_link_features/generated/__init__.py b/services/tenant_manager_control_plane/src/oci_cli_link_features/generated/__init__.py new file mode 100644 index 000000000..dd9420bc5 --- /dev/null +++ b/services/tenant_manager_control_plane/src/oci_cli_link_features/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: 20230401 diff --git a/services/tenant_manager_control_plane/src/oci_cli_link_features/generated/client_mappings.py b/services/tenant_manager_control_plane/src/oci_cli_link_features/generated/client_mappings.py new file mode 100644 index 000000000..0411037a4 --- /dev/null +++ b/services/tenant_manager_control_plane/src/oci_cli_link_features/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: 20230401 + +import oci +from oci_cli.cli_clients import CLIENT_MAP +from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS +from oci.tenant_manager_control_plane import LinkFeaturesClient + +MODULE_TO_TYPE_MAPPINGS["tenant_manager_control_plane"] = oci.tenant_manager_control_plane.models.tenant_manager_control_plane_type_mapping +if CLIENT_MAP.get("tenant_manager_control_plane") is None: + CLIENT_MAP["tenant_manager_control_plane"] = {} +CLIENT_MAP["tenant_manager_control_plane"]["link_features"] = LinkFeaturesClient diff --git a/services/tenant_manager_control_plane/src/oci_cli_link_features/generated/linkfeatures_cli.py b/services/tenant_manager_control_plane/src/oci_cli_link_features/generated/linkfeatures_cli.py new file mode 100644 index 000000000..c7f45187e --- /dev/null +++ b/services/tenant_manager_control_plane/src/oci_cli_link_features/generated/linkfeatures_cli.py @@ -0,0 +1,52 @@ +# 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: 20230401 + +from __future__ import print_function +import click +import oci # noqa: F401 +import six # noqa: F401 +import sys # noqa: F401 +from oci_cli import cli_constants # noqa: F401 +from oci_cli import cli_util +from oci_cli import json_skeleton_utils +from oci_cli import custom_types # noqa: F401 +from oci_cli.aliasing import CommandGroupWithAlias +from services.tenant_manager_control_plane.src.oci_cli_tenant_manager_control_plane.generated import organizations_service_cli + + +@click.command(cli_util.override('link_features.link_features_root_group.command_name', 'link-features'), cls=CommandGroupWithAlias, help=cli_util.override('link_features.link_features_root_group.help', """Use the Organizations API to consolidate multiple OCI tenancies into an organization, and centrally manage your tenancies and organization resources. For more information, see [Organization Management Overview]."""), short_help=cli_util.override('link_features.link_features_root_group.short_help', """Organizations API""")) +@cli_util.help_option_group +def link_features_root_group(): + pass + + +@click.command(cli_util.override('link_features.link_features_collection_group.command_name', 'link-features-collection'), cls=CommandGroupWithAlias, help="""Result of a query request for a list of link features. Contains LinkFeature items.""") +@cli_util.help_option_group +def link_features_collection_group(): + pass + + +organizations_service_cli.organizations_service_group.add_command(link_features_root_group) +link_features_root_group.add_command(link_features_collection_group) + + +@link_features_collection_group.command(name=cli_util.override('link_features.list_link_features.command_name', 'list-link-features'), help=u"""Return a list of link features. \n[Command Reference](listLinkFeatures)""") +@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@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': 'tenant_manager_control_plane', 'class': 'LinkFeaturesCollection'}) +@cli_util.wrap_exceptions +def list_link_features(ctx, from_json, all_pages, compartment_id): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('tenant_manager_control_plane', 'link_features', ctx) + result = client.list_link_features( + compartment_id=compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) diff --git a/services/tenant_manager_control_plane/src/oci_cli_organization/generated/organization_cli.py b/services/tenant_manager_control_plane/src/oci_cli_organization/generated/organization_cli.py index 7e8f3ee83..c60f26f55 100644 --- a/services/tenant_manager_control_plane/src/oci_cli_organization/generated/organization_cli.py +++ b/services/tenant_manager_control_plane/src/oci_cli_organization/generated/organization_cli.py @@ -81,15 +81,16 @@ def approve_organization_tenancy_for_transfer(ctx, from_json, compartment_id, or @cli_util.option('--policy-name', help=u"""The name to use for the administrator policy in the child tenancy. Must contain only letters and underscores.""") @cli_util.option('--governance-status', type=custom_types.CliCaseInsensitiveChoice(["OPTED_IN", "OPTED_OUT"]), help=u"""The governance status of the child tenancy.""") @cli_util.option('--subscription-id', help=u"""OCID of the subscription that needs to be assigned to the child tenancy.""") +@cli_util.option('--features', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of features that the child and parent tenancies will have links for. Link with feature CORE will always be created.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({}) +@json_skeleton_utils.get_cli_json_input_option({'features': {'module': 'tenant_manager_control_plane', 'class': 'list[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={'features': {'module': 'tenant_manager_control_plane', 'class': 'list[string]'}}) @cli_util.wrap_exceptions -def create_child_tenancy(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, tenancy_name, home_region, admin_email, policy_name, governance_status, subscription_id): +def create_child_tenancy(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, tenancy_name, home_region, admin_email, policy_name, governance_status, subscription_id, features): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -109,6 +110,9 @@ def create_child_tenancy(ctx, from_json, wait_for_state, max_wait_seconds, wait_ if subscription_id is not None: _details['subscriptionId'] = subscription_id + if features is not None: + _details['features'] = cli_util.parse_json_parameter("features", features) + client = cli_util.build_client('tenant_manager_control_plane', 'organization', ctx) result = client.create_child_tenancy( create_child_tenancy_details=_details, diff --git a/services/tenant_manager_control_plane/src/oci_cli_sender_invitation/generated/senderinvitation_cli.py b/services/tenant_manager_control_plane/src/oci_cli_sender_invitation/generated/senderinvitation_cli.py index 321e019d6..3181f6000 100644 --- a/services/tenant_manager_control_plane/src/oci_cli_sender_invitation/generated/senderinvitation_cli.py +++ b/services/tenant_manager_control_plane/src/oci_cli_sender_invitation/generated/senderinvitation_cli.py @@ -95,17 +95,18 @@ def cancel_sender_invitation(ctx, from_json, wait_for_state, max_wait_seconds, w @cli_util.option('--subjects', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of subjects this invitation contains. This option is a JSON list with items of type InvitationSubject. For documentation on InvitationSubject please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/senderinvitation/20230401/datatypes/InvitationSubject.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--features', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of features that the invitation is being sent for. Each feature would create one link, of that type.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") -@json_skeleton_utils.get_cli_json_input_option({'subjects': {'module': 'tenant_manager_control_plane', 'class': 'list[InvitationSubject]'}, 'freeform-tags': {'module': 'tenant_manager_control_plane', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'tenant_manager_control_plane', 'class': 'dict(str, dict(str, object))'}}) +@json_skeleton_utils.get_cli_json_input_option({'subjects': {'module': 'tenant_manager_control_plane', 'class': 'list[InvitationSubject]'}, 'features': {'module': 'tenant_manager_control_plane', 'class': 'list[string]'}, 'freeform-tags': {'module': 'tenant_manager_control_plane', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'tenant_manager_control_plane', '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={'subjects': {'module': 'tenant_manager_control_plane', 'class': 'list[InvitationSubject]'}, 'freeform-tags': {'module': 'tenant_manager_control_plane', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'tenant_manager_control_plane', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'tenant_manager_control_plane', 'class': 'SenderInvitation'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'subjects': {'module': 'tenant_manager_control_plane', 'class': 'list[InvitationSubject]'}, 'features': {'module': 'tenant_manager_control_plane', 'class': 'list[string]'}, 'freeform-tags': {'module': 'tenant_manager_control_plane', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'tenant_manager_control_plane', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'tenant_manager_control_plane', 'class': 'SenderInvitation'}) @cli_util.wrap_exceptions -def create_sender_invitation(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, recipient_tenancy_id, recipient_email_address, display_name, subjects, freeform_tags, defined_tags): +def create_sender_invitation(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, recipient_tenancy_id, recipient_email_address, display_name, subjects, features, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -123,6 +124,9 @@ def create_sender_invitation(ctx, from_json, wait_for_state, max_wait_seconds, w if subjects is not None: _details['subjects'] = cli_util.parse_json_parameter("subjects", subjects) + if features is not None: + _details['features'] = cli_util.parse_json_parameter("features", features) + if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) @@ -190,7 +194,7 @@ def get_sender_invitation(ctx, from_json, sender_invitation_id): @cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") @cli_util.option('--recipient-tenancy-id', help=u"""The tenancy that the invitation is addressed to.""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "INACTIVE", "UPDATING", "FAILED", "TERMINATED"]), help=u"""The lifecycle state of the resource.""") -@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["PENDING", "CANCELED", "ACCEPTED", "EXPIRED", "FAILED"]), help=u"""The status of the sender invitation.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["PENDING", "CANCELED", "ACCEPTED", "EXPIRED", "FAILED", "NOT_APPLICABLE"]), help=u"""The status of the sender invitation.""") @cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") @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.""") diff --git a/setup.py b/setup.py index a3e73d26b..3009136ca 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def open_relative(*path): readme = f.read() requires = [ - 'oci==2.178.0', + 'oci==2.179.0', 'arrow>=1.0.0,<2.0.0', 'certifi>=2025.1.31,<2026.0.0', 'click<=8.1.2', diff --git a/src/oci_cli/service_mapping.py b/src/oci_cli/service_mapping.py index 63ac9e7a3..605f89785 100644 --- a/src/oci_cli/service_mapping.py +++ b/src/oci_cli/service_mapping.py @@ -615,7 +615,7 @@ ], "opctl": [ "operator_access_control", - "OperatorAccessControl", + "Operator Access Control", "Oracle Database" ], "opensearch": [ diff --git a/src/oci_cli/version.py b/src/oci_cli/version.py index 0cd60f0c3..87dd12b2d 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.86.0' +__version__ = '3.87.0' diff --git a/tests/test_config_container.py b/tests/test_config_container.py index 14f08de50..667e87df8 100644 --- a/tests/test_config_container.py +++ b/tests/test_config_container.py @@ -13,6 +13,7 @@ import oci import os import six +import urllib.parse import vcr from vcr.persisters.filesystem import FilesystemPersister @@ -38,11 +39,15 @@ def using_vcr_with_mock_responses(): def create_vcr(**kwargs): location = kwargs.get('cassette_library_dir', 'tests/fixtures/cassettes') + custom_patches = tuple(kwargs.get('custom_patches') or ()) + custom_patches += vcr_mods.get_object_storage_work_pool_vcr_patches() + vcr_to_use = vcr.VCR( serializer='yaml', cassette_library_dir=location, record_mode=vcr_mode, - decode_compressed_response=True + decode_compressed_response=True, + custom_patches=custom_patches ) # by default, only match keys in JSON request bodies @@ -164,7 +169,40 @@ def vcr_query_matcher(r1, r2): # Note: 'path' is one of the properties in vcr.Request object. It contains the path of the http request. # For example “/” or “/home.html” # OUTPUT: boolean value indicating if the paths in requests r1 and r2 match. +def _fully_unquote(value, rounds=5): + if value is None: + return '' + current = value + for _ in range(rounds): + decoded = urllib.parse.unquote(current) + if decoded == current: + break + current = decoded + return current + + def vcr_path_matcher(r1, r2): + def split_path(path): + return [seg for seg in (path or '').rstrip('/').split('/') if seg] + + def find_object_storage_object_marker(segments): + for index, segment in enumerate(segments): + if segment != 'o': + continue + if index >= 4 and segments[index - 4] == 'n' and segments[index - 2] == 'b': + return index + return None + + def normalize_object_storage_object_name(segments): + # Keep route segment boundaries intact. Only Object Storage object names can + # contain `/` as data, so `%2F` normalization is limited to the tail after `/o/`. + object_marker_index = find_object_storage_object_marker(segments) + if object_marker_index is None or object_marker_index == len(segments) - 1: + return segments + + object_name = _fully_unquote('/'.join(segments[object_marker_index + 1:])) + return segments[:object_marker_index + 1] + [object_name] + path_ignore_strings = [ 'ocid1.compartment', 'ocid1.tenancy', @@ -172,29 +210,19 @@ def vcr_path_matcher(r1, r2): 'ocid1.tagnamespace' ] - r1_path = r1.path.split('/') - r2_path = r2.path.split('/') - if r2_path[-1] == '': - r2_path.pop() - - r1_updated_path = list(r1_path) - r2_updated_path = list(r2_path) - if r2_updated_path[-1] == '': - r2_updated_path.pop() + r1_path = normalize_object_storage_object_name(split_path(r1.path)) + r2_path = normalize_object_storage_object_name(split_path(r2.path)) if len(r1_path) != len(r2_path): return False + r1_updated_path = [] + r2_updated_path = [] for s1, s2 in zip(r1_path, r2_path): - for s in path_ignore_strings: - if s in s1 and s in s2: - r1_updated_path.remove(s1) - r2_updated_path.remove(s2) - - while '' in r1_updated_path: - r1_updated_path.remove('') - while '' in r2_updated_path: - r2_updated_path.remove('') + if any(ignored in s1 and ignored in s2 for ignored in path_ignore_strings): + continue + r1_updated_path.append(s1) + r2_updated_path.append(s2) return r1_updated_path == r2_updated_path diff --git a/tests/vcr_mods/__init__.py b/tests/vcr_mods/__init__.py index c1fcda872..6172cb71f 100644 --- a/tests/vcr_mods/__init__.py +++ b/tests/vcr_mods/__init__.py @@ -9,6 +9,7 @@ from . import stubs import itertools +import logging import vcr from urllib3 import connectionpool @@ -23,6 +24,8 @@ from packaging import version +logger = logging.getLogger(__name__) + try: # Modern urllib3 (2.0+) from urllib3.connection import HTTPSConnection @@ -44,6 +47,64 @@ original_cassette_patcher_builder_build_ref = vcr.patch.CassettePatcherBuilder.build +def get_object_storage_work_pool_vcr_patches(): + """ + When using mocked VCR responses, Object Storage bulk operations submit work to a thread pool. + In some environments VCR patching does not reliably intercept requests made from those worker + threads, which can cause real network calls in record_mode=none and lead to failures like + BucketNotFound (because bucket creation is replayed, but PUTs hit the real service). + + To keep tests deterministic, execute work pool tasks synchronously while a VCR cassette is active + and VCR is mocking. + """ + try: + from tests import test_config_container + from oci_cli_object_storage.object_storage_transfer_manager import work_pool as os_work_pool + except ImportError as exc: + missing_module = getattr(exc, 'name', '') + if missing_module and missing_module.startswith('oci_cli_object_storage'): + return () + logger.exception("Unable to import Object Storage work pool for VCR patching.") + raise + except Exception: + logger.exception("Unable to prepare Object Storage work pool VCR patch.") + raise + + if not hasattr(os_work_pool, 'WorkPool') or not hasattr(os_work_pool, 'WorkPoolFuture'): + message = "Object Storage work pool module does not expose WorkPool and WorkPoolFuture." + logger.error(message) + raise AttributeError(message) + + original_submit = os_work_pool.WorkPool.submit + + class _ImmediateAsyncResult: + def __init__(self, thunk): + self._success = True + try: + self._value = thunk() + except Exception as exc: + self._success = False + self._value = exc + + def get(self): + if self._success: + return self._value + raise self._value + + def ready(self): + return True + + def successful(self): + return self._success + + def submit(self, work_pool_task, blocking=True): + if test_config_container.using_vcr_with_mock_responses(): + return os_work_pool.WorkPoolFuture(_ImmediateAsyncResult(work_pool_task.do_work)) + return original_submit(self, work_pool_task, blocking=blocking) + + return ((os_work_pool.WorkPool, 'submit', submit),) + + def _revised_vcr_reset_patchers(): for patcher in original_vcr_reset_patchers_ref(): yield patcher