# Module `netapp_ontap.resources.account_password`

Copyright © 2021 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

  - Resource

  ### Methods

  `def post(self, hydrate: bool = False, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = 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.

    ### Related ONTAP commands

    - `security login password`

    ### Learn more

    - `DOC /security/authentication/password`
    - `DOC /security/accounts`

    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

  - `Resource`:
    - `from_dict`
    - `get_collection_url`
    - `get_connection`
    - `instance_location`
    - `path_keys`
    - `poll`
    - `set_connection`
    - `to_dict`
`class AccountPasswordSchema (*, only: typing.Union = None, exclude: typing.Union = (), many: bool = False, context: typing.Dict = None, load_only: typing.Union = (), dump_only: typing.Union = (), partial: typing.Union = 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