netapp_ontap.resources.cifs_session API documentation
Description: Copyright &copy; 2020 NetApp Inc. All rights reserved …

# Module `netapp_ontap.resources.cifs_session`

Copyright © 2020 NetApp Inc. All rights reserved.

## Overview

ONTAP CIFS sessions `show` functionality is used to provide a list of currently established CIFS sessions.

The following lists the fields retrieved using the CIFS sessions GET API:

node.name: Node name hosting this record; basically the node hosting the "server_ip". node.uuid: Node UUID hosting this record; basically the node hosting the "server_ip". svm.name: Svm name to which the "server_ip" belongs to. svm.uuid: Svm uuid to which the "server_ip" belongs to. server_ip: All clients connected to this interface are displayed in rows. client_ip: IP address of the client connected to the interface. identifier: Unique identifier used to represent each SMB session. connection_id: Unique identifier used to represent each SMB Connection. authentication: Type of authentication supported by the server when a client accesses a SMB share. user: Username for the Windows client. mapped_unix_user: Mapped UNIX user name. open_shares: Number of shares opened by the client on a specific SVM. open_files: Number of files opened by the client on a specific SVM. open_others: Number of other files opened by the client on a specific SVM. connected_duration: Time elapsed since the first request was sent by the client for this SMB session. idle_duration: Time elapsed since the last request was sent by the client for this SMB session. protocol: SMB protocol dialects over which the client accesses the SMB share. availability: Level of continuous availabilty of protection provided to the files from the SMB share smb_signing: Specifies whether SMB signing is enabled. smb_encryption: Specifies the SMB session encryption status. large_mtu: Specifies whether the SMB session's large MTU is enabled. connection_count: Counter used to track requests that are sent to the volumes to the node. volumes.name: Name of the active volumes the client is accessing. volumes.uuid: UUID of the active volumes the client is accessing.

## Example

### Retrieves established sessions information

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsSession

    with HostConnection(
        "<cluster-mgmt-ip>", username="admin", password="password", verify=False
    ):
        print(list(CifsSession.get_collection(return_timeout=15)))

Try it out

    [
        CifsSession(
            {
                "svm": {"name": "vs1", "uuid": "fc824aa8-4e60-11ea-afb1-0050568ec4e4"},
                "node": {
                    "name": "bkalyan-vsim1",
                    "uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
                },
                "connection_id": 91842,
                "identifier": 625718873227788300,
                "connection_count": 1,
            }
        ),
        CifsSession(
            {
                "svm": {"name": "vs1", "uuid": "fc824aa8-4e60-11ea-afb1-0050568ec4e4"},
                "node": {
                    "name": "bkalyan-vsim1",
                    "uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
                },
                "connection_id": 92080,
                "identifier": 625718873227788500,
                "connection_count": 1,
            }
        ),
    ]

## Classes

`class CifsSession (*args, **kwargs)`

  Allows interaction with CifsSession objects on the host

  Initialize the instance of the resource.

  Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:

      MyResource(name='foo').name == 'foo'

  ## Args

  `*args`
    Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
  `**kwargs`
    each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.

  ### Ancestors

  - Resource

  ### Static methods

  `def count_collection(*args, connection: HostConnection = None, **kwargs) -> int`

    Retrieves the CIFS sessions information for all SVMs.

    ### Related ONTAP commands

    - `vserver cifs session show -active-volumes`

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Fetch a count of all objects of this type from the host.

    This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the count of bars for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host. These query parameters can affect the count. A return_records query param will be ignored.

    ## Returns

    On success, returns an integer count of the objects of this type. On failure, returns -1.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library.

  `def find(*args, connection: HostConnection = None, **kwargs) -> Resource`

    Retrieves the CIFS sessions information for all SVMs.

    ### Related ONTAP commands

    - `vserver cifs session show -active-volumes`

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Find an instance of an object on the host given a query.

    The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found, None will be returned. If more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to find a bar for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A `Resource` object containing the details of the object or None if no matches were found.

    ## Raises

    `NetAppRestError`: If the API call returned more than 1 matching resource.

  `def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> typing.Iterable`

    Retrieves the CIFS sessions information for all SVMs.

    ### Related ONTAP commands

    - `vserver cifs session show -active-volumes`

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Fetch a list of all objects of this type from the host.

    This is a lazy fetch, making API calls only as necessary when the result of this call is iterated over. For instance, if max_records is set to 5, then iterating over the collection causes an API call to be sent to the server once for every 5 records. If the client stops iterating before getting to the 6th record, then no additional API calls are made.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `max_records`
      The maximum number of records to return per call
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A list of `Resource` objects

    ## Raises

    `NetAppRestError`: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

  ### Methods

  `def get(self, **kwargs) -> NetAppResponse`

    Retrieves SMB session information for a specific SMB connection of a SVM in a node.

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Fetch the details of the object from the host.

    Requires the keys to be set (if any). After returning, new or changed properties from the host will be set on the instance.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  ### Inherited members

  - `Resource`:
    - `from_dict`
    - `get_collection_url`
    - `get_connection`
    - `instance_location`
    - `path_keys`
    - `poll`
    - `set_connection`
    - `to_dict`
`class CifsSessionSchema (*, only: typing.Union = None, exclude: typing.Union = (), many: bool = False, context: typing.Dict = None, load_only: typing.Union = (), dump_only: typing.Union = (), partial: typing.Union = False, unknown: str = None)`

  The fields of the CifsSession object

  ### Ancestors

  - netapp_ontap.resource.ResourceSchema
  - marshmallow.schema.Schema
  - marshmallow.base.SchemaABC

  ### Class variables

  `authentication GET`

    SMB authentication over which the client accesses the share. The following values are supported:

    - none - No authentication
    - ntlmv1 - Ntlm version 1 mechanism
    - ntlmv2 - Ntlm version 2 mechanism
    - kerberos - Kerberos authentication
    - anonymous - Anonymous mechanism

    Valid choices:

    - none
    - ntlmv1
    - ntlmv2
    - kerberos
    - anonymous
  `client_ip GET`

    Specifies IP address of the client.

    Example: 10.74.7.182

  `connected_duration GET`

    Specifies an ISO-8601 format of date and time used to retrieve the connected time duration in hours, minutes, and seconds format.

    Example: P4DT84H30M5S

  `connection_count GET`

    A counter used to track requests that are sent to the volumes to the node.

    Example: 0

  `connection_id GET`

    A unique identifier used to represent each SMB connection.

    Example: 22802

  `continuous_availability GET`

    The level of continuous availabilty protection provided to the SMB sessions and/or files.

    - unavailable - Open file is not continuously available. For sessions, it contains one or more open files but none of them are continuously available.
    - available - open file is continuously available. For sessions, it contains one or more open files and all of them are continuously available.
    - partial - Sessions only. Contains at least one continuously available open file with other files open but not continuously available.

    Valid choices:

    - unavailable
    - available
    - partial
  `identifier GET`

    A unique identifier used to represent each SMB session.

    Example: 4622663542519103507

  `idle_duration GET`

    Specifies an ISO-8601 format of date and time used to retrieve the idle time duration in hours, minutes, and seconds format.

    Example: P4DT84H30M5S

  `large_mtu GET`

    Specifies whether or not a large MTU is enabled for an SMB session.

    Example: true

  `links GET`

    The links field of the cifs_session.

  `mapped_unix_user GET`

    Indicated that a mapped UNIX user has logged in.

    Example: root

  `node GET POST PATCH`

    The node field of the cifs_session.

  `open_files GET`

    Number of files the SMB session has opened.

  `open_other GET`

    Number of other files the SMB session has opened.

  `open_shares GET`

    Number of shares the SMB session has opened.

  `protocol GET`

    The SMB protocol version over which the client accesses the volumes. The following values are supported:

    - smb1 - SMB version 1
    - smb2 - SMB version 2
    - smb2_1 - SMB version 2 minor version 1
    - smb3 - SMB version 3
    - smb3_1 - SMB version 3 minor version 1

    Valid choices:

    - smb1
    - smb2
    - smb2_1
    - smb3
    - smb3_1
  `server_ip GET`

    Specifies the IP address of the SVM.

    Example: 10.140.78.248

  `smb_encryption GET`

    Indicates an SMB encryption state. The following values are supported:

    - unencrypted - SMB session is not encrypted
    - encrypted - SMB session is fully encrypted. SVM level encryption is enabled and encryption occurs for the entire session.
    - partially_encrypted - SMB session is partially encrypted. Share level encryption is enabled and encryption is initiated when the tree-connect occurs.

    Valid choices:

    - unencrypted
    - encrypted
    - partially_encrypted
  `smb_signing GET`

    Specifies whether or not SMB signing is enabled.

    Example: false

  `svm GET POST PATCH`

    The svm field of the cifs_session.

  `user GET`

    Indicates that a Windows user has logged in.

    Example: NBCIFSQA2\administrator

  `volumes GET POST PATCH`

    A group of volumes, the client is accessing.