Module netapp_ontap.resources.whoami

Copyright © 2026 NetApp Inc. All rights reserved.

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

Overview

This API endpoint retrieves the username, role, and permissions information for the logged-in user.

Examples

Retrieves the username, role, and permissions information for the logged-in user.

Retrieves the username, role, and permissions information for the logged-in user.

from netapp_ontap import HostConnection
from netapp_ontap.resources import Whoami

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Whoami()
    resource.get()
    print(resource)

Whoami(
    {
        "privileges": [{"access": "all", "path": "/api"}],
        "_links": {"self": {"href": "/api/security/login/whoami"}},
        "username": "admin",
    }
)

Classes

class Whoami (*args, **kwargs)

Allows interaction with Whoami 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 username, role, and permissions information for the logged-in user.

  • security login whoami

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 or if not all of the keys required are present and config.STRICT_GET has been set to True.

Inherited members

class WhoamiSchema (*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool | None = None, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)

The fields of the Whoami object

Ancestors

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

Class variables

The links field of the whoami.

privileges: List[WhoamiPrivileges] GET POST PATCH

List of privileges

roles: List[str] GET POST PATCH

Role name or names

username: str GET POST PATCH

User name

Example: tom