# Module `netapp_ontap.resources.snapdiff_session`

Copyright © 2022 NetApp Inc. All rights reserved.

This file has been automatically generated based on the ONTAP REST API documentation.

SnapDiff is an ONTAP engine that efficiently identifies the file and directory differences between two Snapshot copies of a volume. The POST API is used to establish a SnapDiff session. The API returns a session UUID and a session handle. A backup application can subsequently use the session UUID and handle to communicate with SnapDiff through Remote Procedure Calls (RPC).

## Classes

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

  SnapDiff session

  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 post_collection(records: Iterable[_ForwardRef('SnapdiffSession')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[SnapdiffSession], NetAppResponse]`

    Creates a SnapDiff session.

    ### Required properties

    - `application.name` - Name of the application.
    - `application.type` - Type of the application.
    - `diff_snapshot.name` or `diff_snapshot.uuid` - Name or UUID of the Snapshot copy corresponding to the end time of the difference operation.

    ### Recommended optional properties

    - `base_snapshot.name` or `base_snapshot.uuid` - Name or UUID of the Snapshot copy corresponding to the beginning time of the difference operation.
    - `restart_cookie` - Cookie to start a session from the associated checkpoint.

    ### Default property values

    - `access_time` - true
    - `report_file_attributes` - true
    - `checkpoint_enabled` - true
    - `file_access_protocol` - nfs
    - `max_diffs` - 256

    ### Example

    Creating a SnapDiff session:

        POST "/api/storage/volumes/{volume.uuid}/snapdiff/sessions/" '{ "application":{"name": "BackupApp", "type": "backup"}, "base_snapshot":{"name": "snap1"}, "diff_snapshot":{"name": "snap2"} }'

    ### Learn more

    - `DOC /storage/volumes/{volume.uuid}/snapdiff/sessions`

    Send this collection of objects to the host as a creation request.

    ## Args

    `records`
      A list of `Resource` objects to send to the server to be created.
    `*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 create a bar for a particular foo, the foo.name value should be passed.
    `hydrate`
      If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of each object. When hydrate is set to True, poll must also be set to True.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `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. Only resources matching this query will be patched.

    ## Returns

    A list of `Resource` objects matching the provided type which have been created by the host and returned. This is not the same list that was provided, so to continue using the object, you should save this list. If poll is set to False, then a `NetAppResponse` object is returned instead.

    ## Raises

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

  ### Methods

  `def post(self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse`

    Creates a SnapDiff session.

    ### Required properties

    - `application.name` - Name of the application.
    - `application.type` - Type of the application.
    - `diff_snapshot.name` or `diff_snapshot.uuid` - Name or UUID of the Snapshot copy corresponding to the end time of the difference operation.

    ### Recommended optional properties

    - `base_snapshot.name` or `base_snapshot.uuid` - Name or UUID of the Snapshot copy corresponding to the beginning time of the difference operation.
    - `restart_cookie` - Cookie to start a session from the associated checkpoint.

    ### Default property values

    - `access_time` - true
    - `report_file_attributes` - true
    - `checkpoint_enabled` - true
    - `file_access_protocol` - nfs
    - `max_diffs` - 256

    ### Example

    Creating a SnapDiff session:

        POST "/api/storage/volumes/{volume.uuid}/snapdiff/sessions/" '{ "application":{"name": "BackupApp", "type": "backup"}, "base_snapshot":{"name": "snap1"}, "diff_snapshot":{"name": "snap2"} }'

    ### Learn more

    - `DOC /storage/volumes/{volume.uuid}/snapdiff/sessions`

    Send this object to the host as a creation request.

    ## Args

    `hydrate`
      If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `**kwargs`
      Any key/value pairs passed will normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

    ## 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 SnapdiffSessionSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)`

  The fields of the SnapdiffSession object

  ### Ancestors

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

  ### Class variables

  `access_time: bool GET POST`

    Set to true to report files which have access time changes.

  `application: SnapdiffApplication GET POST PATCH`

    Application using the session.

  `base_snapshot: Snapshot GET POST`

    The base_snapshot field of the snapdiff_session.

  `checkpoint_enabled: bool GET POST`

    Set to true to enable checkpointing for the session. A checkpoint cookie for restart will be returned when a sd_rpc_next RPC request is called.

  `diff_snapshot: Snapshot GET POST`

    The diff_snapshot field of the snapdiff_session.

  `file_access_protocol: str GET POST`

    This specifies the file access protocol for the filenames to be returned by each sd_rpc_next RPC call. This facilitates clients to use the filenames to access the changed files from the system.

    Valid choices:

    - nfs
    - nfsv4
    - cifs
  `handle: str GET`

    Handle of the session. This is generated when the session is created and is to be used by SnapDiff RPC requests throughout the entire session.

    Example: 0x00000414-00

  `max_diffs: Size GET POST`

    This specifies the maximum number of changes to be returned by each sd_rpc_next RPC call.

  `report_file_attributes: bool GET POST`

    Set to true to report the attributes of files. If this property is set to false, then only the inode number, change-type, filename, and file type are reported.

  `restart_cookie: str GET POST`

    This is the cookie to start a session from the associated checkpoint.

  `uuid: str GET`

    UUID of the session. This is generated when the session is created and is to be used by SnapDiff RPC requests throughout the entire session.

    Example: c868a31d-a3d7-4b33-b555-a5bec402e41a