netapp_ontap.resources.cifs_service API documentation
Description: Copyright &copy; 2020 NetApp Inc. All rights reserved …

# Module `netapp_ontap.resources.cifs_service`

Copyright © 2020 NetApp Inc. All rights reserved.

## Overview

A CIFS server is necessary to provide SMB clients with access to the Storage Virtual Machine (SVM). Before you begin, the following prerequisites must be in place:

- At least one SVM LIF must exist on the SVM.
- The LIFs must be able to connect to the DNS servers configured on the SVM and to an Active Directory domain controller of the domain to which you want to join the CIFS server.
- The DNS servers must contain the service location records that are needed to locate the Active Directory domain services.
- The cluster time must be synchronized to within five minutes of the Active Directory domain controller.

## Performance monitoring

Performance of the SVM can be monitored by the `metric.*` and `statistics.*` properties. These show the performance of the SVM in terms of IOPS, latency and throughput. The `metric.*` properties denote an average whereas `statistics.*` properties denote a real-time monotonically increasing value aggregated across all nodes.

### Information on the CIFS server

You must keep the following in mind when creating the CIFS server:

- The CIFS server name might or might not be the same as the SVM name.
- The CIFS server name can be up to 15 characters in length.
- The following characters are not allowed: @ # * ( ) = + [ ] | ; : " , < > \ / ?
- You must use the FQDN when specifying the domain.
- The default is to add the CIFS server machine account to the Active Directory "CN=Computer" object.
- You can choose to add the CIFS server to a different organizational unit (OU) by specifying the "organizational_unit" parameter. When specifying the OU, do not specify the domain portion of the distinguished name; only specify the OU or CN portion of the distinguished name. ONTAP appends the value provided for the required "-domain" parameter onto the value provided for the "-ou" parameter to create the Active Directory distinguished name, which is used when joining the Active Directory domain.
- You can optionally choose to add a text comment of up to 48 characters about the CIFS server. If there is a space in the comment text, you must enclose the entire string in quotation marks.
- You can optionally choose to add a comma-delimited list of one or more NetBIOS aliases for the CIFS server.
- The initial administrative status of the CIFS server is "up".
- The large-mtu and multichannel features are enabled for the new CIFS server.
- If LDAP is configured with the use_start_tls and session_security features, the new CIFS server will also have this property set.

## Examples

### Creating a CIFS server

To create a CIFS server, use the following API. Note the return_records=true query parameter used to obtain the newly created entry in the response.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsService

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = CifsService()
        resource.ad_domain.fqdn = "CIFS-2008R2-AD.GDL.ENGLAB.NETAPP.COM"
        resource.ad_domain.organizational_unit = "CN=Computers"
        resource.ad_domain.password = "cifs*123"
        resource.ad_domain.user = "administrator"
        resource.comment = "This CIFS Server Belongs to CS Department"
        resource.default_unix_user = "string"
        resource.enabled = True
        resource.name = "CIFS-DOC"
        resource.netbios.aliases = ["ALIAS_1", "ALIAS_2", "ALIAS_3"]
        resource.netbios.enabled = False
        resource.netbios.wins_servers = ["10.224.65.20", "10.224.65.21"]
        resource.security.kdc_encryption = False
        resource.security.encrypt_dc_connection = False
        resource.security.restrict_anonymous = "no_enumeration"
        resource.security.smb_encryption = False
        resource.security.smb_signing = False
        resource.svm.name = "vs1"
        resource.svm.uuid = "ef087155-f9e2-11e8-ac52-0050568ea248"
        resource.post(hydrate=True)
        print(resource)

Try it out

    CifsService(
        {
            "netbios": {
                "aliases": ["ALIAS_1", "ALIAS_2", "ALIAS_3"],
                "wins_servers": ["10.224.65.20", "10.224.65.21"],
                "enabled": False,
            },
            "enabled": True,
            "default_unix_user": "string",
            "ad_domain": {
                "fqdn": "CIFS-2008R2-AD.GDL.ENGLAB.NETAPP.COM",
                "user": "administrator",
                "password": "cifs*123",
                "organizational_unit": "CN=Computers",
            },
            "comment": "This CIFS Server Belongs to CS Department",
            "svm": {"name": "vs1", "uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13"},
            "name": "CIFS-DOC",
            "security": {
                "kdc_encryption": False,
                "restrict_anonymous": "no_enumeration",
                "smb_encryption": False,
                "encrypt_dc_connection": False,
                "smb_signing": False,
            },
        }
    )

### Retrieving the full CIFS server configuration for all SVMs in the cluster

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsService

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        print(list(CifsService.get_collection(fields="*", return_timeout=15)))

Try it out

    [
        CifsService(
            {
                "netbios": {
                    "aliases": ["ALIAS_1", "ALIAS_2", "ALIAS_3"],
                    "wins_servers": ["10.224.65.20", "10.224.65.21"],
                    "enabled": False,
                },
                "enabled": True,
                "default_unix_user": "string",
                "ad_domain": {
                    "fqdn": "CIFS-2008R2-AD.GDL.ENGLAB.NETAPP.COM",
                    "organizational_unit": "CN=Computers",
                },
                "comment": "This CIFS Server Belongs to CS Department",
                "svm": {"name": "vs1", "uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13"},
                "name": "CIFS-DOC",
                "security": {
                    "kdc_encryption": False,
                    "lm_compatibility_level": "lm_ntlm_ntlmv2_krb",
                    "restrict_anonymous": "no_enumeration",
                    "smb_encryption": False,
                    "encrypt_dc_connection": False,
                    "smb_signing": False,
                },
            }
        )
    ]

### Retrieving CIFS server configuration details for a specific SVM

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsService

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = CifsService(**{"svm.uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13"})
        resource.get()
        print(resource)

Try it out

    CifsService(
        {
            "netbios": {
                "aliases": ["ALIAS_1", "ALIAS_2", "ALIAS_3"],
                "wins_servers": ["10.224.65.20", "10.224.65.21"],
                "enabled": False,
            },
            "enabled": True,
            "default_unix_user": "string",
            "ad_domain": {
                "fqdn": "CIFS-2008R2-AD.GDL.ENGLAB.NETAPP.COM",
                "organizational_unit": "CN=Computers",
            },
            "comment": "This CIFS Server Belongs to CS Department",
            "svm": {"name": "vs1", "uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13"},
            "name": "CIFS-DOC",
            "security": {
                "kdc_encryption": False,
                "lm_compatibility_level": "lm_ntlm_ntlmv2_krb",
                "restrict_anonymous": "no_enumeration",
                "smb_encryption": False,
                "encrypt_dc_connection": False,
                "smb_signing": False,
            },
        }
    )

### Updating CIFS server properties for the specified SVM

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsService

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = CifsService(**{"svm.uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13"})
        resource.comment = "CIFS SERVER MODIFICATION"
        resource.patch()

### Removing a CIFS server for a specific SVM

To delete a CIFS server, use the following API. This will delete the CIFS server along with other CIFS configurations such as CIFS share, share ACLs, homedir search-path, and so on.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsService

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = CifsService(**{"svm.uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13"})
        resource.delete(
            body={"ad_domain": {"password": "cifs*123", "user": "administrator"}}
        )

## Classes

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

  Allows interaction with CifsService 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 count_collection(*args, connection: HostConnection = None, **kwargs) -> int`

    Retrieves CIFS servers.

    ### Expensive properties

    There is an added cost to retrieving values for these properties. They are not included by default in GET results and must be explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more. * `statistics.*` * `metric.*`

    ### Related ONTAP commands

    - `vserver cifs server show`
    - `vserver cifs server options show`
    - `vserver cifs server security show`

    ### Learn more

    - `DOC /protocols/cifs/services`

    Fetch a count of all objects of this type from the host.

    This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.

    ## 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 get the count of bars for a particular foo, the foo.name value should be passed.
    `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. These query parameters can affect the count. A return_records query param will be ignored.

    ## Returns

    On success, returns an integer count of the objects of this type. On failure, returns -1.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library.

  `def delete_collection(*args, body: typing.Union = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Deletes a CIFS server and related CIFS configurations.

    ### Related ONTAP commands

    - `vserver cifs server delete`
    - `vserver cifs remove-netbios-aliases`

    ### Learn more

    - `DOC /protocols/cifs/services`

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

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

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

  `def find(*args, connection: HostConnection = None, **kwargs) -> Resource`

    Retrieves CIFS servers.

    ### Expensive properties

    There is an added cost to retrieving values for these properties. They are not included by default in GET results and must be explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more. * `statistics.*` * `metric.*`

    ### Related ONTAP commands

    - `vserver cifs server show`
    - `vserver cifs server options show`
    - `vserver cifs server security show`

    ### Learn more

    - `DOC /protocols/cifs/services`

    Find an instance of an object on the host given a query.

    The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found, None will be returned. If more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.

    ## 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 find a bar for a particular foo, the foo.name value should be passed.
    `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.

    ## Returns

    A `Resource` object containing the details of the object or None if no matches were found.

    ## Raises

    `NetAppRestError`: If the API call returned more than 1 matching resource.

  `def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> typing.Iterable`

    Retrieves CIFS servers.

    ### Expensive properties

    There is an added cost to retrieving values for these properties. They are not included by default in GET results and must be explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more. * `statistics.*` * `metric.*`

    ### Related ONTAP commands

    - `vserver cifs server show`
    - `vserver cifs server options show`
    - `vserver cifs server security show`

    ### Learn more

    - `DOC /protocols/cifs/services`

    Fetch a list of all objects of this type from the host.

    This is a lazy fetch, making API calls only as necessary when the result of this call is iterated over. For instance, if max_records is set to 5, then iterating over the collection causes an API call to be sent to the server once for every 5 records. If the client stops iterating before getting to the 6th record, then no additional API calls are made.

    ## 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 get the collection of bars for a particular foo, the foo.name value should be passed.
    `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.
    `max_records`
      The maximum number of records to return per call
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A list of `Resource` objects

    ## Raises

    `NetAppRestError`: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

  `def patch_collection(body: dict, *args, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Updates both the mandatory and optional parameters of the CIFS configuration. Ensure the CIFS server is administratively disabled when renaming the CIFS server or modifying the ad_domain properties.

    ### Related ONTAP commands

    - `vserver cifs server modify`
    - `vserver cifs server options modify`
    - `vserver cifs security modify`
    - `vserver cifs server add-netbios-aliases`
    - `vserver cifs server remove-netbios-aliases`

    ### Learn more

    - `DOC /protocols/cifs/services`

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

  ### 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 CIFS server and related CIFS configurations.

    ### Related ONTAP commands

    - `vserver cifs server delete`
    - `vserver cifs remove-netbios-aliases`

    ### Learn more

    - `DOC /protocols/cifs/services`

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

    Retrieves a CIFS server.

    ### Related ONTAP commands

    - `vserver cifs server show`
    - `vserver cifs server options show`
    - `vserver cifs server security show`

    ### Learn more

    - `DOC /protocols/cifs/services`

    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: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse`

    Updates both the mandatory and optional parameters of the CIFS configuration. Ensure the CIFS server is administratively disabled when renaming the CIFS server or modifying the ad_domain properties.

    ### Related ONTAP commands

    - `vserver cifs server modify`
    - `vserver cifs server options modify`
    - `vserver cifs security modify`
    - `vserver cifs server add-netbios-aliases`
    - `vserver cifs server remove-netbios-aliases`

    ### Learn more

    - `DOC /protocols/cifs/services`

    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.
    `**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: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse`

    Creates a CIFS server. Each SVM can have one CIFS server.

    ### Important notes

    - The CIFS server name might or might not be the same as the SVM name.
    - The CIFS server name can contain up to 15 characters.
    - The CIFS server name does not support the following characters: @ # * ( ) = + [ ] | ; : " , < > / ?

    ### Required properties

    - `svm.uuid` or `svm.name` - Existing SVM in which to create the CIFS server.
    - `name` - Name of the CIFS server.
    - `ad_domain.fqdn` - Fully qualified domain name of the Windows Active Directory to which this CIFS server belongs.
    - `ad_domain.user` - User account with the access to add the CIFS server to the Active Directory.
    - `ad_domain.password` - Account password used to add this CIFS server to the Active Directory.

    ### Recommended optional properties

    - `comment` - Add a text comment of up to 48 characters about the CIFS server.
    - `netbios.aliases` - Add a comma-delimited list of one or more NetBIOS aliases for the CIFS server.
    - `netbios.wins_servers` - Add a list of Windows Internet Name Server (WINS) addresses that manage and map the NetBIOS name of the CIFS server to their network IP addresses. The IP addresses must be IPv4 addresses.

    ### Default property values

    If not specified in POST, the following default property values are assigned: * `ad_domain.organizational_unit` - CN=Computers * `enabled` - true * `restrict_anonymous` - no_enumeration * `smb_signing` - false * `smb_encryption` - false * `encrypt_dc_connection` - false * `kdc_encryption` - false * `default_unix_user` - pcuser * `netbios_enabled` - false However, if either "netbios.wins-server" or "netbios.aliases" is set during POST and if `netbios_enabled` is not specified then `netbios_enabled` is set to true.

    ### Related ONTAP commands

    - `vserver cifs server create`
    - `vserver cifs server options modify`
    - `vserver cifs security modify`
    - `vserver cifs server add-netbios-aliases`

    ### Learn more

    - `DOC /protocols/cifs/services`

    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 CifsServiceSchema (*, 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 CifsService object

  ### Ancestors

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

  ### Class variables

  `ad_domain GET POST PATCH`

    The ad_domain field of the cifs_service.

  `comment GET POST PATCH`

    A descriptive text comment for the CIFS server. SMB clients can see the CIFS server comment when browsing servers on the network. If there is a space in the comment, you must enclose the entire string in quotation marks.

    Example: This CIFS Server Belongs to CS Department

  `default_unix_user GET POST PATCH`

    Specifies the UNIX user to which any authenticated CIFS user is mapped to, if the normal user mapping rules fails.

  `enabled GET POST PATCH`

    Specifies if the CIFS service is administratively enabled.

  `links GET`

    The links field of the cifs_service.

  `metric GET POST PATCH`

    The metric field of the cifs_service.

  `name GET POST PATCH`

    The name of the CIFS server.

    Example: CIFS1

  `netbios GET POST PATCH`

    The netbios field of the cifs_service.

  `security GET POST PATCH`

    The security field of the cifs_service.

  `statistics GET POST PATCH`

    The statistics field of the cifs_service.

  `svm GET POST PATCH`

    The svm field of the cifs_service.