# coding: utf-8
# Copyright (c) 2016, 2026, Oracle and/or its affiliates.  All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
# NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20181231

from __future__ import print_function
import click
import oci  # noqa: F401
import six  # noqa: F401
import sys  # noqa: F401
from oci_cli.cli_root import cli
from oci_cli import cli_constants  # noqa: F401
from oci_cli import cli_util
from oci_cli import json_skeleton_utils
from oci_cli import custom_types  # noqa: F401
from oci_cli.aliasing import CommandGroupWithAlias


@cli.command(cli_util.override('support.support_root_group.command_name', 'support'), cls=CommandGroupWithAlias, help=cli_util.override('support.support_root_group.help', """Use the Support Management API to manage support requests.
For more information, see [Getting Help and Contacting Support].
**Note**: Before you can create service requests with this API,
complete user registration at My Oracle Cloud Support
and then ask your tenancy administrator to provide you authorization for the related user groups."""), short_help=cli_util.override('support.support_root_group.short_help', """Support Management API"""))
@cli_util.help_option_group
def support_root_group():
    pass


@click.command(cli_util.override('support.update_incident_group.command_name', 'update-incident'), cls=CommandGroupWithAlias, help="""Details about the support request being updated.""")
@cli_util.help_option_group
def update_incident_group():
    pass


@click.command(cli_util.override('support.incident_resource_type_group.command_name', 'incident-resource-type'), cls=CommandGroupWithAlias, help="""Details about the resource associated with the support request.""")
@cli_util.help_option_group
def incident_resource_type_group():
    pass


@click.command(cli_util.override('support.validation_response_group.command_name', 'validation-response'), cls=CommandGroupWithAlias, help="""The validation response returned when checking whether the requested user is valid.""")
@cli_util.help_option_group
def validation_response_group():
    pass


@click.command(cli_util.override('support.incident_group.command_name', 'incident'), cls=CommandGroupWithAlias, help="""Details about the support request.""")
@cli_util.help_option_group
def incident_group():
    pass


support_root_group.add_command(update_incident_group)
support_root_group.add_command(incident_resource_type_group)
support_root_group.add_command(validation_response_group)
support_root_group.add_command(incident_group)


@incident_group.command(name=cli_util.override('support.create_incident.command_name', 'create'), help=u"""Creates a support request in the specified tenancy. For more information, see [Creating Support Requests]. \n[Command Reference](createIncident)""")
@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the tenancy.""")
@cli_util.option('--ticket', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--problem-type', required=True, type=custom_types.CliCaseInsensitiveChoice(["LIMIT", "LEGACY_LIMIT", "TECH", "ACCOUNT", "TAXONOMY"]), help=u"""The kind of support request (type of support request). For information about `ACCOUNT` support requests, see [Creating a Billing Support Request]. For information about `LIMIT` support requests, see [Creating a Service Limit Increase Request]. For information about `TECH` support requests, see [Creating a Technical Support Request].""")
@cli_util.option('--user-group-id', help=u"""Technical support type (`TECH`) only: Identifier of the user group to assign the new support request to. To find identifiers of user groups that you have access to, run the [ValidateUser] operation. Note: The Customer User Administrator (CUA) can manage user groups by name using [My Oracle Cloud Support portal].""")
@cli_util.option('--contacts', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of contacts.

This option is a JSON list with items of type Contact.  For documentation on Contact please see our API reference: https://docs.oracle.com/en-us/iaas/api/#/en/incident/20181231/datatypes/Contact.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--referrer', help=u"""The incident referrer. This value is often the URL that the customer used when creating the support request.""")
@cli_util.option('--ocid', help=u"""User OCID for Oracle Identity Cloud Service (IDCS) users who also have a federated Oracle Cloud Infrastructure account. User OCID is mandatory for OCI Users and optional for Multicloud users.""")
@cli_util.option('--homeregion', help=u"""The region of the tenancy.""")
@cli_util.option('--bearertokentype', help=u"""Token type that determine which cloud provider the request come from.""")
@cli_util.option('--bearertoken', help=u"""Token that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--idtoken', help=u"""IdToken that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--domainid', help=u"""The OCID of identity domain. DomainID is mandatory if the user is part of Non Default Identity domain.""")
@json_skeleton_utils.get_cli_json_input_option({'ticket': {'module': 'cims', 'class': 'CreateTicketDetails'}, 'contacts': {'module': 'cims', 'class': 'list[Contact]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'ticket': {'module': 'cims', 'class': 'CreateTicketDetails'}, 'contacts': {'module': 'cims', 'class': 'list[Contact]'}}, output_type={'module': 'cims', 'class': 'Incident'})
@cli_util.wrap_exceptions
def create_incident(ctx, from_json, compartment_id, ticket, problem_type, user_group_id, contacts, referrer, ocid, homeregion, bearertokentype, bearertoken, idtoken, domainid):

    kwargs = {}
    if ocid is not None:
        kwargs['ocid'] = ocid
    if homeregion is not None:
        kwargs['homeregion'] = homeregion
    if bearertokentype is not None:
        kwargs['bearertokentype'] = bearertokentype
    if bearertoken is not None:
        kwargs['bearertoken'] = bearertoken
    if idtoken is not None:
        kwargs['idtoken'] = idtoken
    if domainid is not None:
        kwargs['domainid'] = domainid
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])

    _details = {}
    _details['compartmentId'] = compartment_id
    _details['ticket'] = cli_util.parse_json_parameter("ticket", ticket)
    _details['problemType'] = problem_type

    if user_group_id is not None:
        _details['userGroupId'] = user_group_id

    if contacts is not None:
        _details['contacts'] = cli_util.parse_json_parameter("contacts", contacts)

    if referrer is not None:
        _details['referrer'] = referrer

    client = cli_util.build_client('cims', 'incident', ctx)
    result = client.create_incident(
        create_incident_details=_details,
        **kwargs
    )
    cli_util.render_response(result, ctx)


@incident_group.command(name=cli_util.override('support.get_incident.command_name', 'get'), help=u"""Gets the specified support request. For more information, see [Getting Details for a Support Request]. \n[Command Reference](getIncident)""")
@cli_util.option('--incident-key', required=True, help=u"""Unique identifier for the support request.""")
@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the tenancy.""")
@cli_util.option('--ocid', help=u"""User OCID for Oracle Identity Cloud Service (IDCS) users who also have a federated Oracle Cloud Infrastructure account. User OCID is mandatory for OCI Users and optional for Multicloud users.""")
@cli_util.option('--homeregion', help=u"""The region of the tenancy.""")
@cli_util.option('--problemtype', help=u"""The kind of support request.""")
@cli_util.option('--bearertokentype', help=u"""Token type that determine which cloud provider the request come from.""")
@cli_util.option('--bearertoken', help=u"""Token that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--idtoken', help=u"""IdToken that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--domainid', help=u"""The OCID of identity domain. DomainID is mandatory if the user is part of Non Default Identity domain.""")
@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': 'cims', 'class': 'Incident'})
@cli_util.wrap_exceptions
def get_incident(ctx, from_json, incident_key, compartment_id, ocid, homeregion, problemtype, bearertokentype, bearertoken, idtoken, domainid):

    if isinstance(incident_key, six.string_types) and len(incident_key.strip()) == 0:
        raise click.UsageError('Parameter --incident-key cannot be whitespace or empty string')

    kwargs = {}
    if ocid is not None:
        kwargs['ocid'] = ocid
    if homeregion is not None:
        kwargs['homeregion'] = homeregion
    if problemtype is not None:
        kwargs['problemtype'] = problemtype
    if bearertokentype is not None:
        kwargs['bearertokentype'] = bearertokentype
    if bearertoken is not None:
        kwargs['bearertoken'] = bearertoken
    if idtoken is not None:
        kwargs['idtoken'] = idtoken
    if domainid is not None:
        kwargs['domainid'] = domainid
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
    client = cli_util.build_client('cims', 'incident', ctx)
    result = client.get_incident(
        incident_key=incident_key,
        compartment_id=compartment_id,
        **kwargs
    )
    cli_util.render_response(result, ctx)


@incident_resource_type_group.command(name=cli_util.override('support.list_incident_resource_types.command_name', 'list'), help=u"""Depending on the selected `productType`, either lists available products (service groups, services, service categories, and subcategories) for technical support requests or lists limits and current usage for limit increase tickets. This operation is called during creation of technical support and limit increase tickets. For more information about listing products, see [Listing Products for Support Requests]. For more information about listing limits, see [Listing Limits for Service Limit Increase Requests]. \n[Command Reference](listIncidentResourceTypes)""")
@cli_util.option('--problem-type', required=True, help=u"""The kind of support request.""")
@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the tenancy.""")
@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].""")
@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(["dateUpdated", "severity"]), help=u"""The key to use to sort the returned items.""")
@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The order to sort the results in.""")
@cli_util.option('--name', help=u"""The user-friendly name of the support request type.""")
@cli_util.option('--ocid', help=u"""User OCID for Oracle Identity Cloud Service (IDCS) users who also have a federated Oracle Cloud Infrastructure account. User OCID is mandatory for OCI Users and optional for Multicloud users.""")
@cli_util.option('--homeregion', help=u"""The region of the tenancy.""")
@cli_util.option('--domainid', help=u"""The OCID of identity domain. DomainID is mandatory if the user is part of Non Default Identity domain.""")
@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': 'cims', 'class': 'list[IncidentResourceType]'})
@cli_util.wrap_exceptions
def list_incident_resource_types(ctx, from_json, all_pages, page_size, problem_type, compartment_id, limit, page, sort_by, sort_order, name, ocid, homeregion, domainid):

    if all_pages and limit:
        raise click.UsageError('If you provide the --all option you cannot provide the --limit option')

    kwargs = {}
    if limit is not None:
        kwargs['limit'] = limit
    if page is not None:
        kwargs['page'] = page
    if sort_by is not None:
        kwargs['sort_by'] = sort_by
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    if name is not None:
        kwargs['name'] = name
    if ocid is not None:
        kwargs['ocid'] = ocid
    if homeregion is not None:
        kwargs['homeregion'] = homeregion
    if domainid is not None:
        kwargs['domainid'] = domainid
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
    client = cli_util.build_client('cims', 'incident', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_incident_resource_types,
            problem_type=problem_type,
            compartment_id=compartment_id,
            **kwargs
        )
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_incident_resource_types,
            limit,
            page_size,
            problem_type=problem_type,
            compartment_id=compartment_id,
            **kwargs
        )
    else:
        result = client.list_incident_resource_types(
            problem_type=problem_type,
            compartment_id=compartment_id,
            **kwargs
        )
    cli_util.render_response(result, ctx)


@incident_group.command(name=cli_util.override('support.list_incidents.command_name', 'list'), help=u"""Lists support requests for the specified tenancy. For more information, see [Listing Support Requests]. \n[Command Reference](listIncidents)""")
@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the tenancy.""")
@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].""")
@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["dateUpdated", "severity"]), help=u"""The key to use to sort the returned items.""")
@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The order to sort the results in.""")
@cli_util.option('--time-updated-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""Filter to return results updated only after the specified timestamp. Must be an RFC 3339 timestamp (e.g. 2025-12-07T17:42:54Z).""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["ACTIVE", "CLOSED"]), help=u"""The current state of the ticket.""")
@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('--ocid', help=u"""User OCID for Oracle Identity Cloud Service (IDCS) users who also have a federated Oracle Cloud Infrastructure account. User OCID is mandatory for OCI Users and optional for Multicloud users.""")
@cli_util.option('--homeregion', help=u"""The region of the tenancy.""")
@cli_util.option('--problem-type', help=u"""The kind of support request.""")
@cli_util.option('--bearertokentype', help=u"""Token type that determine which cloud provider the request come from.""")
@cli_util.option('--bearertoken', help=u"""Token that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--idtoken', help=u"""IdToken that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--domainid', help=u"""The OCID of identity domain. DomainID is mandatory if the user is part of Non Default Identity domain.""")
@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': 'cims', 'class': 'list[IncidentSummary]'})
@cli_util.wrap_exceptions
def list_incidents(ctx, from_json, all_pages, page_size, compartment_id, limit, sort_by, sort_order, time_updated_greater_than_or_equal_to, lifecycle_state, page, ocid, homeregion, problem_type, bearertokentype, bearertoken, idtoken, domainid):

    if all_pages and limit:
        raise click.UsageError('If you provide the --all option you cannot provide the --limit option')

    kwargs = {}
    if limit is not None:
        kwargs['limit'] = limit
    if sort_by is not None:
        kwargs['sort_by'] = sort_by
    if sort_order is not None:
        kwargs['sort_order'] = sort_order
    if time_updated_greater_than_or_equal_to is not None:
        kwargs['time_updated_greater_than_or_equal_to'] = time_updated_greater_than_or_equal_to
    if lifecycle_state is not None:
        kwargs['lifecycle_state'] = lifecycle_state
    if page is not None:
        kwargs['page'] = page
    if ocid is not None:
        kwargs['ocid'] = ocid
    if homeregion is not None:
        kwargs['homeregion'] = homeregion
    if problem_type is not None:
        kwargs['problem_type'] = problem_type
    if bearertokentype is not None:
        kwargs['bearertokentype'] = bearertokentype
    if bearertoken is not None:
        kwargs['bearertoken'] = bearertoken
    if idtoken is not None:
        kwargs['idtoken'] = idtoken
    if domainid is not None:
        kwargs['domainid'] = domainid
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
    client = cli_util.build_client('cims', 'incident', ctx)
    if all_pages:
        if page_size:
            kwargs['limit'] = page_size

        result = cli_util.list_call_get_all_results(
            client.list_incidents,
            compartment_id=compartment_id,
            **kwargs
        )
    elif limit is not None:
        result = cli_util.list_call_get_up_to_limit(
            client.list_incidents,
            limit,
            page_size,
            compartment_id=compartment_id,
            **kwargs
        )
    else:
        result = client.list_incidents(
            compartment_id=compartment_id,
            **kwargs
        )
    cli_util.render_response(result, ctx)


@incident_group.command(name=cli_util.override('support.put_attachment.command_name', 'put-attachment'), help=u"""Uploads the file and attaches it to the support request. \n[Command Reference](putAttachment)""")
@cli_util.option('--put-attachment-details', required=True, help=u"""File to be uploaded as attachment to the Service Request.""")
@cli_util.option('--incident-key', required=True, help=u"""Unique identifier for the support request.""")
@cli_util.option('--attachment-name', required=True, help=u"""The name of the file to attach to the support request. Avoid entering confidential information.""")
@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the tenancy.""")
@cli_util.option('--is-restricted-flag', required=True, type=click.BOOL, help=u"""Set to `true` when the attachment contains personal information (PI) or protected health information (PHI).""")
@cli_util.option('--ocid', help=u"""User OCID for Oracle Identity Cloud Service (IDCS) users who also have a federated Oracle Cloud Infrastructure account. User OCID is mandatory for OCI Users and optional for Multicloud users.""")
@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('--homeregion', help=u"""The region of the tenancy.""")
@cli_util.option('--problemtype', help=u"""The kind of support request.""")
@cli_util.option('--bearertokentype', help=u"""Token type that determine which cloud provider the request come from.""")
@cli_util.option('--bearertoken', help=u"""Token that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--idtoken', help=u"""IdToken that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--domainid', help=u"""The OCID of identity domain. DomainID is mandatory if the user is part of Non Default Identity domain.""")
@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': 'cims', 'class': 'Incident'})
@cli_util.wrap_exceptions
def put_attachment(ctx, from_json, put_attachment_details, incident_key, attachment_name, compartment_id, is_restricted_flag, ocid, if_match, homeregion, problemtype, bearertokentype, bearertoken, idtoken, domainid):

    if isinstance(incident_key, six.string_types) and len(incident_key.strip()) == 0:
        raise click.UsageError('Parameter --incident-key cannot be whitespace or empty string')

    kwargs = {}
    if ocid is not None:
        kwargs['ocid'] = ocid
    if if_match is not None:
        kwargs['if_match'] = if_match
    if homeregion is not None:
        kwargs['homeregion'] = homeregion
    if problemtype is not None:
        kwargs['problemtype'] = problemtype
    if bearertokentype is not None:
        kwargs['bearertokentype'] = bearertokentype
    if bearertoken is not None:
        kwargs['bearertoken'] = bearertoken
    if idtoken is not None:
        kwargs['idtoken'] = idtoken
    if domainid is not None:
        kwargs['domainid'] = domainid
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])

    # do not automatically retry operations with binary inputs
    kwargs['retry_strategy'] = oci.retry.NoneRetryStrategy()

    client = cli_util.build_client('cims', 'incident', ctx)
    result = client.put_attachment(
        put_attachment_details=put_attachment_details,
        incident_key=incident_key,
        attachment_name=attachment_name,
        compartment_id=compartment_id,
        is_restricted_flag=is_restricted_flag,
        **kwargs
    )
    cli_util.render_response(result, ctx)


@update_incident_group.command(name=cli_util.override('support.update_incident.command_name', 'update-incident'), help=u"""Updates the specified support request. For more information, see [Updating Support Requests]. \n[Command Reference](updateIncident)""")
@cli_util.option('--incident-key', required=True, help=u"""Unique identifier for the support request.""")
@cli_util.option('--ticket', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--compartment-id', required=True, help=u"""The OCID of the tenancy.""")
@cli_util.option('--problem-type', type=custom_types.CliCaseInsensitiveChoice(["LIMIT", "LEGACY_LIMIT", "TECH", "ACCOUNT", "TAXONOMY"]), help=u"""The kind of support request (type of support request). For information about `ACCOUNT` support requests, see [Creating a Billing Support Request]. For information about `LIMIT` support requests, see [Creating a Service Limit Increase Request]. For information about `TECH` support requests, see [Creating a Technical Support 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.option('--ocid', help=u"""User OCID for Oracle Identity Cloud Service (IDCS) users who also have a federated Oracle Cloud Infrastructure account. User OCID is mandatory for OCI Users and optional for Multicloud users.""")
@cli_util.option('--homeregion', help=u"""The region of the tenancy.""")
@cli_util.option('--bearertokentype', help=u"""Token type that determine which cloud provider the request come from.""")
@cli_util.option('--bearertoken', help=u"""Token that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--idtoken', help=u"""IdToken that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--domainid', help=u"""The OCID of identity domain. DomainID is mandatory if the user is part of Non Default Identity domain.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@json_skeleton_utils.get_cli_json_input_option({'ticket': {'module': 'cims', 'class': 'UpdateTicketDetails'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'ticket': {'module': 'cims', 'class': 'UpdateTicketDetails'}}, output_type={'module': 'cims', 'class': 'Incident'})
@cli_util.wrap_exceptions
def update_incident(ctx, from_json, force, incident_key, ticket, compartment_id, problem_type, if_match, ocid, homeregion, bearertokentype, bearertoken, idtoken, domainid):

    if isinstance(incident_key, six.string_types) and len(incident_key.strip()) == 0:
        raise click.UsageError('Parameter --incident-key cannot be whitespace or empty string')
    if not force:
        if ticket:
            if not click.confirm("WARNING: Updates to ticket will replace any existing values. Are you sure you want to continue?"):
                ctx.abort()

    kwargs = {}
    if if_match is not None:
        kwargs['if_match'] = if_match
    if ocid is not None:
        kwargs['ocid'] = ocid
    if homeregion is not None:
        kwargs['homeregion'] = homeregion
    if bearertokentype is not None:
        kwargs['bearertokentype'] = bearertokentype
    if bearertoken is not None:
        kwargs['bearertoken'] = bearertoken
    if idtoken is not None:
        kwargs['idtoken'] = idtoken
    if domainid is not None:
        kwargs['domainid'] = domainid
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])

    _details = {}
    _details['ticket'] = cli_util.parse_json_parameter("ticket", ticket)

    if problem_type is not None:
        _details['problemType'] = problem_type

    client = cli_util.build_client('cims', 'incident', ctx)
    result = client.update_incident(
        incident_key=incident_key,
        compartment_id=compartment_id,
        update_incident_details=_details,
        **kwargs
    )
    cli_util.render_response(result, ctx)


@validation_response_group.command(name=cli_util.override('support.validate_user.command_name', 'validate-user'), help=u"""Checks whether the requested user is valid. For more information, see [Validating a User]. \n[Command Reference](validateUser)""")
@cli_util.option('--problem-type', type=custom_types.CliCaseInsensitiveChoice(["LIMIT", "LEGACY_LIMIT", "TECH", "ACCOUNT", "TAXONOMY"]), help=u"""The kind of support request.""")
@cli_util.option('--ocid', help=u"""User OCID for Oracle Identity Cloud Service (IDCS) users who also have a federated Oracle Cloud Infrastructure account. User OCID is mandatory for OCI Users and optional for Multicloud users.""")
@cli_util.option('--homeregion', help=u"""The region of the tenancy.""")
@cli_util.option('--bearertokentype', help=u"""Token type that determine which cloud provider the request come from.""")
@cli_util.option('--bearertoken', help=u"""Token that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--idtoken', help=u"""IdToken that provided by multi cloud provider, which help to validate the email.""")
@cli_util.option('--domainid', help=u"""The OCID of identity domain. DomainID is mandatory if the user is part of Non Default Identity domain.""")
@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': 'cims', 'class': 'ValidationResponse'})
@cli_util.wrap_exceptions
def validate_user(ctx, from_json, problem_type, ocid, homeregion, bearertokentype, bearertoken, idtoken, domainid):

    kwargs = {}
    if problem_type is not None:
        kwargs['problem_type'] = problem_type
    if ocid is not None:
        kwargs['ocid'] = ocid
    if homeregion is not None:
        kwargs['homeregion'] = homeregion
    if bearertokentype is not None:
        kwargs['bearertokentype'] = bearertokentype
    if bearertoken is not None:
        kwargs['bearertoken'] = bearertoken
    if idtoken is not None:
        kwargs['idtoken'] = idtoken
    if domainid is not None:
        kwargs['domainid'] = domainid
    kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
    client = cli_util.build_client('cims', 'incident', ctx)
    result = client.validate_user(
        **kwargs
    )
    cli_util.render_response(result, ctx)
