diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 69de535cf..49a98ddea 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,36 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__. +3.89.3 - 2026-07-21 +------------------- +Added +~~~~~ +* Analytics service + + * Support for Analytics Instance Resource Groups for Oracle Analytics Cloud (OAC) + + * ``oci analytics analytics-instance create-resource-group`` + * ``oci analytics analytics-instance delete-resource-group`` + * ``oci analytics analytics-instance get-resource-group`` + * ``oci analytics analytics-instance list-resource-groups`` + * ``oci analytics analytics-instance update-resource-group`` + +* Networking service + + * Support for new optional parameter for multiple FastConnect enhancements + + * ``oci network cross-connect create --interface-down-timer-value-in-milliseconds --is-interface-hold-timer-enabled --is-qos-enabled`` + * ``oci network cross-connect update --interface-down-timer-value-in-milliseconds --is-interface-hold-timer-enabled`` + * ``oci network cross-connect-group create --interface-down-timer-value-in-milliseconds --is-interface-hold-timer-enabled --is-qos-enabled --minimum-links`` + * ``oci network cross-connect-group update --interface-down-timer-value-in-milliseconds --is-interface-hold-timer-enabled --minimum-links`` + * ``oci network virtual-circuit create --traffic-mode`` + * ``oci network virtual-circuit update --traffic-mode`` + + * Support for getting and updating a Letter of Authority for a cross-connect + + * ``oci network letter-of-authority update-cross-connect`` + * ``oci network letter-of-authority get-cross-connect`` + 3.89.2 - 2026-07-14 ------------------- Added diff --git a/requirements.txt b/requirements.txt index d3f33c013..21d5262ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ Jinja2>=3.1.5,<4.0.0; python_version >= '3.7' jmespath>=0.10.0,<=1.0.1 ndg-httpsclient==0.4.2 mock==2.0.0 -oci==2.182.0 +oci==2.182.1 packaging>=22.0,<25.0; python_version > '3.8' packaging==20.2; python_version <= '3.8' pluggy==0.13.0; python_version < '3.9' 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 c1aceed83..b8d3500c5 100644 --- a/services/analytics/src/oci_cli_analytics/generated/analytics_cli.py +++ b/services/analytics/src/oci_cli_analytics/generated/analytics_cli.py @@ -34,7 +34,7 @@ def work_request_error_group(): pass -@click.command(cli_util.override('analytics.analytics_instance_group.command_name', 'analytics-instance'), cls=CommandGroupWithAlias, help="""Analytics Instance metadata.""") +@click.command(cli_util.override('analytics.analytics_instance_group.command_name', 'analytics-instance'), cls=CommandGroupWithAlias, help="""Analytics instance metadata.""") @cli_util.help_option_group def analytics_instance_group(): pass @@ -52,8 +52,8 @@ def work_request_group(): analytics_root_group.add_command(work_request_group) -@analytics_instance_group.command(name=cli_util.override('analytics.change_analytics_instance_compartment.command_name', 'change-compartment'), help=u"""Change the compartment of an Analytics instance. The operation is long-running and creates a new WorkRequest. \n[Command Reference](changeAnalyticsInstanceCompartment)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.change_analytics_instance_compartment.command_name', 'change-compartment'), help=u"""Change the compartment of an Analytics instance. The operation is long-running and creates a new work request. \n[Command Reference](changeAnalyticsInstanceCompartment)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the new compartment.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -113,8 +113,8 @@ def change_analytics_instance_compartment(ctx, from_json, wait_for_state, max_wa cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.change_analytics_instance_network_endpoint.command_name', 'change-analytics-instance-network-endpoint'), help=u"""Change an Analytics instance network endpoint. The operation is long-running and creates a new WorkRequest. \n[Command Reference](changeAnalyticsInstanceNetworkEndpoint)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.change_analytics_instance_network_endpoint.command_name', 'change-analytics-instance-network-endpoint'), help=u"""Change the network endpoint for an Analytics instance. The operation is long-running and creates a new work request. \n[Command Reference](changeAnalyticsInstanceNetworkEndpoint)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") @cli_util.option('--network-endpoint-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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -174,12 +174,12 @@ def change_analytics_instance_network_endpoint(ctx, from_json, wait_for_state, m cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.change_analytics_instance_network_endpoint_private_endpoint_details.command_name', 'change-analytics-instance-network-endpoint-private-endpoint-details'), help=u"""Change an Analytics instance network endpoint. The operation is long-running and creates a new WorkRequest. \n[Command Reference](changeAnalyticsInstanceNetworkEndpoint)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.change_analytics_instance_network_endpoint_private_endpoint_details.command_name', 'change-analytics-instance-network-endpoint-private-endpoint-details'), help=u"""Change the network endpoint for an Analytics instance. The operation is long-running and creates a new work request. \n[Command Reference](changeAnalyticsInstanceNetworkEndpoint)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") @cli_util.option('--network-endpoint-details-vcn-id', required=True, help=u"""The VCN OCID for the private endpoint.""") @cli_util.option('--network-endpoint-details-subnet-id', required=True, help=u"""The subnet OCID for the private endpoint.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") -@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('--network-endpoint-details-network-security-group-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Network Security Group OCIDs for the 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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -244,14 +244,14 @@ def change_analytics_instance_network_endpoint_private_endpoint_details(ctx, fro cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.change_analytics_instance_network_endpoint_public_endpoint_details.command_name', 'change-analytics-instance-network-endpoint-public-endpoint-details'), help=u"""Change an Analytics instance network endpoint. The operation is long-running and creates a new WorkRequest. \n[Command Reference](changeAnalyticsInstanceNetworkEndpoint)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.change_analytics_instance_network_endpoint_public_endpoint_details.command_name', 'change-analytics-instance-network-endpoint-public-endpoint-details'), help=u"""Change the network endpoint for an Analytics instance. The operation is long-running and creates a new work request. \n[Command Reference](changeAnalyticsInstanceNetworkEndpoint)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the 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('--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. This option is a JSON list with items of type VirtualCloudNetwork. For documentation on VirtualCloudNetwork please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/analytics/20190331/datatypes/VirtualCloudNetwork.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--network-endpoint-details-whitelisted-services', type=custom_types.CliCaseInsensitiveChoice(["ALL"]), help=u"""Oracle Cloud Services that are allowed to access this Analytics instance.""") +@cli_util.option('--network-endpoint-details-whitelisted-services', type=custom_types.CliCaseInsensitiveChoice(["ALL"]), help=u"""Oracle Cloud services that are allowed to access this 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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -320,10 +320,10 @@ def change_analytics_instance_network_endpoint_public_endpoint_details(ctx, from cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.create_analytics_instance.command_name', 'create'), help=u"""Create a new AnalyticsInstance in the specified compartment. The operation is long-running and creates a new WorkRequest. \n[Command Reference](createAnalyticsInstance)""") -@cli_util.option('--name', required=True, help=u"""The name of the Analytics instance. This name must be unique in the tenancy and cannot be changed.""") +@analytics_instance_group.command(name=cli_util.override('analytics.create_analytics_instance.command_name', 'create'), help=u"""Create a new Analytics instance in the specified compartment. The operation is long-running and creates a new work request. \n[Command Reference](createAnalyticsInstance)""") +@cli_util.option('--name', required=True, help=u"""The name of the Analytics instance. This name must be unique in the tenancy and can't be changed. The name must start with a letter and can contain only letters, numbers and dash (-).""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment.""") -@cli_util.option('--feature-set', required=True, type=custom_types.CliCaseInsensitiveChoice(["SELF_SERVICE_ANALYTICS", "ENTERPRISE_ANALYTICS"]), help=u"""Analytics feature set.""") +@cli_util.option('--feature-set', required=True, type=custom_types.CliCaseInsensitiveChoice(["SELF_SERVICE_ANALYTICS", "ENTERPRISE_ANALYTICS"]), help=u"""The feature set. Either `SELF_SERVICE_ANALYTICS` (Professional Edition) or `ENTERPRISE_ANALYTICS` (Enterprise Edition).""") @cli_util.option('--capacity', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--license-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The license used for the service.""") @cli_util.option('--description', help=u"""Optional description.""") @@ -336,11 +336,11 @@ 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('--update-channel', type=custom_types.CliCaseInsensitiveChoice(["REGULAR", "EARLY", "PHASE_2", "PHASE_1"]), help=u"""Analytics instance update channel.""") -@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('--update-channel', type=custom_types.CliCaseInsensitiveChoice(["REGULAR", "EARLY", "PHASE_2", "PHASE_1"]), help=u"""The Analytics instance update cycle.""") +@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 that the default Oracle-managed encryption is used.""") +@cli_util.option('--domain-id', help=u"""The OCID of the identity domain to use for the new Analytics instance. For example: ocid1.domain.oc1..ocid1.domain.oc1..aaaaaa111111bbbbbb222222cccccc333333dddddd444444eeeeee5555.""") +@cli_util.option('--admin-user', help=u"""The Analytics instance administrator user. This must be the user name (not OCID) of a user in the nominated identity domain. For example: john.smith@example.com.""") +@cli_util.option('--feature-bundle', type=custom_types.CliCaseInsensitiveChoice(["FAW_PAID", "FAW_FREE", "FDI_BASE", "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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -429,10 +429,10 @@ def create_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.create_analytics_instance_private_endpoint_details.command_name', 'create-analytics-instance-private-endpoint-details'), help=u"""Create a new AnalyticsInstance in the specified compartment. The operation is long-running and creates a new WorkRequest. \n[Command Reference](createAnalyticsInstance)""") -@cli_util.option('--name', required=True, help=u"""The name of the Analytics instance. This name must be unique in the tenancy and cannot be changed.""") +@analytics_instance_group.command(name=cli_util.override('analytics.create_analytics_instance_private_endpoint_details.command_name', 'create-analytics-instance-private-endpoint-details'), help=u"""Create a new Analytics instance in the specified compartment. The operation is long-running and creates a new work request. \n[Command Reference](createAnalyticsInstance)""") +@cli_util.option('--name', required=True, help=u"""The name of the Analytics instance. This name must be unique in the tenancy and can't be changed. The name must start with a letter and can contain only letters, numbers and dash (-).""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment.""") -@cli_util.option('--feature-set', required=True, type=custom_types.CliCaseInsensitiveChoice(["SELF_SERVICE_ANALYTICS", "ENTERPRISE_ANALYTICS"]), help=u"""Analytics feature set.""") +@cli_util.option('--feature-set', required=True, type=custom_types.CliCaseInsensitiveChoice(["SELF_SERVICE_ANALYTICS", "ENTERPRISE_ANALYTICS"]), help=u"""The feature set. Either `SELF_SERVICE_ANALYTICS` (Professional Edition) or `ENTERPRISE_ANALYTICS` (Enterprise Edition).""") @cli_util.option('--capacity', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--license-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The license used for the service.""") @cli_util.option('--network-endpoint-details-vcn-id', required=True, help=u"""The VCN OCID for the private endpoint.""") @@ -446,12 +446,12 @@ 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('--update-channel', type=custom_types.CliCaseInsensitiveChoice(["REGULAR", "EARLY", "PHASE_2", "PHASE_1"]), help=u"""Analytics instance update channel.""") -@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('--update-channel', type=custom_types.CliCaseInsensitiveChoice(["REGULAR", "EARLY", "PHASE_2", "PHASE_1"]), help=u"""The Analytics instance update cycle.""") +@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 that the default Oracle-managed encryption is used.""") +@cli_util.option('--domain-id', help=u"""The OCID of the identity domain to use for the new Analytics instance. For example: ocid1.domain.oc1..ocid1.domain.oc1..aaaaaa111111bbbbbb222222cccccc333333dddddd444444eeeeee5555.""") +@cli_util.option('--admin-user', help=u"""The Analytics instance administrator user. This must be the user name (not OCID) of a user in the nominated identity domain. For example: john.smith@example.com.""") +@cli_util.option('--feature-bundle', type=custom_types.CliCaseInsensitiveChoice(["FAW_PAID", "FAW_FREE", "FDI_BASE", "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 the 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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -545,10 +545,10 @@ def create_analytics_instance_private_endpoint_details(ctx, from_json, wait_for_ cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.create_analytics_instance_public_endpoint_details.command_name', 'create-analytics-instance-public-endpoint-details'), help=u"""Create a new AnalyticsInstance in the specified compartment. The operation is long-running and creates a new WorkRequest. \n[Command Reference](createAnalyticsInstance)""") -@cli_util.option('--name', required=True, help=u"""The name of the Analytics instance. This name must be unique in the tenancy and cannot be changed.""") +@analytics_instance_group.command(name=cli_util.override('analytics.create_analytics_instance_public_endpoint_details.command_name', 'create-analytics-instance-public-endpoint-details'), help=u"""Create a new Analytics instance in the specified compartment. The operation is long-running and creates a new work request. \n[Command Reference](createAnalyticsInstance)""") +@cli_util.option('--name', required=True, help=u"""The name of the Analytics instance. This name must be unique in the tenancy and can't be changed. The name must start with a letter and can contain only letters, numbers and dash (-).""") @cli_util.option('--compartment-id', required=True, help=u"""The OCID of the compartment.""") -@cli_util.option('--feature-set', required=True, type=custom_types.CliCaseInsensitiveChoice(["SELF_SERVICE_ANALYTICS", "ENTERPRISE_ANALYTICS"]), help=u"""Analytics feature set.""") +@cli_util.option('--feature-set', required=True, type=custom_types.CliCaseInsensitiveChoice(["SELF_SERVICE_ANALYTICS", "ENTERPRISE_ANALYTICS"]), help=u"""The feature set. Either `SELF_SERVICE_ANALYTICS` (Professional Edition) or `ENTERPRISE_ANALYTICS` (Enterprise Edition).""") @cli_util.option('--capacity', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--license-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The license used for the service.""") @cli_util.option('--description', help=u"""Optional description.""") @@ -560,16 +560,16 @@ 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('--update-channel', type=custom_types.CliCaseInsensitiveChoice(["REGULAR", "EARLY", "PHASE_2", "PHASE_1"]), help=u"""Analytics instance update channel.""") -@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('--update-channel', type=custom_types.CliCaseInsensitiveChoice(["REGULAR", "EARLY", "PHASE_2", "PHASE_1"]), help=u"""The Analytics instance update cycle.""") +@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 that the default Oracle-managed encryption is used.""") +@cli_util.option('--domain-id', help=u"""The OCID of the identity domain to use for the new Analytics instance. For example: ocid1.domain.oc1..ocid1.domain.oc1..aaaaaa111111bbbbbb222222cccccc333333dddddd444444eeeeee5555.""") +@cli_util.option('--admin-user', help=u"""The Analytics instance administrator user. This must be the user name (not OCID) of a user in the nominated identity domain. For example: john.smith@example.com.""") +@cli_util.option('--feature-bundle', type=custom_types.CliCaseInsensitiveChoice(["FAW_PAID", "FAW_FREE", "FDI_BASE", "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. This option is a JSON list with items of type VirtualCloudNetwork. For documentation on VirtualCloudNetwork please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/analytics/20190331/datatypes/VirtualCloudNetwork.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--network-endpoint-details-whitelisted-services', type=custom_types.CliCaseInsensitiveChoice(["ALL"]), help=u"""Oracle Cloud Services that are allowed to access this Analytics instance.""") +@cli_util.option('--network-endpoint-details-whitelisted-services', type=custom_types.CliCaseInsensitiveChoice(["ALL"]), help=u"""Oracle Cloud services that are allowed to access this 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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -667,16 +667,16 @@ def create_analytics_instance_public_endpoint_details(ctx, from_json, wait_for_s cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.create_private_access_channel.command_name', 'create-private-access-channel'), help=u"""Create an Private access Channel for the Analytics instance. The operation is long-running and creates a new WorkRequest. \n[Command Reference](createPrivateAccessChannel)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") -@cli_util.option('--display-name', required=True, help=u"""Display Name of the Private Access Channel.""") -@cli_util.option('--vcn-id', required=True, help=u"""OCID of the customer VCN peered with private access channel.""") -@cli_util.option('--subnet-id', required=True, help=u"""OCID of the customer subnet connected to private access channel.""") -@cli_util.option('--private-source-dns-zones', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Private Source DNS zones registered with Private Access Channel, where datasource hostnames from these dns zones / domains will be resolved in the peered VCN for access from Analytics Instance. Min of 1 is required and Max of 30 Private Source DNS zones can be registered.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-source-scan-hosts', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Private Source DB SCAN hosts registered with Private Access Channel for access from Analytics Instance. +@analytics_instance_group.command(name=cli_util.override('analytics.create_private_access_channel.command_name', 'create-private-access-channel'), help=u"""Create an private access channel for the Analytics instance. The operation is long-running and creates a new work request. \n[Command Reference](createPrivateAccessChannel)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--display-name', required=True, help=u"""Display name of the private access channel.""") +@cli_util.option('--vcn-id', required=True, help=u"""OCID of the customer VCN peered with the private access channel.""") +@cli_util.option('--subnet-id', required=True, help=u"""OCID of the customer subnet connected to the private access channel.""") +@cli_util.option('--private-source-dns-zones', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of private source DNS zones registered with the private access channel. The datasource hostnames from these DNS zones / domains will be resolved in the peered VCN for access from the Analytics instance. Minimum 1 private source is required. Maximum 30 private source DNS zones can be registered.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-source-scan-hosts', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of private source database SCAN hosts registered with the private access channel for access from the Analytics instance. This option is a JSON list with items of type PrivateSourceScanHost. For documentation on PrivateSourceScanHost please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/analytics/20190331/datatypes/PrivateSourceScanHost.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--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('--network-security-group-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Network Security Group OCIDs for the 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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -741,14 +741,82 @@ def create_private_access_channel(ctx, from_json, wait_for_state, max_wait_secon cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.create_vanity_url.command_name', 'create-vanity-url'), help=u"""Allows specifying a custom host name to be used to access the analytics instance. This requires prior setup of DNS entry and certificate for this host. \n[Command Reference](createVanityUrl)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") -@cli_util.option('--hosts', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of fully qualified hostnames supported by this vanity URL definition (max of 3).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-key', required=True, help=u"""PEM Private key for HTTPS connections.""") +@analytics_instance_group.command(name=cli_util.override('analytics.create_resource_group.command_name', 'create-resource-group'), help=u"""Create a new resource group for the instance \n[Command Reference](createResourceGroup)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--resource-name', required=True, help=u"""Meaningful name of resource group for end user""") +@cli_util.option('--capacity', required=True, type=click.INT, help=u"""The capacity (in OCPU's) to be allocated for this resource.""") +@cli_util.option('--display-name', help=u"""Meaningful name of resource group for end user""") +@cli_util.option('--description', help=u"""Optional description of the resource group""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'analytics', 'class': 'InstanceResourceGroup'}) +@cli_util.wrap_exceptions +def create_resource_group(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, analytics_instance_id, resource_name, capacity, display_name, description): + + 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 = {} + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + + _details = {} + _details['resourceName'] = resource_name + _details['capacity'] = capacity + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + client = cli_util.build_client('analytics', 'analytics', ctx) + result = client.create_resource_group( + analytics_instance_id=analytics_instance_id, + create_resource_group_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.create_vanity_url.command_name', 'create-vanity-url'), help=u"""Allows you to specify a custom host name to be used to access the Analytics instance. You must set up a DNS entry and certificate for this host in advance. \n[Command Reference](createVanityUrl)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--hosts', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of fully-qualified hostnames supported by this vanity URL definition (maximum of 3).""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--private-key', required=True, help=u"""PEM private key for HTTPS connections.""") @cli_util.option('--public-certificate', required=True, help=u"""PEM certificate for HTTPS connections.""") -@cli_util.option('--ca-certificate', required=True, help=u"""PEM CA certificate(s) for HTTPS connections. This may include multiple PEM certificates.""") +@cli_util.option('--ca-certificate', required=True, help=u"""PEM CA certificates for HTTPS connections. This may include multiple PEM certificates.""") @cli_util.option('--description', help=u"""Optional description.""") -@cli_util.option('--passphrase', help=u"""Passphrase for the PEM Private key (if any).""") +@cli_util.option('--passphrase', help=u"""Passphrase for the PEM private key (if any).""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") @@ -813,8 +881,8 @@ def create_vanity_url(ctx, from_json, wait_for_state, max_wait_seconds, wait_int cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.delete_analytics_instance.command_name', 'delete'), help=u"""Terminates the specified Analytics instance. The operation is long-running and creates a new WorkRequest. \n[Command Reference](deleteAnalyticsInstance)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.delete_analytics_instance.command_name', 'delete'), help=u"""Deletes the specified Analytics instance. The operation is long-running and creates a new work request. \n[Command Reference](deleteAnalyticsInstance)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the 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.confirm_delete_option @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -869,9 +937,9 @@ def delete_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.delete_private_access_channel.command_name', 'delete-private-access-channel'), help=u"""Delete an Analytics instance's Private access channel with the given unique identifier key. \n[Command Reference](deletePrivateAccessChannel)""") -@cli_util.option('--private-access-channel-key', required=True, help=u"""The unique identifier key of the Private Access Channel.""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.delete_private_access_channel.command_name', 'delete-private-access-channel'), help=u"""Delete a private access channel with a given unique identifier key, for an Analytics instance. \n[Command Reference](deletePrivateAccessChannel)""") +@cli_util.option('--private-access-channel-key', required=True, help=u"""The unique identifier key of the private access channel.""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the 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.confirm_delete_option @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -930,9 +998,70 @@ def delete_private_access_channel(ctx, from_json, wait_for_state, max_wait_secon cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.delete_vanity_url.command_name', 'delete-vanity-url'), help=u"""Allows deleting a previously created vanity url. \n[Command Reference](deleteVanityUrl)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") -@cli_util.option('--vanity-url-key', required=True, help=u"""Specify unique identifier key of a vanity url to update or delete.""") +@analytics_instance_group.command(name=cli_util.override('analytics.delete_resource_group.command_name', 'delete-resource-group'), help=u"""Allows deleting a previously created resource group. \n[Command Reference](deleteResourceGroup)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--analytics-instance-resource-group-id', required=True, help=u"""Specify unique id of a resource group within 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.confirm_delete_option +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}) +@cli_util.wrap_exceptions +def delete_resource_group(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, analytics_instance_id, analytics_instance_resource_group_id, 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') + + if isinstance(analytics_instance_resource_group_id, six.string_types) and len(analytics_instance_resource_group_id.strip()) == 0: + raise click.UsageError('Parameter --analytics-instance-resource-group-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('analytics', 'analytics', ctx) + result = client.delete_resource_group( + analytics_instance_id=analytics_instance_id, + analytics_instance_resource_group_id=analytics_instance_resource_group_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) + + +@analytics_instance_group.command(name=cli_util.override('analytics.delete_vanity_url.command_name', 'delete-vanity-url'), help=u"""Deletes a previously created vanity URL. \n[Command Reference](deleteVanityUrl)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--vanity-url-key', required=True, help=u"""Specify unique identifier key of a vanity URL to update or delete.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.confirm_delete_option @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -991,7 +1120,7 @@ def delete_vanity_url(ctx, from_json, wait_for_state, max_wait_seconds, wait_int cli_util.render_response(result, ctx) -@work_request_group.command(name=cli_util.override('analytics.delete_work_request.command_name', 'delete'), help=u"""Cancel a work request that has not started yet. \n[Command Reference](deleteWorkRequest)""") +@work_request_group.command(name=cli_util.override('analytics.delete_work_request.command_name', 'delete'), help=u"""Cancel a work request that hasn't started yet. \n[Command Reference](deleteWorkRequest)""") @cli_util.option('--work-request-id', required=True, help=u"""The OCID of the work request.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.confirm_delete_option @@ -1017,8 +1146,8 @@ def delete_work_request(ctx, from_json, work_request_id, if_match): cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.get_analytics_instance.command_name', 'get'), help=u"""Info for a specific Analytics instance. \n[Command Reference](getAnalyticsInstance)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.get_analytics_instance.command_name', 'get'), help=u"""Information about a specific Analytics instance. \n[Command Reference](getAnalyticsInstance)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context @@ -1039,9 +1168,9 @@ def get_analytics_instance(ctx, from_json, analytics_instance_id): cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.get_private_access_channel.command_name', 'get-private-access-channel'), help=u"""Retrieve private access channel in the specified Analytics Instance. \n[Command Reference](getPrivateAccessChannel)""") -@cli_util.option('--private-access-channel-key', required=True, help=u"""The unique identifier key of the Private Access Channel.""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.get_private_access_channel.command_name', 'get-private-access-channel'), help=u"""Retrieve private access channel for the specified Analytics Instance. \n[Command Reference](getPrivateAccessChannel)""") +@cli_util.option('--private-access-channel-key', required=True, help=u"""The unique identifier key of the private access channel.""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") @json_skeleton_utils.get_cli_json_input_option({}) @cli_util.help_option @click.pass_context @@ -1066,6 +1195,33 @@ def get_private_access_channel(ctx, from_json, private_access_channel_key, analy cli_util.render_response(result, ctx) +@analytics_instance_group.command(name=cli_util.override('analytics.get_resource_group.command_name', 'get-resource-group'), help=u"""Get details of a resource group for an instance \n[Command Reference](getResourceGroup)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--analytics-instance-resource-group-id', required=True, help=u"""Specify unique id of a resource group within an Analytics instance.""") +@json_skeleton_utils.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': 'analytics', 'class': 'InstanceResourceGroup'}) +@cli_util.wrap_exceptions +def get_resource_group(ctx, from_json, analytics_instance_id, analytics_instance_resource_group_id): + + 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') + + if isinstance(analytics_instance_resource_group_id, six.string_types) and len(analytics_instance_resource_group_id.strip()) == 0: + raise click.UsageError('Parameter --analytics-instance-resource-group-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('analytics', 'analytics', ctx) + result = client.get_resource_group( + analytics_instance_id=analytics_instance_id, + analytics_instance_resource_group_id=analytics_instance_resource_group_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @work_request_group.command(name=cli_util.override('analytics.get_work_request.command_name', 'get'), help=u"""Get the details of a work request. \n[Command Reference](getWorkRequest)""") @cli_util.option('--work-request-id', required=True, help=u"""The OCID of the work request.""") @json_skeleton_utils.get_cli_json_input_option({}) @@ -1156,6 +1312,68 @@ def list_analytics_instances(ctx, from_json, all_pages, page_size, compartment_i cli_util.render_response(result, ctx) +@analytics_instance_group.command(name=cli_util.override('analytics.list_resource_groups.command_name', 'list-resource-groups'), help=u"""List resource groups associated with an instance. \n[Command Reference](listResourceGroups)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--name', help=u"""A filter to return only resources that match the given name exactly.""") +@cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination]. + +Example: `50`""") +@cli_util.option('--page', help=u"""For list pagination. The value of the `opc-next-page` response header from the previous \"List\" call. For important details about how pagination works, see [List Pagination].""") +@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["id", "resourceName", "displayName", "description", "capacity", "status"]), help=u"""The field to sort by (one column only). Default sort order is default group first, then sort by resource name, ascending.""") +@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('--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': 'analytics', 'class': 'list[InstanceResourceGroupSummary]'}) +@cli_util.wrap_exceptions +def list_resource_groups(ctx, from_json, all_pages, page_size, analytics_instance_id, name, limit, page, sort_by, sort_order): + + if all_pages and limit: + raise click.UsageError('If you provide the --all option you cannot provide the --limit option') + + if isinstance(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 name is not None: + kwargs['name'] = name + if limit is not None: + kwargs['limit'] = limit + if page is not None: + kwargs['page'] = page + if sort_by is not None: + kwargs['sort_by'] = sort_by + if sort_order is not None: + kwargs['sort_order'] = sort_order + kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id']) + client = cli_util.build_client('analytics', 'analytics', ctx) + if all_pages: + if page_size: + kwargs['limit'] = page_size + + result = cli_util.list_call_get_all_results( + client.list_resource_groups, + analytics_instance_id=analytics_instance_id, + **kwargs + ) + elif limit is not None: + result = cli_util.list_call_get_up_to_limit( + client.list_resource_groups, + limit, + page_size, + analytics_instance_id=analytics_instance_id, + **kwargs + ) + else: + result = client.list_resource_groups( + analytics_instance_id=analytics_instance_id, + **kwargs + ) + cli_util.render_response(result, ctx) + + @work_request_error_group.command(name=cli_util.override('analytics.list_work_request_errors.command_name', 'list'), help=u"""Get the errors of a work request. \n[Command Reference](listWorkRequestErrors)""") @cli_util.option('--work-request-id', required=True, help=u"""The OCID of the work request.""") @cli_util.option('--limit', type=click.INT, help=u"""For list pagination. The maximum number of results per page, or items to return in a paginated \"List\" call. For important details about how pagination works, see [List Pagination]. @@ -1327,8 +1545,8 @@ def list_work_requests(ctx, from_json, all_pages, page_size, compartment_id, res cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.scale_analytics_instance.command_name', 'scale'), help=u"""Scale an Analytics instance up or down. The operation is long-running and creates a new WorkRequest. \n[Command Reference](scaleAnalyticsInstance)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.scale_analytics_instance.command_name', 'scale'), help=u"""Scale an Analytics instance up or down. The operation is long-running and creates a new work request. \n[Command Reference](scaleAnalyticsInstance)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") @cli_util.option('--capacity', 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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -1389,8 +1607,8 @@ def scale_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, w @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('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--feature-bundle', type=custom_types.CliCaseInsensitiveChoice(["FAW_PAID", "FAW_FREE", "FDI_BASE", "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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -1451,9 +1669,9 @@ def set_feature_bundle(ctx, from_json, wait_for_state, max_wait_seconds, wait_in 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).""") +@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 default Oracle-managed key. \n[Command Reference](setKmsKey)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@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 the default Oracle-managed encryption (this API doesn't support null).""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -1512,8 +1730,8 @@ def set_kms_key(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_ cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.start_analytics_instance.command_name', 'start'), help=u"""Starts the specified Analytics instance. The operation is long-running and creates a new WorkRequest. \n[Command Reference](startAnalyticsInstance)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.start_analytics_instance.command_name', 'start'), help=u"""Starts the specified Analytics instance. The operation is long-running and creates a new work request. \n[Command Reference](startAnalyticsInstance)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the 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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -1567,8 +1785,8 @@ def start_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.stop_analytics_instance.command_name', 'stop'), help=u"""Stop the specified Analytics instance. The operation is long-running and creates a new WorkRequest. \n[Command Reference](stopAnalyticsInstance)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@analytics_instance_group.command(name=cli_util.override('analytics.stop_analytics_instance.command_name', 'stop'), help=u"""Stop the specified Analytics instance. The operation is long-running and creates a new work request. \n[Command Reference](stopAnalyticsInstance)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the 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 ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") @@ -1623,7 +1841,7 @@ def stop_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, wa @analytics_instance_group.command(name=cli_util.override('analytics.update_analytics_instance.command_name', 'update'), help=u"""Updates certain fields of an Analytics instance. Fields that are not provided in the request will not be updated. \n[Command Reference](updateAnalyticsInstance)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") @cli_util.option('--description', help=u"""Optional description.""") @cli_util.option('--email-notification', help=u"""Email address receiving notifications.""") @cli_util.option('--license-type', type=custom_types.CliCaseInsensitiveChoice(["LICENSE_INCLUDED", "BRING_YOUR_OWN_LICENSE"]), help=u"""The license used for the service.""") @@ -1633,7 +1851,7 @@ def stop_analytics_instance(ctx, from_json, wait_for_state, max_wait_seconds, wa @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('--update-channel', type=custom_types.CliCaseInsensitiveChoice(["REGULAR", "EARLY", "PHASE_2", "PHASE_1"]), help=u"""Analytics instance update channel.""") +@cli_util.option('--update-channel', type=custom_types.CliCaseInsensitiveChoice(["REGULAR", "EARLY", "PHASE_2", "PHASE_1"]), help=u"""The Analytics instance update cycle.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", "INACTIVE", "UPDATING"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACTIVE --wait-for-state UPDATING would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -1710,19 +1928,19 @@ def update_analytics_instance(ctx, from_json, force, wait_for_state, max_wait_se cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.update_private_access_channel.command_name', 'update-private-access-channel'), help=u"""Update the Private Access Channel with the given unique identifier key in the specified Analytics Instance. \n[Command Reference](updatePrivateAccessChannel)""") -@cli_util.option('--private-access-channel-key', required=True, help=u"""The unique identifier key of the Private Access Channel.""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") -@cli_util.option('--display-name', help=u"""Display Name of the Private Access Channel.""") -@cli_util.option('--vcn-id', help=u"""OCID of the customer VCN peered with private access channel.""") -@cli_util.option('--subnet-id', help=u"""OCID of the customer subnet connected to private access channel.""") -@cli_util.option('--private-source-dns-zones', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Private Source DNS zones registered with Private Access Channel, where datasource hostnames from these dns zones / domains will be resolved in the peered VCN for access from Analytics Instance. Min of 1 is required and Max of 30 Private Source DNS zones can be registered. +@analytics_instance_group.command(name=cli_util.override('analytics.update_private_access_channel.command_name', 'update-private-access-channel'), help=u"""Update the private access channel with the given unique identifier key in the specified Analytics instance. \n[Command Reference](updatePrivateAccessChannel)""") +@cli_util.option('--private-access-channel-key', required=True, help=u"""The unique identifier key of the private access channel.""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--display-name', help=u"""Display name of the private access channel.""") +@cli_util.option('--vcn-id', help=u"""OCID of the customer VCN peered with the private access channel.""") +@cli_util.option('--subnet-id', help=u"""OCID of the customer subnet connected to the private access channel.""") +@cli_util.option('--private-source-dns-zones', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of private source DNS zones registered with the private access channel. The datasource hostnames from these DNS zones / domains will be resolved in the peered VCN for access from the Analytics instance. Minimum 1 private source is required. Maximum 30 private source DNS zones can be registered. This option is a JSON list with items of type PrivateSourceDnsZone. For documentation on PrivateSourceDnsZone please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/analytics/20190331/datatypes/PrivateSourceDnsZone.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--private-source-scan-hosts', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of Private Source DB SCAN hosts registered with Private Access Channel for access from Analytics Instance. +@cli_util.option('--private-source-scan-hosts', type=custom_types.CLI_COMPLEX_TYPE, help=u"""List of private source database SCAN hosts registered with the private access channel for access from the Analytics instance. This option is a JSON list with items of type PrivateSourceScanHost. For documentation on PrivateSourceScanHost please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/analytics/20190331/datatypes/PrivateSourceScanHost.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) -@cli_util.option('--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('--network-security-group-ids', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Network Security Group OCIDs for the Analytics instance.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -1807,13 +2025,89 @@ def update_private_access_channel(ctx, from_json, force, wait_for_state, max_wai cli_util.render_response(result, ctx) -@analytics_instance_group.command(name=cli_util.override('analytics.update_vanity_url.command_name', 'update-vanity-url'), help=u"""Allows uploading a new certificate for a vanity url, which will have to be done when the current certificate is expiring. \n[Command Reference](updateVanityUrl)""") -@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the AnalyticsInstance.""") -@cli_util.option('--vanity-url-key', required=True, help=u"""Specify unique identifier key of a vanity url to update or delete.""") -@cli_util.option('--private-key', required=True, help=u"""PEM Private key for HTTPS connections.""") +@analytics_instance_group.command(name=cli_util.override('analytics.update_resource_group.command_name', 'update-resource-group'), help=u"""Update any fields in a resource group \n[Command Reference](updateResourceGroup)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--analytics-instance-resource-group-id', required=True, help=u"""Specify unique id of a resource group within an Analytics instance.""") +@cli_util.option('--resource-name', required=True, help=u"""Meaningful name of resource group for end user""") +@cli_util.option('--capacity', required=True, type=click.INT, help=u"""The capacity (in OCPU's) to be allocated for this resource.""") +@cli_util.option('--display-name', help=u"""Meaningful name of resource group for end user""") +@cli_util.option('--description', help=u"""Optional description of the resource group""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") +@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") +@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'analytics', 'class': 'InstanceResourceGroup'}) +@cli_util.wrap_exceptions +def update_resource_group(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, analytics_instance_id, analytics_instance_resource_group_id, resource_name, capacity, display_name, description, 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') + + if isinstance(analytics_instance_resource_group_id, six.string_types) and len(analytics_instance_resource_group_id.strip()) == 0: + raise click.UsageError('Parameter --analytics-instance-resource-group-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['resourceName'] = resource_name + _details['capacity'] = capacity + + if display_name is not None: + _details['displayName'] = display_name + + if description is not None: + _details['description'] = description + + client = cli_util.build_client('analytics', 'analytics', ctx) + result = client.update_resource_group( + analytics_instance_id=analytics_instance_id, + analytics_instance_resource_group_id=analytics_instance_resource_group_id, + update_resource_group_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.update_vanity_url.command_name', 'update-vanity-url'), help=u"""Uploads a new certificate for a vanity URL. Required before the current certificate expires. \n[Command Reference](updateVanityUrl)""") +@cli_util.option('--analytics-instance-id', required=True, help=u"""The OCID of the Analytics instance.""") +@cli_util.option('--vanity-url-key', required=True, help=u"""Specify unique identifier key of a vanity URL to update or delete.""") +@cli_util.option('--private-key', required=True, help=u"""PEM private key for HTTPS connections.""") @cli_util.option('--public-certificate', required=True, help=u"""PEM certificate for HTTPS connections.""") -@cli_util.option('--ca-certificate', required=True, help=u"""PEM CA certificate(s) for HTTPS connections. This may include multiple PEM certificates.""") -@cli_util.option('--passphrase', help=u"""Passphrase for the PEM Private key (if any).""") +@cli_util.option('--ca-certificate', required=True, help=u"""PEM CA certificates for HTTPS connections. This may include multiple PEM certificates.""") +@cli_util.option('--passphrase', help=u"""Passphrase for the PEM private key (if any).""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), multiple=True, help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. Multiple states can be specified, returning on the first state. For example, --wait-for-state ACCEPTED --wait-for-state CANCELED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""") diff --git a/services/analytics/tests/util/generated/command_to_api.py b/services/analytics/tests/util/generated/command_to_api.py index d7167baf3..7991b7eb0 100644 --- a/services/analytics/tests/util/generated/command_to_api.py +++ b/services/analytics/tests/util/generated/command_to_api.py @@ -6,15 +6,19 @@ "analytics.change_analytics_instance_network_endpoint": "oci.analytics.AnalyticsClient.change_analytics_instance_network_endpoint", "analytics.create_analytics_instance": "oci.analytics.AnalyticsClient.create_analytics_instance", "analytics.create_private_access_channel": "oci.analytics.AnalyticsClient.create_private_access_channel", + "analytics.create_resource_group": "oci.analytics.AnalyticsClient.create_resource_group", "analytics.create_vanity_url": "oci.analytics.AnalyticsClient.create_vanity_url", "analytics.delete_analytics_instance": "oci.analytics.AnalyticsClient.delete_analytics_instance", "analytics.delete_private_access_channel": "oci.analytics.AnalyticsClient.delete_private_access_channel", + "analytics.delete_resource_group": "oci.analytics.AnalyticsClient.delete_resource_group", "analytics.delete_vanity_url": "oci.analytics.AnalyticsClient.delete_vanity_url", "analytics.delete_work_request": "oci.analytics.AnalyticsClient.delete_work_request", "analytics.get_analytics_instance": "oci.analytics.AnalyticsClient.get_analytics_instance", "analytics.get_private_access_channel": "oci.analytics.AnalyticsClient.get_private_access_channel", + "analytics.get_resource_group": "oci.analytics.AnalyticsClient.get_resource_group", "analytics.get_work_request": "oci.analytics.AnalyticsClient.get_work_request", "analytics.list_analytics_instances": "oci.analytics.AnalyticsClient.list_analytics_instances", + "analytics.list_resource_groups": "oci.analytics.AnalyticsClient.list_resource_groups", "analytics.list_work_request_errors": "oci.analytics.AnalyticsClient.list_work_request_errors", "analytics.list_work_request_logs": "oci.analytics.AnalyticsClient.list_work_request_logs", "analytics.list_work_requests": "oci.analytics.AnalyticsClient.list_work_requests", @@ -25,5 +29,6 @@ "analytics.stop_analytics_instance": "oci.analytics.AnalyticsClient.stop_analytics_instance", "analytics.update_analytics_instance": "oci.analytics.AnalyticsClient.update_analytics_instance", "analytics.update_private_access_channel": "oci.analytics.AnalyticsClient.update_private_access_channel", + "analytics.update_resource_group": "oci.analytics.AnalyticsClient.update_resource_group", "analytics.update_vanity_url": "oci.analytics.AnalyticsClient.update_vanity_url", } diff --git a/services/core/src/oci_cli_virtual_network/generated/virtualnetwork_cli.py b/services/core/src/oci_cli_virtual_network/generated/virtualnetwork_cli.py index d9983563d..fdafa1194 100644 --- a/services/core/src/oci_cli_virtual_network/generated/virtualnetwork_cli.py +++ b/services/core/src/oci_cli_virtual_network/generated/virtualnetwork_cli.py @@ -3041,6 +3041,9 @@ def create_cpe(ctx, from_json, compartment_id, ip_address, defined_tags, display @cli_util.option('--near-cross-connect-or-cross-connect-group-id', help=u"""If you already have an existing cross-connect or cross-connect group at this FastConnect location, and you want this new cross-connect to be on the same router, provide the [OCID] of that existing cross-connect or cross-connect group.""") @cli_util.option('--customer-reference-name', help=u"""A reference name or identifier for the physical fiber connection that this cross-connect uses.""") @cli_util.option('--macsec-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-interface-hold-timer-enabled', type=click.BOOL, help=u"""The flag to enable or disable the down timer for the interface.""") +@cli_util.option('--interface-down-timer-value-in-milliseconds', type=click.INT, help=u"""The duration of the interface down timer in milliseconds between 0 and 3000 in multiples of 500.""") +@cli_util.option('--is-qos-enabled', type=click.BOOL, help=u"""When true, restricts placement so cross-connects lands only on QoS-capable devices. When false (default), placement may use any supported device. If no QoS-capable devices are available in the selected location, the request fails.""") @cli_util.option('--oci-physical-device-name', help=u"""The name of the FastConnect device where this cross-connect is installed.""") @cli_util.option('--interface-name', help=u"""The name of the FastConnect interface where this cross-connect is installed.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["PENDING_CUSTOMER", "PROVISIONING", "PROVISIONED", "INACTIVE", "TERMINATING", "TERMINATED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state PENDING_CUSTOMER --wait-for-state TERMINATED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -3051,7 +3054,7 @@ def create_cpe(ctx, from_json, compartment_id, ip_address, defined_tags, display @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'core', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'core', 'class': 'dict(str, string)'}, 'macsec-properties': {'module': 'core', 'class': 'CreateMacsecProperties'}}, output_type={'module': 'core', 'class': 'CrossConnect'}) @cli_util.wrap_exceptions -def create_cross_connect(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, location_name, port_speed_shape_name, cross_connect_group_id, defined_tags, display_name, far_cross_connect_or_cross_connect_group_id, freeform_tags, near_cross_connect_or_cross_connect_group_id, customer_reference_name, macsec_properties, oci_physical_device_name, interface_name): +def create_cross_connect(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, location_name, port_speed_shape_name, cross_connect_group_id, defined_tags, display_name, far_cross_connect_or_cross_connect_group_id, freeform_tags, near_cross_connect_or_cross_connect_group_id, customer_reference_name, macsec_properties, is_interface_hold_timer_enabled, interface_down_timer_value_in_milliseconds, is_qos_enabled, oci_physical_device_name, interface_name): kwargs = {} @@ -3084,6 +3087,15 @@ def create_cross_connect(ctx, from_json, wait_for_state, max_wait_seconds, wait_ if macsec_properties is not None: _details['macsecProperties'] = cli_util.parse_json_parameter("macsec_properties", macsec_properties) + if is_interface_hold_timer_enabled is not None: + _details['isInterfaceHoldTimerEnabled'] = is_interface_hold_timer_enabled + + if interface_down_timer_value_in_milliseconds is not None: + _details['interfaceDownTimerValueInMilliseconds'] = interface_down_timer_value_in_milliseconds + + if is_qos_enabled is not None: + _details['isQosEnabled'] = is_qos_enabled + if oci_physical_device_name is not None: _details['ociPhysicalDeviceName'] = oci_physical_device_name @@ -3136,6 +3148,10 @@ def create_cross_connect(ctx, from_json, wait_for_state, max_wait_seconds, wait_ Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--macsec-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--minimum-links', type=click.INT, help=u"""(Optional) Minimum number of active cross-connects required for the cross-connect group to be considered operational. During create cross-connect-group operation this value can only be set to 1 (If not specified, this value defaults to 1) and can be edited using the update cross-connect group operation. Value must not exceed the total number of cross-connects in the cross-connect group.""") +@cli_util.option('--is-interface-hold-timer-enabled', type=click.BOOL, help=u"""The flag to enable or disable the down timer for the interface.""") +@cli_util.option('--interface-down-timer-value-in-milliseconds', type=click.INT, help=u"""The duration of the interface down timer in milliseconds between 0 and 3000 in multiples of 500.""") +@cli_util.option('--is-qos-enabled', type=click.BOOL, help=u"""(Optional) When true, restricts placement so cross-connects lands only on QoS-capable devices. When false (default), placement may use any supported device. If no QoS-capable devices are available in the selected location, the request fails.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["PROVISIONING", "PROVISIONED", "INACTIVE", "TERMINATING", "TERMINATED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state PROVISIONING --wait-for-state TERMINATED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -3144,7 +3160,7 @@ def create_cross_connect(ctx, from_json, wait_for_state, max_wait_seconds, wait_ @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'core', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'core', 'class': 'dict(str, string)'}, 'macsec-properties': {'module': 'core', 'class': 'CreateMacsecProperties'}}, output_type={'module': 'core', 'class': 'CrossConnectGroup'}) @cli_util.wrap_exceptions -def create_cross_connect_group(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, defined_tags, display_name, customer_reference_name, freeform_tags, macsec_properties): +def create_cross_connect_group(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, defined_tags, display_name, customer_reference_name, freeform_tags, macsec_properties, minimum_links, is_interface_hold_timer_enabled, interface_down_timer_value_in_milliseconds, is_qos_enabled): kwargs = {} @@ -3166,6 +3182,18 @@ def create_cross_connect_group(ctx, from_json, wait_for_state, max_wait_seconds, if macsec_properties is not None: _details['macsecProperties'] = cli_util.parse_json_parameter("macsec_properties", macsec_properties) + if minimum_links is not None: + _details['minimumLinks'] = minimum_links + + if is_interface_hold_timer_enabled is not None: + _details['isInterfaceHoldTimerEnabled'] = is_interface_hold_timer_enabled + + if interface_down_timer_value_in_milliseconds is not None: + _details['interfaceDownTimerValueInMilliseconds'] = interface_down_timer_value_in_milliseconds + + if is_qos_enabled is not None: + _details['isQosEnabled'] = is_qos_enabled + client = cli_util.build_client('core', 'virtual_network', ctx) result = client.create_cross_connect_group( create_cross_connect_group_details=_details, @@ -5050,6 +5078,7 @@ def create_vcn(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_s This option is a JSON list with items of type CreateVirtualCircuitPublicPrefixDetails. For documentation on CreateVirtualCircuitPublicPrefixDetails please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/CreateVirtualCircuitPublicPrefixDetails.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--region-parameterconflict', help=u"""The Oracle Cloud Infrastructure region where this virtual circuit is located. Example: `phx`""") @cli_util.option('--ip-mtu', type=custom_types.CliCaseInsensitiveChoice(["MTU_1500", "MTU_9000"]), help=u"""The layer 3 IP MTU to use with this virtual circuit.""") +@cli_util.option('--traffic-mode', type=custom_types.CliCaseInsensitiveChoice(["NORMAL", "DRAIN"]), help=u"""The traffic mode to be set with this Virtual Circuit. This controls whether the traffic is to be drained for the associated Virtual Circuit or not.""") @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["PENDING_PROVIDER", "VERIFYING", "PROVISIONING", "PROVISIONED", "FAILED", "INACTIVE", "TERMINATING", "TERMINATED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state PENDING_PROVIDER --wait-for-state TERMINATED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @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.""") @@ -5058,7 +5087,7 @@ def create_vcn(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_s @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'cross-connect-mappings': {'module': 'core', 'class': 'list[CrossConnectMapping]'}, 'defined-tags': {'module': 'core', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'core', 'class': 'dict(str, string)'}, 'public-prefixes': {'module': 'core', 'class': 'list[CreateVirtualCircuitPublicPrefixDetails]'}}, output_type={'module': 'core', 'class': 'VirtualCircuit'}) @cli_util.wrap_exceptions -def create_virtual_circuit(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, type, bandwidth_shape_name, cross_connect_mappings, routing_policy, bgp_admin_state, is_bfd_enabled, is_transport_mode, customer_bgp_asn, customer_asn, defined_tags, display_name, freeform_tags, gateway_id, provider_name, provider_service_id, provider_service_key_name, provider_service_name, public_prefixes, region_parameterconflict, ip_mtu): +def create_virtual_circuit(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, type, bandwidth_shape_name, cross_connect_mappings, routing_policy, bgp_admin_state, is_bfd_enabled, is_transport_mode, customer_bgp_asn, customer_asn, defined_tags, display_name, freeform_tags, gateway_id, provider_name, provider_service_id, provider_service_key_name, provider_service_name, public_prefixes, region_parameterconflict, ip_mtu, traffic_mode): kwargs = {} @@ -5123,6 +5152,9 @@ def create_virtual_circuit(ctx, from_json, wait_for_state, max_wait_seconds, wai if ip_mtu is not None: _details['ipMtu'] = ip_mtu + if traffic_mode is not None: + _details['trafficMode'] = traffic_mode + client = cli_util.build_client('core', 'virtual_network', ctx) result = client.create_virtual_circuit( create_virtual_circuit_details=_details, @@ -7476,6 +7508,7 @@ def get_cross_connect_letter_of_authority(ctx, from_json, cross_connect_id): raise click.UsageError('Parameter --cross-connect-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('core', 'virtual_network', ctx) result = client.get_cross_connect_letter_of_authority( cross_connect_id=cross_connect_id, @@ -12825,6 +12858,8 @@ def update_cpe(ctx, from_json, force, cpe_id, defined_tags, display_name, freefo Example: `true`""") @cli_util.option('--customer-reference-name', help=u"""A reference name or identifier for the physical fiber connection this cross-connect uses.""") @cli_util.option('--macsec-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--is-interface-hold-timer-enabled', type=click.BOOL, help=u"""The flag to enable or disable the down timer for the interface.""") +@cli_util.option('--interface-down-timer-value-in-milliseconds', type=click.INT, help=u"""The duration of the interface down timer in milliseconds between 0 and 3000 in multiples of 500.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST 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(["PENDING_CUSTOMER", "PROVISIONING", "PROVISIONED", "INACTIVE", "TERMINATING", "TERMINATED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state PENDING_CUSTOMER --wait-for-state TERMINATED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -12835,7 +12870,7 @@ def update_cpe(ctx, from_json, force, cpe_id, defined_tags, display_name, freefo @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'core', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'core', 'class': 'dict(str, string)'}, 'macsec-properties': {'module': 'core', 'class': 'UpdateMacsecProperties'}}, output_type={'module': 'core', 'class': 'CrossConnect'}) @cli_util.wrap_exceptions -def update_cross_connect(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, cross_connect_id, defined_tags, display_name, freeform_tags, is_active, customer_reference_name, macsec_properties, if_match): +def update_cross_connect(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, cross_connect_id, defined_tags, display_name, freeform_tags, is_active, customer_reference_name, macsec_properties, is_interface_hold_timer_enabled, interface_down_timer_value_in_milliseconds, if_match): if isinstance(cross_connect_id, six.string_types) and len(cross_connect_id.strip()) == 0: raise click.UsageError('Parameter --cross-connect-id cannot be whitespace or empty string') @@ -12868,6 +12903,12 @@ def update_cross_connect(ctx, from_json, force, wait_for_state, max_wait_seconds if macsec_properties is not None: _details['macsecProperties'] = cli_util.parse_json_parameter("macsec_properties", macsec_properties) + if is_interface_hold_timer_enabled is not None: + _details['isInterfaceHoldTimerEnabled'] = is_interface_hold_timer_enabled + + if interface_down_timer_value_in_milliseconds is not None: + _details['interfaceDownTimerValueInMilliseconds'] = interface_down_timer_value_in_milliseconds + client = cli_util.build_client('core', 'virtual_network', ctx) result = client.update_cross_connect( cross_connect_id=cross_connect_id, @@ -12911,6 +12952,9 @@ def update_cross_connect(ctx, from_json, force, wait_for_state, max_wait_seconds Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) @cli_util.option('--macsec-properties', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--minimum-links', type=click.INT, help=u"""(Optional) Minimum number of active cross-connects required for the cross-connect group to be considered operational. If not specified, this value defaults to 1. Value must not exceed the total number of cross-connects in the cross-connect group.""") +@cli_util.option('--is-interface-hold-timer-enabled', type=click.BOOL, help=u"""The flag to enable or disable the down timer for the interface.""") +@cli_util.option('--interface-down-timer-value-in-milliseconds', type=click.INT, help=u"""The duration of the interface down timer in milliseconds between 0 and 3000 in multiples of 500.""") @cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") @cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True) @cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["PROVISIONING", "PROVISIONED", "INACTIVE", "TERMINATING", "TERMINATED"]), multiple=True, help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. Multiple states can be specified, returning on the first state. For example, --wait-for-state PROVISIONING --wait-for-state TERMINATED would return on whichever lifecycle state is reached first. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""") @@ -12921,7 +12965,7 @@ def update_cross_connect(ctx, from_json, force, wait_for_state, max_wait_seconds @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'defined-tags': {'module': 'core', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'core', 'class': 'dict(str, string)'}, 'macsec-properties': {'module': 'core', 'class': 'UpdateMacsecProperties'}}, output_type={'module': 'core', 'class': 'CrossConnectGroup'}) @cli_util.wrap_exceptions -def update_cross_connect_group(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, cross_connect_group_id, defined_tags, display_name, customer_reference_name, freeform_tags, macsec_properties, if_match): +def update_cross_connect_group(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, cross_connect_group_id, defined_tags, display_name, customer_reference_name, freeform_tags, macsec_properties, minimum_links, is_interface_hold_timer_enabled, interface_down_timer_value_in_milliseconds, if_match): if isinstance(cross_connect_group_id, six.string_types) and len(cross_connect_group_id.strip()) == 0: raise click.UsageError('Parameter --cross-connect-group-id cannot be whitespace or empty string') @@ -12951,6 +12995,15 @@ def update_cross_connect_group(ctx, from_json, force, wait_for_state, max_wait_s if macsec_properties is not None: _details['macsecProperties'] = cli_util.parse_json_parameter("macsec_properties", macsec_properties) + if minimum_links is not None: + _details['minimumLinks'] = minimum_links + + if is_interface_hold_timer_enabled is not None: + _details['isInterfaceHoldTimerEnabled'] = is_interface_hold_timer_enabled + + if interface_down_timer_value_in_milliseconds is not None: + _details['interfaceDownTimerValueInMilliseconds'] = interface_down_timer_value_in_milliseconds + client = cli_util.build_client('core', 'virtual_network', ctx) result = client.update_cross_connect_group( cross_connect_group_id=cross_connect_group_id, @@ -12983,6 +13036,47 @@ def update_cross_connect_group(ctx, from_json, force, wait_for_state, max_wait_s cli_util.render_response(result, ctx) +@letter_of_authority_group.command(name=cli_util.override('virtual_network.update_cross_connect_letter_of_authority.command_name', 'update-cross-connect'), help=u"""Updates the Letter of Authority for the specified cross-connect. \n[Command Reference](updateCrossConnectLetterOfAuthority)""") +@cli_util.option('--cross-connect-id', required=True, help=u"""The [OCID] of the cross-connect.""") +@cli_util.option('--should-extend', type=click.BOOL, help=u"""A boolean flag to indicate whether to extend the expiry of the associated LOA with the provided cross-connect. If un-set or set to false, it does not alter the existing expiry of the LOA. On extension an updated copy of the LOA will be provided with the new expiry date. An LOA cannot be extended more than 3 times.""") +@cli_util.option('--should-remove-authorized-agent', type=click.BOOL, help=u"""A boolean flag to indicate whether to remove an attached Authorized Agent to the LOA. If this boolean flag is set, an attempt will be made to remove the attached authorized agent to the LOA, if any, and any value given in the field 'authorizedAgent' will be ignored. In case, of updating an existing Authorized Agent, keep this flag unset and set the expected value in 'authorizedAgent'.""") +@cli_util.option('--authorized-agent', help=u"""Name of a customer authorized agent which will be appended to the LOA as the field 'Authorized Agent'. If the field is left un-set in the request body, no changes will be done on the LOA for Authorized Agent.""") +@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""") +@json_skeleton_utils.get_cli_json_input_option({}) +@cli_util.help_option +@click.pass_context +@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'core', 'class': 'LetterOfAuthority'}) +@cli_util.wrap_exceptions +def update_cross_connect_letter_of_authority(ctx, from_json, cross_connect_id, should_extend, should_remove_authorized_agent, authorized_agent, if_match): + + if isinstance(cross_connect_id, six.string_types) and len(cross_connect_id.strip()) == 0: + raise click.UsageError('Parameter --cross-connect-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 should_extend is not None: + _details['shouldExtend'] = should_extend + + if should_remove_authorized_agent is not None: + _details['shouldRemoveAuthorizedAgent'] = should_remove_authorized_agent + + if authorized_agent is not None: + _details['authorizedAgent'] = authorized_agent + + client = cli_util.build_client('core', 'virtual_network', ctx) + result = client.update_cross_connect_letter_of_authority( + cross_connect_id=cross_connect_id, + update_cross_connect_letter_of_authority_details=_details, + **kwargs + ) + cli_util.render_response(result, ctx) + + @dhcp_options_group.command(name=cli_util.override('virtual_network.update_dhcp_options.command_name', 'update'), help=u"""Updates the specified set of DHCP options. You can update the display name or the options themselves. Avoid entering confidential information. Note that the `options` object you provide replaces the entire existing set of options. \n[Command Reference](updateDhcpOptions)""") @@ -15148,6 +15242,7 @@ def update_vcn(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_int @cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags]. Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP) +@cli_util.option('--traffic-mode', type=custom_types.CliCaseInsensitiveChoice(["NORMAL", "DRAIN"]), help=u"""The traffic mode to be set with this Virtual Circuit. This controls whether the traffic is to be drained for the associated Virtual Circuit or not.""") @cli_util.option('--gateway-id', help=u"""The [OCID] of the [dynamic routing gateway (DRG)] that this private virtual circuit uses. To be updated only by the customer who owns the virtual circuit.""") @@ -15169,7 +15264,7 @@ def update_vcn(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_int @click.pass_context @json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'cross-connect-mappings': {'module': 'core', 'class': 'list[CrossConnectMapping]'}, 'defined-tags': {'module': 'core', 'class': 'dict(str, dict(str, object))'}, 'freeform-tags': {'module': 'core', 'class': 'dict(str, string)'}}, output_type={'module': 'core', 'class': 'VirtualCircuit'}) @cli_util.wrap_exceptions -def update_virtual_circuit(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, virtual_circuit_id, bandwidth_shape_name, cross_connect_mappings, routing_policy, bgp_admin_state, is_bfd_enabled, is_transport_mode, customer_bgp_asn, customer_asn, defined_tags, display_name, freeform_tags, gateway_id, provider_state, provider_service_key_name, reference_comment, ip_mtu, if_match): +def update_virtual_circuit(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, virtual_circuit_id, bandwidth_shape_name, cross_connect_mappings, routing_policy, bgp_admin_state, is_bfd_enabled, is_transport_mode, customer_bgp_asn, customer_asn, defined_tags, display_name, freeform_tags, traffic_mode, gateway_id, provider_state, provider_service_key_name, reference_comment, ip_mtu, if_match): if isinstance(virtual_circuit_id, six.string_types) and len(virtual_circuit_id.strip()) == 0: raise click.UsageError('Parameter --virtual-circuit-id cannot be whitespace or empty string') @@ -15217,6 +15312,9 @@ def update_virtual_circuit(ctx, from_json, force, wait_for_state, max_wait_secon if freeform_tags is not None: _details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags) + if traffic_mode is not None: + _details['trafficMode'] = traffic_mode + if gateway_id is not None: _details['gatewayId'] = gateway_id diff --git a/services/core/src/oci_cli_virtual_network/virtualnetwork_cli_extended.py b/services/core/src/oci_cli_virtual_network/virtualnetwork_cli_extended.py index 03d6ebdac..d8d6ae5c4 100644 --- a/services/core/src/oci_cli_virtual_network/virtualnetwork_cli_extended.py +++ b/services/core/src/oci_cli_virtual_network/virtualnetwork_cli_extended.py @@ -18,7 +18,8 @@ virtualnetwork_cli.virtual_network_root_group.commands.pop(virtualnetwork_cli.ip_sec_connection_device_config_group.name) virtualnetwork_cli.virtual_network_root_group.commands.pop(virtualnetwork_cli.ip_sec_connection_device_status_group.name) -virtualnetwork_cli.virtual_network_root_group.commands.pop(virtualnetwork_cli.letter_of_authority_group.name) +# to expose GET/UPDATE operations on LOA through oci-cli +# virtualnetwork_cli.virtual_network_root_group.commands.pop(virtualnetwork_cli.letter_of_authority_group.name) virtualnetwork_cli.virtual_network_root_group.commands.pop(virtualnetwork_cli.virtual_circuit_bandwidth_shape_group.name) virtualnetwork_cli.virtual_network_root_group.commands.pop(virtualnetwork_cli.peer_region_for_remote_peering_group.name) diff --git a/services/core/tests/util/generated/command_to_api.py b/services/core/tests/util/generated/command_to_api.py index 866fda1bd..43366f795 100644 --- a/services/core/tests/util/generated/command_to_api.py +++ b/services/core/tests/util/generated/command_to_api.py @@ -239,6 +239,7 @@ "virtual_network.update_cpe": "oci.core.VirtualNetworkClient.update_cpe", "virtual_network.update_cross_connect": "oci.core.VirtualNetworkClient.update_cross_connect", "virtual_network.update_cross_connect_group": "oci.core.VirtualNetworkClient.update_cross_connect_group", + "virtual_network.update_cross_connect_letter_of_authority": "oci.core.VirtualNetworkClient.update_cross_connect_letter_of_authority", "virtual_network.update_dhcp_options": "oci.core.VirtualNetworkClient.update_dhcp_options", "virtual_network.update_drg": "oci.core.VirtualNetworkClient.update_drg", "virtual_network.update_drg_attachment": "oci.core.VirtualNetworkClient.update_drg_attachment", diff --git a/setup.py b/setup.py index 8b8b1a1f0..36d865b24 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def open_relative(*path): readme = f.read() requires = [ - 'oci==2.182.0', + 'oci==2.182.1', 'arrow>=1.0.0,<2.0.0', 'certifi>=2025.1.31,<2026.0.0', 'click<=8.1.2', diff --git a/src/oci_cli/cli_util.py b/src/oci_cli/cli_util.py index c42a9d833..f13c4a1ce 100644 --- a/src/oci_cli/cli_util.py +++ b/src/oci_cli/cli_util.py @@ -730,7 +730,17 @@ def render_response(response, ctx): last_event_time = time.time() try: for event in response.data.events(): - render(json.loads(event.data), response.headers, ctx) + event_data = event.data.strip() + if not event_data: + # event.data is not expected to be None, however, if the data is only whitespace characters, then, + # event.data.strip() can be None. For such cases we simply skip printing/rendering it. + continue + try: + render(json.loads(event_data), response.headers, ctx) + except json.decoder.JSONDecodeError: + # If text/event-stream is set, it doesn't guarantee the payload in event.data is JSON, it could be + # arbitrary text. + print(pretty_print_format(event_data)) elapsed_time = time.time() - last_event_time if elapsed_time > event_read_timeout: raise TimeoutError diff --git a/src/oci_cli/version.py b/src/oci_cli/version.py index 763b45be8..7c74bff1f 100644 --- a/src/oci_cli/version.py +++ b/src/oci_cli/version.py @@ -2,4 +2,4 @@ # Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. -__version__ = '3.89.2' +__version__ = '3.89.3' diff --git a/tests/unit/test_cli_util.py b/tests/unit/test_cli_util.py index 0169923bc..0945b5c8c 100644 --- a/tests/unit/test_cli_util.py +++ b/tests/unit/test_cli_util.py @@ -31,6 +31,19 @@ def build_config(ctx): return Mock.expected_result +class MockSseEvent(object): + def __init__(self, data): + self.data = data + + +class MockSseStream(object): + def __init__(self, events): + self._events = events + + def events(self): + return iter(self._events) + + class TestCliUtil(unittest.TestCase): @staticmethod @@ -52,6 +65,14 @@ def _build_paginated_response(data, has_next_page=False, next_page=None): response.next_page = next_page return response + @staticmethod + def _build_sse_response(event_payloads): + response = Obj() + response.status = 200 + response.headers = {'content-type': 'text/event-stream'} + response.data = MockSseStream([MockSseEvent(payload) for payload in event_payloads]) + return response + def test_iam_coalesce_provided_and_default_value(self): ctx = Obj() ctx.obj = Obj() @@ -226,3 +247,41 @@ def test_list_call_get_all_results_multiple_keys_stream_output_does_not_swallow_ ctx=ctx, stream_output=True ) + + def test_render_response_outputs_non_json_sse_event_without_crashing(self): + ctx = self._build_ctx() + ctx.obj['output'] = 'json' + ctx.obj['raw_output'] = None + response = self._build_sse_response([ + '{"index": 0, "message": {"role": "ASSISTANT"}}', + '{"usage": {"completionTokens": 8, "promptTokens": 4, "totalTokens": 12}}', + '[DONE]' + ]) + + with mock.patch('oci_cli.cli_util.render') as mock_render: + with mock.patch('oci_cli.cli_util.print') as mock_print: + cli_util.render_response(response, ctx) + + self.assertEqual(2, mock_render.call_count) + self.assertEqual(1, mock_print.call_count) + mock_print.assert_called_once_with('"[DONE]"') + + def test_render_response_skips_empty_or_whitespace_only_sse_events(self): + ctx = self._build_ctx() + ctx.obj['output'] = 'json' + ctx.obj['raw_output'] = None + response = self._build_sse_response([ + '{"index": 0, "message": {"role": "ASSISTANT"}}', + '{"usage": {"completionTokens": 8, "promptTokens": 4, "totalTokens": 12}}', + ' ', + '\n\t\t', + ' [DONE] \t' + ]) + + with mock.patch('oci_cli.cli_util.render') as mock_render: + with mock.patch('oci_cli.cli_util.print') as mock_print: + cli_util.render_response(response, ctx) + + self.assertEqual(2, mock_render.call_count) + self.assertEqual(1, mock_print.call_count) + mock_print.assert_called_once_with('"[DONE]"')