def get_secret_parameters(parameters):
    """
    Filter the provided parameters dict and return a dict of parameters which are marked as
    secret. Every key in the dict is the parameter name and values are the parameter type:

    >>> d = get_secret_parameters(params)
    >>> d
    {
        "param_a": "string",
        "param_b": "boolean",
        "param_c": "integer"
    }

    If a paramter is a dictionary or a list, then the value will be a nested dictionary
    containing information about that sub-object:

    >>> d = get_secret_parameters(params)
    >>> d
    {
        "param_dict": {
            "nested_a": "boolean",
            "nested_b": "string",
        },
        "param_list": {
            "nested_dict: {
              "param_c": "integer"
            }
        }
    }

    Note: in JSON Schema, we're assuming lists contain the same data type for every element


    :param parameters: Dictionary with runner or action parameters schema specification.
    :type parameters: ``dict``

    :rtype ``list``
    """

    secret_parameters = {}
    parameters_type = parameters.get("type")
    # If the parameter itself is secret, then skip all processing below it
    # and return the type of this parameter.
    #
    # **This causes the _full_ object / array tree to be secret (no children will be shown).**
    #
    # **Important** that we do this check first, so in case this parameter
    # is an `object` or `array`, and the user wants the full thing
    # to be secret, that it is marked as secret.
    if parameters.get("secret", False):
        return parameters_type

    iterator = None
    if parameters_type == "object":
        # if this is an object, then iterate over the properties within
        # the object
        # result = dict
        iterator = six.iteritems(parameters.get("properties", {}))
    elif parameters_type == "array":
        # if this is an array, then iterate over the items definition as a single
        # property
        # result = list
        iterator = enumerate([parameters.get("items", {})])
        secret_parameters = []
    elif parameters_type in ["integer", "number", "boolean", "null", "string"]:
        # if this a "plain old datatype", then iterate over the properties set
        # of the data type
        # result = string (property type)
        iterator = enumerate([parameters])
    else:
        # otherwise, assume we're in an object's properties definition
        # this is the default case for the "root" level for schema specs.
        # result = dict
        iterator = six.iteritems(parameters)

    # iterate over all of the parameters recursively
    for parameter, options in iterator:
        if not isinstance(options, dict):
            continue

        parameter_type = options.get("type")
        if options.get("secret", False):
            # If this parameter is secret, then add it our secret parameters
            #
            # **This causes the _full_ object / array tree to be secret
            #   (no children will be shown)**
            #
            # **Important** that we do this check first, so in case this parameter
            # is an `object` or `array`, and the user wants the full thing
            # to be secret, that it is marked as secret.
            if isinstance(secret_parameters, list):
                secret_parameters.append(parameter_type)
            elif isinstance(secret_parameters, dict):
                secret_parameters[parameter] = parameter_type
            else:
                return parameter_type
        elif parameter_type in ["object", "array"]:
            # otherwise recursively dive into the `object`/`array` and
            # find individual parameters marked as secret
            sub_params = get_secret_parameters(options)
            if sub_params:
                if isinstance(secret_parameters, list):
                    secret_parameters.append(sub_params)
                elif isinstance(secret_parameters, dict):
                    secret_parameters[parameter] = sub_params
                else:
                    return sub_params

    return secret_parameters

    Filter the provided parameters dict and return a dict of parameters which are marked as
    secret. Every key in the dict is the parameter name and values are the parameter type:

    >>> d = get_secret_parameters(params)
    >>> d
    {
        "param_a": "string",
        "param_b": "boolean",
        "param_c": "integer"
    }

    If a paramter is a dictionary or a list, then the value will be a nested dictionary
    containing information about that sub-object:

    >>> d = get_secret_parameters(params)
    >>> d
    {
        "param_dict": {
            "nested_a": "boolean",
            "nested_b": "string",
        },
        "param_list": {
            "nested_dict: {
              "param_c": "integer"
            }
        }
    }

    Note: in JSON Schema, we're assuming lists contain the same data type for every element


    :param parameters: Dictionary with runner or action parameters schema specification.
    :type parameters: ``dict``

    :rtype ``list``
    
st2common/st2common/util/secrets.py