.. versionadded:: 2019.2.0

    Configures the Nexus switch with the specified commands, via the NX-API.

    commands
        The list of configuration commands to load on the Nexus switch.

        .. note::
            This argument is ignored when ``config_file`` is specified.

    config_file
        The source file with the configuration commands to be sent to the device.

        The file can also be a template that can be rendered using the template
        engine of choice. This can be specified using the absolute path to the
        file, or using one of the following URL schemes:

        - ``salt://``
        - ``https://``
        - ``ftp:/``
        - ``s3:/``
        - ``swift://``

    template_engine: ``jinja``
        The template engine to use when rendering the source file. Default:
        ``jinja``. To simply fetch the file without attempting to render, set
        this argument to ``None``.

    context: ``None``
        Variables to add to the template context.

    defaults: ``None``
        Default values of the ``context`` dict.

    saltenv: ``base``
        Salt fileserver environment from which to retrieve the file. Ignored if
        ``config_file`` is not a ``salt://`` URL.

    CLI Example:

    .. code-block:: bash

        salt '*' napalm.nxos_api_config 'spanning-tree mode mstp'
        salt '*' napalm.nxos_api_config config_file=https://bit.ly/2LGLcDy context="{'servers': ['1.2.3.4']}"

def nxos_api_config(commands=None,
                    config_file=None,
                    template_engine='jinja',
                    context=None,
                    defaults=None,
                    saltenv='base',
                    **kwargs):
    '''
     .. versionadded:: 2019.2.0

    Configures the Nexus switch with the specified commands, via the NX-API.

    commands
        The list of configuration commands to load on the Nexus switch.

        .. note::
            This argument is ignored when ``config_file`` is specified.

    config_file
        The source file with the configuration commands to be sent to the device.

        The file can also be a template that can be rendered using the template
        engine of choice. This can be specified using the absolute path to the
        file, or using one of the following URL schemes:

        - ``salt://``
        - ``https://``
        - ``ftp:/``
        - ``s3:/``
        - ``swift://``

    template_engine: ``jinja``
        The template engine to use when rendering the source file. Default:
        ``jinja``. To simply fetch the file without attempting to render, set
        this argument to ``None``.

    context: ``None``
        Variables to add to the template context.

    defaults: ``None``
        Default values of the ``context`` dict.

    saltenv: ``base``
        Salt fileserver environment from which to retrieve the file. Ignored if
        ``config_file`` is not a ``salt://`` URL.

    CLI Example:

    .. code-block:: bash

        salt '*' napalm.nxos_api_config 'spanning-tree mode mstp'
        salt '*' napalm.nxos_api_config config_file=https://bit.ly/2LGLcDy context="{'servers': ['1.2.3.4']}"
    '''
    nxos_api_kwargs = pyeapi_nxos_api_args(**kwargs)
    return __salt__['nxos_api.config'](commands=commands,
                                       config_file=config_file,
                                       template_engine=template_engine,
                                       context=context,
                                       defaults=defaults,
                                       saltenv=saltenv,
                                       **nxos_api_kwargs)