# Module `netapp_ontap.resources.netgroup_file`

Copyright © 2022 NetApp Inc. All rights reserved.

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

## Overview

Displays the netgroup file details or raw netgroup file of an SVM.

## Examples

### Retrieving the netgroup file status of a given SVM

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import NetgroupFile

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = NetgroupFile(**{"svm.uuid": "53942195-1709-11ec-b0d4-0050568efd14"})
        resource.get()
        print(resource)

Try it out

    NetgroupFile(
        {
            "svm": {"uuid": "53942195-1709-11ec-b0d4-0050568efd14", "name": "svm1"},
            "hash_value_by_host": "eb109a44056a47bdeb4b407ec821a14b",
            "timestamp": "2021-10-04T13:05:06+05:30",
            "hash_value": "729b6e43cee04bcee18efa3aa689881d",
            "file_size": 5118686,
        }
    )

### Retrieving the raw netgroup file of a given SVM

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import NetgroupFile

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = NetgroupFile(**{"svm.uuid": "53942195-1709-11ec-b0d4-0050568efd14"})
        resource.get()
        print(resource)

### Deleting a netgroup file of a given SVM

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import NetgroupFile

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = NetgroupFile(**{"svm.uuid": "53942195-1709-11ec-b0d4-0050568efd14"})
        resource.delete()

## Classes

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

  Allows interaction with NetgroupFile 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('NetgroupFile')] = 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 the netgroup file for a given SVM.

    ### Related ONTAP commands

    - `vserver services name-service netgroup file delete`

    ### Learn more

    - `DOC /name-services/netgroup-files/{svm.uuid}`

    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

  ### 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 the netgroup file for a given SVM.

    ### Related ONTAP commands

    - `vserver services name-service netgroup file delete`

    ### Learn more

    - `DOC /name-services/netgroup-files/{svm.uuid}`

    Send a deletion request to the host for this object.

    ## Args

    `body`
      The body of the delete request. This could be a Resource instance or a dictionary object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

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

    ## Raises

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

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

    Retrieves the netgroup file details for a given SVM if the header is set as "accept: application/json". If the header is set as "accept: multipart/form-data", the raw netgroup file of the given SVM is retrieved.

    ### Important notes

    - For a raw netgroup file, set the header as "accept: multipart/form-data" else "accept: application/json" for netgroup file details.
    - Maximum size supported for raw netgroup file is 5MB, but netgroup file details of any valid SVM can be retrived if present.

    ### Related ONTAP commands

    - `vserver services name-service netgroup status`
    - `vserver services name-service netgroup file show`

    ### Learn more

    - `DOC /name-services/netgroup-files/{svm.uuid}`

    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

  ### Inherited members

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

  ### Ancestors

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

  ### Class variables

  `file_size: Size GET`

    File size of the netgroup definitions file in bytes.

    Example: 5118686

  `hash_value: str GET`

    Hash value of the netgroup definitions.

    Example: e53ec87782356bd6786f146ce0a48449

  `hash_value_by_host: str GET`

    Hash value of the netgroup-by-host database.

    Example: e012b7f62e4810936725ed1239018314

  `links: SelfLink GET`

    The links field of the netgroup_file.

  `svm: Svm GET`

    The svm field of the netgroup_file.

  `timestamp: ImpreciseDateTime GET`

    Load time for netgroup definitions.