Module netapp_ontap.resources.file_info

Copyright © 2020 NetApp Inc. All rights reserved.

Overview

This API is used to read a file, write to a file, retrieve a list of files and directories, and retrieve or modify certain properties of files and directories. The path field is used to specify the path to the directory or file to be acted on. The path field requires using "%2E" to represent "." and "%2F" to represent "/" for the path provided.

File data

Read and write data from/to a named file. To read a file, the Accept request HTTP header must be specified as multipart/form-data, and a value for the length query property, which represents the number of bytes to be read, must be specified. The API will fail if the length of data being read/written exceeds 1 MB. This API should only be used on normal files or streams associated with files. The results for other file types, such as LUNs is undefined.
The following APIs are used to read or write data to a file:

  • GET /api/storage/volumes/{volume.uuid}/files/{path}?byte_offset=0&length=40 -H "Accept: multipart/form-data"
  • POST /api/storage/volumes/{volume.uuid}/files/{path} -H "Content-Type: multipart/form-data" –form "file=the data to be written to the new file"
  • PATCH /api/storage/volumes/{volume.uuid}/files/{path}?byte_offset=10 -H "Content-Type: multipart/form-data" –form "file=the new data to be written or overwritten to the existing file starting at byte_offset"

Listing directories and files

A list of files and directories and their properties can be retrieved for a specified path.
The following APIs are used to view a list of files and directories:

  • GET /api/storage/volumes/{volume.uuid}/files
  • GET /api/storage/volumes/{volume.uuid}/files/{path}
  • GET /api/storage/volumes/{volume.uuid}/files/{path}?fields=*

File information

The metadata and detailed information about a single directory or file can be retrieved by setting the return_metadata query property to true. The information returned includes type, creation_time, modified_time, changed_time, accessed_time, unix_permissions, ownder_id, group_id, size, hard_links_count, inode_number, is_empty, bytes_used, inode_generation, is_vm_aligned, is_junction, is_snapshot, and links.
The following API is used to view the properties of a single file or directory:

  • GET /api/storage/volumes/{volume.uuid}/files/{path}?return_metadata=true

QoS

QoS policies and settings enforce Service Level Objectives (SLO) on a file. A pre-created QoS policy can be used by specifying the qos.name or qos.uuid properties.
The following APIs are used to assign a QoS policy to a file:

  • PATCH /api/storage/volumes/{volume.uuid}/files/{path} -d '{ "qos_policy.name" : "policy" }'
  • PATCH /api/storage/volumes/{volume.uuid}/files/{path} -d '{ "qos_policy.uuid" : "b89bc5dd-94a3-11e8-a7a3-0050568edf84" }'

The following APIs are used to create a symlink and read the contents of a symlink:

  • POST /api/storage/volumes/{volume.uuid}/files/{path} -d '{ "target" : "directory2/file1" }'
  • GET /api/storage/volumes/{volume.uuid}/files/{path}?return_metadata=true&fields=target

Examples

Writing to a new file

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("54c06ce2-5430-11ea-90f9-005056a73aff")
    resource.post(hydrate=True)
    print(resource)

Writing to an existing file

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("54c06ce2-5430-11ea-90f9-005056a73aff", path="aNewFile")
    resource.patch(byte_offset=39)

Reading a file

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("54c06ce2-5430-11ea-90f9-005056a73aff", path="aNewFile")
    resource.get(byte_offset=0, length=100)
    print(resource)

Creating a stream on a file

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("54c06ce2-5430-11ea-90f9-005056a73aff")
    resource.post(
        hydrate=True, overwrite=True, byte_offset=-1, stream_name="someStream"
    )
    print(resource)

Retrieving the list of files in a directory

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("cb6b1b39-8d21-11e9-b926-05056aca658", path="d1/d2/d3")
    resource.get()
    print(resource)

[
    FileInfo(
        {
            "_links": {
                "self": {
                    "href": "/api/storage/volumes/cb6b1b39-8d21-11e9-b926-005056aca658/files/d1%2Fd2%2Fd3%2F%2E"
                },
                "metadata": {
                    "href": "/api/storage/volumes/e8274d79-3bba-11ea-b780-005056a7d72a/files/d1%2Fd2%2Fd3%2F%2E?return_metadata=true"
                },
            },
            "path": "d1/d2/d3",
            "type": "directory",
            "name": ".",
        }
    ),
    FileInfo(
        {
            "_links": {
                "self": {
                    "href": "/api/storage/volumes/cb6b1b39-8d21-11e9-b926-005056aca658/files/d1%2Fd2%2Fd3%2F%2E%2E"
                },
                "metadata": {
                    "href": "/api/storage/volumes/e8274d79-3bba-11ea-b780-005056a7d72a/files/d1%2Fd2%2Fd3%2F%2E%2E?return_metadata=true"
                },
            },
            "path": "d1/d2/d3",
            "type": "directory",
            "name": "..",
        }
    ),
    FileInfo(
        {
            "_links": {
                "metadata": {
                    "href": "/api/storage/volumes/e8274d79-3bba-11ea-b780-005056a7d72a/files/d1%2Fd2%2Fd3%2File1?return_metadata=true"
                }
            },
            "path": "d1/d2/d3",
            "type": "file",
            "name": "f1",
        }
    ),
    FileInfo(
        {
            "_links": {
                "self": {
                    "href": "/api/storage/volumes/cb6b1b39-8d21-11e9-b926-005056aca658/files/d1%2Fd2%2Fd3%2Fd5"
                },
                "metadata": {
                    "href": "/api/storage/volumes/e8274d79-3bba-11ea-b780-005056a7d72a/files/d1%2Fd2%2Fd3%2Fd5?return_metadata=true"
                },
            },
            "path": "d1/d2/d3",
            "type": "directory",
            "name": "d5",
        }
    ),
]

Retrieving a list of files based on file type

You can filter the list of files you retrieve based on multiple file types by including a query parameter in the following format type="file|symlink"

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("cb6b1b39-8d21-11e9-b926-05056aca658", path="d1/d2/d3")
    resource.get(type="file|directory")
    print(resource)

[
    FileInfo(
        {
            "_links": {
                "self": {
                    "href": "/api/storage/volumes/cb6b1b39-8d21-11e9-b926-005056aca658/files/d1%2Fd2%2Fd3%2F%2E"
                },
                "metadata": {
                    "href": "/api/storage/volumes/e8274d79-3bba-11ea-b780-005056a7d72a/files/d1%2Fd2%2Fd3%2F%2E?return_metadata=true"
                },
            },
            "path": "d1/d2/d3",
            "type": "directory",
            "name": ".",
        }
    ),
    FileInfo(
        {
            "_links": {
                "self": {
                    "href": "/api/storage/volumes/cb6b1b39-8d21-11e9-b926-005056aca658/files/d1%2Fd2%2Fd3%2F%2E%2E"
                },
                "metadata": {
                    "href": "/api/storage/volumes/e8274d79-3bba-11ea-b780-005056a7d72a/files/d1%2Fd2%2Fd3%2F%2E%2E?return_metadata=true"
                },
            },
            "path": "d1/d2/d3",
            "type": "directory",
            "name": "..",
        }
    ),
    FileInfo(
        {
            "_links": {
                "metadata": {
                    "href": "/api/storage/volumes/e8274d79-3bba-11ea-b780-005056a7d72a/files/d1%2Fd2%2Fd3%2File1?return_metadata=true"
                }
            },
            "path": "d1/d2/d3",
            "type": "file",
            "name": "f1",
        }
    ),
    FileInfo(
        {
            "_links": {
                "self": {
                    "href": "/api/storage/volumes/cb6b1b39-8d21-11e9-b926-005056aca658/files/d1%2Fd2%2Fd3%2Fd5"
                },
                "metadata": {
                    "href": "/api/storage/volumes/e8274d79-3bba-11ea-b780-005056a7d72a/files/d1%2Fd2%2Fd3%2Fd5?return_metadata=true"
                },
            },
            "path": "d1/d2/d3",
            "type": "directory",
            "name": "d5",
        }
    ),
]

Retrieving the properties of a directory or a file

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("cb6b1b39-8d21-11e9-b926-05056aca658", path="d1/d2/d3/f1")
    resource.get(return_metadata=True)
    print(resource)

[
    FileInfo(
        {
            "accessed_time": "2019-06-12T21:27:28-04:00",
            "is_junction": False,
            "group_id": 30,
            "unix_permissions": 644,
            "bytes_used": 4096,
            "creation_time": "2019-06-12T21:27:28-04:00",
            "hard_links_count": 1,
            "inode_number": 1233,
            "modified_time": "2019-06-12T21:27:28-04:00",
            "changed_time": "2019-06-12T21:27:28-04:00",
            "owner_id": 54738,
            "path": "d1/d2/d3/f1",
            "inode_generation": 214488325,
            "type": "file",
            "is_snapshot": False,
            "size": 200,
            "name": "",
            "is_vm_aligned": False,
        }
    )
]

You can use the POST request to create a symlink.

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("cb6b1b39-8d21-11e9-b926-05056aca658")
    resource.target = "d1/f1"
    resource.post(hydrate=True)
    print(resource)

You can use the GET request to view the target of a symlink.

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("cb6b1b39-8d21-11e9-b926-05056aca658", path="symlink1")
    resource.get(return_metadata=True, fields="target")
    print(resource)

[FileInfo({"target": "d1/f1", "path": "symlink1"})]

Retrieving all information for a directory

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("1ef5d1b2-f9d7-11e9-8043-00505682f860", path="d1")
    resource.get(return_metadata=True, fields="**")
    print(resource)

[
    FileInfo(
        {
            "accessed_time": "2019-10-28T23:10:38+00:00",
            "is_junction": False,
            "group_id": 65533,
            "unix_permissions": 755,
            "bytes_used": 4096,
            "creation_time": "2019-10-28T23:04:13+00:00",
            "volume": {
                "_links": {
                    "self": {
                        "href": "/api/storage/volumes/1ef5d1b2-f9d7-11e9-8043-00505682f860"
                    }
                },
                "uuid": "1ef5d1b2-f9d7-11e9-8043-00505682f860",
            },
            "is_empty": False,
            "qos_policy": {
                "name": "pg1",
                "uuid": "00725264-688f-11ea-8f10-005056a7b8ac",
            },
            "hard_links_count": 5,
            "inode_number": 96,
            "modified_time": "2019-10-28T23:10:30+00:00",
            "changed_time": "2019-10-28T23:10:30+00:00",
            "owner_id": 1002,
            "path": "d1",
            "inode_generation": 214514951,
            "type": "directory",
            "is_snapshot": False,
            "size": 4096,
            "is_vm_aligned": False,
        }
    )
]

Assigning a QoS policy to a file

You can use the PATCH request to assign a QoS policy to a file.

from netapp_ontap import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo("cb6b1b39-8d21-11e9-b926-05056aca658", path="directory1/file1")
    resource.qos_policy.name = "policy"
    resource.patch()

Classes

class FileInfo (*args, **kwargs)

Information about a single file.

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 count_collection(*args, connection: HostConnection = None, **kwargs) -> int

Retrieves a list of files and directories for a given directory of a volume along with the directory's properties or only the properties of a given file of a volume.

Learn more


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 a list of files and directories for a given directory of a volume along with the directory's properties or only the properties of a given file of a volume.

Learn more


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 a list of files and directories for a given directory of a volume along with the directory's properties or only the properties of a given file of a volume.

Learn more


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.

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

Writes to an existing file with the supplied data or modifies the QoS policy of a file.

Learn more


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

async def file_info_create(volume_uuid, links: dict = None, accessed_time: datetime.datetime = None, bytes_used: netapp_ontap.resource.Size = None, changed_time: datetime.datetime = None, creation_time: datetime.datetime = None, group_id: netapp_ontap.resource.Size = None, hard_links_count: netapp_ontap.resource.Size = None, inode_generation: netapp_ontap.resource.Size = None, inode_number: netapp_ontap.resource.Size = None, is_empty: bool = None, is_junction: bool = None, is_snapshot: bool = None, is_vm_aligned: bool = None, modified_time: datetime.datetime = None, name: str = None, owner_id: netapp_ontap.resource.Size = None, path: str = None, qos_policy: dict = None, size: netapp_ontap.resource.Size = None, target: str = None, type: str = None, unix_permissions: netapp_ontap.resource.Size = None, volume: dict = None) -> netapp_ontap.resource_table.ResourceTable

Create an instance of a FileInfo resource

Args

links
 
accessed_time
Last access time of the file in date-time format.
bytes_used
The actual number of bytes used on disk by this file. If byte_offset and length parameters are specified, this will return the bytes used by the file within the given range.
changed_time
Last time data or attributes changed on the file in date-time format.
creation_time
Creation time of the file in date-time format.
group_id
The integer ID of the group of the file owner.
hard_links_count
The number of hard links to the file.
inode_generation
Inode generation number.
inode_number
The file inode number.
is_empty
Specifies whether or not a directory is empty. A directory is considered empty if it only contains entries for "." and "..". This element is present if the file is a directory. In some special error cases, such as when the volume goes offline or when the directory is moved while retrieving this info, this field might not get set.
is_junction
Returns "true" if the directory is a junction.
is_snapshot
Returns "true" if the directory is a Snapshot copy.
is_vm_aligned
Returns true if the file is vm-aligned. A vm-aligned file is a file that is initially padded with zero-filled data so that its actual data starts at an offset other than zero. The amount by which the start offset is adjusted depends on the vm-align setting of the hosting volume.
modified_time
Last data modification time of the file in date-time format.
name
Name of the file.
owner_id
The integer ID of the file owner.
path
Path of the file.
qos_policy
 
size
The size of the file, in bytes.
target
The relative or absolute path contained in a symlink, in the form /.
type
Type of the file.
unix_permissions
UNIX permissions to be viewed as an octal number. It consists of 4 digits derived by adding up bits 4 (read), 2 (write), and 1 (execute). The first digit selects the set user ID(4), set group ID (2), and sticky (1) attributes. The second digit selects permissions for the owner of the file; the third selects permissions for other users in the same group; the fourth selects permissions for other users not in the group.

volume:

async def file_info_modify(volume_uuid, accessed_time: datetime.datetime = None, query_accessed_time: datetime.datetime = None, bytes_used: netapp_ontap.resource.Size = None, query_bytes_used: netapp_ontap.resource.Size = None, changed_time: datetime.datetime = None, query_changed_time: datetime.datetime = None, creation_time: datetime.datetime = None, query_creation_time: datetime.datetime = None, group_id: netapp_ontap.resource.Size = None, query_group_id: netapp_ontap.resource.Size = None, hard_links_count: netapp_ontap.resource.Size = None, query_hard_links_count: netapp_ontap.resource.Size = None, inode_generation: netapp_ontap.resource.Size = None, query_inode_generation: netapp_ontap.resource.Size = None, inode_number: netapp_ontap.resource.Size = None, query_inode_number: netapp_ontap.resource.Size = None, is_empty: bool = None, query_is_empty: bool = None, is_junction: bool = None, query_is_junction: bool = None, is_snapshot: bool = None, query_is_snapshot: bool = None, is_vm_aligned: bool = None, query_is_vm_aligned: bool = None, modified_time: datetime.datetime = None, query_modified_time: datetime.datetime = None, name: str = None, query_name: str = None, owner_id: netapp_ontap.resource.Size = None, query_owner_id: netapp_ontap.resource.Size = None, path: str = None, query_path: str = None, size: netapp_ontap.resource.Size = None, query_size: netapp_ontap.resource.Size = None, target: str = None, query_target: str = None, type: str = None, query_type: str = None, unix_permissions: netapp_ontap.resource.Size = None, query_unix_permissions: netapp_ontap.resource.Size = None) -> netapp_ontap.resource_table.ResourceTable

Modify an instance of a FileInfo resource

Args

accessed_time
Last access time of the file in date-time format.
query_accessed_time
Last access time of the file in date-time format.
bytes_used
The actual number of bytes used on disk by this file. If byte_offset and length parameters are specified, this will return the bytes used by the file within the given range.
query_bytes_used
The actual number of bytes used on disk by this file. If byte_offset and length parameters are specified, this will return the bytes used by the file within the given range.
changed_time
Last time data or attributes changed on the file in date-time format.
query_changed_time
Last time data or attributes changed on the file in date-time format.
creation_time
Creation time of the file in date-time format.
query_creation_time
Creation time of the file in date-time format.
group_id
The integer ID of the group of the file owner.
query_group_id
The integer ID of the group of the file owner.
hard_links_count
The number of hard links to the file.
query_hard_links_count
The number of hard links to the file.
inode_generation
Inode generation number.
query_inode_generation
Inode generation number.
inode_number
The file inode number.
query_inode_number
The file inode number.
is_empty
Specifies whether or not a directory is empty. A directory is considered empty if it only contains entries for "." and "..". This element is present if the file is a directory. In some special error cases, such as when the volume goes offline or when the directory is moved while retrieving this info, this field might not get set.
query_is_empty
Specifies whether or not a directory is empty. A directory is considered empty if it only contains entries for "." and "..". This element is present if the file is a directory. In some special error cases, such as when the volume goes offline or when the directory is moved while retrieving this info, this field might not get set.
is_junction
Returns "true" if the directory is a junction.
query_is_junction
Returns "true" if the directory is a junction.
is_snapshot
Returns "true" if the directory is a Snapshot copy.
query_is_snapshot
Returns "true" if the directory is a Snapshot copy.
is_vm_aligned
Returns true if the file is vm-aligned. A vm-aligned file is a file that is initially padded with zero-filled data so that its actual data starts at an offset other than zero. The amount by which the start offset is adjusted depends on the vm-align setting of the hosting volume.
query_is_vm_aligned
Returns true if the file is vm-aligned. A vm-aligned file is a file that is initially padded with zero-filled data so that its actual data starts at an offset other than zero. The amount by which the start offset is adjusted depends on the vm-align setting of the hosting volume.
modified_time
Last data modification time of the file in date-time format.
query_modified_time
Last data modification time of the file in date-time format.
name
Name of the file.
query_name
Name of the file.
owner_id
The integer ID of the file owner.
query_owner_id
The integer ID of the file owner.
path
Path of the file.
query_path
Path of the file.
size
The size of the file, in bytes.
query_size
The size of the file, in bytes.
target
The relative or absolute path contained in a symlink, in the form /.
query_target
The relative or absolute path contained in a symlink, in the form /.
type
Type of the file.
query_type
Type of the file.
unix_permissions
UNIX permissions to be viewed as an octal number. It consists of 4 digits derived by adding up bits 4 (read), 2 (write), and 1 (execute). The first digit selects the set user ID(4), set group ID (2), and sticky (1) attributes. The second digit selects permissions for the owner of the file; the third selects permissions for other users in the same group; the fourth selects permissions for other users not in the group.
query_unix_permissions
UNIX permissions to be viewed as an octal number. It consists of 4 digits derived by adding up bits 4 (read), 2 (write), and 1 (execute). The first digit selects the set user ID(4), set group ID (2), and sticky (1) attributes. The second digit selects permissions for the owner of the file; the third selects permissions for other users in the same group; the fourth selects permissions for other users not in the group.
def file_info_show(volume_uuid, accessed_time: cliche.arg_types.choices.Choices.define.._Choices = None, bytes_used: cliche.arg_types.choices.Choices.define.._Choices = None, changed_time: cliche.arg_types.choices.Choices.define.._Choices = None, creation_time: cliche.arg_types.choices.Choices.define.._Choices = None, group_id: cliche.arg_types.choices.Choices.define.._Choices = None, hard_links_count: cliche.arg_types.choices.Choices.define.._Choices = None, inode_generation: cliche.arg_types.choices.Choices.define.._Choices = None, inode_number: cliche.arg_types.choices.Choices.define.._Choices = None, is_empty: cliche.arg_types.choices.Choices.define.._Choices = None, is_junction: cliche.arg_types.choices.Choices.define.._Choices = None, is_snapshot: cliche.arg_types.choices.Choices.define.._Choices = None, is_vm_aligned: cliche.arg_types.choices.Choices.define.._Choices = None, modified_time: cliche.arg_types.choices.Choices.define.._Choices = None, name: cliche.arg_types.choices.Choices.define.._Choices = None, owner_id: cliche.arg_types.choices.Choices.define.._Choices = None, path: cliche.arg_types.choices.Choices.define.._Choices = None, size: cliche.arg_types.choices.Choices.define.._Choices = None, target: cliche.arg_types.choices.Choices.define.._Choices = None, type: cliche.arg_types.choices.Choices.define.._Choices = None, unix_permissions: cliche.arg_types.choices.Choices.define.._Choices = None, fields: typing.List = None) -> netapp_ontap.resource_table.ResourceTable

Fetch a list of FileInfo resources

Args

accessed_time
Last access time of the file in date-time format.
bytes_used
The actual number of bytes used on disk by this file. If byte_offset and length parameters are specified, this will return the bytes used by the file within the given range.
changed_time
Last time data or attributes changed on the file in date-time format.
creation_time
Creation time of the file in date-time format.
group_id
The integer ID of the group of the file owner.
hard_links_count
The number of hard links to the file.
inode_generation
Inode generation number.
inode_number
The file inode number.
is_empty
Specifies whether or not a directory is empty. A directory is considered empty if it only contains entries for "." and "..". This element is present if the file is a directory. In some special error cases, such as when the volume goes offline or when the directory is moved while retrieving this info, this field might not get set.
is_junction
Returns "true" if the directory is a junction.
is_snapshot
Returns "true" if the directory is a Snapshot copy.
is_vm_aligned
Returns true if the file is vm-aligned. A vm-aligned file is a file that is initially padded with zero-filled data so that its actual data starts at an offset other than zero. The amount by which the start offset is adjusted depends on the vm-align setting of the hosting volume.
modified_time
Last data modification time of the file in date-time format.
name
Name of the file.
owner_id
The integer ID of the file owner.
path
Path of the file.
size
The size of the file, in bytes.
target
The relative or absolute path contained in a symlink, in the form /.
type
Type of the file.
unix_permissions
UNIX permissions to be viewed as an octal number. It consists of 4 digits derived by adding up bits 4 (read), 2 (write), and 1 (execute). The first digit selects the set user ID(4), set group ID (2), and sticky (1) attributes. The second digit selects permissions for the owner of the file; the third selects permissions for other users in the same group; the fourth selects permissions for other users not in the group.
def get(self, **kwargs) -> NetAppResponse

Retrieves a list of files and directories for a given directory of a volume along with the directory's properties or only the properties of a given file of a volume.

Learn more


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

Writes to an existing file with the supplied data or modifies the QoS policy of a file.

Learn more


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

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

Creates a new file with the supplied data, creates a new directory or creates a new symlink.

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.
**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 FileInfoSchema (*, 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 FileInfo object

Ancestors

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

Class variables

accessed_time GET

Last access time of the file in date-time format.

Example: 2019-06-12T15:00:16.000+0000

bytes_used GET

The actual number of bytes used on disk by this file. If byte_offset and length parameters are specified, this will return the bytes used by the file within the given range.

Example: 4096

changed_time GET

Last time data or attributes changed on the file in date-time format.

Example: 2019-06-12T15:00:16.000+0000

creation_time GET

Creation time of the file in date-time format.

Example: 2019-06-12T15:00:16.000+0000

group_id GET

The integer ID of the group of the file owner.

Example: 30

The number of hard links to the file.

Example: 1

inode_generation GET

Inode generation number.

Example: 214753547

inode_number GET

The file inode number.

Example: 1695

is_empty GET

Specifies whether or not a directory is empty. A directory is considered empty if it only contains entries for "." and "..". This element is present if the file is a directory. In some special error cases, such as when the volume goes offline or when the directory is moved while retrieving this info, this field might not get set.

Example: false

is_junction GET

Returns "true" if the directory is a junction.

Example: false

is_snapshot GET

Returns "true" if the directory is a Snapshot copy.

Example: false

is_vm_aligned GET

Returns true if the file is vm-aligned. A vm-aligned file is a file that is initially padded with zero-filled data so that its actual data starts at an offset other than zero. The amount by which the start offset is adjusted depends on the vm-align setting of the hosting volume.

Example: false

The links field of the file_info.

modified_time GET

Last data modification time of the file in date-time format.

Example: 2019-06-12T15:00:16.000+0000

name GET

Name of the file.

Example: test_file

owner_id GET

The integer ID of the file owner.

Example: 54738

path GET

Path of the file.

Example: d1/d2/d3

qos_policy GET

The qos_policy field of the file_info.

size GET

The size of the file, in bytes.

Example: 200

target GET

The relative or absolute path contained in a symlink, in the form /.

Example: some_directory/some_other_directory/some_file

type GET

Type of the file.

Valid choices:

  • file
  • directory
  • blockdev
  • chardev
  • symlink
  • socket
  • fifo
  • stream
  • lun
unix_permissions GET

UNIX permissions to be viewed as an octal number. It consists of 4 digits derived by adding up bits 4 (read), 2 (write), and 1 (execute). The first digit selects the set user ID(4), set group ID (2), and sticky (1) attributes. The second digit selects permissions for the owner of the file; the third selects permissions for other users in the same group; the fourth selects permissions for other users not in the group.

Example: 493

volume GET

The volume field of the file_info.