Module netapp_ontap.resources.directory_restore

Copyright © 2024 NetApp Inc. All rights reserved.

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

Overview

You can use this API to restore a directory from a volume snapshot without having to use data copy. The directory in the snapshot contains sub-directories and files.
When a directory from a volume snapshot is restored, all the directory entries (dentries) in the source should remain as they are (except for the junction path inodes). The dentries in the restored directory contain new inodes which are in the AFS (Active File System).
The newly created inodes in the AFS have the same attributes as those in the source snapshot.

Directory restore API

The following API is used to perform the following operations:

  • POST /api/storage/directory-restore

Classes

class DirectoryRestore (*args, **kwargs)

Restores a directory from a volume snapshot.

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

Static methods

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

Restores the source directory from the volume snapshot on the destination directory.

Required Properties

  • vserver
  • volume.name
  • snapshot.name
  • source_path
  • restore_path
  • volume snapshot directory-restore start
# The API:
/api/storage/directory-restore
# The call:
curl -X POST "https://<mgmt_ip>/api/storage/directory-restore" -H "accept: application/hal+json" -d '{"svm":"vs1", "volume": "vol1", "snapshot": "sp1", "path": "/aaaa", "restore_path": "/bbbb"}'
# The response:
{
  "job": {
    "uuid": "23b5ff3a-4743-11ee-a08d-005056bb9d00",
    "_links": {
      "self": {
        "href": "/api/cluster/jobs/23b5ff3a-4743-11ee-a08d-005056bb9d00"
      }
    }
  }
}

Learn more


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

Restores the source directory from the volume snapshot on the destination directory.

Required Properties

  • vserver
  • volume.name
  • snapshot.name
  • source_path
  • restore_path
  • volume snapshot directory-restore start
# The API:
/api/storage/directory-restore
# The call:
curl -X POST "https://<mgmt_ip>/api/storage/directory-restore" -H "accept: application/hal+json" -d '{"svm":"vs1", "volume": "vol1", "snapshot": "sp1", "path": "/aaaa", "restore_path": "/bbbb"}'
# The response:
{
  "job": {
    "uuid": "23b5ff3a-4743-11ee-a08d-005056bb9d00",
    "_links": {
      "self": {
        "href": "/api/cluster/jobs/23b5ff3a-4743-11ee-a08d-005056bb9d00"
      }
    }
  }
}

Learn more


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

class DirectoryRestoreSchema (*, 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 DirectoryRestore object

Ancestors

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

Class variables

path: str GET POST PATCH

Source from where the directory is restored.

Example: src_file1 or dir1/src_file2 or ./.snapshot/snap1/src_file3

restore_path: str GET POST PATCH

Destination directory where the new directory tree is created.

Example: dest_file1 or dir1/dest_file2

snapshot: str GET POST PATCH

Name of the volume snapshot from which the directory is restored.

volume: str GET POST PATCH

Name of the volume from which the snapshot is used for directory restore.

vserver: str GET POST PATCH

Name of the SVM.