From 308708781e4f50ad9cba10f3de797fb995c8f4ee Mon Sep 17 00:00:00 2001 From: OCI DEX Release Bot Automation Date: Tue, 20 Aug 2024 10:30:35 +0000 Subject: [PATCH] Releasing version 3.46.0 Co-authored-by: Harsh Kumar --- CHANGELOG.rst | 70 + requirements.txt | 11 +- .../generated/analytics_cli.py | 111 +- .../tests/util/generated/command_to_api.py | 1 + .../generated/database_cli.py | 12 +- .../generated/dbmanagement_cli.py | 1062 +++++++- .../generated/disasterrecovery_cli.py | 5 +- services/fleet_apps_management/__init__.py | 4 + .../fleet_apps_management/src/__init__.py | 4 + .../oci_cli_fleet_apps_management/__init__.py | 4 + .../generated/__init__.py | 4 + .../generated/client_mappings.py | 14 + .../fleet_apps_management_service_cli.py | 15 + .../generated/fleetappsmanagement_cli.py | 2208 +++++++++++++++++ .../__init__.py | 4 + .../generated/__init__.py | 4 + .../generated/client_mappings.py | 14 + .../generated/fleetappsmanagementadmin_cli.py | 523 ++++ .../__init__.py | 4 + .../generated/__init__.py | 4 + .../generated/client_mappings.py | 14 + ...leetappsmanagementmaintenancewindow_cli.py | 383 +++ .../__init__.py | 4 + .../generated/__init__.py | 4 + .../generated/client_mappings.py | 14 + .../fleetappsmanagementoperations_cli.py | 871 +++++++ .../__init__.py | 4 + .../generated/__init__.py | 4 + .../generated/client_mappings.py | 14 + .../fleetappsmanagementrunbooks_cli.py | 240 ++ .../fleet_apps_management/tests/__init__.py | 4 + .../tests/util/generated/command_to_api.py | 9 + .../generated/integrationinstance_cli.py | 63 +- .../tests/util/generated/command_to_api.py | 1 + .../generated/dbsystem_cli.py | 64 +- .../generated/rediscluster_cli.py | 131 +- .../tests/util/generated/command_to_api.py | 1 + setup.py | 2 +- src/oci_cli/service_mapping.py | 7 +- src/oci_cli/version.py | 2 +- 40 files changed, 5773 insertions(+), 141 deletions(-) create mode 100644 services/fleet_apps_management/__init__.py create mode 100644 services/fleet_apps_management/src/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/client_mappings.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/fleet_apps_management_service_cli.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/fleetappsmanagement_cli.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/client_mappings.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/fleetappsmanagementadmin_cli.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/client_mappings.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/fleetappsmanagementmaintenancewindow_cli.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/client_mappings.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/fleetappsmanagementoperations_cli.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/__init__.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/client_mappings.py create mode 100644 services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/fleetappsmanagementrunbooks_cli.py create mode 100644 services/fleet_apps_management/tests/__init__.py create mode 100644 services/fleet_apps_management/tests/util/generated/command_to_api.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index aece6a0c8..88c337561 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,76 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__. +3.46.0 - 2024-08-20 +-------------------- +Removed +~~~~~ +* [BREAKING] Disaster Recovery service + + * Removed optional parameter --dr-plan-execution-type from list command + + * ``oci disaster-recovery dr-plan-execution list`` + +Added +~~~~~ +* Database Service + + * Support for creating Maintenance Run Using Autonomous Database Software Image in the Database service + + * ``oci db maintenance-run create --database-software-image-id`` + +* Fleet Application Management Service + + * Support for the Fleet Application Management service + + * ``oci fleet-apps-management`` + +* Redis Service + + * Support for list cluster nodes command in the OCI Cache service + + * ``oci redis node-summary list-redis-cluster-nodes`` + + * Support new parameters cluster-mode and shard-count for sharding + + * ``oci redis redis-cluster create --cluster-mode, --shard-count`` + * ``oci redis redis-cluster update --shard-count`` + +* Integration Service + + * Support for Extend Data Retention Period for OIC Instance + + * ``oci integration integration-instance extend-data-retention --data-retention-period, --integration-instance-id`` + +* Analytics Service + + * Support for Identity Domains + + * ``oci analytics analytics-instance create --domain-id ocid --admin-user user`` + + * Support for feature set in analytics-instance + + * ``oci analytics analytics-instance create --feature-bundle feature_set`` + +* Database Management Service + + * Support for SQL Watch and DB Lifecycle Management + + * ``oci database-management managed-database enable-external-container-database-management-feature`` + * ``oci database-management managed-database enable-external-pluggable-database-management-feature`` + * ``oci database-management managed-database enable-external-non-container-database-management-feature`` + * ``oci database-management managed-database modify-database-management-feature`` + * ``oci database-management managed-database modify-pluggable-database-management-feature`` + +* Mysql Database Service + + * Support for automatically increasing storage in the MySQL Database service + + * ``oci mysql db-system clone --is-auto-expand-storage-enabled --max-storage-size-in-gbs`` + * ``oci mysql db-system create --is-auto-expand-storage-enabled --max-storage-size-in-gbs`` + * ``oci mysql db-system import --is-auto-expand-storage-enabled --max-storage-size-in-gbs`` + * ``oci mysql db-system update --is-auto-expand-storage-enabled --max-storage-size-in-gbs`` + 3.45.2 - 2024-08-13 -------------------- Added diff --git a/requirements.txt b/requirements.txt index bb1d6dcfb..44e3bfac6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,11 +10,12 @@ click==8.0.4 coverage==4.5.2 cryptography>=3.2.1,<43.0.0 httpsig-cffi==15.0.0 -Jinja2==3.0.3 +Jinja2==3.0.3; python_version == '3.6' +Jinja2>=3.1.4; python_version >= '3.7' jmespath==0.10.0 ndg-httpsclient==0.4.2 mock==2.0.0 -oci==2.131.1 +oci==2.132.0 packaging==20.2 pluggy==0.13.0 py==1.11.0 @@ -28,7 +29,8 @@ pytest-cov==2.5.1 python-dateutil>=2.5.3,<3.0.0 pytz>=2016.10 requests==2.21.0; python_version == '3.6' -requests==2.31.0; python_version > '3.6' +requests==2.31.0; python_version == '3.7' +requests>=2.32.0; python_version > '3.7' six>=1.15.0 sphinx==3.3.0 sphinx-rtd-theme==0.4.3 @@ -43,7 +45,8 @@ PyYAML>=5.4,<=6.0.1 docutils==0.15.2 prompt-toolkit==3.0.29; python_version == '3.6' prompt-toolkit>=3.0.38,<=3.0.43; python_version > '3.6' -setuptools>65.5.1; python_version > '3.6' +setuptools>70.0.0; python_version > '3.7' +setuptools==68.0.0; python_version == '3.7' setuptools==59.6.0; python_version == '3.6' # this is required because of python 3.6 requests dependency version bound urllib3<=1.26.15 diff --git a/services/analytics/src/oci_cli_analytics/generated/analytics_cli.py b/services/analytics/src/oci_cli_analytics/generated/analytics_cli.py index b762d00e2..676f81101 100644 --- a/services/analytics/src/oci_cli_analytics/generated/analytics_cli.py +++ b/services/analytics/src/oci_cli_analytics/generated/analytics_cli.py @@ -336,7 +336,10 @@ def change_analytics_instance_network_endpoint_public_endpoint_details(ctx, from @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('--kms-key-id', help=u"""The [OCID] of the OCI Vault Key encrypting the customer data stored in this Analytics instance. A null value indicates Oracle managed default encryption.""") +@cli_util.option('--kms-key-id', help=u"""OCID of the OCI Vault Key encrypting the customer data stored in this Analytics instance. A null value indicates Oracle managed default encryption.""") +@cli_util.option('--domain-id', help=u"""domain id for which the user is authorized.""") +@cli_util.option('--admin-user', help=u"""user name of the authorized user.""") +@cli_util.option('--feature-bundle', type=custom_types.CliCaseInsensitiveChoice(["FAW_PAID", "FAW_FREE", "EE_EMBEDDED", "SE_EMBEDDED"]), help=u"""The feature set of an Analytics instance.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -345,7 +348,7 @@ def change_analytics_instance_network_endpoint_public_endpoint_details(ctx, from @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'capacity': {'module': 'analytics', 'class': 'Capacity'}, 'network-endpoint-details': {'module': 'analytics', 'class': 'NetworkEndpointDetails'}, 'defined-tags': {'module': 'analytics', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'analytics', 'class': 'dict(str, string)'}}, output_type={'module': 'analytics', 'class': 'AnalyticsInstance'}) @cli_util.wrap_exceptions -def create_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, name, compartment_id, feature_set, capacity, license_type, description, email_notification, network_endpoint_details, idcs_access_token, defined_tags, freeform_tags, kms_key_id): +def create_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, name, compartment_id, feature_set, capacity, license_type, description, email_notification, network_endpoint_details, idcs_access_token, defined_tags, freeform_tags, kms_key_id, domain_id, admin_user, feature_bundle): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -378,6 +381,15 @@ def create_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, if kms_key_id is not None: _details['kmsKeyId'] = kms_key_id + if domain_id is not None: + _details['domainId'] = domain_id + + if admin_user is not None: + _details['adminUser'] = admin_user + + if feature_bundle is not None: + _details['featureBundle'] = feature_bundle + client = cli_util.build_client('analytics', 'analytics', ctx) result = client.create_analytics_instance( create_analytics_instance_details=_details, @@ -430,7 +442,10 @@ def create_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, @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('--kms-key-id', help=u"""The [OCID] of the OCI Vault Key encrypting the customer data stored in this Analytics instance. A null value indicates Oracle managed default encryption.""") +@cli_util.option('--kms-key-id', help=u"""OCID of the OCI Vault Key encrypting the customer data stored in this Analytics instance. A null value indicates Oracle managed default encryption.""") +@cli_util.option('--domain-id', help=u"""domain id for which the user is authorized.""") +@cli_util.option('--admin-user', help=u"""user name of the authorized user.""") +@cli_util.option('--feature-bundle', type=custom_types.CliCaseInsensitiveChoice(["FAW_PAID", "FAW_FREE", "EE_EMBEDDED", "SE_EMBEDDED"]), help=u"""The feature set of an Analytics instance.""") @cli_util.option('--network-endpoint-details-network-security-group-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Network Security Group OCIDs for an Analytics instance.""" + 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 SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -440,7 +455,7 @@ def create_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'capacity': {'module': 'analytics', 'class': 'Capacity'}, 'defined-tags': {'module': 'analytics', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'analytics', 'class': 'dict(str, string)'}, 'network-endpoint-details-network-security-group-ids': {'module': 'analytics', 'class': 'list[string]'}}, output_type={'module': 'analytics', 'class': 'AnalyticsInstance'}) @cli_util.wrap_exceptions -def create_analytics_instance_private_endpoint_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, name, compartment_id, feature_set, capacity, license_type, network_endpoint_details_vcn_id, network_endpoint_details_subnet_id, description, email_notification, idcs_access_token, defined_tags, freeform_tags, kms_key_id, network_endpoint_details_network_security_group_ids): +def create_analytics_instance_private_endpoint_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, name, compartment_id, feature_set, capacity, license_type, network_endpoint_details_vcn_id, network_endpoint_details_subnet_id, description, email_notification, idcs_access_token, defined_tags, freeform_tags, kms_key_id, domain_id, admin_user, feature_bundle, network_endpoint_details_network_security_group_ids): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -473,6 +488,15 @@ def create_analytics_instance_private_endpoint_details(ctx, from_json, wait_for_ if kms_key_id is not None: _details['kmsKeyId'] = kms_key_id + if domain_id is not None: + _details['domainId'] = domain_id + + if admin_user is not None: + _details['adminUser'] = admin_user + + if feature_bundle is not None: + _details['featureBundle'] = feature_bundle + if network_endpoint_details_network_security_group_ids is not None: _details['networkEndpointDetails']['networkSecurityGroupIds'] = cli_util.parse_json_parameter("network_endpoint_details_network_security_group_ids", network_endpoint_details_network_security_group_ids) @@ -528,7 +552,10 @@ def create_analytics_instance_private_endpoint_details(ctx, from_json, wait_for_ @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('--kms-key-id', help=u"""The [OCID] of the OCI Vault Key encrypting the customer data stored in this Analytics instance. A null value indicates Oracle managed default encryption.""") +@cli_util.option('--kms-key-id', help=u"""OCID of the OCI Vault Key encrypting the customer data stored in this Analytics instance. A null value indicates Oracle managed default encryption.""") +@cli_util.option('--domain-id', help=u"""domain id for which the user is authorized.""") +@cli_util.option('--admin-user', help=u"""user name of the authorized user.""") +@cli_util.option('--feature-bundle', type=custom_types.CliCaseInsensitiveChoice(["FAW_PAID", "FAW_FREE", "EE_EMBEDDED", "SE_EMBEDDED"]), help=u"""The feature set of an Analytics instance.""") @cli_util.option('--network-endpoint-details-whitelisted-ips', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Source IP addresses or IP address ranges in ingress rules.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--network-endpoint-details-whitelisted-vcns', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Virtual Cloud Networks allowed to access this network endpoint. @@ -542,7 +569,7 @@ def create_analytics_instance_private_endpoint_details(ctx, from_json, wait_for_ @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'capacity': {'module': 'analytics', 'class': 'Capacity'}, 'defined-tags': {'module': 'analytics', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'analytics', 'class': 'dict(str, string)'}, 'network-endpoint-details-whitelisted-ips': {'module': 'analytics', 'class': 'list[string]'}, 'network-endpoint-details-whitelisted-vcns': {'module': 'analytics', 'class': 'list[VirtualCloudNetwork]'}}, output_type={'module': 'analytics', 'class': 'AnalyticsInstance'}) @cli_util.wrap_exceptions -def create_analytics_instance_public_endpoint_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, name, compartment_id, feature_set, capacity, license_type, description, email_notification, idcs_access_token, defined_tags, freeform_tags, kms_key_id, network_endpoint_details_whitelisted_ips, network_endpoint_details_whitelisted_vcns, network_endpoint_details_whitelisted_services): +def create_analytics_instance_public_endpoint_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, name, compartment_id, feature_set, capacity, license_type, description, email_notification, idcs_access_token, defined_tags, freeform_tags, kms_key_id, domain_id, admin_user, feature_bundle, network_endpoint_details_whitelisted_ips, network_endpoint_details_whitelisted_vcns, network_endpoint_details_whitelisted_services): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -573,6 +600,15 @@ def create_analytics_instance_public_endpoint_details(ctx, from_json, wait_for_s if kms_key_id is not None: _details['kmsKeyId'] = kms_key_id + if domain_id is not None: + _details['domainId'] = domain_id + + if admin_user is not None: + _details['adminUser'] = admin_user + + if feature_bundle is not None: + _details['featureBundle'] = feature_bundle + if network_endpoint_details_whitelisted_ips is not None: _details['networkEndpointDetails']['whitelistedIps'] = cli_util.parse_json_parameter("network_endpoint_details_whitelisted_ips", network_endpoint_details_whitelisted_ips) @@ -1340,6 +1376,69 @@ def scale_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, w cli_util.render_response(result, ctx) +@analytics_instance_group.command(name=cli_util.override('analytics.set_feature_bundle.command_name', 'set-feature-bundle'), help=u"""Set the external service properties of an Analytics instance. \n[Command Reference](setFeatureBundle)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@cli_util.option('--feature-bundle', type=custom_types.CliCaseInsensitiveChoice(["FAW_PAID", "FAW_FREE", "EE_EMBEDDED", "SE_EMBEDDED"]), help=u"""The feature set of an Analytics 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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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 set_feature_bundle(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, analytics_instance_id, feature_bundle, if_match): + + if isinstance(analytics_instance_id, six.string_types) and len(analytics_instance_id.strip()) == 0: + raise click.UsageError('Parameter --analytics-instance-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if feature_bundle is not None: + _details['featureBundle'] = feature_bundle + + client = cli_util.build_client('analytics', 'analytics', ctx) + result = client.set_feature_bundle( + analytics_instance_id=analytics_instance_id, + set_feature_bundle_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) + + @analytics_instance_group.command(name=cli_util.override('analytics.set_kms_key.command_name', 'set-kms-key'), help=u"""Encrypts the customer data of this Analytics instance using either a customer OCI Vault Key or Oracle managed default key. \n[Command Reference](setKmsKey)""") @cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") @cli_util.option('--kms-key-id', required=True, help=u"""OCID of the OCI Vault Key encrypting the customer data stored in this Analytics instance. An empty value indicates Oracle managed default encryption (null is not supported in this API).""") diff --git a/services/analytics/tests/util/generated/command_to_api.py b/services/analytics/tests/util/generated/command_to_api.py index 0d9fcb25b..f6d9b3a84 100644 --- a/services/analytics/tests/util/generated/command_to_api.py +++ b/services/analytics/tests/util/generated/command_to_api.py @@ -19,6 +19,7 @@ "analytics.list_work_request_logs": "oci.analytics.AnalyticsClient.list_work_request_logs", "analytics.list_work_requests": "oci.analytics.AnalyticsClient.list_work_requests", "analytics.scale_analytics_instance": "oci.analytics.AnalyticsClient.scale_analytics_instance", + "analytics.set_feature_bundle": "oci.analytics.AnalyticsClient.set_feature_bundle", "analytics.set_kms_key": "oci.analytics.AnalyticsClient.set_kms_key", "analytics.start_analytics_instance": "oci.analytics.AnalyticsClient.start_analytics_instance", "analytics.stop_analytics_instance": "oci.analytics.AnalyticsClient.stop_analytics_instance", 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 36e138e85..5819a6c0f 100644 --- a/services/database/src/oci_cli_database/generated/database_cli.py +++ b/services/database/src/oci_cli_database/generated/database_cli.py @@ -9641,12 +9641,13 @@ def create_key_store_key_store_type_from_oracle_key_vault_details(ctx, from_json @maintenance_run_group.command(name=cli_util.override('db.create_maintenance_run.command_name', 'create'), help=u"""Creates a maintenance run with one of the following: 1. The latest available release update patch (RUP) for the Autonomous Container Database. 2. The latest available RUP and DST time-zone (TZ) file updates for the Autonomous Container Database. 3. The DST TZ file updates for the Autonomous Container Database. \n[Command Reference](createMaintenanceRun)""") @cli_util.option('--target-resource-id', required=True, help=u"""The ID of the target resource for which the maintenance run should be created.""") @cli_util.option('--time-scheduled', required=True, type=custom_types.CLI_DATETIME, help=u"""The date and time that update should be scheduled.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) -@cli_util.option('--patch-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["QUARTERLY", "TIMEZONE"]), help=u"""Patch type, either \"QUARTERLY\" or \"TIMEZONE\".""") +@cli_util.option('--patch-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["QUARTERLY", "TIMEZONE", "CUSTOM_DATABASE_SOFTWARE_IMAGE"]), help=u"""Patch type, either \"QUARTERLY\", \"TIMEZONE\" or \"CUSTOM_DATABASE_SOFTWARE_IMAGE\".""") @cli_util.option('--is-dst-file-update-enabled', type=click.BOOL, help=u"""Indicates if an automatic DST Time Zone file update is enabled for the Autonomous Container Database. If enabled along with Release Update, patching will be done in a Non-Rolling manner.""") @cli_util.option('--patching-mode', type=custom_types.CliCaseInsensitiveChoice(["ROLLING", "NONROLLING"]), help=u"""Cloud Exadata infrastructure node patching method, either \"ROLLING\" or \"NONROLLING\". Default value is ROLLING. *IMPORTANT*: Non-rolling infrastructure patching involves system down time. See [Oracle-Managed Infrastructure Maintenance Updates] for more information.""") @cli_util.option('--compartment-id', help=u"""The [OCID] of the compartment containing the Maintenance Run.""") +@cli_util.option('--database-software-image-id', help=u"""The Autonomous Database Software Image [OCID]""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["SCHEDULED", "IN_PROGRESS", "SUCCEEDED", "SKIPPED", "FAILED", "UPDATING", "DELETING", "DELETED", "CANCELED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -9655,7 +9656,7 @@ def create_key_store_key_store_type_from_oracle_key_vault_details(ctx, from_json @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'database', 'class': 'MaintenanceRun'}) @cli_util.wrap_exceptions -def create_maintenance_run(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, target_resource_id, time_scheduled, patch_type, is_dst_file_update_enabled, patching_mode, compartment_id): +def create_maintenance_run(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, target_resource_id, time_scheduled, patch_type, is_dst_file_update_enabled, patching_mode, compartment_id, database_software_image_id): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -9674,6 +9675,9 @@ def create_maintenance_run(ctx, from_json, wait_for_state, max_wait_seconds, wai if compartment_id is not None: _details['compartmentId'] = compartment_id + if database_software_image_id is not None: + _details['databaseSoftwareImageId'] = database_software_image_id + client = cli_util.build_client('database', 'database', ctx) result = client.create_maintenance_run( create_maintenance_run_details=_details, @@ -20173,7 +20177,7 @@ def list_key_stores(ctx, from_json, all_pages, page_size, compartment_id, limit, @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["SCHEDULED", "IN_PROGRESS", "SUCCEEDED", "SKIPPED", "FAILED", "UPDATING", "DELETING", "DELETED", "CANCELED"]), help=u"""The state of the maintenance run history.""") @cli_util.option('--availability-domain', help=u"""A filter to return only resources that match the given availability domain exactly.""") -@cli_util.option('--maintenance-subtype', type=custom_types.CliCaseInsensitiveChoice(["QUARTERLY", "HARDWARE", "CRITICAL", "INFRASTRUCTURE", "DATABASE", "ONEOFF", "SECURITY_MONTHLY", "TIMEZONE"]), help=u"""The sub-type of the maintenance run.""") +@cli_util.option('--maintenance-subtype', type=custom_types.CliCaseInsensitiveChoice(["QUARTERLY", "HARDWARE", "CRITICAL", "INFRASTRUCTURE", "DATABASE", "ONEOFF", "SECURITY_MONTHLY", "TIMEZONE", "CUSTOM_DATABASE_SOFTWARE_IMAGE"]), help=u"""The sub-type of the maintenance run.""") @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({}) @@ -20248,7 +20252,7 @@ def list_maintenance_run_history(ctx, from_json, all_pages, page_size, compartme @cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either ascending (`ASC`) or descending (`DESC`).""") @cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["SCHEDULED", "IN_PROGRESS", "SUCCEEDED", "SKIPPED", "FAILED", "UPDATING", "DELETING", "DELETED", "CANCELED"]), help=u"""A filter to return only resources that match the given lifecycle state exactly.""") @cli_util.option('--availability-domain', help=u"""A filter to return only resources that match the given availability domain exactly.""") -@cli_util.option('--maintenance-subtype', type=custom_types.CliCaseInsensitiveChoice(["QUARTERLY", "HARDWARE", "CRITICAL", "INFRASTRUCTURE", "DATABASE", "ONEOFF", "SECURITY_MONTHLY", "TIMEZONE"]), help=u"""The sub-type of the maintenance run.""") +@cli_util.option('--maintenance-subtype', type=custom_types.CliCaseInsensitiveChoice(["QUARTERLY", "HARDWARE", "CRITICAL", "INFRASTRUCTURE", "DATABASE", "ONEOFF", "SECURITY_MONTHLY", "TIMEZONE", "CUSTOM_DATABASE_SOFTWARE_IMAGE"]), help=u"""The sub-type of the maintenance run.""") @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({}) diff --git a/services/database_management/src/oci_cli_db_management/generated/dbmanagement_cli.py b/services/database_management/src/oci_cli_db_management/generated/dbmanagement_cli.py index c7f450256..c7267b836 100644 --- a/services/database_management/src/oci_cli_db_management/generated/dbmanagement_cli.py +++ b/services/database_management/src/oci_cli_db_management/generated/dbmanagement_cli.py @@ -4470,7 +4470,7 @@ def disable_automatic_spm_evolve_advisor_task_database_password_credential_detai @managed_database_group.command(name=cli_util.override('db_management.disable_database_management_feature.command_name', 'disable-database-management-feature'), help=u"""Disables a Database Management feature for the specified Oracle cloud database. \n[Command Reference](disableDatabaseManagementFeature)""") @cli_util.option('--database-id', required=True, help=u"""The [OCID] of the Database.""") -@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT"]), help=u"""The name of the Database Management feature.""") +@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT", "DB_LIFECYCLE_MANAGEMENT", "SQLWATCH"]), help=u"""The name of the Database Management feature.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -4531,7 +4531,7 @@ def disable_database_management_feature(ctx, from_json, wait_for_state, max_wait @managed_database_group.command(name=cli_util.override('db_management.disable_external_container_database_management_feature.command_name', 'disable-external-container-database-management-feature'), help=u"""Disables a Database Management feature for the specified external container database. \n[Command Reference](disableExternalContainerDatabaseManagementFeature)""") @cli_util.option('--external-container-database-id', required=True, help=u"""The [OCID] of the external container database.""") -@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT"]), help=u"""The name of the Database Management feature.""") +@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT", "DB_LIFECYCLE_MANAGEMENT", "SQLWATCH"]), help=u"""The name of the Database Management feature.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -4761,7 +4761,7 @@ def disable_external_exadata_infrastructure_management(ctx, from_json, wait_for_ @managed_database_group.command(name=cli_util.override('db_management.disable_external_non_container_database_management_feature.command_name', 'disable-external-non-container-database-management-feature'), help=u"""Disables a Database Management feature for the specified external non-container database. \n[Command Reference](disableExternalNonContainerDatabaseManagementFeature)""") @cli_util.option('--external-non-container-database-id', required=True, help=u"""The [OCID] of the external non-container database.""") -@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT"]), help=u"""The name of the Database Management feature.""") +@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT", "DB_LIFECYCLE_MANAGEMENT", "SQLWATCH"]), help=u"""The name of the Database Management feature.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -4822,7 +4822,7 @@ def disable_external_non_container_database_management_feature(ctx, from_json, w @managed_database_group.command(name=cli_util.override('db_management.disable_external_pluggable_database_management_feature.command_name', 'disable-external-pluggable-database-management-feature'), help=u"""Disables a Database Management feature for the specified external pluggable database. \n[Command Reference](disableExternalPluggableDatabaseManagementFeature)""") @cli_util.option('--external-pluggable-database-id', required=True, help=u"""The [OCID] of the external pluggable database.""") -@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT"]), help=u"""The name of the Database Management feature.""") +@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT", "DB_LIFECYCLE_MANAGEMENT", "SQLWATCH"]), help=u"""The name of the Database Management feature.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -5128,7 +5128,7 @@ def disable_high_frequency_automatic_spm_evolve_advisor_task_database_password_c @managed_database_group.command(name=cli_util.override('db_management.disable_pluggable_database_management_feature.command_name', 'disable-pluggable-database-management-feature'), help=u"""Disables a Database Management feature for the specified Oracle cloud pluggable database. \n[Command Reference](disablePluggableDatabaseManagementFeature)""") @cli_util.option('--pluggable-database-id', required=True, help=u"""The [OCID] of the Oracle cloud pluggable database.""") -@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT"]), help=u"""The name of the Database Management feature.""") +@cli_util.option('--feature', required=True, type=custom_types.CliCaseInsensitiveChoice(["DIAGNOSTICS_AND_MANAGEMENT", "DB_LIFECYCLE_MANAGEMENT", "SQLWATCH"]), help=u"""The name of the Database Management feature.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -6737,6 +6737,138 @@ def enable_database_management_feature_database_diagnostics_and_management_featu cli_util.render_response(result, ctx) +@managed_database_group.command(name=cli_util.override('db_management.enable_database_management_feature_database_lifecycle_management_feature_details.command_name', 'enable-database-management-feature-database-lifecycle-management-feature-details'), help=u"""Enables a Database Management feature for the specified cloud database. \n[Command Reference](enableDatabaseManagementFeature)""") +@cli_util.option('--database-id', required=True, help=u"""The [OCID] of the Database.""") +@cli_util.option('--feature-details-database-connection-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def enable_database_management_feature_database_lifecycle_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_id, feature_details_database_connection_details, feature_details_connector_details, if_match): + + if isinstance(database_id, six.string_types) and len(database_id.strip()) == 0: + raise click.UsageError('Parameter --database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['databaseConnectionDetails'] = cli_util.parse_json_parameter("feature_details_database_connection_details", feature_details_database_connection_details) + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'DB_LIFECYCLE_MANAGEMENT' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_database_management_feature( + database_id=database_id, + enable_database_management_feature_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) + + +@managed_database_group.command(name=cli_util.override('db_management.enable_database_management_feature_database_sql_watch_feature_details.command_name', 'enable-database-management-feature-database-sql-watch-feature-details'), help=u"""Enables a Database Management feature for the specified cloud database. \n[Command Reference](enableDatabaseManagementFeature)""") +@cli_util.option('--database-id', required=True, help=u"""The [OCID] of the Database.""") +@cli_util.option('--feature-details-database-connection-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def enable_database_management_feature_database_sql_watch_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_id, feature_details_database_connection_details, feature_details_connector_details, if_match): + + if isinstance(database_id, six.string_types) and len(database_id.strip()) == 0: + raise click.UsageError('Parameter --database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['databaseConnectionDetails'] = cli_util.parse_json_parameter("feature_details_database_connection_details", feature_details_database_connection_details) + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'SQLWATCH' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_database_management_feature( + database_id=database_id, + enable_database_management_feature_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) + + @managed_database_group.command(name=cli_util.override('db_management.enable_external_container_database_management_feature.command_name', 'enable-external-container-database-management-feature'), help=u"""Enables a Database Management feature for the specified external container database. \n[Command Reference](enableExternalContainerDatabaseManagementFeature)""") @cli_util.option('--external-container-database-id', required=True, help=u"""The [OCID] of the external container database.""") @cli_util.option('--feature-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -6798,6 +6930,136 @@ def enable_external_container_database_management_feature(ctx, from_json, wait_f cli_util.render_response(result, ctx) +@managed_database_group.command(name=cli_util.override('db_management.enable_external_container_database_management_feature_external_database_lifecycle_management_feature_details.command_name', 'enable-external-container-database-management-feature-external-database-lifecycle-management-feature-details'), help=u"""Enables a Database Management feature for the specified external container database. \n[Command Reference](enableExternalContainerDatabaseManagementFeature)""") +@cli_util.option('--external-container-database-id', required=True, help=u"""The [OCID] of the external container database.""") +@cli_util.option('--feature-details-connector-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-license-model', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The Oracle license model that applies to the external database.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def enable_external_container_database_management_feature_external_database_lifecycle_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_container_database_id, feature_details_connector_details, feature_details_license_model, if_match): + + if isinstance(external_container_database_id, six.string_types) and len(external_container_database_id.strip()) == 0: + raise click.UsageError('Parameter --external-container-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + _details['featureDetails']['licenseModel'] = feature_details_license_model + + _details['featureDetails']['feature'] = 'DB_LIFECYCLE_MANAGEMENT' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_external_container_database_management_feature( + external_container_database_id=external_container_database_id, + enable_external_container_database_management_feature_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) + + +@managed_database_group.command(name=cli_util.override('db_management.enable_external_container_database_management_feature_external_database_sql_watch_feature_details.command_name', 'enable-external-container-database-management-feature-external-database-sql-watch-feature-details'), help=u"""Enables a Database Management feature for the specified external container database. \n[Command Reference](enableExternalContainerDatabaseManagementFeature)""") +@cli_util.option('--external-container-database-id', required=True, help=u"""The [OCID] of the external container database.""") +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def enable_external_container_database_management_feature_external_database_sql_watch_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_container_database_id, feature_details_connector_details, if_match): + + if isinstance(external_container_database_id, six.string_types) and len(external_container_database_id.strip()) == 0: + raise click.UsageError('Parameter --external-container-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'SQLWATCH' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_external_container_database_management_feature( + external_container_database_id=external_container_database_id, + enable_external_container_database_management_feature_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) + + @managed_database_group.command(name=cli_util.override('db_management.enable_external_container_database_management_feature_external_database_diagnostics_and_management_feature_details.command_name', 'enable-external-container-database-management-feature-external-database-diagnostics-and-management-feature-details'), help=u"""Enables a Database Management feature for the specified external container database. \n[Command Reference](enableExternalContainerDatabaseManagementFeature)""") @cli_util.option('--external-container-database-id', required=True, help=u"""The [OCID] of the external container database.""") @cli_util.option('--feature-details-connector-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -6871,15 +7133,266 @@ def enable_external_container_database_management_feature_external_database_diag @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def enable_external_db_system_database_management(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_db_system_id, license_model, if_match): + + if isinstance(external_db_system_id, six.string_types) and len(external_db_system_id.strip()) == 0: + raise click.UsageError('Parameter --external-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['licenseModel'] = license_model + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_external_db_system_database_management( + external_db_system_id=external_db_system_id, + enable_external_db_system_database_management_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) + + +@external_db_system_group.command(name=cli_util.override('db_management.enable_external_db_system_stack_monitoring.command_name', 'enable-external-db-system-stack-monitoring'), help=u"""Enables Stack Monitoring for all the components of the specified external DB system (except databases). \n[Command Reference](enableExternalDbSystemStackMonitoring)""") +@cli_util.option('--external-db-system-id', required=True, help=u"""The [OCID] of the external DB system.""") +@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""The status of the associated service.""") +@cli_util.option('--metadata', help=u"""The associated service-specific inputs in JSON string format, which Database Management can identify.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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 enable_external_db_system_stack_monitoring(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_db_system_id, is_enabled, metadata, if_match): + + if isinstance(external_db_system_id, six.string_types) and len(external_db_system_id.strip()) == 0: + raise click.UsageError('Parameter --external-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['isEnabled'] = is_enabled + + if metadata is not None: + _details['metadata'] = metadata + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_external_db_system_stack_monitoring( + external_db_system_id=external_db_system_id, + enable_external_db_system_stack_monitoring_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) + + +@external_exadata_infrastructure_group.command(name=cli_util.override('db_management.enable_external_exadata_infrastructure_management.command_name', 'enable-external-exadata-infrastructure-management'), help=u"""Enables Database Management for the Exadata infrastructure specified by externalExadataInfrastructureId. It covers the following components: + +- Exadata infrastructure - Exadata storage grid - Exadata storage server \n[Command Reference](enableExternalExadataInfrastructureManagement)""") +@cli_util.option('--external-exadata-infrastructure-id', required=True, help=u"""The [OCID] of the Exadata infrastructure.""") +@cli_util.option('--license-model', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The Oracle license model.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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 enable_external_exadata_infrastructure_management(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_exadata_infrastructure_id, license_model, if_match): + + if isinstance(external_exadata_infrastructure_id, six.string_types) and len(external_exadata_infrastructure_id.strip()) == 0: + raise click.UsageError('Parameter --external-exadata-infrastructure-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['licenseModel'] = license_model + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_external_exadata_infrastructure_management( + external_exadata_infrastructure_id=external_exadata_infrastructure_id, + enable_external_exadata_infrastructure_management_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) + + +@managed_database_group.command(name=cli_util.override('db_management.enable_external_non_container_database_management_feature.command_name', 'enable-external-non-container-database-management-feature'), help=u"""Enables Database Management feature for the specified external non-container database. \n[Command Reference](enableExternalNonContainerDatabaseManagementFeature)""") +@cli_util.option('--external-non-container-database-id', required=True, help=u"""The [OCID] of the external non-container database.""") +@cli_util.option('--feature-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details': {'module': 'database_management', 'class': 'ExternalDatabaseFeatureDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details': {'module': 'database_management', 'class': 'ExternalDatabaseFeatureDetails'}}) +@cli_util.wrap_exceptions +def enable_external_non_container_database_management_feature(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_non_container_database_id, feature_details, if_match): + + if isinstance(external_non_container_database_id, six.string_types) and len(external_non_container_database_id.strip()) == 0: + raise click.UsageError('Parameter --external-non-container-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = cli_util.parse_json_parameter("feature_details", feature_details) + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_external_non_container_database_management_feature( + external_non_container_database_id=external_non_container_database_id, + enable_external_non_container_database_management_feature_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) + + +@managed_database_group.command(name=cli_util.override('db_management.enable_external_non_container_database_management_feature_external_database_lifecycle_management_feature_details.command_name', 'enable-external-non-container-database-management-feature-external-database-lifecycle-management-feature-details'), help=u"""Enables Database Management feature for the specified external non-container database. \n[Command Reference](enableExternalNonContainerDatabaseManagementFeature)""") +@cli_util.option('--external-non-container-database-id', required=True, help=u"""The [OCID] of the external non-container database.""") +@cli_util.option('--feature-details-connector-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-license-model', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The Oracle license model that applies to the external database.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @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={'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @cli_util.wrap_exceptions -def enable_external_db_system_database_management(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_db_system_id, license_model, if_match): +def enable_external_non_container_database_management_feature_external_database_lifecycle_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_non_container_database_id, feature_details_connector_details, feature_details_license_model, if_match): - if isinstance(external_db_system_id, six.string_types) and len(external_db_system_id.strip()) == 0: - raise click.UsageError('Parameter --external-db-system-id cannot be whitespace or empty string') + if isinstance(external_non_container_database_id, six.string_types) and len(external_non_container_database_id.strip()) == 0: + raise click.UsageError('Parameter --external-non-container-database-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: @@ -6887,12 +7400,16 @@ def enable_external_db_system_database_management(ctx, from_json, wait_for_state kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['licenseModel'] = license_model + _details['featureDetails'] = {} + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + _details['featureDetails']['licenseModel'] = feature_details_license_model + + _details['featureDetails']['feature'] = 'DB_LIFECYCLE_MANAGEMENT' client = cli_util.build_client('database_management', 'db_management', ctx) - result = client.enable_external_db_system_database_management( - external_db_system_id=external_db_system_id, - enable_external_db_system_database_management_details=_details, + result = client.enable_external_non_container_database_management_feature( + external_non_container_database_id=external_non_container_database_id, + enable_external_non_container_database_management_feature_details=_details, **kwargs ) if wait_for_state: @@ -6925,23 +7442,22 @@ def enable_external_db_system_database_management(ctx, from_json, wait_for_state cli_util.render_response(result, ctx) -@external_db_system_group.command(name=cli_util.override('db_management.enable_external_db_system_stack_monitoring.command_name', 'enable-external-db-system-stack-monitoring'), help=u"""Enables Stack Monitoring for all the components of the specified external DB system (except databases). \n[Command Reference](enableExternalDbSystemStackMonitoring)""") -@cli_util.option('--external-db-system-id', required=True, help=u"""The [OCID] of the external DB system.""") -@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""The status of the associated service.""") -@cli_util.option('--metadata', help=u"""The associated service-specific inputs in JSON string format, which Database Management can identify.""") +@managed_database_group.command(name=cli_util.override('db_management.enable_external_non_container_database_management_feature_external_database_sql_watch_feature_details.command_name', 'enable-external-non-container-database-management-feature-external-database-sql-watch-feature-details'), help=u"""Enables Database Management feature for the specified external non-container database. \n[Command Reference](enableExternalNonContainerDatabaseManagementFeature)""") +@cli_util.option('--external-non-container-database-id', required=True, help=u"""The [OCID] of the external non-container database.""") +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @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={'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @cli_util.wrap_exceptions -def enable_external_db_system_stack_monitoring(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_db_system_id, is_enabled, metadata, if_match): +def enable_external_non_container_database_management_feature_external_database_sql_watch_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_non_container_database_id, feature_details_connector_details, if_match): - if isinstance(external_db_system_id, six.string_types) and len(external_db_system_id.strip()) == 0: - raise click.UsageError('Parameter --external-db-system-id cannot be whitespace or empty string') + if isinstance(external_non_container_database_id, six.string_types) and len(external_non_container_database_id.strip()) == 0: + raise click.UsageError('Parameter --external-non-container-database-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: @@ -6949,15 +7465,15 @@ def enable_external_db_system_stack_monitoring(ctx, from_json, wait_for_state, m kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['isEnabled'] = is_enabled + _details['featureDetails'] = {} + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) - if metadata is not None: - _details['metadata'] = metadata + _details['featureDetails']['feature'] = 'SQLWATCH' client = cli_util.build_client('database_management', 'db_management', ctx) - result = client.enable_external_db_system_stack_monitoring( - external_db_system_id=external_db_system_id, - enable_external_db_system_stack_monitoring_details=_details, + result = client.enable_external_non_container_database_management_feature( + external_non_container_database_id=external_non_container_database_id, + enable_external_non_container_database_management_feature_details=_details, **kwargs ) if wait_for_state: @@ -6990,24 +7506,23 @@ def enable_external_db_system_stack_monitoring(ctx, from_json, wait_for_state, m cli_util.render_response(result, ctx) -@external_exadata_infrastructure_group.command(name=cli_util.override('db_management.enable_external_exadata_infrastructure_management.command_name', 'enable-external-exadata-infrastructure-management'), help=u"""Enables Database Management for the Exadata infrastructure specified by externalExadataInfrastructureId. It covers the following components: - -- Exadata infrastructure - Exadata storage grid - Exadata storage server \n[Command Reference](enableExternalExadataInfrastructureManagement)""") -@cli_util.option('--external-exadata-infrastructure-id', required=True, help=u"""The [OCID] of the Exadata infrastructure.""") -@cli_util.option('--license-model', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The Oracle license model.""") +@managed_database_group.command(name=cli_util.override('db_management.enable_external_non_container_database_management_feature_external_database_diagnostics_and_management_feature_details.command_name', 'enable-external-non-container-database-management-feature-external-database-diagnostics-and-management-feature-details'), help=u"""Enables Database Management feature for the specified external non-container database. \n[Command Reference](enableExternalNonContainerDatabaseManagementFeature)""") +@cli_util.option('--external-non-container-database-id', required=True, help=u"""The [OCID] of the external non-container database.""") +@cli_util.option('--feature-details-connector-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-license-model', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The Oracle license model that applies to the external database.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @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={'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @cli_util.wrap_exceptions -def enable_external_exadata_infrastructure_management(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_exadata_infrastructure_id, license_model, if_match): +def enable_external_non_container_database_management_feature_external_database_diagnostics_and_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_non_container_database_id, feature_details_connector_details, feature_details_license_model, if_match): - if isinstance(external_exadata_infrastructure_id, six.string_types) and len(external_exadata_infrastructure_id.strip()) == 0: - raise click.UsageError('Parameter --external-exadata-infrastructure-id cannot be whitespace or empty string') + if isinstance(external_non_container_database_id, six.string_types) and len(external_non_container_database_id.strip()) == 0: + raise click.UsageError('Parameter --external-non-container-database-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: @@ -7015,12 +7530,16 @@ def enable_external_exadata_infrastructure_management(ctx, from_json, wait_for_s kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['licenseModel'] = license_model + _details['featureDetails'] = {} + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + _details['featureDetails']['licenseModel'] = feature_details_license_model + + _details['featureDetails']['feature'] = 'DIAGNOSTICS_AND_MANAGEMENT' client = cli_util.build_client('database_management', 'db_management', ctx) - result = client.enable_external_exadata_infrastructure_management( - external_exadata_infrastructure_id=external_exadata_infrastructure_id, - enable_external_exadata_infrastructure_management_details=_details, + result = client.enable_external_non_container_database_management_feature( + external_non_container_database_id=external_non_container_database_id, + enable_external_non_container_database_management_feature_details=_details, **kwargs ) if wait_for_state: @@ -7053,22 +7572,22 @@ def enable_external_exadata_infrastructure_management(ctx, from_json, wait_for_s cli_util.render_response(result, ctx) -@managed_database_group.command(name=cli_util.override('db_management.enable_external_non_container_database_management_feature.command_name', 'enable-external-non-container-database-management-feature'), help=u"""Enables Database Management feature for the specified external non-container database. \n[Command Reference](enableExternalNonContainerDatabaseManagementFeature)""") -@cli_util.option('--external-non-container-database-id', required=True, help=u"""The [OCID] of the external non-container database.""") +@managed_database_group.command(name=cli_util.override('db_management.enable_external_pluggable_database_management_feature.command_name', 'enable-external-pluggable-database-management-feature'), help=u"""Enables a Database Management feature for the specified external pluggable database. \n[Command Reference](enableExternalPluggableDatabaseManagementFeature)""") +@cli_util.option('--external-pluggable-database-id', required=True, help=u"""The [OCID] of the external pluggable database.""") @cli_util.option('--feature-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'feature-details': {'module': 'database_management', 'class': 'ExternalDatabaseFeatureDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'feature-details': {'module': 'database_management', 'class': 'ExternalPluggableDatabaseFeatureDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details': {'module': 'database_management', 'class': 'ExternalDatabaseFeatureDetails'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details': {'module': 'database_management', 'class': 'ExternalPluggableDatabaseFeatureDetails'}}) @cli_util.wrap_exceptions -def enable_external_non_container_database_management_feature(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_non_container_database_id, feature_details, if_match): +def enable_external_pluggable_database_management_feature(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_pluggable_database_id, feature_details, if_match): - if isinstance(external_non_container_database_id, six.string_types) and len(external_non_container_database_id.strip()) == 0: - raise click.UsageError('Parameter --external-non-container-database-id cannot be whitespace or empty string') + if isinstance(external_pluggable_database_id, six.string_types) and len(external_pluggable_database_id.strip()) == 0: + raise click.UsageError('Parameter --external-pluggable-database-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: @@ -7079,9 +7598,9 @@ def enable_external_non_container_database_management_feature(ctx, from_json, wa _details['featureDetails'] = cli_util.parse_json_parameter("feature_details", feature_details) client = cli_util.build_client('database_management', 'db_management', ctx) - result = client.enable_external_non_container_database_management_feature( - external_non_container_database_id=external_non_container_database_id, - enable_external_non_container_database_management_feature_details=_details, + result = client.enable_external_pluggable_database_management_feature( + external_pluggable_database_id=external_pluggable_database_id, + enable_external_pluggable_database_management_feature_details=_details, **kwargs ) if wait_for_state: @@ -7114,10 +7633,9 @@ def enable_external_non_container_database_management_feature(ctx, from_json, wa cli_util.render_response(result, ctx) -@managed_database_group.command(name=cli_util.override('db_management.enable_external_non_container_database_management_feature_external_database_diagnostics_and_management_feature_details.command_name', 'enable-external-non-container-database-management-feature-external-database-diagnostics-and-management-feature-details'), help=u"""Enables Database Management feature for the specified external non-container database. \n[Command Reference](enableExternalNonContainerDatabaseManagementFeature)""") -@cli_util.option('--external-non-container-database-id', required=True, help=u"""The [OCID] of the external non-container database.""") +@managed_database_group.command(name=cli_util.override('db_management.enable_external_pluggable_database_management_feature_external_pluggable_database_diagnostics_and_management_feature_details.command_name', 'enable-external-pluggable-database-management-feature-external-pluggable-database-diagnostics-and-management-feature-details'), help=u"""Enables a Database Management feature for the specified external pluggable database. \n[Command Reference](enableExternalPluggableDatabaseManagementFeature)""") +@cli_util.option('--external-pluggable-database-id', required=True, help=u"""The [OCID] of the external pluggable database.""") @cli_util.option('--feature-details-connector-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--feature-details-license-model', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The Oracle license model that applies to the external database.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -7127,10 +7645,10 @@ def enable_external_non_container_database_management_feature(ctx, from_json, wa @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @cli_util.wrap_exceptions -def enable_external_non_container_database_management_feature_external_database_diagnostics_and_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_non_container_database_id, feature_details_connector_details, feature_details_license_model, if_match): +def enable_external_pluggable_database_management_feature_external_pluggable_database_diagnostics_and_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_pluggable_database_id, feature_details_connector_details, if_match): - if isinstance(external_non_container_database_id, six.string_types) and len(external_non_container_database_id.strip()) == 0: - raise click.UsageError('Parameter --external-non-container-database-id cannot be whitespace or empty string') + if isinstance(external_pluggable_database_id, six.string_types) and len(external_pluggable_database_id.strip()) == 0: + raise click.UsageError('Parameter --external-pluggable-database-id cannot be whitespace or empty string') kwargs = {} if if_match is not None: @@ -7140,14 +7658,13 @@ def enable_external_non_container_database_management_feature_external_database_ _details = {} _details['featureDetails'] = {} _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) - _details['featureDetails']['licenseModel'] = feature_details_license_model _details['featureDetails']['feature'] = 'DIAGNOSTICS_AND_MANAGEMENT' client = cli_util.build_client('database_management', 'db_management', ctx) - result = client.enable_external_non_container_database_management_feature( - external_non_container_database_id=external_non_container_database_id, - enable_external_non_container_database_management_feature_details=_details, + result = client.enable_external_pluggable_database_management_feature( + external_pluggable_database_id=external_pluggable_database_id, + enable_external_pluggable_database_management_feature_details=_details, **kwargs ) if wait_for_state: @@ -7180,19 +7697,19 @@ def enable_external_non_container_database_management_feature_external_database_ cli_util.render_response(result, ctx) -@managed_database_group.command(name=cli_util.override('db_management.enable_external_pluggable_database_management_feature.command_name', 'enable-external-pluggable-database-management-feature'), help=u"""Enables a Database Management feature for the specified external pluggable database. \n[Command Reference](enableExternalPluggableDatabaseManagementFeature)""") +@managed_database_group.command(name=cli_util.override('db_management.enable_external_pluggable_database_management_feature_external_pluggable_database_lifecycle_management_feature_details.command_name', 'enable-external-pluggable-database-management-feature-external-pluggable-database-lifecycle-management-feature-details'), help=u"""Enables a Database Management feature for the specified external pluggable database. \n[Command Reference](enableExternalPluggableDatabaseManagementFeature)""") @cli_util.option('--external-pluggable-database-id', required=True, help=u"""The [OCID] of the external pluggable database.""") -@cli_util.option('--feature-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'feature-details': {'module': 'database_management', 'class': 'ExternalPluggableDatabaseFeatureDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details': {'module': 'database_management', 'class': 'ExternalPluggableDatabaseFeatureDetails'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @cli_util.wrap_exceptions -def enable_external_pluggable_database_management_feature(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_pluggable_database_id, feature_details, if_match): +def enable_external_pluggable_database_management_feature_external_pluggable_database_lifecycle_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_pluggable_database_id, feature_details_connector_details, if_match): if isinstance(external_pluggable_database_id, six.string_types) and len(external_pluggable_database_id.strip()) == 0: raise click.UsageError('Parameter --external-pluggable-database-id cannot be whitespace or empty string') @@ -7203,7 +7720,10 @@ def enable_external_pluggable_database_management_feature(ctx, from_json, wait_f kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) _details = {} - _details['featureDetails'] = cli_util.parse_json_parameter("feature_details", feature_details) + _details['featureDetails'] = {} + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'DB_LIFECYCLE_MANAGEMENT' client = cli_util.build_client('database_management', 'db_management', ctx) result = client.enable_external_pluggable_database_management_feature( @@ -7241,7 +7761,7 @@ def enable_external_pluggable_database_management_feature(ctx, from_json, wait_f cli_util.render_response(result, ctx) -@managed_database_group.command(name=cli_util.override('db_management.enable_external_pluggable_database_management_feature_external_pluggable_database_diagnostics_and_management_feature_details.command_name', 'enable-external-pluggable-database-management-feature-external-pluggable-database-diagnostics-and-management-feature-details'), help=u"""Enables a Database Management feature for the specified external pluggable database. \n[Command Reference](enableExternalPluggableDatabaseManagementFeature)""") +@managed_database_group.command(name=cli_util.override('db_management.enable_external_pluggable_database_management_feature_external_pluggable_database_sql_watch_feature_details.command_name', 'enable-external-pluggable-database-management-feature-external-pluggable-database-sql-watch-feature-details'), help=u"""Enables a Database Management feature for the specified external pluggable database. \n[Command Reference](enableExternalPluggableDatabaseManagementFeature)""") @cli_util.option('--external-pluggable-database-id', required=True, help=u"""The [OCID] of the external pluggable database.""") @cli_util.option('--feature-details-connector-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.""") @@ -7253,7 +7773,7 @@ def enable_external_pluggable_database_management_feature(ctx, from_json, wait_f @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) @cli_util.wrap_exceptions -def enable_external_pluggable_database_management_feature_external_pluggable_database_diagnostics_and_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_pluggable_database_id, feature_details_connector_details, if_match): +def enable_external_pluggable_database_management_feature_external_pluggable_database_sql_watch_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, external_pluggable_database_id, feature_details_connector_details, if_match): if isinstance(external_pluggable_database_id, six.string_types) and len(external_pluggable_database_id.strip()) == 0: raise click.UsageError('Parameter --external-pluggable-database-id cannot be whitespace or empty string') @@ -7267,7 +7787,7 @@ def enable_external_pluggable_database_management_feature_external_pluggable_dat _details['featureDetails'] = {} _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) - _details['featureDetails']['feature'] = 'DIAGNOSTICS_AND_MANAGEMENT' + _details['featureDetails']['feature'] = 'SQLWATCH' client = cli_util.build_client('database_management', 'db_management', ctx) result = client.enable_external_pluggable_database_management_feature( @@ -7657,7 +8177,139 @@ def enable_pluggable_database_management_feature_database_diagnostics_and_manage if feature_details_is_auto_enable_pluggable_database is not None: _details['featureDetails']['isAutoEnablePluggableDatabase'] = feature_details_is_auto_enable_pluggable_database - _details['featureDetails']['feature'] = 'DIAGNOSTICS_AND_MANAGEMENT' + _details['featureDetails']['feature'] = 'DIAGNOSTICS_AND_MANAGEMENT' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_pluggable_database_management_feature( + pluggable_database_id=pluggable_database_id, + enable_pluggable_database_management_feature_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) + + +@managed_database_group.command(name=cli_util.override('db_management.enable_pluggable_database_management_feature_database_lifecycle_management_feature_details.command_name', 'enable-pluggable-database-management-feature-database-lifecycle-management-feature-details'), help=u"""Enables a Database Management feature for the specified Oracle cloud pluggable database. \n[Command Reference](enablePluggableDatabaseManagementFeature)""") +@cli_util.option('--pluggable-database-id', required=True, help=u"""The [OCID] of the Oracle cloud pluggable database.""") +@cli_util.option('--feature-details-database-connection-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def enable_pluggable_database_management_feature_database_lifecycle_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, pluggable_database_id, feature_details_database_connection_details, feature_details_connector_details, if_match): + + if isinstance(pluggable_database_id, six.string_types) and len(pluggable_database_id.strip()) == 0: + raise click.UsageError('Parameter --pluggable-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['databaseConnectionDetails'] = cli_util.parse_json_parameter("feature_details_database_connection_details", feature_details_database_connection_details) + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'DB_LIFECYCLE_MANAGEMENT' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.enable_pluggable_database_management_feature( + pluggable_database_id=pluggable_database_id, + enable_pluggable_database_management_feature_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) + + +@managed_database_group.command(name=cli_util.override('db_management.enable_pluggable_database_management_feature_database_sql_watch_feature_details.command_name', 'enable-pluggable-database-management-feature-database-sql-watch-feature-details'), help=u"""Enables a Database Management feature for the specified Oracle cloud pluggable database. \n[Command Reference](enablePluggableDatabaseManagementFeature)""") +@cli_util.option('--pluggable-database-id', required=True, help=u"""The [OCID] of the Oracle cloud pluggable database.""") +@cli_util.option('--feature-details-database-connection-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def enable_pluggable_database_management_feature_database_sql_watch_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, pluggable_database_id, feature_details_database_connection_details, feature_details_connector_details, if_match): + + if isinstance(pluggable_database_id, six.string_types) and len(pluggable_database_id.strip()) == 0: + raise click.UsageError('Parameter --pluggable-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['databaseConnectionDetails'] = cli_util.parse_json_parameter("feature_details_database_connection_details", feature_details_database_connection_details) + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'SQLWATCH' client = cli_util.build_client('database_management', 'db_management', ctx) result = client.enable_pluggable_database_management_feature( @@ -13154,6 +13806,138 @@ def modify_database_management_feature_database_diagnostics_and_management_featu cli_util.render_response(result, ctx) +@managed_database_group.command(name=cli_util.override('db_management.modify_database_management_feature_database_lifecycle_management_feature_details.command_name', 'modify-database-management-feature-database-lifecycle-management-feature-details'), help=u"""Modifies a Database Management feature for the specified Oracle cloud database. \n[Command Reference](modifyDatabaseManagementFeature)""") +@cli_util.option('--database-id', required=True, help=u"""The [OCID] of the Database.""") +@cli_util.option('--feature-details-database-connection-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def modify_database_management_feature_database_lifecycle_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_id, feature_details_database_connection_details, feature_details_connector_details, if_match): + + if isinstance(database_id, six.string_types) and len(database_id.strip()) == 0: + raise click.UsageError('Parameter --database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['databaseConnectionDetails'] = cli_util.parse_json_parameter("feature_details_database_connection_details", feature_details_database_connection_details) + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'DB_LIFECYCLE_MANAGEMENT' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.modify_database_management_feature( + database_id=database_id, + modify_database_management_feature_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) + + +@managed_database_group.command(name=cli_util.override('db_management.modify_database_management_feature_database_sql_watch_feature_details.command_name', 'modify-database-management-feature-database-sql-watch-feature-details'), help=u"""Modifies a Database Management feature for the specified Oracle cloud database. \n[Command Reference](modifyDatabaseManagementFeature)""") +@cli_util.option('--database-id', required=True, help=u"""The [OCID] of the Database.""") +@cli_util.option('--feature-details-database-connection-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def modify_database_management_feature_database_sql_watch_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, database_id, feature_details_database_connection_details, feature_details_connector_details, if_match): + + if isinstance(database_id, six.string_types) and len(database_id.strip()) == 0: + raise click.UsageError('Parameter --database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['databaseConnectionDetails'] = cli_util.parse_json_parameter("feature_details_database_connection_details", feature_details_database_connection_details) + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'SQLWATCH' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.modify_database_management_feature( + database_id=database_id, + modify_database_management_feature_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) + + @managed_database_group.command(name=cli_util.override('db_management.modify_pluggable_database_management_feature.command_name', 'modify-pluggable-database-management-feature'), help=u"""Modifies the Database Management feature for the specified Oracle cloud pluggable database. \n[Command Reference](modifyPluggableDatabaseManagementFeature)""") @cli_util.option('--pluggable-database-id', required=True, help=u"""The [OCID] of the Oracle cloud pluggable database.""") @cli_util.option('--feature-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @@ -13287,6 +14071,138 @@ def modify_pluggable_database_management_feature_database_diagnostics_and_manage cli_util.render_response(result, ctx) +@managed_database_group.command(name=cli_util.override('db_management.modify_pluggable_database_management_feature_database_lifecycle_management_feature_details.command_name', 'modify-pluggable-database-management-feature-database-lifecycle-management-feature-details'), help=u"""Modifies the Database Management feature for the specified Oracle cloud pluggable database. \n[Command Reference](modifyPluggableDatabaseManagementFeature)""") +@cli_util.option('--pluggable-database-id', required=True, help=u"""The [OCID] of the Oracle cloud pluggable database.""") +@cli_util.option('--feature-details-database-connection-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def modify_pluggable_database_management_feature_database_lifecycle_management_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, pluggable_database_id, feature_details_database_connection_details, feature_details_connector_details, if_match): + + if isinstance(pluggable_database_id, six.string_types) and len(pluggable_database_id.strip()) == 0: + raise click.UsageError('Parameter --pluggable-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['databaseConnectionDetails'] = cli_util.parse_json_parameter("feature_details_database_connection_details", feature_details_database_connection_details) + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'DB_LIFECYCLE_MANAGEMENT' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.modify_pluggable_database_management_feature( + pluggable_database_id=pluggable_database_id, + modify_pluggable_database_management_feature_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) + + +@managed_database_group.command(name=cli_util.override('db_management.modify_pluggable_database_management_feature_database_sql_watch_feature_details.command_name', 'modify-pluggable-database-management-feature-database-sql-watch-feature-details'), help=u"""Modifies the Database Management feature for the specified Oracle cloud pluggable database. \n[Command Reference](modifyPluggableDatabaseManagementFeature)""") +@cli_util.option('--pluggable-database-id', required=True, help=u"""The [OCID] of the Oracle cloud pluggable database.""") +@cli_util.option('--feature-details-database-connection-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--feature-details-connector-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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'feature-details-database-connection-details': {'module': 'database_management', 'class': 'DatabaseConnectionDetails'}, 'feature-details-connector-details': {'module': 'database_management', 'class': 'ConnectorDetails'}}) +@cli_util.wrap_exceptions +def modify_pluggable_database_management_feature_database_sql_watch_feature_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, pluggable_database_id, feature_details_database_connection_details, feature_details_connector_details, if_match): + + if isinstance(pluggable_database_id, six.string_types) and len(pluggable_database_id.strip()) == 0: + raise click.UsageError('Parameter --pluggable-database-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['featureDetails'] = {} + _details['featureDetails']['databaseConnectionDetails'] = cli_util.parse_json_parameter("feature_details_database_connection_details", feature_details_database_connection_details) + _details['featureDetails']['connectorDetails'] = cli_util.parse_json_parameter("feature_details_connector_details", feature_details_connector_details) + + _details['featureDetails']['feature'] = 'SQLWATCH' + + client = cli_util.build_client('database_management', 'db_management', ctx) + result = client.modify_pluggable_database_management_feature( + pluggable_database_id=pluggable_database_id, + modify_pluggable_database_management_feature_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) + + @external_db_system_discovery_group.command(name=cli_util.override('db_management.patch_external_db_system_discovery.command_name', 'patch'), help=u"""Patches the external DB system discovery specified by `externalDbSystemDiscoveryId`. \n[Command Reference](patchExternalDbSystemDiscovery)""") @cli_util.option('--external-db-system-discovery-id', required=True, help=u"""The [OCID] of the external DB system discovery.""") @cli_util.option('--items', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A sequence of instructions to apply to the resource. diff --git a/services/disaster_recovery/src/oci_cli_disaster_recovery/generated/disasterrecovery_cli.py b/services/disaster_recovery/src/oci_cli_disaster_recovery/generated/disasterrecovery_cli.py index 0c63fe177..1ca9c1aac 100644 --- a/services/disaster_recovery/src/oci_cli_disaster_recovery/generated/disasterrecovery_cli.py +++ b/services/disaster_recovery/src/oci_cli_disaster_recovery/generated/disasterrecovery_cli.py @@ -1698,7 +1698,6 @@ def ignore_dr_plan_execution(ctx, from_json, wait_for_state, max_wait_seconds, w @cli_util.option('--dr-plan-execution-id', help=u"""The OCID of the DR plan execution. Example: `ocid1.drplanexecution.oc1..uniqueID`""") -@cli_util.option('--dr-plan-execution-type', type=custom_types.CliCaseInsensitiveChoice(["SWITCHOVER", "SWITCHOVER_PRECHECK", "FAILOVER", "FAILOVER_PRECHECK", "START_DRILL", "START_DRILL_PRECHECK", "STOP_DRILL", "STOP_DRILL_PRECHECK"]), help=u"""The DR plan execution type.""") @cli_util.option('--display-name', help=u"""A filter to return only resources that match the given display name. Example: `MyResourceDisplayName`""") @@ -1721,7 +1720,7 @@ def ignore_dr_plan_execution(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': 'disaster_recovery', 'class': 'DrPlanExecutionCollection'}) @cli_util.wrap_exceptions -def list_dr_plan_executions(ctx, from_json, all_pages, page_size, dr_protection_group_id, lifecycle_state, dr_plan_execution_id, dr_plan_execution_type, display_name, limit, page, sort_order, sort_by): +def list_dr_plan_executions(ctx, from_json, all_pages, page_size, dr_protection_group_id, lifecycle_state, dr_plan_execution_id, display_name, limit, page, sort_order, sort_by): if all_pages and limit: raise click.UsageError('If you provide the --all option you cannot provide the --limit option') @@ -1731,8 +1730,6 @@ def list_dr_plan_executions(ctx, from_json, all_pages, page_size, dr_protection_ kwargs['lifecycle_state'] = lifecycle_state if dr_plan_execution_id is not None: kwargs['dr_plan_execution_id'] = dr_plan_execution_id - if dr_plan_execution_type is not None: - kwargs['dr_plan_execution_type'] = dr_plan_execution_type if display_name is not None: kwargs['display_name'] = display_name if limit is not None: diff --git a/services/fleet_apps_management/__init__.py b/services/fleet_apps_management/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/__init__.py b/services/fleet_apps_management/src/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/client_mappings.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/client_mappings.py new file mode 100644 index 000000000..5d7c2d67c --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/client_mappings.py @@ -0,0 +1,14 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +import oci +from oci_cli.cli_clients import CLIENT_MAP +from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS +from oci.fleet_apps_management import FleetAppsManagementClient + +MODULE_TO_TYPE_MAPPINGS["fleet_apps_management"] = oci.fleet_apps_management.models.fleet_apps_management_type_mapping +if CLIENT_MAP.get("fleet_apps_management") is None: + CLIENT_MAP["fleet_apps_management"] = {} +CLIENT_MAP["fleet_apps_management"]["fleet_apps_management"] = FleetAppsManagementClient diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/fleet_apps_management_service_cli.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/fleet_apps_management_service_cli.py new file mode 100644 index 000000000..20eb57f3f --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/fleet_apps_management_service_cli.py @@ -0,0 +1,15 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +from oci_cli.cli_root import cli +from oci_cli import cli_util +from oci_cli.aliasing import CommandGroupWithAlias + + +@cli.command(cli_util.override('fleet_apps_management_runbooks.fleet_apps_management_service_group.command_name', 'fleet-apps-management'), cls=CommandGroupWithAlias, help=cli_util.override('fleet_apps_management_runbooks.fleet_apps_management_service_group.help', """Fleet Application Management Service API. Use this API to for all FAMS related activities. +To manage fleets,view complaince report for the Fleet,scedule patches and other lifecycle activities"""), short_help=cli_util.override('fleet_apps_management_runbooks.fleet_apps_management_service_group.short_help', """Fleet Application Management Service API""")) +@cli_util.help_option_group +def fleet_apps_management_service_group(): + pass diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/fleetappsmanagement_cli.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/fleetappsmanagement_cli.py new file mode 100644 index 000000000..bfe35a86a --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management/generated/fleetappsmanagement_cli.py @@ -0,0 +1,2208 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +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.fleet_apps_management.src.oci_cli_fleet_apps_management.generated import fleet_apps_management_service_cli + + +@click.command(cli_util.override('fleet_apps_management.fleet_apps_management_root_group.command_name', 'fleet-apps-management'), cls=CommandGroupWithAlias, help=cli_util.override('fleet_apps_management.fleet_apps_management_root_group.help', """Fleet Application Management Service API. Use this API to for all FAMS related activities. +To manage fleets,view complaince report for the Fleet,scedule patches and other lifecycle activities"""), short_help=cli_util.override('fleet_apps_management.fleet_apps_management_root_group.short_help', """Fleet Application Management Service API""")) +@cli_util.help_option_group +def fleet_apps_management_root_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_group.command_name', 'fleet'), cls=CommandGroupWithAlias, help="""Description of Fleet.""") +@cli_util.help_option_group +def fleet_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_product_collection_group.command_name', 'fleet-product-collection'), cls=CommandGroupWithAlias, help="""Results of a fleetProduct search. Contains boh FleetProductSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def fleet_product_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.inventory_resource_collection_group.command_name', 'inventory-resource-collection'), cls=CommandGroupWithAlias, help="""Results of a inventoryResource search. Contains both InventoryResourceSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def inventory_resource_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_property_collection_group.command_name', 'fleet-property-collection'), cls=CommandGroupWithAlias, help="""Results of a fleetProperty search. Contains boh FleetPropertySummary items and other information, such as metadata.""") +@cli_util.help_option_group +def fleet_property_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.announcement_collection_group.command_name', 'announcement-collection'), cls=CommandGroupWithAlias, help="""Results of list announcements . Contains AnnouncementSummary items""") +@cli_util.help_option_group +def announcement_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_credential_group.command_name', 'fleet-credential'), cls=CommandGroupWithAlias, help="""Description of FleetCredential.""") +@cli_util.help_option_group +def fleet_credential_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.work_request_log_entry_group.command_name', 'work-request-log-entry'), cls=CommandGroupWithAlias, help="""A log message from the execution of a work request.""") +@cli_util.help_option_group +def work_request_log_entry_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_resource_collection_group.command_name', 'fleet-resource-collection'), cls=CommandGroupWithAlias, help="""Results of a fleetResource search. Contains boh FleetResourceSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def fleet_resource_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.work_request_group.command_name', 'work-request'), cls=CommandGroupWithAlias, help="""A description of workrequest status""") +@cli_util.help_option_group +def work_request_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.compliance_report_group.command_name', 'compliance-report'), cls=CommandGroupWithAlias, help="""Summary of a compliance report.""") +@cli_util.help_option_group +def compliance_report_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_target_collection_group.command_name', 'fleet-target-collection'), cls=CommandGroupWithAlias, help="""Results of a fleetTarget search. Contains both FleetTargetSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def fleet_target_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_resource_group.command_name', 'fleet-resource'), cls=CommandGroupWithAlias, help="""Resource added to a Fleet.""") +@cli_util.help_option_group +def fleet_resource_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_property_group.command_name', 'fleet-property'), cls=CommandGroupWithAlias, help="""Property associated with a Fleet.""") +@cli_util.help_option_group +def fleet_property_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.work_request_error_group.command_name', 'work-request-error'), cls=CommandGroupWithAlias, help="""An error encountered while executing a work request.""") +@cli_util.help_option_group +def work_request_error_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_credential_collection_group.command_name', 'fleet-credential-collection'), cls=CommandGroupWithAlias, help="""Results of a fleetCredential search. Contains boh FleetCredentialSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def fleet_credential_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management.fleet_collection_group.command_name', 'fleet-collection'), cls=CommandGroupWithAlias, help="""Results of a fleet search. Contains both FleetSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def fleet_collection_group(): + pass + + +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_apps_management_root_group) +fleet_apps_management_root_group.add_command(fleet_group) +fleet_apps_management_root_group.add_command(fleet_product_collection_group) +fleet_apps_management_root_group.add_command(inventory_resource_collection_group) +fleet_apps_management_root_group.add_command(fleet_property_collection_group) +fleet_apps_management_root_group.add_command(announcement_collection_group) +fleet_apps_management_root_group.add_command(fleet_credential_group) +fleet_apps_management_root_group.add_command(work_request_log_entry_group) +fleet_apps_management_root_group.add_command(fleet_resource_collection_group) +fleet_apps_management_root_group.add_command(work_request_group) +fleet_apps_management_root_group.add_command(compliance_report_group) +fleet_apps_management_root_group.add_command(fleet_target_collection_group) +fleet_apps_management_root_group.add_command(fleet_resource_group) +fleet_apps_management_root_group.add_command(fleet_property_group) +fleet_apps_management_root_group.add_command(work_request_error_group) +fleet_apps_management_root_group.add_command(fleet_credential_collection_group) +fleet_apps_management_root_group.add_command(fleet_collection_group) +# oci fleet_apps_management fleet_apps_management --> oci fleet_apps_management +fleet_apps_management_service_cli.fleet_apps_management_service_group.commands.pop(fleet_apps_management_root_group.name) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_product_collection_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(inventory_resource_collection_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_property_collection_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(announcement_collection_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_credential_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(work_request_log_entry_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_resource_collection_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(work_request_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(compliance_report_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_target_collection_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_resource_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_property_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(work_request_error_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_credential_collection_group) +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_collection_group) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.check_resource_tagging.command_name', 'check-resource-tagging'), help=u"""Check if FAMS tags can be added for the resources \n[Command Reference](checkResourceTagging)""") +@cli_util.option('--compartment-id', required=True, help=u"""Tenancy OCID""") +@cli_util.option('--resource-ids', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Resource OCIDS that need to be verified if tag can be enabled""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--fleet-display-name', help=u"""Fleet Name""") +@json_skeleton_utils.get_cli_json_input_option({'resource-ids': {'module': 'fleet_apps_management', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'resource-ids': {'module': 'fleet_apps_management', 'class': 'list[string]'}}, output_type={'module': 'fleet_apps_management', 'class': 'ResourceTagCheckDetails'}) +@cli_util.wrap_exceptions +def check_resource_tagging(ctx, from_json, compartment_id, resource_ids, fleet_display_name): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + _details['resourceIds'] = cli_util.parse_json_parameter("resource_ids", resource_ids) + + if fleet_display_name is not None: + _details['fleetDisplayName'] = fleet_display_name + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.check_resource_tagging( + check_resource_tagging_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.confirm_targets.command_name', 'confirm-targets'), help=u"""Confirm targets to be managed for a Fleet.Only targets that are confirmed will be managed by FAMS \n[Command Reference](confirmTargets)""") +@cli_util.option('--targets', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""The targets to confirm.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'targets': {'module': 'fleet_apps_management', 'class': 'list[DiscoveredTarget]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'targets': {'module': 'fleet_apps_management', 'class': 'list[DiscoveredTarget]'}}) +@cli_util.wrap_exceptions +def confirm_targets(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, targets, fleet_id): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['targets'] = cli_util.parse_json_parameter("targets", targets) + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.confirm_targets( + fleet_id=fleet_id, + confirm_targets_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) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.create_fleet.command_name', 'create'), help=u"""Creates a new fleet instance that includes fleet resources and properties. For more information, please see the documentation. \n[Command Reference](createFleet)""") +@cli_util.option('--compartment-id', required=True, help=u"""Tenancy OCID""") +@cli_util.option('--fleet-type', required=True, help=u"""Type of the Fleet""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--description', help=u"""A user-friendly description. To provide some insight about the resource. Avoid entering confidential information.""") +@cli_util.option('--products', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Products associated with the Fleet""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--application-type', help=u"""Application Type associated with the Fleet.Applicable for Environment fleet types.""") +@cli_util.option('--environment-type', help=u"""Environment Type associated with the Fleet.Applicable for Environment fleet types.""") +@cli_util.option('--group-type', help=u"""Group Type associated with Group Fleet.Applicable for Group fleet types.""") +@cli_util.option('--resource-selection-type', help=u"""Type of resource selection in a fleet""") +@cli_util.option('--rule-selection-criteria', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--notification-preferences', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--resources', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Resources to be added during fleet creation when Resource selection type is Manual. + +This option is a JSON list with items of type AssociatedFleetResourceDetails. For documentation on AssociatedFleetResourceDetails please see our API reference: https://docs.cloud.oracle.com/api/#/en/fleetappsmanagement/20230831/datatypes/AssociatedFleetResourceDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-target-auto-confirm', type=click.BOOL, help=u"""A value which represents if auto confirming of the targets can be enabled""") +@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", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'products': {'module': 'fleet_apps_management', 'class': 'list[string]'}, 'rule-selection-criteria': {'module': 'fleet_apps_management', 'class': 'SelectionCriteria'}, 'notification-preferences': {'module': 'fleet_apps_management', 'class': 'NotificationPreferences'}, 'resources': {'module': 'fleet_apps_management', 'class': 'list[AssociatedFleetResourceDetails]'}, 'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', '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={'products': {'module': 'fleet_apps_management', 'class': 'list[string]'}, 'rule-selection-criteria': {'module': 'fleet_apps_management', 'class': 'SelectionCriteria'}, 'notification-preferences': {'module': 'fleet_apps_management', 'class': 'NotificationPreferences'}, 'resources': {'module': 'fleet_apps_management', 'class': 'list[AssociatedFleetResourceDetails]'}, 'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'fleet_apps_management', 'class': 'Fleet'}) +@cli_util.wrap_exceptions +def create_fleet(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, fleet_type, display_name, description, products, application_type, environment_type, group_type, resource_selection_type, rule_selection_criteria, notification_preferences, resources, is_target_auto_confirm, freeform_tags, defined_tags): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + _details['fleetType'] = fleet_type + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if products is not None: + _details['products'] = cli_util.parse_json_parameter("products", products) + + if application_type is not None: + _details['applicationType'] = application_type + + if environment_type is not None: + _details['environmentType'] = environment_type + + if group_type is not None: + _details['groupType'] = group_type + + if resource_selection_type is not None: + _details['resourceSelectionType'] = resource_selection_type + + if rule_selection_criteria is not None: + _details['ruleSelectionCriteria'] = cli_util.parse_json_parameter("rule_selection_criteria", rule_selection_criteria) + + if notification_preferences is not None: + _details['notificationPreferences'] = cli_util.parse_json_parameter("notification_preferences", notification_preferences) + + if resources is not None: + _details['resources'] = cli_util.parse_json_parameter("resources", resources) + + if is_target_auto_confirm is not None: + _details['isTargetAutoConfirm'] = is_target_auto_confirm + + 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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.create_fleet( + create_fleet_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) + + +@fleet_credential_group.command(name=cli_util.override('fleet_apps_management.create_fleet_credential.command_name', 'create'), help=u"""Creates a new FleetCredential. \n[Command Reference](createFleetCredential)""") +@cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--compartment-id', required=True, help=u"""Tenancy OCID""") +@cli_util.option('--entity-specifics', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--user', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--password', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'entity-specifics': {'module': 'fleet_apps_management', 'class': 'CredentialEntitySpecificDetails'}, 'user': {'module': 'fleet_apps_management', 'class': 'CredentialDetails'}, 'password': {'module': 'fleet_apps_management', 'class': 'CredentialDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'entity-specifics': {'module': 'fleet_apps_management', 'class': 'CredentialEntitySpecificDetails'}, 'user': {'module': 'fleet_apps_management', 'class': 'CredentialDetails'}, 'password': {'module': 'fleet_apps_management', 'class': 'CredentialDetails'}}, output_type={'module': 'fleet_apps_management', 'class': 'FleetCredential'}) +@cli_util.wrap_exceptions +def create_fleet_credential(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, entity_specifics, user, password, fleet_id): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['displayName'] = display_name + _details['compartmentId'] = compartment_id + _details['entitySpecifics'] = cli_util.parse_json_parameter("entity_specifics", entity_specifics) + _details['user'] = cli_util.parse_json_parameter("user", user) + _details['password'] = cli_util.parse_json_parameter("password", password) + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.create_fleet_credential( + fleet_id=fleet_id, + create_fleet_credential_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@fleet_property_group.command(name=cli_util.override('fleet_apps_management.create_fleet_property.command_name', 'create'), help=u"""Creates a new FleetProperty. \n[Command Reference](createFleetProperty)""") +@cli_util.option('--compartment-id', required=True, help=u"""Tenancy OCID""") +@cli_util.option('--value', required=True, help=u"""Value of the Property""") +@cli_util.option('--property-id', required=True, help=u"""Property Id.""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "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 SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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': 'fleet_apps_management', 'class': 'FleetProperty'}) +@cli_util.wrap_exceptions +def create_fleet_property(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, value, property_id, fleet_id): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + _details['value'] = value + _details['propertyId'] = property_id + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.create_fleet_property( + fleet_id=fleet_id, + create_fleet_property_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_fleet_property') and callable(getattr(client, 'get_fleet_property')): + 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_fleet_property(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) + + +@fleet_resource_group.command(name=cli_util.override('fleet_apps_management.create_fleet_resource.command_name', 'create'), help=u"""Creates a new FleetResource. \n[Command Reference](createFleetResource)""") +@cli_util.option('--resource-id', required=True, help=u"""The OCID of the resource.""") +@cli_util.option('--tenancy-id', required=True, help=u"""OCID of the tenancy to which the resource belongs to.""") +@cli_util.option('--compartment-id', required=True, help=u"""OCID of the compartment to which the resource belongs to.""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--resource-region', help=u"""Associated region""") +@cli_util.option('--resource-type', help=u"""Type of the Resource.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'FleetResource'}) +@cli_util.wrap_exceptions +def create_fleet_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, resource_id, tenancy_id, compartment_id, fleet_id, resource_region, resource_type): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['resourceId'] = resource_id + _details['tenancyId'] = tenancy_id + _details['compartmentId'] = compartment_id + + if resource_region is not None: + _details['resourceRegion'] = resource_region + + if resource_type is not None: + _details['resourceType'] = resource_type + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.create_fleet_resource( + fleet_id=fleet_id, + create_fleet_resource_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) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.delete_fleet.command_name', 'delete'), help=u"""Deletes a Fleet resource by identifier \n[Command Reference](deleteFleet)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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_fleet(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_id, if_match): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.delete_fleet( + fleet_id=fleet_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) + + +@fleet_credential_group.command(name=cli_util.override('fleet_apps_management.delete_fleet_credential.command_name', 'delete'), help=u"""Deletes a FleetCredential resource by identifier \n[Command Reference](deleteFleetCredential)""") +@cli_util.option('--fleet-credential-id', required=True, help=u"""unique FleetCredential identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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_fleet_credential(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_credential_id, fleet_id, if_match): + + if isinstance(fleet_credential_id, six.string_types) and len(fleet_credential_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-credential-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.delete_fleet_credential( + fleet_credential_id=fleet_credential_id, + fleet_id=fleet_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) + + +@fleet_property_group.command(name=cli_util.override('fleet_apps_management.delete_fleet_property.command_name', 'delete'), help=u"""Deletes a FleetProperty resource by identifier \n[Command Reference](deleteFleetProperty)""") +@cli_util.option('--fleet-property-id', required=True, help=u"""unique FleetProperty identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@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_fleet_property(ctx, from_json, fleet_property_id, fleet_id, if_match): + + if isinstance(fleet_property_id, six.string_types) and len(fleet_property_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-property-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.delete_fleet_property( + fleet_property_id=fleet_property_id, + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_resource_group.command(name=cli_util.override('fleet_apps_management.delete_fleet_resource.command_name', 'delete'), help=u"""Deletes a FleetResource resource by identifier \n[Command Reference](deleteFleetResource)""") +@cli_util.option('--fleet-resource-id', required=True, help=u"""unique FleetResource identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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_fleet_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_resource_id, fleet_id, if_match): + + if isinstance(fleet_resource_id, six.string_types) and len(fleet_resource_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-resource-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.delete_fleet_resource( + fleet_resource_id=fleet_resource_id, + fleet_id=fleet_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) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.generate_compliance_report.command_name', 'generate-compliance-report'), help=u"""Request to generate compliance report for a Fleet \n[Command Reference](generateComplianceReport)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--are-details-required', help=u"""Are compliance details required at target level also""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def generate_compliance_report(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_id, are_details_required): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if are_details_required is not None: + _details['areDetailsRequired'] = are_details_required + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.generate_compliance_report( + fleet_id=fleet_id, + generate_compliance_report_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@compliance_report_group.command(name=cli_util.override('fleet_apps_management.get_compliance_report.command_name', 'get'), help=u"""Retrieve compiane report for a Fleet \n[Command Reference](getComplianceReport)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--compliance-report-id', required=True, help=u"""compliance report identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'ComplianceReport'}) +@cli_util.wrap_exceptions +def get_compliance_report(ctx, from_json, fleet_id, compliance_report_id): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + if isinstance(compliance_report_id, six.string_types) and len(compliance_report_id.strip()) == 0: + raise click.UsageError('Parameter --compliance-report-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.get_compliance_report( + fleet_id=fleet_id, + compliance_report_id=compliance_report_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.get_fleet.command_name', 'get'), help=u"""Gets a Fleet by identifier \n[Command Reference](getFleet)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'Fleet'}) +@cli_util.wrap_exceptions +def get_fleet(ctx, from_json, fleet_id): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.get_fleet( + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_credential_group.command(name=cli_util.override('fleet_apps_management.get_fleet_credential.command_name', 'get'), help=u"""Gets a FleetCredential by identifier \n[Command Reference](getFleetCredential)""") +@cli_util.option('--fleet-credential-id', required=True, help=u"""unique FleetCredential identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'FleetCredential'}) +@cli_util.wrap_exceptions +def get_fleet_credential(ctx, from_json, fleet_credential_id, fleet_id): + + if isinstance(fleet_credential_id, six.string_types) and len(fleet_credential_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-credential-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.get_fleet_credential( + fleet_credential_id=fleet_credential_id, + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_property_group.command(name=cli_util.override('fleet_apps_management.get_fleet_property.command_name', 'get'), help=u"""Gets a FleetProperty by identifier \n[Command Reference](getFleetProperty)""") +@cli_util.option('--fleet-property-id', required=True, help=u"""unique FleetProperty identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'FleetProperty'}) +@cli_util.wrap_exceptions +def get_fleet_property(ctx, from_json, fleet_property_id, fleet_id): + + if isinstance(fleet_property_id, six.string_types) and len(fleet_property_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-property-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.get_fleet_property( + fleet_property_id=fleet_property_id, + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_resource_group.command(name=cli_util.override('fleet_apps_management.get_fleet_resource.command_name', 'get'), help=u"""Gets a FleetResource by identifier \n[Command Reference](getFleetResource)""") +@cli_util.option('--fleet-resource-id', required=True, help=u"""unique FleetResource identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'FleetResource'}) +@cli_util.wrap_exceptions +def get_fleet_resource(ctx, from_json, fleet_resource_id, fleet_id): + + if isinstance(fleet_resource_id, six.string_types) and len(fleet_resource_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-resource-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.get_fleet_resource( + fleet_resource_id=fleet_resource_id, + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_group.command(name=cli_util.override('fleet_apps_management.get_work_request.command_name', 'get'), help=u"""Gets details of the work request with the given ID. \n[Command Reference](getWorkRequest)""") +@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") +@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': 'fleet_apps_management', 'class': 'WorkRequest'}) +@cli_util.wrap_exceptions +def get_work_request(ctx, from_json, work_request_id): + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.get_work_request( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@announcement_collection_group.command(name=cli_util.override('fleet_apps_management.list_announcements.command_name', 'list-announcements'), help=u"""Return a list of AnnouncementSummary items \n[Command Reference](listAnnouncements)""") +@cli_util.option('--summary-contains', help=u"""Filter the list with summary contains the given value.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@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(["timeReleased", "summary"]), help=u"""The field to sort AnnouncementSummary by. Only one sort order may be provided. If no value is specified _timeReleased_ is default.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'AnnouncementCollection'}) +@cli_util.wrap_exceptions +def list_announcements(ctx, from_json, all_pages, page_size, summary_contains, display_name, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if summary_contains is not None: + kwargs['summary_contains'] = summary_contains + if display_name is not None: + kwargs['display_name'] = display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_announcements, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_announcements, + limit, + page_size, + **kwargs + ) + else: + result = client.list_announcements( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_credential_collection_group.command(name=cli_util.override('fleet_apps_management.list_fleet_credentials.command_name', 'list-fleet-credentials'), help=u"""Returns a list of FleetCredentials. \n[Command Reference](listFleetCredentials)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@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(["ACTIVE", "DELETED", "FAILED"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--credential-level', type=custom_types.CliCaseInsensitiveChoice(["TARGET"]), help=u"""Credential Level.""") +@cli_util.option('--id', help=u"""unique FleetCredential identifier""") +@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': 'fleet_apps_management', 'class': 'FleetCredentialCollection'}) +@cli_util.wrap_exceptions +def list_fleet_credentials(ctx, from_json, all_pages, page_size, fleet_id, compartment_id, lifecycle_state, display_name, credential_level, id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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 credential_level is not None: + kwargs['credential_level'] = credential_level + 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('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_fleet_credentials, + fleet_id=fleet_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_fleet_credentials, + limit, + page_size, + fleet_id=fleet_id, + **kwargs + ) + else: + result = client.list_fleet_credentials( + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_product_collection_group.command(name=cli_util.override('fleet_apps_management.list_fleet_products.command_name', 'list-fleet-products'), help=u"""Returns a list of FleetProducts. \n[Command Reference](listFleetProducts)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--compartment-id', help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--resource-id', help=u"""Resource Identifier""") +@cli_util.option('--resource-display-name', help=u"""Resource Display Name""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@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(["displayName", "resourceDisplayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for displayName and resourceDisplayName 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': 'fleet_apps_management', 'class': 'FleetProductCollection'}) +@cli_util.wrap_exceptions +def list_fleet_products(ctx, from_json, all_pages, page_size, fleet_id, compartment_id, resource_id, resource_display_name, display_name, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if resource_id is not None: + kwargs['resource_id'] = resource_id + if resource_display_name is not None: + kwargs['resource_display_name'] = resource_display_name + if display_name is not None: + kwargs['display_name'] = display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_fleet_products, + fleet_id=fleet_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_fleet_products, + limit, + page_size, + fleet_id=fleet_id, + **kwargs + ) + else: + result = client.list_fleet_products( + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_property_collection_group.command(name=cli_util.override('fleet_apps_management.list_fleet_properties.command_name', 'list-fleet-properties'), help=u"""Returns a list of FleetProperties. \n[Command Reference](listFleetProperties)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@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(["ACTIVE", "DELETED", "FAILED"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--id', help=u"""unique FleetProperty identifier""") +@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': 'fleet_apps_management', 'class': 'FleetPropertyCollection'}) +@cli_util.wrap_exceptions +def list_fleet_properties(ctx, from_json, all_pages, page_size, fleet_id, compartment_id, lifecycle_state, display_name, id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_fleet_properties, + fleet_id=fleet_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_fleet_properties, + limit, + page_size, + fleet_id=fleet_id, + **kwargs + ) + else: + result = client.list_fleet_properties( + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_resource_collection_group.command(name=cli_util.override('fleet_apps_management.list_fleet_resources.command_name', 'list-fleet-resources'), help=u"""Returns a list of FleetResources. \n[Command Reference](listFleetResources)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--tenancy-id', help=u"""Resource Tenancy Id""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED", "FAILED", "NEEDS_ATTENTION"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--id', help=u"""unique FleetResource identifier""") +@cli_util.option('--fleet-resource-type', help=u"""A filter to return resources that match the Type""") +@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': 'fleet_apps_management', 'class': 'FleetResourceCollection'}) +@cli_util.wrap_exceptions +def list_fleet_resources(ctx, from_json, all_pages, page_size, fleet_id, tenancy_id, lifecycle_state, display_name, id, fleet_resource_type, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + if tenancy_id is not None: + kwargs['tenancy_id'] = tenancy_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 fleet_resource_type is not None: + kwargs['fleet_resource_type'] = fleet_resource_type + 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('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_fleet_resources, + fleet_id=fleet_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_fleet_resources, + limit, + page_size, + fleet_id=fleet_id, + **kwargs + ) + else: + result = client.list_fleet_resources( + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_target_collection_group.command(name=cli_util.override('fleet_apps_management.list_fleet_targets.command_name', 'list-fleet-targets'), help=u"""Returns a list of FleetTargets. \n[Command Reference](listFleetTargets)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--product', help=u"""Product Name""") +@cli_util.option('--resource-id', help=u"""Resource Identifier""") +@cli_util.option('--resource-display-name', help=u"""Resource Display Name""") +@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(["displayName", "product", "resourceDisplayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for displayName,product and resourceDisplayName 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': 'fleet_apps_management', 'class': 'FleetTargetCollection'}) +@cli_util.wrap_exceptions +def list_fleet_targets(ctx, from_json, all_pages, page_size, fleet_id, display_name, product, resource_id, resource_display_name, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + if display_name is not None: + kwargs['display_name'] = display_name + if product is not None: + kwargs['product'] = product + if resource_id is not None: + kwargs['resource_id'] = resource_id + if resource_display_name is not None: + kwargs['resource_display_name'] = resource_display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_fleet_targets, + fleet_id=fleet_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_fleet_targets, + limit, + page_size, + fleet_id=fleet_id, + **kwargs + ) + else: + result = client.list_fleet_targets( + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_collection_group.command(name=cli_util.override('fleet_apps_management.list_fleets.command_name', 'list-fleets'), help=u"""Returns a list of Fleets in the specified Tenancy. \n[Command Reference](listFleets)""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", "UPDATING", "NEEDS_ATTENTION"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--compartment-id', help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--fleet-type', type=custom_types.CliCaseInsensitiveChoice(["PRODUCT", "ENVIRONMENT", "GENERIC", "GROUP"]), help=u"""A filter to return only resources their fleetType matches the given fleetType.""") +@cli_util.option('--application-type', help=u"""A filter to return only resources that match the Application Type given.""") +@cli_util.option('--product', help=u"""A filter to return only resources that match the Product Type given.""") +@cli_util.option('--environment-type', help=u"""A filter to return only resources that match the Environment Type given.""") +@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"""unique Fleet identifier""") +@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': 'fleet_apps_management', 'class': 'FleetCollection'}) +@cli_util.wrap_exceptions +def list_fleets(ctx, from_json, all_pages, page_size, lifecycle_state, compartment_id, fleet_type, application_type, product, environment_type, display_name, id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if fleet_type is not None: + kwargs['fleet_type'] = fleet_type + if application_type is not None: + kwargs['application_type'] = application_type + if product is not None: + kwargs['product'] = product + if environment_type is not None: + kwargs['environment_type'] = environment_type + 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('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_fleets, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_fleets, + limit, + page_size, + **kwargs + ) + else: + result = client.list_fleets( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@inventory_resource_collection_group.command(name=cli_util.override('fleet_apps_management.list_inventory_resources.command_name', 'list-inventory-resources'), help=u"""Returns a list of InventoryResources. \n[Command Reference](listInventoryResources)""") +@cli_util.option('--compartment-id', required=True, help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--resource-compartment-id', required=True, help=u"""Resource Compartment ID""") +@cli_util.option('--lifecycle-state', help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--resource-region', help=u"""Resource Region""") +@cli_util.option('--defined-tag-equals', multiple=True, help=u"""A list of tag filters to apply. Only resources with a defined tag matching the value will be returned. Each item in the list has the format \"{namespace}.{tagName}={value}\". All inputs are case-insensitive. Multiple values for the same key (i.e. same namespace and tag name) are interpreted as \"OR\". Values for different keys (i.e. different namespaces, different tag names, or both) are interpreted as \"AND\".""") +@cli_util.option('--freeform-tag-equals', multiple=True, help=u"""A list of tag filters to apply. Only resources with a freeform tag matching the value will be returned. The key for each tag is \"{tagName}.{value}\". All inputs are case-insensitive. Multiple values for the same tag name are interpreted as \"OR\". Values for different tag names are interpreted as \"AND\".""") +@cli_util.option('--inventory-properties', multiple=True, help=u"""A list of inventory properties filters to apply. The key for each inventory property and value for each resource type is \"{resourceType}.{inventoryProperty}={value}\".""") +@cli_util.option('--matching-criteria', help=u"""Fetch resources matching matching ANY or ALL criteria passed as params in \"tags\" and \"inventoryProperties\"""") +@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({'defined-tag-equals': {'module': 'fleet_apps_management', 'class': 'list[string]'}, 'freeform-tag-equals': {'module': 'fleet_apps_management', 'class': 'list[string]'}, 'inventory-properties': {'module': 'fleet_apps_management', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tag-equals': {'module': 'fleet_apps_management', 'class': 'list[string]'}, 'freeform-tag-equals': {'module': 'fleet_apps_management', 'class': 'list[string]'}, 'inventory-properties': {'module': 'fleet_apps_management', 'class': 'list[string]'}}, output_type={'module': 'fleet_apps_management', 'class': 'InventoryResourceCollection'}) +@cli_util.wrap_exceptions +def list_inventory_resources(ctx, from_json, all_pages, page_size, compartment_id, resource_compartment_id, lifecycle_state, display_name, resource_region, defined_tag_equals, freeform_tag_equals, inventory_properties, matching_criteria, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if resource_region is not None: + kwargs['resource_region'] = resource_region + if defined_tag_equals is not None and len(defined_tag_equals) > 0: + kwargs['defined_tag_equals'] = defined_tag_equals + if freeform_tag_equals is not None and len(freeform_tag_equals) > 0: + kwargs['freeform_tag_equals'] = freeform_tag_equals + if inventory_properties is not None and len(inventory_properties) > 0: + kwargs['inventory_properties'] = inventory_properties + if matching_criteria is not None: + kwargs['matching_criteria'] = matching_criteria + 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('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_inventory_resources, + compartment_id=compartment_id, + resource_compartment_id=resource_compartment_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_inventory_resources, + limit, + page_size, + compartment_id=compartment_id, + resource_compartment_id=resource_compartment_id, + **kwargs + ) + else: + result = client.list_inventory_resources( + compartment_id=compartment_id, + resource_compartment_id=resource_compartment_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_target_collection_group.command(name=cli_util.override('fleet_apps_management.list_targets.command_name', 'list-targets'), help=u"""Returns a list of FleetTargets. \n[Command Reference](listTargets)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@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': 'fleet_apps_management', 'class': 'FleetTargetCollection'}) +@cli_util.wrap_exceptions +def list_targets(ctx, from_json, all_pages, page_size, fleet_id, display_name, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + if display_name is not None: + kwargs['display_name'] = display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_targets, + fleet_id=fleet_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_targets, + limit, + page_size, + fleet_id=fleet_id, + **kwargs + ) + else: + result = client.list_targets( + fleet_id=fleet_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_error_group.command(name=cli_util.override('fleet_apps_management.list_work_request_errors.command_name', 'list'), help=u"""Returns a (paginated) list of errors for the work request with the given ID. \n[Command Reference](listWorkRequestErrors)""") +@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timestamp"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timestamp is descending.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@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': 'fleet_apps_management', 'class': 'WorkRequestErrorCollection'}) +@cli_util.wrap_exceptions +def list_work_request_errors(ctx, from_json, all_pages, page_size, work_request_id, page, limit, sort_by, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_request_errors, + work_request_id=work_request_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_work_request_errors, + limit, + page_size, + work_request_id=work_request_id, + **kwargs + ) + else: + result = client.list_work_request_errors( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_log_entry_group.command(name=cli_util.override('fleet_apps_management.list_work_request_logs.command_name', 'list-work-request-logs'), help=u"""Returns a (paginated) list of logs for the work request with the given ID. \n[Command Reference](listWorkRequestLogs)""") +@cli_util.option('--work-request-id', required=True, help=u"""The ID of the asynchronous request.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timestamp"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timestamp is descending.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@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': 'fleet_apps_management', 'class': 'WorkRequestLogEntryCollection'}) +@cli_util.wrap_exceptions +def list_work_request_logs(ctx, from_json, all_pages, page_size, work_request_id, page, limit, sort_by, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0: + raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string') + + kwargs = {} + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_request_logs, + work_request_id=work_request_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_work_request_logs, + limit, + page_size, + work_request_id=work_request_id, + **kwargs + ) + else: + result = client.list_work_request_logs( + work_request_id=work_request_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@work_request_group.command(name=cli_util.override('fleet_apps_management.list_work_requests.command_name', 'list'), help=u"""Lists the work requests in a compartment. \n[Command Reference](listWorkRequests)""") +@cli_util.option('--compartment-id', help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--work-request-id', help=u"""The ID of the asynchronous work request.""") +@cli_util.option('--status', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help=u"""A filter to return only resources their lifecycleState matches the given OperationStatus.""") +@cli_util.option('--resource-id', help=u"""Resource Identifier""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeAccepted"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeAccepted is descending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'WorkRequestSummaryCollection'}) +@cli_util.wrap_exceptions +def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, work_request_id, status, resource_id, page, limit, sort_order, sort_by): + + 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 work_request_id is not None: + kwargs['work_request_id'] = work_request_id + if status is not None: + kwargs['status'] = status + if resource_id is not None: + kwargs['resource_id'] = resource_id + if page is not None: + kwargs['page'] = page + if limit is not None: + kwargs['limit'] = limit + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_work_requests, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_work_requests, + limit, + page_size, + **kwargs + ) + else: + result = client.list_work_requests( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.request_resource_validation.command_name', 'request-resource-validation'), help=u"""Request validation for resources with in a fleet \n[Command Reference](requestResourceValidation)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--is-applicable-to-all-resources', type=click.BOOL, help=u"""A boolean flag which decides if all resources within the fleet should be part of vaidation.""") +@cli_util.option('--resource-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Resource OCIDS that need to be included for validation.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'resource-ids': {'module': 'fleet_apps_management', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'resource-ids': {'module': 'fleet_apps_management', 'class': 'list[string]'}}) +@cli_util.wrap_exceptions +def request_resource_validation(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_id, is_applicable_to_all_resources, resource_ids): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if is_applicable_to_all_resources is not None: + _details['isApplicableToAllResources'] = is_applicable_to_all_resources + + if resource_ids is not None: + _details['resourceIds'] = cli_util.parse_json_parameter("resource_ids", resource_ids) + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.request_resource_validation( + fleet_id=fleet_id, + request_resource_validation_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) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.request_target_discovery.command_name', 'request-target-discovery'), help=u"""Confirm targets to be managed for a Fleet.Only targets that are confirmed will be managed by FAMS \n[Command Reference](requestTargetDiscovery)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--is-applicable-to-all-resources', type=click.BOOL, help=u"""A boolean flag which decides if all resources within the fleet should be part of discovery.""") +@cli_util.option('--resource-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Resource OCIDS that need to be included for discovery.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'resource-ids': {'module': 'fleet_apps_management', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'resource-ids': {'module': 'fleet_apps_management', 'class': 'list[string]'}}) +@cli_util.wrap_exceptions +def request_target_discovery(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_id, is_applicable_to_all_resources, resource_ids): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if is_applicable_to_all_resources is not None: + _details['isApplicableToAllResources'] = is_applicable_to_all_resources + + if resource_ids is not None: + _details['resourceIds'] = cli_util.parse_json_parameter("resource_ids", resource_ids) + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.request_target_discovery( + fleet_id=fleet_id, + request_target_discovery_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) + + +@fleet_group.command(name=cli_util.override('fleet_apps_management.update_fleet.command_name', 'update'), help=u"""Updates the Fleet \n[Command Reference](updateFleet)""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--description', help=u"""A user-friendly description. To provide some insight about the resource. Avoid entering confidential information.""") +@cli_util.option('--notification-preferences', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--rule-selection-criteria', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-target-auto-confirm', type=click.BOOL, help=u"""A value which represents if auto confirming of the targets can be enabled""") +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", "UPDATING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'notification-preferences': {'module': 'fleet_apps_management', 'class': 'NotificationPreferences'}, 'rule-selection-criteria': {'module': 'fleet_apps_management', 'class': 'SelectionCriteria'}, 'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'notification-preferences': {'module': 'fleet_apps_management', 'class': 'NotificationPreferences'}, 'rule-selection-criteria': {'module': 'fleet_apps_management', 'class': 'SelectionCriteria'}, 'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'fleet_apps_management', 'class': 'Fleet'}) +@cli_util.wrap_exceptions +def update_fleet(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_id, display_name, description, notification_preferences, rule_selection_criteria, is_target_auto_confirm, freeform_tags, defined_tags, if_match): + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + if not force: + if notification_preferences or rule_selection_criteria or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to notification-preferences and rule-selection-criteria 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 notification_preferences is not None: + _details['notificationPreferences'] = cli_util.parse_json_parameter("notification_preferences", notification_preferences) + + if rule_selection_criteria is not None: + _details['ruleSelectionCriteria'] = cli_util.parse_json_parameter("rule_selection_criteria", rule_selection_criteria) + + if is_target_auto_confirm is not None: + _details['isTargetAutoConfirm'] = is_target_auto_confirm + + 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('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.update_fleet( + fleet_id=fleet_id, + update_fleet_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_fleet') and callable(getattr(client, 'get_fleet')): + 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_fleet(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) + + +@fleet_credential_group.command(name=cli_util.override('fleet_apps_management.update_fleet_credential.command_name', 'update'), help=u"""Updates the FleetCredential \n[Command Reference](updateFleetCredential)""") +@cli_util.option('--fleet-credential-id', required=True, help=u"""unique FleetCredential identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--entity-specifics', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--user', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--password', 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('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'entity-specifics': {'module': 'fleet_apps_management', 'class': 'CredentialEntitySpecificDetails'}, 'user': {'module': 'fleet_apps_management', 'class': 'CredentialDetails'}, 'password': {'module': 'fleet_apps_management', 'class': 'CredentialDetails'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'entity-specifics': {'module': 'fleet_apps_management', 'class': 'CredentialEntitySpecificDetails'}, 'user': {'module': 'fleet_apps_management', 'class': 'CredentialDetails'}, 'password': {'module': 'fleet_apps_management', 'class': 'CredentialDetails'}}) +@cli_util.wrap_exceptions +def update_fleet_credential(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_credential_id, fleet_id, display_name, entity_specifics, user, password, if_match): + + if isinstance(fleet_credential_id, six.string_types) and len(fleet_credential_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-credential-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-id cannot be whitespace or empty string') + if not force: + if entity_specifics or user or password: + if not click.confirm("WARNING: Updates to entity-specifics and user and password 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 entity_specifics is not None: + _details['entitySpecifics'] = cli_util.parse_json_parameter("entity_specifics", entity_specifics) + + if user is not None: + _details['user'] = cli_util.parse_json_parameter("user", user) + + if password is not None: + _details['password'] = cli_util.parse_json_parameter("password", password) + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.update_fleet_credential( + fleet_credential_id=fleet_credential_id, + fleet_id=fleet_id, + update_fleet_credential_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + if 'opc-work-request-id' not in result.headers: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state') + cli_util.render_response(result, ctx) + return + + click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) + + +@fleet_property_group.command(name=cli_util.override('fleet_apps_management.update_fleet_property.command_name', 'update'), help=u"""Updates the FleetProperty \n[Command Reference](updateFleetProperty)""") +@cli_util.option('--fleet-property-id', required=True, help=u"""unique FleetProperty identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--value', help=u"""Value of the Property""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "DELETED", "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 SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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': 'fleet_apps_management', 'class': 'FleetProperty'}) +@cli_util.wrap_exceptions +def update_fleet_property(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_property_id, fleet_id, value, if_match): + + if isinstance(fleet_property_id, six.string_types) and len(fleet_property_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-property-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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 value is not None: + _details['value'] = value + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.update_fleet_property( + fleet_property_id=fleet_property_id, + fleet_id=fleet_id, + update_fleet_property_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_fleet_property') and callable(getattr(client, 'get_fleet_property')): + 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_fleet_property(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) + + +@fleet_resource_group.command(name=cli_util.override('fleet_apps_management.update_fleet_resource.command_name', 'update'), help=u"""Updates the FleetResource \n[Command Reference](updateFleetResource)""") +@cli_util.option('--fleet-resource-id', required=True, help=u"""unique FleetResource identifier""") +@cli_util.option('--fleet-id', required=True, help=u"""unique Fleet identifier""") +@cli_util.option('--tenancy-id', help=u"""OCID of the tenancy to which the resource belongs to.""") +@cli_util.option('--compartment-id', help=u"""OCID of the compartment to which the resource belongs to.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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 update_fleet_resource(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, fleet_resource_id, fleet_id, tenancy_id, compartment_id, if_match): + + if isinstance(fleet_resource_id, six.string_types) and len(fleet_resource_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-resource-id cannot be whitespace or empty string') + + if isinstance(fleet_id, six.string_types) and len(fleet_id.strip()) == 0: + raise click.UsageError('Parameter --fleet-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 tenancy_id is not None: + _details['tenancyId'] = tenancy_id + + if compartment_id is not None: + _details['compartmentId'] = compartment_id + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management', ctx) + result = client.update_fleet_resource( + fleet_resource_id=fleet_resource_id, + fleet_id=fleet_id, + update_fleet_resource_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) diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/client_mappings.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/client_mappings.py new file mode 100644 index 000000000..2b69996b4 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/client_mappings.py @@ -0,0 +1,14 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +import oci +from oci_cli.cli_clients import CLIENT_MAP +from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS +from oci.fleet_apps_management import FleetAppsManagementAdminClient + +MODULE_TO_TYPE_MAPPINGS["fleet_apps_management"] = oci.fleet_apps_management.models.fleet_apps_management_type_mapping +if CLIENT_MAP.get("fleet_apps_management") is None: + CLIENT_MAP["fleet_apps_management"] = {} +CLIENT_MAP["fleet_apps_management"]["fleet_apps_management_admin"] = FleetAppsManagementAdminClient diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/fleetappsmanagementadmin_cli.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/fleetappsmanagementadmin_cli.py new file mode 100644 index 000000000..ccae0dda6 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_admin/generated/fleetappsmanagementadmin_cli.py @@ -0,0 +1,523 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +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.fleet_apps_management.src.oci_cli_fleet_apps_management.generated import fleet_apps_management_service_cli + + +@click.command(cli_util.override('fleet_apps_management_admin.fleet_apps_management_admin_root_group.command_name', 'fleet-apps-management-admin'), cls=CommandGroupWithAlias, help=cli_util.override('fleet_apps_management_admin.fleet_apps_management_admin_root_group.help', """Fleet Application Management Service API. Use this API to for all FAMS related activities. +To manage fleets,view complaince report for the Fleet,scedule patches and other lifecycle activities"""), short_help=cli_util.override('fleet_apps_management_admin.fleet_apps_management_admin_root_group.short_help', """Fleet Application Management Service API""")) +@cli_util.help_option_group +def fleet_apps_management_admin_root_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_admin.property_collection_group.command_name', 'property-collection'), cls=CommandGroupWithAlias, help="""Results of a property search. Contains boh PropertySummary items and other information, such as metadata.""") +@cli_util.help_option_group +def property_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_admin.onboarding_collection_group.command_name', 'onboarding-collection'), cls=CommandGroupWithAlias, help="""List of FleetAppManagementService Onboardings.""") +@cli_util.help_option_group +def onboarding_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_admin.property_group.command_name', 'property'), cls=CommandGroupWithAlias, help="""Taxonomy metadata aka Property .""") +@cli_util.help_option_group +def property_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_admin.onboarding_group.command_name', 'onboarding'), cls=CommandGroupWithAlias, help="""FleetAppManagementService onboarding resource.""") +@cli_util.help_option_group +def onboarding_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_admin.onboarding_policy_collection_group.command_name', 'onboarding-policy-collection'), cls=CommandGroupWithAlias, help="""List of FleetAppManagementService Onboard policies.""") +@cli_util.help_option_group +def onboarding_policy_collection_group(): + pass + + +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_apps_management_admin_root_group) +fleet_apps_management_admin_root_group.add_command(property_collection_group) +fleet_apps_management_admin_root_group.add_command(onboarding_collection_group) +fleet_apps_management_admin_root_group.add_command(property_group) +fleet_apps_management_admin_root_group.add_command(onboarding_group) +fleet_apps_management_admin_root_group.add_command(onboarding_policy_collection_group) + + +@onboarding_group.command(name=cli_util.override('fleet_apps_management_admin.create_onboarding.command_name', 'create'), help=u"""Onboard a tenant to Fleet Application Management Service \n[Command Reference](createOnboarding)""") +@cli_util.option('--compartment-id', required=True, help=u"""Tenancy OCID""") +@cli_util.option('--is-fams-tag-enabled', type=click.BOOL, help=u"""A value determining FAMS tag is enabled or not""") +@cli_util.option('--is-cost-tracking-tag-enabled', type=click.BOOL, help=u"""A value determining if cost tracking tag is enabled or not""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'Onboarding'}) +@cli_util.wrap_exceptions +def create_onboarding(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, is_fams_tag_enabled, is_cost_tracking_tag_enabled): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + + if is_fams_tag_enabled is not None: + _details['isFamsTagEnabled'] = is_fams_tag_enabled + + if is_cost_tracking_tag_enabled is not None: + _details['isCostTrackingTagEnabled'] = is_cost_tracking_tag_enabled + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management_admin', ctx) + result = client.create_onboarding( + create_onboarding_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) + + +@property_group.command(name=cli_util.override('fleet_apps_management_admin.create_property.command_name', 'create'), help=u"""Creates a new Property. \n[Command Reference](createProperty)""") +@cli_util.option('--compartment-id', required=True, help=u"""Tenancy OCID""") +@cli_util.option('--selection', required=True, type=custom_types.CliCaseInsensitiveChoice(["SINGLE_CHOICE", "MULTI_CHOICE", "DEFAULT_TEXT"]), help=u"""Text selection of the category""") +@cli_util.option('--value-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["STRING", "NUMERIC"]), help=u"""Format of the value""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--values', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Values of the property (must be a single value if selection = 'single choice')""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "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 SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'values': {'module': 'fleet_apps_management', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'values': {'module': 'fleet_apps_management', 'class': 'list[string]'}}, output_type={'module': 'fleet_apps_management', 'class': 'Property'}) +@cli_util.wrap_exceptions +def create_property(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, selection, value_type, display_name, values): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + _details['selection'] = selection + _details['valueType'] = value_type + + if display_name is not None: + _details['displayName'] = display_name + + if values is not None: + _details['values'] = cli_util.parse_json_parameter("values", values) + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management_admin', ctx) + result = client.create_property( + create_property_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_property') and callable(getattr(client, 'get_property')): + 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_property(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) + + +@property_group.command(name=cli_util.override('fleet_apps_management_admin.delete_property.command_name', 'delete'), help=u"""Deletes a Property resource by identifier \n[Command Reference](deleteProperty)""") +@cli_util.option('--property-id', required=True, help=u"""unique Property identifier""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "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 SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_property(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, property_id, if_match): + + if isinstance(property_id, six.string_types) and len(property_id.strip()) == 0: + raise click.UsageError('Parameter --property-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('fleet_apps_management', 'fleet_apps_management_admin', ctx) + result = client.delete_property( + property_id=property_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_property') and callable(getattr(client, 'get_property')): + 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_property(property_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) + + +@property_group.command(name=cli_util.override('fleet_apps_management_admin.get_property.command_name', 'get'), help=u"""Gets a Property by identifier \n[Command Reference](getProperty)""") +@cli_util.option('--property-id', required=True, help=u"""unique Property identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'Property'}) +@cli_util.wrap_exceptions +def get_property(ctx, from_json, property_id): + + if isinstance(property_id, six.string_types) and len(property_id.strip()) == 0: + raise click.UsageError('Parameter --property-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('fleet_apps_management', 'fleet_apps_management_admin', ctx) + result = client.get_property( + property_id=property_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@onboarding_policy_collection_group.command(name=cli_util.override('fleet_apps_management_admin.list_onboarding_policies.command_name', 'list-onboarding-policies'), help=u"""Returns a list of onboarding policy information for FAMS. \n[Command Reference](listOnboardingPolicies)""") +@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"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'OnboardingPolicyCollection'}) +@cli_util.wrap_exceptions +def list_onboarding_policies(ctx, from_json, all_pages, page_size, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if 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('fleet_apps_management', 'fleet_apps_management_admin', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_onboarding_policies, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_onboarding_policies, + limit, + page_size, + **kwargs + ) + else: + result = client.list_onboarding_policies( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@onboarding_collection_group.command(name=cli_util.override('fleet_apps_management_admin.list_onboardings.command_name', 'list-onboardings'), help=u"""Returns a list of onboarding information for the Tenancy. \n[Command Reference](listOnboardings)""") +@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(["ACTIVE", "INACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", "UPDATING", "NEEDS_ATTENTION"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--id', help=u"""unique onboarding identifier""") +@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': 'fleet_apps_management', 'class': 'OnboardingCollection'}) +@cli_util.wrap_exceptions +def list_onboardings(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + 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('fleet_apps_management', 'fleet_apps_management_admin', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_onboardings, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_onboardings, + limit, + page_size, + **kwargs + ) + else: + result = client.list_onboardings( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@property_collection_group.command(name=cli_util.override('fleet_apps_management_admin.list_properties.command_name', 'list-properties'), help=u"""Returns a list of Properties for Tenancy. \n[Command Reference](listProperties)""") +@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(["ACTIVE", "DELETED", "FAILED"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--id', help=u"""unique Property identifier""") +@cli_util.option('--scope', type=custom_types.CliCaseInsensitiveChoice(["TAXONOMY", "PLATFORM_CONFIG"]), help=u"""A filter to return only resources their scope matches the given lifecycleState.""") +@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return.""") +@cli_util.option('--page', help=u"""A token representing the position at which to start retrieving results. This must come from the `opc-next-page` header field of a previous response.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'PropertyCollection'}) +@cli_util.wrap_exceptions +def list_properties(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, scope, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if id is not None: + kwargs['id'] = id + if scope is not None: + kwargs['scope'] = scope + 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('fleet_apps_management', 'fleet_apps_management_admin', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_properties, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_properties, + limit, + page_size, + **kwargs + ) + else: + result = client.list_properties( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@property_group.command(name=cli_util.override('fleet_apps_management_admin.update_property.command_name', 'update'), help=u"""Updates the Property \n[Command Reference](updateProperty)""") +@cli_util.option('--property-id', required=True, help=u"""unique Property identifier""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--selection', type=custom_types.CliCaseInsensitiveChoice(["SINGLE_CHOICE", "MULTI_CHOICE", "DEFAULT_TEXT"]), help=u"""Text selection of the category""") +@cli_util.option('--value-type', type=custom_types.CliCaseInsensitiveChoice(["STRING", "NUMERIC"]), help=u"""Format of the value""") +@cli_util.option('--values', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Values of the property (must be a single value if selection = 'single choice')""" + 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", "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 SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'values': {'module': 'fleet_apps_management', 'class': 'list[string]'}}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'values': {'module': 'fleet_apps_management', 'class': 'list[string]'}}, output_type={'module': 'fleet_apps_management', 'class': 'Property'}) +@cli_util.wrap_exceptions +def update_property(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, property_id, display_name, selection, value_type, values, if_match): + + if isinstance(property_id, six.string_types) and len(property_id.strip()) == 0: + raise click.UsageError('Parameter --property-id cannot be whitespace or empty string') + if not force: + if values: + if not click.confirm("WARNING: Updates to values 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 selection is not None: + _details['selection'] = selection + + if value_type is not None: + _details['valueType'] = value_type + + if values is not None: + _details['values'] = cli_util.parse_json_parameter("values", values) + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management_admin', ctx) + result = client.update_property( + property_id=property_id, + update_property_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_property') and callable(getattr(client, 'get_property')): + 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_property(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/client_mappings.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/client_mappings.py new file mode 100644 index 000000000..24dc19951 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/client_mappings.py @@ -0,0 +1,14 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +import oci +from oci_cli.cli_clients import CLIENT_MAP +from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS +from oci.fleet_apps_management import FleetAppsManagementMaintenanceWindowClient + +MODULE_TO_TYPE_MAPPINGS["fleet_apps_management"] = oci.fleet_apps_management.models.fleet_apps_management_type_mapping +if CLIENT_MAP.get("fleet_apps_management") is None: + CLIENT_MAP["fleet_apps_management"] = {} +CLIENT_MAP["fleet_apps_management"]["fleet_apps_management_maintenance_window"] = FleetAppsManagementMaintenanceWindowClient diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/fleetappsmanagementmaintenancewindow_cli.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/fleetappsmanagementmaintenancewindow_cli.py new file mode 100644 index 000000000..1822f5922 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_maintenance_window/generated/fleetappsmanagementmaintenancewindow_cli.py @@ -0,0 +1,383 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +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.fleet_apps_management.src.oci_cli_fleet_apps_management.generated import fleet_apps_management_service_cli + + +@click.command(cli_util.override('fleet_apps_management_maintenance_window.fleet_apps_management_maintenance_window_root_group.command_name', 'fleet-apps-management-maintenance-window'), cls=CommandGroupWithAlias, help=cli_util.override('fleet_apps_management_maintenance_window.fleet_apps_management_maintenance_window_root_group.help', """Fleet Application Management Service API. Use this API to for all FAMS related activities. +To manage fleets,view complaince report for the Fleet,scedule patches and other lifecycle activities"""), short_help=cli_util.override('fleet_apps_management_maintenance_window.fleet_apps_management_maintenance_window_root_group.short_help', """Fleet Application Management Service API""")) +@cli_util.help_option_group +def fleet_apps_management_maintenance_window_root_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_maintenance_window.maintenance_window_group.command_name', 'maintenance-window'), cls=CommandGroupWithAlias, help="""Details of Maintenance Window.""") +@cli_util.help_option_group +def maintenance_window_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_maintenance_window.maintenance_window_collection_group.command_name', 'maintenance-window-collection'), cls=CommandGroupWithAlias, help="""Results of a maintenanceWindow search. Contains boh MaintenanceWindowSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def maintenance_window_collection_group(): + pass + + +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_apps_management_maintenance_window_root_group) +fleet_apps_management_maintenance_window_root_group.add_command(maintenance_window_group) +fleet_apps_management_maintenance_window_root_group.add_command(maintenance_window_collection_group) + + +@maintenance_window_group.command(name=cli_util.override('fleet_apps_management_maintenance_window.create_maintenance_window.command_name', 'create'), help=u"""Creates a new MaintenanceWindow. \n[Command Reference](createMaintenanceWindow)""") +@cli_util.option('--compartment-id', required=True, help=u"""Tenancy OCID""") +@cli_util.option('--duration', required=True, help=u"""Duration if schedule type is Custom""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--description', help=u"""A user-friendly description. To provide some insight about the resource. Avoid entering confidential information.""") +@cli_util.option('--is-outage', type=click.BOOL, help=u"""Does the maintenenace window cause outage?""") +@cli_util.option('--maintenance-window-type', type=custom_types.CliCaseInsensitiveChoice(["OPEN_ENDED"]), help=u"""Type of maintenenace window""") +@cli_util.option('--time-schedule-start', type=custom_types.CLI_DATETIME, help=u"""Start time of schedule""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--is-recurring', type=click.BOOL, help=u"""Is this is a recurring maintenance window""") +@cli_util.option('--recurrences', help=u"""Recurrence rule specification if recurring""") +@cli_util.option('--task-initiation-cutoff', type=click.INT, help=u"""Task initiation cutoff""") +@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(["ACTIVE", "DELETED", "FAILED", "DELETING", "UPDATING", "NEEDS_ATTENTION"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', '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': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'fleet_apps_management', 'class': 'MaintenanceWindow'}) +@cli_util.wrap_exceptions +def create_maintenance_window(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, duration, display_name, description, is_outage, maintenance_window_type, time_schedule_start, is_recurring, recurrences, task_initiation_cutoff, freeform_tags, defined_tags): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + _details['duration'] = duration + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if is_outage is not None: + _details['isOutage'] = is_outage + + if maintenance_window_type is not None: + _details['maintenanceWindowType'] = maintenance_window_type + + if time_schedule_start is not None: + _details['timeScheduleStart'] = time_schedule_start + + if is_recurring is not None: + _details['isRecurring'] = is_recurring + + if recurrences is not None: + _details['recurrences'] = recurrences + + if task_initiation_cutoff is not None: + _details['taskInitiationCutoff'] = task_initiation_cutoff + + 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('fleet_apps_management', 'fleet_apps_management_maintenance_window', ctx) + result = client.create_maintenance_window( + create_maintenance_window_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_maintenance_window') and callable(getattr(client, 'get_maintenance_window')): + 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_maintenance_window(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) + + +@maintenance_window_group.command(name=cli_util.override('fleet_apps_management_maintenance_window.delete_maintenance_window.command_name', 'delete'), help=u"""Deletes a MaintenanceWindow resource by identifier \n[Command Reference](deleteMaintenanceWindow)""") +@cli_util.option('--maintenance-window-id', required=True, help=u"""unique MaintenanceWindow identifier""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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_maintenance_window(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, maintenance_window_id, if_match): + + if isinstance(maintenance_window_id, six.string_types) and len(maintenance_window_id.strip()) == 0: + raise click.UsageError('Parameter --maintenance-window-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('fleet_apps_management', 'fleet_apps_management_maintenance_window', ctx) + result = client.delete_maintenance_window( + maintenance_window_id=maintenance_window_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) + + +@maintenance_window_group.command(name=cli_util.override('fleet_apps_management_maintenance_window.get_maintenance_window.command_name', 'get'), help=u"""Gets a MaintenanceWindow by identifier \n[Command Reference](getMaintenanceWindow)""") +@cli_util.option('--maintenance-window-id', required=True, help=u"""unique MaintenanceWindow identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'MaintenanceWindow'}) +@cli_util.wrap_exceptions +def get_maintenance_window(ctx, from_json, maintenance_window_id): + + if isinstance(maintenance_window_id, six.string_types) and len(maintenance_window_id.strip()) == 0: + raise click.UsageError('Parameter --maintenance-window-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('fleet_apps_management', 'fleet_apps_management_maintenance_window', ctx) + result = client.get_maintenance_window( + maintenance_window_id=maintenance_window_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@maintenance_window_collection_group.command(name=cli_util.override('fleet_apps_management_maintenance_window.list_maintenance_windows.command_name', 'list-maintenance-windows'), help=u"""Returns a list of MaintenanceWindows in the specified Tenancy. \n[Command Reference](listMaintenanceWindows)""") +@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(["ACTIVE", "DELETED", "FAILED", "DELETING", "UPDATING", "NEEDS_ATTENTION"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--id', help=u"""unique MaintenanceWindow identifier""") +@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': 'fleet_apps_management', 'class': 'MaintenanceWindowCollection'}) +@cli_util.wrap_exceptions +def list_maintenance_windows(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if 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('fleet_apps_management', 'fleet_apps_management_maintenance_window', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_maintenance_windows, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_maintenance_windows, + limit, + page_size, + **kwargs + ) + else: + result = client.list_maintenance_windows( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@maintenance_window_group.command(name=cli_util.override('fleet_apps_management_maintenance_window.update_maintenance_window.command_name', 'update'), help=u"""Updates the MaintenanceWindow \n[Command Reference](updateMaintenanceWindow)""") +@cli_util.option('--maintenance-window-id', required=True, help=u"""unique MaintenanceWindow identifier""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--description', help=u"""A user-friendly description. To provide some insight about the resource. Avoid entering confidential information.""") +@cli_util.option('--maintenance-window-type', type=custom_types.CliCaseInsensitiveChoice(["OPEN_ENDED"]), help=u"""MaintenanceWindow Identifier""") +@cli_util.option('--is-outage', type=click.BOOL, help=u"""Does the maintenenace window cause outage?""") +@cli_util.option('--time-schedule-start', type=custom_types.CLI_DATETIME, help=u"""Start time of schedule""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--duration', help=u"""Duration if schedule type is Custom""") +@cli_util.option('--is-recurring', type=click.BOOL, help=u"""Is this is a recurring maintenance window""") +@cli_util.option('--recurrences', help=u"""Recurrence rule specification if recurring""") +@cli_util.option('--task-initiation-cutoff', type=click.INT, help=u"""Task initiation cutoff""") +@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", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', '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': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_maintenance_window(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, maintenance_window_id, display_name, description, maintenance_window_type, is_outage, time_schedule_start, duration, is_recurring, recurrences, task_initiation_cutoff, freeform_tags, defined_tags, if_match): + + if isinstance(maintenance_window_id, six.string_types) and len(maintenance_window_id.strip()) == 0: + raise click.UsageError('Parameter --maintenance-window-id cannot be whitespace or empty string') + if not force: + if freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if maintenance_window_type is not None: + _details['maintenanceWindowType'] = maintenance_window_type + + if is_outage is not None: + _details['isOutage'] = is_outage + + if time_schedule_start is not None: + _details['timeScheduleStart'] = time_schedule_start + + if duration is not None: + _details['duration'] = duration + + if is_recurring is not None: + _details['isRecurring'] = is_recurring + + if recurrences is not None: + _details['recurrences'] = recurrences + + if task_initiation_cutoff is not None: + _details['taskInitiationCutoff'] = task_initiation_cutoff + + 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('fleet_apps_management', 'fleet_apps_management_maintenance_window', ctx) + result = client.update_maintenance_window( + maintenance_window_id=maintenance_window_id, + update_maintenance_window_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) diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/client_mappings.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/client_mappings.py new file mode 100644 index 000000000..009a3904b --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/client_mappings.py @@ -0,0 +1,14 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +import oci +from oci_cli.cli_clients import CLIENT_MAP +from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS +from oci.fleet_apps_management import FleetAppsManagementOperationsClient + +MODULE_TO_TYPE_MAPPINGS["fleet_apps_management"] = oci.fleet_apps_management.models.fleet_apps_management_type_mapping +if CLIENT_MAP.get("fleet_apps_management") is None: + CLIENT_MAP["fleet_apps_management"] = {} +CLIENT_MAP["fleet_apps_management"]["fleet_apps_management_operations"] = FleetAppsManagementOperationsClient diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/fleetappsmanagementoperations_cli.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/fleetappsmanagementoperations_cli.py new file mode 100644 index 000000000..4fe553a89 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_operations/generated/fleetappsmanagementoperations_cli.py @@ -0,0 +1,871 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +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.fleet_apps_management.src.oci_cli_fleet_apps_management.generated import fleet_apps_management_service_cli + + +@click.command(cli_util.override('fleet_apps_management_operations.fleet_apps_management_operations_root_group.command_name', 'fleet-apps-management-operations'), cls=CommandGroupWithAlias, help=cli_util.override('fleet_apps_management_operations.fleet_apps_management_operations_root_group.help', """Fleet Application Management Service API. Use this API to for all FAMS related activities. +To manage fleets,view complaince report for the Fleet,scedule patches and other lifecycle activities"""), short_help=cli_util.override('fleet_apps_management_operations.fleet_apps_management_operations_root_group.short_help', """Fleet Application Management Service API""")) +@cli_util.help_option_group +def fleet_apps_management_operations_root_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_operations.scheduler_definition_group.command_name', 'scheduler-definition'), cls=CommandGroupWithAlias, help="""Definition of a Schedule.""") +@cli_util.help_option_group +def scheduler_definition_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_operations.scheduler_definition_collection_group.command_name', 'scheduler-definition-collection'), cls=CommandGroupWithAlias, help="""Results of a schedulerDefinition search. Contains boh SchedulerDefinitionSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def scheduler_definition_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_operations.execution_group.command_name', 'execution'), cls=CommandGroupWithAlias, help="""Task Execution associated with the Job.""") +@cli_util.help_option_group +def execution_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_operations.scheduler_job_collection_group.command_name', 'scheduler-job-collection'), cls=CommandGroupWithAlias, help="""Results of a schedulerJob search. Contains boh SchedulerJobSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def scheduler_job_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_operations.job_activity_group.command_name', 'job-activity'), cls=CommandGroupWithAlias, help="""Description of JobActivity.""") +@cli_util.help_option_group +def job_activity_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_operations.execution_collection_group.command_name', 'execution-collection'), cls=CommandGroupWithAlias, help="""Results of a""") +@cli_util.help_option_group +def execution_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_operations.scheduler_job_group.command_name', 'scheduler-job'), cls=CommandGroupWithAlias, help="""A SchedulerJob resource.""") +@cli_util.help_option_group +def scheduler_job_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_operations.scheduled_fleet_collection_group.command_name', 'scheduled-fleet-collection'), cls=CommandGroupWithAlias, help="""Results of a Scheduled ActionGroup search.""") +@cli_util.help_option_group +def scheduled_fleet_collection_group(): + pass + + +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_apps_management_operations_root_group) +fleet_apps_management_operations_root_group.add_command(scheduler_definition_group) +fleet_apps_management_operations_root_group.add_command(scheduler_definition_collection_group) +fleet_apps_management_operations_root_group.add_command(execution_group) +fleet_apps_management_operations_root_group.add_command(scheduler_job_collection_group) +fleet_apps_management_operations_root_group.add_command(job_activity_group) +fleet_apps_management_operations_root_group.add_command(execution_collection_group) +fleet_apps_management_operations_root_group.add_command(scheduler_job_group) +fleet_apps_management_operations_root_group.add_command(scheduled_fleet_collection_group) + + +@scheduler_definition_group.command(name=cli_util.override('fleet_apps_management_operations.create_scheduler_definition.command_name', 'create'), help=u"""Creates a new SchedulerDefinition. \n[Command Reference](createSchedulerDefinition)""") +@cli_util.option('--compartment-id', required=True, help=u"""Tenancy OCID""") +@cli_util.option('--schedule', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--action-groups', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""Action Groups associated with the Schedule.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--description', help=u"""A user-friendly description. To provide some insight about the resource. Avoid entering confidential information.""") +@cli_util.option('--activity-initiation-cut-off', type=click.INT, help=u"""Activity Initiation Cut Off""") +@cli_util.option('--run-books', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Runbooks. + +This option is a JSON list with items of type OperationRunbook. For documentation on OperationRunbook please see our API reference: https://docs.cloud.oracle.com/api/#/en/fleetappsmanagementoperations/20230831/datatypes/OperationRunbook.""" + 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", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'schedule': {'module': 'fleet_apps_management', 'class': 'Schedule'}, 'action-groups': {'module': 'fleet_apps_management', 'class': 'list[ActionGroup]'}, 'run-books': {'module': 'fleet_apps_management', 'class': 'list[OperationRunbook]'}, 'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', '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={'schedule': {'module': 'fleet_apps_management', 'class': 'Schedule'}, 'action-groups': {'module': 'fleet_apps_management', 'class': 'list[ActionGroup]'}, 'run-books': {'module': 'fleet_apps_management', 'class': 'list[OperationRunbook]'}, 'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'fleet_apps_management', 'class': 'SchedulerDefinition'}) +@cli_util.wrap_exceptions +def create_scheduler_definition(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, schedule, action_groups, display_name, description, activity_initiation_cut_off, run_books, freeform_tags, defined_tags): + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['compartmentId'] = compartment_id + _details['schedule'] = cli_util.parse_json_parameter("schedule", schedule) + _details['actionGroups'] = cli_util.parse_json_parameter("action_groups", action_groups) + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + if activity_initiation_cut_off is not None: + _details['activityInitiationCutOff'] = activity_initiation_cut_off + + if run_books is not None: + _details['runBooks'] = cli_util.parse_json_parameter("run_books", run_books) + + 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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.create_scheduler_definition( + create_scheduler_definition_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) + + +@scheduler_definition_group.command(name=cli_util.override('fleet_apps_management_operations.delete_scheduler_definition.command_name', 'delete'), help=u"""Deletes a SchedulerDefinition resource by identifier \n[Command Reference](deleteSchedulerDefinition)""") +@cli_util.option('--scheduler-definition-id', required=True, help=u"""unique SchedulerDefinition identifier""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "INACTIVE"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_scheduler_definition(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, scheduler_definition_id, if_match): + + if isinstance(scheduler_definition_id, six.string_types) and len(scheduler_definition_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-definition-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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.delete_scheduler_definition( + scheduler_definition_id=scheduler_definition_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_scheduler_definition') and callable(getattr(client, 'get_scheduler_definition')): + 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_scheduler_definition(scheduler_definition_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) + + +@scheduler_job_group.command(name=cli_util.override('fleet_apps_management_operations.delete_scheduler_job.command_name', 'delete'), help=u"""Deletes a SchedulerJob resource by identifier \n[Command Reference](deleteSchedulerJob)""") +@cli_util.option('--scheduler-job-id', required=True, help=u"""unique SchedulerJob identifier""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "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 SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_scheduler_job(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, scheduler_job_id, if_match): + + if isinstance(scheduler_job_id, six.string_types) and len(scheduler_job_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-job-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.delete_scheduler_job( + scheduler_job_id=scheduler_job_id, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_scheduler_job') and callable(getattr(client, 'get_scheduler_job')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + oci.wait_until(client, client.get_scheduler_job(scheduler_job_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) + + +@execution_group.command(name=cli_util.override('fleet_apps_management_operations.get_execution.command_name', 'get'), help=u"""Gets a JobActivity by identifier \n[Command Reference](getExecution)""") +@cli_util.option('--scheduler-job-id', required=True, help=u"""unique SchedulerJob identifier""") +@cli_util.option('--job-activity-id', required=True, help=u"""unique jobActivity identifier""") +@cli_util.option('--resource-id', required=True, help=u"""unique Resource identifier""") +@cli_util.option('--execution-id', required=True, help=u"""Execution Id""") +@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': 'fleet_apps_management', 'class': 'Execution'}) +@cli_util.wrap_exceptions +def get_execution(ctx, from_json, scheduler_job_id, job_activity_id, resource_id, execution_id): + + if isinstance(scheduler_job_id, six.string_types) and len(scheduler_job_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-job-id cannot be whitespace or empty string') + + if isinstance(job_activity_id, six.string_types) and len(job_activity_id.strip()) == 0: + raise click.UsageError('Parameter --job-activity-id cannot be whitespace or empty string') + + if isinstance(resource_id, six.string_types) and len(resource_id.strip()) == 0: + raise click.UsageError('Parameter --resource-id cannot be whitespace or empty string') + + if isinstance(execution_id, six.string_types) and len(execution_id.strip()) == 0: + raise click.UsageError('Parameter --execution-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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.get_execution( + scheduler_job_id=scheduler_job_id, + job_activity_id=job_activity_id, + resource_id=resource_id, + execution_id=execution_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@job_activity_group.command(name=cli_util.override('fleet_apps_management_operations.get_job_activity.command_name', 'get'), help=u"""Gets a JobActivity by identifier \n[Command Reference](getJobActivity)""") +@cli_util.option('--scheduler-job-id', required=True, help=u"""unique SchedulerJob identifier""") +@cli_util.option('--job-activity-id', required=True, help=u"""unique jobActivity identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'JobActivity'}) +@cli_util.wrap_exceptions +def get_job_activity(ctx, from_json, scheduler_job_id, job_activity_id): + + if isinstance(scheduler_job_id, six.string_types) and len(scheduler_job_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-job-id cannot be whitespace or empty string') + + if isinstance(job_activity_id, six.string_types) and len(job_activity_id.strip()) == 0: + raise click.UsageError('Parameter --job-activity-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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.get_job_activity( + scheduler_job_id=scheduler_job_id, + job_activity_id=job_activity_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@scheduler_definition_group.command(name=cli_util.override('fleet_apps_management_operations.get_scheduler_definition.command_name', 'get'), help=u"""Gets a SchedulerDefinition by identifier \n[Command Reference](getSchedulerDefinition)""") +@cli_util.option('--scheduler-definition-id', required=True, help=u"""unique SchedulerDefinition identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'SchedulerDefinition'}) +@cli_util.wrap_exceptions +def get_scheduler_definition(ctx, from_json, scheduler_definition_id): + + if isinstance(scheduler_definition_id, six.string_types) and len(scheduler_definition_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-definition-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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.get_scheduler_definition( + scheduler_definition_id=scheduler_definition_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@scheduler_job_group.command(name=cli_util.override('fleet_apps_management_operations.get_scheduler_job.command_name', 'get'), help=u"""Gets a SchedulerJob by identifier \n[Command Reference](getSchedulerJob)""") +@cli_util.option('--scheduler-job-id', required=True, help=u"""unique SchedulerJob identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'SchedulerJob'}) +@cli_util.wrap_exceptions +def get_scheduler_job(ctx, from_json, scheduler_job_id): + + if isinstance(scheduler_job_id, six.string_types) and len(scheduler_job_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-job-id cannot be whitespace or empty string') + + kwargs = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.get_scheduler_job( + scheduler_job_id=scheduler_job_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@execution_collection_group.command(name=cli_util.override('fleet_apps_management_operations.list_executions.command_name', 'list-executions'), help=u"""Returns a list of Task Executions for a Resource. \n[Command Reference](listExecutions)""") +@cli_util.option('--scheduler-job-id', required=True, help=u"""unique SchedulerJob identifier""") +@cli_util.option('--job-activity-id', required=True, help=u"""unique jobActivity identifier""") +@cli_util.option('--resource-id', required=True, help=u"""unique Resource identifier""") +@cli_util.option('--resource-task-id', help=u"""Task Id""") +@cli_util.option('--step-name', help=u"""Unique step name""") +@cli_util.option('--target-name', help=u"""Unique target name""") +@cli_util.option('--sequence', help=u"""Task Order Sequence""") +@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(["timeStarted"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeStarted is descending.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'ExecutionCollection'}) +@cli_util.wrap_exceptions +def list_executions(ctx, from_json, all_pages, page_size, scheduler_job_id, job_activity_id, resource_id, resource_task_id, step_name, target_name, sequence, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(scheduler_job_id, six.string_types) and len(scheduler_job_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-job-id cannot be whitespace or empty string') + + if isinstance(job_activity_id, six.string_types) and len(job_activity_id.strip()) == 0: + raise click.UsageError('Parameter --job-activity-id cannot be whitespace or empty string') + + if isinstance(resource_id, six.string_types) and len(resource_id.strip()) == 0: + raise click.UsageError('Parameter --resource-id cannot be whitespace or empty string') + + kwargs = {} + if resource_task_id is not None: + kwargs['resource_task_id'] = resource_task_id + if step_name is not None: + kwargs['step_name'] = step_name + if target_name is not None: + kwargs['target_name'] = target_name + if sequence is not None: + kwargs['sequence'] = sequence + 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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_executions, + scheduler_job_id=scheduler_job_id, + job_activity_id=job_activity_id, + resource_id=resource_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_executions, + limit, + page_size, + scheduler_job_id=scheduler_job_id, + job_activity_id=job_activity_id, + resource_id=resource_id, + **kwargs + ) + else: + result = client.list_executions( + scheduler_job_id=scheduler_job_id, + job_activity_id=job_activity_id, + resource_id=resource_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@scheduled_fleet_collection_group.command(name=cli_util.override('fleet_apps_management_operations.list_scheduled_fleets.command_name', 'list-scheduled-fleets'), help=u"""Returns a list of ScheduledFleets \n[Command Reference](listScheduledFleets)""") +@cli_util.option('--scheduler-definition-id', required=True, help=u"""unique SchedulerDefinition identifier""") +@cli_util.option('--compartment-id', help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--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(["displayName"]), help=u"""The field to sort by. Only one sort order may be provided. 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': 'fleet_apps_management', 'class': 'ScheduledFleetCollection'}) +@cli_util.wrap_exceptions +def list_scheduled_fleets(ctx, from_json, all_pages, page_size, scheduler_definition_id, compartment_id, display_name, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(scheduler_definition_id, six.string_types) and len(scheduler_definition_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-definition-id cannot be whitespace or empty string') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if display_name is not None: + kwargs['display_name'] = display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management_operations', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_scheduled_fleets, + scheduler_definition_id=scheduler_definition_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_scheduled_fleets, + limit, + page_size, + scheduler_definition_id=scheduler_definition_id, + **kwargs + ) + else: + result = client.list_scheduled_fleets( + scheduler_definition_id=scheduler_definition_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@scheduler_definition_collection_group.command(name=cli_util.override('fleet_apps_management_operations.list_scheduler_definitions.command_name', 'list-scheduler-definitions'), help=u"""Returns a list of SchedulerDefinitions. \n[Command Reference](listSchedulerDefinitions)""") +@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", "DELETING", "DELETED", "FAILED", "INACTIVE"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--product', help=u"""A filter to return only Scheduler Definitions whose assocaited product matches the given product""") +@cli_util.option('--id', help=u"""unique SchedulerDefinition identifier""") +@cli_util.option('--maintenance-window-id', help=u"""unique MaintenanceWindow identifier""") +@cli_util.option('--fleet-id', help=u"""unique Fleet identifier""") +@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", "timeOfNextRun"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated and timeOfNextRun 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': 'fleet_apps_management', 'class': 'SchedulerDefinitionCollection'}) +@cli_util.wrap_exceptions +def list_scheduler_definitions(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, product, id, maintenance_window_id, fleet_id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if 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 product is not None: + kwargs['product'] = product + if id is not None: + kwargs['id'] = id + if maintenance_window_id is not None: + kwargs['maintenance_window_id'] = maintenance_window_id + if fleet_id is not None: + kwargs['fleet_id'] = fleet_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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_scheduler_definitions, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_scheduler_definitions, + limit, + page_size, + **kwargs + ) + else: + result = client.list_scheduler_definitions( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@scheduler_job_collection_group.command(name=cli_util.override('fleet_apps_management_operations.list_scheduler_jobs.command_name', 'list-scheduler-jobs'), help=u"""Returns a list of SchedulerJobs. \n[Command Reference](listSchedulerJobs)""") +@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(["ACTIVE", "DELETED", "FAILED"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--fleet-id', help=u"""unique Fleet identifier""") +@cli_util.option('--time-scheduled-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""Scheduled Time""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--time-scheduled-less-than', type=custom_types.CLI_DATETIME, help=u"""Scheduled Time""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--is-remediation-job-needed', type=click.BOOL, help=u"""Fetch next remediation Job""") +@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"""unique SchedulerJob identifier""") +@cli_util.option('--defintion-id', help=u"""SchedulerJob Definition identifier""") +@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", "timeScheduled", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated and timeScheduled 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': 'fleet_apps_management', 'class': 'SchedulerJobCollection'}) +@cli_util.wrap_exceptions +def list_scheduler_jobs(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, fleet_id, time_scheduled_greater_than_or_equal_to, time_scheduled_less_than, is_remediation_job_needed, display_name, id, defintion_id, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if fleet_id is not None: + kwargs['fleet_id'] = fleet_id + if time_scheduled_greater_than_or_equal_to is not None: + kwargs['time_scheduled_greater_than_or_equal_to'] = time_scheduled_greater_than_or_equal_to + if time_scheduled_less_than is not None: + kwargs['time_scheduled_less_than'] = time_scheduled_less_than + if is_remediation_job_needed is not None: + kwargs['is_remediation_job_needed'] = is_remediation_job_needed + if display_name is not None: + kwargs['display_name'] = display_name + if id is not None: + kwargs['id'] = id + if defintion_id is not None: + kwargs['defintion_id'] = defintion_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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_scheduler_jobs, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_scheduler_jobs, + limit, + page_size, + **kwargs + ) + else: + result = client.list_scheduler_jobs( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@scheduler_definition_group.command(name=cli_util.override('fleet_apps_management_operations.update_scheduler_definition.command_name', 'update'), help=u"""Updates the SchedulerDefinition \n[Command Reference](updateSchedulerDefinition)""") +@cli_util.option('--scheduler-definition-id', required=True, help=u"""unique SchedulerDefinition identifier""") +@cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + +Example: `My new resource`""") +@cli_util.option('--description', help=u"""A user-friendly description. To provide some insight about the resource. Avoid entering confidential information.""") +@cli_util.option('--activity-initiation-cut-off', type=click.INT, help=u"""Activity Initiation Cut Off""") +@cli_util.option('--schedule', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--action-groups', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Action Groups associated with the Schedule. + +This option is a JSON list with items of type ActionGroup. For documentation on ActionGroup please see our API reference: https://docs.cloud.oracle.com/api/#/en/fleetappsmanagementoperations/20230831/datatypes/ActionGroup.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--run-books', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Runbooks. + +This option is a JSON list with items of type OperationRunbook. For documentation on OperationRunbook please see our API reference: https://docs.cloud.oracle.com/api/#/en/fleetappsmanagementoperations/20230831/datatypes/OperationRunbook.""" + 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", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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({'schedule': {'module': 'fleet_apps_management', 'class': 'Schedule'}, 'action-groups': {'module': 'fleet_apps_management', 'class': 'list[ActionGroup]'}, 'run-books': {'module': 'fleet_apps_management', 'class': 'list[OperationRunbook]'}, 'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', '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={'schedule': {'module': 'fleet_apps_management', 'class': 'Schedule'}, 'action-groups': {'module': 'fleet_apps_management', 'class': 'list[ActionGroup]'}, 'run-books': {'module': 'fleet_apps_management', 'class': 'list[OperationRunbook]'}, 'freeform-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, dict(str, object))'}}) +@cli_util.wrap_exceptions +def update_scheduler_definition(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, scheduler_definition_id, display_name, description, activity_initiation_cut_off, schedule, action_groups, run_books, freeform_tags, defined_tags, if_match): + + if isinstance(scheduler_definition_id, six.string_types) and len(scheduler_definition_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-definition-id cannot be whitespace or empty string') + if not force: + if schedule or action_groups or run_books or freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to schedule and action-groups and run-books 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 activity_initiation_cut_off is not None: + _details['activityInitiationCutOff'] = activity_initiation_cut_off + + if schedule is not None: + _details['schedule'] = cli_util.parse_json_parameter("schedule", schedule) + + if action_groups is not None: + _details['actionGroups'] = cli_util.parse_json_parameter("action_groups", action_groups) + + if run_books is not None: + _details['runBooks'] = cli_util.parse_json_parameter("run_books", run_books) + + 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('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.update_scheduler_definition( + scheduler_definition_id=scheduler_definition_id, + update_scheduler_definition_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) + + +@scheduler_job_group.command(name=cli_util.override('fleet_apps_management_operations.update_scheduler_job.command_name', 'update'), help=u"""Updates the SchedulerJob \n[Command Reference](updateSchedulerJob)""") +@cli_util.option('--scheduler-job-id', required=True, help=u"""unique SchedulerJob identifier""") +@cli_util.option('--time-scheduled', type=custom_types.CLI_DATETIME, help=u"""Scheduled date for the Job.Provide only the date""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE) +@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{\"bar-key\": \"value\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{\"foo-namespace\": {\"bar-key\": \"value\"}}`""" + 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", "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 SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', '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': 'fleet_apps_management', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'fleet_apps_management', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'fleet_apps_management', 'class': 'SchedulerJob'}) +@cli_util.wrap_exceptions +def update_scheduler_job(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, scheduler_job_id, time_scheduled, freeform_tags, defined_tags, if_match): + + if isinstance(scheduler_job_id, six.string_types) and len(scheduler_job_id.strip()) == 0: + raise click.UsageError('Parameter --scheduler-job-id cannot be whitespace or empty string') + if not force: + if freeform_tags or defined_tags: + if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"): + ctx.abort() + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + + if time_scheduled is not None: + _details['timeScheduled'] = time_scheduled + + if freeform_tags is not None: + _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + + if defined_tags is not None: + _details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags) + + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management_operations', ctx) + result = client.update_scheduler_job( + scheduler_job_id=scheduler_job_id, + update_scheduler_job_details=_details, + **kwargs + ) + if wait_for_state: + + if hasattr(client, 'get_scheduler_job') and callable(getattr(client, 'get_scheduler_job')): + try: + wait_period_kwargs = {} + if max_wait_seconds is not None: + wait_period_kwargs['max_wait_seconds'] = max_wait_seconds + if wait_interval_seconds is not None: + wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds + + click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr) + result = oci.wait_until(client, client.get_scheduler_job(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs) + except oci.exceptions.MaximumWaitTimeExceeded as e: + # If we fail, we should show an error, but we should still provide the information to the customer + click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + sys.exit(2) + except Exception: + click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr) + cli_util.render_response(result, ctx) + raise + else: + click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr) + cli_util.render_response(result, ctx) diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/__init__.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/client_mappings.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/client_mappings.py new file mode 100644 index 000000000..a77f380f7 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/client_mappings.py @@ -0,0 +1,14 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +import oci +from oci_cli.cli_clients import CLIENT_MAP +from oci_cli.cli_clients import MODULE_TO_TYPE_MAPPINGS +from oci.fleet_apps_management import FleetAppsManagementRunbooksClient + +MODULE_TO_TYPE_MAPPINGS["fleet_apps_management"] = oci.fleet_apps_management.models.fleet_apps_management_type_mapping +if CLIENT_MAP.get("fleet_apps_management") is None: + CLIENT_MAP["fleet_apps_management"] = {} +CLIENT_MAP["fleet_apps_management"]["fleet_apps_management_runbooks"] = FleetAppsManagementRunbooksClient diff --git a/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/fleetappsmanagementrunbooks_cli.py b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/fleetappsmanagementrunbooks_cli.py new file mode 100644 index 000000000..686f29a19 --- /dev/null +++ b/services/fleet_apps_management/src/oci_cli_fleet_apps_management_runbooks/generated/fleetappsmanagementrunbooks_cli.py @@ -0,0 +1,240 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 + +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.fleet_apps_management.src.oci_cli_fleet_apps_management.generated import fleet_apps_management_service_cli + + +@click.command(cli_util.override('fleet_apps_management_runbooks.fleet_apps_management_runbooks_root_group.command_name', 'fleet-apps-management-runbooks'), cls=CommandGroupWithAlias, help=cli_util.override('fleet_apps_management_runbooks.fleet_apps_management_runbooks_root_group.help', """Fleet Application Management Service API. Use this API to for all FAMS related activities. +To manage fleets,view complaince report for the Fleet,scedule patches and other lifecycle activities"""), short_help=cli_util.override('fleet_apps_management_runbooks.fleet_apps_management_runbooks_root_group.short_help', """Fleet Application Management Service API""")) +@cli_util.help_option_group +def fleet_apps_management_runbooks_root_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_runbooks.task_record_collection_group.command_name', 'task-record-collection'), cls=CommandGroupWithAlias, help="""Results of a taskRecord search. Contains boh TaskRecordSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def task_record_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_runbooks.runbook_collection_group.command_name', 'runbook-collection'), cls=CommandGroupWithAlias, help="""Results of a runbook search. Contains boh RunbookSummary items and other information, such as metadata.""") +@cli_util.help_option_group +def runbook_collection_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_runbooks.runbook_group.command_name', 'runbook'), cls=CommandGroupWithAlias, help="""Runbook definition.""") +@cli_util.help_option_group +def runbook_group(): + pass + + +@click.command(cli_util.override('fleet_apps_management_runbooks.task_record_group.command_name', 'task-record'), cls=CommandGroupWithAlias, help="""Description of TaskRecord.""") +@cli_util.help_option_group +def task_record_group(): + pass + + +fleet_apps_management_service_cli.fleet_apps_management_service_group.add_command(fleet_apps_management_runbooks_root_group) +fleet_apps_management_runbooks_root_group.add_command(task_record_collection_group) +fleet_apps_management_runbooks_root_group.add_command(runbook_collection_group) +fleet_apps_management_runbooks_root_group.add_command(runbook_group) +fleet_apps_management_runbooks_root_group.add_command(task_record_group) + + +@runbook_group.command(name=cli_util.override('fleet_apps_management_runbooks.get_runbook.command_name', 'get'), help=u"""Gets a Runbook by identifier \n[Command Reference](getRunbook)""") +@cli_util.option('--runbook-id', required=True, help=u"""Unique Runbook identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'Runbook'}) +@cli_util.wrap_exceptions +def get_runbook(ctx, from_json, runbook_id): + + if isinstance(runbook_id, six.string_types) and len(runbook_id.strip()) == 0: + raise click.UsageError('Parameter --runbook-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('fleet_apps_management', 'fleet_apps_management_runbooks', ctx) + result = client.get_runbook( + runbook_id=runbook_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@task_record_group.command(name=cli_util.override('fleet_apps_management_runbooks.get_task_record.command_name', 'get'), help=u"""Gets a TaskRecord by identifier \n[Command Reference](getTaskRecord)""") +@cli_util.option('--task-record-id', required=True, help=u"""unique TaskDetail identifier""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'TaskRecord'}) +@cli_util.wrap_exceptions +def get_task_record(ctx, from_json, task_record_id): + + if isinstance(task_record_id, six.string_types) and len(task_record_id.strip()) == 0: + raise click.UsageError('Parameter --task-record-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('fleet_apps_management', 'fleet_apps_management_runbooks', ctx) + result = client.get_task_record( + task_record_id=task_record_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@runbook_collection_group.command(name=cli_util.override('fleet_apps_management_runbooks.list_runbooks.command_name', 'list-runbooks'), help=u"""Returns a list of Runbooks. \n[Command Reference](listRunbooks)""") +@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(["ACTIVE", "DELETED", "FAILED"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@cli_util.option('--id', help=u"""unique Runbook identifier""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["USER_DEFINED", "ORACLE_DEFINED", "SYSTEM_DEFINED"]), help=u"""The ID of the runbook type.""") +@cli_util.option('--runbook-relevance', type=custom_types.CliCaseInsensitiveChoice(["PRODUCT_GROUP", "PRODUCT"]), help=u"""The runbook relevance of product or full-stack.""") +@cli_util.option('--platform', help=u"""The ID of the runbook platform.""") +@cli_util.option('--operation', help=u"""The runbook lifecycle.""") +@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': 'fleet_apps_management', 'class': 'RunbookCollection'}) +@cli_util.wrap_exceptions +def list_runbooks(ctx, from_json, all_pages, page_size, compartment_id, lifecycle_state, display_name, id, type, runbook_relevance, platform, operation, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if display_name is not None: + kwargs['display_name'] = display_name + if id is not None: + kwargs['id'] = id + if type is not None: + kwargs['type'] = type + if runbook_relevance is not None: + kwargs['runbook_relevance'] = runbook_relevance + if platform is not None: + kwargs['platform'] = platform + if operation is not None: + kwargs['operation'] = operation + 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('fleet_apps_management', 'fleet_apps_management_runbooks', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_runbooks, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_runbooks, + limit, + page_size, + **kwargs + ) + else: + result = client.list_runbooks( + **kwargs + ) + cli_util.render_response(result, ctx) + + +@task_record_collection_group.command(name=cli_util.override('fleet_apps_management_runbooks.list_task_records.command_name', 'list-task-records'), help=u"""Returns a list of TaskRecords. \n[Command Reference](listTaskRecords)""") +@cli_util.option('--compartment-id', help=u"""The ID of the compartment in which to list resources.""") +@cli_util.option('--platform', help=u"""The platform for the Task.""") +@cli_util.option('--type', type=custom_types.CliCaseInsensitiveChoice(["USER_DEFINED", "ORACLE_DEFINED", "SYSTEM_DEFINED"]), help=u"""The type of the Task.""") +@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"""unique TaskDetail identifier""") +@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('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "INACTIVE", "DELETED", "DELETING", "FAILED", "UPDATING"]), help=u"""The current state of the Task.""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["timeCreated", "displayName"]), help=u"""The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for displayName is ascending.""") +@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The sort order to use, either 'ASC' or 'DESC'.""") +@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""") +@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'fleet_apps_management', 'class': 'TaskRecordCollection'}) +@cli_util.wrap_exceptions +def list_task_records(ctx, from_json, all_pages, page_size, compartment_id, platform, type, display_name, id, limit, page, lifecycle_state, sort_by, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + kwargs = {} + if compartment_id is not None: + kwargs['compartment_id'] = compartment_id + if platform is not None: + kwargs['platform'] = platform + if type is not None: + kwargs['type'] = type + 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 lifecycle_state is not None: + kwargs['lifecycle_state'] = lifecycle_state + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('fleet_apps_management', 'fleet_apps_management_runbooks', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_task_records, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_task_records, + limit, + page_size, + **kwargs + ) + else: + result = client.list_task_records( + **kwargs + ) + cli_util.render_response(result, ctx) diff --git a/services/fleet_apps_management/tests/__init__.py b/services/fleet_apps_management/tests/__init__.py new file mode 100644 index 000000000..b12f296f0 --- /dev/null +++ b/services/fleet_apps_management/tests/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, 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: 20230831 diff --git a/services/fleet_apps_management/tests/util/generated/command_to_api.py b/services/fleet_apps_management/tests/util/generated/command_to_api.py new file mode 100644 index 000000000..69ce3fd1b --- /dev/null +++ b/services/fleet_apps_management/tests/util/generated/command_to_api.py @@ -0,0 +1,9 @@ +# coding: utf-8 +# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + +SDK_client_map = { + "fleet_apps_management_runbooks.get_runbook": "oci.fleet_apps_management.FleetAppsManagementRunbooksClient.get_runbook", + "fleet_apps_management_runbooks.get_task_record": "oci.fleet_apps_management.FleetAppsManagementRunbooksClient.get_task_record", + "fleet_apps_management_runbooks.list_runbooks": "oci.fleet_apps_management.FleetAppsManagementRunbooksClient.list_runbooks", + "fleet_apps_management_runbooks.list_task_records": "oci.fleet_apps_management.FleetAppsManagementRunbooksClient.list_task_records", +} diff --git a/services/integration/src/oci_cli_integration_instance/generated/integrationinstance_cli.py b/services/integration/src/oci_cli_integration_instance/generated/integrationinstance_cli.py index ba6f44785..d2a96a9c0 100644 --- a/services/integration/src/oci_cli_integration_instance/generated/integrationinstance_cli.py +++ b/services/integration/src/oci_cli_integration_instance/generated/integrationinstance_cli.py @@ -785,6 +785,67 @@ def enable_process_automation(ctx, from_json, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) +@integration_instance_group.command(name=cli_util.override('integration.extend_data_retention.command_name', 'extend-data-retention'), help=u"""Extend Data Retention period for given Integration Instance \n[Command Reference](extendDataRetention)""") +@cli_util.option('--integration-instance-id', required=True, help=u"""Unique Integration Instance identifier.""") +@cli_util.option('--data-retention-period', required=True, type=custom_types.CliCaseInsensitiveChoice(["MONTHS_1", "MONTHS_3", "MONTHS_6"]), help=u"""Data retention period set for given integration 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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@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 extend_data_retention(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, integration_instance_id, data_retention_period, if_match): + + if isinstance(integration_instance_id, six.string_types) and len(integration_instance_id.strip()) == 0: + raise click.UsageError('Parameter --integration-instance-id cannot be whitespace or empty string') + + kwargs = {} + if if_match is not None: + kwargs['if_match'] = if_match + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['dataRetentionPeriod'] = data_retention_period + + client = cli_util.build_client('integration', 'integration_instance', ctx) + result = client.extend_data_retention( + integration_instance_id=integration_instance_id, + extend_data_retention_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) + + @integration_instance_group.command(name=cli_util.override('integration.get_integration_instance.command_name', 'get'), help=u"""Gets a IntegrationInstance by identifier \n[Command Reference](getIntegrationInstance)""") @cli_util.option('--integration-instance-id', required=True, help=u"""Unique Integration Instance identifier.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -834,7 +895,7 @@ def get_work_request(ctx, from_json, work_request_id): @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Example: `My new resource`""") -@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED", "FAILED"]), help=u"""Life cycle state to query on.""") +@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "UPDATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED", "FAILED", "STANDBY"]), help=u"""Life cycle state to query on.""") @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'.""") diff --git a/services/integration/tests/util/generated/command_to_api.py b/services/integration/tests/util/generated/command_to_api.py index 2b81809c6..dfc3cf211 100644 --- a/services/integration/tests/util/generated/command_to_api.py +++ b/services/integration/tests/util/generated/command_to_api.py @@ -8,6 +8,7 @@ "integration.create_integration_instance": "oci.integration.IntegrationInstanceClient.create_integration_instance", "integration.delete_integration_instance": "oci.integration.IntegrationInstanceClient.delete_integration_instance", "integration.enable_process_automation": "oci.integration.IntegrationInstanceClient.enable_process_automation", + "integration.extend_data_retention": "oci.integration.IntegrationInstanceClient.extend_data_retention", "integration.get_integration_instance": "oci.integration.IntegrationInstanceClient.get_integration_instance", "integration.get_work_request": "oci.integration.IntegrationInstanceClient.get_work_request", "integration.list_integration_instances": "oci.integration.IntegrationInstanceClient.list_integration_instances", diff --git a/services/mysql/src/oci_cli_db_system/generated/dbsystem_cli.py b/services/mysql/src/oci_cli_db_system/generated/dbsystem_cli.py index d41f3315e..30c6fb808 100644 --- a/services/mysql/src/oci_cli_db_system/generated/dbsystem_cli.py +++ b/services/mysql/src/oci_cli_db_system/generated/dbsystem_cli.py @@ -139,6 +139,7 @@ def add_heat_wave_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait @cli_util.option('--admin-username', help=u"""The username for the administrative user.""") @cli_util.option('--admin-password', help=u"""The password for the administrative user. The password must be between 8 and 32 characters long, and must contain at least 1 numeric character, 1 lowercase character, 1 uppercase character, and 1 special (nonalphanumeric) character.""") @cli_util.option('--data-storage-size-in-gbs', type=click.INT, help=u"""Initial size of the data volume in GBs that will be created and attached. Keep in mind that this only specifies the size of the database data volume, the log volume for the database will be scaled appropriately with its shape.""") +@cli_util.option('--data-storage', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--hostname-label', help=u"""The hostname for the primary endpoint of the DB System. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, \"dbsystem-1\" in FQDN \"dbsystem-1.subnet123.vcn1.oraclevcn.com\"). @@ -159,12 +160,12 @@ def add_heat_wave_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'source': {'module': 'mysql', 'class': 'CreateDbSystemSourceDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'source': {'module': 'mysql', 'class': 'CreateDbSystemSourceDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'source': {'module': 'mysql', 'class': 'CreateDbSystemSourceDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'source': {'module': 'mysql', 'class': 'CreateDbSystemSourceDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, hostname_label, ip_address, port, port_x, backup_policy, source, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections): +def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, data_storage, hostname_label, ip_address, port, port_x, backup_policy, source, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -204,6 +205,9 @@ def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte if data_storage_size_in_gbs is not None: _details['dataStorageSizeInGBs'] = data_storage_size_in_gbs + if data_storage is not None: + _details['dataStorage'] = cli_util.parse_json_parameter("data_storage", data_storage) + if hostname_label is not None: _details['hostnameLabel'] = hostname_label @@ -305,6 +309,7 @@ def create_db_system(ctx, from_json, wait_for_state, max_wait_seconds, wait_inte @cli_util.option('--admin-username', help=u"""The username for the administrative user.""") @cli_util.option('--admin-password', help=u"""The password for the administrative user. The password must be between 8 and 32 characters long, and must contain at least 1 numeric character, 1 lowercase character, 1 uppercase character, and 1 special (nonalphanumeric) character.""") @cli_util.option('--data-storage-size-in-gbs', type=click.INT, help=u"""Initial size of the data volume in GBs that will be created and attached. Keep in mind that this only specifies the size of the database data volume, the log volume for the database will be scaled appropriately with its shape.""") +@cli_util.option('--data-storage', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--hostname-label', help=u"""The hostname for the primary endpoint of the DB System. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, \"dbsystem-1\" in FQDN \"dbsystem-1.subnet123.vcn1.oraclevcn.com\"). @@ -324,12 +329,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", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system_create_db_system_source_from_backup_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, source_backup_id, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections): +def create_db_system_create_db_system_source_from_backup_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, source_backup_id, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, data_storage, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -371,6 +376,9 @@ def create_db_system_create_db_system_source_from_backup_details(ctx, from_json, if data_storage_size_in_gbs is not None: _details['dataStorageSizeInGBs'] = data_storage_size_in_gbs + if data_storage is not None: + _details['dataStorage'] = cli_util.parse_json_parameter("data_storage", data_storage) + if hostname_label is not None: _details['hostnameLabel'] = hostname_label @@ -470,6 +478,7 @@ def create_db_system_create_db_system_source_from_backup_details(ctx, from_json, @cli_util.option('--admin-username', help=u"""The username for the administrative user.""") @cli_util.option('--admin-password', help=u"""The password for the administrative user. The password must be between 8 and 32 characters long, and must contain at least 1 numeric character, 1 lowercase character, 1 uppercase character, and 1 special (nonalphanumeric) character.""") @cli_util.option('--data-storage-size-in-gbs', type=click.INT, help=u"""Initial size of the data volume in GBs that will be created and attached. Keep in mind that this only specifies the size of the database data volume, the log volume for the database will be scaled appropriately with its shape.""") +@cli_util.option('--data-storage', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--hostname-label', help=u"""The hostname for the primary endpoint of the DB System. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, \"dbsystem-1\" in FQDN \"dbsystem-1.subnet123.vcn1.oraclevcn.com\"). @@ -489,12 +498,12 @@ def create_db_system_create_db_system_source_from_backup_details(ctx, from_json, @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system_create_db_system_source_from_none_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections): +def create_db_system_create_db_system_source_from_none_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, data_storage, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -535,6 +544,9 @@ def create_db_system_create_db_system_source_from_none_details(ctx, from_json, w if data_storage_size_in_gbs is not None: _details['dataStorageSizeInGBs'] = data_storage_size_in_gbs + if data_storage is not None: + _details['dataStorage'] = cli_util.parse_json_parameter("data_storage", data_storage) + if hostname_label is not None: _details['hostnameLabel'] = hostname_label @@ -635,6 +647,7 @@ def create_db_system_create_db_system_source_from_none_details(ctx, from_json, w @cli_util.option('--admin-username', help=u"""The username for the administrative user.""") @cli_util.option('--admin-password', help=u"""The password for the administrative user. The password must be between 8 and 32 characters long, and must contain at least 1 numeric character, 1 lowercase character, 1 uppercase character, and 1 special (nonalphanumeric) character.""") @cli_util.option('--data-storage-size-in-gbs', type=click.INT, help=u"""Initial size of the data volume in GBs that will be created and attached. Keep in mind that this only specifies the size of the database data volume, the log volume for the database will be scaled appropriately with its shape.""") +@cli_util.option('--data-storage', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--hostname-label', help=u"""The hostname for the primary endpoint of the DB System. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, \"dbsystem-1\" in FQDN \"dbsystem-1.subnet123.vcn1.oraclevcn.com\"). @@ -654,12 +667,12 @@ def create_db_system_create_db_system_source_from_none_details(ctx, from_json, w @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system_create_db_system_source_import_from_url_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, source_source_url, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections): +def create_db_system_create_db_system_source_import_from_url_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, source_source_url, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, data_storage, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -701,6 +714,9 @@ def create_db_system_create_db_system_source_import_from_url_details(ctx, from_j if data_storage_size_in_gbs is not None: _details['dataStorageSizeInGBs'] = data_storage_size_in_gbs + if data_storage is not None: + _details['dataStorage'] = cli_util.parse_json_parameter("data_storage", data_storage) + if hostname_label is not None: _details['hostnameLabel'] = hostname_label @@ -801,6 +817,7 @@ def create_db_system_create_db_system_source_import_from_url_details(ctx, from_j @cli_util.option('--admin-username', help=u"""The username for the administrative user.""") @cli_util.option('--admin-password', help=u"""The password for the administrative user. The password must be between 8 and 32 characters long, and must contain at least 1 numeric character, 1 lowercase character, 1 uppercase character, and 1 special (nonalphanumeric) character.""") @cli_util.option('--data-storage-size-in-gbs', type=click.INT, help=u"""Initial size of the data volume in GBs that will be created and attached. Keep in mind that this only specifies the size of the database data volume, the log volume for the database will be scaled appropriately with its shape.""") +@cli_util.option('--data-storage', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--hostname-label', help=u"""The hostname for the primary endpoint of the DB System. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, \"dbsystem-1\" in FQDN \"dbsystem-1.subnet123.vcn1.oraclevcn.com\"). @@ -821,12 +838,12 @@ def create_db_system_create_db_system_source_import_from_url_details(ctx, from_j @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'CreateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'CreateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'CreateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}, output_type={'module': 'mysql', 'class': 'DbSystem'}) @cli_util.wrap_exceptions -def create_db_system_create_db_system_source_from_pitr_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, source_db_system_id, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections, source_recovery_point): +def create_db_system_create_db_system_source_from_pitr_details(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, shape_name, subnet_id, source_db_system_id, display_name, description, is_highly_available, availability_domain, fault_domain, configuration_id, mysql_version, admin_username, admin_password, data_storage_size_in_gbs, data_storage, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections, source_recovery_point): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -868,6 +885,9 @@ def create_db_system_create_db_system_source_from_pitr_details(ctx, from_json, w if data_storage_size_in_gbs is not None: _details['dataStorageSizeInGBs'] = data_storage_size_in_gbs + if data_storage is not None: + _details['dataStorage'] = cli_util.parse_json_parameter("data_storage", data_storage) + if hostname_label is not None: _details['hostnameLabel'] = hostname_label @@ -1651,6 +1671,7 @@ def stop_heat_wave_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wai DB Systems with an initial storage size of 400 GB or less can be expanded up to 32 TB. DB Systems with an initial storage size between 401-800 GB can be expanded up to 64 TB. DB Systems with an initial storage size between 801-1200 GB can be expanded up to 96 TB. DB Systems with an initial storage size of 1201 GB or more can be expanded up to 128 TB. It is not possible to decrease data storage size.""") +@cli_util.option('--data-storage', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--hostname-label', help=u"""The hostname for the primary endpoint of the DB System. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, \"dbsystem-1\" in FQDN \"dbsystem-1.subnet123.vcn1.oraclevcn.com\"). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.""") @cli_util.option('--ip-address', help=u"""The IP address the DB System should be configured to listen on the provided subnet. It must be a free private IP address within the subnet's CIDR. If you don't specify a value, Oracle automatically assigns a private IP address from the subnet. This should be a \"dotted-quad\" style IPv4 address.""") @cli_util.option('--port', type=click.INT, help=u"""The port for primary endpoint of the DB System to listen on.""") @@ -1668,18 +1689,18 @@ def stop_heat_wave_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wai @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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({'backup-policy': {'module': 'mysql', 'class': 'UpdateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'UpdateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'UpdateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) +@json_skeleton_utils.get_cli_json_input_option({'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'UpdateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'UpdateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'UpdateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) @cli_util.help_option @click.pass_context -@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'backup-policy': {'module': 'mysql', 'class': 'UpdateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'UpdateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'UpdateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'data-storage': {'module': 'mysql', 'class': 'DataStorageDetails'}, 'backup-policy': {'module': 'mysql', 'class': 'UpdateBackupPolicyDetails'}, 'maintenance': {'module': 'mysql', 'class': 'UpdateMaintenanceDetails'}, 'freeform-tags': {'module': 'mysql', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'mysql', 'class': 'dict(str, dict(str, object))'}, 'deletion-policy': {'module': 'mysql', 'class': 'UpdateDeletionPolicyDetails'}, 'secure-connections': {'module': 'mysql', 'class': 'SecureConnectionDetails'}}) @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, subnet_id, is_highly_available, availability_domain, fault_domain, shape_name, mysql_version, configuration_id, admin_username, admin_password, data_storage_size_in_gbs, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections, if_match): +def update_db_system(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, db_system_id, display_name, description, subnet_id, is_highly_available, availability_domain, fault_domain, shape_name, mysql_version, configuration_id, admin_username, admin_password, data_storage_size_in_gbs, data_storage, hostname_label, ip_address, port, port_x, backup_policy, maintenance, freeform_tags, defined_tags, deletion_policy, crash_recovery, database_management, secure_connections, 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 backup_policy or maintenance or freeform_tags or defined_tags or deletion_policy or secure_connections: - if not click.confirm("WARNING: Updates to backup-policy and maintenance and freeform-tags and defined-tags and deletion-policy and secure-connections will replace any existing values. Are you sure you want to continue?"): + if data_storage or backup_policy or maintenance or freeform_tags or defined_tags or deletion_policy or secure_connections: + if not click.confirm("WARNING: Updates to data-storage and backup-policy and maintenance and freeform-tags and defined-tags and deletion-policy and secure-connections will replace any existing values. Are you sure you want to continue?"): ctx.abort() kwargs = {} @@ -1725,6 +1746,9 @@ def update_db_system(ctx, from_json, force, wait_for_state, max_wait_seconds, wa if data_storage_size_in_gbs is not None: _details['dataStorageSizeInGBs'] = data_storage_size_in_gbs + if data_storage is not None: + _details['dataStorage'] = cli_util.parse_json_parameter("data_storage", data_storage) + if hostname_label is not None: _details['hostnameLabel'] = hostname_label diff --git a/services/redis/src/oci_cli_redis_cluster/generated/rediscluster_cli.py b/services/redis/src/oci_cli_redis_cluster/generated/rediscluster_cli.py index 8646523e2..1f4d523b6 100644 --- a/services/redis/src/oci_cli_redis_cluster/generated/rediscluster_cli.py +++ b/services/redis/src/oci_cli_redis_cluster/generated/rediscluster_cli.py @@ -16,13 +16,13 @@ from oci_cli.aliasing import CommandGroupWithAlias -@cli.command(cli_util.override('redis.redis_root_group.command_name', 'redis'), cls=CommandGroupWithAlias, help=cli_util.override('redis.redis_root_group.help', """Use the Redis Service API to create and manage Redis clusters. A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis]."""), short_help=cli_util.override('redis.redis_root_group.short_help', """Redis Service API""")) +@cli.command(cli_util.override('redis.redis_root_group.command_name', 'redis'), cls=CommandGroupWithAlias, help=cli_util.override('redis.redis_root_group.help', """Use the OCI Cache API to create and manage clusters. A cluster is a memory-based storage solution. For more information, see [OCI Cache]."""), short_help=cli_util.override('redis.redis_root_group.short_help', """OCI Cache API""")) @cli_util.help_option_group def redis_root_group(): pass -@click.command(cli_util.override('redis.redis_cluster_summary_group.command_name', 'redis-cluster-summary'), cls=CommandGroupWithAlias, help="""Summary of information about a Redis cluster. A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis].""") +@click.command(cli_util.override('redis.redis_cluster_summary_group.command_name', 'redis-cluster-summary'), cls=CommandGroupWithAlias, help="""Summary of information about a cluster. A cluster is a memory-based storage solution. For more information, see [OCI Cache].""") @cli_util.help_option_group def redis_cluster_summary_group(): pass @@ -34,7 +34,7 @@ def work_request_error_group(): pass -@click.command(cli_util.override('redis.redis_cluster_group.command_name', 'redis-cluster'), cls=CommandGroupWithAlias, help="""A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis].""") +@click.command(cli_util.override('redis.redis_cluster_group.command_name', 'redis-cluster'), cls=CommandGroupWithAlias, help="""An OCI Cache cluster is a memory-based storage solution. For more information, see [OCI Cache].""") @cli_util.help_option_group def redis_cluster_group(): pass @@ -52,11 +52,18 @@ def work_request_group(): pass +@click.command(cli_util.override('redis.node_summary_group.command_name', 'node-summary'), cls=CommandGroupWithAlias, help="""The details of each node in the cluster.""") +@cli_util.help_option_group +def node_summary_group(): + pass + + redis_root_group.add_command(redis_cluster_summary_group) redis_root_group.add_command(work_request_error_group) redis_root_group.add_command(redis_cluster_group) redis_root_group.add_command(work_request_log_entry_group) redis_root_group.add_command(work_request_group) +redis_root_group.add_command(node_summary_group) @work_request_group.command(name=cli_util.override('redis.cancel_work_request.command_name', 'cancel'), help=u"""Cancels the specified work request. \n[Command Reference](cancelWorkRequest)""") @@ -85,9 +92,9 @@ def cancel_work_request(ctx, from_json, work_request_id, if_match): cli_util.render_response(result, ctx) -@redis_cluster_group.command(name=cli_util.override('redis.change_redis_cluster_compartment.command_name', 'change-compartment'), help=u"""Moves a Redis cluster into a different compartment within the same tenancy. A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis]. \n[Command Reference](changeRedisClusterCompartment)""") -@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the Redis cluster.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment into which the Redis cluster should be moved.""") +@redis_cluster_group.command(name=cli_util.override('redis.change_redis_cluster_compartment.command_name', 'change-compartment'), help=u"""Moves an OCI Cache cluster into a different compartment within the same tenancy. A cluster is a memory-based storage solution. For more information, see [OCI Cache]. \n[Command Reference](changeRedisClusterCompartment)""") +@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the cluster.""") +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment into which the cluster should be moved.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -146,14 +153,16 @@ def change_redis_cluster_compartment(ctx, from_json, wait_for_state, max_wait_se cli_util.render_response(result, ctx) -@redis_cluster_group.command(name=cli_util.override('redis.create_redis_cluster.command_name', 'create'), help=u"""Creates a new Redis cluster. A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis]. \n[Command Reference](createRedisCluster)""") +@redis_cluster_group.command(name=cli_util.override('redis.create_redis_cluster.command_name', 'create'), help=u"""Creates a new OCI Cache cluster. A cluster is a memory-based storage solution. For more information, see [OCI Cache]. \n[Command Reference](createRedisCluster)""") @cli_util.option('--display-name', required=True, help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment that contains the Redis cluster.""") -@cli_util.option('--node-count', required=True, type=click.INT, help=u"""The number of nodes in the Redis cluster.""") -@cli_util.option('--software-version', required=True, help=u"""The Redis version that the cluster is running.""") -@cli_util.option('--node-memory-in-gbs', required=True, type=click.FLOAT, help=u"""The amount of memory allocated to the Redis cluster's nodes, in gigabytes.""") -@cli_util.option('--subnet-id', required=True, help=u"""The [OCID] of the Redis cluster's subnet.""") -@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of Network Security Group (NSG) [OCIDs] associated with this cluster. For more information, see [Using an NSG for Redis Clusters].""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment that contains the cluster.""") +@cli_util.option('--node-count', required=True, type=click.INT, help=u"""The number of nodes per shard in the cluster when clusterMode is SHARDED. This is the total number of nodes when clusterMode is NONSHARDED.""") +@cli_util.option('--software-version', required=True, help=u"""The OCI Cache engine version that the cluster is running.""") +@cli_util.option('--node-memory-in-gbs', required=True, type=click.FLOAT, help=u"""The amount of memory allocated to the cluster's nodes, in gigabytes.""") +@cli_util.option('--subnet-id', required=True, help=u"""The [OCID] of the cluster's subnet.""") +@cli_util.option('--cluster-mode', help=u"""Specifies whether the cluster is sharded or non-sharded.""") +@cli_util.option('--shard-count', type=click.INT, help=u"""The number of shards in sharded cluster. Only applicable when clusterMode is SHARDED.""") +@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of Network Security Group (NSG) [OCIDs] associated with this cluster. For more information, see [Using an NSG for Clusters].""" + 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", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -164,7 +173,7 @@ def change_redis_cluster_compartment(ctx, from_json, wait_for_state, max_wait_se @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'nsg-ids': {'module': 'redis', 'class': 'list[string]'}, 'freeform-tags': {'module': 'redis', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'redis', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'redis', 'class': 'RedisCluster'}) @cli_util.wrap_exceptions -def create_redis_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, node_count, software_version, node_memory_in_gbs, subnet_id, nsg_ids, freeform_tags, defined_tags): +def create_redis_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, display_name, compartment_id, node_count, software_version, node_memory_in_gbs, subnet_id, cluster_mode, shard_count, nsg_ids, freeform_tags, defined_tags): kwargs = {} kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) @@ -177,6 +186,12 @@ def create_redis_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait_ _details['nodeMemoryInGBs'] = node_memory_in_gbs _details['subnetId'] = subnet_id + if cluster_mode is not None: + _details['clusterMode'] = cluster_mode + + if shard_count is not None: + _details['shardCount'] = shard_count + if nsg_ids is not None: _details['nsgIds'] = cli_util.parse_json_parameter("nsg_ids", nsg_ids) @@ -221,8 +236,8 @@ def create_redis_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait_ cli_util.render_response(result, ctx) -@redis_cluster_group.command(name=cli_util.override('redis.delete_redis_cluster.command_name', 'delete'), help=u"""Deletes the specified Redis cluster. A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis]. \n[Command Reference](deleteRedisCluster)""") -@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the Redis cluster.""") +@redis_cluster_group.command(name=cli_util.override('redis.delete_redis_cluster.command_name', 'delete'), help=u"""Deletes the specified OCI Cache cluster. A cluster is a memory-based storage solution. For more information, see [OCI Cache]. \n[Command Reference](deleteRedisCluster)""") +@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the cluster.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.confirm_delete_option @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "WAITING", "NEEDS_ATTENTION", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state SUCCEEDED --wait-for-state FAILED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -277,8 +292,8 @@ def delete_redis_cluster(ctx, from_json, wait_for_state, max_wait_seconds, wait_ cli_util.render_response(result, ctx) -@redis_cluster_group.command(name=cli_util.override('redis.get_redis_cluster.command_name', 'get'), help=u"""Retrieves the specified Redis cluster. A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis]. \n[Command Reference](getRedisCluster)""") -@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the Redis cluster.""") +@redis_cluster_group.command(name=cli_util.override('redis.get_redis_cluster.command_name', 'get'), help=u"""Retrieves the specified OCI Cache cluster. A cluster is a memory-based storage solution. For more information, see [OCI Cache]. \n[Command Reference](getRedisCluster)""") +@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the cluster.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context @@ -321,11 +336,71 @@ def get_work_request(ctx, from_json, work_request_id): cli_util.render_response(result, ctx) -@redis_cluster_summary_group.command(name=cli_util.override('redis.list_redis_clusters.command_name', 'list-redis-clusters'), help=u"""Lists the Redis clusters in the specified compartment. A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis]. \n[Command Reference](listRedisClusters)""") +@node_summary_group.command(name=cli_util.override('redis.list_redis_cluster_nodes.command_name', 'list-redis-cluster-nodes'), help=u"""Gets the list of all nodes in a cluster. \n[Command Reference](listRedisClusterNodes)""") +@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the cluster.""") +@cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") +@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': 'redis', 'class': 'RedisNodeCollection'}) +@cli_util.wrap_exceptions +def list_redis_cluster_nodes(ctx, from_json, all_pages, page_size, redis_cluster_id, display_name, limit, page, sort_order, sort_by): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(redis_cluster_id, six.string_types) and len(redis_cluster_id.strip()) == 0: + raise click.UsageError('Parameter --redis-cluster-id cannot be whitespace or empty string') + + kwargs = {} + if display_name is not None: + kwargs['display_name'] = display_name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_order is not None: + kwargs['sort_order'] = sort_order + if sort_by is not None: + kwargs['sort_by'] = sort_by + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('redis', 'redis_cluster', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_redis_cluster_nodes, + redis_cluster_id=redis_cluster_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_redis_cluster_nodes, + limit, + page_size, + redis_cluster_id=redis_cluster_id, + **kwargs + ) + else: + result = client.list_redis_cluster_nodes( + redis_cluster_id=redis_cluster_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + +@redis_cluster_summary_group.command(name=cli_util.override('redis.list_redis_clusters.command_name', 'list-redis-clusters'), help=u"""Lists the OCI Cache clusters in the specified compartment. A cluster is a memory-based storage solution. For more information, see [OCI Cache]. \n[Command Reference](listRedisClusters)""") @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", "DELETING", "DELETED", "FAILED"]), help=u"""A filter to return only resources their lifecycleState matches the given lifecycleState.""") @cli_util.option('--display-name', help=u"""A filter to return only resources that match the entire display name given.""") -@cli_util.option('--id', help=u"""The [OCID] of the Redis cluster.""") +@cli_util.option('--id', help=u"""The [OCID] of the cluster.""") @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'.""") @@ -559,12 +634,13 @@ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, wor cli_util.render_response(result, ctx) -@redis_cluster_group.command(name=cli_util.override('redis.update_redis_cluster.command_name', 'update'), help=u"""Updates the specified Redis cluster. A Redis cluster is a memory-based storage solution. For more information, see [OCI Caching Service with Redis]. \n[Command Reference](updateRedisCluster)""") -@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the Redis cluster.""") +@redis_cluster_group.command(name=cli_util.override('redis.update_redis_cluster.command_name', 'update'), help=u"""Updates the specified OCI Cache cluster. A cluster is a memory-based storage solution. For more information, see [OCI Cache]. \n[Command Reference](updateRedisCluster)""") +@cli_util.option('--redis-cluster-id', required=True, help=u"""The [OCID] of the cluster.""") +@cli_util.option('--shard-count', type=click.INT, help=u"""The number of shards in sharded cluster. Only applicable when clusterMode is SHARDED.""") @cli_util.option('--display-name', help=u"""A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.""") -@cli_util.option('--node-count', type=click.INT, help=u"""The number of nodes in the Redis cluster.""") -@cli_util.option('--node-memory-in-gbs', type=click.FLOAT, help=u"""The amount of memory allocated to the Redis cluster's nodes, in gigabytes.""") -@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of Network Security Group (NSG) [OCIDs] associated with this cluster. For more information, see [Using an NSG for Redis Clusters].""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--node-count', type=click.INT, help=u"""The number of nodes per shard in the cluster when clusterMode is SHARDED. This is the total number of nodes when clusterMode is NONSHARDED.""") +@cli_util.option('--node-memory-in-gbs', type=click.FLOAT, help=u"""The amount of memory allocated to the cluster's nodes, in gigabytes.""") +@cli_util.option('--nsg-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of Network Security Group (NSG) [OCIDs] associated with this cluster. For more information, see [Using an NSG for Clusters].""" + 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.""") @@ -577,7 +653,7 @@ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, wor @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'nsg-ids': {'module': 'redis', 'class': 'list[string]'}, 'freeform-tags': {'module': 'redis', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'redis', 'class': 'dict(str, dict(str, object))'}}) @cli_util.wrap_exceptions -def update_redis_cluster(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, redis_cluster_id, display_name, node_count, node_memory_in_gbs, nsg_ids, freeform_tags, defined_tags, if_match): +def update_redis_cluster(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, redis_cluster_id, shard_count, display_name, node_count, node_memory_in_gbs, nsg_ids, freeform_tags, defined_tags, if_match): if isinstance(redis_cluster_id, six.string_types) and len(redis_cluster_id.strip()) == 0: raise click.UsageError('Parameter --redis-cluster-id cannot be whitespace or empty string') @@ -593,6 +669,9 @@ def update_redis_cluster(ctx, from_json, force, wait_for_state, max_wait_seconds _details = {} + if shard_count is not None: + _details['shardCount'] = shard_count + if display_name is not None: _details['displayName'] = display_name diff --git a/services/redis/tests/util/generated/command_to_api.py b/services/redis/tests/util/generated/command_to_api.py index 65dd10b1b..ad4989196 100644 --- a/services/redis/tests/util/generated/command_to_api.py +++ b/services/redis/tests/util/generated/command_to_api.py @@ -8,6 +8,7 @@ "redis.delete_redis_cluster": "oci.redis.RedisClusterClient.delete_redis_cluster", "redis.get_redis_cluster": "oci.redis.RedisClusterClient.get_redis_cluster", "redis.get_work_request": "oci.redis.RedisClusterClient.get_work_request", + "redis.list_redis_cluster_nodes": "oci.redis.RedisClusterClient.list_redis_cluster_nodes", "redis.list_redis_clusters": "oci.redis.RedisClusterClient.list_redis_clusters", "redis.list_work_request_errors": "oci.redis.RedisClusterClient.list_work_request_errors", "redis.list_work_request_logs": "oci.redis.RedisClusterClient.list_work_request_logs", diff --git a/setup.py b/setup.py index eea3bed66..fb3459a7e 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def open_relative(*path): readme = f.read() requires = [ - 'oci==2.131.1', + 'oci==2.132.0', 'arrow>=1.0.0', 'certifi', 'click==8.0.4', diff --git a/src/oci_cli/service_mapping.py b/src/oci_cli/service_mapping.py index f6f10d9b5..6427212b7 100644 --- a/src/oci_cli/service_mapping.py +++ b/src/oci_cli/service_mapping.py @@ -283,6 +283,11 @@ "Events", "Observability & Management" ], + "fleet-apps-management": [ + "fleet_apps_management", + "Fleet Application Management Service", + "Others" + ], "fleet-software-update": [ "fleet_software_update", "Exadata Fleet Update service", @@ -585,7 +590,7 @@ ], "redis": [ "redis", - "Redis Service", + "OCI Cache", "Others" ], "resource-manager": [ diff --git a/src/oci_cli/version.py b/src/oci_cli/version.py index 1663997ce..a0a27ec62 100644 --- a/src/oci_cli/version.py +++ b/src/oci_cli/version.py @@ -2,4 +2,4 @@ # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. -__version__ = '3.45.2' +__version__ = '3.46.0'