# Module `netapp_ontap.resources.snaplock_file_retention`

Copyright © 2020 NetApp Inc. All rights reserved.

This API manages the SnapLock retention time of a file. You can perform a privileged-delete operation by executing this API.

### Examples

1. Sets the SnapLock retention time of a file:
   `PATCH "/api/storage/snaplock/file/000dc5fd-4175-11e9-b937-0050568e3f82/%2Ffile2.txt" '{"expiry_time": "2030-02-14T18:30:00+5:30"}'`
2. Extends the retention time of a WORM file:
   `PATCH "/api/storage/snaplock/file/000dc5fd-4175-11e9-b937-0050568e3f82/%2Ffile2.txt" '{"expiry_time": "infinite"}'`

## Classes

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

  Allows interaction with SnaplockFileRetention 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 delete_collection(*args, body: typing.Union = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Deletes unexpired WORM files of a SnapLock Enterprise volume. This is a privileged-delete operation. The only built-in role that has access to the command is vsadmin-snaplock.

    ### Related ONTAP commands

    - `volume file privileged-delete`

    ### Learn more

    - `DOC /storage/snaplock/file/{volume.uuid}/{path}`

    Delete all objects in a collection which match the given query.

    All records on the host which match the query will be deleted.

    ## 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 delete the collection of bars for a particular foo, the foo.name value should be passed.
    `body`
      The body of the delete request. This could be a Resource instance or a dictionary object.
    `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 `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

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

  `def patch_collection(body: dict, *args, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Updates the SnapLock retention time of a file or extends the retention time of a WORM file. Input parameter expiry_time expects the date in ISO 8601 format or infinite.

    ### Related ONTAP commands

    - `volume file retention set`

    ### Learn more

    - `DOC /storage/snaplock/file/{volume.uuid}/{path}`

    Patch all objects in a collection which match the given query.

    All records on the host which match the query will be patched with the provided body.

    ## Args

    `body`
      A dictionary of name/value pairs to set on all matching members of the collection.
    `*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 patch 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.
    `**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 `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

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

  ### Methods

  `def delete(self, body: typing.Union = None, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse`

    Deletes unexpired WORM files of a SnapLock Enterprise volume. This is a privileged-delete operation. The only built-in role that has access to the command is vsadmin-snaplock.

    ### Related ONTAP commands

    - `volume file privileged-delete`

    ### Learn more

    - `DOC /storage/snaplock/file/{volume.uuid}/{path}`

    Send a deletion request to the host for this object.

    ## Args

    `body`
      The body of the delete request. This could be a Resource instance or a dictionary 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 be sent as query parameters to the host.

    ## Returns

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

    ## Raises

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

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

    Retrieves the SnapLock retention details of the specified file. An indefinite expiry time indicates the file is under a Legal-Hold.

    ### Related ONTAP commands

    - `volume file retention show`

    ### Learn more

    - `DOC /storage/snaplock/file/{volume.uuid}/{path}`

    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

  `def patch(self, hydrate: bool = False, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse`

    Updates the SnapLock retention time of a file or extends the retention time of a WORM file. Input parameter expiry_time expects the date in ISO 8601 format or infinite.

    ### Related ONTAP commands

    - `volume file retention set`

    ### Learn more

    - `DOC /storage/snaplock/file/{volume.uuid}/{path}`

    Send the difference in the object's state to the host as a modification request.

    Calculates the difference in the object's state since the last time we interacted with the host and sends this in the request body.

    ## 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

  `async def snaplock_file_retention_delete(expiry_time: datetime.datetime = None, file_path: str = None)`

    Delete an instance of a SnaplockFileRetention resource

    ## Args

    `expiry_time`
      Expiry time of the file in date-time format.
    `file_path`
      Specifies the volume relative path of the file
  `async def snaplock_file_retention_modify(expiry_time: datetime.datetime = None, query_expiry_time: datetime.datetime = None, file_path: str = None, query_file_path: str = None) -> netapp_ontap.resource_table.ResourceTable`

    Modify an instance of a SnaplockFileRetention resource

    ## Args

    `expiry_time`
      Expiry time of the file in date-time format.
    `query_expiry_time`
      Expiry time of the file in date-time format.
    `file_path`
      Specifies the volume relative path of the file
    `query_file_path`
      Specifies the volume relative path of the file
  `def snaplock_file_retention_show(expiry_time: cliche.arg_types.choices.Choices.define.._Choices = None, file_path: cliche.arg_types.choices.Choices.define.._Choices = None, fields: typing.List = None) -> netapp_ontap.resource_table.ResourceTable`

    Fetch a single SnaplockFileRetention resource

    ## Args

    `expiry_time`
      Expiry time of the file in date-time format.
    `file_path`
      Specifies the volume relative path of the file

  ### Inherited members

  - `Resource`:
    - `from_dict`
    - `get_collection_url`
    - `get_connection`
    - `instance_location`
    - `path_keys`
    - `poll`
    - `set_connection`
    - `to_dict`
`class SnaplockFileRetentionSchema (*, 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 SnaplockFileRetention object

  ### Ancestors

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

  ### Class variables

  `expiry_time GET PATCH`

    Expiry time of the file in date-time format.

    Example: 2058-06-04T19:00:00.000+0000

  `file_path GET POST`

    Specifies the volume relative path of the file

    Example: /dir1/file

  `links GET`

    The links field of the snaplock_file_retention.

  `svm GET POST`

    The svm field of the snaplock_file_retention.

  `volume GET POST`

    The volume field of the snaplock_file_retention.