Module netapp_ontap.resources.netgroup

Copyright © 2022 NetApp Inc. All rights reserved.

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

Overview

This API can be used to display hosts belonging to the specified netgroup. While this endpoint provides supportability, it is not recommended for use since a netgroup can have 1000s of hosts.

Important information

  • Use the "count" property to determine the total number of hosts belonging to the specified netgroup.
  • Only the first 100 hosts belonging to the netgroup are retrieved.

Retrieving netgroup information

You can use the netgroup GET endpoint to retrieve netgroup host configurations for data SVMs.

Examples

Retrieving hosts belonging to the specific netgroup and SVM


from netapp_ontap import HostConnection
from netapp_ontap.resources import Netgroup

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Netgroup(
        name="netgroup1", **{"svm.uuid": "25b363a6-2971-11eb-88e1-0050568eefd4"}
    )
    resource.get()
    print(resource)

Netgroup(
    {
        "svm": {"uuid": "25b363a6-2971-11eb-88e1-0050568eefd4", "name": "vs1"},
        "name": "netgroup1",
        "hosts": [
            "host1.netapp.com",
            "host2.netapp.com",
            "host3.netapp.com",
            "host4.netapp.com",
            "host5.netapp.com",
        ],
        "count": 5,
        "status": "Success",
        "source": "nis",
    }
)


Retrieving hosts belonging to the specific netgroup and SVM with partial results


from netapp_ontap import HostConnection
from netapp_ontap.resources import Netgroup

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Netgroup(
        name="netgroup2", **{"svm.uuid": "25b363a6-2971-11eb-88e1-0050568eefd4"}
    )
    resource.get()
    print(resource)

Netgroup(
    {
        "svm": {"uuid": "25b363a6-2971-11eb-88e1-0050568eefd4", "name": "vs1"},
        "name": "netgroup2",
        "hosts": ["host-pc.netapp.com", "host-ng.netapp.com", "host-nb.netapp.com"],
        "count": 3,
        "status": "Partial: Error processing netgroup file /etc/netgroup: Nesting levels greater than 1000 are not supported.",
        "source": "files",
    }
)


Classes

class Netgroup (*args, **kwargs)

Allows interaction with Netgroup 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

Methods

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

Retrieves all hosts belonging to the specified netgroup.

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

Inherited members

class NetgroupSchema (*, 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 Netgroup object

Ancestors

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

Class variables

count: Size GET

Number of hosts belonging to the specified netgroup.

hosts: List[str] GET

Name of host belonging to the specified netgroup.

The links field of the netgroup.

name: str GET POST PATCH

Netgroup name.

Example: netgroup1

source: str GET

Source used for netgroup lookup.

Valid choices:

  • unknown
  • files
  • nis
  • ldap
status: str GET

Status of netgroup hosts retrieval.

Example: success

svm: Svm GET POST PATCH

The svm field of the netgroup.