Module netapp_ontap.resources.host_record
Copyright © 2023 NetApp Inc. All rights reserved.
This file has been automatically generated based on the ONTAP REST API documentation.
Overview
Displays the IP address of the specified hostname and vice-versa.
Retrieving the host table entries
The host-record GET endpoint to retrieve the hostname for a given Ip address and vice-versa.
Examples
Retrieving the hostname for a given IP address.
from netapp_ontap import HostConnection
from netapp_ontap.resources import HostRecord
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = HostRecord(
host="127.0.0.1", **{"svm.uuid": "77e23bd4-a8fe-11eb-99e0-0050568e14ff"}
)
resource.get()
print(resource)
HostRecord(
{
"ipv4_addresses": ["127.0.0.1"],
"host": "127.0.0.1",
"hostname": "localhost",
"svm": {"name": "svm1", "uuid": "77e23bd4-a8fe-11eb-99e0-0050568e14ff"},
"source": "Files",
}
)
Retrieving the Ip address for a given hostname.
from netapp_ontap import HostConnection
from netapp_ontap.resources import HostRecord
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = HostRecord(
host="localhost", **{"svm.uuid": "77e23bd4-a8fe-11eb-99e0-0050568e14ff"}
)
resource.get()
print(resource)
HostRecord(
{
"ipv4_addresses": ["127.0.0.1"],
"host": "localhost",
"hostname": "localhost",
"svm": {"name": "svm1", "uuid": "77e23bd4-a8fe-11eb-99e0-0050568e14ff"},
"source": "Files",
"ipv6_addresses": ["::1"],
"canonical_name": "localhost",
}
)
Classes
class HostRecord (*args, **kwargs)
-
Allows interaction with HostRecord 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 the IP address of the specified hostname.
Related ONTAP commands
vserver services name-service getxxbyyy getnameinfo
vserver services name-service getxxbyyy getaddrinfo
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 HostRecordSchema (*, 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 HostRecord object
Ancestors
- netapp_ontap.resource.ResourceSchema
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
-
canonical_name: str GET
-
Canonical name of the host.
Example: localhost
-
host: str GET POST PATCH
-
IP address or hostname.
Example: localhost
-
hostname: str GET
-
Hostname.
Example: localhost
-
ipv4_addresses: List[str] GET
-
List of IPv4 addresses.
Example: ["127.0.0.1"]
-
ipv6_addresses: List[str] GET
-
List of IPv6 addresses.
Example: ["::1"]
-
source: str GET POST PATCH
-
Source used for lookup.
Example: Files
-
svm: Svm GET POST PATCH
-
The svm field of the host_record.