Module netapp_ontap.resources.unix_group_users
Copyright © 2021 NetApp Inc. All rights reserved.
Overview
You can use this API to add or delete UNIX users to a UNIX group of an SVM.
Adding users to a UNIX group
The UNIX group users POST endpoint adds UNIX users to the specified UNIX group and the SVM. Multiple users can be added in a single call using the "records" parameter.
Examples
Adding a single user to the group 'group1'
from netapp_ontap import HostConnection
from netapp_ontap.resources import UnixGroupUsers
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = UnixGroupUsers("group1")
resource.name = "user4"
resource.post(hydrate=True)
print(resource)
Adding multiple users to the group 'group1' in a single REST call
from netapp_ontap import HostConnection
from netapp_ontap.resources import UnixGroupUsers
with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = UnixGroupUsers("group1")
resource.records = [{"name": "user1"}, {"name": "user2"}, {"name": "user3"}]
resource.post(hydrate=True)
print(resource)
Deleting a user from a group of a specific SVM
Example
Delete the user 'user1' from group 'group1' in SVM 'vs1'
```
The API:
/api/name-services/unix-groups/{svm.uuid}/{unix_group.name}/users/{name}
The call:
Classes
class UnixGroupUsers (*args, **kwargs)
-
Allows interaction with UnixGroupUsers 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
Static methods
def delete_collection(*args, body: typing.Union = None, connection: HostConnection = None, **kwargs) -> NetAppResponse
-
Deletes a user from the specified UNIX group.
Related ONTAP commands
vserver services name-service unix-group deluser
Learn more
Delete all objects in a collection which match the given query.
All records on the host which match the query will be deleted.
Args
*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 delete the collection of bars for a particular foo, the foo.name value should be passed.
body
- The body of the delete request. This could be a Resource instance or a dictionary object.
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 deleted.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400
Methods
def delete(self, body: typing.Union = None, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse
-
Deletes a user from the specified UNIX group.
Related ONTAP commands
vserver services name-service unix-group deluser
Learn more
Send a deletion request to the host for this object.
Args
body
- The body of the delete request. This could be a Resource instance or a dictionary 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 be sent as query parameters to the host.
Returns
A
NetAppResponse
object containing the details of the HTTP response.Raises
NetAppRestError
: If the API call returned a status code >= 400 def post(self, hydrate: bool = False, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse
-
Adds users to the specified UNIX group and SVM.
Important notes
- Multiple users can be added in a single call using the "records" parameter.
- "records" parameter must not be specified when "name" parameter is specified.
- Specified users are appended to the existing list of users.
- Duplicate users are ignored.
Related ONTAP commands
vserver services name-service unix-group adduser
vserver services name-service unix-group addusers
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 UnixGroupUsersSchema (*, 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 UnixGroupUsers object
Ancestors
- netapp_ontap.resource.ResourceSchema
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
-
links GET
-
The links field of the unix_group_users.
-
name GET POST
-
UNIX user who belongs to the specified UNIX group and the SVM.
-
records POST PATCH
-
An array of UNIX users specified to add multiple users to a UNIX group in a single API call. Not allowed when the
name
property is used. -
skip_name_validation POST
-
Indicates whether or not the validation for the specified UNIX user names is disabled.