# Module `netapp_ontap.resources.local_cifs_users_and_groups_import`

Copyright © 2023 NetApp Inc. All rights reserved.

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

## Overview

Bulk import of the CIFS local users, groups and group membership information can be done from the specified Uniform Resource Identifier (URI). This replaces the existing contents of the CIFS local users, groups and group memberships. This API is used to bulk import from the specified URI, get the status of the last import and to upload the import status to the specified URI.

## Retrieving import status of the last bulk import

The bulk-import GET endpoint retrieves the status of the last bulk-import operation of the specified SVM.

## Examples

### Retrieving the status of a successful bulk import

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import LocalCifsUsersAndGroupsImport

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = LocalCifsUsersAndGroupsImport(
            **{"svm.uuid": "6de1d39d-1473-11ec-b0cf-0050568e4acc"}
        )
        resource.get()
        print(resource)

Try it out

    LocalCifsUsersAndGroupsImport(
        {
            "elements_ignored": 0,
            "svm": {
                "_links": {
                    "self": {"href": "/api/svm/svms/6de1d39d-1473-11ec-b0cf-0050568e4acc"}
                },
                "uuid": "6de1d39d-1473-11ec-b0cf-0050568e4acc",
                "name": "vs1",
            },
            "elements_imported": 2,
            "import_uri": {"path": "http://<import_uri>/file.7z"},
            "state": "success",
            "detailed_status": {
                "code": "0",
                "message": "Operation completed successfully.",
            },
            "_links": {
                "self": {
                    "href": "/api/protocols/cifs/users-and-groups/import/6de1d39d-1473-11ec-b0cf-0050568e4acc"
                }
            },
        }
    )

### Retrieving the status of a bulk import that failed

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import LocalCifsUsersAndGroupsImport

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = LocalCifsUsersAndGroupsImport(
            **{"svm.uuid": "6de1d39d-1473-11ec-b0cf-0050568e4acc"}
        )
        resource.get()
        print(resource)

Try it out

    LocalCifsUsersAndGroupsImport(
        {
            "elements_ignored": 0,
            "svm": {
                "_links": {
                    "self": {"href": "/api/svm/svms/6de1d39d-1473-11ec-b0cf-0050568e4acc"}
                },
                "uuid": "6de1d39d-1473-11ec-b0cf-0050568e4acc",
                "name": "vs1",
            },
            "elements_imported": 0,
            "import_uri": {"path": "http://<import_uri>/file.7z"},
            "state": "success",
            "detailed_status": {
                "code": "655698",
                "message": "Failed parsing line 1 of the input file. Check syntax and contents.",
            },
            "_links": {
                "self": {
                    "href": "/api/protocols/cifs/users-and-groups/import/6de1d39d-1473-11ec-b0cf-0050568e4acc"
                }
            },
        }
    )

## Retrieving bulk import information for CIFS local users, groups, and group memberships

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import LocalCifsUsersAndGroupsImport

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = LocalCifsUsersAndGroupsImport()
        resource.import_uri.username = "user1"
        resource.import_uri.password = "aaaa"
        resource.decryption_password = "cccc"
        resource.import_uri.path = "http://example.com/file1.7z"
        resource.post(hydrate=True)
        print(resource)

Try it out

    LocalCifsUsersAndGroupsImport(
        {
            "import_uri": {
                "path": "http://example.com/file1.7z",
                "password": "aaaa",
                "username": "user1",
            },
            "decryption_password": "cccc",
        }
    )

## Retrieving status upload information of the last import operation for the specified URI

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import LocalCifsUsersAndGroupsImport

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = LocalCifsUsersAndGroupsImport(
            **{"svm.uuid": "6de1d39d-1473-11ec-b0cf-0050568e4acc"}
        )
        resource.status_uri.username = "user1"
        resource.status_uri.password = "aaaa"
        resource.status_uri.path = "http://example.com/fileupload.7z"
        resource.patch()

## Classes

`class LocalCifsUsersAndGroupsImport (*args, **kwargs)`

  Allows interaction with LocalCifsUsersAndGroupsImport 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

  - Resource

  ### Static methods

  `def patch_collection (body: dict, *args, records: Iterable[_ForwardRef('LocalCifsUsersAndGroupsImport')] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Upload the status of the bulk-import of the specified SVM to the specified URI.

    ### Important notes

    - Only the status of the last bulk-import will be uploaded and not the status of the previous bulk-imports.

    ### Required properties

    - status_uri.path - URI to which the status needs to be uploaded.

    ### Optional properties

    - status_uri.username - Username of the specified URI.
    - status_uri.password - Password of the specified URI.

    ### Related ONTAP commands

    - `vserver cifs users-and-groups import get-status`

    ### Learn more

    - `DOC /protocols/cifs/users-and-groups/bulk-import/{svm.uuid}`

    Patch all objects in a collection which match the given query.

    All records on the host which match the query will be patched with the provided body.

    ## Args

    `body`
      A dictionary of name/value pairs to set on all matching members of the collection. The body argument will be ignored if records is provided.
    `*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 patch the collection of bars for a particular foo, the foo.name value should be passed.
    `records`
      Can be provided in place of a query. If so, this list of objects will be patched on the host.
    `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 `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

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

    Loads CIFS local users,groups and group memberships file from the specified URL.

    ### Important notes

    Existing CIFS local users, groups, and group memberships will be replaced with the contents of the file.

    ### Required properties

    - import_uri.path
    - decryption_password

    ### Optional properties

    - import_uri.username
    - import_uri.password

    ### Related ONTAP commands

    - `vserver cifs users-and-groups import load-from-uri`

    ### Learn more

    - `DOC /protocols/cifs/users-and-groups/bulk-import/{svm.uuid}`

    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 get (self, **kwargs) -> NetAppResponse`

    Retrieves information about the import operation status of the CIFS local users, groups, and group memberships.

    ### Related ONTAP commands

    - `vserver cifs users-and-groups import get-status`

    ### Learn more

    - `DOC /protocols/cifs/users-and-groups/bulk-import/{svm.uuid}`

    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

  `def patch (self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse`

    Upload the status of the bulk-import of the specified SVM to the specified URI.

    ### Important notes

    - Only the status of the last bulk-import will be uploaded and not the status of the previous bulk-imports.

    ### Required properties

    - status_uri.path - URI to which the status needs to be uploaded.

    ### Optional properties

    - status_uri.username - Username of the specified URI.
    - status_uri.password - Password of the specified URI.

    ### Related ONTAP commands

    - `vserver cifs users-and-groups import get-status`

    ### Learn more

    - `DOC /protocols/cifs/users-and-groups/bulk-import/{svm.uuid}`

    Send the difference in the object's state to the host as a modification request.

    Calculates the difference in the object's state since the last time we interacted with the host and sends this in the request body.

    ## 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.
    `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 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

  `def post (self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse`

    Loads CIFS local users,groups and group memberships file from the specified URL.

    ### Important notes

    Existing CIFS local users, groups, and group memberships will be replaced with the contents of the file.

    ### Required properties

    - import_uri.path
    - decryption_password

    ### Optional properties

    - import_uri.username
    - import_uri.password

    ### Related ONTAP commands

    - `vserver cifs users-and-groups import load-from-uri`

    ### Learn more

    - `DOC /protocols/cifs/users-and-groups/bulk-import/{svm.uuid}`

    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.
    `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 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 LocalCifsUsersAndGroupsImportSchema (*, 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 LocalCifsUsersAndGroupsImport object

  ### Ancestors

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

  ### Class variables

  `decryption_password: str POST`

    Password to decrypt the compressed file.

  `detailed_status: DetailedStatusCodeMessage GET`

    The detailed_status field of the local_cifs_users_and_groups_import.

  `elements_ignored: Size GET`

    Number of elements ignored.

  `elements_imported: Size GET`

    Number of elements successfully imported.

  `import_uri: UniformResourceIdentifier GET POST`

    The import_uri field of the local_cifs_users_and_groups_import.

  `links: SelfLink GET`

    The links field of the local_cifs_users_and_groups_import.

  `state: str GET`

    Operation status.

    Valid choices:

    - failed
    - success
    - success_with_warnings
    - in_progress
    - unknown
  `status_uri: UniformResourceIdentifier PATCH`

    The status_uri field of the local_cifs_users_and_groups_import.

  `svm: Svm GET POST PATCH`

    The svm field of the local_cifs_users_and_groups_import.