# Module `netapp_ontap.resources.quota_rule`

Copyright © 2023 NetApp Inc. All rights reserved.

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

## Overview

Quotas are defined in quota rules specific to FlexVol volumes or FlexGroup volumes. Each quota rule has a type. The type can be "user", "group", or "tree".

- User rules must have the user property and qtree property.
- Group rules must have the group property and qtree property.
- Tree rules must have the qtree property and not have the user or group property.

## Quota policy rule APIs

The following APIs can be used to perform create, retrieve, modify, and delete operations related to quota policy rules.

- POST /api/storage/quota/rules
- GET /api/storage/quota/rules
- GET /api/storage/quota/rules/{rule-uuid}
- PATCH /api/storage/quota/rules/{rule-uuid}
- DELETE /api/storage/quota/rules/{rule-uuid}

## Examples

### Retrieving all quota policy rules

This API is used to retrieve all quota policy rules.
The following example shows how to retrieve quota policy rules for FlexVol volumes and FlexGroup volumes.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        print(list(QuotaRule.get_collection()))

Try it out

    [
        QuotaRule(
            {
                "svm": {
                    "_links": {
                        "self": {
                            "href": "/api/svm/svms/038545f8-9ff8-11e8-bce6-005056a73bed"
                        }
                    },
                    "uuid": "038545f8-9ff8-11e8-bce6-005056a73bed",
                    "name": "svm1",
                },
                "volume": {
                    "_links": {
                        "self": {
                            "href": "/api/storage/volumes/ab3df793-0f02-43c6-9514-4f142fc8cc92"
                        }
                    },
                    "uuid": "ab3df793-0f02-43c6-9514-4f142fc8cc92",
                    "name": "vol1",
                },
                "uuid": "66319cbe-b837-11e8-9c5a-005056a7e88c",
                "_links": {
                    "self": {
                        "href": "/api/storage/quota/rules/66319cbe-b837-11e8-9c5a-005056a7e88c"
                    }
                },
            }
        ),
        QuotaRule(
            {
                "svm": {
                    "_links": {
                        "self": {
                            "href": "/api/svm/svms/038545f8-9ff8-11e8-bce6-005056a73bed"
                        }
                    },
                    "uuid": "038545f8-9ff8-11e8-bce6-005056a73bed",
                    "name": "svm1",
                },
                "volume": {
                    "_links": {
                        "self": {
                            "href": "/api/storage/volumes/ab3df793-0f02-43c6-9514-4f142fc8cc92"
                        }
                    },
                    "uuid": "ab3df793-0f02-43c6-9514-4f142fc8cc92",
                    "name": "vol1",
                },
                "uuid": "dbd5b443-b7a4-11e8-bc58-005056a7e88c",
                "_links": {
                    "self": {
                        "href": "/api/storage/quota/rules/dbd5b443-b7a4-11e8-bc58-005056a7e88c"
                    }
                },
            }
        ),
    ]

### Retrieving a specific quota policy rule

This API is used to retrieve a quota policy rule for a specific qtree.
The following example shows how to retrieve a quota policy user rule for a specific qtree.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule(uuid="264a9e0b-2e03-11e9-a610-005056a7b72d")
        resource.get()
        print(resource)

Try it out

    QuotaRule(
        {
            "svm": {
                "_links": {
                    "self": {"href": "/api/svm/svms/fd5db15a-15b9-11e9-a6ad-005056a760e0"}
                },
                "uuid": "fd5db15a-15b9-11e9-a6ad-005056a760e0",
                "name": "svm1",
            },
            "qtree": {
                "_links": {
                    "self": {
                        "href": "/api/storage/qtrees/c1b64eea-ca8b-45ec-9397-ab489830d268/1"
                    }
                },
                "name": "qt1",
                "id": 1,
            },
            "user_mapping": True,
            "volume": {
                "_links": {
                    "self": {
                        "href": "/api/storage/volumes/c1b64eea-ca8b-45ec-9397-ab489830d268"
                    }
                },
                "uuid": "c1b64eea-ca8b-45ec-9397-ab489830d268",
                "name": "vol1",
            },
            "uuid": "264a9e0b-2e03-11e9-a610-005056a7b72d",
            "type": "user",
            "users": [{"name": "fred"}],
            "files": {"soft_limit": 80, "hard_limit": 100},
            "_links": {
                "self": {
                    "href": "/api/storage/quota/rules/264a9e0b-2e03-11e9-a610-005056a7b72d"
                }
            },
            "space": {"soft_limit": 51200, "hard_limit": 1222800},
        }
    )

### Retrieving a quota policy multi-user rule at the volume level

##

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule(uuid="0ab84fba-19aa-11e9-a04d-005056a72f42")
        resource.get()
        print(resource)

Try it out

    QuotaRule(
        {
            "svm": {
                "_links": {
                    "self": {"href": "/api/svm/svms/fd5db15a-15b9-11e9-a6ad-005056a760e0"}
                },
                "uuid": "fd5db15a-15b9-11e9-a6ad-005056a760e0",
                "name": "svm1",
            },
            "volume": {
                "_links": {
                    "self": {
                        "href": "/api/storage/volumes/c1b64eea-ca8b-45ec-9397-ab489830d268"
                    }
                },
                "uuid": "c1b64eea-ca8b-45ec-9397-ab489830d268",
                "name": "vol1",
            },
            "uuid": "0ab84fba-19aa-11e9-a04d-005056a72f42",
            "type": "user",
            "users": [{"name": "sam"}, {"name": "smith"}, {"id": "300010"}],
            "files": {"soft_limit": 80, "hard_limit": 100},
            "_links": {
                "self": {
                    "href": "/api/storage/quota/rules/0ab84fba-19aa-11e9-a04d-005056a72f42"
                }
            },
            "space": {"soft_limit": 51200, "hard_limit": 1222800},
        }
    )

### Retrieving a quota policy default tree rule

##

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule(uuid="4a276b8c-1753-11e9-8101-005056a760e0")
        resource.get()
        print(resource)

Try it out

    QuotaRule(
        {
            "svm": {
                "_links": {
                    "self": {"href": "/api/svm/svms/fd5db15a-15b9-11e9-a6ad-005056a760e0"}
                },
                "uuid": "fd5db15a-15b9-11e9-a6ad-005056a760e0",
                "name": "svm1",
            },
            "qtree": {"name": ""},
            "volume": {
                "_links": {
                    "self": {
                        "href": "/api/storage/volumes/c1b64eea-ca8b-45ec-9397-ab489830d268"
                    }
                },
                "uuid": "c1b64eea-ca8b-45ec-9397-ab489830d268",
                "name": "vol1",
            },
            "uuid": "4a276b8c-1753-11e9-8101-005056a760e0",
            "type": "tree",
            "files": {"soft_limit": 10, "hard_limit": 20},
            "_links": {
                "self": {
                    "href": "/api/storage/quota/rules/4a276b8c-1753-11e9-8101-005056a760e0"
                }
            },
            "space": {"soft_limit": 51200, "hard_limit": 1034000},
        }
    )

### Retrieving a quota policy tree rule for a specific qtree

##

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule(uuid="49b1134f-19ab-11e9-a04d-005056a72f42")
        resource.get()
        print(resource)

Try it out

    QuotaRule(
        {
            "svm": {
                "_links": {
                    "self": {"href": "/api/svm/svms/fd5db15a-15b9-11e9-a6ad-005056a760e0"}
                },
                "uuid": "fd5db15a-15b9-11e9-a6ad-005056a760e0",
                "name": "svm1",
            },
            "qtree": {
                "_links": {
                    "self": {
                        "href": "/api/storage/qtrees/c1b64eea-ca8b-45ec-9397-ab489830d268/1"
                    }
                },
                "name": "qt1",
                "id": 1,
            },
            "volume": {
                "_links": {
                    "self": {
                        "href": "/api/storage/volumes/c1b64eea-ca8b-45ec-9397-ab489830d268"
                    }
                },
                "uuid": "c1b64eea-ca8b-45ec-9397-ab489830d268",
                "name": "vol1",
            },
            "uuid": "49b1134f-19ab-11e9-a04d-005056a72f42",
            "type": "tree",
            "files": {"soft_limit": 40, "hard_limit": 100},
            "_links": {
                "self": {
                    "href": "/api/storage/quota/rules/49b1134f-19ab-11e9-a04d-005056a72f42"
                }
            },
            "space": {"soft_limit": 838861, "hard_limit": 1048576},
        }
    )

### Retrieving a quota policy group rule for a specific qtree

##

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule(uuid="b9236852-19ab-11e9-a04d-005056a72f42")
        resource.get()
        print(resource)

Try it out

    QuotaRule(
        {
            "svm": {
                "_links": {
                    "self": {"href": "/api/svm/svms/fd5db15a-15b9-11e9-a6ad-005056a760e0"}
                },
                "uuid": "fd5db15a-15b9-11e9-a6ad-005056a760e0",
                "name": "svm1",
            },
            "qtree": {
                "_links": {
                    "self": {
                        "href": "/api/storage/qtrees/c1b64eea-ca8b-45ec-9397-ab489830d268/1"
                    }
                },
                "name": "qt1",
                "id": 1,
            },
            "volume": {
                "_links": {
                    "self": {
                        "href": "/api/storage/volumes/c1b64eea-ca8b-45ec-9397-ab489830d268"
                    }
                },
                "uuid": "c1b64eea-ca8b-45ec-9397-ab489830d268",
                "name": "vol1",
            },
            "uuid": "b9236852-19ab-11e9-a04d-005056a72f42",
            "type": "group",
            "files": {"soft_limit": 200, "hard_limit": 250},
            "group": {"name": "group1"},
            "_links": {
                "self": {
                    "href": "/api/storage/quota/rules/b9236852-19ab-11e9-a04d-005056a72f42"
                }
            },
            "space": {"soft_limit": 1572864, "hard_limit": 2097152},
        }
    )

### Creating a quota policy rule

This API is used to create a new quota policy rule. When an explicit rule or a qtree-scoped rule of a type is created on a volume, a default rule of the same type is automatically added if it does not already exist on the volume.
The following example shows how to create a quota policy user rule using POST.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule()
        resource.svm = {"name": "svm1"}
        resource.volume = {"name": "vol1"}
        resource.type = "user"
        resource.users = [{"name": "jsmith"}]
        resource.qtree = {"name": "qt1"}
        resource.user_mapping = "on"
        resource.space = {"hard_limit": 8192, "soft_limit": 1024}
        resource.files = {"hard_limit": 20, "soft_limit": 10}
        resource.post(hydrate=True)
        print(resource)

Try it out

    QuotaRule(
        {
            "svm": {"name": "svm1"},
            "qtree": {"name": "qt1"},
            "user_mapping": True,
            "volume": {"name": "fv"},
            "uuid": "3220eea6-5049-11e9-bfb7-005056a7f717",
            "type": "user",
            "users": [{"name": "jsmith"}],
            "files": {"soft_limit": 10, "hard_limit": 20},
            "_links": {
                "self": {
                    "href": "/api/storage/quota/rules/3220eea6-5049-11e9-bfb7-005056a7f717"
                }
            },
            "space": {"soft_limit": 1024, "hard_limit": 8192},
        }
    )

### Creating a quota policy group rule using POST.

##

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule()
        resource.svm = {"name": "svm1"}
        resource.volume = {"name": "vol1"}
        resource.type = "group"
        resource.group = {"name": "test_group1"}
        resource.qtree = {"name": "qt1"}
        resource.space = {"hard_limit": 8192, "soft_limit": 1024}
        resource.files = {"hard_limit": 20, "soft_limit": 10}
        resource.post(hydrate=True)
        print(resource)

Try it out

    QuotaRule(
        {
            "svm": {"name": "svm1"},
            "qtree": {"name": "qt1"},
            "volume": {"name": "fv"},
            "uuid": "3b130f7d-504a-11e9-bfb7-005056a7f717",
            "type": "group",
            "files": {"soft_limit": 10, "hard_limit": 20},
            "group": {"name": "test_group1"},
            "_links": {
                "self": {
                    "href": "/api/storage/quota/rules/3b130f7d-504a-11e9-bfb7-005056a7f717"
                }
            },
            "space": {"soft_limit": 1024, "hard_limit": 8192},
        }
    )

### Creating a quota policy tree rule using POST

##

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule()
        resource.svm = {"name": "svm1"}
        resource.volume = {"name": "vol1"}
        resource.type = "tree"
        resource.qtree = {"name": "qt1"}
        resource.space = {"hard_limit": 8192, "soft_limit": 1024}
        resource.files = {"hard_limit": 20, "soft_limit": 10}
        resource.post(hydrate=True)
        print(resource)

Try it out

    QuotaRule(
        {
            "svm": {"name": "svm1"},
            "qtree": {"name": "qt1"},
            "volume": {"name": "fv"},
            "uuid": "e5eb03be-504a-11e9-bfb7-005056a7f717",
            "type": "tree",
            "files": {"soft_limit": 10, "hard_limit": 20},
            "_links": {
                "self": {
                    "href": "/api/storage/quota/rules/e5eb03be-504a-11e9-bfb7-005056a7f717"
                }
            },
            "space": {"soft_limit": 1024, "hard_limit": 8192},
        }
    )

### Updating the quota policy rule

This API is used to update a quota policy rule.
The following example shows how to update a quota policy rule.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule(uuid="364d38eb-8e87-11e8-a806-005056a7e73a")
        resource.space = {"hard_limit": 16554, "soft_limit": 8192}
        resource.files = {"hard_limit": 40, "soft_limit": 20}
        resource.patch()

### Deleting the quota policy rule

This API is used to delete a quota policy rule.
The following example shows how to delete a quota policy rule.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = QuotaRule(uuid="364d38eb-8e87-11e8-a806-005056a7e73a")
        resource.delete()

### Retrieving a quota policy rule with the property files.hard_limit greater than 5 or null (unlimited) for qtree qt1

##

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import QuotaRule

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        print(
            list(
                QuotaRule.get_collection(
                    **{"rqtree.name": "qt1", "files.hard_limit": ">5|null"}
                )
            )
        )

Try it out

    [
        QuotaRule(
            {
                "svm": {
                    "_links": {
                        "self": {
                            "href": "/api/svm/svms/2272378d-eab2-11ed-913b-005056ac10bf"
                        }
                    },
                    "uuid": "2272378d-eab2-11ed-913b-005056ac10bf",
                    "name": "vs0",
                },
                "volume": {
                    "_links": {
                        "self": {
                            "href": "/api/storage/volumes/6dc24682-edde-11ed-8b6b-005056acde94"
                        }
                    },
                    "uuid": "6dc24682-edde-11ed-8b6b-005056acde94",
                    "name": "testVol",
                },
                "uuid": "9abfdd9f-ede7-11ed-8b6b-005056acde94",
                "files": {"hard_limit": 15},
                "_links": {
                    "self": {
                        "href": "/api/storage/quota/rules/9abfdd9f-ede7-11ed-8b6b-005056acde94"
                    }
                },
            }
        ),
        QuotaRule(
            {
                "svm": {
                    "_links": {
                        "self": {
                            "href": "/api/svm/svms/2272378d-eab2-11ed-913b-005056ac10bf"
                        }
                    },
                    "uuid": "2272378d-eab2-11ed-913b-005056ac10bf",
                    "name": "vs0",
                },
                "volume": {
                    "_links": {
                        "self": {
                            "href": "/api/storage/volumes/83c865bd-edde-11ed-8b6b-005056acde94"
                        }
                    },
                    "uuid": "83c865bd-edde-11ed-8b6b-005056acde94",
                    "name": "testVol2",
                },
                "uuid": "a876601e-ede7-11ed-8b6b-005056acde94",
                "files": {"hard_limit": 6},
                "_links": {
                    "self": {
                        "href": "/api/storage/quota/rules/a876601e-ede7-11ed-8b6b-005056acde94"
                    }
                },
            }
        ),
        QuotaRule(
            {
                "svm": {
                    "_links": {
                        "self": {
                            "href": "/api/svm/svms/2272378d-eab2-11ed-913b-005056ac10bf"
                        }
                    },
                    "uuid": "2272378d-eab2-11ed-913b-005056ac10bf",
                    "name": "vs0",
                },
                "volume": {
                    "_links": {
                        "self": {
                            "href": "/api/storage/volumes/a44c8f5d-edde-11ed-8b6b-005056acde94"
                        }
                    },
                    "uuid": "a44c8f5d-edde-11ed-8b6b-005056acde94",
                    "name": "testVol4",
                },
                "uuid": "d66ff5ed-ede7-11ed-8b6b-005056acde94",
                "_links": {
                    "self": {
                        "href": "/api/storage/quota/rules/d66ff5ed-ede7-11ed-8b6b-005056acde94"
                    }
                },
            }
        ),
    ]

## Classes

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

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

    Returns a count of all QuotaRule resources that match the provided query

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

    Deletes a quota policy rule.

    ### Related ONTAP commands

    - `quota policy rule delete`

    ### Learn more

    - `DOC /storage/quota/rules`

    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 fast_get_collection (*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> Iterable[RawResource]`

    Returns a list of RawResources that represent QuotaRule resources that match the provided query

    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
    `raw`
      return a list of `netapp_ontap.resource.RawResource` objects that require to be promoted before any RESTful operations can be used on them. Setting this argument to True makes get_collection substantially quicker when many records are returned from the server.
    `**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 find (*args, connection: HostConnection = None, **kwargs) -> Resource`

    Retrieves quota policy rules configured for all FlexVol volumes and FlexGroup volumes.

    ### Related ONTAP commands

    - `quota policy rule show`

    ### Learn more

    - `DOC /storage/quota/rules`

    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) -> Iterable[Resource]`

    Retrieves quota policy rules configured for all FlexVol volumes and FlexGroup volumes.

    ### Related ONTAP commands

    - `quota policy rule show`

    ### Learn more

    - `DOC /storage/quota/rules`

    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
    `raw`
      return a list of `netapp_ontap.resource.RawResource` objects that require to be promoted before any RESTful operations can be used on them. Setting this argument to True makes get_collection substantially quicker when many records are returned from the server.
    `**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, records: Iterable[_ForwardRef('QuotaRule')] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Updates properties of a specific quota policy rule.
    Important notes: * The quota resize functionality is supported with the PATCH operation. * Quota resize allows you to modify the quota limits, directly in the filesystem. * The quota must be enabled on a FlexVol or a FlexGroup volume for `quota resize` to take effect. * If the quota is disabled on the volume, the quota policy rule PATCH API modifies the rule, but this does not affect the limits in the filesystem.

    ### Related ONTAP commands

    - `quota policy rule modify`
    - `quota resize`

    ### Learn more

    - `DOC /storage/quota/rules`

    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. The body argument will be ignored if records is provided.
    `*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.
    `records`
      Can be provided in place of a query. If so, this list of objects will be patched on the host.
    `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 `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('QuotaRule')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[QuotaRule], NetAppResponse]`

    Creates a quota policy rule for a FlexVol or a FlexGroup volume.
    Important notes: * Unlike CLI/ONTAPI, the `quota policy` input is not needed for POST.

    ### Required properties

    - `svm.uuid` or `svm.name` - Existing SVM in which to create the qtree.
    - `volume.uuid` or `volume.name` - Existing volume in which to create the qtree.
    - `type` - Quota type for the rule. This type can be `user`, `group`, or `tree`.
    - `users.name` or `user.id` - If the quota type is user, this property takes the user name or user ID. For default user quota rules, the user name must be specified as "".
    - `group.name` or `group.id` - If the quota type is group, this property takes the group name or group ID. For default group quota rules, the group name must be specified as "".
    - `qtree.name` - Qtree for which to create the rule. For default tree rules, the qtree name must be specified as "".

    ### Recommended optional properties

    - `space.hard_limit` - Specifies the space hard limit, in bytes. If less than 1024 bytes, the value is rounded up to 1024 bytes.
    - `space.soft_limit` - Specifies the space soft limit, in bytes. If less than 1024 bytes, the value is rounded up to 1024 bytes.
    - `files.hard_limit` - Specifies the hard limit for files.
    - `files.soft_limit` - Specifies the soft limit for files.
    - `user_mapping` - Specifies the user_mapping. This property is valid only for quota policy rules of type `user`.

    ### Related ONTAP commands

    - `quota policy rule create`

    ### Learn more

    - `DOC /storage/quota/rules`

    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`

    Deletes a quota policy rule.

    ### Related ONTAP commands

    - `quota policy rule delete`

    ### Learn more

    - `DOC /storage/quota/rules`

    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 properties for a specific quota policy rule.

    ### Related ONTAP commands

    - `quota policy rule show`

    ### Learn more

    - `DOC /storage/quota/rules`

    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: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse`

    Updates properties of a specific quota policy rule.
    Important notes: * The quota resize functionality is supported with the PATCH operation. * Quota resize allows you to modify the quota limits, directly in the filesystem. * The quota must be enabled on a FlexVol or a FlexGroup volume for `quota resize` to take effect. * If the quota is disabled on the volume, the quota policy rule PATCH API modifies the rule, but this does not affect the limits in the filesystem.

    ### Related ONTAP commands

    - `quota policy rule modify`
    - `quota resize`

    ### Learn more

    - `DOC /storage/quota/rules`

    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.
    `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

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

    Creates a quota policy rule for a FlexVol or a FlexGroup volume.
    Important notes: * Unlike CLI/ONTAPI, the `quota policy` input is not needed for POST.

    ### Required properties

    - `svm.uuid` or `svm.name` - Existing SVM in which to create the qtree.
    - `volume.uuid` or `volume.name` - Existing volume in which to create the qtree.
    - `type` - Quota type for the rule. This type can be `user`, `group`, or `tree`.
    - `users.name` or `user.id` - If the quota type is user, this property takes the user name or user ID. For default user quota rules, the user name must be specified as "".
    - `group.name` or `group.id` - If the quota type is group, this property takes the group name or group ID. For default group quota rules, the group name must be specified as "".
    - `qtree.name` - Qtree for which to create the rule. For default tree rules, the qtree name must be specified as "".

    ### Recommended optional properties

    - `space.hard_limit` - Specifies the space hard limit, in bytes. If less than 1024 bytes, the value is rounded up to 1024 bytes.
    - `space.soft_limit` - Specifies the space soft limit, in bytes. If less than 1024 bytes, the value is rounded up to 1024 bytes.
    - `files.hard_limit` - Specifies the hard limit for files.
    - `files.soft_limit` - Specifies the soft limit for files.
    - `user_mapping` - Specifies the user_mapping. This property is valid only for quota policy rules of type `user`.

    ### Related ONTAP commands

    - `quota policy rule create`

    ### Learn more

    - `DOC /storage/quota/rules`

    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`
`class QuotaRuleSchema (*, 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 QuotaRule object

  ### Ancestors

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

  ### Class variables

  `files: QuotaRuleFiles GET POST PATCH`

    The files field of the quota_rule.

  `group: QuotaRuleGroup GET POST`

    The group field of the quota_rule.

  `links: SelfLink GET`

    The links field of the quota_rule.

  `qtree: QuotaRuleQtree GET POST`

    The qtree field of the quota_rule.

  `space: QuotaRuleSpace GET POST PATCH`

    The space field of the quota_rule.

  `svm: Svm GET POST`

    The svm field of the quota_rule.

  `type: str GET POST`

    This parameter specifies the quota policy rule type. This is required in POST only and can take either one of the "user", "group" or "tree" values.

    Valid choices:

    - tree
    - user
    - group
  `user_mapping: bool GET POST PATCH`

    This parameter enables user mapping for user quota policy rules. This is valid in POST or PATCH for user quota policy rules only.

  `users: List[QuotaRuleUsers] GET POST`

    This parameter specifies the target user to which the user quota policy rule applies. This parameter takes single or multiple user names or identifiers. This parameter is valid only for the POST operation of a user quota policy rule. If this parameter is used as an input to create a group or a tree quota policy rule, the POST operation will fail with an appropriate error. For POST, this input parameter takes either a user name or a user identifier, not both. For default quota rules, the user name must be chosen and specified as "". For explicit user quota rules, this parameter can indicate either a user name or user identifier. The user name can be a UNIX user name or a Windows user name. If a name contains a space, enclose the entire value in quotes. A UNIX user name cannot include a backslash () or an @ sign; user names with these characters are treated as Windows names. The user identifer can be a UNIX user identifier or a Windows security identifier. For multi-user quota, this parameter can contain multiple user targets separated by a comma.

  `uuid: str GET`

    Unique identifier for the quota policy rule. This field is generated when the quota policy rule is created.

    Example: 5f1d13a7-f401-11e8-ac1a-005056a7c3b9

  `volume: Volume GET POST`

    The volume field of the quota_rule.