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

# Module `netapp_ontap.resources.snaplock_legal_hold_operation`

Copyright © 2026 NetApp Inc. All rights reserved.

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

Manages the legal-hold operations for the specified litigation ID.

### Examples

1. Adds a Legal-Hold.
   `POST "/api/storage/snaplock/litigations/f8a67b60-4461-11e9-b327-0050568ebef5:l1/operations" '{"type" : "begin", "path" : "/a.txt"}'`
2. Removes a Legal-Hold.
   `POST "/api/storage/snaplock/litigations/f8a67b60-4461-11e9-b327-0050568ebef5:l1/operations" '{"type" : "end", "path" : "/a.txt"}'`

## Classes

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

  Allows interaction with SnaplockLegalHoldOperation 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, records: Iterable[ForwardRef('SnaplockLegalHoldOperation')] = None, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Aborts the ongoing legal-hold operation. An abort does not rollback any changes already made. You must re-run begin or end for cleanup.

    ### Related ONTAP commands

    - `snaplock legal-hold abort`

    ### Example

        DELETE "/api/storage/snaplock/litigations/f8a67b60-4461-11e9-b327-0050568ebef5:l1/operations/16908292"

    ### Learn more

    - `DOC /storage/snaplock/litigations/{litigation.id}/operations`

    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.
    `records`
      Can be provided in place of a query. If so, this list of objects will be deleted from the host.
    `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.
    `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 deleted.

    ## Returns

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

    ## Raises

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

  `def post_collection (records: Iterable[ForwardRef('SnaplockLegalHoldOperation')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[SnaplockLegalHoldOperation], NetAppResponse]`

    Creates or removes litigations for the specified path.

    ### Required properties

    - `type` - Legal-Hold operation type.
    - `path` - Litigation path.

    ### Related ONTAP commands

    - `snaplock legal-hold begin`
    - `snaplock legal-hold end`

    ### Learn more

    - `DOC /storage/snaplock/litigations/{litigation.id}/operations`

    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 delete (self, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse`

    Aborts the ongoing legal-hold operation. An abort does not rollback any changes already made. You must re-run begin or end for cleanup.

    ### Related ONTAP commands

    - `snaplock legal-hold abort`

    ### Example

        DELETE "/api/storage/snaplock/litigations/f8a67b60-4461-11e9-b327-0050568ebef5:l1/operations/16908292"

    ### Learn more

    - `DOC /storage/snaplock/litigations/{litigation.id}/operations`

    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.
    `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 `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 status of legal-hold for the specified operation ID.

    ### Related ONTAP commands

    - `snaplock legal-hold show`

    ### Learn more

    - `DOC /storage/snaplock/litigations/{litigation.id}/operations`

    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 or if not all of the keys required are present and config.STRICT_GET has been set to True.

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

    Creates or removes litigations for the specified path.

    ### Required properties

    - `type` - Legal-Hold operation type.
    - `path` - Litigation path.

    ### Related ONTAP commands

    - `snaplock legal-hold begin`
    - `snaplock legal-hold end`

    ### Learn more

    - `DOC /storage/snaplock/litigations/{litigation.id}/operations`

    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.
    `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 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`
    - `validate_schema`
`class SnaplockLegalHoldOperationSchema (*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool | None = None, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)`

  The fields of the SnaplockLegalHoldOperation object

  ### Ancestors

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

  ### Class variables

  `id: Size GET`

    Operation ID.

    Example: 16842759

  `links: SelfLink GET`

    The links field of the snaplock_legal_hold_operation.

  `num_files_failed: str GET`

    Specifies the number of files on which legal-hold operation failed.

    Example: 0

  `num_files_processed: str GET`

    Specifies the number of files on which legal-hold operation was successful.

    Example: 30

  `num_files_skipped: str GET`

    Specifies the number of files on which legal-hold begin operation was skipped. The legal-hold begin operation is skipped on a file if it is already under hold for a given litigation.

    Example: 10

  `num_inodes_ignored: str GET`

    Specifies the number of inodes on which the legal-hold operation was not attempted because they were not regular files.

    Example: 10

  `path: str GET POST`

    Specifies the path on which legal-hold operation is applied.

    Example: /dir1

  `state: str GET`

    Specifies the status of legal-hold operation.

    Valid choices:

    - in_progress
    - failed
    - aborting
    - completed
  `type: str GET POST`

    Specifies the type of legal-hold operation.

    Valid choices:

    - begin
    - end