Module netapp_ontap.resources.account_password

Copyright © 2022 NetApp Inc. All rights reserved.

Overview

This API changes the password for a local user account.

Only cluster administrators with the "admin" role can change the password for other cluster or SVM user accounts. If you are not a cluster administrator, you can only change your own password.

Examples

Changing the password of another cluster or SVM user account by a cluster administrator

Specify the user account name and the new password in the body of the POST request. The owner.uuid or owner.name are not required to be specified for a cluster-scoped user account.

For an SVM-scoped account, along with new password and user account name, specify either the SVM name as the owner.name or SVM uuid as the owner.uuid in the body of the POST request. These indicate the SVM for which the user account is created and can be obtained from the response body of a GET request performed on the /api/svm/svms API.

from netapp_ontap import HostConnection
from netapp_ontap.resources import AccountPassword

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = AccountPassword()
    resource.name = "cluster_user1"
    resource.password = "hello@1234"
    resource.post(hydrate=True)
    print(resource)

from netapp_ontap import HostConnection
from netapp_ontap.resources import AccountPassword

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = AccountPassword()
    resource.owner.name = "svm1"
    resource.name = "svm_user1"
    resource.password = "hello@1234"
    resource.post(hydrate=True)
    print(resource)

Changing the password of an SVM-scoped user

Note: The IP address in the URI must be same as one of the interfaces owned by the SVM.

from netapp_ontap import HostConnection
from netapp_ontap.resources import AccountPassword

with HostConnection("<svm-ip>", username="admin", password="password", verify=False):
    resource = AccountPassword()
    resource.name = "svm_user1"
    resource.password = "new1@1234"
    resource.post(hydrate=True)
    print(resource)


Classes

class AccountPassword (*args, **kwargs)

The password object

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

Static methods

def post_collection(records: Iterable[_ForwardRef('AccountPassword')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, connection: HostConnection = None, **kwargs) -> Union[List[AccountPassword], NetAppResponse]

Updates the password for a user account.

Required parameters

  • name - User account name.
  • password - New password for the user account.

Optional parameters

  • owner.name or owner.uuid - Name or UUID of the SVM for an SVM-scoped user account.
  • security login password

Learn more


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 post(self, hydrate: bool = False, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, **kwargs) -> NetAppResponse

Updates the password for a user account.

Required parameters

  • name - User account name.
  • password - New password for the user account.

Optional parameters

  • owner.name or owner.uuid - Name or UUID of the SVM for an SVM-scoped user account.
  • security login password

Learn more


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

class AccountPasswordSchema (*, 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 AccountPassword object

Ancestors

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

Class variables

name GET POST PATCH

The user account name whose password is being modified.

owner GET POST

The owner field of the account_password.

password POST PATCH

The password string